/* learn.ankafoods.com: Anka's colors (the website's logo: green #9BC31C, charcoal #292724), phone first. */
@font-face { font-family: "Archivo"; src: url("/fonts/archivo-600-800.woff2") format("woff2"); font-weight: 600 800; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("/fonts/sourcesans3-400-700.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --green: #9BC31C; --green-deep: #6E8C10; --charcoal: #292724;
  --bg: #F6F5F0; --card: #FFFFFF; --text: #292724; --muted: #6B6862; --line: #E4E1D8;
  --good: #1F8548; --good-bg: #E3F3E9; --bad: #C42B1C; --bad-bg: #FBE6E3; --info-bg: #EEF4DC;
  --shadow: 0 1px 2px rgba(41,39,36,.06), 0 4px 14px rgba(41,39,36,.07);
  --radius: 16px;
  --head: "Archivo", "Segoe UI", system-ui, sans-serif;
  --body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1B1A18; --card: #25231F; --text: #F2F0EA; --muted: #B0ACA2; --line: #3A3732;
    --good: #5BC184; --good-bg: #1E3327; --bad: #F08A7E; --bad-bg: #3A2320; --info-bg: #2C331C;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.45 var(--body); min-height: 100vh;
  display: flex; flex-direction: column; }
h1, h2, h3 { font-family: var(--head); line-height: 1.15; margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.icon { width: 1.25em; height: 1.25em; flex: none; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- the bar ---- */
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--charcoal); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { height: 32px; width: auto; display: block; }
.brand-word { font: 700 18px/1 var(--head); color: var(--green); letter-spacing: .02em; padding-left: 10px;
  border-left: 1px solid rgba(255,255,255,.25); }
.lang { display: flex; background: rgba(255,255,255,.1); border-radius: 999px; padding: 3px; }
.lang button { border: 0; background: none; color: #fff; font: 700 14px/1 var(--head); padding: 8px 12px; border-radius: 999px;
  min-width: 44px; min-height: 36px; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--green); color: var(--charcoal); }

main { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 16px 16px 40px; outline: none; }
.foot { text-align: center; color: var(--muted); font-size: 14px; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
.loading { color: var(--muted); text-align: center; padding: 60px 0; }

/* ---- hero and search ---- */
.hero { position: relative; overflow: hidden; border-radius: 22px; padding: 22px 20px 20px; margin-bottom: 18px;
  background: var(--charcoal); color: #fff; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(155,195,28,.55), rgba(155,195,28,0) 70%); pointer-events: none; }
.hero h1 { font-size: 28px; font-weight: 800; max-width: 18ch; }
.hero h1 em { font-style: normal; color: var(--green); }
.hero p { margin: 8px 0 16px; color: rgba(255,255,255,.8); max-width: 40ch; }
.search { position: relative; display: block; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; border: 0; border-radius: 14px; padding: 14px 14px 14px 44px; font: 17px var(--body);
  background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.search input::placeholder { color: var(--muted); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 15px; cursor: pointer; min-height: 40px; }
.chip[aria-pressed="true"] { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }
@media (prefers-color-scheme: dark) { .chip[aria-pressed="true"] { background: var(--green); color: var(--charcoal); border-color: var(--green); } }

.section { margin: 22px 0 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.section h2 { font-size: 20px; font-weight: 800; }
.section span { color: var(--muted); font-size: 15px; }

/* ---- topic tiles: each topic its own soft color ---- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--radius); background: var(--card);
  box-shadow: var(--shadow); text-decoration: none; min-height: 132px; transition: transform .15s ease; }
.tile:active { transform: scale(.98); }
.tile .badge { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--tint); color: var(--tone); }
.tile .badge .icon { width: 24px; height: 24px; }
.tile strong { font: 700 17px/1.2 var(--head); }
.tile small { color: var(--muted); font-size: 14px; margin-top: auto; }
[data-tone="0"] { --tint: #EEF6D8; --tone: #5E7A0E; } [data-tone="1"] { --tint: #E1F1EF; --tone: #157A78; }
[data-tone="2"] { --tint: #FCEFD6; --tone: #9A6200; } [data-tone="3"] { --tint: #E3EDFA; --tone: #2F5F9E; }
[data-tone="4"] { --tint: #FBE5E1; --tone: #B23A2B; } [data-tone="5"] { --tint: #F1E6F4; --tone: #7A3E8E; }
[data-tone="6"] { --tint: #E8ECEF; --tone: #3E5B62; } [data-tone="7"] { --tint: #EAF2DD; --tone: #4E6B1F; }
[data-tone="8"] { --tint: #FAF0D2; --tone: #8A6A00; } [data-tone="9"] { --tint: #F9E4EC; --tone: #A0365F; }
[data-tone="10"] { --tint: #DCF5E3; --tone: #1E7C45; } [data-tone="11"] { --tint: #F2EDE4; --tone: #6B5A3E; }
@media (prefers-color-scheme: dark) {
  [data-tone] { --tint: rgba(255,255,255,.08); }
  [data-tone="0"] { --tone: #B9DB52; } [data-tone="1"] { --tone: #5CC2BE; } [data-tone="2"] { --tone: #F0B85A; }
  [data-tone="3"] { --tone: #86AEE8; } [data-tone="4"] { --tone: #F09A8C; } [data-tone="5"] { --tone: #CC97DD; }
  [data-tone="6"] { --tone: #9DB8C0; } [data-tone="7"] { --tone: #A9CC6E; } [data-tone="8"] { --tone: #E2C25A; }
  [data-tone="9"] { --tone: #EC97B8; } [data-tone="10"] { --tone: #6FD39A; } [data-tone="11"] { --tone: #CDB895; }
}

/* ---- challenge cards ---- */
.games { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 80%); gap: 12px; overflow-x: auto;
  padding: 2px 2px 8px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.games::-webkit-scrollbar { display: none; }
@media (min-width: 720px) { .games { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; } }
.game-card { scroll-snap-align: start; position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 8px;
  padding: 16px; border-radius: var(--radius); background: linear-gradient(140deg, #3A3833, var(--charcoal)); color: #fff;
  text-decoration: none; min-height: 150px; box-shadow: var(--shadow); }
.game-card::after { content: ""; position: absolute; right: -30px; bottom: -40px; width: 140px; height: 140px; border-radius: 50%;
  background: rgba(155,195,28,.22); }
.game-card .kicker { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font: 700 13px/1 var(--head);
  letter-spacing: .06em; text-transform: uppercase; }
.game-card strong { font: 800 19px/1.2 var(--head); position: relative; z-index: 1; }
.game-card .go { margin-top: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; background: var(--green);
  color: var(--charcoal); font-weight: 700; border-radius: 999px; padding: 8px 14px; position: relative; z-index: 1; }
.game-card .best { font-size: 14px; color: rgba(255,255,255,.75); position: relative; z-index: 1; }

/* ---- item rows ---- */
.list { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--card);
  box-shadow: var(--shadow); text-decoration: none; min-height: 64px; }
.row .kind { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.row .kind[data-kind="challenge"] { background: var(--charcoal); color: var(--green); }
.row .kind[data-kind="video"] { background: #FBE5E1; color: #B23A2B; }
.row .kind[data-kind="guide"] { background: #E3EDFA; color: #2F5F9E; }
.row .kind[data-kind="card"] { background: #EEF6D8; color: #5E7A0E; }
@media (prefers-color-scheme: dark) { .row .kind[data-kind]:not([data-kind="challenge"]) { background: rgba(255,255,255,.08); } }
.row .text { flex: 1; min-width: 0; }
.row strong { display: block; font-weight: 700; line-height: 1.25; }
.row small { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.row .chev { color: var(--muted); transform: rotate(180deg); }
.tag { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .03em; padding: 2px 7px; border-radius: 6px;
  background: var(--info-bg); color: var(--green-deep); margin-left: 6px; vertical-align: 1px; }
@media (prefers-color-scheme: dark) { .tag { color: var(--green); } }
.empty { color: var(--muted); text-align: center; padding: 28px 10px; }

/* ---- pages ---- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 600;
  padding: 6px 0; margin-bottom: 8px; min-height: 40px; }
.topic-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.topic-head .badge { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: var(--tint);
  color: var(--tone); flex: none; }
.topic-head .badge .icon { width: 30px; height: 30px; }
.topic-head h1 { font-size: 26px; font-weight: 800; }
.topic-head p { margin: 4px 0 0; color: var(--muted); }

.item { background: var(--card); border-radius: 22px; box-shadow: var(--shadow); padding: 20px; }
.item .kind-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 700; font-size: 14px;
  text-transform: uppercase; letter-spacing: .05em; }
.item h1 { font-size: 26px; font-weight: 800; margin: 8px 0 6px; }
.item .meta { color: var(--muted); }
.item .note { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--info-bg); font-size: 15px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 12px 20px;
  border-radius: 14px; border: 0; font: 700 17px/1 var(--head); cursor: pointer; text-decoration: none; }
.btn-main { background: var(--green); color: var(--charcoal); }
.btn-dark { background: var(--charcoal); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-dark { background: #F2F0EA; color: var(--charcoal); } }
.btn-soft { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-wide { width: 100%; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--charcoal); color: #fff; padding: 10px 16px; border-radius: 999px; font-weight: 600; z-index: 30;
  box-shadow: var(--shadow); }

/* ---- the door ---- */
.door { max-width: 420px; margin: 8vh auto 0; background: var(--card); border-radius: 24px; box-shadow: var(--shadow);
  padding: 26px 22px; text-align: center; }
.door img { width: 160px; height: auto; margin: 4px auto 14px; display: block; }
@media (prefers-color-scheme: dark) { .door img.dark-logo { display: none; } }
@media (prefers-color-scheme: light) { .door img.light-logo { display: none; } }
.door h1 { font-size: 24px; font-weight: 800; }
.door p { color: var(--muted); margin: 8px 0 18px; }
.door input { width: 100%; text-align: center; letter-spacing: .12em; font: 700 22px/1 var(--head); padding: 14px;
  border-radius: 14px; border: 2px solid var(--line); background: var(--bg); color: var(--text); margin-bottom: 12px; }
.door input:focus { border-color: var(--green); outline: none; }
.door .error { color: var(--bad); font-weight: 600; min-height: 1.4em; margin: 0 0 8px; }
.door.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---- the game ---- */
.play { max-width: 760px; margin: 0 auto; }
.hud { position: sticky; top: 56px; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 0 -4px 12px;
  border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.dots { display: flex; gap: 4px; flex: 1; }
.dots i { flex: 1; height: 8px; border-radius: 4px; background: var(--line); transition: background .3s; }
.dots i.now { background: var(--charcoal); } .dots i.ok { background: var(--green); } .dots i.miss { background: #E8A13A; }
.dots i.lost { background: var(--bad); }
@media (prefers-color-scheme: dark) { .dots i.now { background: #F2F0EA; } }
.score { display: flex; align-items: center; gap: 4px; font: 800 18px/1 var(--head); min-width: 64px; justify-content: flex-end; }
.streak { display: none; align-items: center; gap: 2px; font: 800 15px/1 var(--head); color: #E8711A; }
.streak.on { display: inline-flex; animation: pop .35s ease; }
.prompt { font: 700 21px/1.3 var(--head); margin: 0 0 6px; }
.prompt b, .feedback b { font-weight: 800; }
.hint-line { color: var(--muted); font-size: 15px; margin: 0 0 10px; }
.stage { position: relative; border-radius: 14px; overflow: hidden; border: 2px solid var(--line); background: #fff;
  touch-action: manipulation; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.stage img { display: block; width: 100%; height: auto; -webkit-user-drag: none; pointer-events: none; }
.stage.shake { animation: shake .35s; }
.target { position: absolute; border-radius: 8px; outline: 4px solid var(--good); outline-offset: 3px;
  box-shadow: 0 0 0 10px rgba(255,255,255,.85); display: none; }
.target.answer { outline-color: #E8711A; animation: pulse 1s ease-in-out 3; }
.ripple { position: absolute; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; border: 4px solid var(--bad);
  background: rgba(196,43,28,.2); animation: ripple .6s ease-out forwards; pointer-events: none; }
.points { position: absolute; transform: translate(-50%, -50%); font: 800 26px/1 var(--head); color: var(--good);
  text-shadow: 0 2px 0 #fff, 0 0 8px #fff; animation: rise 1s ease-out forwards; pointer-events: none; }
.feedback { margin-top: 12px; padding: 12px 14px; border-radius: 14px; display: none; }
.feedback.good { display: block; background: var(--good-bg); } .feedback.bad { display: block; background: var(--bad-bg); }
.feedback.answer { display: block; background: var(--info-bg); }
.feedback strong { display: block; font: 800 19px/1.2 var(--head); margin-bottom: 2px; }
.feedback.good strong { color: var(--good); } .feedback.bad strong { color: var(--bad); }
.feedback .btn { margin-top: 10px; }
.intro, .finish { background: var(--card); border-radius: 22px; box-shadow: var(--shadow); padding: 22px 20px; text-align: center; }
.intro .big-icon, .finish .big-icon { width: 72px; height: 72px; margin: 0 auto 10px; border-radius: 22px; display: grid; place-items: center;
  background: var(--charcoal); color: var(--green); }
.intro .big-icon .icon, .finish .big-icon .icon { width: 38px; height: 38px; }
.intro h1, .finish h1 { font-size: 25px; font-weight: 800; }
.intro p { color: var(--muted); }
.intro .facts { display: flex; justify-content: center; gap: 18px; margin: 14px 0; color: var(--muted); font-size: 15px; flex-wrap: wrap; }
.intro .facts span { display: inline-flex; align-items: center; gap: 6px; }
.intro label { display: block; text-align: left; font-weight: 600; font-size: 15px; margin: 6px 0; }
.intro input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg);
  color: var(--text); font: 17px var(--body); margin-bottom: 14px; }
.stars { display: flex; justify-content: center; gap: 8px; margin: 10px 0; }
.stars .icon { width: 46px; height: 46px; color: var(--line); }
.stars .icon.lit { color: #F2B705; fill: #F2B705; animation: pop .45s ease both; }
.stars .icon.lit:nth-child(2) { animation-delay: .25s; } .stars .icon.lit:nth-child(3) { animation-delay: .5s; }
.total { font: 800 48px/1 var(--head); color: var(--green-deep); margin: 6px 0 2px; }
@media (prefers-color-scheme: dark) { .total { color: var(--green); } }
.record { display: inline-block; background: #F2B705; color: var(--charcoal); font: 800 14px/1 var(--head); padding: 6px 10px;
  border-radius: 999px; margin: 8px 0; animation: pop .5s ease .7s both; }
.facts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.facts-grid div { background: var(--bg); border-radius: 12px; padding: 10px 6px; }
.facts-grid b { display: block; font: 800 20px/1.1 var(--head); }
.facts-grid small { color: var(--muted); font-size: 13px; }
.who { color: var(--muted); font-size: 15px; margin: 6px 0 0; }
.finish .actions { justify-content: center; }
canvas.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }

@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@keyframes pulse { 50% { transform: scale(1.06); } }
@keyframes ripple { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
@keyframes rise { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -60px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
