/* Ascendia 2.0 — toàn bộ giao diện. Mọi màu/cỡ lấy từ tokens.css. Điện thoại trước, rồi iPad, rồi desktop. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: var(--t-sm); line-height: 1.45; font-weight: 600;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
h1, h2, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
small { display: block; font-size: var(--t-xs); font-weight: 600; color: var(--ink-soft); }
.vi { color: var(--ink-soft); font-weight: 600; }
:focus-visible { outline: 3px solid var(--sky-deep); outline-offset: 3px; }
[hidden] { display: none !important; }

.page {
  width: 100%; max-width: 560px; margin: 0 auto; min-height: 100dvh;
  padding: max(var(--s3), env(safe-area-inset-top)) max(var(--s4), env(safe-area-inset-right)) max(var(--s6), env(safe-area-inset-bottom)) max(var(--s4), env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: var(--s4);
}
.page.play { max-width: 720px; }
.note { font-size: var(--t-xs); color: var(--ink-soft); text-align: center; }
.eyebrow { font-size: var(--t-xs); letter-spacing: .08em; text-transform: uppercase; font-weight: 800; color: var(--sky-deep); }
.eyebrow .vi { letter-spacing: 0; text-transform: none; }

/* ---------- khối cơ bản ---------- */
.card { background: var(--card); border: var(--stroke) solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--drop); padding: var(--s5); }
.ico { display: inline-flex; flex: none; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); padding: 0 var(--s5); width: 100%;
  background: var(--card); border: var(--stroke) solid var(--line); border-radius: var(--radius); box-shadow: var(--drop-sm);
  font-weight: 800; font-size: var(--t-md); text-align: center;
  transition: transform var(--fast) var(--out), box-shadow var(--fast) var(--out);
  touch-action: manipulation; user-select: none;
}
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.btn--go { background: var(--go); }
.btn--xl { min-height: 72px; font-size: var(--t-lg); letter-spacing: .03em; box-shadow: var(--drop); }
.btn--xl:active { transform: translateY(6px); }
.btn--card { justify-content: flex-start; text-align: left; padding: var(--s3) var(--s4); min-height: 68px; font-size: var(--t-md); }
.btn--card small { margin-top: -2px; }
@media (hover: hover) { .btn:hover { transform: translateY(-2px); } .btn:active { transform: translateY(4px); } }

.iconbtn {
  flex: none; width: 48px; height: 48px; display: grid; place-items: center;
  background: var(--card); border: var(--stroke) solid var(--line); border-radius: var(--radius); box-shadow: var(--drop-sm);
  transition: transform var(--fast) var(--out), box-shadow var(--fast) var(--out);
}
.iconbtn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }

.topbar { display: flex; align-items: center; gap: var(--s3); min-height: 52px; }
.topbar > .iconbtn:last-child { margin-left: auto; }
.topbar__title { min-width: 0; line-height: 1.2; }
.topbar__title strong { display: block; font-size: var(--t-md); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__title small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand { font-weight: 900; letter-spacing: .14em; font-size: var(--t-sm); }

/* ---------- nhân vật ---------- */
.blok { display: block; overflow: visible; }
.blok__body { transform-origin: 60px 174px; animation: blok-idle 2.4s ease-in-out infinite; }
.blok--cheer .blok__body { animation: blok-cheer .5s var(--bounce) 3; }
@keyframes blok-idle { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.97) translateY(1px); } }
@keyframes blok-cheer { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-14px) scaleY(1.04); } }

/* ---------- trang chính ---------- */
.home__grid { display: grid; gap: var(--s5); flex: 1; align-content: center; }
.hero { display: grid; justify-items: center; gap: var(--s3); text-align: center; }
.hero__stage { position: relative; display: grid; justify-items: center; }
.hero__avatar { position: relative; z-index: 1; margin-bottom: -10px; }
.hero__ground { width: 220px; height: 26px; background: var(--go); border: var(--stroke) solid var(--line); border-radius: 10px; box-shadow: var(--drop-sm); }
.petline { display: grid; justify-items: center; gap: 2px; text-align: center; background: var(--card); border: var(--stroke) solid var(--line); border-radius: var(--radius); padding: var(--s2) var(--s4); box-shadow: var(--drop-sm); }
.petline strong { font-size: var(--t-md); font-weight: 900; }
.petline--hungry { background: var(--sun); }
.petline--grave { background: var(--stone); }
.streak { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; background: var(--sun); border: 2px solid var(--line); border-radius: 9px; padding: 0 8px; font-size: var(--t-xs); font-weight: 900; }
.petline--hungry .streak { background: var(--card); }
.reward__pet { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 2px solid var(--line); border-radius: 10px; padding: 2px 10px; font-weight: 800; }
.hint { font-size: var(--t-xs); color: var(--ink-soft); margin-top: calc(var(--s2) * -1); }
.hero__hi { font-size: var(--t-xxl); font-weight: 900; line-height: 1.05; margin-top: var(--s3); }

