:root {
    /* Strict 7-Color Palette */
    --col-bg-main: #18282D;
    --col-bg-surface: #33373A;
    --col-accent-deep: #A84557;
    --col-accent-warm: #D97566;
    --col-text-highlight: #F9CE8A;
    --col-accent-cool: #476F71;
    --col-text-primary: #AEBAA6;
    --col-btc-sec: #4A5240;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--col-bg-main);
    background-image: url("img/cartographer.webp");
    color: var(--col-text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--col-text-highlight);
}

/* --- Site Header --- */
#site-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 0 auto 10px auto;
    width: 800px;
    box-sizing: border-box;
}

#header-controls {
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 100%;
    justify-content: flex-end;
}

#header-branding {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    justify-content: flex-start;
    /* Changed from center to flex-start */
    position: relative;
}

#header-branding #header-logo {
    position: static;
    left: auto;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
    /* Softer, matching div shadow style */
}

#header-branding h1 {
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    /* Softer text shadow */
}

#header-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

/* ========================================
   ONBOARDING SCREEN
   ======================================== */

#onboarding-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    max-width: 800px;
    margin: 0 auto;
}

#onboarding-header {
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 40px;
}

#onboarding-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

#onboarding-logo {
    width: 150px;
    height: 150px;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}

#onboarding-title {
    font-size: 2.5rem;
    text-align: center;
    margin: 0;
    color: var(--col-text-highlight);
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.onboarding-start-btn {
    padding: 15px 40px;
    font-size: 1.3em;
    max-width: none !important;
    width: fit-content !important;
    margin-bottom: 40px;
    background-color: var(--col-accent-deep);
    white-space: nowrap;
}

.onboarding-start-btn:hover {
    filter: brightness(1.1);
    transform: scale(1.02);
}

#onboarding-info {
    background-color: var(--col-bg-surface);
    border: 1px solid var(--col-accent-cool);
    border-radius: 0;
    padding: 30px;
    max-width: 700px;
    width: 100%;
    box-sizing: border-box;
    line-height: 1.6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#onboarding-info h2 {
    text-align: center;
    margin-top: 0;
}

#onboarding-info h3 {
    margin-top: 25px;
    margin-bottom: 10px;
}

#onboarding-info ul {
    padding-left: 20px;
}

#onboarding-info li {
    margin-bottom: 10px;
}

#onboarding-info hr {
    border: none;
    border-top: 1px solid var(--col-accent-cool);
    margin: 25px 0;
}

#onboarding-info p:last-child {
    margin-bottom: 0;
    font-size: 0.85em;
    opacity: 0.8;
}

/* Hidden states for onboarding flow */
body.onboarding-active #site-header,
body.onboarding-active #main-content {
    display: none !important;
}

body:not(.onboarding-active) #onboarding-screen {
    display: none !important;
}

/* Ensure main content shows when not onboarding */
body:not(.onboarding-active) #site-header {
    display: flex;
}

body:not(.onboarding-active) #main-content {
    display: block;
}

/* --- Layout Principal --- */
#main-container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    width: 100%;
    justify-content: center;
}

/* Standard Width Containers */
#info-container,
#bottom-container,
#calendar-container {
    width: 800px;
    /* Desktop default (matches map size roughly) */
    /*max-width: 100%;*/
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

#map-container {
    position: relative;
    width: 1000px;
    height: 1000px;
    margin-top: -230px;
    margin-bottom: -230px;
    /* border: 1px solid #ccc; Removed default border */
}

#controls-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 300px;
}

/* --- Hexagon Styles --- */
.hexagon {
    stroke: var(--col-accent-cool);
    stroke-width: 2;
    transition: stroke 0.3s;
}

.hex-group {
    cursor: pointer;
}

.hex-bg {
    fill: transparent;
    transition: fill 0.3s;
}

.hex-group:hover .hex-bg {
    fill: var(--col-accent-cool);
}

.hex-group:hover .hexagon {
    stroke: var(--col-text-highlight);
}

.hexagon.selected-modal-hex {
    stroke: var(--col-text-highlight) !important;
    stroke-width: 5 !important;
    filter: drop-shadow(0 0 8px var(--col-text-highlight));
}

#modal-map-container .hex-group:hover .hexagon {
    stroke: var(--col-accent-cool);
}

/* --- Solitary Hexagon --- */
#solitary-hexagon-container {
    width: 100px;
    height: 100px;
    margin: 0 auto;
}

#solitary-hexagon-svg,
#solitary-terrain-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* --- Bottom Container --- */
#bottom-container {
    display: flex;
    flex-direction: row;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
    margin-top: 20px;
    /* height: 400px; removed to allow growth */
}

#bottom-left-column {
    display: flex;
    flex-direction: column;
    width: 30%;
    height: auto;
    min-height: 150px;
    gap: 10px;
    order: 2;
    /* Swap visual order on desktop: Control column to the right */
}

/* --- Selected Hexagon Display --- */
#selected-hexweather-container {
    width: 100%;
    height: auto;
    min-height: 150px;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    border: 1px solid var(--col-accent-cool);
    border-radius: 0px;
    background-color: var(--col-bg-surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    color: var(--col-text-primary);
    cursor: pointer;
    transition: border-color 0.3s, color 0.3s;
    overflow: hidden;
}

#selected-hexweather-container:hover {
    /* Border color change removed */
    color: var(--col-text-highlight);
}

#selected-hexweather-container:hover .hexagon {
    stroke: var(--col-text-highlight);
    filter: drop-shadow(0 0 5px var(--col-text-highlight));
}

#selected-hexweather-container img {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

/* --- Terrain Selection --- */
#selected-terrain {
    width: 100%;
    height: auto;
    min-height: 150px;
    border: 1px solid var(--col-accent-cool);
    border-radius: 0px;
    background-color: var(--col-bg-surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

#selected-terrain:hover .hexagon {
    stroke: var(--col-text-highlight);
    filter: drop-shadow(0 0 5px var(--col-text-highlight));
}

#selected-terrain img {
    width: auto;
    height: auto;
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    display: none;
    /* Hidden by default */
}

#selected-terrain .masthead-icon img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
}

/* --- Info Display --- */
#info-display {
    padding: 0;
    border: 1px solid var(--col-accent-cool);
    background-color: var(--col-bg-surface);
    border-radius: 0px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    min-height: 100px;
    font-size: 0.9em;
    color: var(--col-text-primary);
    overflow: hidden;
}

#info-display-text {
    padding: 15px;
}

/* --- Tables --- */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--col-bg-surface);
    color: var(--col-text-primary);
    border-radius: 8px;
    overflow: hidden;
}

th,
td {
    border: 1px solid var(--col-bg-main);
    padding: 8px;
    text-align: center;
}

th {
    background-color: var(--col-accent-cool);
    color: var(--col-bg-main);
    /* Contrast */
    font-weight: bold;
}

tr:nth-child(even) {
    background-color: rgba(70, 66, 67, 0.5);
    /* Slightly lighter surface */
}

tr.selected {
    background-color: var(--col-accent-deep);
    color: var(--col-text-highlight);
}

tr:hover:not(th) {
    background-color: var(--col-bg-main);
    cursor: pointer;
}

/* --- Standardized Buttons --- */
.std-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 20px;
    font-family: inherit;
    font-weight: bold;
    text-transform: uppercase;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: var(--col-text-primary) !important;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
    flex: 1;
    max-width: 200px;
}

.std-btn:active {
    transform: scale(0.95);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.std-btn img.btn-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    /* Optional: filter to match text if needed, but user just said text color */
}

