:root {
  --bg: #fdf3e3;
  --wall: #fff8ec;
  --wood: #c98b52;
  --wood-dark: #8a5a35;
  --ink: #3a2616;
  --muted: #7a6450;
  --nghin: #f59e42;
  --nghin-soft: #ffe7cc;
  --donvi: #3fae6a;
  --donvi-soft: #d8f3e2;
  --card: #fffdf8;
  --card-edge: #5b3b22;
  --accent: #d63a3a;
  --hint: #7a5bb0;
  --hint-soft: #f1eaff;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }

[hidden] { display: none !important; }

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 16px 24px;
}

/* ---------- Phiếu, nút gợi ý ---------- */

.top {
  display: flex;
  gap: 10px;
  align-items: stretch;
  justify-content: space-between;
}

.ticket {
  flex: 1;
  background: #fff;
  border: 2px dashed var(--wood);
  border-radius: var(--radius);
  padding: 8px 12px;
  min-height: 64px;
  transition: box-shadow .2s, border-color .2s;
}
.ticket-wait { color: var(--muted); display: flex; align-items: center; }
.ticket-title { font-weight: 700; font-size: 14px; color: var(--muted); }
.ticket-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.ticket-list li {
  background: #fff4e2;
  border-radius: 8px;
  padding: 2px 8px;
  font-weight: 700;
  font-size: 17px;
}
.ticket.glow { border-color: var(--hint); box-shadow: 0 0 0 4px var(--hint-soft); }