.level { display: flex; align-items: center; gap: var(--s2); width: 100%; max-width: 340px; font-weight: 800; font-size: var(--t-xs); }
.level__badge { background: var(--sun); border: var(--stroke) solid var(--line); border-radius: 10px; padding: 2px 10px; white-space: nowrap; }
.level__track { flex: 1; height: 16px; background: var(--card); border: var(--stroke) solid var(--line); border-radius: 8px; overflow: hidden; }
.level__fill { display: block; height: 100%; background: var(--sun); border-right: var(--stroke) solid var(--line); transition: width .6s var(--out); }
.level__count { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }

.mission { background: var(--card); border: var(--stroke) solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--drop); padding: var(--s5); display: grid; gap: var(--s2); }
.mission__title { font-size: var(--t-xl); font-weight: 900; line-height: 1.12; }
.mission__meta { color: var(--ink-soft); }
.tags { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s2) 0 var(--s3); }
.tags li { display: inline-flex; align-items: center; gap: 6px; background: var(--paper); border: 2px solid var(--line); border-radius: 10px; padding: 4px 10px; font-size: var(--t-xs); font-weight: 800; }
.home__side { display: grid; gap: var(--s4); }
.dock { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }

@media (min-width: 900px) {
  .page.home { max-width: 980px; }
  .home__grid { grid-template-columns: 1fr 1.1fr; align-items: center; gap: var(--s7); }
}

/* ---------- nhiệm vụ ---------- */
.steps { display: flex; gap: var(--s2); }
.steps__dot { flex: 1; display: flex; align-items: center; gap: var(--s2); padding: 6px 10px; border: var(--stroke) solid var(--line); border-radius: var(--radius); background: var(--stone); color: var(--ink-soft); font-size: var(--t-xs); font-weight: 800; min-width: 0; }
.steps__n { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border: 2px solid currentColor; border-radius: 8px; background: var(--card); }
.steps__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps__dot.is-now { background: var(--sky); color: var(--ink); }
.steps__dot.is-done { background: var(--go); color: var(--ink); }

.step { display: grid; gap: var(--s4); }
.enter { animation: enter var(--med) var(--out); }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }

.video__frame { border: var(--stroke) solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--ink); aspect-ratio: 16 / 9; }
.video { display: block; width: 100%; height: 100%; }

.idea__formula { background: var(--paper); border: var(--stroke) solid var(--line); border-radius: var(--radius); padding: var(--s4); font-size: var(--t-lg); overflow-x: auto; text-align: center; }
.idea__formula .katex-display { margin: .2em 0; }
.idea__method { display: grid; gap: var(--s2); counter-reset: m; font-size: var(--t-md); }
.idea__method li { counter-increment: m; display: grid; grid-template-columns: 32px 1fr; gap: var(--s3); align-items: start; }
.idea__method li::before { content: counter(m); width: 32px; height: 32px; display: grid; place-items: center; background: var(--sky); border: var(--stroke) solid var(--line); border-radius: 10px; font-weight: 900; font-size: var(--t-sm); }
.idea__tag { font-size: var(--t-xs); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: var(--s2); }
.idea__example, .idea__watch { border-top: var(--stroke) dashed var(--stone-deep); padding-top: var(--s4); }
.idea__q { font-size: var(--t-lg); overflow-x: auto; }
.idea__q .katex-display { margin: .2em 0; text-align: left; }
.idea__q .katex-display > .katex { text-align: left; }
.idea__steps { display: grid; gap: 6px; font-size: var(--t-md); padding-left: var(--s4); border-left: 4px solid var(--go); margin-top: var(--s2); }
.idea__watch p:not(.idea__tag) { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); font-size: var(--t-md); }
.idea__wrong { text-decoration: line-through; text-decoration-color: var(--brick-deep); text-decoration-thickness: 3px; }
.idea__right { background: var(--go); border: 2px solid var(--line); border-radius: 8px; padding: 0 8px; }

