:root {
  --ink: #10173a;
  --ink-2: #202957;
  --paper: #fffdf5;
  --white: #ffffff;
  --pink: #ff4f9a;
  --pink-soft: #ffb8d9;
  --yellow: #ffe34f;
  --cyan: #56e2dc;
  --blue: #5267ff;
  --green: #47ce8c;
  --orange: #ff9857;
  --muted: #6f7390;
  --line: #cfd2e0;
  --shadow: 0 14px 0 rgba(16, 23, 58, 0.1);
  --radius: 24px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% -10%, rgba(86, 226, 220, 0.18), transparent 34rem),
    #f6f4ff;
  font-family: Inter, ui-rounded, "Trebuchet MS", system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.55;
}

button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, [tabindex]:focus-visible {
  outline: 4px solid var(--cyan);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  left: 1rem;
  top: -5rem;
  padding: .75rem 1rem;
  color: var(--white);
  background: var(--ink);
  border-radius: 12px;
}
.skip-link:focus { top: 1rem; }

.topbar {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: .65rem clamp(1rem, 4vw, 4rem);
  color: var(--white);
  background: rgba(16, 23, 58, .96);
  border-bottom: 2px solid rgba(255,255,255,.12);
  backdrop-filter: blur(15px);
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0;
  color: inherit;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 43px;
  aspect-ratio: 1;
  color: var(--ink);
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 14px 14px 14px 4px;
  transform: rotate(-4deg);
}
.brand strong, .brand small { display: block; line-height: 1.1; }
.brand strong { font-size: 1.05rem; }
.brand small { margin-top: .18rem; color: #cbd0e8; font-size: .73rem; letter-spacing: .05em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 1rem; }
.silk-meter { width: min(210px, 24vw); }
.silk-meter-label { display: block; margin-bottom: .25rem; font-size: .77rem; color: #dfe1f0; }
.silk-meter-track, .quiz-progress {
  display: block;
  overflow: hidden;
  height: 8px;
  background: rgba(255,255,255,.18);
  border-radius: 999px;
}
.silk-meter-track i, .quiz-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--yellow));
  border-radius: inherit;
  transition: width .5s ease;
}
.round-button {
  width: 44px;
  aspect-ratio: 1;
  color: var(--white);
  background: rgba(255,255,255,.1);
  border: 2px solid rgba(255,255,255,.25);
  border-radius: 50%;
  cursor: pointer;
}
.round-button[aria-pressed="false"] { opacity: .55; text-decoration: line-through; }

