/* The site uses one light palette, shared by the lobby, games and account screens. */
:root {
    color-scheme: light;
    --green-900: #173a28;
    --green-800: #235738;
    --green-700: #307447;
    --green-100: #e4f2df;
    --green-50: #f0f7ed;
    --bg: #f7faf6;
    --bg-elevated: #fff;
    --bg-muted: #e3ebe1;
    --surface: #fff;
    --surface-2: var(--green-50);
    --text: #192e21;
    --text-soft: #485e50;
    --text-faint: #52665a;
    --navy: var(--bg);
    --action: var(--green-800);
    --action-hover: var(--green-900);
    --primary: var(--green-800);
    --primary-strong: var(--green-900);
    --primary-soft: var(--green-100);
    --accent: var(--primary);
    --accent-strong: var(--primary-strong);
    --accent-soft: var(--primary-soft);
    --on-action: #fff;
    --on-primary: #fff;
    --on-accent: #fff;
    --art-ink: var(--green-800);
    --art-wash: #cfe7c9;
    --success: #25643a;
    --success-soft: #e1f4e3;
    --on-success: #fff;
    --danger: #a52e38;
    --danger-soft: #fce8e7;
    --on-danger: #fff;
    --warning-soft: #fff4d8;
    --medal-gold: #865705;
    --medal-silver: #465e67;
    --medal-bronze: #824a2e;
    --border: #d7e3d6;
    --border-strong: #829986;
    --map-sea: #edf5eb;
    --shadow-sm: 0 3px 8px #183e2110;
    --shadow: 0 10px 24px #183e2112;
    --shadow-lg: 0 18px 46px #183e211c;
    --radius-sm: 12px;
    --radius: 16px;
    --radius-lg: 22px;
    --radius-xl: 28px;
    --container: 1160px;
    --header-height: 72px;
    --transition: 160ms ease;
    --font: system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-display: var(--font);
    --font-mono: ui-monospace, monospace;
}

