/* shell.css — phần khung do main.js dựng. Chỉ BỔ SUNG app.css, không sửa/nhân bản class có sẵn. */

/* ---------- Bản đồ 13 đảo (v12): dành lề trái cho Gấu Bơ; cuộn dọc được khi thấp ---------- */
.map .guide { left: 1.5vmin; bottom: 1.5vmin; z-index: 3; pointer-events: none; }
.map .guide .bear { width: clamp(86px, min(14vw, 22vh), 168px) !important; height: auto !important; aspect-ratio: 200 / 210; }
.map .islands {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 1140px;
  width: 100%;
  margin: 0 auto;
  gap: 2vmin 2.6vmin;
  padding: 0 3vmin 3vmin clamp(106px, 16vw, 196px);
  align-content: start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.island .disk { width: min(19vmin, 25vh, 160px); }
@media (min-width: 900px) {
  .map .islands {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 1240px;
    gap: 1.4vmin 2vmin;
  }
  .island .disk { width: min(15vmin, 18vh, 136px); }
}
/* v13b (K261022-4PB5): nhãn đảo xuống tối đa 2 dòng trong ô lưới thay vì tràn
   sang đảo bên (đo live: "Tìm hình giống nhau" đè "Đoàn tàu sắc màu" 43px ở
   1440x900). text-wrap:balance cân dòng, max-width = bề ô; sàn 15px ở mọi khung —
   hai rule font dưới thắng app.css nhờ shell.css tải sau (cùng specificity). */
.island .name {
  font-size: clamp(15px, min(2.3vw, 3.4vh), 28px);
  padding: 2px 12px;
  line-height: 1.12;
  text-align: center;
  text-wrap: balance;
  max-width: 100%;
  position: relative;
  z-index: 2;
}
.screen.map .island .name { font-size: clamp(15px, min(1.9vw, 3.1vh), 24px); }
@media (max-width: 640px) {
  .screen.map .island .name { font-size: clamp(15px, min(3.4vw, 2.6vh), 18px); padding: 2px 10px; }
}
.island .tag { position: absolute; top: -12px; right: 4%; z-index: 2; background: #FFF3CC; border: 3px solid var(--left); border-radius: 999px; padding: 3px 14px; font: 700 clamp(12px, 1.6vw, 19px)/1.3 var(--f); color: #6B4E00; white-space: nowrap; }
.island .tag.newtag { background: #E2F3E5; border-color: var(--right); color: #1B5E2A; }
.island.wip .disk { filter: saturate(.45) opacity(.75); }
.island.new .disk { box-shadow: 0 9px 0 var(--wood), 0 0 0 16px #FFE27A, 0 0 42px #FFB300; animation: pulse 2s ease-in-out infinite; }
@media (max-width: 620px) {
  .map .islands {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 3vmin clamp(96px, 15vh, 130px) 3vmin;
  }
}

/* ---------- Khung màn chơi (v16 L1): lưới 3 vùng — topbar / sân chơi / điều khiển ----------
   Dọc: topbar trên, .stage ở giữa (minmax(0,1fr) — CHỈ nhận phần trời còn lại),
   hàng đáy = [.bottombar: Bơ+thẻ từ+Đổi bạn] [.padspot: D-pad]. Không còn lớp
   tuyệt đối đè sân: vùng chơi và vùng điều khiển là hai ô grid tách hẳn. */
.game {
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "topbar topbar"
    "play   play"
    "side   ctl";
}
.game > * { min-width: 0; }
.game .topbar { grid-area: topbar; }
.game .stage { grid-area: play; }
/* .bottombar giữ tên class cũ nhưng giờ là ô grid "side": Bơ + nút Đổi bạn
   một hàng, thẻ từ dưới (rộng bằng cả hai). */
.bottombar {
  grid-area: side;
  align-self: end;
  display: grid;
  grid-template-areas: "bear switch" "word word";
  /* B-agy-01: cột 2 phải 1fr — "word" bắc qua 2 cột mới lấy được toàn bề
     .bottombar; giữ auto auto thì vùng word chỉ rộng bằng Bơ+nút (thẻ co
     về ~24px do inline-size containment). */
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  justify-items: start;
  gap: 4px 8px;
  min-width: 0;
  min-height: 0;
  padding: 0 2.5vmin 1.5vmin;
  /* đệm đáy cộng safe-area (thanh home iPhone/iPad). Giữ shorthand dạng
     "0 Xvmin Yvmin" để test v12_r6 bóc được số. */
  padding-bottom: calc(1.5vmin + env(safe-area-inset-bottom));
}
/* Bơ ô side: clamp toàn cục — inline width 140px của bear(140) trước đây chỉ
   bị khối <=580px-cao/<=520px-rộng ghi đè; khung lớn hơn giữ 140px trong ô
   ~50px nên tràn lên đè .stage (đo 4828px² trên Safari iPhone /choi/).
   v16 RC2 (K261026-9MEP): translateY hạ rect Bơ xuống 6px, tạo khe thật với
   mép .stage — mép trùng nhau (khe 0) được mỗi engine làm tròn một kiểu;
   Safari iPad biến nó thành chồng 1px và gate báo bear:96px ở /choi/ 740x904.
   Không dùng padding-top của hàng: đệm đó lấy chiều cao .stage, làm sàn tàu
   (train) bị cắt ở khung /choi/ ngắn nhất (345x418, iphonese_p). */
.bottombar > .bear { grid-area: bear; align-self: end; transform: translateY(6px); width: clamp(48px, 13vmin, 96px) !important; height: auto !important; aspect-ratio: 200 / 210; }
/* B-agy-01: thẻ là inline-size container -> intrinsic width = 0; justify-
   items: start/center sẽ ép nó về ~24-38px. Phải stretch lấp vùng grid. */
.bottombar .wordcard { grid-area: word; min-width: 0; justify-self: stretch; }
.bottombar .char-switch-btn { grid-area: switch; }
.padspot {
  grid-area: ctl;
  display: grid;
  place-items: end center;
  min-width: 0;
  padding: 0 2.5vmin calc(1.5vmin + env(safe-area-inset-bottom)) 0;
}
.padspot:empty { display: none; }
.topbar .iconbtn, .topbar-right { flex: none; }          /* nút không bị bóp méo khi thanh chật */
.topbar .stars { min-width: 0; }

/* v16 L1-R2 (LD-1): ô chip tiến độ của game lưới (táo+chấm rắn, chip mức
   kho báu) nằm static TRONG topbar — không còn absolute đè .stage/.play-area
   (từng đè hàng 1 bàn rắn trên iPad). Topbar chật (<=560px) thì ẩn — sao
   + pill Level vẫn báo tiến độ. */
.hudspot { display: flex; align-items: center; justify-content: center; min-width: 0; flex: 0 1 auto; }
.hudspot .grid-hud {
  display: flex; align-items: center; gap: 8px; position: static;
  background: #FFF; border: 4px solid var(--wood); border-radius: 18px;
  box-shadow: 0 4px 0 var(--wood); padding: 6px 12px; white-space: nowrap;
}
.hudspot .grid-hud-ico { width: 26px; height: 26px; display: inline-grid; place-items: center; }
.hudspot .grid-hud-ico img, .hudspot .grid-hud-ico svg { width: 100%; height: 100%; }
.hudspot .grid-hud-dot { width: 14px; height: 14px; border-radius: 50%; background: #EFE4CE; border: 3px solid var(--wood); }
.hudspot .grid-hud-dot.on { background: #E5484D; }
.hudspot .grid-hud-label { font-weight: 900; font-size: clamp(15px, 2.2vmin, 22px); color: var(--ink); }
@media (max-width: 560px) { .hudspot { display: none; } }

/* Ngang: điều khiển thành hai cột bên sân — Bơ/thẻ/Đổi bạn bên trái, D-pad
   cột phải. Sân (cột giữa) vẫn chỉ nhận phần trời còn lại. */
@media (orientation: landscape) {
  .game {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "topbar topbar topbar"
      "side   play   ctl";
  }
  .bottombar {
    align-self: stretch;
    align-content: end;
    justify-items: center;
    grid-template-areas: "switch" "word" "bear";
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    /* B-agy-01: cột "side" của .game là auto -> rộng theo content (~Bơ 80px)
     * thì thẻ từ chỉ còn ~62px. Sàn 184px để thẻ (trừ padding ~17px) đạt
     * ~165px — đủ chỗ hình + chữ EN hai dòng. */
    min-width: 184px;
    padding: 0 1vmin calc(1.5vmin + env(safe-area-inset-bottom)) 1.5vmin;
  }
  .padspot {
    place-items: end center;
    align-self: stretch;
    padding: 0 calc(1.5vmin + env(safe-area-inset-right)) 1.5vmin 0;
  }
}

/* ---------- L1: cụm nút phải topbar (loa + khoá phụ huynh) ---------- */
.topbar-right { display: flex; align-items: center; gap: 1.4vmin; }
.iconbtn.shake { animation: btnShake .42s ease-in-out; }
@keyframes btnShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-7px) rotate(-4deg); }
  40%, 80% { transform: translateX(7px) rotate(4deg); }
}

/* ---------- Thẻ từ: nghĩa tiếng Việt nhỏ dưới từ Anh; VI là thứ bỏ trước ---------- */
.wordcard .col { display: grid; gap: 2px; min-width: 0; }
.wordcard .vi { font-size: clamp(12px, 9cqi, 22px); font-weight: 600; color: var(--ink-2); }
/* Thẻ quá hẹp (<=110px, khung cực nhỏ): giấu VI, giữ hình + EN. */
@container (max-width: 110px) {
  .wordcard .vi { display: none; }
}

/* ---------- Màn thưởng: nhãn dưới nút lớn ---------- */
.bigwrap { display: grid; justify-items: center; gap: 10px; }
.bigwrap .cap { font-size: clamp(18px, 2.4vw, 26px); font-weight: 700; color: var(--wood); }

/* ---------- Cổng phụ huynh ---------- */
.gate .card { display: grid; gap: 20px; justify-items: center; background: #FFF; border: 2px solid #B9C3BD; border-radius: 24px; padding: 30px 40px; max-width: min(480px, calc(100vw - 24px)); box-sizing: border-box; }
.gate .step { margin: 0; font-size: 14px; color: #4A5560; }
@media (max-width: 440px) {
  .gate .card { padding: 22px 16px; gap: 16px; }
  .gate .opts { gap: 10px; }
  .gate .opts button { width: 76px; height: 64px; }
}
.gate .fb { min-height: 1.3em; font-size: 15px; color: #A3191E; margin: 0; }

/* ---------- L2: Màn nghỉ/ngủ: góc nút phụ huynh & dòng hướng dẫn ---------- */
.rest .gate-corner { position: absolute; top: 2vmin; right: 2vmin; z-index: 6; }
.rest .parent-sleep-hint { font-family: var(--fp); font-size: clamp(14px, 1.7vw, 19px); font-weight: 500; color: #C9D4F5; margin: 0; }   /* chữ thường, KHÔNG viền/nền — không trông như nút bấm (v11 UX-10) */

/* ---------- Tương thích khung thấp hoặc hẹp (iframe 748x467, 640x400, 390x700) ---------- */
@media (max-height: 580px), (max-width: 520px) {
  .topbar { min-height: 58px; padding: 6px 10px; gap: 8px; }
  .topbar-right { gap: 6px; }
  .iconbtn { width: 64px; height: 64px; border-radius: 18px; border-width: 4px; padding: 8px; box-shadow: 0 4px 0 var(--wood); }
  .iconbtn.small { width: 64px; height: 64px; }
  .hold-ring { inset: -7px; border-radius: 25px; }
  .stars { gap: 4px; }
  .stars .star { width: clamp(22px, 5.2vmin, 34px); }
  .bottombar .bear { width: clamp(48px, 13vmin, 88px) !important; height: auto !important; aspect-ratio: 200 / 210; }
  /* v16 L1: thẻ từ dạng cột (hình trên, chữ dưới) — vừa ô "side" ~120-140px
     trên khung hẹp; EN vẫn đủ 1-2 dòng, không cắt. */
  .wordcard { min-height: 0; padding: 4px 8px; border-radius: 16px; border-width: 4px; gap: 2px; flex-direction: column; text-align: center; }
  .wordcard .pic { width: clamp(28px, 8vmin, 44px); height: auto; }
  .wordcard .w { font-size: clamp(14px, 17cqi, 22px); line-height: 1.05; }
  .wordcard .vi { font-size: clamp(11px, 12cqi, 15px); }
  /* v16 L1: ô "side" hẹp ~90-145px — label được xuống 2 dòng để nút vừa ô
     mà không tràn sang D-pad; giữ đích chạm >=64px và chữ >=12px. */
  .char-switch-btn { height: 64px; min-height: 64px; min-width: 64px; max-width: 96px; font-size: 12px; padding: 3px 7px 3px 5px; gap: 3px; white-space: normal; line-height: 1.15; }
  .char-switch-label { line-height: 1.15; }
  .char-switch-icon { width: 20px; height: 20px; }
  .dpad { --k: clamp(64px, 15vmin, 72px); gap: 6px; }
  .island .disk { border-width: 5px; box-shadow: 0 6px 0 var(--wood); }
  .splash .go { width: min(40vmin, 240px); margin: 1.5vmin auto; border-width: 6px; box-shadow: 0 7px 0 var(--wood); }
  .splash .go .bear { width: 78% !important; height: auto !important; aspect-ratio: 200 / 210; }
  .splash .title { font-size: clamp(28px, 8vmin, 52px); }
  .splash .hint { font-size: clamp(15px, 3.6vmin, 22px); }
  .rest .bear { width: min(34vmin, 180px) !important; height: auto !important; aspect-ratio: 200 / 210; }
  .rest .msg { font-size: clamp(20px, 5vmin, 36px); }
  .overlay .sticker { width: min(26vmin, 150px); }
  .overlay .big { width: clamp(84px, 19vmin, 118px); height: clamp(84px, 19vmin, 118px); padding: 14px; border-radius: 26px; }
  .overlay .big.home { width: clamp(72px, 16vmin, 98px); height: clamp(72px, 16vmin, 98px); }
}
/* Màn dọc hẹp (≈360×740): đích chạm tối thiểu cho bé — nút chrome 60px, phím
   d-pad sàn 64px (QA v12 r5; trước đây 58/48/56 quá nhỏ). Khối này đứng SAU khối
   chung (max-width:520px) để thắng, nhưng các rule khung cực thấp/hẹp bên dưới
   vẫn thu nhỏ được khi cần (không vỡ 740×360 hay 1100×535 vì chúng không vào
   nhánh width<=520; và khung <=430px cao vẫn co d-pad xuống). */
@media (max-width: 520px) {
  .iconbtn { width: 64px; height: 64px; }
  .iconbtn.small { width: 64px; height: 64px; }
  .dpad { --k: clamp(64px, 18vmin, 76px); }
}
/* Khung ngang cực thấp (điện thoại xoay ngang ~740×360 / 800×400 / 667×375 —
   QA v12 r6): phím d-pad sàn 64px (v15c1: trước 56 < ngưỡng chạm 64px). */
@media (max-height: 430px) {
  .dpad { --k: clamp(64px, 13vmin, 72px); gap: 5px; }
}
/* v16 L1-R2 (LD-2): khung thấp (iframe /choi/ ~451px, điện thoại ngang ~375px)
   — giành lại sân cho bàn. Thẻ từ KHÔNG đặt chỗ khi ẩn: position absolute phủ
   ô điều khiển (được phép — zone chỉ cấm đè .play-area), khi .show hiện đè tạm
   Bơ/Đổi bạn ~4s. */
@media (max-height: 520px) {
  .topbar { min-height: 0; padding-top: 4px; padding-bottom: 4px; }
}
/* Web v2 (29/11/2026): CẤM .wordcard nhảy thành fixed bottom đè lên D-pad và Gấu Bơ
   (audit đo 8,800px² overlap trên 860×640). Trên khung thấp/hẹp, thẻ từ là pill gọn
   ở mép TRÊN ngay dưới topbar — 0px² đè vùng điều khiển ở đáy. */
@media (max-height: 520px), (max-width: 560px) {
  .bottombar .wordcard {
    position: fixed; left: 50%; top: 56px; bottom: auto;
    container-type: normal; width: max-content;
    max-width: min(calc(100vw - 24px), 340px); z-index: 14;
    flex-direction: row; flex-wrap: nowrap; min-height: 0; padding: 4px 14px; gap: 8px;
    border-radius: 999px; border-width: 3px; pointer-events: none;
    box-shadow: 0 5px 16px rgba(59, 42, 30, 0.16);
    transform: translate(-50%, -8px);
  }
  .bottombar .wordcard.show { transform: translate(-50%, 0); }
  .bottombar .wordcard .pic { width: 28px; margin-inline: 0; }
  .bottombar .wordcard .col { display: flex; flex-direction: row; align-items: baseline; gap: 8px; flex: 0 1 auto; text-align: left; }
  .bottombar .wordcard .w { font-size: 18px; white-space: nowrap; }
  .bottombar .wordcard .vi { display: inline; font-size: 13px; white-space: nowrap; }
}
/* v15c1: iPad/máy bảng trỏ thô — nút chrome nhỏ (🔊 🔒) cũng >=88px như nút Home.
   v16 L1: chỉ khi màn đủ cao (>=560px) — điện thoại xoay ngang ~261px giữ 64px
   để topbar không nuốt 1/3 sân. */
@media (pointer: coarse) and (min-width: 561px) and (min-height: 560px) {
  .iconbtn.small { width: 88px; height: 88px; }
  .char-switch-btn { height: 88px; min-height: 88px; }
  .char-default-btn { min-height: 88px; }
}

/* ---------- v15c3 (K261025-PZ1Q): thẻ "Giờ chơi" trong khu phụ huynh ----------
   Trạng thái live + thanh tiến trình + chip chọn >=48px đích chạm (ba mẹ bấm
   bằng ngón tay trên iPhone/iPad) + hàng gợi ý tuổi + "Đã lưu ✓". Đứng SAU các
   khối media cũ — test khoá vị trí đầu của '@media (max-width: 520px)'. */
.parent .time-status { margin: 0 0 8px; font-size: 19px; font-weight: 700; color: #1D2320; }
.parent .time-bar { display: block; height: 10px; border-radius: 999px; background: #E3E8E4; overflow: hidden; margin: 0 0 10px; }
.parent .time-bar[hidden] { display: none; }
.parent .time-fill { display: block; height: 100%; width: 0; border-radius: 999px; background: #2F9E44; transition: width .6s linear; }
.parent .time-sum { margin: 0 0 14px; }
.parent .time-label { margin: 12px 0 6px; font-size: 15px; font-weight: 700; }
.parent .chiprow { display: flex; flex-wrap: wrap; gap: 8px; }
.parent .chip {
  min-height: 48px; min-width: 48px; padding: 10px 16px;
  border-radius: 999px; border: 2px solid #A9B3AD; background: #FFF;
  font: 600 16px/1.1 var(--fp); color: #1D2320; cursor: pointer;
}
.parent .chip.on { background: #1B5E2A; border-color: #1B5E2A; color: #FFF; }
.parent .chip.sug { border-style: dashed; border-color: #7D8B84; background: #F4F7F2; }
.parent .chip.sug.mine { border-color: #1B5E2A; border-style: solid; font-weight: 800; }
.parent .chip:focus-visible { outline: 3px solid #1C7ED6; outline-offset: 2px; }
.parent .small-note { font-size: 13px; margin: 8px 0 0; }
.parent .time-actions { margin-top: 14px; }
/* v15c3 R2 (Codex P2-04): nút tác vụ giờ chơi cũng phải đạt chạm ≥48px —
   .btn chung chỉ 44px. */
.parent .time-actions .btn { min-height: 48px; }
.parent .saved-tick { display: inline-block; margin-top: 10px; min-height: 20px; font-weight: 700; color: #1B5E2A; font-size: 15px; }
@media (width <= 520px) {
  .parent .chip { font-size: 15px; padding: 10px 13px; }
}

/* ---------- Web Desktop v2 (29/11/2026): Stage-First, bỏ cột trái chết 184px ----------
   Áp cho màn ngang máy tính (min-width: 720px, orientation: landscape) và mọi trò thường
   (không chạm .game:has(.g-story-mit) vốn đã tràn khung riêng).
   - Đặt trước khối màn siêu hẹp 340px để không chạm regex kiểm tra.
   - Lưới 2 hàng x 3 cột ("side topbar topbar" / "play play ctl"):
     * Hàng 1: Gấu Bơ + Đổi bạn (.bottombar) đứng gọn cùng hàng topbar (TRÊN .stage)
       -> safeBoardLayout thấy intersects(bear) === false, sân chơi .stage ăn TRỌN 100% bề rộng!
     * Hàng 2: .stage (play play) căn giữa tuyệt đối; khi .padspot rỗng (Câu cá), cột ctl = 0px.
     * Thẻ từ .wordcard là Top HUD Pill căn giữa ngay dưới topbar -> 0px² đè lên D-pad / Bơ! */
@media (orientation: landscape) and (min-width: 720px) and (hover: hover) and (pointer: fine) {
  .game:not(:has(.g-story-mit)) {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "side topbar topbar"
      "play play   ctl";
  }
  .game:not(:has(.g-story-mit)) .topbar {
    min-height: 58px;
    padding: 4px 14px 4px 8px;
    gap: 10px;
  }
  .game:not(:has(.g-story-mit)) .topbar .iconbtn {
    width: 60px; height: 60px; border-radius: 16px; border-width: 4px;
    padding: 7px; box-shadow: 0 4px 0 var(--wood);
  }
  .game:not(:has(.g-story-mit)) .topbar .iconbtn.small { width: 60px; height: 60px; }
  .game:not(:has(.g-story-mit)) .topbar .stars .star { width: clamp(26px, 3.8vmin, 40px); }
  .game:not(:has(.g-story-mit)) .bottombar {
    grid-area: side;
    align-self: center;
    min-width: 0;
    min-height: 0;
    padding: 6px 4px 6px 14px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  .game:not(:has(.g-story-mit)) .bottombar > .bear {
    transform: none;
    width: clamp(46px, 6.4vmin, 58px) !important;
    flex: none;
  }
  .game:not(:has(.g-story-mit)) .bottombar .char-switch-btn {
    height: 46px;
    min-height: 46px;
    padding: 4px 12px 4px 6px;
    box-shadow: 0 3px 0 var(--wood);
    white-space: nowrap;
  }
  .game:not(:has(.g-story-mit)) .bottombar .wordcard {
    position: fixed;
    left: 50%;
    top: 72px;
    bottom: auto;
    container-type: normal;
    width: max-content;
    max-width: min(60vw, 360px);
    min-height: 0;
    padding: 6px 16px 6px 10px;
    gap: 10px;
    border-radius: 999px;
    border-width: 3px;
    flex-direction: row;
    flex-wrap: nowrap;
    text-align: left;
    z-index: 14;
    pointer-events: none;
    box-shadow: 0 6px 20px rgba(59, 42, 30, 0.16);
    transform: translate(-50%, -10px);
  }
  .game:not(:has(.g-story-mit)) .bottombar .wordcard.show {
    transform: translate(-50%, 0);
  }
  .game:not(:has(.g-story-mit)) .bottombar .wordcard .pic {
    width: 34px;
    margin-inline: 0;
  }
  .game:not(:has(.g-story-mit)) .bottombar .wordcard .col {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    flex: 0 1 auto;
    text-align: left;
  }
  .game:not(:has(.g-story-mit)) .bottombar .wordcard .w {
    font-size: clamp(18px, 2.3vmin, 25px);
    white-space: nowrap;
  }
  .game:not(:has(.g-story-mit)) .bottombar .wordcard .vi {
    display: inline;
    font-size: clamp(13px, 1.7vmin, 16px);
    white-space: nowrap;
  }
  .game:not(:has(.g-story-mit)) .padspot {
    padding: 0 14px 14px 6px;
    align-self: center;
  }
  .game:not(:has(.g-story-mit)) .dpad {
    --k: clamp(58px, 8.2vmin, 74px);
    gap: 6px;
  }
}

/* Đặt CUỐI file để thắng khối (max-height: 580px), (max-width: 520px) ở trên.
   Giữ đích chạm >=60px: khung ~304px vẫn đủ chỗ (2 nút 60 + sao ~110 + lề). */
@media (max-width: 340px) {                              /* khung game ~304px (điện thoại 360) */
  .topbar { padding: 6px 8px; gap: 6px; }
  .iconbtn { padding: 6px; }
  .stars .star { width: 18px; }
}
/* Khung cực hẹp (~304px): ô "side" chỉ còn ~90px — Bơ/Đổi bạn/thẻ từ xếp dọc
   hết thay vì tràn sang ô D-pad. (Block riêng, đứng cuối file.) */
@media (max-width: 340px) {
  .bottombar { grid-template-areas: "bear" "switch" "word"; grid-template-columns: minmax(0, 1fr); }
}

/* v16 L1: khung ngang cực thấp (iframe /choi/ ~814x261) — topbar gọn ~70px
   thay vì ~100px: nút giữ sàn chạm 64px. */
@media (max-height: 340px) {
  .topbar { min-height: 44px; padding: 3px 8px; gap: 6px; }
  .stars .star { width: clamp(20px, 7vh, 30px); }
  .iconbtn, .iconbtn.small { width: 64px; height: 64px; border-radius: 16px; padding: 7px; }
}