main { min-height: calc(100vh - 74px); padding-bottom: 8rem; }
.view { display: none; width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(1.5rem, 5vw, 4.5rem) 0; }
.view.is-active { display: block; animation: view-in .35s ease both; }
#view-quiz { width: 100%; padding: 0; }
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.08; letter-spacing: -.035em; }
h1 { margin-bottom: 1rem; font-size: clamp(2.4rem, 6vw, 5.4rem); }
h2 { margin-bottom: .7rem; font-size: clamp(1.65rem, 3vw, 2.55rem); }
h3 { margin-bottom: .45rem; font-size: 1.3rem; }
mark {
  color: inherit;
  background: linear-gradient(transparent 48%, var(--pink) 48%, var(--pink) 89%, transparent 89%);
  padding: 0 .08em;
}
.eyebrow {
  display: inline-block;
  margin-bottom: .7rem;
  color: var(--cyan);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.eyebrow.dark { color: var(--ink); opacity: .65; }

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.02fr .98fr;
  gap: clamp(2rem, 4vw, 5rem);
  align-items: center;
  overflow: hidden;
  min-height: 600px;
  margin: clamp(-1.5rem, -5vw, -4.5rem) calc(50% - 50vw) 3rem;
  padding: clamp(3rem, 7vw, 6.5rem) max(clamp(1rem, 6vw, 7rem), calc((100vw - 1180px) / 2));
  color: var(--white);
  background:
    linear-gradient(135deg, rgba(82,103,255,.22), transparent 45%),
    var(--ink);
}
.hero-grid::after {
  content: "";
  position: absolute;
  right: -6rem;
  bottom: -8rem;
  width: 32rem;
  aspect-ratio: 1;
  border: 2px dashed rgba(255,255,255,.14);
  border-radius: 50%;
}
.hero-copy { position: relative; z-index: 2; }
.hero-copy h1 { max-width: 720px; }
.hero-copy p { max-width: 610px; color: #dfe1ef; font-size: clamp(1.05rem, 2vw, 1.3rem); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin: 2rem 0 1.5rem; }
.primary-button, .secondary-button, .text-button, .tiny-button, .back-button {
  min-height: 48px;
  border-radius: 14px;
  font-weight: 850;
  cursor: pointer;
}
.primary-button {
  padding: .9rem 1.2rem;
  color: var(--ink);
  background: var(--yellow);
  border: 3px solid var(--yellow);
  box-shadow: 5px 5px 0 var(--pink);
}
.primary-button:hover { transform: translate(-2px,-2px); box-shadow: 7px 7px 0 var(--pink); }
.text-button { padding: .8rem .4rem; color: var(--white); background: transparent; border: 0; border-bottom: 2px solid currentColor; border-radius: 0; }
.secondary-button { padding: .75rem 1rem; color: var(--ink); background: var(--white); border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.secondary-button.danger { color: #9e265c; border-color: #9e265c; box-shadow: none; }
.tiny-button { padding: .55rem .85rem; background: var(--white); border: 2px solid var(--ink); }
.back-button { padding: .5rem .8rem; background: transparent; border: 0; }
.back-button.light { color: var(--white); }
.privacy-pill { display: inline-flex; align-items: center; gap: .5rem; color: #bfc4df; font-size: .82rem; }
.privacy-pill span { color: var(--cyan); }

.hero-visual { position: relative; z-index: 2; min-height: 465px; }
.hero-visual img { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 20px 28px rgba(0,0,0,.3)); }
.orbit { position: absolute; border: 2px dashed rgba(86,226,220,.45); border-radius: 50%; }
.orbit-one { inset: 7% 9% 10% 12%; animation: spin 30s linear infinite; }
.orbit-two { inset: 18% 2% 1% 25%; border-color: rgba(255,227,79,.35); animation: spin 22s linear infinite reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.fact-sticker { position: absolute; z-index: 3; padding: .6rem .8rem; color: var(--ink); background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 5px 5px 0 rgba(0,0,0,.25); font-size: .76rem; line-height: 1.15; transform: rotate(-4deg); }
.fact-sticker b { font-size: .9rem; }
.sticker-a { left: 2%; bottom: 14%; background: var(--pink-soft); }
.sticker-b { right: 3%; top: 13%; background: var(--yellow); transform: rotate(5deg); }

.mission-panel, .report-card { padding: clamp(1.2rem, 3vw, 2rem); background: var(--paper); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.mission-rail { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: .9rem; overflow-x: auto; padding: .4rem .15rem 1rem; scrollbar-color: var(--pink) transparent; }
.mission-card {
  position: relative;
  min-height: 185px;
  padding: 1rem;
  text-align: left;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 18px;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}
.mission-card:hover { transform: translateY(-5px); box-shadow: 0 7px 0 var(--ink); }
.mission-card.is-mastered { background: #eafff4; }
.mission-number { display: inline-grid; place-items: center; width: 35px; aspect-ratio: 1; margin-bottom: 1.2rem; color: var(--white); background: var(--ink); border-radius: 50%; font-weight: 900; }
.mission-card strong, .mission-card small { display: block; }
.mission-card strong { line-height: 1.15; }
.mission-card small { margin-top: .45rem; color: var(--muted); }
.mission-state { position: absolute; right: .7rem; top: .7rem; color: #9b6b00; font-size: .78rem; font-weight: 900; }

.quick-lab { display: grid; grid-template-columns: 1fr 1fr; gap: 1.3rem; margin-top: 2rem; }
.quick-card { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; padding: 1.4rem; border: 3px solid var(--ink); border-radius: var(--radius); }
.quick-card p { margin-bottom: 0; }
.quick-card-pink { background: var(--pink-soft); }
.quick-card-yellow { background: var(--yellow); }
.quick-icon { display: grid; place-items: center; width: 58px; aspect-ratio: 1; background: var(--paper); border: 2px solid var(--ink); border-radius: 17px; font-size: 1.7rem; }
.round-arrow { width: 50px; aspect-ratio: 1; color: var(--white); background: var(--ink); border: 0; border-radius: 50%; font-size: 1.4rem; cursor: pointer; }

.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 2rem; margin-bottom: 2.5rem; }
.page-heading h1 { font-size: clamp(2.3rem, 5vw, 4.5rem); }
.page-heading p { margin-bottom: 0; color: var(--muted); font-size: 1.1rem; }
.compact-heading { display: block; max-width: 780px; }
.lesson-grid, .practice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.lesson-card, .practice-card {
  overflow: hidden;
  background: var(--white);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 8px 0 rgba(16,23,58,.08);
}
.lesson-card { min-height: 355px; }
.lesson-card-top { min-height: 112px; padding: 1.2rem; background: var(--accent, var(--cyan)); border-bottom: 3px solid var(--ink); }
.lesson-card-top span { font-size: 2.4rem; }
.lesson-card-body { padding: 1.2rem; }
.lesson-card-body p { min-height: 80px; color: var(--muted); }
.lesson-card-footer { display: flex; justify-content: space-between; align-items: center; gap: .7rem; }
.lesson-card-footer button { padding: .65rem .8rem; background: var(--ink); color: var(--white); border: 0; border-radius: 12px; font-weight: 850; cursor: pointer; }
.star-row { color: #c7a000; letter-spacing: .07em; }

.lesson-sheet { overflow: hidden; background: var(--white); border: 3px solid var(--ink); border-radius: 30px; box-shadow: var(--shadow); }
.lesson-hero { position: relative; padding: clamp(2rem, 5vw, 4rem); background: var(--accent, var(--cyan)); border-bottom: 3px solid var(--ink); }
.lesson-hero .big-icon { position: absolute; right: 5%; bottom: -1.2rem; font-size: clamp(5rem, 13vw, 10rem); transform: rotate(8deg); filter: drop-shadow(5px 6px 0 rgba(16,23,58,.15)); }
.lesson-hero h1 { max-width: 760px; font-size: clamp(2.4rem, 6vw, 5rem); }
.lesson-hero p { max-width: 680px; margin-bottom: 0; font-size: 1.15rem; }
.lesson-content { padding: clamp(1.2rem, 5vw, 4rem); }
.fluo-block { position: relative; margin-bottom: 1rem; padding: 1.2rem 1.2rem 1.2rem 4.2rem; background: #fff9ca; border: 2px solid var(--ink); border-radius: 18px; }
.fluo-block::before { content: "!"; position: absolute; left: 1rem; top: 1rem; display: grid; place-items: center; width: 38px; aspect-ratio: 1; color: var(--white); background: var(--pink); border: 2px solid var(--ink); border-radius: 50%; font-weight: 950; }
.fluo-block h3 { margin-bottom: .35rem; }
.fluo-block p { margin-bottom: 0; }
.memory-trick { margin: 2rem 0; padding: 1.25rem; color: var(--white); background: var(--ink); border-radius: 20px; }
.memory-trick strong { color: var(--yellow); }
.lesson-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
.lesson-actions button { min-height: 50px; padding: .75rem 1rem; border: 2px solid var(--ink); border-radius: 14px; font-weight: 850; cursor: pointer; }
.lesson-actions .listen { background: var(--white); }
.lesson-actions .train { color: var(--white); background: var(--ink); }

.practice-grid { grid-template-columns: repeat(2, 1fr); }
.practice-card { display: grid; grid-template-columns: auto 1fr; gap: 1.2rem; align-items: start; padding: 1.5rem; cursor: pointer; text-align: left; }
.practice-card:hover { transform: translateY(-3px); box-shadow: 0 10px 0 rgba(16,23,58,.13); }
.practice-card .practice-icon { display: grid; place-items: center; width: 64px; aspect-ratio: 1; background: var(--accent, var(--yellow)); border: 2px solid var(--ink); border-radius: 18px; font-size: 1.8rem; }
.practice-card p { margin-bottom: .6rem; color: var(--muted); }
.practice-meta { font-size: .8rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }

.quiz-shell { min-height: calc(100vh - 74px); padding: clamp(1rem, 4vw, 3rem); color: var(--white); background: var(--ink); }
.quiz-topline { display: grid; grid-template-columns: auto minmax(140px, 640px) auto; align-items: center; justify-content: center; gap: 1rem; max-width: 900px; margin: 0 auto 2rem; }
.quiz-progress { width: 100%; height: 11px; }
.question-card { max-width: 820px; margin: 0 auto; padding: clamp(1.3rem, 4vw, 2.8rem); color: var(--ink); background: var(--paper); border: 3px solid var(--ink); border-radius: 30px; box-shadow: 10px 10px 0 var(--pink); }
.question-kicker { display: inline-block; margin-bottom: 1rem; padding: .35rem .6rem; background: var(--cyan); border: 2px solid var(--ink); border-radius: 10px; font-size: .77rem; font-weight: 950; letter-spacing: .08em; text-transform: uppercase; }
.question-card h2 { font-size: clamp(1.7rem, 4vw, 2.7rem); }
.question-help { color: var(--muted); }
.answer-list { display: grid; gap: .75rem; margin: 1.5rem 0; }
.answer-button, .category-button, .order-option {
  position: relative;
  width: 100%;
  min-height: 58px;
  padding: .8rem 1rem;
  text-align: left;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 15px;
  cursor: pointer;
}
.answer-button:hover, .order-option:hover { background: #eef9ff; }
.answer-button.is-selected, .category-button.is-selected { background: var(--yellow); box-shadow: 4px 4px 0 var(--ink); transform: translate(-2px,-2px); }
.answer-button.is-correct { background: #bdf4d5; }
.answer-button.is-wrong { background: #ffc4dc; }
.answer-letter { display: inline-grid; place-items: center; width: 30px; aspect-ratio: 1; margin-right: .65rem; background: var(--ink); color: var(--white); border-radius: 8px; font-weight: 900; }
.quiz-submit { width: 100%; min-height: 56px; color: var(--white); background: var(--blue); border: 2px solid var(--ink); border-radius: 15px; font-weight: 950; cursor: pointer; }
.quiz-submit:disabled { opacity: .4; cursor: not-allowed; }
.feedback { margin-top: 1.3rem; padding: 1rem; background: #eef0ff; border-left: 7px solid var(--blue); border-radius: 12px; }
.feedback.good { background: #dbf8e8; border-color: var(--green); }
.feedback.bad { background: #ffe0ed; border-color: var(--pink); }
.feedback h3 { margin-bottom: .3rem; }
.feedback p { margin-bottom: .8rem; }
.feedback button { min-height: 48px; padding: .7rem 1rem; color: var(--white); background: var(--ink); border: 0; border-radius: 12px; font-weight: 900; cursor: pointer; }
.order-bank, .order-built { display: grid; gap: .6rem; min-height: 66px; margin: 1rem 0; padding: .7rem; border: 2px dashed var(--line); border-radius: 16px; }
.order-built { counter-reset: order; background: #f0edff; }
.order-built .order-option::before { counter-increment: order; content: counter(order); display: inline-grid; place-items: center; width: 28px; aspect-ratio: 1; margin-right: .6rem; color: white; background: var(--blue); border-radius: 50%; font-weight: 900; }
.classification-item { margin: 1.3rem 0; padding: 1.5rem; text-align: center; background: #eef0ff; border: 2px solid var(--ink); border-radius: 18px; }
.classification-item .creature { display: block; font-size: 4rem; }
.category-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.category-button { text-align: center; font-weight: 900; }
.quiz-result { text-align: center; }
.result-medal { display: grid; place-items: center; width: 120px; aspect-ratio: 1; margin: 0 auto 1.3rem; background: var(--yellow); border: 4px solid var(--ink); border-radius: 50%; font-size: 3.7rem; box-shadow: 8px 8px 0 var(--pink); }
.result-score { font-size: clamp(2.5rem, 7vw, 5rem); font-weight: 950; line-height: 1; }
.result-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: .8rem; margin-top: 1.5rem; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2rem; }
.stat-card { padding: 1.4rem; background: var(--white); border: 3px solid var(--ink); border-radius: 20px; }
.stat-card strong { display: block; margin-bottom: .2rem; font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1; }
.stat-card span { color: var(--muted); }
.report-row { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr auto; gap: 1rem; align-items: center; padding: 1rem 0; border-top: 2px solid #e1e2ea; }
.report-bar { overflow: hidden; height: 12px; background: #e5e6ef; border-radius: 999px; }
.report-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--yellow)); border-radius: inherit; }

.bottom-nav {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 1rem;
  display: flex;
  gap: .35rem;
  width: min(560px, calc(100% - 2rem));
  padding: .45rem;
  color: var(--white);
  background: rgba(16,23,58,.97);
  border: 2px solid rgba(255,255,255,.18);
  border-radius: 22px;
  box-shadow: 0 14px 35px rgba(16,23,58,.3);
  transform: translateX(-50%);
  backdrop-filter: blur(16px);
  transition: transform .28s ease, opacity .2s ease;
}
.bottom-nav button { flex: 1; min-height: 54px; padding: .45rem .25rem; color: #bec3df; background: transparent; border: 0; border-radius: 16px; font-size: .77rem; font-weight: 850; cursor: pointer; }
.bottom-nav button span { display: block; margin-bottom: .1rem; font-size: 1.05rem; }
.bottom-nav button.is-active { color: var(--ink); background: var(--yellow); }

.toast { position: fixed; z-index: 80; left: 50%; bottom: 6rem; max-width: calc(100% - 2rem); padding: .8rem 1rem; color: var(--white); background: var(--ink); border: 2px solid var(--white); border-radius: 14px; opacity: 0; pointer-events: none; transform: translate(-50%, 15px); transition: .25s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-copy p { margin-left: auto; margin-right: auto; }
  .hero-actions { justify-content: center; }
  .hero-visual { min-height: 370px; }
  .lesson-grid { grid-template-columns: repeat(2, 1fr); }
  .mission-rail { grid-template-columns: repeat(6, 180px); }
}

@media (max-width: 680px) {
  body { font-size: 16px; }
  .topbar { min-height: 66px; }
  .brand small, .silk-meter { display: none; }
  .view { width: min(100% - 1.1rem, 1180px); padding-top: 1.5rem; }
  .hero-grid { min-height: 0; margin-top: -1.5rem; padding-top: 3rem; padding-bottom: 2.5rem; }
  .hero-visual { min-height: 300px; }
  .fact-sticker { font-size: .67rem; }
  .quick-lab, .lesson-grid, .practice-grid, .stats-grid { grid-template-columns: 1fr; }
  .page-heading { display: block; }
  .page-heading .secondary-button { margin-top: 1rem; }
  .section-heading { align-items: start; }
  .quick-card { grid-template-columns: auto 1fr; }
  .quick-card .round-arrow { grid-column: 1 / -1; width: 100%; aspect-ratio: auto; min-height: 46px; border-radius: 13px; }
  .practice-card { grid-template-columns: auto 1fr; padding: 1rem; }
  .quiz-shell { padding: 1rem .55rem 6rem; }
  .quiz-topline { grid-template-columns: auto 1fr auto; gap: .5rem; }
  .back-button.light { padding-left: .2rem; }
  .lesson-hero .big-icon { position: static; display: block; margin-top: 1rem; }
  .fluo-block { padding-left: 1rem; padding-top: 4.3rem; }
  .report-row { grid-template-columns: 1fr auto; }
  .report-bar { grid-column: 1 / -1; grid-row: 2; }
  body.is-nav-hidden .bottom-nav {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, calc(100% + 2rem));
  }
  body[data-view="quiz"] .bottom-nav { display: none; }
}

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