/* ============================================================
   CƯỠI HỔ VƯỢT LỬA – style.css
   Giao diện rạp xiếc ban đêm, thân thiện với trẻ nhỏ, tối ưu cảm ứng (iPad)
   ============================================================ */

:root {
  --font: "Baloo 2", "Arial Rounded MT Bold", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --orange: #ff6b35;
  --orange-dark: #d84f1d;
  --teal: #2ec4b6;
  --teal-dark: #1e9a8e;
  --yellow: #ffd166;
  --yellow-dark: #e0a800;
  --purple: #7b5ea7;
  --purple-dark: #5a3f85;
  --green: #06d6a0;
  --green-dark: #04a67c;
  --red: #ef476f;
  --red-dark: #c42b52;
  --blue: #118ab2;
  --blue-dark: #0c6a8a;
  --night: #1a0b3d;
  --ink: #2b2d42;
  --ink-soft: #5b5f7a;
  --paper: #ffffff;
  --paper-soft: #f4f6fc;
  --shadow: 0 12px 40px rgba(20, 5, 40, 0.5);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--night);
  font-family: var(--font);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
  touch-action: none;
}

#app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ---------- Màn hình (overlay) ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--sat) + 12px) calc(var(--sar) + 12px) calc(var(--sab) + 12px) calc(var(--sal) + 12px);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.25s ease;
  z-index: 5;
}
.screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.screen > * { pointer-events: auto; }
.screen.dim { background: rgba(15, 5, 35, 0.6); }

.panel {
  background: var(--paper);
  border-radius: 32px;
  padding: 26px 30px;
  max-width: 760px;
  width: min(100%, 760px);
  max-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  box-shadow: var(--shadow);
  text-align: center;
  position: relative;
}
.panel.wide { max-width: 900px; width: min(100%, 900px); }
.panel h1, .panel h2 {
  margin: 0 0 8px;
  font-weight: 800;
  line-height: 1.1;
}
.panel h2 { font-size: 32px; color: var(--ink); }
.panel p { margin: 6px 0; font-size: 19px; color: var(--ink-soft); font-weight: 600; }

