@font-face {
    font-family: 'Alegreya';
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url('fonts/alegreya-latin.woff2?v=1') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Alegreya';
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url('fonts/alegreya-cyrillic.woff2?v=1') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Alegreya';
    font-style: italic;
    font-weight: 400 900;
    font-display: swap;
    src: url('fonts/alegreya-italic-latin.woff2?v=1') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Alegreya';
    font-style: italic;
    font-weight: 400 900;
    font-display: swap;
    src: url('fonts/alegreya-italic-cyrillic.woff2?v=1') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Material Symbols Outlined';
    font-style: normal;
    font-weight: 100 700;
    font-display: block;
    src: url('fonts/material-symbols-outlined.woff2?v=3') format('woff2');
}

.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    /* -webkit-font-feature-settings: 'liga'; */
    -webkit-font-smoothing: antialiased;
    user-select: none;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0b0604;
    --surface-0: #804f3a;
    --surface: #221a16;
    --surface-2: #2A1810;
    --surface-3: #1e110b;
    --gold: #d4af37;
    --cream: #FEF3C7;
    --cream-faded: #fef3c83b;
    --forest: #76B041;
    --village: #AD492B;
    --water: #17BEBB;
    --farm: #FFC914;
    --enemy: #B427A6;
    --ruins-color: #bd2828;
}

/* Hide page content until the language has been applied (prevents a flash of
   the wrong language on load). Removed by the page scripts right after i18n. */
body.i18n-loading {
    visibility: hidden;
}

html {
    overflow-x: hidden;
}

body {
    font-family: 'Alegreya', serif;
    font-variant-numeric: lining-nums;
    background: var(--bg);
    min-height: 100vh;
    padding: 0px 10px 10px 10px;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    opacity: 1;
    transition: opacity 0.08s ease;
}

body.page-loading {
    opacity: 0.6;
}

.container {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

.app-shell {
    color: var(--cream);
    flex: 1 0 auto;
}

.app-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
}

.app-title {
    font-size: 2em;
    font-weight: 700;
    display: flex;
    gap: 4px;
    align-items: baseline;
    pointer-events: none;
}

.app-title-daily {
    color: var(--gold);
    font-weight: 200;
    font-style: italic;
}

.app-description {
    font-size: 1em;
    line-height: 1.5;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1em;
    
}

.layout-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    column-gap: 20px;
}

.content-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 10px 0;
}

/* Centered content column for the settings / home / stats pages */
.settings-page .content-block,
.archive-page .content-block,
.home-page .content-block,
.stats-page .content-block {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.content-block-title {
    font-size: 1.5em;
    letter-spacing: normal;
    line-height: 1;
}

#home-heading {
    font-size: 1.8em;
    margin-bottom: 3px;
}

.home-heading-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.help-btn {
    background: transparent;
    border: 1px solid var(--surface-0);
    color: var(--surface-0);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 1.2em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: 0.15s ease;
}

@media (hover: hover) {
.help-btn:hover {
    opacity: 0.8;
}
}

.help-popup-body {
    max-width: 420px;
    text-align: left;
}

.help-text {
    font-size: 1em;
    color: var(--cream);
}

.help-text ul {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.help-text li {
    display: flex;
    align-items: center;
    gap: 6px;
}

.help-map-item {
    flex-direction: column;
    font-weight: 600;
}

.help-map-item > span:first-child,
.help-c-letter {
    font-weight: 700;
    font-size: 1.1em;
}

.help-text li.help-c-item {
    max-width: 275px;
    gap: 6px;
}

.help-c-text {
    text-align: center;
}

.help-text a {
    color: var(--gold);
    text-decoration: 1px underline hsl(46 65% 15% / 1);
    text-underline-offset: 3px;
    transition: 0.15s ease;
}

@media (hover: hover) {
.help-text a:hover {
    text-decoration: 1px underline var(--gold);
}
}

.help-map-icon {
    width: 112px;
    height: 160px;
    object-fit: cover;
    border-radius: 6px;
}

.map-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--cream);
    text-decoration: none;
    font-weight: 500;
    text-align: right;
    align-self: stretch;
    position: relative;
    z-index: 0;
}

.map-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('map_small_bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}

.map-link-icon {
    font-size: 20px;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
    text-decoration: none;
}

.map-link-date {
    display: inline-block;
    text-decoration: 1px underline var(--cream-faded);
    text-underline-offset: 3px;
    transition: 0.15s ease;
}

@media (hover: hover) {
    .map-link:hover .map-link-date {
        text-decoration-color: var(--cream);
    }
}

.map-link.active {
    color: var(--gold);
    pointer-events: none;
}

.map-link.active .map-link-date {
    text-decoration: none;
}

.game-container {
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    overflow: hidden;
}

.card-container {
    perspective: 1000px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 10px;
}

.card-container.scoring-card-viewing #scoring-cards-container,
.card-container.scoring-card-viewing .season-header {
    opacity: 0.5;
    transition: opacity 0.15s ease;
}

.scoring-cards-container,
.skill-cards-container {
    width: 100%;
    max-width: 520px;
}

.scoring-cards-row,
.skill-cards-row {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    gap: 5px;
    width: 100%;
}

.scoring-card-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1 1 0;
    min-width: 0;
}

.scoring-card-item,
.skill-card-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--surface);
    border-radius: 20px;
    padding: 10px 12px;
    transition: all 0.15s ease;
}

