:root {
  --ink: #102e42;
  --muted: #567083;
  --paper: #f7f4ed;
  --white: #ffffff;
  --blue: #174f6c;
  --blue-2: #2d7894;
  --sky: #dceef3;
  --rust: #bd5a36;
  --gold: #f2b544;
  --green: #257562;
  --red: #a33b32;
  --line: #cbd8de;
  --shadow: 0 18px 60px rgba(16, 46, 66, .15);
  --radius: 24px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); }
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 4px solid rgba(242, 181, 68, .9); outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 1000; padding: .8rem 1rem; background: var(--ink); color: #fff; border-radius: 12px; }
.skip-link:focus { top: 1rem; }

.topbar { position: sticky; top: 0; z-index: 50; min-height: 76px; display: flex; align-items: center; gap: 1.2rem; padding: .75rem clamp(1rem, 4vw, 4rem); color: #fff; background: rgba(13, 49, 69, .97); box-shadow: 0 6px 24px rgba(16,46,66,.2); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: .6rem; border: 0; background: transparent; color: #fff; font-size: clamp(1rem, 2vw, 1.25rem); font-weight: 800; letter-spacing: .02em; cursor: pointer; white-space: nowrap; }
.brand strong { color: #ffd36e; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--rust); color: #fff; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: .15rem; }
.top-actions button, .mobile-actions button { border: 0; background: transparent; color: #fff; padding: .75rem .8rem; border-radius: 12px; font-weight: 700; cursor: pointer; }
.top-actions button:hover, .mobile-actions button:hover { background: rgba(255,255,255,.12); }
.mobile-menu { display: none; margin-left: auto; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.1); color: #fff; border-radius: 12px; padding: .65rem .9rem; font-weight: 800; }
.mobile-actions { position: fixed; inset: 76px 0 auto 0; z-index: 49; padding: .65rem 1rem 1rem; display: grid; gap: .25rem; background: #123f58; box-shadow: var(--shadow); }
.mobile-actions[hidden] { display: none; }
.mobile-actions button { text-align: left; font-size: 1.05rem; }

main { min-height: 70vh; }
.page-shell { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(1.25rem, 4vw, 3.5rem) 0 4rem; }
.eyebrow { margin: 0 0 .55rem; color: var(--rust); font-size: .78rem; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.muted { color: var(--muted); }

.hero { min-height: min(720px, calc(100vh - 76px)); display: grid; align-items: center; position: relative; overflow: hidden; color: #fff; background: #0e405a url("assets/autumn.jpg") center/cover no-repeat; }
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8,35,51,.96) 0%, rgba(8,35,51,.82) 37%, rgba(8,35,51,.18) 72%, rgba(8,35,51,.08) 100%); }
.hero-content { position: relative; z-index: 1; width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 4rem 0; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(260px, .55fr); gap: 3rem; align-items: center; }
.hero-copy { max-width: 680px; }
.hero .eyebrow { color: #ffd36e; }
.hero h1 { margin: 0; max-width: 760px; font-size: clamp(3rem, 8vw, 6.8rem); line-height: .92; letter-spacing: -.05em; }
.hero h1 span { display: block; color: #ffd36e; }
.hero-subtitle { max-width: 640px; margin: 1.4rem 0 0; font-size: clamp(1.08rem, 2vw, 1.4rem); line-height: 1.55; color: #e9f5f7; }
.hero-actions, .button-row { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; }
.hero-cover { justify-self: end; align-self: end; width: min(320px, 36vw); padding: 1rem; border-radius: 28px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.32); backdrop-filter: blur(10px); transform: rotate(2deg); box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.hero-cover img { width: 100%; height: auto; display: block; border-radius: 15px; }
.hero-cover p { margin: .8rem 0 0; text-align: center; font-weight: 800; }

.primary, .secondary, .ghost, .voice-test, .upload-label { min-height: 50px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .78rem 1.15rem; border-radius: 14px; border: 2px solid transparent; font-weight: 850; text-decoration: none; cursor: pointer; }
.primary { background: var(--rust); color: #fff; box-shadow: 0 8px 22px rgba(189,90,54,.25); }
.primary:hover { background: #a9482b; }
.secondary { background: #fff; color: var(--blue); border-color: var(--blue); }
.secondary:hover { background: var(--sky); }
.ghost { color: #fff; border-color: rgba(255,255,255,.65); background: rgba(255,255,255,.08); }
.wide { width: 100%; }

.resume-card { margin-top: -2rem; position: relative; z-index: 3; display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; padding: 1.1rem 1.25rem; border-radius: 20px; background: #fff; box-shadow: var(--shadow); border: 1px solid var(--line); }
.resume-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: var(--sky); font-size: 1.7rem; }
.resume-card h2 { margin: 0 0 .2rem; font-size: 1.25rem; }
.resume-card p { margin: 0; color: var(--muted); }

.intro-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 1.5rem; margin: 3rem 0; align-items: stretch; }
.intro-card, .method-card { padding: clamp(1.4rem, 3vw, 2.2rem); border-radius: var(--radius); background: #fff; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(16,46,66,.08); }
.intro-card h2, .method-card h2, .section-heading h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.6rem); line-height: 1.1; }
.intro-card p { font-size: 1.06rem; line-height: 1.7; }
.approach-list { display: grid; gap: .75rem; margin: 1.2rem 0 0; padding: 0; list-style: none; }
.approach-list li { display: flex; align-items: center; gap: .8rem; padding: .8rem; border-radius: 14px; background: #eef6f7; font-weight: 750; }
.approach-list b { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--blue); color: #fff; }
.method-card { display: grid; grid-template-columns: 110px 1fr; gap: 1.2rem; align-items: center; background: linear-gradient(145deg, #fff 0%, #edf5f7 100%); }
.method-card img { width: 100%; border-radius: 10px; box-shadow: 0 8px 24px rgba(16,46,66,.2); }
.method-card p { margin: .55rem 0 0; color: var(--muted); line-height: 1.55; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 4rem 0 1.25rem; }
.section-heading p { margin: .35rem 0 0; color: var(--muted); }
.legend-chip { padding: .55rem .85rem; border-radius: 999px; color: var(--blue); background: var(--sky); font-weight: 800; white-space: nowrap; }
.season-section { margin-top: 1.5rem; overflow: hidden; border-radius: 30px; background: #fff; border: 1px solid var(--line); box-shadow: 0 12px 38px rgba(16,46,66,.08); }
.season-banner { min-height: 220px; display: flex; align-items: end; position: relative; padding: 1.6rem; color: #fff; background-position: center; background-size: cover; }
.season-banner::before { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(8,35,51,.9), rgba(8,35,51,.08) 80%); }
.season-banner > div { position: relative; z-index: 1; }
.season-banner h3 { margin: 0; font-size: clamp(2rem, 5vw, 3.6rem); }
.season-banner p { margin: .25rem 0 0; font-weight: 700; }
.season-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; padding: 1.25rem; }
.episode-card { min-height: 250px; display: flex; flex-direction: column; padding: 1.15rem; border: 2px solid #d7e2e7; border-radius: 20px; background: #fff; cursor: pointer; text-align: left; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.episode-card:hover { transform: translateY(-4px); border-color: var(--blue-2); box-shadow: 0 12px 28px rgba(16,46,66,.12); }
.episode-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.episode-number { display: inline-flex; align-items: center; gap: .35rem; padding: .38rem .62rem; border-radius: 999px; background: var(--sky); color: var(--blue); font-size: .78rem; font-weight: 900; letter-spacing: .06em; }
.episode-percent { font-size: .9rem; font-weight: 900; color: var(--green); }
.episode-card h4 { margin: 1rem 0 .5rem; font-size: 1.3rem; line-height: 1.15; }
.episode-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.episode-card .mini-progress { margin-top: auto; }
.mini-progress { height: 10px; margin-top: .9rem; overflow: hidden; border-radius: 999px; background: #e4ecef; }
.mini-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--rust), var(--gold)); }
.bilan-note { margin: 1rem 1.25rem 1.25rem; padding: .9rem 1rem; border-radius: 14px; background: #fff8e6; color: #6d531b; border: 1px solid #f0d58c; font-weight: 720; }

.episode-shell { width: min(1100px, calc(100% - 2rem)); margin: 0 auto; padding: 1.5rem 0 5rem; }
.episode-hero { min-height: 300px; display: grid; grid-template-columns: 1.05fr .95fr; overflow: hidden; border-radius: 30px; background: var(--ink); color: #fff; box-shadow: var(--shadow); }
.episode-hero-copy { display: flex; flex-direction: column; justify-content: center; padding: clamp(1.5rem, 5vw, 3.2rem); }
.episode-hero-copy .eyebrow { color: #ffd36e; }
.episode-hero h1 { margin: 0; font-size: clamp(2.4rem, 6vw, 4.8rem); line-height: .98; letter-spacing: -.04em; }
.episode-hero p { margin: 1rem 0 0; max-width: 620px; color: #dcecf1; font-size: 1.08rem; line-height: 1.55; }
.episode-hero-image { min-height: 300px; background-position: center; background-size: cover; }
.episode-overall { display: flex; align-items: center; gap: .8rem; margin-top: 1.2rem; }
.episode-overall .mini-progress { flex: 1; margin: 0; background: rgba(255,255,255,.24); }
.episode-overall strong { white-space: nowrap; }

.stage-nav { display: grid; grid-template-columns: repeat(5, 1fr); gap: .6rem; margin: 1.2rem 0; }
.stage-button { min-height: 86px; display: grid; place-items: center; gap: .2rem; padding: .55rem; border: 2px solid var(--line); border-radius: 16px; background: #fff; font-weight: 800; cursor: pointer; text-align: center; }
.stage-button span:first-child { font-size: 1.55rem; }
.stage-button small { display: block; color: var(--muted); font-size: .75rem; }
.stage-button.active { color: #fff; background: var(--blue); border-color: var(--blue); }
.stage-button.active small { color: #e4f1f5; }
.stage-button.complete { border-color: var(--green); }
.stage-button[disabled] { opacity: .45; cursor: not-allowed; }

.activity-frame { min-height: 520px; display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 1rem; align-items: stretch; }
.activity-card { display: flex; flex-direction: column; min-height: 520px; padding: clamp(1.25rem, 4vw, 2.4rem); border-radius: 26px; background: #fff; border: 1px solid var(--line); box-shadow: 0 12px 34px rgba(16,46,66,.09); }
.activity-kicker { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.activity-kicker strong { color: var(--rust); font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; }
.activity-count { padding: .35rem .6rem; border-radius: 999px; background: #eef4f6; color: var(--muted); font-size: .82rem; font-weight: 800; }
.activity-card h2 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.7rem); line-height: 1.1; }
.instruction { margin: .8rem 0; font-size: 1.15rem; line-height: 1.55; }
.help-line { margin: .35rem 0 1rem; padding: .7rem .85rem; border-left: 5px solid var(--gold); border-radius: 0 10px 10px 0; background: #fff8e7; color: #6b5425; font-size: .92rem; line-height: 1.4; }
.scene-panel { min-height: 250px; margin: .7rem 0 1rem; border-radius: 20px; background-position: center; background-size: cover; }
.goal-box, .memo-box, .model-box { margin: .8rem 0; padding: 1rem 1.1rem; border-radius: 16px; background: #edf6f7; border: 1px solid #c9e1e5; }
.goal-box strong, .memo-box strong, .model-box strong { display: block; margin-bottom: .35rem; color: var(--blue); }
.memo-box p, .model-box p { margin: .35rem 0; line-height: 1.55; }
.example { font-size: 1.08rem; font-weight: 800; color: var(--blue); }
.listen-button { align-self: flex-start; margin: .5rem 0; border: 2px solid var(--blue); border-radius: 13px; background: #fff; color: var(--blue); padding: .7rem .9rem; font-weight: 850; cursor: pointer; }
.listen-button:hover { background: var(--sky); }
.options { display: grid; gap: .7rem; margin: 1rem 0; }
.option-button { min-height: 56px; display: flex; align-items: center; gap: .75rem; padding: .8rem 1rem; border: 2px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; text-align: left; font-weight: 750; }
.option-button::before { content: attr(data-letter); display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; background: #eaf1f3; color: var(--blue); font-weight: 900; }
.option-button:hover { border-color: var(--blue-2); }
.option-button.correct { border-color: var(--green); background: #e8f6ef; }
.option-button.wrong { border-color: var(--red); background: #fff0ee; }
.feedback { margin: .6rem 0; padding: .8rem 1rem; border-radius: 13px; font-weight: 760; }
.feedback.good { color: #155c4a; background: #e7f6ef; }
.feedback.try { color: #7f2e28; background: #fff0ee; }
.lexicon-visual { display: grid; place-items: center; min-height: 160px; margin: .8rem 0; border-radius: 24px; background: linear-gradient(145deg, #dceef3, #fff5df); font-size: clamp(4rem, 14vw, 7rem); }
.lexicon-word { text-align: center; font-size: clamp(2rem, 7vw, 4rem); margin: .6rem 0; }
.translation-pair { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; color: var(--muted); font-weight: 750; }
.textarea { width: 100%; min-height: 170px; resize: vertical; padding: 1rem; border: 2px solid var(--line); border-radius: 15px; color: var(--ink); background: #fbfdfe; font-size: 1.06rem; line-height: 1.55; }
.char-count { text-align: right; color: var(--muted); font-size: .86rem; }
.self-check { display: grid; gap: .65rem; margin: 1rem 0; }
.self-check label { display: flex; gap: .7rem; align-items: flex-start; padding: .8rem; border-radius: 12px; background: #eef5f6; font-weight: 720; }
.self-check input { width: 22px; height: 22px; flex: 0 0 auto; }
.activity-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: auto; padding-top: 1.2rem; }
.activity-actions .primary { margin-left: auto; }
.activity-side { display: flex; flex-direction: column; gap: .75rem; }
.side-card { padding: 1rem; border-radius: 18px; background: #fff; border: 1px solid var(--line); }
.side-card h3 { margin: 0 0 .65rem; font-size: 1rem; }
.side-card p { margin: .35rem 0; color: var(--muted); line-height: 1.45; }
.side-progress-list { display: grid; gap: .45rem; }
.side-progress-row { display: flex; justify-content: space-between; gap: .5rem; font-size: .88rem; }

.lost-button { position: fixed; right: 1rem; bottom: 1rem; z-index: 45; min-height: 50px; padding: .75rem 1rem; border: 0; border-radius: 999px; background: var(--rust); color: #fff; font-weight: 900; box-shadow: 0 10px 26px rgba(97,41,25,.3); cursor: pointer; }

.app-dialog { width: min(680px, calc(100% - 1rem)); max-height: calc(100vh - 1rem); padding: 0; border: 0; border-radius: 28px; background: transparent; color: var(--ink); }
.app-dialog::backdrop { background: rgba(7, 28, 41, .72); backdrop-filter: blur(4px); }
.wide-dialog { width: min(1080px, calc(100% - 1rem)); }
.dialog-card { position: relative; max-height: calc(100vh - 1rem); overflow: auto; margin: 0; padding: clamp(1.3rem, 4vw, 2.3rem); border-radius: 26px; background: #fff; box-shadow: var(--shadow); }
.dialog-card h2 { margin: 0 2.3rem 1rem 0; font-size: clamp(1.7rem, 4vw, 2.5rem); }
.dialog-close { position: absolute; right: 1rem; top: .9rem; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #edf2f4; font-size: 1.7rem; cursor: pointer; }
fieldset { display: grid; gap: .65rem; margin: 1rem 0; padding: 0; border: 0; }
legend { margin-bottom: .65rem; font-weight: 900; }
.choice-card { display: block; position: relative; }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card span { display: flex; flex-direction: column; gap: .25rem; min-height: 82px; justify-content: center; padding: .8rem 1rem; border: 3px solid var(--line); border-radius: 16px; background: #fff; cursor: pointer; }
.choice-card span strong { font-size: 1.08rem; }
.choice-card span small { color: var(--muted); }
.choice-card input:checked + span { border-color: var(--blue); background: var(--sky); }
.choice-card input:focus-visible + span { outline: 4px solid rgba(242,181,68,.9); outline-offset: 3px; }
.language-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; }
.choice-card.compact span { min-height: 70px; text-align: center; align-items: center; }
.voice-test { width: 100%; background: #eef6f7; border-color: var(--blue); color: var(--blue); }
.voice-status, .status-line { min-height: 24px; margin: .6rem 0; color: var(--green); font-weight: 750; text-align: center; }
.plain-note { color: var(--muted); line-height: 1.55; }
.field-label { display: block; margin: .9rem 0 .35rem; font-weight: 800; }
.text-field { width: 100%; min-height: 52px; padding: .75rem .9rem; border: 2px solid var(--line); border-radius: 13px; }
.upload-label { margin-top: .8rem; text-align: center; }
.lost-card { text-align: center; }
.lost-icon { font-size: 4rem; }
.success-card { text-align: center; padding-top: 3.2rem; }
.success-burst { display: grid; place-items: center; width: 92px; height: 92px; margin: 0 auto 1rem; border-radius: 50%; background: linear-gradient(145deg, var(--gold), #ffe59e); color: #7a4b08; font-size: 3.3rem; box-shadow: 0 0 0 12px rgba(242,181,68,.18); }

.progress-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin: 1rem 0 1.4rem; }
.summary-box { padding: 1rem; border-radius: 16px; background: #eef5f6; text-align: center; }
.summary-box strong { display: block; font-size: 1.7rem; color: var(--blue); }
.summary-box span { color: var(--muted); font-size: .85rem; }
.progress-table, .teacher-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.progress-table th, .progress-table td, .teacher-table th, .teacher-table td { padding: .65rem .55rem; border-bottom: 1px solid var(--line); text-align: left; }
.progress-table th, .teacher-table th { color: var(--blue); background: #eef5f6; position: sticky; top: 0; }
.teacher-wrap { margin-top: 1rem; overflow: auto; }
.teacher-empty { padding: 2rem; border-radius: 18px; text-align: center; background: #eef5f6; color: var(--muted); }

.site-footer { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 2rem max(1rem, 5vw); color: #dcebf0; background: #0e344a; }
.site-footer img { width: 84px; height: 84px; object-fit: cover; border-radius: 50%; border: 3px solid #f3bd55; }
.site-footer div { display: grid; gap: .25rem; max-width: 720px; }
.site-footer span, .site-footer small { color: #b9d0d9; }

@media (max-width: 900px) {
  .top-actions { display: none; }
  .mobile-menu { display: inline-flex; }
  .hero-content { grid-template-columns: 1fr; }
  .hero-cover { display: none; }
  .intro-grid { grid-template-columns: 1fr; }
  .season-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .episode-hero { grid-template-columns: 1fr; }
  .episode-hero-image { min-height: 220px; order: -1; }
  .activity-frame { grid-template-columns: 1fr; }
  .activity-side { display: grid; grid-template-columns: 1fr 1fr; }
  .progress-summary { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .topbar { min-height: 68px; padding: .65rem .8rem; }
  .brand { font-size: .95rem; }
  .brand-mark { width: 32px; height: 32px; }
  .mobile-actions { inset-block-start: 68px; }
  .hero { min-height: 650px; }
  .hero::before { background: linear-gradient(0deg, rgba(8,35,51,.98) 0%, rgba(8,35,51,.72) 72%, rgba(8,35,51,.42) 100%); }
  .hero-content { align-self: end; padding: 3rem 0; }
  .hero h1 { font-size: clamp(3.1rem, 17vw, 5.2rem); }
  .resume-card { grid-template-columns: auto 1fr; }
  .resume-card .primary { grid-column: 1 / -1; width: 100%; }
  .method-card { grid-template-columns: 82px 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .season-grid { grid-template-columns: 1fr; }
  .episode-card { min-height: 215px; }
  .episode-shell { width: min(100% - 1rem, 1100px); padding-top: .5rem; }
  .episode-hero { border-radius: 20px; }
  .stage-nav { display: flex; overflow-x: auto; padding-bottom: .35rem; scroll-snap-type: x mandatory; }
  .stage-button { flex: 0 0 112px; min-height: 76px; scroll-snap-align: start; }
  .activity-card { min-height: 580px; border-radius: 20px; }
  .activity-side { grid-template-columns: 1fr; }
  .activity-actions { flex-direction: column-reverse; }
  .activity-actions .primary, .activity-actions .secondary { width: 100%; margin: 0; }
  .language-grid { grid-template-columns: 1fr; }
  .lost-button { left: auto; right: .6rem; bottom: .6rem; transform: none; white-space: nowrap; font-size: .9rem; }
  .site-footer { flex-direction: column; text-align: center; padding-bottom: 5rem; }
  .app-dialog, .wide-dialog { width: calc(100% - .5rem); }
  .dialog-card { max-height: calc(100vh - .5rem); border-radius: 20px; }
  .progress-table, .teacher-table { font-size: .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