body { line-height: 1.6; }
::selection { color: var(--green-900); background: #d1eac9; }
:focus-visible { outline: 3px solid var(--green-700); outline-offset: 3px; }
.eyebrow, .eyebrow-light {
    color: var(--text-soft);
    font: 700 .88rem/1.35 var(--font);
    letter-spacing: 0;
    text-transform: none;
}
.eyebrow > span:empty { display: none; }
.button { min-height: 46px; border-radius: 12px; font-weight: 720; }
.button-small { min-height: 44px; }
.button-large { min-height: 54px; }
.button-ghost { border-color: var(--border-strong); }
.button-ghost:hover { border-color: var(--green-700); background: var(--green-50); }
input, textarea, select { accent-color: var(--green-800); }
input::placeholder, textarea::placeholder { color: var(--text-faint); opacity: 1; }
.variant-field { border-color: var(--border); background: var(--surface-2); }
.profile-avatar { color: var(--on-primary); }

.site-header { background: var(--surface); }
.header-inner { justify-content: space-between; gap: 16px; }
.brand { gap: 10px; font-size: 1.22rem; letter-spacing: -.05em; }
.brand-mark.brand-logo { border-radius: 11px; }
.nav-icon {
    width: 21px;
    height: 21px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.main-nav a {
    position: relative;
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: 8px;
    color: var(--text-soft);
    font-size: .88rem;
    font-weight: 680;
    line-height: 1.25;
}
.main-nav a:hover, .main-nav a.is-active {
    background: var(--green-100);
    color: var(--green-900);
    box-shadow: none;
}
.main-nav [aria-current="page"] { font-weight: 780; }
.main-nav .nav-register { display: none; }
.main-nav .daily-nav-link { color: var(--text-soft); }
.main-nav .duel-nav-badge { background: var(--green-800); color: var(--on-primary); }
.header-actions { gap: 8px; }
.header-actions .button { padding-inline: 14px; white-space: nowrap; }
.header-actions .button-ghost { border-color: transparent; background: transparent; }
.header-actions .button-ghost:hover { background: var(--surface-2); }
.account-pill { min-width: 0; max-width: 168px; }
.account-pill > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-pill .account-badge { display: none; }
.menu-toggle { width: 44px; height: 44px; align-content: center; }
.menu-toggle:hover { background: var(--surface-2); }
.main-nav.is-open {
    z-index: 20;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: calc(100dvh - var(--header-height) - 24px);
    overflow: auto;
}

.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, .87fr);
    margin-top: 30px;
    overflow: hidden;
    border: 1px solid #d5e8d0;
    border-radius: 32px;
    background: #e7f2e3;
}
.home-hero-copy {
    z-index: 1;
    align-self: center;
    padding: clamp(32px, 4.5vw, 54px);
}
.home-hero-kicker {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 20px;
    color: var(--green-800);
    font-size: .94rem;
    font-weight: 730;
}
.home-hero h1 {
    margin: 0 0 20px;
    font-size: clamp(3.1rem, 6vw, 5.1rem);
    font-weight: 850;
    line-height: .99;
    letter-spacing: -.058em;
}
.home-hero h1 em { color: var(--green-700); font-style: normal; }
.home-hero-lead {
    max-width: 37ch;
    margin: 0;
    color: var(--text-soft);
    font-size: clamp(1rem, 1.6vw, 1.14rem);
    line-height: 1.55;
}
.home-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.home-hero-actions .button-ghost { background: #f5faf2; color: var(--green-900); }
.home-hero-actions .button-ghost:hover { background: #fff; }
.home-hero-note { margin: 14px 0 0; color: var(--text-soft); font-size: .85rem; }
.home-hero-art { position: relative; min-height: 100%; background: #e7f2e3; }
.home-hero-art img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(100%, 520px);
    height: auto;
    transform: translate(-50%, -50%);
    mix-blend-mode: multiply;
    mask-image: radial-gradient(circle closest-side, #000 65%, transparent 100%);
}

.home-page .daily-home-section { padding: 0; margin-top: 18px; background: none; }
.home-page .daily-home-card {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 16px 21px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}
.home-daily-icon {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    border-radius: 16px;
    background: var(--primary-soft);
    color: var(--green-800);
}
.home-daily-icon svg { width: 28px; height: 28px; }
.home-page .daily-home-copy h2 { margin: 0 0 3px; font-size: 1.22rem; letter-spacing: -.025em; }
.home-page .daily-home-copy p { margin: 0; font-size: .92rem; }
.home-page .daily-home-action { grid-column: auto; justify-self: end; }

.home-page .quiz-modes { padding-block: 42px 32px; }
.home-mode-heading {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: end;
    gap: 9px 18px;
    margin-bottom: 20px;
}
.home-mode-heading h2, .home-demo h2 {
    font-size: clamp(1.8rem, 3.8vw, 2.55rem);
    line-height: 1.12;
    letter-spacing: -.055em;
}
.home-mode-heading p { margin: 7px 0 0; color: var(--text-soft); }
.home-mode-heading .text-link { padding-block: 7px; }
.home-page .mode-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.home-page .mode-grid .mode-card {
    grid-row: auto;
    grid-template: auto / 66px minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    min-height: 105px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.home-page .mode-grid .mode-card:hover { border-color: var(--green-700); box-shadow: var(--shadow-sm); }
.home-page .mode-grid .mode-card.is-selected {
    border-color: var(--green-700);
    background: var(--green-50);
    box-shadow: inset 0 0 0 1px var(--green-700);
}
.home-page .mode-card .mode-icon {
    width: 66px;
    max-width: 100%;
    height: 62px;
    margin: 0;
    border-radius: 13px;
    background: var(--green-100);
}
.home-page .mode-icon svg { width: 54px; }
.mode-copy { display: grid; gap: 4px; }
.mode-copy strong { font-size: 1.1rem; line-height: 1.25; }
.mode-copy > span { color: var(--text-soft); font-size: .875rem; line-height: 1.4; }
.mode-arrow { color: var(--primary); font-size: 1.23rem; font-weight: 750; }
#quizy, #launcher { scroll-margin-top: calc(var(--header-height) + 18px); }
.home-page .launcher-section { padding-block: 0 40px; }
.home-page .launcher-card { grid-template-columns: minmax(0, .66fr) minmax(0, 1.34fr); align-items: start; }
.home-page .launcher-copy h2 { font-size: clamp(1.8rem, 4vw, 2.65rem); letter-spacing: -.05em; }
.home-page .launcher-summary > span { letter-spacing: 0; text-transform: none; }
.home-page .launcher-summary small { font-size: .82rem; }
.home-page .region-choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.home-page .region-choice:first-child { grid-column: 1 / -1; }
.home-page .region-choice {
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 46px;
    padding: 9px 12px;
    background: var(--surface);
}
.home-page .region-choice input {
    position: static;
    width: 17px;
    height: 17px;
    margin: 0;
    opacity: 1;
}
.region-name { font-size: .9rem; font-weight: 680; line-height: 1.3; }
.home-page .region-choice.is-selected { background: var(--surface-2); }
.home-page .region-choice:focus-within { outline: 3px solid var(--green-700); outline-offset: 3px; }

.home-demo {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    align-items: center;
    gap: clamp(18px, 5vw, 62px);
    padding: clamp(20px, 4vw, 42px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--surface-2);
}
.home-demo-copy .ui-illustration { width: 96px; margin-bottom: 12px; }
.home-demo h2 { margin: 0 0 10px; }
.home-demo-copy p { margin: 0 0 10px; color: var(--text-soft); }
.home-demo .home-case {
    margin: 0;
    padding: clamp(17px, 3vw, 26px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}
.home-demo-clue { margin: 0 0 14px; font-size: 1.12rem; font-weight: 650; }
.home-case-form input { border-color: var(--border-strong); }
.home-case-form p:empty { display: none; }
.home-demo .home-case-reveal { width: auto; min-height: 44px; padding: 5px 0; border: 0; text-decoration: underline; text-underline-offset: .25em; }
.home-demo .home-case-answer { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
.home-demo .home-case-answer > span { grid-row: auto; }
.home-page .featured-custom { margin-top: 46px; }
.home-page .community-section { padding-block: 40px 58px; }
.home-page .stats-panel h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
.home-page .account-invite { margin-top: 40px; }

.page-hero, .profile-hero, .legal-hero, .admin-hero, .auth-aside, .contact-aside {
    background: var(--surface-2);
}
.page-hero, .profile-hero { border-bottom: 1px solid var(--border); }
.page-hero h1, .profile-identity h1, .community-intro h1 {
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    font-weight: 820;
    line-height: 1.08;
    letter-spacing: -.062em;
}
.auth-aside { min-height: 0; }
.auth-shell, .question-panel, .quiz-ready-card, .result-card { box-shadow: var(--shadow-sm); }
.quiz-ready-section, .result-section { padding-top: clamp(22px, 5vw, 58px); }
.quiz-status-bar { background: var(--surface); }
.answer-choice:hover:not(:disabled), .answer-choice:focus-visible { color: var(--green-900); }
.map-tool { min-height: 44px; }
.leaflet-container { background: var(--map-sea); font-family: var(--font); }
.leaflet-bar a, .leaflet-bar a:hover { background: var(--surface); color: var(--primary); }
.leaflet-tooltip { border: 1px solid var(--border-strong); border-radius: 7px; color: var(--text); box-shadow: var(--shadow-sm); }
.site-footer { background: var(--surface-2); }

@media (min-width: 1040px) {
    .main-nav { justify-content: center; gap: 2px; margin-left: 0; }
    .main-nav a { padding-inline: 9px; white-space: nowrap; }
    .main-nav .nav-icon, .main-nav .nav-profile { display: none; }
    .header-actions { margin-left: 0; }
}

@media (min-width: 1040px) and (max-width: 1199px) {
    .main-nav a { padding-inline: 6px; }
    .main-nav .nav-hall { display: none; }
}

@media (min-width: 680px) and (max-width: 1039px) {
    .header-actions .register-link { display: inline-flex; }
    .account-pill { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
}

@media (max-width: 759px) {
    :root { --header-height: 64px; }
    .home-hero { margin-top: 18px; }
    .home-hero-copy { padding: 24px; }
    .home-hero-actions { margin-top: 19px; }
    .home-hero-actions .button { min-height: 46px; padding-inline: 12px; }
    .home-page .launcher-card, .home-demo { grid-template-columns: minmax(0, 1fr); }
    .home-page .launcher-section { padding-bottom: 28px; }
}

@media (max-width: 959px) {
    .home-page .mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 559px) {
    .home-page .mode-grid { grid-template-columns: minmax(0, 1fr); gap: 9px; }
    .home-page .mode-grid .mode-card { min-height: 80px; padding: 10px 13px; }
}

@media (max-width: 640px) {
    .header-inner { gap: 8px; }
    .brand { gap: 8px; font-size: 1.12rem; }
    .brand-mark.brand-logo { width: 33px; height: 33px; }
    .header-actions .button { padding-inline: 10px; }
    .home-hero { grid-template-columns: minmax(0, 1fr); border-radius: 23px; }
    .home-hero-kicker { margin-bottom: 13px; }
    .home-hero h1 { margin-bottom: 15px; font-size: clamp(2.75rem, 11vw, 4.5rem); }
    .home-hero-art { min-height: 166px; margin-top: -12px; }
    .home-hero-art img { width: min(90%, 220px); }
    .home-page .daily-home-card { grid-template-columns: 46px minmax(0, 1fr); gap: 10px; padding: 14px; }
    .home-daily-icon { width: 46px; height: 46px; border-radius: 13px; }
    .home-daily-icon svg { width: 23px; height: 23px; }
    .home-page .daily-home-action { grid-column: 2; justify-self: start; }
    .home-page .quiz-modes { padding-block: 32px 24px; }
}

@media (max-width: 679px) {
    .main-nav .nav-register { display: flex; }
}

@media (max-width: 380px) {
    .home-hero-actions .button { width: 100%; }
    .home-page .region-choice-grid { grid-template-columns: minmax(0, 1fr); }
    .main-nav.is-open { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; }
    .button, .home-page .mode-card { transition: none; }
}