/* cầu khối: mỗi câu đúng đặt một khối, Blok nhảy sang */
.bridge { display: flex; align-items: flex-end; gap: var(--s3); padding-top: 64px; }
.bridge__track { --n: 6; --at: 0; position: relative; flex: 1; display: grid; grid-template-columns: 1fr repeat(var(--n), 1fr) 1fr; gap: 4px; align-items: end; }
.bridge__bank { height: 22px; background: var(--go); border: var(--stroke) solid var(--line); border-radius: 8px 4px 4px 8px; position: relative; }
.bridge__bank--end { border-radius: 4px 8px 8px 4px; }
.bridge__flag { position: absolute; right: 6px; bottom: 100%; color: var(--sun-deep); display: grid; padding-bottom: 2px; }
.bridge__flag svg { fill: var(--sun); stroke: var(--ink); }
.bridge__slot { height: 22px; border: var(--stroke) dashed var(--stone-deep); border-radius: 4px; }
.bridge__slot.is-laid { border-style: solid; border-color: var(--line); animation: drop var(--med) var(--bounce); }
.bridge__slot.is-gold { background: var(--sun); }
.bridge__slot.is-plain { background: var(--sky); }
.bridge__slot.is-ghost { background: var(--stone); }
@keyframes drop { from { transform: translateY(-26px); opacity: 0; } }
.bridge__runner {
  position: absolute; bottom: 15px; left: 0; width: calc(100% / (var(--n) + 2)); display: grid; justify-items: center;
  transform: translateX(calc(var(--at) * 100%)); transition: transform .35s var(--out); pointer-events: none;
}
.bridge__runner.hop .b3 { animation: hop .35s var(--out); }
@keyframes hop { 50% { transform: translateY(-16px); } }
.bridge__count { display: inline-flex; align-items: center; gap: 4px; font-weight: 900; background: var(--sun); border: var(--stroke) solid var(--line); border-radius: 10px; padding: 2px 10px; min-width: 64px; justify-content: center; }