/* Button Specific Backgrounds */
#btn-initial-start,
#btn-save-game,
#btn-start-game,
#btn-roll-nav,
#btn-roll-temp,
#btn-caminhar,
#btn-advance-day,
#btn-edit-entry,
.btn-edit-entry,
#btn-cancel-edit,
.tool-btn.active,
#modal-btn-cancel-edit,
.btn-edit-entry-modal {
    background-color: var(--col-accent-deep);
}

#btn-load-game,
#btn-permanecer {
    background-color: var(--col-btc-sec);
}

#btn-reset-game,
#btn-info-game,
#btn-save-entry,
#modal-btn-save-entry,
#btn-update-entry,
#modal-btn-update-entry,
#btn-add-entry-modal {
    background-color: var(--col-accent-cool);
}

.header-btn {
    background-color: var(--col-text-highlight) !important;
    color: var(--col-bg-surface) !important;
}

.header-btn .btn-icon {
    width: 14px;
    height: 14px;
}

/* --- Modals --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(30, 49, 56, 0.9);
    /* #1E3138 with opacity */
}

.modal-content {
    background-color: var(--col-bg-surface);
    margin: 5% auto;
    padding: 0;
    border: 1px solid var(--col-accent-cool);
    width: 90%;
    max-width: 1000px;
    border-radius: 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    /* Keep shadow for depth, but could use color */
    display: flex;
    flex-direction: column;
    /* Changed from row to column for Header/Body layout */
    gap: 0;
    color: var(--col-text-primary);
    position: relative;
    overflow: hidden;
    /* For absolute positioning of close button */
}

.close-button {
    color: var(--col-text-primary);
    position: absolute;
    right: 15px;
    /* Move to right */
    top: 50%;
    transform: translateY(-50%);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    left: auto;
    /* reset left */
}

.close-button:hover,
.close-button:focus {
    color: var(--col-accent-warm);
    text-decoration: none;
}

#modal-left-column {
    display: flex;
    flex-direction: column;
    width: 60%;
    align-items: center;
    position: relative;
    z-index: 5;
}

#modal-controls-container {
    display: flex;
    flex-direction: column;
    width: 40%;
    position: relative;
    z-index: 20;
}

#general-info-modal {
    z-index: 2000;
}

#modal-map-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

#modal-map-container h3 {
    margin-bottom: 0px;
    margin-top: 0;
    position: relative;
    z-index: 5;
    padding-top: 20px;
    /* Ensure it stays above if overlapping */
}

#modal-map-container h2 {
    margin-bottom: 0;
}

#text-window {
    margin-top: 15px;
    padding: 10px;
    background-color: var(--col-bg-main);
    border: 1px solid var(--col-accent-cool);
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    color: var(--col-text-primary);
    min-height: 50px;
    /* Ensure visibility */
}

#text-window b {
    display: block;
    text-align: center;
    margin-bottom: 5px;
}

/* --- Terrain Modal Grid --- */
#terrain-modal h2 {
    text-align: center;
}

#terrain-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    padding: 10px;
}

.terrain-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    border: none;
    transition: background-color 0.2s;
}

.terrain-item:hover {
    background-color: var(--col-bg-main);
}

.terrain-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 5px;
    border: 1px solid var(--col-text-primary);
}

.terrain-item span {
    text-align: center;
    font-size: 0.9em;
    color: var(--col-text-primary);
}

/* --- Calendar Styles --- */
#calendar-container {
    text-align: center;
    margin-top: 0;
    padding: 0;
    background: var(--col-bg-surface);
    border: 1px solid var(--col-accent-cool);
    border-radius: 0px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    flex: 1;
    width: auto;
    max-width: none;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    order: 1;
    /* Swap visual order on desktop: Calendar to the left */
}

#calendar-content-wrapper {
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#current-day-display {
    font-size: 1em;
    font-weight: bold;
    color: var(--col-text-highlight);
    padding: 0;
    background-color: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    width: auto;
    box-sizing: border-box;
    display: block;
    min-height: auto;
    flex-grow: 1;
    text-align: center;
}

#travel-controls {
    display: flex;
    gap: 15px;
    width: 100%;
    justify-content: center;
    align-items: flex-start;
}

.btn-icon {
    width: 24px;
    height: 24px;
}

.travel-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
    box-shadow: none;
}

#btn-advance-day.visible {
    display: block;
}

.caminhar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex: 1;
    max-width: 200px;
}

.caminhar-container #btn-caminhar {
    width: 100%;
    max-width: none;
    /* Let container control width */
}

/* --- Calendar Modal Styles --- */
#calendar-modal .modal-content,
#terrain-modal .modal-content {
    flex-direction: column !important;
}

#calendar-modal h2 {
    text-align: center;
}

#calendar-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
    padding: 5px;
    /* Add padding for scrollbar space */
}

/* Scrollbar styling for dark theme */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--col-bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--col-accent-cool);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--col-text-primary);
}

.calendar-day-item {
    width: 60px;
    height: 60px;
    border: 1px solid var(--col-accent-cool);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 5px;
    background-color: var(--col-bg-main);
    flex-direction: column;
    font-size: 0.8em;
    color: var(--col-text-primary);
}

.calendar-day-item:hover {
    background-color: var(--col-bg-surface);
    border-color: var(--col-text-highlight);
}

.calendar-day-item.selected {
    border-color: var(--col-text-highlight);
    background-color: var(--col-bg-surface);
    color: var(--col-text-highlight);
    font-weight: bold;
    box-shadow: 0 0 5px var(--col-text-highlight);
}

.calendar-day-item.viewing-day {
    background-color: var(--col-accent-deep);
    color: var(--col-text-highlight);
    border-color: var(--col-text-highlight);
}

#day-details,
#day-details-main {
    border-top: 1px solid var(--col-accent-cool);
    text-align: left;
    width: 100%;
    color: var(--col-text-primary);
}

.quarter-detail {
    margin-bottom: 10px;
    padding: 5px;
    border-bottom: 1px solid var(--col-bg-main);
}


#temperature-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    /* Slightly reduce font size */
}

#temperature-table tr td:first-child {
    font-weight: bold;
    font-size: 1.1em;
    width: 30%;
}

#temperature-table tr td:nth-child(2) {
    text-align: left;
}

#temperature-table tr.selected-row {
    background-color: var(--col-accent-deep);
    color: var(--col-text-highlight);
}

#temperature-table tr:first-child {
    pointer-events: none;
    cursor: default;
    background-color: var(--col-bg-main);
    font-weight: bold;
}

#temperature-container {
    text-align: center;
    border: 1px solid var(--col-accent-cool);
    border-radius: 0;
    padding: 0;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}


#temperature-container .subtitle {
    font-size: 0.85em;
    color: var(--col-text-primary);
    margin: 0 0 10px 0;
    max-width: 250px;
    line-height: 1.4;
}

.quarter-title {
    font-weight: bold;
    font-size: 0.9em;
    color: var(--col-text-highlight);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
}

.quarter-note-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    margin-left: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: transform 0.2s, opacity 0.2s;
}

.quarter-note-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.quarter-note-btn img {
    width: 16px;
    height: 16px;
    filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.5));
}

.slot-detail {
    display: flex;
    align-items: center;
    margin-left: 10px;
    font-size: 0.85em;
    margin-bottom: 2px;
    gap: 5px;
}

.slot-detail span:first-child {
    min-width: 95px;
}

.text-desbravou {
    color: var(--col-accent-warm);
    font-weight: bold;
}

.text-permanecer {
    color: var(--col-text-primary);
}