.scoring-card-item {
    position: relative;
    width: 100%;
    flex: 1;
    overflow: hidden;
}

.skill-card-item {
    flex: 1 1 0;
    min-width: 0;
}

.scoring-card-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

@media (hover: hover) {
.skill-card-item:hover {
    /* transform: translateY(-4px); */
    background: var(--cream-faded);
}
}

.skill-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.skill-card-cost-badge,
.skill-cost-badge {
    background: var(--gold);
    color: var(--surface-2);
    border-radius: 50%;
    font-weight: 800;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.skill-card-cost-badge {
    min-width: 20px;
    height: 20px;
    font-size: 0.9em;
}

.skill-cost-badge {
    width: 45px;
    height: 45px;
    font-size: 1.5em;
    margin-right: 10px;
}

.scoring-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
}

.coin-indicator {
    background: var(--gold);
    color: var(--surface-2);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scoring-card-letter,
.scoring-card-score {
    position: absolute;
    bottom: 8px;
    z-index: 2;
    color: var(--cream-faded);
    font-weight: 700;
    font-size: 0.8em;
    letter-spacing: 0.08em;
    line-height: 1;
    text-align: center;
    pointer-events: none;
}

.scoring-card-letter {
    right: 8px;
}

.scoring-card-score {
    left: 8px;
}

.scoring-card-emoji {
    font-size: 1.2em;
    text-align: center;
    margin: 5px 0;
    line-height: 1;
}

.scoring-card-symbol {
    width: 1.5em;
    height: 1.5em;
    border-radius: 4px;
    margin: 5px auto;
    position: relative;
}

.scoring-forest {
    background-color: var(--forest);
}

.scoring-village {
    background-color: var(--village);
}

.scoring-water-farm {
    display: flex;
    gap: 4px;
    width: auto;
    height: 1.5em;
    background: transparent;
}

.scoring-water-farm::before,
.scoring-water-farm::after {
    content: '';
    width: 1.5em;
    height: 1.5em;
    border-radius: 4px;
    flex-shrink: 0;
}

.scoring-water-farm::before {
    background-color: var(--water);
}

.scoring-water-farm::after {
    background-color: var(--farm);
}

.scoring-map {
    background-color: #A0A0A0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000000;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}


/* Material Symbol icon overlays on scoring card symbols */
.scoring-icon-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: #000000;
    opacity: 0.6;
    line-height: 1;
    pointer-events: none;
    z-index: 1;
}

/* Special positioning for water_farm icons */
.scoring-water-farm .scoring-icon-water {
    position: absolute;
    left: 0.6em;
    
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.scoring-water-farm .scoring-icon-farm {
    position: absolute;
    left: 2em;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.scoring-card-name {
    color: var(--cream);
    font-size: 0.9em;
    text-align: center;
    line-height: 1;
    text-overflow: ellipsis;
    overflow: hidden;
}

.scoring-card-wrapper.inactive .scoring-card-item {
    opacity: 0.4;
}

.scoring-card-wrapper.inactive .scoring-card-letter,
.scoring-card-wrapper.inactive .scoring-card-score {
    color: var(--cream-faded);
}

.scoring-card-wrapper.inactive .scoring-card-name {
    color: var(--cream-faded);
}

.scoring-card-wrapper.inactive .scoring-card-symbol {
    opacity: 0.6;
}

@media (hover: hover) {
.scoring-card-wrapper:not(.inactive) .scoring-card-item:hover {
    /* transform: translateY(-4px); */
    background: var(--cream-faded);
}
}

@media (hover: hover) {
.scoring-card-wrapper.inactive .scoring-card-item:hover {
    /* transform: translateY(-4px); */
    opacity: 0.6;
}
}

.season-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    max-width: 520px;
    margin-bottom: 0;
    align-self: flex-start;
}

.season-badge {
    color: var(--cream);
    font-size: 1.5em;
    text-align: left;
    line-height: 0.9;
}

.season-letters {
    color: var(--cream-faded);
    font-size: 1.5em;
    font-variant: all-small-caps;
    letter-spacing: 0.05em;
    line-height: 0.9;
    margin-left: 8px;
    font-weight: 700;
}

.season-fraction {
    color: var(--cream);
    font-size: 1.5em;
    text-align: right;
    line-height: 0.9;
    margin-left: auto;
}

.card {
    background: var(--surface-2);
    border-radius: 20px;
    padding: 16px 20px;
    width: 100%;
    max-width: 520px;
    height: 300px;
    display: flex;
    flex-direction: column;
    position: relative;
    align-self: flex-start;
    box-shadow: inset 0px -3px 5px hsl(18 38% 15% / 1);
}

.card-header-top {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    min-width: 0;
}

/* Special cards (game-end) - center title vertically and horizontally */
#game-end-card .card-header-top {
    margin-bottom: 5px;
    flex-direction: column;
    gap: 0px;
}

#game-end-card .card-title {
    text-align: center;
    justify-content: center;
}

#game-end-card {
    height: auto;
}

/* Season-end card: title at the top, left-aligned */
#season-end-card .card-header-top {
    justify-content: flex-start;
    align-items: center;
    flex-direction: column;
}

#season-end-card .card-title {
    text-align: left;
    justify-content: center;
}

.cost-badge {
    background: transparent;
    color: var(--surface-0);
    border-radius: 12px;
    font-weight: 700;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
}

