:root {
  --bg: #f6f3ea;
  --surface: #ffffff;
  --surface-2: #efeadc;
  --text: #1f2a24;
  --muted: #5d6b62;
  --line: #ddd6c4;
  --green: #1f5f45;
  --green-2: #2e7d5b;
  --red: #c62828;
  --red-soft: #fde8e6;
  --ok: #2e7d32;
  --ok-soft: #e3f3e4;
  --bad: #c62828;
  --bad-soft: #fde8e6;
  --gold: #f2a900;
  --shadow: 0 6px 24px rgba(31, 42, 36, .08);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121714; --surface: #1b221e; --surface-2: #232c27; --text: #e8efe9; --muted: #9fb0a6;
    --line: #2f3a34; --green: #4fb08a; --green-2: #6cc7a1; --red: #ef5350; --red-soft: #3a1e1e;
    --ok: #66bb6a; --ok-soft: #1d3320; --bad: #ef5350; --bad-soft: #3a1e1e; --shadow: 0 6px 24px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #121714; --surface: #1b221e; --surface-2: #232c27; --text: #e8efe9; --muted: #9fb0a6;
  --line: #2f3a34; --green: #4fb08a; --green-2: #6cc7a1; --red: #ef5350; --red-soft: #3a1e1e;
  --ok: #66bb6a; --ok-soft: #1d3320; --bad: #ef5350; --bad-soft: #3a1e1e; --shadow: 0 6px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", Arial, sans-serif;
}
img { max-width: 100%; display: block; }
a { color: var(--green); }
h1 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); line-height: 1.15; margin: .2em 0 .5em; }
h2, h3 { line-height: 1.25; }
main { max-width: 1180px; margin: 0 auto; padding: 16px 16px 40px; }
.red { color: var(--red); }