.slot-detail img {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid var(--col-text-primary);
}

.weather-detail {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--col-bg-main);
}

.weather-images {
    display: flex;
    gap: 10px;
    margin-top: 5px;
    align-items: center;
}

.quarter-detail.current-quarter {
    background-color: rgba(249, 206, 138, 0.1);
    border-left: 2px solid var(--col-text-highlight);
    padding-left: 8px;
    margin-left: -10px;
    /* Counteract padding to align */
    padding-right: 5px;
    border-radius: 0 4px 4px 0;
}

.weather-images img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border: 1px solid var(--col-accent-cool);
    border-radius: 4px;
    background-color: var(--col-bg-main);
}

.weather-images .temp-badge {
    height: 40px;
    width: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--col-text-primary);
}

.temp-badge img {
    width: 30px;
    height: 30px;
    padding: 5px;
}

.source-tag {
    height: 15px;
    width: 15px;
    vertical-align: bottom;
    margin-top: 5px;
    margin-right: 2px;
    border: 1px solid var(--col-accent-cool);
    border-radius: 4px;
    background-color: var(--col-bg-main);
    padding: 2px;
    cursor: pointer;
    display: inline-block;
}

#weather-navigation {
    text-align: center;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Was center, flex-start is better for masthead */
    border: 1px solid var(--col-accent-cool);
    border-radius: 0;
    padding: 0;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.container-content {
    padding: 10px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}


#weather-navigation .subtitle {
    font-size: 0.85em;
    color: var(--col-text-primary);
    margin: 0 0 -15px 0;
    max-width: 250px;
    line-height: 1.4;
}

#weather-navigation .hex-group {
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.2s;
}



#weather-nav-svg {
    width: 200px;
    height: 200px;
    /* border: 1px solid var(--col-accent-cool); Optional: for debugging/visual boundary */
}

#weather-nav-svg .hexagon {
    stroke: var(--col-accent-cool);
    transition: stroke 0.3s, stroke-width 0.3s;
}

#weather-nav-svg text {
    fill: var(--col-text-primary);
    transition: fill 0.3s;
    pointer-events: none;
    /* Let clicks pass through text to group */
}

/* Dice Roller Styles */
#dice-container-nav,
#dice-container-temp {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.dice-wrapper {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.die-d12 {
    width: 60px;
    height: 60px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s;
    cursor: pointer;
}

.d12-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 3px var(--col-accent-deep));
}

.die-number {
    position: absolute;
    font-weight: bold;
    font-size: 18px;
    color: var(--col-accent-deep);
    text-shadow: 0 0 3px var(--col-accent-deep);
    z-index: 1;
}

.die-d12.shake {
    animation: shake 0.5s;
    animation-iteration-count: infinite;
}

.die-d12:hover {
    transform: scale(1.05);
}

.die {
    width: 50px;
    height: 50px;
    background-color: var(--col-text-primary);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), 0 0 5px var(--col-accent-deep);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    color: var(--col-accent-deep);
    text-shadow: 0 0 3px var(--col-accent-deep);
    box-sizing: border-box;
    border: 1px solid var(--col-accent-deep);
    transition: transform 0.2s, border-color 0.2s;
    cursor: pointer;
}

.d12-svg polygon,
.d12-svg line {
    stroke: var(--col-accent-deep) !important;
}

.d12-svg polygon:first-child {
    fill: var(--col-text-primary) !important;
}

@keyframes shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-1deg);
    }
}

.die.shake {
    animation: shake 0.5s;
    animation-iteration-count: infinite;
}

.die:hover {
    transform: scale(1.05);
    border-color: var(--col-text-highlight);
}

/* Selected State for Weather Navigation */
#weather-navigation .hex-group.selected-nav-hex .hexagon {
    stroke: var(--col-accent-deep) !important;
    stroke-width: 3 !important;
    filter: drop-shadow(0 0 3px var(--col-accent-deep));
}

#weather-navigation .hex-group.selected-nav-hex text {
    fill: var(--col-accent-deep) !important;
    font-weight: bold;
}

#weather-navigation .hex-group[data-nav-name="3N"] text {
    fill: var(--col-accent-deep) !important;
}

/* Utility Class for Toggling Visibility */
.hidden {
    display: none !important;
}

/* --- Map Marker Styles --- */
#map-container {
    position: relative;
    /* Ensure aspect ratio matches SVG to prevent misalignment */
    aspect-ratio: 800 / 600;
}

#grid-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* --- Toggle Switch Styles --- */
.controls {
    position: absolute;
    bottom: 15px;
    left: 15px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 4px;
    background-color: rgba(30, 49, 56, 0.6);
    /* More transparent background */
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid var(--col-accent-cool);
    opacity: 0.7;
    transition: opacity 0.3s;
    transform: scale(0.8);
    /* Scale down the whole control */
    transform-origin: bottom left;
}

.controls:hover {
    opacity: 1;
    background-color: rgba(30, 49, 56, 0.9);
}

.controls label:not(.switch) {
    font-size: 0.7em;
    color: var(--col-text-highlight);
    font-weight: bold;
    cursor: pointer;
}

.switch {
    position: relative;
    display: inline-block;
    width: 30px;
    height: 16px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--col-bg-surface);
    transition: .4s;
    border: 1px solid var(--col-accent-cool);
}

.slider:before {
    position: absolute;
    content: "";
    height: 10px;
    width: 10px;
    left: 2px;
    bottom: 2px;
    background-color: var(--col-text-primary);
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--col-accent-cool);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--col-accent-cool);
}

input:checked+.slider:before {
    transform: translateX(14px);
    background-color: var(--col-text-highlight);
}

/* Rounded sliders */
.slider.round {
    border-radius: 16px;
}

.slider.round:before {
    border-radius: 50%;
}

.mounted-switch-container {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--col-accent-cool);
    font-weight: bold;
    font-size: 0.8em;
}

.mounted-switch-container:has(input:checked) {
    color: var(--col-text-highlight);
}

.mounted-switch-container .switch {
    width: 20px;
    height: 10px;
}

.mounted-switch-container .slider:before {
    height: 6px;
    width: 6px;
    left: 2px;
    bottom: 2px;
}

/* Disabled State Styles */
button.disabled,
#die-d12.disabled,
#btn-roll-temp.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
    filter: grayscale(100%);
}

.disabled-container {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(80%);
}

.faded-row {
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(100%);
}

.mounted-switch-container input:checked+.slider:before {
    transform: translateX(10px);
}

/* --- Start Game Modal --- */
.start-game-content {
    max-width: 400px;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 5px;
    text-align: left;
}

.form-group label {
    font-weight: bold;
    color: var(--col-text-highlight);
}

.form-group select,
.form-group input {
    padding: 10px;
    border-radius: 5px;
    border: 1px solid var(--col-accent-cool);
    background-color: var(--col-bg-main);
    color: var(--col-text-primary);
    font-size: 1em;
}

/* --- Info Modal --- */
#info-modal .modal-content {
    max-width: 600px;
    flex-direction: column;
    align-items: center;
    gap: 0;
    /* Let body handle gap */
    max-height: 80vh;
    overflow-y: hidden;
    /* Scroll body, not wrapper */
}

.modal-body-split {
    display: flex;
    flex-direction: row;
    gap: 20px;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
    height: 100%;
    overflow: hidden;
    /* Let children manage scroll if needed */
}

.modal-body-column {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
}

#info-content {
    text-align: justify;
    line-height: 1.6;
    padding: 20px;
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
}

#info-content p {
    margin-bottom: 1em;
}

/* --- Journal Editor Styles --- */