.cost-badge .material-symbols-outlined {
    font-size: 35px;
    line-height: 1;
    color: var(--surface-0);
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
    display: block;
}

.cost-badge .cost-badge-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    line-height: 1;
    color: var(--surface-2);
    z-index: 1;
}

.score-badge,
.skill-badge {
    width: 35px;
    height: 35px;
    color: var(--surface-2);
    font-weight: 700;
    font-size: 1.5em;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.score-badge {
    background: var(--gold);
    border-radius: 50%;
}

.skill-badge {
    background: var(--surface-0);
    border-radius: 4px;
}

.card-title {
    font-size: 1.5em;
    font-weight: 600;
    color: var(--cream);
    text-align: left;
    display: block;
    line-height: 0.9;
    flex: 1;
    gap: 5px;
    min-width: 0;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    align-content: center;
}

.card-title .ruins-prefix,
.card-title .card-name-text {
    white-space: nowrap;
}

.card-title .ruins-prefix {
    color: var(--ruins-color);
}

.card-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0;
    align-items: center;
    min-height: 0;
    position: relative;
}

#scoring-card .card-content {
    flex-direction: row;
}

.season-end-content,
.game-end-content {
    gap: 20px;
    align-items: stretch;
    justify-content: center;
}

.season-end-season-label {
    font-size: 1em;
    text-align: center;
    opacity: 0.85;
}

.season-score-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 0px;
    width: 100%;
    justify-items: center;
}

.season-score-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    justify-content: space-between;
    min-width: 0;
    width: 100px;
}

.season-score-label {
    font-size: 1.5em;
    font-weight: 700;

    display: flex;

    justify-content: center;
    gap: 6px;
}

.season-score-label .type-icon {
    font-size: 1.3em;
}

.enemy-indicator {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--enemy);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--cream);
    font-weight: 700;
    font-size: 1em;
}

.season-score-input {
    background: #1B0F0A;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 8px 10px;
    color: var(--cream);

    font-family: 'Alegreya', serif;
    font-weight: 600;
    text-align: center;
    font-size: 1.5em;
}

.season-score-input::placeholder {
    color: var(--cream-faded);
}

.season-score-input:focus {
    outline: none;
    border: 1px solid var(--gold);
}

.season-score-input.input-error {
    border: 1px solid #C0392B;
}

.season-score-input[readonly] {
    opacity: 0.6;
    cursor: default;
}

.season-tooltip {
    position: fixed;
    transform: translate(-50%, 0);
    background: var(--gold);
    color: var(--surface-3);
    padding: 6px 10px;
    border-radius: 6px;
    line-height: 1.2;
    font-weight: 600;
    z-index: 9999;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    display: none;
}

.season-tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: var(--gold);
}

.game-end-summary {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
}

.game-end-section {

    border-radius: 16px;
    background: var(--surface-3);
    padding: 1em;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-end-section-title {
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: left;
}

.game-end-list {
    display: flex;
    flex-direction: row;
    gap: 0px;
    justify-content: space-around;
    align-items: flex-end;
}

.game-end-row {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    color: var(--cream);
    font-size: 1.2em;
    text-align: center;
    flex: 1 1 0;
    flex-direction: column;
    line-height: 1;
    gap: 5px;
    overflow: hidden;
}

.game-end-row:not(.game-end-total-row) > span:first-child {
    color: var(--surface-0);
    font-size: 0.8em;
}

.game-end-plus {
    font-weight: 400;
    font-size: 1.2em;
    flex: 0 0 auto;
    line-height: 1;
    margin-right: 5px;
}

.game-end-total-row {
    font-size: 1.2em;
    color: var(--gold);
    flex: 0 1 auto;
}

.game-end-total-row span {
    font-size: 1em;
}

.game-end-final-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: 1.5em;
    margin: 10px 0 -5px;
}

.game-end-final-right {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

#game-end-final-label {
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#game-end-final-formula {
    font-size: 0.8em;
}

#game-end-total-value {
    font-weight: 700;
    color: var(--gold);
}

.game-end-title-badge {
    position: relative;
    user-select: none;
    padding: 12px 20px;
    margin: 0em 2em 0.5em 2em;
    text-align: center;
    font-size: 1.2em;
    font-weight: 700;
    color: var(--gold);
    background: rgba(212, 175, 55, 0.1);
}

/* Ribbon variant */
.game-end-title-badge.ribbon {
    background-color: var(--gold);
    color: var(--surface-3);
    border: none;
}

/* darker gold used for ribbon edges */
.game-end-title-badge.ribbon:before,
.game-end-title-badge.ribbon:after {
    content: "";
    position: absolute;
    top: 5px;
    z-index: -1;
    height: 0;
    width: 0;
    border-style: solid;
}

/* left tail */
.game-end-title-badge.ribbon:before {
    left: -40px;
    border-width: 26px;
    border-color: #b38c1d #b38c1d #b38c1d transparent; /* darkened gold */
}

/* right tail */
.game-end-title-badge.ribbon:after {
    right: -40px;
    border-width: 26px;
    border-color: #b38c1d transparent #b38c1d #b38c1d;
}

.card-content.has-two-figures::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: var(--surface-3);
    transform: translateX(-50%);
}

.game-end-title-container {
    z-index: 0;
}

.card-types {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex: 0 0 auto;
    margin-left: auto;
}

