/* Colours mirror lib/core/theme/app_colors.dart; keep the two in step. */
:root {
  --primary: #FF7A59;
  --on-primary: #2B1A14;
  --secondary: #4D96FF;
  --accent: #FFD93D;
  --correct: #4CC38A;
  --wrong: #FF6B6B;
  --warning: #FFA94D;
  --bg: #FFF8F0;
  --ink: #2B2A33;
  --surface: #FFFFFF;
  --muted: #55525F;
  --mascot-body: #2B2A33;
  --mascot-belly: #FFFFFF;
  --primary-text: #B03E1B;
  --line: rgba(43, 42, 51, .12);
  --shadow: 0 10px 30px rgba(176, 62, 27, .12);
  --radius-lg: 28px;
  --radius-md: 20px;
  --edge: 5px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #FF8F73;
    --secondary: #6BA8FF;
    --accent: #FFE066;
    --correct: #5FD39A;
    --wrong: #FF8585;
    --warning: #FFBB6B;
    --bg: #14161F;
    --ink: #F2F0F7;
    --surface: #1F2230;
    --muted: #B8B5C6;
    --mascot-body: #4A4E6B;
    --mascot-belly: #F2F0F7;
    --primary-text: #FF8F73;
    --line: rgba(242, 240, 247, .12);
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 500 1.0625rem/1.6 Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 900; letter-spacing: -.01em; }
h2 { font-size: clamp(1.6rem, 4.5vw, 2.25rem); }
h3 { font-size: 1.15rem; font-weight: 800; }
p { margin: 0; }

a { color: var(--primary-text); }

:focus-visible { outline: 3px solid var(--secondary); outline-offset: 3px; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1080px; margin: 0 auto; padding: 16px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 900; font-size: 1.35rem; }
.brand img { border-radius: 10px; }
.topbar-link { font-weight: 800; text-decoration: none; padding: 8px 4px; }