/* ---------- Nút bấm ---------- */
.btn {
  font-family: var(--font);
  font-weight: 800;
  font-size: 24px;
  line-height: 1;
  border: none;
  border-radius: 999px;
  padding: 18px 34px;
  min-height: 62px;
  color: #fff;
  background: linear-gradient(180deg, var(--orange) 0%, #ff8b5a 100%);
  box-shadow: 0 7px 0 var(--orange-dark), 0 12px 24px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn:active, .btn.pressed {
  transform: translateY(5px);
  box-shadow: 0 2px 0 var(--orange-dark), 0 4px 10px rgba(0, 0, 0, 0.18);
}
.btn.big { font-size: 30px; padding: 20px 42px; min-height: 76px; }
.btn.teal { background: linear-gradient(180deg, var(--teal), #4fd8cb); box-shadow: 0 7px 0 var(--teal-dark), 0 12px 24px rgba(0,0,0,0.18); }
.btn.teal:active { box-shadow: 0 2px 0 var(--teal-dark), 0 4px 10px rgba(0,0,0,0.18); }
.btn.purple { background: linear-gradient(180deg, var(--purple), #9b7fc7); box-shadow: 0 7px 0 var(--purple-dark), 0 12px 24px rgba(0,0,0,0.18); }
.btn.purple:active { box-shadow: 0 2px 0 var(--purple-dark), 0 4px 10px rgba(0,0,0,0.18); }
.btn.green { background: linear-gradient(180deg, var(--green), #3ee8b8); box-shadow: 0 7px 0 var(--green-dark), 0 12px 24px rgba(0,0,0,0.18); }
.btn.green:active { box-shadow: 0 2px 0 var(--green-dark), 0 4px 10px rgba(0,0,0,0.18); }
.btn.blue { background: linear-gradient(180deg, var(--blue), #2aa8d4); box-shadow: 0 7px 0 var(--blue-dark), 0 12px 24px rgba(0,0,0,0.18); }
.btn.blue:active { box-shadow: 0 2px 0 var(--blue-dark), 0 4px 10px rgba(0,0,0,0.18); }
.btn.ghost {
  background: #f1f3fa;
  color: var(--ink);
  text-shadow: none;
  box-shadow: 0 6px 0 #cfd4e6, 0 8px 16px rgba(0,0,0,0.08);
}
.btn.ghost:active { box-shadow: 0 2px 0 #cfd4e6; }
.btn.small { font-size: 19px; padding: 12px 22px; min-height: 50px; }
.btn[disabled] { opacity: 0.45; cursor: default; }
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: 18px;
}
.linkish {
  font-family: var(--font); font-weight: 700; font-size: 15px; color: #98a0bd;
  background: none; border: none; cursor: pointer; text-decoration: underline; padding: 8px; touch-action: manipulation;
}

/* ---------- Menu chính ---------- */
#menu .panel {
  background: rgba(255, 255, 255, 0.95);
  padding: 22px 30px 26px;
}
.logo-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}
.logo-img {
  width: 150px;
  height: 150px;
  filter: drop-shadow(0 10px 14px rgba(0,0,0,0.25));
  animation: logo-bob 3s ease-in-out infinite;
}
@keyframes logo-bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-10px) rotate(3deg); }
}
.title {
  font-size: clamp(42px, 8vw, 72px);
  font-weight: 800;
  line-height: 0.95;
  margin: 0;
  background: linear-gradient(180deg, #ffb703 0%, #ff6b35 55%, #d62828 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,0.12));
  letter-spacing: -1px;
}
.title small {
  display: block;
  font-size: 0.34em;
  letter-spacing: 3px;
  color: var(--purple-dark);
  background: none;
  -webkit-text-fill-color: var(--purple-dark);
}
.subtitle { font-size: 21px; color: var(--ink-soft); margin: 10px 0 18px; font-weight: 700; }
.toggle-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.toggle {
  font-family: var(--font);
  font-weight: 800;
  font-size: 16px;
  border: 3px solid #dfe3ef;
  background: #f1f3fa;
  color: var(--ink-soft);
  padding: 8px 14px;
  min-height: 42px;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s;
}
.toggle:active { transform: scale(0.96); }
.toggle.on { background: #e3fff4; border-color: var(--green); color: #05603f; }
.toggle.off { text-decoration: line-through; opacity: 0.8; }
.toggle[disabled] { opacity: 0.5; cursor: default; text-decoration: none; }
.footer-note { margin-top: 14px; font-size: 15px; color: #98a0bd; font-weight: 700; }
.footer-note a { color: var(--blue); text-decoration: none; }

/* ---------- Chọn màn / hành trình ---------- */
.screen-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.screen-head h2 { flex: 1; text-align: center; margin: 0; }
.mode-desc { font-size: 18px; margin: 0 0 10px; }
.journey-stats {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px;
}
.journey-stats span {
  background: #fff4d6; color: #8a5a00; font-weight: 800; font-size: 16px;
  padding: 6px 14px; border-radius: 999px;
}
.journey-stats span.badge { background: linear-gradient(90deg, #ffb300, #ff6b35); color: #fff; }
.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  text-align: left;
}
.level-card {
  position: relative;
  background: linear-gradient(180deg, #ffffff, #f4f6fc);
  border: 3px solid #e3e7f2;
  border-radius: 24px;
  padding: 16px 16px 14px;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 6px 0 #dfe3ef;
  transition: transform 0.08s;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.level-card:active { transform: translateY(4px); box-shadow: 0 2px 0 #dfe3ef; }
.level-card .icon { font-size: 38px; line-height: 1; }
.level-card .name { font-size: 21px; font-weight: 800; margin-top: 6px; line-height: 1.15; }
.level-card .name .num { color: var(--orange-dark); }
.level-card .desc { font-size: 14px; color: var(--ink-soft); font-weight: 600; margin-top: 2px; }
.level-card .grade {
  position: absolute; top: 12px; right: 12px;
  font-size: 13px; font-weight: 800; color: #fff;
  background: var(--purple); border-radius: 999px; padding: 4px 10px;
}
.level-card .grade.g2 { background: var(--blue); }
.level-card .grade.g3 { background: var(--purple); }
.level-card .grade.gx { background: var(--red); }
.level-card .meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: 10px; font-size: 15px; font-weight: 800;
}
.level-card .best { color: var(--orange-dark); }
.level-card .stars { color: #ffbf1f; letter-spacing: 2px; font-size: 19px; }
.level-card .stars .off { color: #d5d9e6; }
.level-card .quiz-ok { position: absolute; left: 12px; top: 12px; font-size: 14px; font-weight: 800; color: var(--green-dark); background: #e3fff4; border-radius: 999px; padding: 3px 9px; }
.level-card.locked { cursor: default; filter: saturate(0.4); }
.level-card.locked .lock {
  position: absolute; inset: 0; background: rgba(240, 242, 250, 0.94);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-weight: 800; color: var(--ink-soft); font-size: 14px; text-align: center; padding: 10px;
}
.level-card.locked .lock .em { font-size: 32px; }
.level-card.locked .lock .lk-name { font-size: 18px; color: var(--ink); line-height: 1.15; }
.level-card.locked .lock .lk-how { font-size: 13px; line-height: 1.2; }
.level-card.current { border-color: var(--yellow-dark); box-shadow: 0 6px 0 var(--yellow-dark), 0 0 0 4px rgba(255, 209, 102, 0.35); }
.parent-row { margin: 12px 0 0; }

/* ---------- Bài học ---------- */
.lesson-panel { max-width: 820px; }
.slide {
  display: flex; align-items: center; justify-content: center; gap: 22px; flex-wrap: wrap;
  background: linear-gradient(180deg, #fff8e8, #fff1d0);
  border-radius: 26px; padding: 18px 22px; min-height: 250px;
}
.slide-visual { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.slide-visual .clock { width: min(220px, 48vw); height: min(220px, 48vw); filter: drop-shadow(0 8px 12px rgba(0,0,0,0.18)); }
.slide-text {
  flex: 1 1 260px; text-align: left; font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1.4;
}
.slide-text b { color: var(--orange-dark); }
.dots { display: flex; gap: 8px; justify-content: center; margin: 12px 0 4px; flex-wrap: wrap; }
.dots span { width: 12px; height: 12px; border-radius: 50%; background: #dfe3ef; transition: transform 0.2s, background 0.2s; }
.dots span.on { background: var(--orange); transform: scale(1.3); }
.dots span.done { background: var(--green); }
.dots span.bad { background: var(--red); }
.lesson-nav { margin-top: 10px; }

.digital {
  display: inline-block; background: #1d2b3a; color: #7CFC8B; font-weight: 800;
  font-size: 44px; letter-spacing: 3px; padding: 6px 22px; border-radius: 16px;
  border: 4px solid #4a5a6a; box-shadow: inset 0 0 12px rgba(0,0,0,0.6), 0 6px 14px rgba(0,0,0,0.2);
  font-variant-numeric: tabular-nums; font-family: "Courier New", Consolas, monospace;
}
.emoji-art { font-size: 56px; line-height: 1.1; padding: 6px 0; }

/* ---------- Ghi nhớ ---------- */
.notes-list { text-align: left; display: grid; gap: 10px; }
.note-group { background: var(--paper-soft); border-radius: 20px; padding: 10px 14px; }
.note-group h3 { margin: 2px 0 6px; font-size: 18px; color: var(--purple-dark); }
.note-group h3 .g { font-size: 13px; color: #fff; background: var(--blue); border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }
.note-line {
  background: #fff; border-radius: 14px; padding: 8px 12px; margin: 5px 0; font-size: 18px; font-weight: 700; color: var(--ink);
  cursor: pointer; touch-action: manipulation; box-shadow: 0 3px 0 #e3e7f2;
}
.note-line:active, .note-line.speaking { background: #fff4d6; transform: translateY(2px); box-shadow: 0 1px 0 #e3e7f2; }

/* ---------- HUD ---------- */
#hud {
  align-items: flex-start;
  justify-content: stretch;
  flex-direction: column;
  padding: calc(var(--sat) + 8px) calc(var(--sar) + 10px) 0 calc(var(--sal) + 10px);
  z-index: 3;
}
#hud > * { pointer-events: none; }
.hud-top {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: "left center right";
  align-items: start;
  gap: 10px;
}
.hud-left { grid-area: left; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hud-center { grid-area: center; }
.hud-right { grid-area: right; display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.score-box {
  background: rgba(255,255,255,0.94);
  border-radius: 18px;
  padding: 6px 16px 4px;
  min-width: 120px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  line-height: 1;
}
.score-box .label { display: block; font-size: 13px; letter-spacing: 2px; font-weight: 800; color: var(--ink-soft); }
.score-box .value { display: block; font-size: 34px; font-weight: 800; color: var(--orange-dark); transition: transform 0.1s; }
.score-box .value.bump { transform: scale(1.18); }
.stage-chip {
  background: var(--purple); color: #fff; font-weight: 800; font-size: 15px;
  padding: 5px 12px; border-radius: 999px; box-shadow: 0 3px 10px rgba(0,0,0,0.25);
}
.combo-chip {
  background: linear-gradient(90deg, #ff7a00, #ffb800); color: #fff; font-weight: 800; font-size: 16px;
  padding: 5px 12px; border-radius: 999px; box-shadow: 0 3px 10px rgba(0,0,0,0.25);
  transform-origin: left center;
  animation: chip-pop 0.3s ease;
}
@keyframes chip-pop { 0% { transform: scale(0.5); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }

.hud-center { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.question-card {
  background: #fff;
  border-radius: 24px;
  padding: 8px 18px;
  box-shadow: 0 8px 0 #dfe3ef, 0 14px 30px rgba(0,0,0,0.3);
  min-width: 260px;
  max-width: min(560px, 70vw);
  display: flex; align-items: center; justify-content: center; gap: 14px;
  transition: transform 0.15s ease, background 0.2s;
}
.question-card .q-visual { flex: 0 0 auto; display: flex; align-items: center; }
.question-card .q-visual .clock { width: 104px; height: 104px; }
.question-card .q-visual .digital { font-size: 30px; padding: 3px 14px; border-width: 3px; }
.question-card .q-visual .emoji-art { font-size: 44px; padding: 0; }
.question-card .q-text { font-size: clamp(19px, 2.6vw, 27px); font-weight: 800; color: var(--ink); line-height: 1.2; text-align: center; }
.question-card .q-text b { color: var(--orange-dark); }
.question-card.pop { animation: card-pop 0.35s ease; }
@keyframes card-pop { 0% { transform: scale(0.7); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
.question-card.shake { animation: card-shake 0.4s ease; background: #ffe3e8; }
@keyframes card-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); } 40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); } 80% { transform: translateX(5px); }
}
.question-card.ok { background: #e3fff4; }
.timer {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.92);
  border-radius: 999px;
  padding: 4px 12px 4px 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  transition: opacity 0.2s;
}
.timer.idle { opacity: 0.45; }
.timer .bar { width: 150px; height: 12px; background: #e6e9f3; border-radius: 999px; overflow: hidden; }
.timer .fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--teal), var(--green)); border-radius: 999px; transition: width 0.2s linear; }
.timer .fill.warn { background: linear-gradient(90deg, #ff8a00, #ffcf00); }
.timer .fill.danger { background: linear-gradient(90deg, #ff2d55, #ff7a90); }
.timer .time { font-weight: 800; font-size: 19px; color: var(--ink); min-width: 30px; text-align: right; font-variant-numeric: tabular-nums; }
.timer.danger .time { color: var(--red); animation: blink 0.5s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

.hint {
  background: rgba(43,45,66,0.92); color: #fff; font-weight: 800; font-size: 20px;
  padding: 6px 18px; border-radius: 999px; box-shadow: 0 6px 16px rgba(0,0,0,0.3);
  max-width: 92vw; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  animation: chip-pop 0.3s ease;
}
.hint.bad { background: var(--red); }
.hint.ok { background: var(--green); color: #063b2c; }
.hint.info { background: var(--blue); }
.hearts { display: flex; gap: 2px; background: rgba(255,255,255,0.92); border-radius: 999px; padding: 6px 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.25); }
.hearts span { font-size: 26px; line-height: 1; transition: transform 0.2s, filter 0.2s; display: inline-block; }
.hearts span.lost { filter: grayscale(1) opacity(0.35); transform: scale(0.8); }
.hearts.hit { animation: hearts-hit 0.45s ease; }
@keyframes hearts-hit { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-4px); } }

#btn-pause {
  pointer-events: auto;
  width: 56px; height: 56px; min-height: 56px; padding: 0;
  font-size: 24px; border-radius: 50%;
  background: rgba(255,255,255,0.94); color: var(--ink);
  box-shadow: 0 5px 0 #cfd4e6, 0 8px 16px rgba(0,0,0,0.2);
  text-shadow: none;
}
#btn-pause:active { box-shadow: 0 1px 0 #cfd4e6; }
.tap-tip {
  align-self: center; margin-top: auto; margin-bottom: calc(var(--sab) + 14px);
  background: rgba(255,255,255,0.94); color: var(--ink); font-weight: 800; font-size: 18px;
  padding: 10px 18px; border-radius: 999px; box-shadow: 0 6px 16px rgba(0,0,0,0.3);
  animation: tip-bounce 1.2s ease-in-out infinite;
}
@keyframes tip-bounce { 50% { transform: translateY(-6px); } }

/* ---------- Đếm ngược ---------- */
#countdown { pointer-events: none; }
#countdown .count {
  font-size: clamp(120px, 28vw, 260px);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 8px 0 rgba(0,0,0,0.25), 0 0 40px rgba(255,180,80,0.7);
  -webkit-text-stroke: 4px var(--orange-dark);
  line-height: 1;
  animation: count-pop 1s ease both;
}
#countdown .count.go { color: var(--yellow); -webkit-text-stroke: 4px var(--red-dark); font-size: clamp(80px, 18vw, 170px); }
@keyframes count-pop {
  0% { transform: scale(0.2); opacity: 0; }
  25% { transform: scale(1.2); opacity: 1; }
  70% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* ---------- Kết quả ---------- */
.result-title { font-size: 38px; margin-bottom: 2px; }
.result-title.finish { color: var(--green-dark); }
.result-title.nolife { color: var(--red); }
.result-score {
  font-size: clamp(52px, 11vw, 88px);
  font-weight: 800;
  line-height: 1;
  color: var(--orange-dark);
  margin: 4px 0 0;
}
.result-score-label { font-size: 16px; letter-spacing: 3px; color: var(--ink-soft); font-weight: 800; }
.result-stars { font-size: 50px; line-height: 1; margin: 6px 0; letter-spacing: 4px; color: #ffbf1f; }
.result-stars .off { color: #dfe3ef; }
.result-stars .on { display: inline-block; animation: star-in 0.5s ease both; }
.result-stars .on:nth-child(2) { animation-delay: 0.2s; }
.result-stars .on:nth-child(3) { animation-delay: 0.4s; }
@keyframes star-in { 0% { transform: scale(0) rotate(-90deg); } 70% { transform: scale(1.3) rotate(10deg); } 100% { transform: scale(1) rotate(0); } }
.record-badge {
  display: inline-block;
  background: linear-gradient(90deg, #ffb300, #ff6b35);
  color: #fff; font-weight: 800; font-size: 20px;
  padding: 6px 18px; border-radius: 999px; margin: 6px 0 4px;
  animation: badge-pulse 1s ease-in-out infinite;
  box-shadow: 0 6px 16px rgba(255, 120, 0, 0.35);
}
@keyframes badge-pulse { 50% { transform: scale(1.06); } }
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 12px 0 8px;
}
.stat { background: #f4f6fc; border-radius: 18px; padding: 10px 6px 8px; }
.stat .v { font-size: 30px; font-weight: 800; line-height: 1; }
.stat .k { font-size: 14px; font-weight: 800; color: var(--ink-soft); margin-top: 4px; }
.stat.ok .v { color: var(--green-dark); }
.stat.bad .v { color: var(--red); }
.stat.combo .v { color: var(--orange-dark); }
.stat.acc .v { color: var(--blue); }
.review { background: #fff4d6; border-radius: 18px; padding: 8px 14px 10px; margin: 8px auto 4px; max-width: 600px; }
.review h3 { margin: 0 0 6px; font-size: 17px; color: #8a5a00; }
.review-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.review-chips > span {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border-radius: 999px; padding: 4px 12px 4px 6px; font-size: 16px; font-weight: 800; color: var(--ink);
  box-shadow: 0 2px 0 #e8d5a8; cursor: pointer; touch-action: manipulation;
}
.review-chips .clock { width: 36px; height: 36px; flex-shrink: 0; }
.review-chips .dg { font-style: normal; background: #1d2b3a; color: #7CFC8B; border-radius: 8px; padding: 2px 8px; font-family: "Courier New", Consolas, monospace; }
.review-chips span b { color: var(--orange-dark); }
.result-msg { font-size: 18px; margin: 8px 0 0; }

/* ---------- Hỏi đáp ---------- */
.quiz-panel { max-width: 820px; }
.quiz-q {
  display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap;
  background: linear-gradient(180deg, #f3f0ff, #e9e2ff);
  border-radius: 24px; padding: 16px 20px; margin-top: 6px;
}
.quiz-visual .clock { width: min(170px, 40vw); height: min(170px, 40vw); filter: drop-shadow(0 6px 10px rgba(0,0,0,0.18)); }
.quiz-visual .digital { font-size: 38px; }
.quiz-text { flex: 1 1 240px; font-size: 24px; font-weight: 800; color: var(--ink); line-height: 1.3; text-align: left; }
.quiz-text b { color: var(--purple-dark); }
.quiz-answers { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 14px; }
.quiz-answers button {
  font-family: var(--font); font-weight: 800; font-size: 22px; color: var(--ink);
  background: #fff; border: 3px solid #e3e7f2; border-radius: 20px; padding: 14px 12px; min-height: 68px;
  cursor: pointer; touch-action: manipulation; box-shadow: 0 6px 0 #dfe3ef;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.08s;
}
.quiz-answers button:active { transform: translateY(4px); box-shadow: 0 2px 0 #dfe3ef; }
.quiz-answers button.ok { background: #e3fff4; border-color: var(--green); box-shadow: 0 6px 0 var(--green-dark); }
.quiz-answers button.bad { background: #ffe3e8; border-color: var(--red); box-shadow: 0 6px 0 var(--red-dark); animation: card-shake 0.4s ease; }
.quiz-answers button.dim { opacity: 0.45; }
.quiz-answers button[disabled] { cursor: default; }
.quiz-answers .clock.mini { width: 88px; height: 88px; }
.quiz-feedback {
  margin-top: 12px; border-radius: 18px; padding: 10px 16px; font-size: 19px; font-weight: 700; text-align: left; line-height: 1.35;
}
.quiz-feedback.ok { background: #e3fff4; color: #05603f; }
.quiz-feedback.bad { background: #fff1d6; color: #7a4a00; }
.unlock-art { font-size: 72px; line-height: 1; margin: 10px 0 4px; animation: badge-pulse 1.2s ease-in-out infinite; }
.unlock-title { font-size: 32px; margin: 4px 0; color: var(--green-dark); }
.unlock-desc { font-size: 20px; }

/* ---------- Hướng dẫn ---------- */
.howto-list { text-align: left; display: grid; gap: 10px; margin: 10px 0 6px; }
.howto-item {
  display: flex; gap: 14px; align-items: center;
  background: #f6f7fb; border-radius: 20px; padding: 10px 16px;
}
.howto-item .em { font-size: 36px; line-height: 1; width: 50px; text-align: center; flex-shrink: 0; }
.howto-item .tx { font-size: 18px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.howto-item .tx b { color: var(--orange-dark); }
.tip {
  margin-top: 12px; font-size: 16px; color: var(--ink-soft); font-weight: 700;
  background: #fff4d6; border-radius: 16px; padding: 10px 14px;
}

/* ---------- Toast ---------- */
#toast {
  position: absolute; left: 50%; bottom: calc(var(--sab) + 22px);
  transform: translateX(-50%);
  background: rgba(43,45,66,0.92); color: #fff; font-weight: 800; font-size: 18px;
  padding: 12px 22px; border-radius: 999px; pointer-events: none;
  opacity: 0; transition: opacity 0.3s; z-index: 20; max-width: 90%; text-align: center;
}
#toast.show { opacity: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  .panel { padding: 18px 14px; border-radius: 24px; }
  .btn { font-size: 20px; padding: 14px 24px; }
  .btn.big { font-size: 24px; padding: 16px 30px; min-height: 64px; }
  .logo-img { width: 110px; height: 110px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .score-box { min-width: 90px; padding: 5px 12px 3px; }
  .score-box .value { font-size: 26px; }
  .hearts span { font-size: 21px; }
  .timer .bar { width: 90px; }
  .question-card { padding: 6px 12px; min-width: 200px; max-width: 94vw; gap: 10px; }
  .question-card .q-visual .clock { width: 78px; height: 78px; }
  .question-card .q-visual .digital { font-size: 24px; }
  .question-card .q-text { font-size: 18px; }
  .hud-top {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "left right" "center center";
    gap: 6px 10px;
  }
  .hud-left { flex-direction: row; align-items: center; }
  .hud-center { justify-self: center; }
  .hint { font-size: 16px; padding: 5px 14px; }
  .screen-head h2 { font-size: 21px; white-space: nowrap; }
  .screen-head .btn { font-size: 16px; padding: 10px 14px; min-height: 44px; }
  .mode-desc { font-size: 16px; }
  .level-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .level-card { min-height: 130px; padding: 12px; }
  .level-card .name { font-size: 18px; }
  .slide { padding: 12px 14px; min-height: 200px; gap: 12px; }
  .slide-text { font-size: 19px; }
  .quiz-text { font-size: 20px; }
  .quiz-answers button { font-size: 19px; min-height: 58px; }
  .digital { font-size: 34px; }
  .tap-tip { font-size: 15px; padding: 8px 14px; }
}
@media (max-height: 900px) {
  #gameover .panel { padding: 16px 26px 18px; }
  .result-title { font-size: 30px; }
  .result-score { font-size: clamp(44px, 9vw, 70px); }
  .result-stars { font-size: 40px; margin: 2px 0; }
  .stats { margin: 8px 0 4px; gap: 8px; }
  .stat { padding: 6px 4px 6px; }
  .stat .v { font-size: 24px; }
  .stat .k { font-size: 13px; }
  #gameover .btn-row { margin-top: 10px; }
  #gameover .btn.big { font-size: 22px; padding: 14px 28px; min-height: 60px; }
}
@media (max-height: 560px) {
  .logo-img { width: 90px; height: 90px; }
  .subtitle { margin: 4px 0 10px; }
  .panel { padding: 14px 20px; }
  .howto-item { padding: 8px 12px; }
  .slide { min-height: 160px; }
  .slide-visual .clock { width: 150px; height: 150px; }
  .quiz-visual .clock { width: 120px; height: 120px; }
  .question-card .q-visual .clock { width: 72px; height: 72px; }
}