/* Journal Toggle Button Container */
.journal-toggle-container {
    display: flex;
    justify-content: center;
    margin: 5px 0;
}

.journal-toggle-btn {
    background-color: var(--col-accent-cool);
    color: var(--col-text-primary);
    white-space: nowrap;
    padding: 12px 20px;
    min-width: 250px !important;
}

/* Journal Section Header */
.journal-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--col-bg-main);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.journal-section-header h3 {
    margin: 0;
    color: var(--col-bg-main);
    border: none;
    padding-bottom: 0;
}

.journal-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.journal-close-btn:hover {
    opacity: 1;
}

.journal-close-btn img {
    width: 24px;
    height: 24px;
    filter: brightness(0);
}

/* Journal Section with slide animation */


#journal-controls {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.editor-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    background-color: var(--col-bg-main);
    padding: 5px;
    border-radius: 0;
    flex-wrap: wrap;
    align-items: center;
}

.tool-btn {
    background: transparent;
    border: 1px solid var(--col-border);
    color: var(--col-text-primary);
    padding: 0px;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.2s;
    min-width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    background-color: var(--col-bg-highlight);
    border-color: var(--col-text-highlight);
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    position: relative;
    border: 1px solid transparent;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    overflow: hidden;
    background: var(--col-bg-main);
}

#journal-editor {
    min-height: 150px;
    background-color: var(--col-bg-main);
    border: 1px solid var(--col-border);
    border-radius: 0;
    padding: 10px;
    color: var(--col-text-primary);
    overflow-y: auto;
    font-family: inherit;
    line-height: 1.5;
    text-align: left;
}

#journal-editor:focus {
    outline: 2px solid var(--col-accent-cool);
    border-color: transparent;
}

#journal-editor ul,
#journal-editor ol {
    margin-left: 20px;
}

/* --- Journal Entries List --- */
.journal-entries-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
}

@keyframes flashHighlight {
    0% {
        background-color: rgba(249, 206, 138, 0.4);
    }

    100% {
        background-color: var(--col-bg-main);
    }
}

.flash-highlight {
    animation: flashHighlight 1.5s ease-out;
}

.awaiting-roll {
    border-color: var(--col-text-highlight) !important;
    box-shadow: 0 0 10px rgba(249, 206, 138, 0.3);
    transition: all 0.5s;
}

.journal-entry {
    background-color: var(--col-bg-main);
    /* Dark card background */
    border: 1px solid var(--col-bg-surface);
    border-radius: 0;
    padding: 10px;
    position: relative;
    transition: border-color 0.2s;
}

.journal-entry:hover {
    border-color: var(--col-text-highlight);
}

.journal-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    border-bottom: 1px solid var(--col-text-primary);
    /* Lighter separator */
    padding-bottom: 5px;
}

.journal-entry-quarter {
    font-weight: bold;
    color: var(--col-text-highlight);
    font-size: 0.9em;
}

.journal-entry-content {
    font-size: 0.95em;
    color: var(--col-text-primary);
    /* Keep text light on dark card */
    line-height: 1.5;
    text-align: left;
}

#journal-controls label {
    color: var(--col-bg-main);
    font-weight: bold;
}

.journal-entry-actions {
    display: flex;
    gap: 10px;
}

#journal-section {
    transition: opacity 0.3s;
}

#journal-section.disabled {
    opacity: 0.5;
    pointer-events: none;
    user-select: none;
    filter: grayscale(100%);
}


#modal-journal-section {
    background-color: var(--col-text-primary);
    border: 1px solid var(--col-accent-cool);
    border-radius: 0;
    padding: 15px;
    box-shadow: none;
    margin-top: 20px;
    color: var(--col-bg-main);
}

#modal-journal-editor {
    min-height: 150px;
    background-color: var(--col-bg-main);
    border: 1px solid var(--col-border);
    border-radius: 0;
    padding: 10px;
    color: var(--col-text-primary);
    overflow-y: auto;
    font-family: inherit;
    line-height: 1.5;
    text-align: left;
}

#modal-journal-editor:focus {
    outline: 2px solid var(--col-accent-cool);
    border-color: transparent;
}

/* --- Tooltip --- */
#terrain-tooltip {
    position: fixed;
    background-color: var(--col-bg-surface);
    color: var(--col-text-primary);
    border: 1px solid var(--col-accent-cool);
    border-radius: 5px;
    padding: 10px;
    font-size: 0.9em;
    z-index: 2000;
    pointer-events: none;
    /* Mouse passes through */
    max-width: 300px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    display: none;
    line-height: 1.4;
}

#terrain-tooltip strong {
    color: var(--col-text-highlight);
    display: block;
    margin-bottom: 5px;
}

.tool-btn.icon-only {
    padding: 0px 0px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn img {
    width: 13px;
    height: 13px;
    display: block;
    padding: 0px 0px;
}

.color-picker-wrapper:hover {
    background-color: var(--col-accent-cool);
}

.color-icon {
    width: 20px;
    height: 20px;
}

#editor-color {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Hidden file input */
#file-input-load {
    display: none;
}


/* Quarter select styling */
#journal-quarter-select,
#modal-journal-quarter-select {
    padding: 5px;
    border-radius: 4px;
    background: var(--col-bg-surface);
    color: var(--col-text-primary);
    border: 1px solid var(--col-accent-cool);
}

/* Editor toolbar separator */
.editor-toolbar .separator {
    width: 1px;
    height: 20px;
    background: #555;
    margin: 0 5px;
}

/* Journal actions container */
#journal-actions,
#modal-journal-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

/* Cancel edit button - initially hidden */
#btn-cancel-edit,
#modal-btn-cancel-edit {
    display: none;
}

#btn-update-entry,
#modal-btn-update-entry,
#btn-cancel-edit,
#modal-btn-cancel-edit {
    width: auto;
    max-width: none;
    white-space: nowrap;
    min-width: fit-content;
}

/* Initial hex subtitle - hidden by default */
#initial-hex-subtitle {
    display: none;
}

/* Terrain modal subtitle */
#terrain-modal .subtitle {
    text-align: center;
    padding: 20px 20px 0 20px;
    margin: 0;
}

/* Terrain grid padding */
#terrain-grid {
    padding: 20px;
}

/* Modal journal section - hidden by default */
#modal-journal-section {
    display: none;
    margin-top: 20px;
}

/* Modal journal controls */
#modal-journal-controls {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Start game modal padding */
.start-game-content>div:not(.masthead) {
    padding: 20px;
}

/* Info modal content padding */
#info-content {
    padding: 20px;
}

/* General info modal content */
#general-info-content {
    padding: 20px;
    font-size: 1.1em;
    line-height: 1.6;
    overflow-y: auto;
}

/* Start game form padding and layout */
.start-game-form {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

#btn-start-game {
    width: 100%;
    margin-top: 10px;
}

/* Journal Section Redesign */
#journal-section {
    border: 1px solid var(--col-accent-cool);
    border-top: none;
    /* Connects with calendar container visually or handled by layout */
    border-radius: 0;
    padding: 15px;
    background-color: var(--col-text-primary);
    margin-top: 0;
    box-sizing: border-box;
    width: 100%;
}


/* --- Toast Notification --- */
.toast {
    visibility: hidden;
    min-width: 250px;
    margin-left: -125px;
    background-color: var(--col-text-primary);
    color: var(--col-bg-main);
    text-align: center;
    border-radius: 8px;
    padding: 16px;
    position: fixed;
    z-index: 2000;
    left: 50%;
    top: 30px;
    font-size: 17px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--col-text-highlight);
    opacity: 0;
    transition: opacity 0.5s, top 0.5s;
    font-weight: bold;
}