/* Chunky buttons: thick bottom edge that collapses on press, like the app. */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 24px; border-radius: 18px;
  font: inherit; font-weight: 800; text-decoration: none; cursor: pointer;
  border: 0; transition: transform .08s ease, box-shadow .08s ease;
}
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 var(--edge) 0 color-mix(in srgb, var(--primary) 60%, #000); }
.btn-ghost { background: var(--surface); color: var(--ink); box-shadow: 0 var(--edge) 0 var(--line), inset 0 0 0 2px var(--line); }
.btn:active { transform: translateY(var(--edge)); box-shadow: 0 0 0 transparent; }
.btn-ghost:active { box-shadow: inset 0 0 0 2px var(--line); }

/* Hero */
main { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

.hero {
  display: grid; gap: 40px; align-items: center;
  padding: 24px 0 64px;
}
.hero h1 { font-size: clamp(2.3rem, 8vw, 3.75rem); max-width: 12ch; }
.lead { margin-top: 18px; font-size: 1.15rem; color: var(--muted); max-width: 34rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 28px; }

.demo {
  position: relative; background: var(--surface); border-radius: 36px;
  padding: 28px 20px 22px; box-shadow: var(--shadow);
  max-width: 440px; width: 100%; justify-self: center;
}
.mascot { position: absolute; width: 92px; height: 92px; top: -58px; right: 18px; overflow: visible; }
.m-body { fill: var(--mascot-body); }
.m-belly { fill: var(--mascot-belly); }
.m-beak { fill: var(--primary); }
.m-stripe { fill: var(--accent); }
.m-shadow { fill: var(--ink); opacity: .08; }
.m-wave { transform: rotate(-145deg); animation: wave 1.6s ease-in-out 3; }
.m-bob { animation: bob 3.2s ease-in-out infinite; }
.mascot.cheer .m-bob { animation: hop .45s ease-out; }

@keyframes wave { 50% { transform: rotate(-125deg); } }
@keyframes bob { 50% { transform: translateY(1.2px); } }
@keyframes hop { 40% { transform: translateY(-6px); } }

.card-stage { perspective: 1200px; }
.card {
  position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; max-height: 260px;
  border: 0; padding: 0; background: none; cursor: pointer; font: inherit; color: inherit;
  transform-style: preserve-3d; transition: transform .45s cubic-bezier(.2, .8, .2, 1);
}
.card.flipped { transform: rotateY(180deg); }
.card-face {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 20px; border-radius: var(--radius-lg); backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--bg); border: 2px solid var(--line); text-align: center;
}
.card-back { transform: rotateY(180deg); }
.card-word { font-size: clamp(2rem, 9vw, 2.6rem); font-weight: 900; }
.card-word-small { font-size: 1.15rem; color: var(--muted); font-weight: 800; }
.card-hint { font-size: .95rem; color: var(--muted); }
.card-meaning { font-size: 1.45rem; font-weight: 900; color: var(--primary-text); }
.card-example { font-size: 1rem; color: var(--muted); font-style: italic; }

.ratings { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 18px; }
.rate {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 60px; padding: 8px 4px; border: 0; border-radius: 16px; cursor: pointer;
  font: inherit; color: var(--on-primary); transition: transform .08s ease, box-shadow .08s ease, opacity .2s;
}
.rate b { font-weight: 900; font-size: 1rem; }
.rate span { font-size: .8rem; font-weight: 700; opacity: .85; }
.rate-again { background: var(--wrong);   box-shadow: 0 4px 0 color-mix(in srgb, var(--wrong) 60%, #000); }
.rate-hard  { background: var(--warning); box-shadow: 0 4px 0 color-mix(in srgb, var(--warning) 60%, #000); }
.rate-good  { background: var(--correct); box-shadow: 0 4px 0 color-mix(in srgb, var(--correct) 60%, #000); }
.rate-easy  { background: var(--secondary); box-shadow: 0 4px 0 color-mix(in srgb, var(--secondary) 60%, #000); }
.rate:active { transform: translateY(4px); box-shadow: none; }
.rate:disabled { opacity: .4; cursor: default; transform: none; }
.demo-note { margin-top: 14px; font-size: .95rem; color: var(--muted); text-align: center; min-height: 3em; }

/* Sections */
.block { padding: 56px 0; border-top: 2px dashed var(--line); }
.section-lead { margin-top: 12px; color: var(--muted); max-width: 40rem; }

.steps { list-style: none; counter-reset: step; padding: 0; margin: 32px 0 0; display: grid; gap: 28px; }
.steps li { counter-increment: step; position: relative; padding-left: 64px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -4px;
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #2B2A33; font-weight: 900; font-size: 1.2rem;
}
.steps p { margin-top: 6px; color: var(--muted); max-width: 32rem; }

.why { display: grid; gap: 32px; align-items: center; }
.why-text p { margin-top: 14px; color: var(--muted); max-width: 36rem; }
.heatmap { margin: 0; background: var(--surface); border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow); }
.heat-grid { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; gap: 4px; }
.heat-grid i { aspect-ratio: 1; border-radius: 4px; background: var(--line); }
.heat-grid i[data-l="1"] { background: color-mix(in srgb, var(--correct) 35%, transparent); }
.heat-grid i[data-l="2"] { background: color-mix(in srgb, var(--correct) 65%, transparent); }
.heat-grid i[data-l="3"] { background: var(--correct); }
.heatmap figcaption { margin-top: 12px; font-size: .9rem; color: var(--muted); }

.traits { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 14px; }
.traits li { padding: 20px 22px; border-radius: var(--radius-md); background: var(--surface); border-left: 8px solid var(--c); }
.traits p { margin-top: 6px; color: var(--muted); }
.t-coral { --c: var(--primary); }
.t-blue { --c: var(--secondary); }
.t-yellow { --c: var(--accent); }
.t-green { --c: var(--correct); }

.packs { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; }
.packs li {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "lang count" "level count";
  align-items: center; padding: 14px 20px; border-radius: 18px; background: var(--surface); border: 2px solid var(--line);
}
.pack-lang { grid-area: lang; font-weight: 800; }
.pack-level { grid-area: level; color: var(--muted); font-size: .95rem; }
.pack-count { grid-area: count; font-weight: 900; color: var(--primary-text); font-size: 1.15rem; }

.download {
  margin: 24px 0 56px; padding: 40px 24px; border-radius: 36px; text-align: center;
  background: var(--primary); color: var(--on-primary);
}
.download h2 { max-width: 18ch; margin: 0 auto; }
.download p { margin: 14px auto 0; max-width: 32rem; }
.stores { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 26px; }
.store {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 20px; border-radius: 16px;
  background: #2B2A33; color: #FFF8F0; text-align: left; font-weight: 800; line-height: 1.2; opacity: .92;
}
.store svg { width: 26px; height: 26px; fill: currentColor; }
.store small { display: block; font-weight: 600; font-size: .75rem; opacity: .8; }

.footer {
  max-width: 1080px; margin: 0 auto; padding: 28px 20px 40px; color: var(--muted); font-size: .95rem;
  display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; border-top: 2px dashed var(--line);
}
.footer nav a { font-weight: 800; }

/* Plain text pages (privacy) */
.prose { max-width: 42rem; padding: 16px 0 56px; }
.prose h1 { font-size: clamp(2rem, 6vw, 2.75rem); }
.prose h2 { font-size: 1.35rem; margin-top: 32px; }
.prose p, .prose ul { margin-top: 12px; color: var(--muted); }
.prose .updated { font-size: .95rem; }

@media (min-width: 760px) {
  .hero { grid-template-columns: 1.1fr 1fr; padding: 48px 0 88px; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .steps li { padding-left: 0; padding-top: 62px; }
  .why { grid-template-columns: 1fr 1fr; }
  .traits { grid-template-columns: 1fr 1fr; }
  .packs { grid-template-columns: 1fr 1fr; }
  .download { padding: 56px 40px; }
}

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