:root {
    --yellow: #f7cf22;
    --yellow-soft: #fff5ba;
    --blue: #1649a8;
    --blue-dark: #0d2f70;
    --red: #db2d35;
    --ink: #5F6F8B;
    --muted: #626873;
    --paper: #fffaf0;
    --white: #ffffff;
    --line: #e7dfcf;
    --soft: #f5efe4;
    --radius: 22px;
    --shadow: 0 14px 35px rgba(34, 37, 42, 0.09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Nunito, Helvetica, sans-serif; line-height: 1.6; }
img { max-width: 100%; display: block; }
a { color: var(--blue); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

h1, h2, h3, h4 { margin: 0 0 0.7rem; line-height: 1.08; letter-spacing: -0.03em; color:var(--blue);}
h1 { font-size: clamp(1.32rem, 4.8vw, 1.5rem); color:var(--blue);}
h2 { font-size: clamp(1.08rem, 3.6vw, 1.125rem); color:var(--blue);}
h3 { font-size: clamp(0.87rem, 3vw, 1.05rem); color:var(--blue);}
h4 { font-size: 0.825rem; color:var(--blue);}
p { margin: 0 0 1rem; }

.container { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }
.narrow { max-width: 760px; }
.section { padding: 72px 0; }
.section-heading { max-width: 700px; margin-bottom: 34px; }
.eyebrow { display: inline-block; margin-bottom: 10px; color: var(--red); font-size: 0.8rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 12px; top: -50px; z-index: 1000; background: var(--ink); color: var(--white); padding: 10px 14px; }
.skip-link:focus { top: 12px; }

.site-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid rgba(34,37,42,0.08); background: rgba(255,250,240,0.96); backdrop-filter: blur(10px); }
.nav-wrap { min-height: 74px; display: flex; align-items: center; justify-content: space-between; }
.brand img { width: 170px; }
.site-nav { display: none; }
.site-nav.is-open { display: flex; position: absolute; left: 16px; right: 16px; top: 68px; flex-direction: column; gap: 6px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); box-shadow: var(--shadow); }
.site-nav a { padding: 10px; color: var(--ink); text-decoration: none; font-weight: 700; }
.menu-button { width: 44px; height: 44px; display: grid; place-content: center; gap: 4px; border: 0; background: transparent; }
.menu-button span:not(.sr-only) { width: 24px; height: 2px; background: var(--ink); }