.toast.show {
    visibility: visible;
    opacity: 1;
    top: 50px;
}

/* --- Masthead Styles --- */
.masthead {
    background-color: var(--col-bg-main);
    color: var(--col-text-highlight);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-bottom: 1px solid var(--col-accent-cool);
    width: 100%;
    box-sizing: border-box;
    min-height: 42px;
    position: relative;
}

.masthead-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* Icon is no longer absolute in general usage unless specified, 
       but for centering title with absolute icon we can keep it or use flex */
    position: absolute;
    left: 12px;
}

.masthead-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.masthead-title {
    font-weight: bold;
    font-size: 1em;
    text-align: center;
    margin: 0;
    line-height: 1.2;
    width: 100%;
    padding: 0 40px;
    box-sizing: border-box;
}

#info-display .masthead-title {
    font-size: 1.2em;
}

#general-info-modal .modal-content {
    width: 450px !important;
    max-width: 450px !important;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0 !important;
    /* Override the 5% auto */
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}


/* Mobile / Portrait (9:16 approximation) */


/* --- Highlighted Roll Terms --- */
.roll-term {
    display: inline-block;
    font-weight: bold;
    color: var(--col-text-primary);
    background-color: var(--col-bg-main);
    border: 1px solid var(--col-accent-cool);
    border-radius: 4px;
    padding: 0 5px;
    margin: 0 2px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9em;
    vertical-align: middle;
    line-height: 1.4;
}

.roll-term:hover {
    background-color: var(--col-accent-cool);
    color: var(--col-bg-main);
    border-color: var(--col-text-highlight);
    box-shadow: 0 0 5px var(--col-accent-cool);
}

/* ========================================
   ORACLE DECK STYLES
   ======================================== */

/* --- Deck Container --- */
#deck-container {
    width: 100%;
    height: auto;
    min-height: 300px;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    border: 1px solid var(--col-accent-cool);
    border-radius: 0;
    background-color: var(--col-bg-surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    color: var(--col-text-primary);
    cursor: pointer;
    transition: border-color 0.3s, color 0.3s;
    overflow: hidden;
}

#deck-container:hover {
    color: var(--col-text-highlight);
    border-color: var(--col-text-highlight);
}

#deck-container-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 10px;
    gap: 10px;
}

#deck-card-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    width: 100%;
    min-height: 0;
}

#deck-card-preview .card-back,
#deck-card-preview .playing-card {
    height: calc(100% - 10px);
    width: auto;
    min-height: 150px;
    aspect-ratio: 5 / 7;
}

#deck-card-preview .card-back {
    height: 150px;
    width: auto;
    aspect-ratio: 5 / 7;
}

#deck-card-preview .card-rank {
    font-size: 2em;
}

#deck-card-preview .card-suit {
    font-size: 1.8em;
}

#deck-card-preview .card-suit-large {
    font-size: 5em;
}

#deck-card-preview .card-top-left {
    top: 8px;
    left: 10px;
}

#deck-card-preview .card-bottom-right {
    bottom: 8px;
    right: 10px;
    left: auto;
}

#deck-container-counters {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.85em;
}

.pile-counter-group {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.pile-label {
    color: var(--col-text-primary);
    opacity: 0.8;
}

.pile-count {
    font-weight: bold;
    color: var(--col-text-highlight);
}

/* --- Playing Card Styles --- */
.playing-card {
    width: 80px;
    height: 112px;
    /*background: linear-gradient(145deg, #fff 0%, #f0f0f0 100%);*/
    background-color: var(--col-text-primary);
    border: 2px solid #333;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
    font-family: 'Georgia', serif;
}

.playing-card.card-mini {
    width: 50px;
    height: 70px;
    font-size: 0.7em;
}

.playing-card.card-red {
    color: var(--col-accent-deep);
}

.playing-card.card-black {
    color: var(--col-bg-main);
}

.card-corner {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: absolute;
    line-height: 1;
}

.card-top-left {
    top: 4px;
    left: 6px;
}

.card-bottom-right {
    bottom: 4px;
    right: 6px;
    transform: rotate(180deg);
}

.card-rank {
    font-size: 1.1em;
    font-weight: bold;
}

.card-suit {
    font-size: 0.9em;
}

.card-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.card-suit-large {
    font-size: 2em;
}

.playing-card.card-mini .card-suit-large {
    font-size: 1.4em;
}

.playing-card.card-mini .card-rank {
    font-size: 0.9em;
}

.playing-card.card-mini .card-suit {
    font-size: 0.7em;
}

/* --- Faded Card (non-winning in oracle) --- */
.playing-card.card-faded {
    opacity: 0.25;
    filter: grayscale(100%) brightness(0.7);
    transform: scale(0.9);
    transition: opacity 0.3s, filter 0.3s, transform 0.3s;
}


/* --- Card Back --- */
.card-back {
    width: 80px;
    height: 112px;
    background: linear-gradient(145deg, var(--col-accent-deep) 0%, #6a2a38 100%);
    border: 2px solid var(--col-bg-main);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5em;
    color: var(--col-text-highlight);
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

.card-back.card-mini {
    width: 50px;
    height: 70px;
    font-size: 1.5em;
}

.card-back.discard-empty {
    background: linear-gradient(145deg, var(--col-bg-main) 0%, #1a1a1a 100%);
    opacity: 0.5;
}

.card-back img {
    width: 60%;
    height: auto;
    max-height: 60%;
    object-fit: contain;
}

/* --- Deck Modal --- */
.deck-modal-content {
    max-width: 600px;
}

.deck-modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* --- Oracle Message --- */
.oracle-message {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--col-text-highlight);
    text-align: center;
    min-height: 40px;
    padding: 10px 20px;
    background-color: var(--col-bg-main);
    border: 1px solid var(--col-accent-cool);
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    transition: transform 0.2s;
}

.oracle-message.show {
    animation: messagePop 0.3s ease-out;
}

@keyframes messagePop {
    0% {
        transform: scale(0.95);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- Displayed Cards --- */
.displayed-cards {
    display: flex;
    gap: 15px;
    justify-content: center;
    min-height: 120px;
    align-items: center;
}

/* --- Card Draw Animation --- */
.card-draw-animation {
    animation: cardDraw 0.4s ease-out forwards;
}

@keyframes cardDraw {
    0% {
        transform: translateY(-30px) rotateY(90deg);
        opacity: 0;
    }

    50% {
        transform: translateY(-5px) rotateY(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(0) rotateY(0deg);
        opacity: 1;
    }
}

/* --- Deck Piles --- */
.deck-piles {
    display: flex;
    gap: 40px;
    justify-content: center;
}

.pile-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.pile-visual {
    position: relative;
}

.pile-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.pile-info .pile-label {
    font-size: 0.9em;
}

.pile-info .pile-count {
    font-size: 1.2em;
}

/* --- Deck Buttons --- */
.deck-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
}

.deck-btn {
    font-size: 0.65em;
    padding: 8px 12px;
    white-space: nowrap;
    background-color: var(--col-accent-deep);
    color: var(--col-text-highlight) !important;
}

/* ========================================
   DICE ROLLER STYLES
   ======================================== */

/* --- Roller Container --- */
#roller-container {
    width: 100%;
    height: auto;
    min-height: 150px;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    border: 1px solid var(--col-accent-cool);
    border-radius: 0;
    background-color: var(--col-bg-surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    color: var(--col-text-primary);
    cursor: pointer;
    transition: border-color 0.3s, color 0.3s;
    overflow: hidden;
}

#roller-container:hover {
    color: var(--col-text-highlight);
    border-color: var(--col-text-highlight);
}

#roller-container-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 15px;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

#roller-result-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 80px;
    justify-content: center;
}

.roller-placeholder {
    color: var(--col-text-primary);
    opacity: 0.7;
    font-style: italic;
}

.roller-result-summary {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.roller-result-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.roller-result-item img {
    width: 24px;
    height: 24px;
}

.roller-result-item .result-value {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--col-text-highlight);
}

/* --- Dice Roller Modal --- */
.dice-roller-modal-content {
    max-width: 700px;
}

.dice-roller-modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Quick Roll Section --- */
.dice-roller-quick-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--col-accent-cool);
}

.quick-roll-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.quick-roll-btn {
    display: inline-block;
    font-weight: bold;
    color: var(--col-text-primary);
    background-color: var(--col-bg-main);
    border: 1px solid var(--col-accent-cool);
    border-radius: 4px;
    padding: 8px 20px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85em;
    min-width: 230px;
    text-align: center;
}

.quick-roll-btn:hover {
    background-color: var(--col-accent-cool);
    color: var(--col-bg-main);
    border-color: var(--col-text-highlight);
    box-shadow: 0 0 5px var(--col-accent-cool);
}

.quick-roll-btn.active {
    background-color: var(--col-accent-deep);
    color: var(--col-text-highlight);
    border-color: var(--col-text-highlight);
    box-shadow: 0 0 8px var(--col-accent-deep);
}

.quick-roll-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-roll-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: all 0.2s;
    margin-right: 2px;
}

