:root {
    --ink: #102a43;
    --ink-deep: #071827;
    --ink-soft: #334e68;
    --muted: #627d98;
    --line: #d8e2ea;
    --paper: #ffffff;
    --paper-soft: #f7f4ed;
    --navy: #102a43;
    --navy-bright: #174766;
    --emerald: #047857;
    --emerald-dark: #065f46;
    --emerald-soft: #ecfdf5;
    --gold: #b7791f;
    --gold-soft: #fff8e7;
    --danger: #991b1b;
    --shadow: 0 18px 50px rgba(16, 42, 67, 0.11);
    --radius: 22px;
    color: var(--ink);
    background: var(--paper-soft);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; }
a { color: inherit; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 3px;
    border-radius: 6px;
}

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 12px;
    left: 12px;
    padding: 12px 16px;
    color: #fff;
    background: var(--ink-deep);
    border-radius: 10px;
    transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.app-home {
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 4%, rgba(183, 121, 31, 0.13), transparent 25rem),
        radial-gradient(circle at 92% 24%, rgba(4, 120, 87, 0.1), transparent 24rem),
        linear-gradient(180deg, #f7f4ed 0%, #ffffff 38%, #f7f4ed 100%);
}

.site-header {
    position: sticky;
    z-index: 50;
    top: 0;
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    padding: max(12px, env(safe-area-inset-top)) clamp(20px, 5vw, 72px) 12px;
    border-bottom: 1px solid rgba(216, 226, 234, 0.92);
    background: rgba(247, 244, 237, 0.95);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}
.brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 2px solid #d8ad5b;
    border-radius: 14px 14px 7px 7px;
    color: #fff;
    background: var(--navy);
    box-shadow: 0 8px 20px rgba(16, 42, 67, 0.2);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.08em;
}
.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, "Times New Roman", serif; font-size: 17px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }

.header-nav { display: flex; align-items: center; gap: 8px; }
.header-nav a {
    min-height: 44px;
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 750;
    text-decoration: none;
}
.header-nav a:hover { color: var(--navy); background: #e6edf2; }

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
    gap: clamp(36px, 6vw, 84px);
    align-items: center;
    max-width: 1280px;
    min-height: 650px;
    margin: 0 auto;
    padding: clamp(64px, 10vw, 128px) clamp(24px, 6vw, 80px);
}
.eyebrow {
    margin: 0 0 14px;
    color: var(--emerald-dark);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.hero h1 {
    max-width: 850px;
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(44px, 6.4vw, 80px);
    font-weight: 700;
    letter-spacing: -0.045em;
    line-height: 0.98;
}
.hero-lead {
    max-width: 760px;
    margin: 28px 0 0;
    color: var(--ink-soft);
    font-size: clamp(18px, 2vw, 22px);
    line-height: 1.65;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.button {
    display: inline-flex;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    padding: 14px 22px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-weight: 850;
    text-decoration: none;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.button:hover { transform: translateY(-2px); }
.button-primary { color: #fff; background: var(--navy); box-shadow: 0 12px 28px rgba(16, 42, 67, 0.24); }
.button-primary:hover { background: var(--navy-bright); }
.button-secondary { border-color: var(--line); background: #fff; }
.button-secondary:hover { border-color: #9fb3c8; box-shadow: 0 10px 24px rgba(16, 42, 67, 0.08); }
.trust-list { display: flex; flex-wrap: wrap; gap: 18px; padding: 0; margin: 28px 0 0; color: var(--muted); list-style: none; font-size: 13px; font-weight: 750; }
.trust-list li::before { content: "✓"; margin-right: 6px; color: var(--emerald); font-weight: 900; }

.hero-panel {
    padding: clamp(26px, 4vw, 42px);
    border: 1px solid rgba(216, 173, 91, 0.55);
    border-radius: 28px;
    color: #fff;
    background:
        linear-gradient(140deg, rgba(255,255,255,0.04), transparent 44%),
        linear-gradient(145deg, #071827, #102a43 70%, #174766);
    box-shadow: 0 30px 80px rgba(7, 24, 39, 0.25);
}
.panel-kicker { margin: 0 0 26px; color: #f4d58d; font-size: 12px; font-weight: 900; letter-spacing: 0.16em; text-transform: uppercase; }
.course-path { display: grid; gap: 0; padding: 0; margin: 0; list-style: none; }
.course-path li { position: relative; display: grid; min-height: 94px; grid-template-columns: 44px 1fr; gap: 0 14px; padding-bottom: 22px; }
.course-path li:not(:last-child)::after { position: absolute; top: 38px; bottom: 0; left: 18px; width: 1px; content: ""; background: rgba(244, 213, 141, 0.35); }
.course-path span { z-index: 1; display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgba(244, 213, 141, 0.56); border-radius: 50%; color: #f4d58d; background: var(--navy); font-size: 11px; font-weight: 900; }
.course-path strong { align-self: center; font-family: Georgia, serif; font-size: 21px; }
.course-path small { grid-column: 2; color: #c7d5e0; font-size: 13px; line-height: 1.5; }

.game-feature {
    display: grid;
    max-width: 1180px;
    grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1fr);
    margin: 0 auto 36px;
    overflow: hidden;
    border: 1px solid rgba(216, 173, 91, 0.62);
    border-radius: 28px;
    color: #f8f3e8;
    background: linear-gradient(145deg, #071827, #102a43 72%, #174766);
    box-shadow: 0 28px 70px rgba(7, 24, 39, 0.2);
}
.game-feature-art { position: relative; min-height: 450px; overflow: hidden; }
.game-feature-art::after { position: absolute; inset: 0; background: linear-gradient(90deg, transparent 55%, #0b2234 100%); content: ""; }
.game-feature-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 35%; }
.game-feature-art span { position: absolute; bottom: 22px; left: 22px; z-index: 1; padding: 8px 11px; border: 1px solid rgba(244,213,141,0.6); border-radius: 999px; color: #f4d58d; background: rgba(7,24,39,0.82); font-size: 10px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; backdrop-filter: blur(8px); }
.game-feature-copy { display: grid; align-content: center; padding: clamp(34px, 6vw, 72px); }
.game-feature-copy .eyebrow { color: #f4d58d; }
.game-feature-copy h2 { max-width: 650px; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(35px, 4.5vw, 58px); font-weight: 600; letter-spacing: -0.04em; line-height: 1.02; }
.game-feature-copy > p:not(.eyebrow) { max-width: 650px; margin: 24px 0; color: #c9d6df; font-size: 16px; line-height: 1.7; }
.game-feature-copy ul { display: flex; flex-wrap: wrap; gap: 1px; padding: 0; margin: 0 0 28px; list-style: none; background: rgba(255,255,255,0.1); }
.game-feature-copy li { display: grid; flex: 1 1 120px; gap: 2px; padding: 14px; background: #102a43; }
.game-feature-copy li strong { color: #f4d58d; font-family: Georgia, serif; font-size: 25px; }
.game-feature-copy li span { color: #9db1bf; font-size: 9px; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.button-game { width: fit-content; color: #071827; background: #f4d58d; box-shadow: 0 14px 30px rgba(244,213,141,0.15); }
.button-game:hover { background: #ffe4a6; }

.study-strip {
    display: grid;
    max-width: 1180px;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    margin: 0 auto 36px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--line);
    box-shadow: var(--shadow);
}
.study-strip article { display: flex; gap: 16px; align-items: center; padding: 26px; background: #fff; }
.study-strip article > span { display: grid; flex: 0 0 auto; width: 44px; height: 44px; place-items: center; border-radius: 12px; color: var(--emerald-dark); background: var(--emerald-soft); font-family: Georgia, serif; font-size: 22px; font-weight: 800; }
.study-strip h2 { margin: 0; font-family: Georgia, serif; font-size: 20px; }
.study-strip p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.library { max-width: 1280px; margin: 0 auto; padding: 86px clamp(24px, 6vw, 80px) 100px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 36px; }
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(36px, 5vw, 54px); letter-spacing: -0.035em; }
.search-wrap { width: min(100%, 390px); }
.search-wrap label { display: block; margin-bottom: 8px; color: var(--ink-soft); font-size: 13px; font-weight: 800; }
.search-field { display: flex; overflow: hidden; border: 1px solid #aebfce; border-radius: 12px; background: #fff; box-shadow: 0 8px 22px rgba(16, 42, 67, 0.06); }
.search-field:focus-within { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16); }
.search-field input { min-width: 0; min-height: 48px; flex: 1; padding: 12px 14px; border: 0; outline: 0; color: var(--ink); background: transparent; }
.search-field button { padding: 0 14px; border: 0; color: var(--navy); background: transparent; font-size: 13px; font-weight: 800; cursor: pointer; }
.search-status { margin: 7px 2px 0; color: var(--muted); font-size: 12px; }

.chapter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.chapter-card {
    position: relative;
    display: flex;
    min-height: 326px;
    flex-direction: column;
    padding: clamp(24px, 4vw, 36px);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 12px 34px rgba(16, 42, 67, 0.065);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.chapter-card::after { position: absolute; top: -80px; right: -80px; width: 170px; height: 170px; border: 34px solid rgba(4, 120, 87, 0.06); border-radius: 50%; content: ""; }
.chapter-card:hover { transform: translateY(-4px); border-color: #9fb3c8; box-shadow: 0 22px 45px rgba(16, 42, 67, 0.12); }
.chapter-card[hidden] { display: none; }
.chapter-number { position: absolute; top: 28px; right: 30px; color: #ced9e3; font-family: Georgia, serif; font-size: 34px; font-weight: 800; }
.chapter-label { margin: 0 0 16px; color: var(--emerald-dark); font-size: 11px; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; }
.chapter-card h3 { z-index: 1; max-width: 80%; margin: 0; font-family: Georgia, serif; font-size: clamp(25px, 3vw, 34px); letter-spacing: -0.025em; line-height: 1.12; }
.chapter-card > p:not(.chapter-label) { z-index: 1; margin: 18px 0; color: var(--ink-soft); line-height: 1.65; }
.chapter-card ul { display: flex; flex-wrap: wrap; gap: 7px; padding: 0; margin: auto 0 22px; list-style: none; }
.chapter-card li { padding: 6px 9px; border-radius: 999px; color: var(--ink-soft); background: #eef3f6; font-size: 11px; font-weight: 750; }
.chapter-card > a { z-index: 1; display: flex; min-height: 44px; align-items: center; justify-content: space-between; padding-top: 14px; border-top: 1px solid var(--line); color: var(--emerald-dark); font-weight: 850; text-decoration: none; }
.chapter-card > a:hover { color: var(--navy); }
.chapter-card-featured { border-color: rgba(183, 121, 31, 0.5); background: linear-gradient(145deg, #fff, var(--gold-soft)); }
.empty-state { padding: 44px; border: 1px dashed #9fb3c8; border-radius: var(--radius); color: var(--muted); background: #fff; text-align: center; }

.disclaimer { display: flex; max-width: 1120px; gap: 20px; align-items: flex-start; margin: 0 auto 100px; padding: 28px; border: 1px solid #ecd7a6; border-radius: var(--radius); background: var(--gold-soft); }
.disclaimer > div:first-child { display: grid; flex: 0 0 48px; width: 48px; height: 48px; place-items: center; border-radius: 14px; color: #fff; background: var(--gold); font-family: Georgia, serif; font-size: 26px; }
.disclaimer h2 { margin: 0 0 7px; font-family: Georgia, serif; font-size: 21px; }
.disclaimer p { margin: 0; color: #654c24; line-height: 1.6; }

.site-footer { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; padding: 38px clamp(24px, 6vw, 80px) max(38px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: #d6e1e9; background: var(--ink-deep); }
.site-footer strong { color: #fff; font-family: Georgia, serif; font-size: 18px; }
.site-footer p { margin: 4px 0 0; font-size: 12px; }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 18px; }
.site-footer a { min-height: 36px; padding-block: 8px; font-size: 13px; font-weight: 750; }
.copyright { grid-column: 1 / -1; color: #93a8b8; }

.legal-page { min-height: 100vh; color: var(--ink); background: linear-gradient(180deg, #f7f4ed, #fff 360px); }
.legal-main { max-width: 940px; margin: 0 auto; padding: 64px clamp(20px, 5vw, 54px) 96px; }
.legal-hero { padding: clamp(30px, 6vw, 54px); border: 1px solid rgba(216, 173, 91, 0.5); border-radius: 28px; color: #fff; background: linear-gradient(145deg, var(--ink-deep), var(--navy)); box-shadow: var(--shadow); }
.legal-hero .eyebrow { color: #f4d58d; }
.legal-hero h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(42px, 7vw, 68px); letter-spacing: -0.04em; }
.legal-hero > p:not(.eyebrow) { max-width: 700px; margin: 18px 0 0; color: #d6e1e9; font-size: 18px; line-height: 1.65; }
.legal-meta { display: flex; flex-wrap: wrap; gap: 10px 20px; padding: 22px 0 0; margin: 26px 0 0; border-top: 1px solid rgba(255,255,255,0.16); color: #b9cbd9; list-style: none; font-size: 12px; font-weight: 750; }
.legal-card { margin-top: 18px; padding: clamp(24px, 5vw, 38px); border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 10px 28px rgba(16, 42, 67, 0.055); }
.legal-card h2, .support-item h2 { margin: 0 0 14px; font-family: Georgia, serif; color: var(--ink); font-size: 24px; }
.legal-card p, .legal-card li, .support-item p { color: var(--ink-soft); line-height: 1.72; }
.legal-card p { margin: 12px 0 0; }
.legal-card ul { padding-left: 22px; }
.legal-card a { color: var(--emerald-dark); font-weight: 750; }
.notice { padding: 18px; border-left: 4px solid var(--gold); border-radius: 8px; color: #654c24; background: var(--gold-soft); line-height: 1.65; }
.support-email { display: inline-flex; min-height: 48px; align-items: center; margin-top: 20px; padding: 12px 18px; border-radius: 10px; color: #fff !important; background: var(--emerald-dark); text-decoration: none; }
.support-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 18px; }
.support-item { padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }

/* Shared course navigation injected into each preserved chapter. */
.course-library-nav { display: grid; gap: 5px; margin-bottom: 20px; padding-bottom: 18px; border-bottom: 2px solid #dbe4ea; }
.course-library-label { margin: 0 0 5px; color: #64748b; font-size: 10px; font-weight: 900; letter-spacing: 0.15em; text-transform: uppercase; }
.course-library-home, .course-library-link { display: grid; min-height: 38px; align-items: center; border-radius: 9px; color: #334155; font-size: 11px; font-weight: 700; line-height: 1.25; text-decoration: none; }
.course-library-home { grid-template-columns: 27px 1fr; padding: 7px 9px; color: #fff; background: var(--navy); }
.course-library-home:hover { background: var(--navy-bright); }
.course-library-game { display: grid; min-height: 48px; grid-template-columns: 27px 1fr; align-items: center; padding: 8px 9px; border: 1px solid rgba(183,121,31,0.38); border-radius: 9px; color: #7b4b0b; background: var(--gold-soft); text-decoration: none; }
.course-library-game:hover { border-color: var(--gold); background: #fff3d6; }
.course-library-game > span:last-child { display: grid; gap: 1px; }
.course-library-game strong { font-size: 11px; }
.course-library-game small { color: #8a6a35; font-size: 9px; letter-spacing: 0.04em; text-transform: uppercase; }
.course-library-link { grid-template-columns: 27px 1fr; padding: 7px 8px; }
.course-library-link:hover { color: var(--emerald-dark); background: var(--emerald-soft); }
.course-library-link[aria-current="page"] { color: var(--emerald-dark); background: #d9f7ea; box-shadow: inset 3px 0 var(--emerald); }
.course-library-number { display: grid; width: 22px; height: 22px; place-items: center; border: 1px solid #cbd5e1; border-radius: 50%; color: #64748b; font-size: 9px; font-weight: 900; }
.course-library-link[aria-current="page"] .course-library-number { border-color: var(--emerald); color: #fff; background: var(--emerald); }
.course-legal-links { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 8px; padding: 9px 8px 0; border-top: 1px solid #e2e8f0; }
.course-legal-link { min-height: 30px; padding-block: 7px; color: #64748b; font-size: 10px; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.course-legal-link:hover { color: var(--emerald-dark); }

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; min-height: auto; }
    .hero-panel { max-width: 640px; }
    .game-feature { grid-template-columns: 1fr; margin-inline: 20px; }
    .game-feature-art { min-height: 390px; }
    .game-feature-art::after { background: linear-gradient(0deg, #0b2234 0, transparent 45%); }
    .study-strip { margin-inline: 20px; grid-template-columns: 1fr; }
    .section-heading { align-items: stretch; flex-direction: column; }
    .search-wrap { width: 100%; }
}

@media (max-width: 680px) {
    .site-header { align-items: flex-start; gap: 12px; }
    .header-nav { gap: 2px; }
    .header-nav a { padding-inline: 8px; font-size: 12px; }
    .brand small { display: none; }
    .hero { padding-top: 54px; }
    .hero h1 { font-size: clamp(40px, 13vw, 58px); }
    .game-feature-art { min-height: 330px; }
    .game-feature-copy { padding: 28px 24px 34px; }
    .chapter-grid { grid-template-columns: 1fr; }
    .chapter-card { min-height: 305px; }
    .chapter-card h3 { max-width: 86%; }
    .disclaimer { margin-inline: 20px; padding: 22px; }
    .site-footer { grid-template-columns: 1fr; }
    .site-footer nav { justify-content: flex-start; }
    .copyright { grid-column: 1; }
    .support-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

@media print {
    .site-header, .site-footer, .hero-actions, .search-wrap { display: none !important; }
    .app-home, .legal-page { background: #fff; }
    .hero, .library, .legal-main { max-width: none; padding: 24px; margin: 0; }
    .hero-panel, .legal-hero { color: #000; border: 1px solid #aaa; background: #fff; box-shadow: none; }
    .chapter-card, .legal-card { break-inside: avoid; box-shadow: none; }
}