.card-types .scoring-map {
    font-size: 2em;
    width: 1em;
    height: 1em;
}

/* Make icon overlay bigger in detailed card view */
.card-types .scoring-icon-overlay {
    font-size: 24px;
    top: 50%;
}

.divider-horizontal {
    width: 100%;
    height: 2px;
    background: var(--surface-3);
    flex-shrink: 0;
}

.type-icon {
    font-size: 2em;
    padding: 5px;
    position: relative;
}

.type-square {
    display: inline-block;
    width: 1em;
    height: 1em;
    border-radius: 4px;
    background-color: #000;
    position: relative;
}

.type-forest {
    background-color: var(--forest);
}

.type-farm {
    background-color: var(--farm);
}

.type-water {
    background-color: var(--water);
}

.type-village {
    background-color: var(--village);
}

.type-enemy {
    background-color: var(--enemy);
}

/* Material Symbol icon overlays on type icons */
.type-icon-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #000000;
    opacity: 0.6;
    line-height: 1;
    pointer-events: none;
    z-index: 1;
}

.card-figures {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0;
    overflow-x: auto;
    flex: 1;
    padding-top: 20px;
    width: 100%;
    position: relative;
}

.card-figures.has-two-options {
    gap: 40px;
    align-items: stretch;
}

.card-figures.has-two-options .figure-container {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 10px;
    transition: border-color 0.15s;
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
}

body.game-completed .card-figures.has-two-options .figure-container {
    cursor: default;
}

@media (hover: hover) {
.card-figures.has-two-options .figure-container:hover {
    border-color: var(--cream-faded);
}
body.game-completed .card-figures.has-two-options .figure-container:hover {
    border-color: transparent;
}
}

.card-figures.has-two-options .figure-container.selected {
    background-color: var(--surface-3);
}

.card-figures.has-two-options .figure-container.selected::after {
    content: '✓';
    position: absolute;
    bottom: 10px;
    right: 10px;
    color: var(--gold);
    font-size: 1.2em;
    font-weight: 700;
    line-height: 1;
}

.figure-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    position: relative;
}

.figure-grid {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    padding: 15px;
    position: relative;
}

.figure-row {
    display: flex;
    gap: 2px;
    line-height: 1.2;
}

.figure-cell {
    font-size: 2em;
    width: 1em;
    height: 1em;
    display: inline-block;
    text-align: center;
    position: relative;
}

.figure-cell.empty-cell {
    opacity: 0;
}

.figure-block {
    display: inline-block;
    background-color: var(--surface-0);
    border-radius: 4px;
    position: relative;
}

.direction-symbol {
    display: inline-block;
    width: 1em;
    height: 1em;
    position: relative;
    box-sizing: border-box;
}

.direction-symbol::before {
    content: '→';
    font-size: 1.5em;
    color: var(--surface-0);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.direction-up::before { content: '↑'; }

.direction-down::before { content: '↓'; }

.direction-left::before { content: '←'; }

.direction-right::before { content: '→'; }

.button-container {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    margin-top: 0;
    width: 100%;
    max-width: 520px;
    align-self: flex-start;
    padding: 0;
}

.button-container .prev-card-btn {
    order: 1;
    margin-right: auto;
}

.button-container .next-card-btn {
    order: 2;
}

.button-container .close-card-btn {
    order: 2;
    margin-left: auto;
}

.button-spacer {
    display: none;
}

.close-card-btn,
.nav-btn {
    background: var(--surface);
    color: var(--cream);
    border: none;
    padding: 10px 12px;
    font-size: 1em;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.03em;
    white-space: nowrap;
    font-family: 'Alegreya', serif;
}

.prev-card-btn {
    padding: 10px;
    width: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.next-card-btn {
    flex: 0 0 auto;
}

.restart-btn {
    background: var(--surface);
    color: var(--cream);
    border: none;
    padding: 15px 40px;
    font-size: 1.2em;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.05em;
}

@media (hover: hover) {
.nav-btn:hover, .restart-btn:hover, .close-card-btn:hover {
    background: var(--cream-faded);
    /* transform: translateY(-2px); */
}
}

.nav-btn:active, .restart-btn:active, .close-card-btn:active {
    transform: translateY(0);
}

.nav-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* .finished-message {
    text-align: center;
    color: var(--cream);
    padding: 40px;
    background: var(--surface);
    border-radius: 20px;
}

.finished-message h2 {
    font-size: 2em;
    margin-bottom: 15px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.finished-message p {
    font-size: 1.2em;
    margin-bottom: 25px;
} */


.scoring-card-description {
    color: var(--cream);
    font-size: 1.2em;
    text-align: left;
    white-space: pre-wrap;
    line-height: 1.1;
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

/* Star icon with number overlay */
.star-with-number {
    position: relative;
    display: inline-block;
    margin: 0 2px 0 0;
}

.star-icon {
    font-size: 2em;
    color: var(--gold);
    display: inline-block;
    vertical-align: middle;
    font-variation-settings: 'FILL' 1;
}

.star-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1em;
    font-weight: 700;
    color: var(--surface-2);
    line-height: 1;
    pointer-events: none;
    z-index: 1;
}

@media (min-width: 600px) {
    .container {
        max-width: 1024px;
    }
    .layout-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    /* In 2-column layout: 
       Column 1: Scoring cards (row 1) and Skills (row 2) - stacked
       Column 2: Explorer card (row 1, spans 2 rows) */
    .layout-grid .content-block:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }
    
    .layout-grid .content-block:nth-child(2) {
        grid-column: 1;
        grid-row: 2;
    }
    
    .layout-grid .content-block:nth-child(3) {
        grid-column: 2;
        grid-row: 1 / 4; /* Spans both rows */
    }
}



/* Map Popup Modal Styles */
.map-popup {
    position: fixed;
    top: 0;
    left: 0;
    padding: 10px;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
}

.map-popup-content {
    position: relative;
    background: var(--surface);
    border-radius: 20px;
    padding: 16px 20px;
    overflow: auto;
    z-index: 10001;
    max-width: 100%;
}

.map-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2em;
    margin-bottom: 10px;
}

.map-popup-title {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--cream);
    margin: 0;
    line-height: 1;
}