.info-roll-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.info-roll-btn img.btn-icon {
    width: 22px;
    height: 22px;
    filter: invert(1) drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}

.quick-roll-bonus {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--col-text-primary);
    background-color: var(--col-bg-main);
    border: 1px solid var(--col-accent-cool);
    border-radius: 4px;
    width: 40px;
    height: 34px;
    font-size: 0.85em;
}

.quick-roll-bonus.negative {
    color: var(--col-accent-warm);
}

.modifier-input-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.modifier-input-section label {
    font-weight: bold;
    color: var(--col-text-highlight);
}

.modifier-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.modifier-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--col-bg-main);
    border: 1px solid var(--col-accent-cool);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.modifier-btn:hover {
    background-color: var(--col-accent-cool);
    border-color: var(--col-text-highlight);
}

.modifier-btn img {
    width: 18px;
    height: 18px;
}

#custom-modifier {
    width: 60px;
    text-align: center;
    padding: 8px;
    font-size: 1.2em;
    font-weight: bold;
    background-color: var(--col-bg-main);
    color: var(--col-text-highlight);
    border: 1px solid var(--col-accent-cool);
    border-radius: 4px;
}

.applied-modifier-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1.1em;
    background-color: var(--col-text-highlight);
    padding: 10px 20px;
    margin-top: 10px;
    width: 230px;
}

#applied-modifier-label {
    color: var(--col-bg-surface);
    font-weight: bold;
}

#applied-modifier-value {
    font-weight: bold;
    color: var(--col-accent-cool);
    font-size: 1.3em;
}

#applied-modifier-value.negative {
    color: var(--col-accent-deep);
}

/* --- Dice Slots --- */
.dice-slots-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: linear-gradient(145deg, rgba(24, 40, 45, 0.6) 0%, rgba(51, 55, 58, 0.4) 100%);
    border: 1px solid var(--col-accent-cool);
    border-radius: 8px;
    padding: 16px;
    position: relative;
}

/* Decorative corner accents */
.dice-slots-section::before,
.dice-slots-section::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: var(--col-text-highlight);
    border-style: solid;
    opacity: 0.6;
}

.dice-slots-section::before {
    top: 8px;
    left: 8px;
    border-width: 2px 0 0 2px;
}

.dice-slots-section::after {
    bottom: 8px;
    right: 8px;
    border-width: 0 2px 2px 0;
}

.global-reset-btn {
    background-color: var(--col-accent-deep);
    align-self: center;
    font-size: 0.75em;
    padding: 6px 12px;
    margin-top: 10px;
}

.global-reset-btn .btn-icon {
    filter: invert(1);
}

.dice-slots-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dice-slot {
    background: linear-gradient(180deg, rgba(71, 111, 113, 0.5) 0%, rgba(71, 111, 113, 0.25) 100%);
    border: 1px solid var(--col-accent-cool);
    border-radius: 6px;
    padding: 0;
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 2px 8px rgba(0, 0, 0, 0.25);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.dice-slot:hover {
    border-color: var(--col-text-highlight);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(249, 206, 138, 0.1);
}

.dice-slot-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: linear-gradient(90deg, rgba(24, 40, 45, 0.9) 0%, rgba(24, 40, 45, 0.7) 100%);
    border-bottom: 1px solid rgba(71, 111, 113, 0.5);
    flex-wrap: nowrap;
}

.dice-slot-label {
    font-weight: bold;
    font-size: 0.95em;
    color: var(--col-text-highlight);
    width: 110px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.dice-amount-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.dice-amount-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--col-bg-surface);
    border: 1px solid var(--col-accent-cool);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.dice-amount-btn:hover {
    background-color: var(--col-accent-cool);
    border-color: var(--col-text-highlight);
}

.dice-amount-btn img {
    width: 16px;
    height: 16px;
}

.dice-amount-input {
    width: 50px;
    text-align: center;
    padding: 6px;
    font-size: 1.1em;
    font-weight: bold;
    background-color: var(--col-bg-surface);
    color: var(--col-text-primary);
    border: 1px solid var(--col-accent-cool);
    border-radius: 4px;
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Hide spin buttons on number input */
.dice-amount-input::-webkit-outer-spin-button,
.dice-amount-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.dice-reset-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: 1px solid var(--col-accent-cool);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: auto;
}

.dice-reset-btn:hover {
    background-color: var(--col-accent-deep);
    border-color: var(--col-accent-warm);
}

.dice-reset-btn img {
    width: 16px;
    height: 16px;
}

/* Artifact Die Select */
.artifact-die-select {
    display: flex;
    align-items: center;
    gap: 0;
    margin-left: 10px;
    justify-content: flex-start;
}

.artifact-die-select label {
    font-size: 0.85em;
    font-weight: bold;
    color: var(--col-text-primary);
}

#artifact-die-type {
    padding: 5px 10px;
    background-color: var(--col-bg-surface);
    color: var(--col-text-primary);
    border: 1px solid var(--col-accent-cool);
    border-radius: 4px;
    cursor: pointer;
}

/* --- Dice Display Area --- */
.dice-display {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 58px;
    padding: 12px 14px;
    align-items: center;
    justify-content: flex-start;
    background: rgba(24, 40, 45, 0.4);
    border-radius: 0 0 5px 5px;
}

/* Base Roller Die */
.roller-die {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: bold;
    box-sizing: border-box;
    border: 2px solid transparent;
    transition: all 0.3s;
    cursor: default;
    position: relative;
    z-index: 1;
}

/* Success Icon inside dice (when rolling 6) */
.die-success-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

/* Skull Icon inside dice (when rolling 1 on atributo/equipamento) */
.die-skull-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

/* Smaller success icons for multiple icons on one die */
.die-success-icon.die-success-icon-small {
    width: 18px;
    height: 18px;
}

/* Tiny success icons for 3 icons on one die */
.die-success-icon.die-success-icon-tiny {
    width: 14px;
    height: 14px;
}