.stage { position: relative; border: var(--stroke) solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--drop-sm); overflow: hidden; background: #cfeaff; aspect-ratio: 2.5 / 1; min-height: 190px; max-height: 300px; width: 100%; }
.stage3d { position: absolute; inset: 0; }
.stage3d canvas { display: block; width: 100%; height: 100%; }
.stage .bridge__count { position: absolute; top: var(--s3); right: var(--s3); z-index: 1; }
.stage--flat { aspect-ratio: auto; min-height: 0; padding: 56px var(--s4) var(--s4); background: var(--paper); }
.stage--flat .bridge__count { top: var(--s2); }
.q__card { display: grid; gap: var(--s3); padding: var(--s4) var(--s4) var(--s5); }
.q__n { font-size: var(--t-xs); font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }
.q__stem { font-size: var(--t-md); }
.q__text { font-size: var(--t-xl); font-weight: 700; line-height: 1.3; overflow-x: auto; padding: var(--s2) 0; }
.choices { display: grid; grid-template-columns: 1fr; gap: var(--s3); }
@media (min-width: 520px) { .choices { grid-template-columns: 1fr 1fr; } .choices[data-n="3"] { grid-template-columns: 1fr 1fr 1fr; } }
.choice {
  min-height: 64px; padding: var(--s2) var(--s4); background: var(--card); border: var(--stroke) solid var(--line); border-radius: var(--radius); box-shadow: var(--drop-sm);
  font-size: var(--t-lg); font-weight: 700; touch-action: manipulation; overflow-x: auto;
  transition: transform var(--fast) var(--out), box-shadow var(--fast) var(--out), background var(--fast);
}
.choice:not(:disabled):active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.choice:disabled { cursor: default; color: var(--ink); opacity: 1; }
.choice.is-right { background: var(--go); }
.choice.is-wrong { background: var(--stone); color: var(--ink-soft); box-shadow: none; transform: translateY(4px); text-decoration: line-through; text-decoration-color: var(--brick-deep); text-decoration-thickness: 3px; }
.choice:disabled:not(.is-right):not(.is-wrong) { background: var(--paper); box-shadow: none; transform: translateY(4px); color: var(--ink-soft); }
.shake { animation: shake var(--med) var(--out); }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.feedback { display: grid; gap: var(--s3); }
.feedback:empty { display: none; }
.feedback { border: var(--stroke) solid var(--line); border-radius: var(--radius); padding: var(--s4); animation: enter var(--med) var(--out); }
.feedback.is-right { background: #e3f7ec; border-color: var(--go-deep); }
.feedback.is-again { background: #ffe9e6; border-color: var(--brick-deep); }
.feedback.is-info { background: #e6f2ff; border-color: var(--sky-deep); }
.feedback__head { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-md); font-weight: 900; }
.feedback__head .plus { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; background: var(--sun); border: 2px solid var(--line); border-radius: 10px; padding: 0 10px; }
.feedback__hint { font-size: var(--t-sm); }
.feedback__steps { display: grid; gap: 6px; padding-left: var(--s4); border-left: 4px solid var(--go); font-size: var(--t-md); }

.reward { justify-items: center; text-align: center; background: var(--sun); }
.reward__title { font-size: var(--t-xxl); font-weight: 900; line-height: 1.05; }
.reward__blocks { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-lg); font-weight: 800; }
.reward__num { font-size: var(--t-xl); font-weight: 900; font-variant-numeric: tabular-nums; }
.reward .note { color: var(--ink); }
.reward .level__fill { background: var(--go); }
.reward .level__badge { background: var(--card); }
.unlock { display: flex; align-items: center; gap: var(--s3); text-align: left; width: 100%; background: var(--card); border: var(--stroke) solid var(--line); border-radius: var(--radius); box-shadow: var(--drop-sm); padding: var(--s3) var(--s4); animation: enter .4s var(--bounce) .5s backwards; }

/* ---------- bản đồ ---------- */
.unit { display: grid; gap: var(--s2); }
.unit__head { display: flex; align-items: baseline; justify-content: space-between; font-size: var(--t-lg); font-weight: 900; margin-top: var(--s3); }
.unit__count { font-size: var(--t-xs); color: var(--ink-soft); font-weight: 800; }
.sec__head {
  width: 100%; min-height: var(--tap); display: grid; grid-template-columns: 1fr 72px auto; align-items: center; gap: var(--s3);
  padding: var(--s2) var(--s4); text-align: left; background: var(--card); border: var(--stroke) solid var(--line); border-radius: var(--radius); box-shadow: var(--drop-sm);
  font-weight: 800; font-size: var(--t-sm);
}
.sec__head.is-next { background: var(--sun); }
.sec__head.is-done { background: var(--go); }
.sec__bar { height: 12px; background: var(--paper); border: 2px solid var(--line); border-radius: 6px; overflow: hidden; }
.sec__fill { display: block; height: 100%; background: var(--go); }
.sec__head.is-done .sec__fill { background: var(--card); }
.sec__count { font-size: var(--t-xs); font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; }
.sec__list { display: grid; gap: var(--s2); padding: var(--s3) 0 var(--s3) var(--s4); margin-left: var(--s4); border-left: 4px solid var(--line); }
.lesson { min-height: 52px; display: grid; grid-template-columns: 32px 1fr auto auto; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); font-size: var(--t-sm); }
.lesson__state { width: 32px; height: 32px; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 10px; background: var(--stone); }
.lesson.is-done .lesson__state { background: var(--go); }
.lesson.is-next { background: var(--sun); }
.lesson.is-next .lesson__state { background: var(--card); }
.lesson__tag { color: var(--ink-soft); display: grid; }
.lesson__next { font-size: var(--t-xs); font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.lesson:active { transform: translateY(2px); }

/* ---------- tủ đồ ---------- */
.locker__grid2 { display: grid; gap: var(--s5); }
.locker__grid2 > * { min-width: 0; }
.locker__stage { display: grid; justify-items: center; }
.locker__preview { margin-bottom: -10px; position: relative; z-index: 1; }
.locker__preview.pop { animation: pop var(--med) var(--bounce); }
@keyframes pop { 50% { transform: scale(1.06) translateY(-6px); } }
.tabs { display: flex; gap: var(--s2); overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px; scrollbar-width: none; }
.tab { flex: 1 0 auto; min-height: 48px; padding: 0 var(--s4); background: var(--card); border: var(--stroke) solid var(--line); border-radius: var(--radius); font-weight: 800; box-shadow: var(--drop-sm); }
.tab.is-on { background: var(--sky); transform: translateY(4px); box-shadow: none; }
.locker__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: var(--s3); margin-top: var(--s2); }
.item { position: relative; display: grid; justify-items: center; gap: 2px; padding: var(--s2) var(--s2) var(--s3); background: var(--card); border: var(--stroke) solid var(--line); border-radius: var(--radius); box-shadow: var(--drop-sm); font-size: var(--t-xs); font-weight: 800; min-height: 140px; }
.item.is-on { background: var(--sun); }
.item.is-locked { background: var(--stone); box-shadow: none; color: var(--ink-soft); cursor: default; }
.item.is-locked .item__art { opacity: .5; }
.item__lock { display: inline-flex; align-items: center; gap: 4px; background: var(--card); border: 2px solid var(--line); border-radius: 8px; padding: 0 6px; color: var(--ink); }
.item:not(:disabled):active { transform: translateY(4px); box-shadow: none; }
@media (min-width: 760px) {
  .page.locker { max-width: 900px; }
  .locker__grid2 { grid-template-columns: 300px 1fr; align-items: start; }
  .locker__stage { position: sticky; top: var(--s5); }
}

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