.map-popup-close {
    background: var(--surface);
    border: none;
    color: var(--cream);
    font-size: 1.8em;

    cursor: pointer;
    border-radius: 25px;
    /* padding-top: 2px; */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: color 0.15s;

    /* width: 32px; */
    height: 20px;
}

@media (hover: hover) {
.map-popup-close:hover {
    color: var(--cream);
}
}

.map-popup-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.map-popup-image {
    position: absolute;
    transform: scale(1.1);
    top: var(--offset-y, -180px);
    height: calc(100% / 1.1 + 240px);
    width: inherit;
    
    aspect-ratio: 65 / 94;

    pointer-events: none;
    touch-action: none
}

.map-popup-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* The wrapper handles aspect ratio and interaction blocking */
.frame-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  /* Definite viewport-based width (edge-to-edge on narrow screens, capped by
     viewport height on wide screens); the ratio is preserved. */
  width: min(calc(100vw - 60px), calc((100vh - 140px) * 65 / 94));
  aspect-ratio: 65 / 94;
  overflow: hidden;
  border-radius: 10px;
}

/* Gradient fade at the bottom */
.frame-wrapper::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 25%; /* adjust fade size */
  pointer-events: none;

  background: linear-gradient(
    to top,
    var(--surface),
    rgba(0, 0, 0, 0)
  );
}

.frame-wrapper.static-map::after {
  content: none;
}

/* Button inside wrapper, centered at bottom */
.map-popup-link {
  position: absolute;
  bottom: 20px;         /* sits inside the gradient */
  left: 50%;
  transform: translateX(-50%);

  color: var(--cream);
  text-decoration: none;
  font-size: 1em;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 20px;
  background: var(--surface);

  transition: all 0.15s;
  z-index: 5;                  /* stays ABOVE iframe + gradient */
  white-space: nowrap;
}

@media (hover: hover) {
.map-popup-link:hover {
    background: var(--cream-faded);
}
}



/* Loading Screen Styles */
.loading-screen {
    display: none; /* Hidden by default, shown via JavaScript */
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    padding: 40px 0;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    text-align: center;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(212, 175, 55, 0.2);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: var(--cream);
    font-size: 1.5em;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.loading-subtext {

    font-size: 1em;
    opacity: 0.8;
}

/* Footer Styles */
.app-footer {
    /* margin-top: 30px; */
    padding-top: 5px;
    border-top: 3px dotted var(--surface);
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9em;
    color: var(--cream-faded);
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 12px;
}

.footer-updates {
    color: var(--cream);
}

.lang-select {
    background: transparent;
    color: var(--cream-faded);
    border: 1px solid var(--surface);
    /* border: none; */
    border-radius: 6px;
    padding: 0px 4px;
    font-family: inherit;
    font-size: 0.9em;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: color 0.15s ease;
}

@media (hover: hover) {
.lang-select:hover {
    color: var(--cream);
    background: var(--surface);
}
}


.lang-select option {
    background: var(--surface);
    color: var(--cream);
}

.footer-actions {
    display: flex;
    align-items: stretch;
    gap: 5px;
}

.game-footer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 30px;
    margin-bottom: 10px;
}

.reset-link {
    background: none;
    border: none;
    padding: 0;
    display: inline-flex;
    align-items: end;
    gap: 3px;
    color: var(--cream-faded);
    font-family: inherit;
    font-size: 0.9em;
    cursor: pointer;
    transition: 0.15s ease;
}

@media (hover: hover) {
.reset-link:hover {
    color: var(--cream);
}
}

.reset-link:disabled {
    opacity: 0.45;
    cursor: default;
}

.reset-link .reset-label {
    text-decoration: 1px underline var(--cream-faded);
    text-underline-offset: 3px;
}

.reset-icon {
    font-size: 1.2em;
    line-height: 1;
}

.season-summary {
    color: var(--cream-faded);
    font-size: 0.9em;
    text-align: right;
    margin-left: auto;
}

.footer-contacts {
    display: flex;
    flex-wrap: wrap;
    column-gap: 10px;
    row-gap: 0px;
}

.footer-link {
    color: var(--cream-faded);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: color 0.15s ease;
}

@media (hover: hover) {
.footer-link:hover {
    color: var(--gold);
}
}

.footer-icon {
    width: 15px;
    height: 15px;
    fill: currentColor;
    flex-shrink: 0;
}

.footer-legal {
    color: var(--cream-faded);
    font-size: 0.8em;
    line-height: 1.5;
    margin: 0;
}