.top-right { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.chip {
  font-size: 13px;
  background: #fff;
  border-radius: 999px;
  padding: 3px 10px;
  border: 1px solid #e6d4bd;
  white-space: nowrap;
}
.chip.done { background: var(--donvi-soft); border-color: var(--donvi); font-weight: 700; }

.hint-btn {
  border: 0;
  border-radius: 999px;
  background: var(--hint);
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
  min-height: 44px;
  white-space: nowrap;
}
.hint-btn.invite { animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { box-shadow: 0 0 0 6px rgba(122, 91, 176, .35); } }

/* ---------- Lời thoại và gợi ý ---------- */

.say {
  margin-top: 10px;
  background: #fff;
  border-radius: var(--radius);
  padding: 10px 12px;
  min-height: 48px;
  border: 1px solid #ecdcc6;
  line-height: 1.4;
}
.say-who { font-weight: 700; margin-right: 4px; }
.say-who:not(:empty)::after { content: ":"; }
.say.flash { animation: sayFlash .5s; }
@keyframes sayFlash { from { background: #fff1c9; } to { background: #fff; } }

.hint {
  margin-top: 8px;
  background: var(--hint-soft);
  border: 2px solid var(--hint);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.hint-head { display: flex; justify-content: space-between; font-weight: 700; color: var(--hint); font-size: 14px; }
.hint-text { margin: 4px 0 6px; line-height: 1.4; }
.hint-close {
  border: 0; background: var(--hint); color: #fff; border-radius: 10px; padding: 6px 12px; min-height: 36px;
}

/* ---------- Cửa hàng ---------- */

.scene {
  position: relative;
  margin-top: 10px;
  background: linear-gradient(var(--wall) 0 72%, #e9c79a 72% 100%);
  border-radius: 18px;
  border: 3px solid var(--wood);
  padding: 14px 10px 0;
  overflow: hidden;
}

.lanterns { position: relative; height: 0; opacity: 0; transition: height .6s, opacity .6s; }
.lanterns.on { height: 62px; opacity: 1; }
.lantern-string { position: absolute; left: 0; top: 0; width: 100%; height: 40px; }
.lantern-row { display: flex; justify-content: space-around; padding: 0 8%; }
.lantern {
  width: 22px; height: 30px; margin-top: 10px; border-radius: 45%;
  background: radial-gradient(circle at 40% 35%, #ff8a6b, #d63a3a 70%);
  box-shadow: 0 0 12px rgba(255, 140, 80, .7);
  position: relative;
}
.lantern:nth-child(even) { margin-top: 18px; background: radial-gradient(circle at 40% 35%, #ffd36b, #f08a1c 70%); }
.lantern::before { content: ""; position: absolute; left: 6px; right: 6px; top: -4px; height: 5px; background: #7a4b2a; border-radius: 2px; }
.lantern::after { content: ""; position: absolute; left: 10px; bottom: -8px; width: 2px; height: 8px; background: #d6a23a; }
.lanterns.on .lantern { animation: sway 2.4s ease-in-out infinite; transform-origin: top center; }
@keyframes sway { 50% { transform: rotate(6deg); } }

.board {
  text-align: center;
  background: #2f4a3a;
  color: #f6f1e4;
  border-radius: 12px;
  padding: 6px 8px 8px;
  border: 4px solid var(--wood-dark);
}
.board-label { font-size: 12px; letter-spacing: 2px; opacity: .8; }
.board-main { font-size: 30px; font-weight: 800; letter-spacing: 1px; min-height: 38px; font-variant-numeric: tabular-nums; }
.board-sub { font-size: 14px; min-height: 18px; opacity: .9; }

.shelf {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}
.band {
  flex: 1;
  border-radius: 12px;
  padding: 4px 4px 6px;
}
.band-nghin { background: var(--nghin-soft); border: 2px solid var(--nghin); }
.band-donvi { background: var(--donvi-soft); border: 2px solid var(--donvi); }
.band-label { text-align: center; font-weight: 800; font-size: 13px; letter-spacing: 1px; }
.band-nghin .band-label { color: #a65a0d; }
.band-donvi .band-label { color: #1f7a45; }
.cells { display: flex; gap: 4px; margin-top: 2px; }

.slot {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.slot-name {
  font-size: 11px;
  line-height: 1.1;
  min-height: 25px;
  text-align: center;
  color: var(--ink);
  display: flex;
  align-items: flex-end;
}
.slot-box {
  position: relative;
  width: 100%;
  height: 58px;
  border-radius: 10px;
  border: 2.5px dashed rgba(91, 59, 34, .45);
  background: rgba(255, 255, 255, .45);
  display: flex;
  align-items: center;
  justify-content: center;
}
.slot.filled .slot-box { border: 0; background: transparent; }
.slot .card-face { display: none; }
.slot.filled .card-face { display: flex; }

.card-face {
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 2.5px solid var(--card-edge);
  border-radius: 10px;
  font-size: 30px;
  font-weight: 800;
  box-shadow: 0 3px 0 var(--card-edge);
}

.slot .ghost {
  position: absolute;
  inset: 4px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: rgba(122, 91, 176, .45);
  border-radius: 8px;
  outline: 2px dashed rgba(122, 91, 176, .6);
  pointer-events: none;
}
.slot.has-ghost .ghost { display: flex; }
.slot.filled.has-ghost .ghost {
  inset: auto -4px -8px auto;
  width: 24px; height: 24px; font-size: 15px;
  background: var(--hint-soft); color: var(--hint); outline: 2px solid var(--hint); border-radius: 50%;
}
.slot.target .slot-box { box-shadow: 0 0 0 4px var(--hint); border-radius: 10px; }
.slot.shake .slot-box { animation: shake .45s; border-color: var(--accent); }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.slot.flash .card-face { animation: flash .9s 2; }
@keyframes flash { 50% { background: #fff27a; box-shadow: 0 0 16px #ffd23f; } }

.bin {
  margin-top: 12px;
  background: var(--wood);
  border-radius: 12px;
  padding: 4px 6px 8px;
}
.bin-label { text-align: center; color: #fff8ec; font-weight: 800; font-size: 12px; letter-spacing: 2px; }
.bin-cells { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; margin-top: 3px; }
.bin-cell {
  min-height: 46px;
  border-radius: 10px;
  border: 2px solid var(--card-edge);
  background: var(--card);
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 3px 0 var(--card-edge);
  padding: 0;
}
.bin-cell.holding { background: #fff27a; }
.bin-cell:active, .slot:active .slot-box, .bell:active { transform: translateY(2px); }

.floor {
  position: relative;
  height: 122px;
  margin-top: 6px;
}

.hero {
  position: absolute;
  bottom: 6px;
  left: 6px;
  width: 72px;
  height: 72px;
  pointer-events: none;
  transition: left .4s linear;
  z-index: 3;
}
.hero-svg { width: 100%; height: 100%; display: block; }
.hero.face-left .hero-svg { transform: scaleX(-1); }
.hero.walking .hero-svg { animation: bob .28s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.hero.face-left.walking .hero-svg { animation: bobLeft .28s ease-in-out infinite; }
@keyframes bobLeft { 0%, 100% { transform: scaleX(-1); } 50% { transform: scaleX(-1) translateY(-4px); } }
.held {
  position: absolute;
  left: 50%;
  top: -34px;
  transform: translateX(-50%);
  width: 36px; height: 40px;
  border-radius: 8px;
  background: #fff27a;
  border: 2.5px solid var(--card-edge);
  font-size: 24px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 0 var(--card-edge);
}

.counter-area {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 128px;
  height: 120px;
}
.customer {
  position: absolute;
  right: 18px;
  bottom: 40px;
  width: 70px;
  height: 84px;
  border: 0;
  background: transparent;
  padding: 0;
  z-index: 1;
  transition: transform .8s, opacity .8s;
}
.customer.away { transform: translateX(140px); opacity: 0; }
.customer.wave .rabbit-svg { animation: wave .5s ease-in-out 3; }
@keyframes wave { 50% { transform: rotate(-8deg); } }
.rabbit-svg { width: 100%; height: 100%; }
.customer-bubble {
  position: absolute;
  left: -18px;
  top: -6px;
  background: #fff;
  border: 2px solid var(--wood);
  border-radius: 12px;
  padding: 2px 6px;
  font-size: 18px;
  animation: pop 1.2s ease-in-out infinite;
}
@keyframes pop { 50% { transform: translateY(-4px); } }

.counter {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 128px;
  height: 50px;
  background: var(--wood-dark);
  border-radius: 10px 10px 0 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.counter-top { position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; font-size: 10px; letter-spacing: 2px; color: #f3d9b5; }
.bell {
  border: 0;
  border-radius: 12px;
  background: #ffd23f;
  font-weight: 800;
  padding: 6px 12px;
  min-height: 40px;
  margin-bottom: 8px;
  box-shadow: 0 3px 0 #b8860b;
}

.scene.checking .bell { filter: grayscale(.6); }

.owl {
  position: absolute;
  width: 54px; height: 54px;
  z-index: 5;
  pointer-events: none;
  animation: owlIn .5s ease-out;
}
@keyframes owlIn { from { transform: translateY(-40px); opacity: 0; } }

/* ---------- Kết thúc lượt ---------- */

.end {
  position: fixed;
  inset: 0;
  background: rgba(58, 38, 22, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10;
}
.end-card {
  background: #fff;
  border-radius: 18px;
  padding: 18px 18px 16px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  border: 3px solid var(--wood);
}
.end-card h2 { margin: 0 0 6px; }
.end-lead { margin: 0 0 12px; line-height: 1.4; }
.parent { text-align: left; background: #fbf6ee; border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.parent summary { font-weight: 700; cursor: pointer; }
.parent dl { margin: 8px 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; }
.parent dt { color: var(--muted); }
.parent dd { margin: 0; font-weight: 700; }
.parent-note { color: var(--muted); margin: 6px 0 0; }
.replay {
  margin-top: 14px;
  border: 0; border-radius: 999px; background: var(--donvi); color: #fff;
  font-weight: 800; padding: 12px 28px; min-height: 48px; font-size: 18px;
}

/* ---------- Màn hình hẹp ---------- */

/* ---------- Âm thanh: thanh nhỏ dưới cảnh chơi, không che vùng chơi ---------- */

.sound-bar {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.sound-toggle {
  border: 1px solid #e6d4bd;
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 40px;
  font-size: 14px;
  white-space: nowrap;
}
.sound-toggle[aria-pressed="false"] { color: var(--muted); background: #f4ece0; }
.sound-vol { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 120px; font-size: 14px; }
.sound-vol input { flex: 1; min-width: 0; accent-color: var(--wood-dark); }

@media (max-width: 520px) {
  .app { padding: 8px 10px 20px; }
  .scene { padding: 10px 6px 0; }
  .shelf { gap: 4px; }
  .band { padding: 3px 3px 5px; }
  .cells { gap: 3px; }
  .slot-name { font-size: 10px; min-height: 24px; }
  .slot-box { height: 52px; }
  .card-face { font-size: 26px; }
  .bin-cells { grid-template-columns: repeat(5, 1fr); }
  .board-main { font-size: 26px; }
  .ticket-list li { font-size: 16px; }
}

/* ---------- M3.1: ba ca, nhóm K, khay, tem, đồ trang trí ---------- */
.tip {
  margin-top: 6px; padding: 6px 10px; border-radius: 10px;
  background: var(--hint-soft); color: var(--hint); font-size: 14px; font-weight: 600;
}
.decor { display: flex; flex-wrap: wrap; gap: 4px 6px; justify-content: center; margin-bottom: 6px; }
.deco {
  font-size: 12px; background: #fff; border: 2px solid var(--wood); border-radius: 999px;
  padding: 2px 8px; white-space: nowrap; animation: pop 1.2s ease-in-out 1;
}
.deco b { font-size: 15px; margin-right: 2px; }
.scene.lights-on { background: #fffbea; box-shadow: inset 0 0 0 3px #ffe58a; }
.scene.fan .deco-fan b { display: inline-block; animation: spin 1.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.deco-sign { border-color: var(--accent); color: var(--accent); font-weight: 800; }
.scene.closed::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: repeating-linear-gradient(90deg, rgba(214, 58, 58, .28) 0 14px, rgba(214, 58, 58, .18) 14px 28px);
}

/* Nhóm K: kệ khóa, nhãn hàng phủ bụi (D5), thẻ chiếu đèn */
.shelf.locked .slot.filled .card-face { background: #f7efe2; }
.held.held-stamp { font-size: 10px; line-height: 1.1; width: 64px; height: auto; min-height: 30px; padding: 2px; color: var(--accent); border-color: var(--accent); }
.dusty .slot-name { color: transparent; position: relative; }
.dusty .slot-name::after {
  content: "· · ·"; position: absolute; left: 0; right: 0; bottom: 0; text-align: center;
  color: #a08c78; letter-spacing: 1px;
}
.shelf.locked .slot.lit .card-face { background: #fff27a; box-shadow: 0 0 0 3px #ffd23f, 0 0 16px #ffd23f; }
.slot.ring .slot-box { box-shadow: 0 0 0 4px var(--hint), 0 0 14px var(--hint); border-radius: 10px; }
.stamp-tag {
  position: absolute; left: -2px; right: -2px; bottom: -10px; display: none;
  font-size: 10px; line-height: 1.1; font-weight: 800; padding: 2px 1px; border-radius: 6px;
  background: #fff; border: 2px solid var(--accent); color: var(--accent); text-align: center; z-index: 1;
}
.stamp-tag.on { display: block; }
.stamp-tag.ghosted { border-style: dashed; border-color: var(--hint); color: var(--hint); opacity: .75; }
.class-spot {
  display: block; margin: 2px auto 0; min-height: 30px; min-width: 120px; padding: 2px 10px;
  border-radius: 8px; border: 2px dashed var(--accent); background: rgba(255, 255, 255, .7);
  font-size: 12px; font-weight: 800; color: var(--accent);
}
.class-spot.on { border-style: solid; background: #fff; }
.class-spot.ghosted { border-color: var(--hint); color: var(--hint); }
.class-spot.target { box-shadow: 0 0 0 4px var(--hint); }

/* Khay giá trị (K3) */
.tray { margin-top: 10px; background: #f6e7d2; border: 2px solid var(--wood); border-radius: 12px; padding: 4px 6px 6px; }
.tray-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tray-label { font-size: 12px; font-weight: 800; letter-spacing: 2px; color: var(--wood-dark); }
.tray-main { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tray-sub { font-size: 12px; color: var(--muted); min-height: 15px; text-align: right; }
.tray-bands { display: flex; gap: 6px; }
.tray-band { flex: 1; border-radius: 10px; padding: 2px 4px 4px; }
.tray .slot-box { height: 44px; }
.tray .card-face { font-size: 24px; }

/* Hộp tem (K1) */
.stamp-cells { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 3px; }
.stamp {
  min-height: 40px; border-radius: 8px; border: 2px solid var(--accent); background: #fff;
  color: var(--accent); font-weight: 800; font-size: 12px; line-height: 1.15; padding: 2px;
}
.stamp.lop { border-color: var(--wood-dark); color: var(--wood-dark); }
.stamp.holding { background: #fff27a; }

/* Mũi tên hướng dẫn (H0) */
.arrow {
  position: absolute; z-index: 4; font-size: 26px; color: var(--accent); pointer-events: none;
  animation: bounceDown .8s ease-in-out infinite; text-shadow: 0 1px 0 #fff;
}
@keyframes bounceDown { 50% { transform: translateY(6px); } }

.customer-emoji { position: absolute; inset: 8px 0 0; font-size: 52px; line-height: 76px; text-align: center; }
.customer.wave .customer-emoji { animation: wave .5s ease-in-out 3; }

/* Trang đầu, kết ca */
.ca-list { display: flex; flex-direction: column; gap: 8px; }
.ca-btn {
  border: 3px solid var(--wood); border-radius: 14px; background: var(--wall); padding: 10px 12px; min-height: 56px;
  text-align: left; font-size: 16px; color: var(--ink);
}
.ca-btn b { display: block; font-size: 18px; }
.ca-btn.done { border-color: var(--donvi); background: var(--donvi-soft); }
.ca-btn.suggest { box-shadow: 0 0 0 4px var(--nghin-soft); }
.ca-new { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ca-new li { background: var(--nghin-soft); border-radius: 999px; padding: 3px 10px; font-size: 14px; }
.table-wrap { max-width: 100%; overflow-x: auto; }
.ca-table { border-collapse: collapse; width: 100%; min-width: 540px; margin: 8px 0; font-size: 12px; }
.ca-table th, .ca-table td { border: 1px solid #e6d8c4; padding: 3px 4px; vertical-align: top; overflow-wrap: normal; }
.ca-table th { background: #f4ece0; text-align: left; }

@media (max-width: 520px) {
  .stamp { font-size: 11px; }
  .tray .slot-box { height: 40px; }
  .tray-main { font-size: 18px; }
  .customer-emoji { font-size: 46px; }
}

/* ---------- M3.1.1: Cách chơi, bước tiếp theo, popup chúc mừng, trang đầu ---------- */
/* Nhím Su đứng sau quầy khi đi tới ngăn thẻ sát mép phải: quầy và chuông Giao luôn nằm trên, không bị che */
.hero { z-index: 1; }
.top-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.guide-btn {
  border: 2px solid var(--hint); border-radius: 999px; background: #fff; color: var(--hint);
  padding: 8px 12px; font-weight: 700; min-height: 44px; white-space: nowrap;
}

/* Dòng "Bước tiếp theo": luôn có trong lượt chơi, một việc chính và một dòng phụ nhỏ */
.tip.step {
  display: flex; flex-direction: column; gap: 2px;
  background: #fff4d6; color: var(--ink); border: 2px solid #f0b54a; font-weight: 400; font-size: 15px; line-height: 1.35;
}
.step-head { font-size: 12px; font-weight: 800; color: #a65a0d; letter-spacing: .5px; }
.step-text { font-weight: 700; }
.step-phu { font-size: 13px; color: var(--muted); }

/* Chỗ có thể thao tác tiếp: viền cam nhấp nháy (không bao giờ chỉ riêng ô/thẻ/tem đúng) */
@keyframes cuePulse { 50% { box-shadow: 0 0 0 5px rgba(240, 138, 28, .25); } }
.bin.cue, .tray.cue, .shelf.cue {
  box-shadow: 0 0 0 3px #f08a1c; border-radius: 12px; animation: cuePulse 1.2s ease-in-out infinite;
}
.shelf.cue { border-radius: 14px; }
.bell.cue { box-shadow: 0 3px 0 #b8860b, 0 0 0 4px #f08a1c; animation: bellPulse 1s ease-in-out infinite; }
@keyframes bellPulse { 50% { box-shadow: 0 3px 0 #b8860b, 0 0 0 8px rgba(240, 138, 28, .45); } }
.customer.cue { border-radius: 16px; box-shadow: 0 0 0 3px #f08a1c; animation: cuePulse 1.2s ease-in-out infinite; }
.slot.cue .slot-box { box-shadow: 0 0 0 4px #f08a1c; border-radius: 10px; animation: cuePulse 1.2s ease-in-out infinite; }
.class-spot.cue { box-shadow: 0 0 0 4px #f08a1c; animation: cuePulse 1.2s ease-in-out infinite; }

/* Thẻ Cách chơi và popup: nội dung dài thì cuộn trong thẻ, nút luôn bấm được */
.guide-card, .cheer-card { max-height: calc(100vh - 32px); overflow-y: auto; }
.guide-card { text-align: left; }
.guide-card h2 { text-align: center; font-size: 20px; }
.guide-list { margin: 6px 0 0; }
.guide-list dt { font-weight: 800; color: #a65a0d; margin-top: 8px; font-size: 14px; }
.guide-list dd { margin: 2px 0 0; line-height: 1.4; }
.guide-steps { margin: 0; padding-left: 20px; }
.guide-steps li { margin: 2px 0; line-height: 1.35; }
.guide-card .replay { display: block; margin: 14px auto 0; }

.cheer-card { border-color: var(--donvi); animation: cheerIn .35s ease-out; }
@keyframes cheerIn { from { transform: scale(.85); opacity: 0; } }
.cheer-burst { font-size: 44px; line-height: 1; animation: pop 1s ease-in-out 2; }
.cheer-card h2 { color: #1f7a45; font-size: 22px; }
.cheer-why { background: var(--donvi-soft); border-radius: 12px; padding: 8px 10px; margin: 0 0 8px; line-height: 1.4; text-align: left; }
.cheer-reward { margin: 0; font-weight: 700; color: #a65a0d; }
.cheer-card .replay { margin-top: 12px; }
/* M3.1.3 sửa 1: nút Hiệu ứng trong popup, nhỏ hơn nút đi tiếp, vùng chạm ≥ 44 px */
/* (không dùng lớp .sound-toggle để các kiểm tra thanh âm thanh cũ không đếm nút ẩn này) */
.cheer-card .cheer-fx {
  display: block; margin: 12px auto 0; min-height: 44px; min-width: 44px; padding: 8px 16px;
  border: 1px solid #e6d4bd; background: #fff; border-radius: 999px; font-size: 15px; white-space: nowrap;
}
.cheer-card .cheer-fx[aria-pressed="false"] { color: var(--muted); background: #f4ece0; }
.cheer-panel.big .cheer-card { border-color: var(--nghin); box-shadow: 0 0 0 6px var(--nghin-soft), 0 0 40px #ffd23f; }
.cheer-panel.big .cheer-burst::after { content: " 🎊🏆🎊"; }
.cheer-panel.big h2 { color: #a65a0d; font-size: 24px; }

/* Trang đầu: minh họa ba bước */
.demo { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.demo li {
  background: var(--wall); border: 2px solid #ecdcc6; border-radius: 12px; padding: 6px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; line-height: 1.3;
}
.demo-pic { display: flex; align-items: center; justify-content: center; gap: 3px; min-height: 40px; }
.demo-cus { font-size: 28px; }
.demo-bubble { font-size: 15px; background: #fff; border: 2px solid var(--wood); border-radius: 8px; padding: 0 3px; }
.demo-card, .demo-slot {
  width: 26px; height: 32px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; border: 2px solid var(--card-edge); background: var(--card);
}
.demo-card { background: #fff27a; }
.demo-slot { border-style: dashed; color: rgba(58, 38, 22, .45); }
.demo-arrow { color: var(--accent); font-weight: 800; }
.demo-bell { background: #ffd23f; border-radius: 10px; padding: 4px 8px; font-weight: 800; font-size: 14px; box-shadow: 0 2px 0 #b8860b; }
.start-btn { margin: 0 0 8px; font-size: 19px; }
.ca-or { margin: 4px 0 6px; color: var(--muted); font-size: 14px; }
.home .end-card { max-height: calc(100vh - 32px); overflow-y: auto; }

@media (max-width: 520px) {
  /* Khung hẹp: phiếu chiếm cả hàng, chip và hai nút xuống một hàng riêng để phiếu không bị ép hẹp */
  .top { flex-wrap: wrap; }
  .ticket { flex-basis: 100%; min-height: 0; }
  .top-right { flex-direction: row; width: 100%; justify-content: space-between; align-items: center; }
  .guide-btn { padding: 6px 10px; font-size: 14px; }
  .hint-btn { padding: 8px 12px; font-size: 14px; }
  .tip.step { font-size: 14px; }
  .demo li { font-size: 12px; }
}

/* ---------- M3.1.2: màn mẫu ---------- */
/* Bàn tay chỉ chỗ (không chặn chạm: chạm xuyên qua tới ô bên dưới) */
.demo-hand {
  position: absolute; z-index: 30; pointer-events: none; font-size: 34px; line-height: 1;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .3)); animation: handTap 1s ease-in-out infinite;
}
@keyframes handTap { 50% { transform: translateY(8px); } }
.demo-hand.shake { animation: handNo .4s ease-in-out 1, handTap 1s ease-in-out .4s infinite; }
@keyframes handNo { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
/* Lời Cú Bé khi làm mẫu: màu tím, khác dòng "Bước tiếp theo" */
.tip.step.demo-tip { background: #f1eaff; border-color: #9c7bd1; }
.tip.step.demo-tip .step-head { color: #5b3f99; }
.skip-btn { border-color: #5b3f99; color: #5b3f99; }
/* Đếm hàng từ phải sang: tên hàng hiện trên từng ô, kể cả khi kệ bị bụi che */
.slot.count-on .slot-name, .dusty .slot.count-on .slot-name { color: #5b3f99; font-weight: 800; }
.dusty .slot.count-on .slot-name::after { content: none; }
/* Làm nổi các thẻ cùng chữ số; nhãn giá trị trên thẻ */
.slot.spot .slot-box { box-shadow: 0 0 0 4px #9c7bd1; border-radius: 10px; }
.slot-box[data-val] { position: relative; }
.slot-box[data-val]::before {
  content: attr(data-val); position: absolute; left: 50%; top: -14px; transform: translateX(-50%);
  background: #5b3f99; color: #fff; font-size: 11px; font-weight: 800; padding: 1px 5px; border-radius: 6px; white-space: nowrap; z-index: 2;
}
.ticket.cue, .board.cue, .ticket-wait.cue { box-shadow: 0 0 0 3px #9c7bd1; animation: cuePulse 1.2s ease-in-out infinite; }
.stamp.cue, .bin-cell.cue { box-shadow: 0 0 0 4px #f08a1c; animation: cuePulse 1.2s ease-in-out infinite; }
.ca-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- M3.2: tiếp tục ca đang chơi, hỏi trước khi bỏ ca cũ, báo cáo phụ huynh ---------- */
.resume-box { background: var(--donvi-soft); border: 2px solid var(--donvi); border-radius: 14px; padding: 8px 10px 10px; margin: 0 0 10px; }
.resume-lead { margin: 0 0 4px; font-weight: 700; }
.resume-btn { margin-top: 4px; font-size: 17px; padding: 10px 18px; line-height: 1.3; }
.resume-bad { margin: 0 0 10px; font-size: 14px; color: #8a4b0f; background: #fff3e0; border-radius: 10px; padding: 6px 10px; }
.confirm-card .replay { display: block; width: 100%; margin: 10px 0 0; }
.confirm-card .confirm-new { background: #fff; color: var(--ink); border: 2px solid var(--wood); }
.confirm-old { margin: 0; font-weight: 700; }
.parent-home { margin-top: 12px; }
.report-list { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; }
.report-ca { background: #fff; border: 1px solid #e6d8c4; border-radius: 10px; padding: 8px 10px; }
.report-ca h3 { margin: 0 0 2px; font-size: 15px; }
.report-meta { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.report-bai { border-top: 1px dashed #e6d8c4; padding-top: 6px; margin-top: 6px; }
.report-bai h4 { margin: 0 0 4px; font-size: 14px; }
.parent .report-bai dl { margin: 0; grid-template-columns: minmax(96px, auto) 1fr; font-size: 13px; }
.parent .report-bai dd { font-weight: 600; overflow-wrap: anywhere; }
.report-bai ul { margin: 0; padding-left: 16px; }
.report-lap { margin: 8px 0 0; font-size: 13px; background: #fff7e6; border-radius: 8px; padding: 6px 8px; }
.report-empty { color: var(--muted); margin: 6px 0; }
.luu-note { font-size: 13px; }
.luu-loi {
  position: fixed; left: 8px; right: 8px; top: 8px; z-index: 40; margin: 0; padding: 8px 12px; border-radius: 10px;
  background: #fff3e0; border: 2px solid #e08a1e; color: #6b3a06; font-size: 14px; font-weight: 700; text-align: center;
}