/* Grid layout for 3 icons (2 on top, 1 on bottom) */
.die-icon-grid-3 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    justify-items: center;
}

.die-icon-grid-3 img:last-child {
    grid-column: span 2;
}

/* Grid layout for 4 icons (2x2) */
.die-icon-grid-4 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    justify-items: center;
}

/* Atributo Dice - bg=--col-text-primary, font=--col-bg-main */
.roller-die.die-atributo {
    background-color: var(--col-text-primary);
    color: var(--col-bg-main);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

/* Perícia Dice - bg=--col-accent-deep, font=--col-text-highlight */
.roller-die.die-pericia {
    background-color: var(--col-accent-deep);
    color: var(--col-text-highlight);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

/* Equipamento Dice - bg=--col-bg-main, font=--col-text-primary */
.roller-die.die-equipamento {
    background-color: var(--col-bg-main);
    color: var(--col-text-primary);
    border: 1px solid var(--col-text-primary);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

/* Artifact Dice Colors */
.roller-die.die-artifact-d8 {
    background-color: transparent;
    color: var(--col-text-primary);
    position: relative;
    overflow: visible;
    width: 70px;
    height: 70px;
}

/* SVG diamond for d8 */
.d8-svg {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
}

/* Content overlay for d8 */
.d8-content {
    position: relative;
    z-index: 1;
    color: var(--col-text-primary);
    font-weight: bold;
}

.roller-die.die-artifact-d10 {
    background-color: transparent;
    color: var(--col-text-highlight);
    position: relative;
    overflow: visible;
    width: 70px;
    height: 70px;
}

/* SVG hexagon for d10 */
.d10-svg {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
}

/* Content overlay for d10 */
.d10-content {
    position: relative;
    z-index: 1;
    color: var(--col-text-highlight);
    font-weight: bold;
}

.roller-die.die-artifact-d12 {
    background-color: transparent;
    color: var(--col-bg-main);
    position: relative;
    overflow: visible;
    width: 70px;
    height: 70px;
}

/* SVG pentagon for d12 */
.d12-svg {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
}

/* Content overlay for d12 */
.d12-content {
    position: relative;
    z-index: 1;
    color: var(--col-bg-main);
    font-weight: bold;
}

.roller-die.die-bonus {
    background-color: #813845;
}

.roller-die.die-negative {
    position: relative;
}

/* X overlay on negative dice */
.roller-die.die-negative::before,
.roller-die.die-negative::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 6px;
    background-color: #813845;
    z-index: -1;
}

.roller-die.die-negative::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.roller-die.die-negative::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* Faded Die - Not rolled due to negative modifier */
.roller-die.die-faded {
    opacity: 0.35;
    filter: grayscale(70%);
}

/* Die showing success (6) */
.roller-die.die-success {
    border: 2px solid var(--col-text-highlight);
    box-shadow: 0 0 8px var(--col-text-highlight);
}

/* Artifact dice success - use drop-shadow on SVG for shape-following glow */
.roller-die.die-artifact-d8.die-success,
.roller-die.die-artifact-d10.die-success,
.roller-die.die-artifact-d12.die-success {
    border: none;
    box-shadow: none;
}

.roller-die.die-artifact-d8.die-success .d8-svg,
.roller-die.die-artifact-d10.die-success .d10-svg,
.roller-die.die-artifact-d12.die-success .d12-svg {
    filter: drop-shadow(0 0 6px var(--col-text-highlight)) drop-shadow(0 0 10px var(--col-text-highlight));
}

.roller-die.die-artifact-d8.die-success .d8-svg path,
.roller-die.die-artifact-d10.die-success .d10-svg path,
.roller-die.die-artifact-d12.die-success .d12-svg path {
    stroke: var(--col-text-highlight);
    stroke-width: 2;
}

/* Negative die showing success (6) - no glow, warm border */
.roller-die.die-negative.die-success {
    border: 2px solid var(--col-accent-warm);
    box-shadow: 0 0 8px var(--col-accent-deep);
}

/* Die showing skull (1) */
.roller-die.die-skull {
    border: 2px solid var(--col-accent-warm);
}

/* Rolling Animation */
.roller-die.rolling {
    animation: diceRoll 0.6s ease-in-out;
}

@keyframes diceRoll {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-1deg);
    }
}

/* Tumble Animation for variety */
@keyframes diceTumble {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    20% {
        transform: translateY(-10px) rotate(180deg);
    }

    40% {
        transform: translateY(0) rotate(360deg);
    }

    60% {
        transform: translateY(-5px) rotate(540deg);
    }

    80% {
        transform: translateY(0) rotate(680deg);
    }

    100% {
        transform: translateY(0) rotate(720deg);
    }
}

.roller-die.tumbling {
    animation: diceTumble 0.8s ease-out;
}

/* --- Results Section --- */
.dice-results-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 15px;
}

.dice-results-main {
    display: flex;
    justify-content: center;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: var(--col-bg-surface);
    border-radius: 8px;
}

.result-icon {
    width: 32px;
    height: 32px;
}

.result-value {
    font-size: 2em;
    font-weight: bold;
    color: var(--col-text-highlight);
}

.result-label {
    font-size: 0.9em;
    color: var(--col-text-primary);
}

.success-result {
    border: 2px solid var(--col-text-highlight);
}

.skull-result {
    border: 1px solid var(--col-accent-warm);
}

.dice-results-skulls {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.dice-results-skulls.faded {
    opacity: 0.35;
}

.dice-results-skulls .result-item {
    padding: 8px 15px;
    width: 220px;
}

.dice-results-skulls .result-value {
    font-size: 1.5em;
}

.dice-results-skulls .result-icon {
    width: 24px;
    height: 24px;
}

/* --- Willpower Results --- */
.dice-results-willpower {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.dice-results-willpower.faded {
    opacity: 0.35;
}

.dice-results-willpower .result-item {
    padding: 8px 15px;
    border: 1px solid var(--col-accent-cool);
    background: linear-gradient(135deg, var(--col-bg-main) 0%, var(--col-bg-surface) 100%);
}

.dice-results-willpower .result-value {
    font-size: 1.5em;
    color: var(--col-accent-cool);
}

.dice-results-willpower .result-icon {
    width: 24px;
    height: 24px;
    filter: hue-rotate(180deg) saturate(0.7);
}

/* --- Action Buttons --- */
.dice-action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.roll-btn {
    background-color: var(--col-accent-deep);
    flex: 1;
    max-width: 200px;
}

.force-roll-btn {
    background-color: var(--col-btc-sec);
    flex: 1;
    max-width: 200px;
}

.force-roll-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(50%);
}

#btn-advance-day {
    width: 100%;
    min-width: max-content;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    height: auto;
}

#btn-advance-day img {
    vertical-align: bottom;
    flex-shrink: 0;
}

/* ========================================
   CALENDAR GRID
   ======================================== */

#calendar-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
    background: rgba(32, 32, 32, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Custom scrollbar for Windows 11 feel */
#calendar-grid::-webkit-scrollbar {
    width: 6px;
}

#calendar-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

#calendar-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#calendar-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Month Section Container */
.calendar-month-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    width: fit-content;
}

/* Month Title Header */
.calendar-month-title {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    padding-bottom: 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.calendar-month-title img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
}

/* Days Grid Container - 7 columns */
.calendar-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 36px);
    gap: 0;
    justify-content: center;
}

/* Individual Day Cell - Base Styles */
.calendar-day-item {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    background: transparent;
    border: none;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
    position: relative;
}

/* Past Day - Days that have been played */
.calendar-day-item.past-day {
    color: rgba(255, 255, 255, 0.85);
}