/* Landing page */
.app-title-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.content-block-title a,
.home-description-list a {
    color: var(--gold);
    text-decoration: 1px underline hsl(46 65% 15% / 1);
    text-underline-offset: 4px;
    transition: 0.15s ease;
}

@media (hover: hover) {
.content-block-title a:hover,
.home-description-list a:hover {
    text-decoration: 1px underline var(--gold);
}
}

.map-link.archive-link::before {
    content: none;
}

.header-links {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 5px;
}

.home-grid {
    display: flex;
    flex-direction: column;
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
}

.calendar {
    display: flex;
    flex-direction: column;
    width: fit-content;
    gap: 2px;
}

.day-circles {
    display: flex;
    gap: 8px;
    position: relative;
    height: 45px;
}

.day-maps {
    display: flex;
    gap: 8px;
}

.streak-band {
    position: absolute;
    top: 0;
    bottom: 0;
    background: var(--gold);
    border-radius: 24px;
    z-index: 0;
    overflow: hidden;
}

.streak-shine {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        transparent 40%,
        #f2d163 50%,
        transparent 60%,
        transparent 100%
    );
    background-size: 200% 100%;
    background-repeat: no-repeat;
    animation: streak-shine 5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes streak-shine {
    0% { background-position: 200% 0; }
    100% { background-position: -100% 0; }
}

.streak-band.clip-left {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.streak-band.clip-right {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Calendar card styled like the in-game card */
.home-calendar-card {
    align-items: center;
    background: var(--surface-2);
    border-radius: 20px;
    padding: 16px 20px;
    overflow: hidden;
    box-shadow: inset 0px -3px 5px hsl(18 38% 15% / 1);
}

.day-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 45px;
    flex: 0 0 45px;
    justify-content: space-evenly;
    position: relative;
    z-index: 1;
}

.day-circle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 0.8;
    padding-bottom: 2px;
}

.day-cell.today .day-circle {
    border: 1px solid var(--surface-0);
}

.day-cell.completed .day-circle {
    border: 1px solid var(--gold);
    color: var(--gold);
    background: var(--surface-2);
}

.day-cell.future .day-circle {
    color: var(--surface-0);
    border: 1px solid var(--surface-2);
}

.day-cell.future .day-map-letter {
    color: var(--surface-0);
}

.day-number {
    font-size: 1.2em;
}

.day-month {
    text-transform: lowercase;
    font-size: 0.8em;
}

.day-map {
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day-map-dice {
    font-size: 20px;
    font-variation-settings: 'FILL' 1;
}

.day-cell.completed .day-map-letter,
.day-cell.completed .day-map-dice {
    color: var(--gold);
}

.play-btn {
    display: inline-block;
    margin: 5px 0 8px;
    padding: 12px 34px;
    border-radius: 999px;
    background: var(--gold);
    color: var(--bg);
    font-weight: 700;
    font-size: 1.2em;
    letter-spacing: 0.04em;
    text-decoration: none;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

@media (hover: hover) {
.play-btn:hover {
    /* transform: translateY(-2px); */
    opacity: 0.8;
}
}

.home-description {
    color: var(--cream-faded);
    font-size: 0.9em;
    line-height: 1.5;
    text-align: left;
    margin: 0;
}

.home-description-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 5px;
}

.home-description-list li {
    position: relative;
    padding-left: 22px;
    font-size: 1.2em;
    line-height: 1.2;
}

.home-description-list li::before {
    content: '•';
    position: absolute;
    left: 4px;
    color: var(--gold);
    font-weight: 700;
}

.play-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.resume-subtitle {
    font-size: 0.9em;
    color: var(--surface-0);
    margin-bottom: 5px;
}

.streak {
    display: flex;
    /* align-items: center; */
    gap: 3px;
    border-bottom: 3px dotted var(--surface);
    padding: 5px 0 10px;
    color: var(--gold);
    line-height: 1.2;
}

.streak.grace {
    color: var(--cream);
}

.streak-icon {
    font-size: 1.2em;
}

.backup-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 3px dotted var(--surface);
    padding: 10px 0;
}

.backup-hint-text {
    flex: 1;
}

.backup-hint-close {
    background: none;
    border: none;
    color: var(--cream-faded);
    font-size: 1.2em;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    flex-shrink: 0;
}

@media (hover: hover) {
.backup-hint-close:hover {
    color: var(--cream);
}
}

/* Archive page */
.archive-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--surface);
    border-radius: 20px;
    padding: 16px 20px;
    width: 640px;
    max-width: 100%;
    box-sizing: border-box;
    /* margin-bottom: 20px; */
}

.archive-stat-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.archive-stat-label {
    white-space: nowrap;
}

.archive-stat-count {
    font-size: 1.2em;
    font-weight: 700;
    line-height: 1;
}

.archive-stat-info {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 2px 8px;
    color: var(--cream-faded);
    /* font-size: 0.9em; */
}

.archive-stat-example {
    color: var(--cream-faded);
}

.archive-calendar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    background: var(--surface-2);
    border-radius: 20px;
    padding: 16px 20px;
    overflow: hidden;
    box-shadow: inset 0px -3px 5px hsl(18 38% 15% / 1);
}

.archive-month-title {
    color: var(--cream);
    font-size: 1.2em;
    font-weight: 600;
    letter-spacing: 0.03em;
    align-self: center;
}