.button { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; padding: 12px 20px; border: 0; border-radius: 999px; background: var(--yellow); color: var(--ink); font-weight: 800; text-decoration: none; cursor: pointer; box-shadow: 0 6px 0 #d8ad00; }
.button-small { min-height: 40px; padding: 8px 15px; }
.button-dark { background: var(--ink); color: var(--white); box-shadow: 0 6px 0 #000; }
.button-danger { background: var(--red); color: var(--white); box-shadow: 0 6px 0 #9f171e; }
.button-full { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.text-link { font-weight: 800; }

.hero { padding: 48px 0 64px; overflow: hidden; }
.hero-grid { display: grid; gap: 30px; align-items: center; }
.hero-text { max-width: 680px; font-size: 1.08rem; color: var(--muted); }
.hero-art { position: relative; max-width: 420px; margin: auto; padding: 25px; }
.hero-art::before { content: ""; position: absolute; inset: 10% 0 0; z-index: -1; border-radius: 48% 52% 46% 54%; background: var(--yellow); }
.speech-bubble { position: absolute; z-index: 2; padding: 9px 13px; border: 2px solid var(--ink); border-radius: 16px; background: var(--white); font-weight: 800; box-shadow: 4px 4px 0 var(--ink); }
.speech-one { top: 4px; right: 0; }
.speech-two { bottom: 15px; left: 0; }

.card, .phrase-card, .level-card, .slide-card, .quiz-shell, .form-card, .admin-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); }
.benefit-grid, .phrase-grid, .stats-grid { display: grid; gap: 18px; }
.benefit-card { padding: 24px; }
.benefit-icon { font-size: 2rem; }
.benefit-card h3 { margin-top: 12px; font-size: 1.35rem; }

.section-blue { background: var(--blue); color: var(--white); }
.eyebrow-light { color: var(--yellow); }
.two-column { display: grid; gap: 30px; }
.check-list { margin: 0; padding: 0; list-style: none; }
.check-list li { position: relative; margin-bottom: 14px; padding: 14px 16px 14px 44px; border-radius: 14px; background: rgba(255,255,255,0.1); }
.check-list li::before { content: "✓"; position: absolute; left: 17px; font-weight: 900; color: var(--yellow); }

.phrase-card { padding: 23px; }
.phrase-card span { display: block; color: var(--blue); font-size: 1.45rem; font-weight: 900; }
.phrase-card strong { display: block; margin: 5px 0 8px; }
.phrase-card p { color: var(--muted); margin: 0; }

.section-soft { background: var(--soft); }
.faq-list details { margin-bottom: 12px; padding: 17px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.faq-list summary { cursor: pointer; font-weight: 900; }
.faq-list p { margin: 12px 0 0; color: var(--muted); }
.final-cta { padding: 60px 0; background: var(--red); color: var(--white); text-align: center; }
.final-cta .container { display: grid; justify-items: center; gap: 12px; }

.site-footer { padding: 54px 0 20px; background: var(--ink); color: #d9d9d9; }
.footer-grid { display: grid; gap: 30px; }
.footer-logo { width: 190px; margin-bottom: 12px; filter: brightness(0) invert(1); }
.site-footer h4 { color: var(--white); font-size: 1rem; }
.site-footer a, .site-footer span { display: block; color: #d9d9d9; text-decoration: none; margin: 6px 0; }
.footer-bottom { margin-top: 35px; padding-top: 18px; border-top: 1px solid #444; }

.page-main { min-height: 60vh; padding: 60px 0; }
.page-header { padding: 50px 0; }
.form-page { min-height: 72vh; display: grid; place-items: center; padding: 42px 16px; }
.form-card { width: min(100%, 520px); padding: 28px; }
.form-card-wide { width: min(100%, 820px); }
.center-card { text-align: center; }
.status-icon { font-size: 3rem; }
.form-card label, .admin-form label { display: block; margin: 15px 0 6px; font-weight: 800; }
input, select { width: 100%; min-height: 48px; padding: 10px 13px; border: 1px solid #cfc7b8; border-radius: 12px; background: var(--white); color: var(--ink); }
.form-grid { display: grid; gap: 0 18px; }
.checkbox-row { display: flex !important; gap: 10px; align-items: flex-start; }
.checkbox-row input { width: auto; min-height: auto; margin-top: 5px; }
.form-actions { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-top: 22px; }
.form-footer { margin-top: 22px; text-align: center; }
.optional { color: var(--muted); font-weight: 400; }
fieldset { margin: 24px 0; padding: 0; border: 0; }
legend { font-weight: 900; margin-bottom: 10px; }
.choice-grid { display: grid; gap: 12px; }
.choice-card { display: flex !important; gap: 12px; margin: 0 !important; padding: 15px; border: 2px solid var(--line); border-radius: 14px; cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--blue); background: #eef4ff; }
.choice-card input { width: auto; min-height: auto; }
.choice-card small { display: block; color: var(--muted); }
.password-rules { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px 15px; padding-left: 20px; color: var(--muted); font-size: 0.9rem; }
.password-rules li.is-valid { color: #16803a; font-weight: 800; }

.member-header, .admin-title-row { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 28px; }
.level-card { padding: 26px; }
.level-card-top { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.level-progress-label { min-width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; background: var(--yellow); font-weight: 900; }
.card-kicker { color: var(--red); font-weight: 900; text-transform: uppercase; font-size: 0.78rem; }
.lesson-list { display: grid; gap: 10px; margin-top: 24px; }
.lesson-row { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); text-decoration: none; background: var(--paper); }
.lesson-row small { display: block; color: var(--muted); }
.lesson-number { width: auto; min-width: 92px; height: 34px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; background: var(--blue); color: var(--white); font-weight: 900; line-height: 1; white-space: nowrap; }
.lesson-row.is-current { border-color: var(--blue); background: #eef4ff; }
.lesson-row.is-complete .lesson-number { background: #1b8a44; }

.lesson-page { min-height: calc(100vh - 74px); padding: 14px; background: var(--soft); }
.lesson-shell, .quiz-shell { width: min(760px, 100%); margin: 0 auto; }
.lesson-meta { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; margin-bottom: 10px; }
.lesson-meta span, .lesson-meta strong { display: block; }
.lesson-exit { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--white); color: var(--ink); text-decoration: none; font-size: 1.6rem; }
.lesson-quiz-link { font-weight: 900; }
.lesson-progress { height: 8px; margin-bottom: 12px; border-radius: 999px; background: #ddd; overflow: hidden; }
.lesson-progress span { display: block; height: 100%; background: var(--red); }
.slide-card { padding: 18px; }
.slide-label { margin-bottom: 12px; color: var(--red); font-weight: 900; font-size: 0.8rem; letter-spacing: 0.12em; }
.slide-phrases { display: grid; gap: 10px; }
.learning-phrase { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 13px; border-radius: 16px; background: var(--paper); }
.learning-phrase h2 { margin-bottom: 3px; font-size: 1.35rem; }
.learning-phrase p { margin: 0; color: var(--muted); }
.phrase-audio { width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--yellow); color: var(--ink); font-weight: 900; cursor: pointer; }
.culture-note { margin-top: 12px; padding: 12px 14px; border-left: 5px solid var(--blue); border-radius: 12px; background: #eef4ff; }
.culture-note p { margin: 3px 0 0; }
.lesson-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.lesson-nav-button { display: grid; min-height: 48px; place-items: center; border-radius: 14px; background: var(--blue); color: var(--white); text-decoration: none; font-weight: 900; }
.lesson-nav-button.secondary { background: var(--white); color: var(--ink); border: 1px solid var(--line); }

.quiz-shell { margin-top: 30px; padding: 28px; }
.quiz-options { display: grid; gap: 12px; margin: 24px 0; }
.quiz-options button { min-height: 52px; padding: 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--white); text-align: left; cursor: pointer; }

.admin-body { background: #f3f4f6; }
.admin-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 14px 24px; background: var(--ink); }
.admin-header .brand img { filter: brightness(0) invert(1); }
.admin-header nav { display: flex; gap: 15px; }
.admin-header a { color: var(--white); text-decoration: none; font-weight: 800; }
.admin-main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 40px 0; }
.stats-grid { margin-bottom: 25px; }
.stat-card { padding: 22px; border-radius: 18px; background: var(--white); box-shadow: var(--shadow); }
.stat-card strong { display: block; font-size: 2rem; }
.stat-card span { color: var(--muted); }
.admin-panel { padding: 25px; }
.admin-filters { display: grid; gap: 12px; margin-bottom: 20px; padding: 18px; border-radius: 18px; background: var(--white); }
.table-wrap { overflow-x: auto; border-radius: 18px; background: var(--white); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px; border-bottom: 1px solid #ececec; text-align: left; white-space: nowrap; }
th { background: #fafafa; font-size: 0.82rem; text-transform: uppercase; }
.status { display: inline-block; padding: 4px 9px; border-radius: 999px; font-size: 0.8rem; font-weight: 900; }
.status.active { background: #dbf5e4; color: #176a32; }
.status.disabled { background: #ffe0e2; color: #a11d25; }
.admin-form-actions { margin-top: 22px; }
.admin-danger-zone { padding-top: 0; }

.debug-panel { position: fixed; right: 10px; bottom: 10px; z-index: 9999; width: min(420px, calc(100% - 20px)); max-height: 55vh; overflow: auto; padding: 14px; border: 2px solid #ff8c00; border-radius: 12px; background: #111; color: #fff; font: 13px/1.4 monospace; }
.debug-panel details { margin-top: 8px; }
.debug-panel pre { white-space: pre-wrap; }

@media (min-width: 680px) {
    .benefit-grid, .phrase-grid, .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid, .choice-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-filters { grid-template-columns: 2fr 1fr 1fr auto; }
    .footer-grid { grid-template-columns: 2fr repeat(3, 1fr); }
    .slide-card { padding: 24px; }
}

@media (min-width: 900px) {
    .menu-button { display: none; }
    .site-nav { display: flex; align-items: center; gap: 6px; }
    .site-nav a { padding: 9px 10px; }
    .hero-grid, .two-column { grid-template-columns: 1.15fr 0.85fr; }
    .hero { padding: 72px 0 88px; }
    .benefit-grid, .phrase-grid, .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 600px) {
    .admin-header { align-items: flex-start; flex-direction: column; }
    .admin-header nav { flex-wrap: wrap; }
    .admin-title-row, .member-header, .level-card-top { align-items: flex-start; flex-direction: column; }
    .password-rules { grid-template-columns: 1fr; }
    .site-footer { padding-bottom: 100px; }
}


/* Add this block to the bottom of /assets/css/site.css */

.lesson-shell {
    width: min(900px, calc(100% - 32px));
    margin: 40px auto;
}

.lesson-heading {
    margin-bottom: 28px;
}

.explainer-slide,
.phrase-card {
    background: #ffffff;
    border: 1px solid rgba(95, 111, 139, 0.18);
    border-radius: 20px;
    box-shadow: 0 14px 34px rgba(36, 58, 94, 0.08);
    padding: 28px;
}

.vowel-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(90px, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.vowel-card {
    display: grid;
    gap: 4px;
    text-align: center;
    padding: 16px;
    border-radius: 14px;
    background: rgba(252, 209, 22, 0.18);
}

.vowel-card strong {
    color: var(--blue);
    font-size: 2rem;
    text-transform: uppercase;
}

.phrase-list {
    display: grid;
    gap: 18px;
}

.phrase-card {
    position: relative;
}

.phrase-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.audio-button,
.microphone-button {
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.15rem;
}

.audio-button {
    background: var(--yellow);
}

.microphone-button {
    background: var(--blue);
    color: #ffffff;
}

.phrase-target {
    color: var(--blue);
    font-size: clamp(1.7rem, 5vw, 2.6rem);
    font-weight: 800;
    margin: 12px 0 4px;
}

.phrase-token {
    position: relative;
    display: inline-block;
    border-bottom: 2px dotted rgba(0, 56, 168, 0.45);
    cursor: help;
    margin-right: 0.2em;
}

.phrase-token::after {
    content: attr(data-tooltip);
    position: absolute;
    z-index: 20;
    left: 50%;
    bottom: calc(100% + 10px);
    width: min(280px, 70vw);
    transform: translateX(-50%);
    padding: 12px;
    border-radius: 10px;
    background: #172033;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.35;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.phrase-token:hover::after,
.phrase-token:focus::after {
    opacity: 1;
}

.phrase-source {
    font-size: 1.1rem;
}

.pronunciation-result {
    min-height: 30px;
    margin-top: 14px;
}

.pronunciation-result strong {
    color: var(--blue);
    font-size: 1.35rem;
}

.pronunciation-result small {
    display: block;
    margin-top: 5px;
}

.lesson-navigation {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 24px;
}

textarea[name="lesson_json"] {
    width: 100%;
    min-height: 480px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.9rem;
}

@media (max-width: 700px) {
    .vowel-grid {
        grid-template-columns: repeat(2, minmax(100px, 1fr));
    }

    .explainer-slide,
    .phrase-card {
        padding: 20px;
    }
}
/* Admin-only learning-track test switcher. Scoped so it cannot affect normal forms. */
.admin-test-switcher {
    margin: 0;
}

.admin-test-switcher label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 5px 7px;
    border: 1px solid rgba(34, 37, 42, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
}

.admin-test-switcher label > span {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    line-height: 1;
    text-transform: uppercase;
}

.admin-test-switcher select {
    max-width: 142px;
    min-height: 30px;
    padding: 4px 26px 4px 8px;
    border: 1px solid rgba(34, 37, 42, 0.14);
    border-radius: 7px;
    background-color: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

@media (max-width: 899px) {
    .admin-test-switcher {
        width: 100%;
        padding: 4px 10px;
    }

    .admin-test-switcher label {
        justify-content: space-between;
    }

    .admin-test-switcher select {
        max-width: 190px;
    }
}

.admin-test-bar {
    border-top: 1px solid rgba(34, 37, 42, 0.07);
    background: #eef4ff;
}

.admin-test-bar-inner {
    display: flex;
    min-height: 42px;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.admin-test-bar-inner > strong {
    color: #17458d;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

@media (max-width: 600px) {
    .admin-test-bar-inner {
        justify-content: space-between;
        gap: 8px;
    }

    .admin-test-bar-inner > strong {
        font-size: 0.66rem;
    }
}

@media (max-width: 899px) {
    .admin-test-bar .admin-test-switcher {
        width: auto;
        padding: 0;
    }
}