/* ---------- Blok 3D (Three.js vẽ vào canvas, xem js/ui/blok3d.js) ---------- */
.b3 { position: relative; display: block; flex: none; }
.b3 canvas { display: block; width: 100%; height: 100%; }
.b3--drag { cursor: grab; touch-action: pan-y; }
.b3--drag.is-held { cursor: grabbing; }
.b3 .blok { position: absolute; inset: 0; margin: auto; height: 100%; width: auto; }

.hero__stage .b3 { margin-bottom: calc(var(--s2) * -1); }
.bridge__runner .b3 { margin-bottom: -2px; }
.item .b3 { pointer-events: none; }

/* ---------- vườn chung ---------- */
.page.garden { max-width: 980px; }
.garden__summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5); }
.garden__stat strong { font-size: var(--t-xl); font-weight: 900; line-height: 1; }
.garden__lvl { display: grid; grid-template-columns: auto minmax(120px, 220px); align-items: center; gap: 4px var(--s2); font-weight: 800; font-size: var(--t-xs); }
.garden__lvl small { grid-column: 1 / -1; }
.garden__demo { background: var(--stone); border: 2px solid var(--line); border-radius: 9px; padding: 2px 9px; font-size: var(--t-xs); font-weight: 800; }
.garden__stage { position: relative; border: var(--stroke) solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--drop-sm); overflow: hidden; background: #cfeaff; height: min(58vh, 520px); min-height: 300px; touch-action: none; }
.garden__stage canvas { display: block; width: 100%; height: 100%; }
.gtag { position: absolute; transform: translate(-50%, -100%); display: inline-flex; align-items: center; gap: 4px; background: rgba(255, 255, 255, .86); border: 1.5px solid rgba(27, 36, 64, .28); border-radius: 999px; padding: 0 7px; font-size: 11px; line-height: 18px; font-weight: 800; white-space: nowrap; pointer-events: none; }
.gtag span { display: inline-flex; align-items: center; gap: 1px; color: var(--sun-deep); }
.gtag.is-me { background: var(--sun); border-color: var(--line); font-size: 12px; z-index: 2; } .gtag.is-me span { color: var(--ink); }
.gtag.is-down { transform: translate(-50%, 0); background: #efe8ff; border-color: #8a63e6; color: #4b2fa8; animation: sos 1.4s ease-in-out infinite; z-index: 1; }
.gtag.is-down i { font-style: normal; font-size: 9px; letter-spacing: .04em; background: #e5484d; color: #fff; border-radius: 999px; padding: 0 5px; line-height: 14px; }
@keyframes sos { 50% { transform: translate(-50%, 0) scale(1.12); box-shadow: 0 0 0 5px rgba(138, 99, 230, .22); } }
@media (prefers-reduced-motion: reduce) { .gtag.is-down { animation: none; } }
.gbub { position: absolute; transform: translate(-50%, -100%); background: #fff; border: 2px solid var(--line); border-radius: 10px 10px 10px 3px; padding: 0 7px; font-size: 13px; line-height: 20px; font-weight: 900; white-space: nowrap; pointer-events: none; z-index: 3; animation: bub .18s ease-out; }
.gbub[hidden] { display: none; }
@keyframes bub { from { transform: translate(-50%, -80%) scale(.6); opacity: 0; } }
.gtag.is-on { outline: 3px solid var(--sky-deep); }
.garden__card { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); background: var(--card); border: var(--stroke) solid var(--line); border-radius: var(--radius); box-shadow: var(--drop-sm); padding: var(--s3) var(--s4); }
.garden__card > div { flex: 1; min-width: 160px; }
.garden__card strong { font-size: var(--t-md); font-weight: 900; }
.garden__card .btn { width: auto; min-height: 48px; }

/* ---------- phòng của pet: kéo thả trực tiếp, danh mục bên cạnh ---------- */
.page.room { max-width: 1100px; }
.room__main { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: var(--s3); align-items: start; }
.room__left { display: grid; gap: var(--s2); min-width: 0; }
.room__stage { position: relative; border: var(--stroke) solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--drop-sm); overflow: hidden; background: #fff0d9; height: min(66vh, 600px); min-height: 300px; touch-action: none; cursor: grab; }
.room__stage.is-out { background: var(--stone); }
.room__stage canvas { display: block; width: 100%; height: 100%; }
.room__hint { font-size: var(--t-xs); font-weight: 800; color: var(--ink-soft); text-align: center; }
.room__tools { position: absolute; transform: translate(-50%, -100%); display: flex; gap: 6px; z-index: 2; }
.room__tools .iconbtn { width: 44px; height: 44px; border-radius: 12px; }
.room__tools .x { font-size: 26px; font-weight: 900; line-height: 1; }
.room__menu { display: grid; gap: var(--s2); max-height: min(66vh, 600px); overflow-y: auto; padding: 2px 4px 8px 2px; align-content: start; }
.room__count { font-weight: 900; font-size: var(--t-xs); color: var(--ink-soft); }
.chip { min-height: 48px; padding: 2px var(--s3); background: var(--card); border: var(--stroke) solid var(--line); border-radius: var(--radius); box-shadow: var(--drop-sm); font-weight: 800; font-size: var(--t-xs); text-align: left; }
.chip:not(:disabled):active { transform: translateY(4px); box-shadow: none; background: var(--sun); }
.chip.is-locked, .chip:disabled { background: var(--stone); color: var(--ink-soft); box-shadow: none; cursor: default; }
@media (max-width: 760px) {
  .room__main { grid-template-columns: 1fr; }
  .room__stage { height: min(52vh, 460px); }
  .room__menu { display: flex; overflow-x: auto; overflow-y: hidden; max-height: none; align-items: stretch; }
  .room__count { flex: none; align-self: center; }
  .chip { flex: none; white-space: nowrap; }
}

/* ---------- màn hình chính = vườn + thanh điều khiển ---------- */
.page.garden { max-width: 1100px; gap: var(--s3); }
.page.garden .topbar { flex-wrap: wrap; row-gap: 4px; }
.hud__hi { font-weight: 900; font-size: var(--t-md); margin-left: var(--s2); }
.page.garden .topbar .level { margin-left: auto; max-width: 260px; }
.page.garden .garden__stage { height: min(64vh, 620px); min-height: 320px; }
.hud__pet { position: absolute; left: var(--s3); top: var(--s3); z-index: 2; display: grid; gap: 1px; max-width: min(70%, 300px); background: var(--card); border: var(--stroke) solid var(--line); border-radius: var(--radius); box-shadow: var(--drop-sm); padding: var(--s2) var(--s3); }
.hud__pet strong { font-weight: 900; }
.hud__pet--hungry, .hud__pet--new { background: var(--sun); }
.hud__pet--grave { background: var(--stone); }
.hud__pet .streak { justify-self: start; }
.garden__summary { position: absolute; right: var(--s3); top: var(--s3); z-index: 2; display: grid; justify-items: end; gap: 0; background: var(--card); border: 2px solid var(--line); border-radius: 10px; padding: 3px 9px; font-size: var(--t-xs); font-weight: 800; }
.garden__summary:empty { display: none; }
.hud__bar { display: flex; align-items: stretch; gap: var(--s3); }
.hud__play { flex: 1; text-align: left; justify-content: center; }
.hud__play span { display: grid; line-height: 1.1; }
.hud__play small { color: var(--ink); font-size: var(--t-xs); font-weight: 800; letter-spacing: 0; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud__nav { display: flex; gap: var(--s2); align-items: center; }
.hud__nav .iconbtn { width: 64px; height: 72px; display: grid; place-items: center; align-content: center; gap: 0; }
.hud__navbtn small { font-size: 11px; font-weight: 900; color: var(--ink); line-height: 1; }
@media (max-width: 560px) { .hud__nav .iconbtn { width: 50px; } .page.garden .topbar .level { max-width: none; width: 100%; order: 3; } }

/* ---------- lộ trình học + bài kiểm tra (16/11) ---------- */
.iconbtn--label { flex-direction: column; gap: 0; font-size: 10px; font-weight: 800; line-height: 1; text-decoration: none; color: var(--ink); }
.pathsum { display: grid; gap: 4px; }
.pathsum small { font-size: var(--t-xs); color: var(--ink-soft); font-weight: 800; }
.pathnext { display: grid; gap: var(--s3); padding: var(--s4); }
.pathnext .btn span, .test__intro .btn span { display: grid; text-align: left; line-height: 1.15; }
.pathnext .btn small, .test__intro .btn small { font-size: var(--t-xs); font-weight: 700; letter-spacing: 0; opacity: .8; }
.sec__sub { font-size: var(--t-xs); font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--sky-deep); margin-top: var(--s2); }
.lesson--test { background: #eaf4ff; }
.lesson--test .lesson__title { display: grid; line-height: 1.2; }
.lesson--test .lesson__title small { font-size: var(--t-xs); color: var(--ink-soft); font-weight: 700; }
.lesson--test .lesson__state { background: var(--card); }
.lesson--test.is-tried { background: #fff1c9; }
.lesson--test.is-done { background: #d9f5e5; }
.lesson__score { font-weight: 900; font-variant-numeric: tabular-nums; }
.page.tests { max-width: 720px; }
.tests__h { font-size: var(--t-lg); font-weight: 900; margin-top: var(--s3); }
.tests__h small { font-size: var(--t-xs); color: var(--ink-soft); font-weight: 700; }
.exam { display: grid; gap: var(--s3); padding: var(--s4); }
.exam h2 { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; font-size: var(--t-lg); font-weight: 900; }
.exam h2 small { font-size: var(--t-sm); color: var(--ink-soft); }
.note--left { text-align: left; }
.tchip { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s2); min-height: 52px; padding: var(--s2) var(--s3); background: #eaf4ff; border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--drop-sm); color: var(--ink); text-decoration: none; font-weight: 800; }
.tchip span { display: grid; line-height: 1.2; }
.tchip small { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.tchip b { font-variant-numeric: tabular-nums; background: var(--card); border: 2px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: var(--t-xs); }
.tchip.is-tried { background: #fff1c9; } .tchip.is-done { background: #d9f5e5; }
.tchip:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.trow { display: grid; gap: var(--s2); padding: var(--s3); background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); }
.trow__title { font-weight: 800; display: flex; justify-content: space-between; gap: var(--s2); align-items: baseline; }
.trow__title small { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.trow__title .trow__ready { color: var(--go-deep); }
.trow__chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s2); }
.test__body { display: grid; gap: var(--s3); }
.test__intro, .test__result { display: grid; gap: var(--s3); justify-items: center; text-align: center; }
.test__intro > .btn, .test__result > .btn, .test__intro > a.btn { width: 100%; }
.test__intro h1 { font-size: var(--t-xl); font-weight: 900; line-height: 1.15; }
.test__sec { font-weight: 800; color: var(--ink-soft); }
.test__facts { list-style: none; display: grid; gap: var(--s2); padding: 0; text-align: left; font-weight: 800; }
.test__facts li { display: flex; align-items: center; gap: var(--s2); }
.test__best { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--sun-deep); }
.test__bar { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.test__time { display: inline-flex; align-items: center; gap: 6px; }
.test__dots { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.tdot { flex: none; min-width: 40px; height: 40px; padding: 0 6px; border: 2px solid var(--line); border-radius: 10px; background: var(--card); font: inherit; font-size: var(--t-xs); font-weight: 800; color: var(--ink); cursor: pointer; }
.tdot.is-set { background: var(--sky); }
.tdot.is-on { outline: 3px solid var(--ink); outline-offset: 1px; }
.choice.is-picked { background: var(--sky); }
.test__nav { display: grid; grid-template-columns: 1fr 1.4fr; gap: var(--s3); }
.test__confirm { display: grid; gap: var(--s3); padding: var(--s3); background: #fff1c9; border: 2px solid var(--line); border-radius: var(--radius); font-weight: 800; }
.test__confirm[hidden] { display: none; }
.test__confirm p { display: flex; gap: var(--s2); align-items: center; }
.test__score { display: grid; }
.test__score strong { font-size: var(--t-xxl); font-weight: 900; line-height: 1; }
.test__score span { font-weight: 800; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.rev__list { display: grid; gap: var(--s2); }
.rev { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.rev summary { display: grid; grid-template-columns: 30px auto 1fr auto; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); cursor: pointer; list-style: none; font-weight: 800; min-height: 48px; }
.rev summary::-webkit-details-marker { display: none; }
.rev__state { width: 28px; height: 28px; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 8px; background: var(--go); }
.rev.is-wrong .rev__state { background: var(--brick); } .rev.is-blank .rev__state { background: var(--stone); }
.rev__ans { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }
.rev.is-wrong .rev__ans { text-decoration: line-through; text-decoration-color: var(--brick-deep); }
.rev__marks { font-variant-numeric: tabular-nums; }
.rev__body { display: grid; gap: var(--s2); padding: var(--s3); border-top: 2px solid var(--line); background: var(--paper); }
.rev__text { font-size: var(--t-md); font-weight: 700; overflow-x: auto; }
.rev__scheme { font-size: var(--t-xs); color: var(--ink-soft); }

/* ---------- chọn chủ đề có hình + danh sách ôn (17/11) ---------- */
.page.path, .page.topic { max-width: 760px; }
.art { display: block; color: var(--ink); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: var(--stroke) solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.seg__btn { min-height: 52px; border: 0; background: transparent; font: inherit; font-weight: 800; color: var(--ink); cursor: pointer; display: grid; place-content: center; line-height: 1.15; }
.seg__btn small { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.seg__btn.is-on { background: var(--sun); }
.seg__btn + .seg__btn { border-left: var(--stroke) solid var(--line); }
.topics { display: grid; gap: var(--s4); }
.strands { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3); }
.strand { display: grid; justify-items: center; gap: 2px; padding: var(--s3) var(--s2); background: var(--t); border: var(--stroke) solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--drop-sm); font: inherit; color: var(--ink); cursor: pointer; text-align: center; line-height: 1.15; }
.strand b { font-size: var(--t-sm); font-weight: 900; }
.strand small { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.strand__count { font-size: 11px; font-weight: 800; color: var(--ink-soft); margin-top: 2px; }
.strand.is-on { background: var(--a); transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.strand.is-on small, .strand.is-on .strand__count { color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); scroll-margin-top: var(--s4); }
.tile { position: relative; display: grid; gap: 6px; padding: var(--s3); background: var(--card); border: var(--stroke) solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--drop-sm); color: var(--ink); text-decoration: none; align-content: start; }
.tile__art { display: grid; place-items: center; background: var(--t); border: 2px solid var(--line); border-radius: var(--radius); padding: var(--s2); }
.tile__title { font-size: var(--t-sm); font-weight: 800; line-height: 1.2; min-height: 2.4em; }
.tile__meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.tile__lv { position: absolute; top: 8px; right: 8px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); }
.tile.is-next { background: var(--sun); }
.tile.is-done .tile__art { background: var(--go); }
.tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.sec__head { grid-template-columns: auto 1fr 72px auto !important; }
.sec__art { display: grid; }
.focus { display: grid; gap: var(--s3); }
.fgroup { display: grid; gap: var(--s2); }
.fgroup__head { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-xs); font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.fgroup__head i { width: 14px; height: 14px; border-radius: 50%; background: var(--lv); border: 2px solid var(--line); }
.fgroup__head small { margin-left: auto; font-size: var(--t-xs); color: var(--ink-soft); }
.frow { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s3); min-height: 64px; padding: var(--s2) var(--s3) var(--s2) var(--s2); background: var(--card); border: 2px solid var(--line); border-left: 10px solid var(--lv); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.frow__art { display: grid; place-items: center; width: 52px; height: 52px; border: 2px solid var(--line); border-radius: 12px; }
.frow__text { display: grid; line-height: 1.2; min-width: 0; }
.frow__text b { font-weight: 800; }
.frow__text small { font-size: var(--t-xs); color: var(--ink-soft); }
.frow__count { font-weight: 900; font-variant-numeric: tabular-nums; font-size: var(--t-xs); }
.frow.is-next { background: var(--sun); }
.frow.is-done { background: #d9f5e5; }
.frow:active { transform: translateY(2px); }
.thead { display: grid; grid-template-columns: auto 1fr; gap: var(--s4); align-items: center; padding: var(--s4); }
.thead__art { display: grid; place-items: center; background: var(--t); border: var(--stroke) solid var(--line); border-radius: var(--radius-lg); padding: var(--s3); }
.thead__text { display: grid; gap: 6px; min-width: 0; }
.thead__text h1 { font-size: var(--t-lg); font-weight: 900; line-height: 1.15; }
.thead__text p { color: var(--ink-soft); font-weight: 700; }
.thead__text small { font-size: var(--t-xs); color: var(--ink-soft); font-weight: 700; }
.thead__lv { justify-self: start; font-size: 12px; font-weight: 900; padding: 2px 10px; border: 2px solid var(--line); border-radius: 999px; }
.tlist { display: grid; gap: var(--s2); }
@media (max-width: 560px) {
  .strands { grid-template-columns: repeat(2, 1fr); }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .thead { grid-template-columns: 1fr; justify-items: start; }
}

/* ---------- đăng nhập (17/11) ---------- */
.login { display: grid; gap: var(--s3); }
.login h1 { font-size: var(--t-xl); font-weight: 900; text-align: center; }
.field { min-height: var(--tap); width: 100%; padding: 0 var(--s4); font: inherit; font-size: var(--t-md); font-weight: 700; color: var(--ink); background: var(--card); border: var(--stroke) solid var(--line); border-radius: var(--radius); }
.field:focus { outline: 4px solid var(--sky); outline-offset: 1px; }
.login__msg { min-height: 1.4em; text-align: center; font-weight: 800; color: var(--ink-soft); }
.login__msg.is-bad { color: var(--brick-deep); }
.login__ok { display: flex; align-items: center; justify-content: center; gap: var(--s2); font-weight: 900; font-size: var(--t-md); }
.hud__signin { text-decoration: underline; color: var(--sky-deep); font-weight: 800; }
a.hud__hi { color: var(--ink); text-decoration: none; }