.calendar-day-item.past-day:hover {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Current Day - Windows 11 accent blue */
.calendar-day-item.current-day {
    background: #0078D4;
    color: #ffffff;
    font-weight: 600;
}

.calendar-day-item.current-day:hover {
    background: #1a86d9;
    box-shadow: 0 0 8px rgba(0, 120, 212, 0.5);
}

/* Future Day - Faded */
.calendar-day-item.future-day {
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
}

/* Pre-Campaign Days - Very faded */
.calendar-day-item.pre-campaign {
    color: rgba(255, 255, 255, 0.15);
    cursor: default;
    pointer-events: none;
}

/* Viewing Day - Selected indicator */
.calendar-day-item.viewing-day:not(.current-day) {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.6);
}

.calendar-day-item.viewing-day.current-day {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4), 0 0 12px rgba(0, 120, 212, 0.4);
}

/* Unexplored Days - Days not yet visited in the campaign */
.calendar-day-item.unexplored-day {
    color: rgba(255, 255, 255, 0.2);
    cursor: default;
    pointer-events: none;
}

/* Days with journal entries - Highlight color indicator */
.calendar-day-item.has-journal {
    color: var(--col-text-highlight);
}

/* ========================================
   LANGUAGE MODAL STYLES
   ======================================== */

.lang-modal-content {
    max-width: 400px;
}

.lang-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 30px;
    align-items: center;
}

.lang-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 15px 30px;
    font-size: 1.1em;
    background-color: var(--col-bg-main);
    border: 2px solid var(--col-accent-cool);
    color: var(--col-text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 250px;
}

.lang-option:hover {
    background-color: var(--col-accent-cool);
    color: var(--col-text-highlight);
    border-color: var(--col-text-highlight);
}

.lang-option.active {
    background-color: var(--col-accent-deep);
    border-color: var(--col-text-highlight);
    color: var(--col-text-highlight);
}

.lang-flag {
    font-size: 1.5em;
    line-height: 1;
}

#btn-lang {
    background-color: var(--col-text-highlight) !important;
}

@media (max-width: 1120px) {

    html,
    body,
    .modal {
        overflow-x: hidden !important;

    }

    #site-header {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 20px;
        width: 95%;
    }

    #header-branding {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        width: 100%;
        gap: 10px;
        position: static;
    }

    #header-branding #header-logo {
        position: static;
    }

    #header-logo {
        width: 60px;
        height: 60px;
        object-fit: contain;
    }

    h1 {
        text-align: left;
        font-size: 1.6rem;
        margin: 0;
    }

    .header-btn {
        padding: 2px 2px;
        font-size: 0.4em;
        gap: 2px;
    }

    .header-btn .btn-icon {
        width: 11px;
        height: 11px;
    }

    #calendar-modal {
        overflow-x: hidden;
    }

    #calendar-modal .modal-content {
        width: 95%;
        margin: 10px auto;
        box-sizing: border-box;
    }

    #selected-terrain-title {
        text-align: center;
        font-weight: bold;
        font-size: 0.8em;
    }

    #selected-hexagon-title {
        text-align: center;
        font-size: 0.7em;
    }

    #info-container,
    #bottom-container {
        width: 95%;
    }

    #bottom-container {
        flex-direction: row;
        flex-wrap: wrap;
        height: auto;
        align-items: flex-start;
        justify-content: space-between;
    }

    #calendar-container {
        width: 100%;
        flex: none;
        order: 2;
    }

    #bottom-left-column {
        display: contents;
    }

    #selected-hexweather-container,
    #selected-terrain {
        order: 0;
        width: 46%;
        height: 200px;
        flex-shrink: 0;
    }

    #hexagon-modal .modal-content {
        flex-direction: column;
        align-items: center;
        width: 95%;
        overflow-y: auto;
        overflow-x: hidden;
        height: auto;
        box-sizing: border-box;
        background-color: var(--col-bg-surface);
        margin: 10px auto;
    }

    #terrain-modal .modal-content {
        width: 95%;
        margin: 10px auto;
        box-sizing: border-box;
    }

    #map-container {
        transform: none !important;
        width: 700px !important;
        height: 700px !important;
        margin-top: -150px;
        margin-bottom: -180px;
    }

    #modal-map-container h2 {
        text-align: center;
    }

    #text-window {
        width: 320px;
        margin: 0px;
    }

    /* Modal Body Layout Reset for Mobile */
    .modal-body-split {
        flex-direction: column;
        overflow-y: auto;
        /* Allow full body scroll */
        height: auto;
    }

    #modal-left-column,
    #modal-controls-container {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* Original styles for map container reset ensuring it fits */
    #modal-map-container {
        width: 100%;
        margin-bottom: 10px;
    }

    #temperature-container,
    #weather-navigation {
        width: 100%;
        box-sizing: border-box;
    }

    .close-button {
        position: absolute;
        top: -7px;
        right: 2px;
        z-index: 9999;
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        transform: none;
    }

    .controls {
        display: none;
    }

    .mounted-switch-container {
        font-size: 0.7em;
    }

    #terrain-tooltip {
        display: none !important;
    }

    /* Revert Masthead centering on mobile */
    .masthead {
        justify-content: flex-start;
        position: static;
    }

    .masthead-icon {
        position: static;
        left: auto;
    }

    .masthead-title {
        text-align: left;
        width: auto;
        padding: 0;
        flex-grow: 1;
    }

    #general-info-modal .modal-content {
        width: 300px !important;
        max-width: 300px !important;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        margin: 0 !important;
        /* Override the 5% auto */
        display: flex;
        flex-direction: column;
    }

    #deck-container {
        width: 100%;
        height: auto;
        order: 10;
        /* Place below calendar-container in mobile */
    }

    .deck-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .deck-modal-content {
        width: 95%;
        margin: 10px auto;
    }

    .displayed-cards {
        flex-wrap: wrap;
    }

    /* Dice Roller Mobile Styles */
    #roller-container {
        width: 100%;
        height: auto;
        order: 11;
    }

    .dice-roller-modal-content {
        width: 95%;
        margin: 10px auto;
    }

    .quick-roll-buttons {
        grid-template-columns: 1fr;
    }

    .dice-slot-header {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: space-between;
    }

    .dice-slot-label {
        min-width: auto;
        width: auto;
        font-size: 0.85em;
    }

    .dice-amount-controls {
        gap: 3px;
    }

    .dice-amount-btn {
        width: 26px;
        height: 26px;
    }

    .dice-amount-btn img {
        width: 12px;
        height: 12px;
    }

    .dice-amount-input {
        width: 38px;
        padding: 4px;
        font-size: 0.95em;
    }

    .artifact-die-select {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
        flex-basis: 100%;
        order: 3;
    }

    .dice-action-buttons {
        flex-direction: column;
    }

    .roll-btn,
    .force-roll-btn {
        max-width: none;
    }

    .dice-results-skulls {
        flex-direction: column;
        align-items: center;
    }

    .dice-results-skulls .result-item.skull-result {
        width: 220px;
    }

    /* Calendar Grid Mobile Styles */
    #calendar-grid {
        padding: 10px;
        max-height: 300px;
        overflow-x: hidden;
    }

    .calendar-month-section {
        padding: 10px;
        width: 100%;
        box-sizing: border-box;
    }

    .calendar-days-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 2px;
    }

    .calendar-day-item {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .calendar-month-title {
        font-size: 12px;
        gap: 6px;
    }

    .calendar-month-title img {
        width: 22px;
        height: 22px;
    }
}