/* header */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding: 10px 16px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand small { display: block; color: var(--muted); font-size: .75rem; }
.book-icon {
  width: 30px; height: 38px; border-radius: 4px 6px 6px 4px; background: var(--red); position: relative;
  box-shadow: inset 5px 0 0 rgba(0,0,0,.22);
}
.book-icon::after { content: "🐾"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; filter: grayscale(1) brightness(3); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  text-decoration: none; color: var(--text); padding: 7px 12px; border-radius: 999px; font-weight: 600; font-size: .95rem;
}
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--green); color: #fff; }
.nav a.nav-ai { border: 2px solid var(--red); }
.nav a.nav-ai.active { background: var(--red); border-color: var(--red); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); background: var(--surface-2); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--red) 85%, #000); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* hero */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center; padding: 18px 0 8px; }
.eyebrow { color: var(--green); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; margin: 0; }
.lead { font-size: 1.1rem; color: var(--muted); }
.lead.small { font-size: 1rem; margin-top: -6px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-img { margin: 0; position: relative; }
.hero-img img { border-radius: 24px; aspect-ratio: 4/3; object-fit: cover; width: 100%; box-shadow: var(--shadow); }
.hero-img figcaption {
  position: absolute; left: 14px; bottom: 14px; background: rgba(0,0,0,.55); color: #fff; padding: 4px 12px; border-radius: 999px; font-size: .85rem;
}
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 26px 0; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stats b { display: block; font-size: 1.7rem; color: var(--red); }
.stats span { color: var(--muted); font-size: .9rem; }
.sec-title { margin: 28px 0 12px; }

/* cards & grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.grid.mini { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.sp {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer;
  text-align: left; padding: 0; font: inherit; color: inherit; transition: transform .15s, box-shadow .15s;
}
.sp:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.sp img { aspect-ratio: 4/3; object-fit: cover; width: 100%; background: var(--surface-2); }
.sp div { padding: 10px 12px 12px; }
.sp b { display: block; }
.sp small { color: var(--muted); display: block; }
.sp .tag { display: inline-block; margin-top: 6px; font-size: .75rem; background: var(--red-soft); color: var(--red); padding: 1px 8px; border-radius: 999px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 7px 14px;
  font: inherit; font-weight: 600; cursor: pointer;
}
.chip.on { background: var(--green); border-color: var(--green); color: #fff; }
.note { color: var(--muted); font-size: .85rem; margin-top: 18px; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.prose h3 { margin-top: 0; }
.cats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.cat { border-radius: var(--radius); padding: 14px; color: #fff; display: flex; flex-direction: column; gap: 4px; min-height: 110px; }
.cat b { font-size: 1.6rem; }
.c1 { background: #b71c1c; } .c2 { background: #e65100; } .c3 { background: #f9a825; color: #2a2100; }
.c4 { background: #607d8b; } .c5 { background: #2e7d32; }
.tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { background: var(--surface-2); border-radius: 999px; padding: 4px 12px; font-size: .9rem; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { padding: 6px 0 6px 30px; position: relative; border-bottom: 1px dashed var(--line); }
.checks li::before { content: "✓"; position: absolute; left: 4px; color: var(--ok); font-weight: 800; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { background: var(--surface); border-radius: 20px; max-width: 760px; width: 100%; max-height: 92vh; overflow: auto; position: relative; display: grid; grid-template-columns: 1fr 1.1fr; }
.modal-box img { width: 100%; height: 100%; object-fit: cover; min-height: 260px; }
.modal-body { padding: 20px 22px; }
.modal-body h2 { margin: 0; }
.modal-x { position: absolute; top: 10px; right: 10px; border: 0; background: rgba(0,0,0,.55); color: #fff; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 16px; z-index: 2; }
.latin { font-style: italic; color: var(--muted); margin: 2px 0 8px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badges span { background: var(--surface-2); border-radius: 999px; padding: 2px 10px; font-size: .85rem; }
.credit { font-size: .75rem; color: var(--muted); margin-top: 14px; }

/* games */
.game-menu { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.game-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 16px; cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font: inherit; color: inherit; text-align: left;
  transition: transform .15s, box-shadow .15s;
}
.game-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.game-card .gi { font-size: 2.2rem; }
.game-card b { font-size: 1.15rem; }
.game-card small { color: var(--muted); }
.game-card em { font-style: normal; font-size: .8rem; color: var(--green); font-weight: 600; min-height: 1.2em; }
.game-area { margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px; }
.g-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.g-head h2 { margin: 0; font-size: 1.3rem; }
.g-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.g-stats span { background: var(--surface-2); border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: .9rem; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: 16px; }
.progress i { display: block; height: 100%; background: var(--green); transition: width .3s; }

.q-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.q-img { border-radius: 16px; aspect-ratio: 4/3; object-fit: cover; width: 100%; background: var(--surface-2); }
.q-text { font-size: 1.25rem; font-weight: 700; margin: 0 0 12px; }
.opts { display: grid; gap: 10px; }
.opt {
  border: 2px solid var(--line); background: var(--surface); color: var(--text); padding: 12px 14px; border-radius: 12px; font: inherit;
  font-weight: 600; text-align: left; cursor: pointer; transition: border-color .15s, background .15s;
}
.opt:hover:not(:disabled) { border-color: var(--green); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt:disabled { cursor: default; }
.feedback { margin-top: 12px; padding: 12px 14px; border-radius: 12px; font-weight: 500; }
.feedback.good { background: var(--ok-soft); }
.feedback.bad { background: var(--bad-soft); }

.memory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 720px; margin: 0 auto; }
.mcard { aspect-ratio: 1; perspective: 800px; border: 0; padding: 0; background: none; cursor: pointer; }
.mcard .inner { position: relative; width: 100%; height: 100%; transition: transform .45s; transform-style: preserve-3d; }
.mcard.flip .inner, .mcard.done .inner { transform: rotateY(180deg); }
.mcard .face { position: absolute; inset: 0; border-radius: 14px; backface-visibility: hidden; display: grid; place-items: center; overflow: hidden; }
.mcard .front { background: var(--red); color: #fff; font-size: 2rem; box-shadow: inset 0 0 0 4px rgba(255,255,255,.25); }
.mcard .back { transform: rotateY(180deg); background: var(--surface-2); border: 2px solid var(--line); font-weight: 700; padding: 6px; text-align: center; font-size: clamp(.75rem, 1.8vw, 1rem); }
.mcard .back img { width: 100%; height: 100%; object-fit: cover; }
.mcard.done .back { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok); }

.habitat-game { display: grid; gap: 16px; }
.tray { display: flex; flex-wrap: wrap; gap: 10px; min-height: 120px; padding: 10px; border: 2px dashed var(--line); border-radius: 16px; justify-content: center; }
.hcard {
  width: 120px; border-radius: 12px; overflow: hidden; background: var(--surface); border: 2px solid var(--line); cursor: grab; padding: 0;
  font: inherit; color: inherit; touch-action: none;
}
.hcard img { width: 100%; aspect-ratio: 4/3; object-fit: cover; pointer-events: none; }
.hcard span { display: block; font-size: .8rem; font-weight: 700; padding: 4px; text-align: center; }
.hcard.sel { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold); }
.hcard.shake { animation: shake .4s; border-color: var(--bad); }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.zones { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.zone { border-radius: 16px; min-height: 170px; padding: 10px; border: 2px solid transparent; display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.zone h4 { margin: 0; font-size: 1.05rem; }
.zone .zitems { display: flex; flex-wrap: wrap; gap: 4px; }
.zone .zitems img { width: 54px; height: 42px; object-fit: cover; border-radius: 6px; border: 2px solid var(--ok); }
.zone.over { border-color: var(--gold); }
.z-tau { background: linear-gradient(160deg, #cfd8dc, #90a4ae); color: #1d2a30; }
.z-dala { background: linear-gradient(160deg, #f0e6a8, #c5b35a); color: #2e2a0e; }
.z-shol { background: linear-gradient(160deg, #ffe0b2, #e0a96d); color: #3a2410; }
.z-su { background: linear-gradient(160deg, #b3e5fc, #4fc3f7); color: #0b2f40; }

.hidden-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.blur-box { border-radius: 16px; overflow: hidden; aspect-ratio: 4/3; background: var(--surface-2); }
.blur-box img { width: 100%; height: 100%; object-fit: cover; transition: filter .6s, transform .6s; }
.endcard { text-align: center; padding: 20px 10px; }
.endcard .stars { font-size: 2.6rem; letter-spacing: 6px; }
.endcard h2 { margin: 8px 0; }

/* LESSON PLAYER */
.player { background: #0e1512; border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); color: #eef5f0; }
.stage { position: relative; aspect-ratio: 16/9; overflow: hidden; background: radial-gradient(circle at 70% 30%, #23463a, #0e1512 70%); }
.player:fullscreen { border-radius: 0; display: flex; flex-direction: column; }
.player:fullscreen .stage { aspect-ratio: auto; flex: 1; }
.scene { position: absolute; inset: 0 0 0 30%; }
.scene .shot { position: absolute; inset: 0; opacity: 0; transition: opacity .9s; }
.scene .shot.on { opacity: 1; }
.scene .shot img { width: 100%; height: 100%; object-fit: cover; animation: kenburns 22s ease-in-out infinite alternate; }
.scene .shot::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #0e1512 0%, rgba(14,21,18,.2) 35%, rgba(14,21,18,0) 60%), linear-gradient(0deg, rgba(0,0,0,.75), transparent 40%); }
.scene .shot .label { position: absolute; right: 18px; top: 16px; z-index: 2; background: rgba(0,0,0,.55); padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: clamp(.75rem, 1.6vw, 1rem); }
@keyframes kenburns { from { transform: scale(1.02) translate(0,0); } to { transform: scale(1.14) translate(-2%, -2%); } }
.cover-shot { display: grid; place-items: center; height: 100%; }
.big-book {
  width: 34%; aspect-ratio: 3/4; background: linear-gradient(135deg, #e53935, #8e1515); border-radius: 8px 16px 16px 8px; position: relative;
  box-shadow: inset 14px 0 0 rgba(0,0,0,.25), 0 20px 50px rgba(0,0,0,.5); display: grid; place-items: center; text-align: center;
  font-weight: 800; color: #fff; font-size: clamp(.8rem, 2.4vw, 1.6rem); padding: 10px; animation: floaty 4s ease-in-out infinite;
}
.big-book small { display: block; font-size: .5em; font-weight: 600; opacity: .85; }
@keyframes floaty { 50% { transform: translateY(-10px) rotate(-1deg); } }
.collage { display: grid; grid-template-columns: 1fr 1fr; height: 100%; }
.collage img { width: 100%; height: 100%; object-fit: cover; animation: none; }

.avatar { position: absolute; left: 3%; top: 8%; width: 25%; text-align: center; z-index: 3; }
.avatar svg { width: 100%; filter: drop-shadow(0 10px 30px rgba(0,0,0,.5)); }
.avatar-name { margin-top: 6px; font-weight: 700; font-size: clamp(.65rem, 1.5vw, .95rem); background: rgba(255,255,255,.1); border-radius: 999px; padding: 3px 10px; display: inline-block; }
.avatar .eyes { animation: blink 4.5s infinite; transform-origin: 100px 90px; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
.avatar .mouth { transform-origin: 100px 115px; transition: transform .1s; }
.avatar.talking .mouth { animation: talk .32s infinite alternate; }
@keyframes talk { 0% { transform: scaleY(.6); } 40% { transform: scaleY(1.9) scaleX(.95); } 70% { transform: scaleY(1); } 100% { transform: scaleY(2.3) scaleX(.9); } }
.avatar.listening svg { animation: nod 1.6s ease-in-out infinite; }
@keyframes nod { 50% { transform: rotate(-3deg) translateY(2px); } }
.avatar.happy .mouth path { d: path("M87 112 Q100 126 113 112 Q100 117 87 112Z"); }

.badge-live { position: absolute; left: 14px; bottom: 14px; z-index: 4; display: none; }
.score-badge { position: absolute; right: 14px; bottom: 14px; z-index: 4; background: rgba(0,0,0,.55); padding: 4px 12px; border-radius: 999px; font-weight: 700; }
.stage.listen-mode .badge-live { display: flex; align-items: center; gap: 6px; background: var(--red); color: #fff; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: .85rem; }
.badge-live span { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1s infinite; }
.badge-live i { font-style: normal; }
@keyframes pulse { 50% { opacity: .2; } }

.subs {
  position: absolute; left: 30%; right: 3%; bottom: 13%; z-index: 4; text-align: center; font-size: clamp(.8rem, 2vw, 1.3rem);
  font-weight: 600; line-height: 1.4; text-shadow: 0 2px 6px rgba(0,0,0,.8);
}
.subs .line { display: inline; background: rgba(0,0,0,.55); padding: 4px 10px; border-radius: 8px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.subs .w { opacity: .55; transition: opacity .15s, color .15s; }
.subs .w.on { opacity: 1; }
.subs .who { color: #ffcc80; margin-right: 6px; }
.subs.student .who { color: #80deea; }
.subs.feedback-ok .line { background: rgba(46,125,50,.85); }
.subs.feedback-bad .line { background: rgba(198,40,40,.85); }

.big-play {
  position: absolute; inset: 0; z-index: 6; border: 0; background: rgba(8,12,10,.55); color: #fff; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font: inherit;
}
.big-play span { width: 86px; height: 86px; border-radius: 50%; background: var(--red); display: grid; place-items: center; font-size: 2.2rem; padding-left: 6px; box-shadow: 0 0 0 10px rgba(198,40,40,.3); transition: transform .2s; }
.big-play:hover span { transform: scale(1.08); }
.big-play b { font-size: 1.3rem; }
.big-play small { opacity: .8; }
.big-play[hidden] { display: none; }

.controls { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #0a100d; }
.ctl { background: transparent; border: 0; color: #fff; font-size: 1.15rem; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; }
.ctl:hover { background: rgba(255,255,255,.12); }
.timeline { flex: 1; display: flex; gap: 3px; height: 8px; }
.timeline button { flex: 1; border: 0; padding: 0; height: 100%; border-radius: 3px; background: rgba(255,255,255,.18); cursor: pointer; position: relative; overflow: hidden; }
.timeline button.q { background: rgba(255,204,128,.35); }
.timeline button.done { background: #66bb6a; }
.timeline button.done.q.bad { background: #ef9a9a; }
.timeline button i { position: absolute; inset: 0 auto 0 0; width: 0; background: #fff; }
.step-count { font-size: .85rem; opacity: .8; min-width: 48px; text-align: right; }

.answer { background: #142019; padding: 14px 16px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.answer[hidden] { display: none; }
.answer-row { display: flex; gap: 16px; align-items: center; }
.mic {
  flex: none; width: 78px; height: 78px; border-radius: 50%; border: 0; background: var(--red); color: #fff; font-size: 2rem; cursor: pointer; position: relative;
}
.mic-ring { position: absolute; inset: -6px; border-radius: 50%; border: 3px solid rgba(239,83,80,.6); opacity: 0; }
.mic.on .mic-ring { animation: ring 1.2s infinite; }
@keyframes ring { 0% { transform: scale(.9); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }
.mic:disabled { background: #455a64; cursor: not-allowed; }
.answer-main { flex: 1; min-width: 0; }
.heard { font-weight: 600; margin-bottom: 8px; color: #cfe8d9; min-height: 1.5em; }
.heard q { color: #80deea; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chips .chip { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.2); }
.chips .chip:hover { background: rgba(255,255,255,.18); }
.typed { display: flex; gap: 8px; }
.typed input { flex: 1; min-width: 0; padding: 10px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.06); color: #fff; font: inherit; }
.mic-note { font-size: .85rem; color: #ffcc80; margin: 10px 0 0; }

.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 20px 16px 30px; border-top: 1px solid var(--line); }

@media (max-width: 860px) {
  .hero, .cols, .q-wrap, .hidden-wrap { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cats { grid-template-columns: repeat(2, 1fr); }
  .game-menu { grid-template-columns: repeat(2, 1fr); }
  .zones { grid-template-columns: repeat(2, 1fr); }
  .modal-box { grid-template-columns: 1fr; }
  .modal-box img { max-height: 260px; }
}
@media (max-width: 600px) {
  .top { padding: 8px 12px; }
  .nav a { padding: 6px 9px; font-size: .85rem; }
  .stage { aspect-ratio: 3/4; }
  .scene { inset: 0; }
  .scene .shot::after { background: linear-gradient(0deg, rgba(0,0,0,.85), transparent 55%); }
  .avatar { width: 30%; left: 4%; top: auto; bottom: 34%; }
  .avatar-name { display: none; }
  .subs { left: 4%; right: 4%; bottom: 10%; }
  .memory { grid-template-columns: repeat(3, 1fr); }
  .answer-row { flex-direction: column; align-items: stretch; }
  .mic { align-self: center; }
  .step-count { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* teacher photo / talking video (img/teacher.jpg, video/*.mp4) */
.tvid { display: none; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 50%; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.avatar.video-on .tvid { display: block; }
.avatar.video-on > svg { display: none; }
.avatar.has-photo > svg { display: none; }
.tphoto { position: relative; width: 100%; aspect-ratio: 1; border-radius: 50%; overflow: hidden; border: 4px solid #c62828; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.tphoto img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.tphoto .tvid { position: absolute; inset: 0; border-radius: 0; box-shadow: none; }
.avatar.has-photo.talking .tphoto { animation: speakglow 1s ease-in-out infinite; }
.avatar.has-photo.video-on.talking .tphoto { animation: none; }
@keyframes speakglow { 50% { box-shadow: 0 0 0 10px rgba(198,40,40,.35), 0 10px 30px rgba(0,0,0,.5); transform: scale(1.02); } }
.tphoto .suit { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* new games */
.g-hint { color: var(--muted); margin: 0 0 12px; }
.floaty { position: absolute; font-weight: 800; font-size: 1.6rem; pointer-events: none; transform: translate(-50%, 0); animation: floatup .9s ease-out forwards; z-index: 5; text-shadow: 0 2px 6px rgba(0,0,0,.25); }
@keyframes floatup { to { transform: translate(-50%, -60px); opacity: 0; } }
.whack { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 560px; margin: 0 auto;
  padding: 18px; border-radius: 22px; background: linear-gradient(180deg, #bfe3f5 0%, #d8efc4 45%, #9ccc65 100%); user-select: none; }
.hole { position: relative; aspect-ratio: 1; overflow: hidden; background: radial-gradient(ellipse 46% 16% at 50% 80%, #3e2723 0 70%, #6d4c41 71% 100%, transparent 101%); }
.bush { position: absolute; left: -6%; right: -6%; bottom: -8%; height: 42%; z-index: 2; pointer-events: none;
  background: radial-gradient(circle at 20% 60%, #43a047 0 30%, transparent 31%), radial-gradient(circle at 50% 45%, #4caf50 0 34%, transparent 35%), radial-gradient(circle at 80% 60%, #388e3c 0 30%, transparent 31%); }
.pop { position: absolute; left: 12%; right: 12%; top: 14%; bottom: 10%; border: 0; border-radius: 50%; cursor: pointer; transform: translateY(110%);
  transition: transform .16s ease-out; display: grid; place-items: center; padding: 0; z-index: 1; font: inherit; touch-action: manipulation; }
.pop.up { transform: translateY(0); }
.pop.threat { background: #fff3e0; box-shadow: 0 0 0 4px #ff7043; }
.pop.threat span { font-size: clamp(1.6rem, 6vw, 2.6rem); line-height: 1; }
.pop.threat small { font-size: .7rem; font-weight: 700; color: #bf360c; margin-top: -18px; }
.pop.animal { background: #fff; box-shadow: 0 0 0 4px #66bb6a; overflow: hidden; }
.pop.animal img { width: 100%; height: 100%; object-fit: cover; }
.pop.hit { transform: translateY(0) scale(.6) rotate(20deg); opacity: 0; transition: .2s; }
.w-msg { text-align: center; min-height: 1.6em; margin-top: 12px; font-weight: 600; }

.tf { display: grid; grid-template-columns: 90px 1fr 90px; gap: 12px; align-items: center; max-width: 720px; margin: 0 auto; }
.tf-zone { font-weight: 800; text-align: center; padding: 30px 6px; border-radius: 14px; font-size: .85rem; }
.tf-zone.l { background: var(--bad-soft); color: var(--bad); }
.tf-zone.r { background: var(--ok-soft); color: var(--ok); }
.tf-card { background: var(--surface); border: 2px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); cursor: grab;
  touch-action: pan-y; user-select: none; transition: transform .35s, opacity .35s, border-color .2s; }
.tf-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; pointer-events: none; }
.tf-card p { font-size: 1.2rem; font-weight: 700; padding: 14px 16px 6px; margin: 0; }
.tf-timer { height: 6px; background: var(--surface-2); margin: 8px 16px 14px; border-radius: 99px; overflow: hidden; }
.tf-timer i { display: block; height: 100%; width: 100%; background: var(--gold); }
.tf-card.lean-r { border-color: var(--ok); } .tf-card.lean-l { border-color: var(--bad); }
.tf-card.fly-r { transform: translateX(120%) rotate(18deg); opacity: 0; }
.tf-card.fly-l { transform: translateX(-120%) rotate(-18deg); opacity: 0; }
.tf-card.fly-down { transform: translateY(40%); opacity: 0; }
.tf-btns { display: flex; gap: 12px; justify-content: center; margin: 14px 0 6px; }
.tf-btns .btn { font-size: 1.05rem; padding: 12px 26px; }
.tf-no { border-color: var(--bad); color: var(--bad); } .tf-yes { border-color: var(--ok); color: var(--ok); }
.tf-fb { max-width: 720px; margin: 0 auto; min-height: 52px; }

.pz-wrap { display: grid; grid-template-columns: minmax(0, 520px) 1fr; gap: 20px; align-items: start; }
.pz { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 3px; background: var(--line); padding: 3px; border-radius: 14px; aspect-ratio: 4/3; }
.pz-t { border: 0; padding: 0; cursor: pointer; border-radius: 4px; outline: 0 solid var(--gold); transition: outline-width .1s, filter .2s; }
.pz-t.sel { outline: 4px solid var(--gold); outline-offset: -4px; filter: brightness(1.15); }
.pz.solved { gap: 0; padding: 0; }
.pz.solved .pz-t { border-radius: 0; }
.pz-prev { border-radius: 12px; max-width: 220px; opacity: .9; }

.slots, .tiles { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.slot, .tile { width: 44px; height: 50px; border-radius: 10px; font: inherit; font-size: 1.4rem; font-weight: 800; cursor: pointer; }
.slot { border: 2px dashed var(--line); background: var(--surface-2); color: var(--text); }
.slot.full { border-style: solid; border-color: var(--green); background: var(--surface); }
.slots.win .slot { border-color: var(--ok); background: var(--ok-soft); }
.slots.shake { animation: shake .4s; }
.tile { border: 0; background: var(--green); color: #fff; box-shadow: 0 4px 0 color-mix(in srgb, var(--green) 60%, #000); transition: transform .1s; }
.tile:active { transform: translateY(3px); box-shadow: none; }
.tile:disabled { opacity: .2; cursor: default; }
.game-menu { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .pz-wrap { grid-template-columns: 1fr; } .tf { grid-template-columns: 1fr; } .tf-zone { display: none; } }

/* ===== formal look (overrides) ===== */
:root { --bg: #f5f3ee; --surface: #ffffff; --surface-2: #eeebe3; --text: #1c1f22; --muted: #5b6168; --line: #dcd7cc;
  --green: #1f4e3d; --red: #9b1c1c; --red-soft: #f6e7e5; --gold: #b8a46a; --radius: 8px; --shadow: 0 2px 12px rgba(20, 24, 28, .07); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #121417; --surface: #1a1d21; --surface-2: #23272c; --text: #e9eaec; --muted: #a2a8b0; --line: #30353b;
    --green: #5fa98b; --red: #e06666; --red-soft: #3a2222; --gold: #c9b77f; }
}
:root[data-theme="dark"] { --bg: #121417; --surface: #1a1d21; --surface-2: #23272c; --text: #e9eaec; --muted: #a2a8b0; --line: #30353b;
  --green: #5fa98b; --red: #e06666; --red-soft: #3a2222; --gold: #c9b77f; }
h1, h2, h3, .brand b, .stats b, .cat b, .game-card b, .q-text, .tf-card p, .big-play b {
  font-family: Cambria, "PT Serif", "Noto Serif", Georgia, serif; letter-spacing: .005em; }
h1 { font-weight: 700; }
.btn, .chip, .nav a, .tags li, .badges span, .g-stats span, .sp .tag { border-radius: 6px; }
.btn { font-weight: 600; letter-spacing: .01em; }
.btn:hover { transform: none; }
.nav a { font-weight: 500; }
.nav a.nav-ai { border-width: 1px; }
.book-icon { width: 24px; height: 32px; border-radius: 2px 4px 4px 2px; }
.book-icon::after { content: ""; }
.eyebrow { color: var(--red); letter-spacing: .14em; }
.hero-img img, .q-img, .blur-box, .modal-box, .player, .game-area, .whack, .tf-card { border-radius: 10px; }
.hero-img figcaption { border-radius: 4px; }
.stats div { border-left: 3px solid var(--red); }
.stats b { color: var(--text); }
.sp:hover, .game-card:hover { transform: none; box-shadow: var(--shadow); border-color: var(--muted); }
.sp .tag { background: var(--surface-2); color: var(--muted); }
.cat { border-radius: 8px; }
.c1 { background: #7f1d1d; } .c2 { background: #9a3412; } .c3 { background: #a16207; color: #fff; } .c4 { background: #475569; } .c5 { background: #166534; }
.game-card .gi { font: 700 1.05rem/1 Cambria, Georgia, serif; color: var(--red); border-bottom: 2px solid var(--red); padding-bottom: 6px; margin-bottom: 6px; }
.game-card em { color: var(--muted); }
.player { background: #12171d; }
.stage { background: radial-gradient(circle at 70% 30%, #2b3644, #12171d 70%); }
.scene .shot::after { background: linear-gradient(90deg, #12171d 0%, rgba(18,23,29,.25) 35%, rgba(18,23,29,0) 60%), linear-gradient(0deg, rgba(0,0,0,.75), transparent 40%); }
.controls { background: #0d1116; }
.answer { background: #171d24; }
.big-play span { background: var(--red); box-shadow: 0 0 0 8px rgba(155,28,28,.25); }
.avatar-name { background: rgba(255,255,255,.08); border-radius: 4px; letter-spacing: .03em; }
.subs .who { color: #d9c58f; }
.mic { background: var(--red); }
.feedback { border-radius: 6px; }
.ai-badge { display: inline-block; font-size: .85rem; padding: 4px 10px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); margin: 0 0 12px; }
.ai-badge.on { border-color: var(--green); color: var(--green); }
.subs.thinking .line { font-style: italic; opacity: .85; }
.avatar.thinking svg { animation: nod 1.2s ease-in-out infinite; }