.archive-month {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(7, 45px);
    gap: 8px;
    width: max-content;
    position: relative;
}

.archive-weekday {
    color: var(--surface-0);
    font-size: 0.8em;
    text-align: center;
    text-transform: lowercase;
}

.archive-day {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
}

.archive-circle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--surface-2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 0.8;
    gap: 2px;
    transition: opacity 0.15s ease;
}

.archive-day-number {
    font-size: 0.8em;
    opacity: 0.7;
}

.archive-day.active .archive-circle {
    cursor: pointer;
}

@media (hover: hover) {
.archive-day.active .archive-circle:hover {
    /* box-shadow: 0 0 0 2px var(--cream); */
    opacity: 0.8;
}
}

.archive-day.disabled .archive-circle {
    color: var(--surface-0);
}

.archive-day.today .archive-circle {
    border: 1px solid var(--surface-0);
}

.archive-day.completed .archive-circle {
    border: 1px solid var(--gold);
    color: var(--gold);
    /* background: var(--surface-3); */
}

/* Stats page */
.stats-empty {
    font-size: 1.2em;
    margin: 10px 0;
    line-height: 1.2;
}

.stats-rows {
    display: grid;
    grid-template-columns: auto auto 1fr;
    column-gap: 12px;
    row-gap: 16px;
    align-items: baseline;
    background: var(--surface);
    border-radius: 20px;
    padding: 16px 20px;
}

.stats-row {
    display: contents;
}

.stats-label {
    white-space: nowrap;
}

.stats-value {
    font-size: 1.2em;
    font-weight: 700;
    line-height: 1;
    text-align: left;
}

.stats-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 2px 8px;
    color: var(--cream-faded);
    text-align: right;
}

.backup-hint a,
.streak-text a,
.stats-empty a,
.archive-stat-link,
.most-scored-date,
.stats-info a {
    color: var(--gold);
    text-decoration: 1px underline hsl(46 65% 15% / 1);
    text-underline-offset: 3px;
    white-space: nowrap;
    transition: 0.15s ease;
}


@media (hover: hover) {
.backup-hint a:hover,
.streak-text a:hover,
.stats-empty a:hover,
.archive-stat-link:hover,
.most-scored-date:hover,
.stats-info a:hover {
    text-decoration: 1px underline var(--gold);
}
}

.distribution {
    display: block;
    background: var(--surface);
    border-radius: 20px;
    padding: 16px 20px;
    margin-bottom: 10px;
}

.most-scored-desc {
    line-height: 1.2;
    color: var(--cream);
}

.distribution-chart {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.chart-labels {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.label-row {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    text-align: right;
    color: var(--cream);
    line-height: 1;
    white-space: nowrap;
}

.label-row.zero {
    color: var(--cream-faded);
}

.chart-plot {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    border-left: 3px solid var(--cream-faded);
}

.chart-bars {
    display: flex;
    flex-direction: column;
}

.bar-row {
    height: 40px;
    display: flex;
    align-items: center;
}

.chart-bar {
    height: 100%;
    background: var(--cream);
    border-radius: 0 4px 4px 0;
    min-width: 2px;
    transition: width 0.15s ease;
}

.chart-bar.empty {
    background: transparent;
    min-width: 0;
}

.bar-count {
    margin-left: 10px;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 1.2em;
    font-weight: 700;
    line-height: 1;
}

.bar-count.zero {
    color: var(--cream-faded);
}

.most-scored-row {
    display: flex;
    gap: 5px;
    justify-content: space-around;
    align-items: stretch;
    width: 100%;
}

.most-scored-slot {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.most-scored-profit {
    color: var(--cream);
    font-size: 1.2em;
    font-weight: 700;
    line-height: 1;
}

.most-scored-bottom {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

/* Footer settings link */
.settings-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--cream-faded);
    text-decoration: none;
    border-radius: 6px;
    transition: color 0.15s ease;
}

@media (hover: hover) {
.settings-link:hover {
    color: var(--cream);
    background: var(--surface);
}
}

.settings-link .material-symbols-outlined {
    font-size: 20px;
}

/* Home countdown */
.countdown {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-align: center;
    color: var(--cream-faded);
    font-size: 0.9em;
    margin-bottom: 10px;
}

.countdown-icon {
    font-size: 1.2em;
    line-height: 1;
    vertical-align: middle;
}

/* Settings page */

.settings-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    background: var(--surface);
    border-radius: 20px;
    padding: 16px 20px;
}

@media (hover: hover) {
.settings-toggle:hover .settings-label {
    color: var(--cream);
}
}

.settings-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.tickbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--cream);
    border-radius: 5px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.settings-toggle input:checked + .tickbox {
    background: var(--gold);
    border-color: var(--gold);
}

.settings-toggle input:checked + .tickbox::after {
    content: '';
    width: 5px;
    height: 11px;
    border: solid var(--bg);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

.settings-toggle input:focus-visible + .tickbox {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.settings-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.settings-label {
    color: var(--cream);
    font-size: 1.2em;
    line-height: 1.2;
}

.settings-desc {
    line-height: 1.2;
}

.distribution-title,
.most-scored-title,
.settings-data-title {
    margin-top: 16px;
}

.settings-actions {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: 20px;
    padding: 16px 20px;
    gap: 20px;
}

.settings-action {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.settings-action .settings-desc {
    flex: 1;
}

.settings-action .settings-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.settings-danger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border-radius: 20px;
    padding: 16px 20px;
    gap: 20px;
}

.settings-danger .settings-desc {
    flex: 1;
}

.settings-danger .settings-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.import-preview {
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* margin-top: 12px; */
    padding: 16px 20px;
    border: 1px solid var(--cream-faded);
    border-radius: 20px;
}

.import-preview-text {
    color: var(--cream);
    font-size: 0.9em;
    line-height: 1.4;
}

.import-preview-actions {
    display: flex;
    gap: 10px;
}

.settings-btn {
    background-color: var(--cream-faded);
    /* border: 1px solid var(--cream-faded); */
    border-radius: 8px;
    border: none;
    color: var(--cream);
    padding: 8px 16px;
    font-family: inherit;
    font-size: 0.9em;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

@media (hover: hover) {
.settings-btn:hover {
    opacity: 0.8;
}
}

.settings-btn-danger {
    background-color: var(--village);
}


.settings-status {
    color: var(--cream);
    font-size: 0.9em;
    opacity: 0;
    transition: opacity 0.15s ease;
    align-self: center;
}

.settings-status.visible {
    opacity: 1;
}

/* Press (active) feedback — scale down on click/tap */
.nav-btn:active,
.restart-btn:active,
.close-card-btn:active,
.play-btn:active,
.settings-btn:active,
.settings-link:active,
.reset-link:active,
.backup-hint-close:active,
.map-popup-close:active,
.map-popup-link:active,
.lang-select:active,
.footer-link:active,
.archive-day.active .archive-circle:active,
.scoring-card-wrapper:not(.inactive) .scoring-card-item:active,
.scoring-card-wrapper.inactive .scoring-card-item:active,
.skill-card-item:active,
.card-figures.has-two-options .figure-container:active,
a.map-link:active,
a.app-title-link:active,
.backup-hint a:active,
.streak-text a:active,
.stats-empty a:active,
.archive-stat-link:active,
.most-scored-date:active,
.stats-info a:active,
.content-block-title a:active,
.home-description-list a:active,
.help-btn:active {
    transform: scale(0.95);
    transition: 0.15s ease;
}

/* --- Leaderboard --- */
#leaderboard-section {
    display: flex;
    gap: 20px;
}

.leaderboard-rank-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.2em;
}
.leaderboard-rank-text {
    color: var(--cream);
}

.leaderboard-chart {
    width: 100%;
}

.lb-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 110px;
}

.lb-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
    height: 100%;
    justify-content: flex-end;
    position: relative;
}

.lb-bar {
    width: 100%;
    background: var(--surface-0);
    border-radius: 10px;
    min-height: 2px;
    transition: background 0.15s ease;
    max-width: 220px;
}

.lb-bar:active {
    transform: scale(0.95);
    transition: 0.15s ease;
}

.lb-bar:hover {
    opacity: 0.8;
}

.lb-bar.lb-bar-player {
    background: var(--gold);
}

.lb-tip {
    display: none;
    position: absolute;
    background: var(--gold);
    color: var(--surface-3);
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.lb-tip::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
}

.lb-tip-above {
    bottom: 100%;
    margin-bottom: 4px;
}

.lb-tip-above::after {
    top: 100%;
    border-top-color: var(--gold);
}

.lb-tip-below {
    top: 100%;
    margin-top: 4px;
}

.lb-tip-below::after {
    bottom: 100%;
    border-bottom-color: var(--gold);
}

.lb-bar-group:hover .lb-tip {
    display: block;
}

.lb-chart {
    position: relative;
}

.lb-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    pointer-events: none;
}

.lb-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 3px dashed var(--cream);
    opacity: 0.6;
}

.lb-line-player {
    border-left-color: var(--gold);
    opacity: 0.8;
}

.lb-line-label {
    position: absolute;
    bottom: -20px;
    transform: translateX(-50%);
    color: var(--cream);
    white-space: nowrap;
    line-height: 1;
}

.lb-line-label-player {
    bottom: auto;
    top: -16px;
    color: var(--gold);
}

.leaderboard-chart-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.leaderboard-error,
.leaderboard-loading {

    color: var(--surface-0);
    text-align: center;
    /* padding: 20px 0; */
}

/* Tutorial Overlay Styles */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: all;
}

.tutorial-highlight {
    position: fixed;
    border-radius: 12px;
    z-index: 1;
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7);
    transition: all 0.3s ease;
}

.tutorial-tooltip {
    position: fixed;
    z-index: 2;
    pointer-events: all;
    cursor: pointer;
    background: var(--surface);
    border-radius: 20px;
    padding: 16px 20px;
    max-width: 400px;
    width: calc(100% - 40px);
}

.tutorial-tooltip.tooltip-below {
    top: auto;
    bottom: auto;
}

.tutorial-tooltip.tooltip-above {
    top: auto;
    bottom: auto;
}

.tutorial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.tutorial-title {
    color: var(--cream);
    font-size: 1em;
    font-weight: 600;
}

.tutorial-step {
    color: var(--cream-faded);
}

.tutorial-text {
    color: var(--cream);
}

.tutorial-text p {
    margin: 0 0 8px;
}

.tutorial-text p:last-child {
    margin-bottom: 0;
}

.tutorial-text .tutorial-hint {
    color: var(--cream-faded);
    font-size: 0.85em;
    font-style: italic;
}



