/* game-ocean.css — Kanji Ocean (templates/pages/games/kanji_ocean.html). Bản vẽ chủ dự án duyệt 25/09/2026:
   Main.dc.html (máy tính 1440×900), KO_Mobile (điện thoại dọc 390×844), KO_Wrong, KO_Escape, KO_Review, KO_Clear.
   Canvas Phaser (trong suốt) chỉ vẽ cá + ngọc chữ + hiệu ứng; nền biển, vạch san hô, khung bàn, HUD, nút, thông báo,
   ôn thẻ, tổng kết là HTML/CSS ở đây. JS (ocean/ui.js) đặt vị trí bàn/vạch qua biến --ko-board-*, --ko-reef-y…
   #game-wrapper[data-layout]: desk (máy tính) / phone (điện thoại dọc) / land (điện thoại ngang, bàn sang phải).
   Bảng màu biển sâu là màu riêng của game (không có trong tokens.css) → khai báo một chỗ trong .ko-play. */

.ko-play {
  --ko-sea-1: #1c7fb0; --ko-sea-2: #0d5687; --ko-sea-3: #083a64; --ko-sea-4: #05223f; --ko-sea-5: #06243f;
  --ko-ink: #0b3556;            /* chữ trên ngọc trai, thẻ trắng */
  --ko-ink-soft: #3d7ea6;       /* cách đọc kana */
  --ko-text: #37424d;
  --ko-muted: #6b7785;
  --ko-glass: rgba(4, 30, 54, 0.58);
  --ko-glass-hover: rgba(10, 52, 88, 0.72);
  --ko-glass-line: rgba(160, 220, 255, 0.18);
  --ko-on-glass: #eaf6ff;
  --ko-label: #9cc7e4;
  --ko-sub: #cfe7f7;
  --ko-gold: #ffd166;
  --ko-gold-hi: #ffe08a;
  --ko-gold-shadow: #8a5a00;
  --ko-cyan: #7fe3ff;
  --ko-bar: #7fd8ff;
  --ko-reef: #ff9a8a;
  --ko-bad: #7a1c1c;
  --ko-hit: #1b8f5a;
  --ko-card: #fbfdff;
  --ko-card-line: #e2edf4;
  --ko-btn-line: #d5e1ea;
  --ko-chip: #f1f7fb;
  --ko-note-bg: #fff6e8;
  --ko-note: #7a4a06;
  --ko-dark: #0a4d68;
  --ko-coral: #042038;
  --ko-weed: #0e5a4a;
  --ko-white: #ffffff;
  --ko-jp: "Zen Maru Gothic", var(--font-jp);
  --ko-nums: Fredoka, var(--font);
  --ko-top: 12px;

  position: fixed; inset: 0; z-index: 5;
  display: flex; flex-direction: column; background: var(--ko-sea-5);
}
.ko-play[hidden] { display: none; }
body:has(.ko-play:not([hidden])) { overflow: hidden; }
.gs-wait { margin-top: 10px; }

/* Điện thoại (dọc, ngang): bỏ thanh trên của trang, nút thoát nằm trong khung chơi (KO_Mobile).
   App điện thoại (?mobile=1) luôn bỏ thanh trên (app có nút quay lại riêng). */
.ko-play:not([data-layout="desk"]) .ko-bar,
.gs.is-mobile .ko-bar { display: none; }

.ko-stage {
  position: relative; flex-grow: 1; min-height: 0; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  font-family: var(--font); color: var(--ko-on-glass);
}
.ko-jp { font-family: var(--ko-jp); font-weight: 700; }
.ko-num { font-family: var(--ko-nums); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Nền biển ─────────────────────────────────────────────────────── */
.ko-sea {
  position: absolute; inset: 0; overflow: hidden;
  background: linear-gradient(180deg, var(--ko-sea-1) 0%, var(--ko-sea-2) 34%, var(--ko-sea-3) 68%, var(--ko-sea-4) 100%);
}
.ko-rays { position: absolute; inset: 0; width: 100%; height: 100%; }
.ko-rays-g { fill: #bfe9ff; opacity: 0.07; animation: ko-rays 7s ease-in-out infinite alternate; }
.ko-waves { fill: none; stroke: #d6f2ff; stroke-width: 1.4; opacity: 0.13; }
.ko-specks { fill: var(--ko-white); opacity: 0.22; }
@keyframes ko-rays { from { opacity: 0.05; } to { opacity: 0.1; } }
.ko-coral { position: absolute; bottom: 0; width: min(400px, 30vw); height: auto; aspect-ratio: 400 / 320; }
.ko-coral-l { left: 0; }
.ko-coral-r { right: 0; }
.ko-rock { fill: var(--ko-coral); }
.ko-weed { fill: none; stroke: var(--ko-weed); stroke-width: 5; stroke-linecap: round; opacity: 0.9; }

/* Vạch san hô (cá chạm vạch là thoát) + khung bàn chữ — nằm dưới canvas */
.ko-reef {
  position: absolute; left: 0; right: 0; top: var(--ko-reef-y, 60%); height: 1.5px; opacity: 0.6;
  background: repeating-linear-gradient(90deg, var(--ko-reef) 0 3px, transparent 3px 12px);
}
.ko-board-bg {
  position: absolute; left: var(--ko-board-x, 0); top: var(--ko-board-y, 0);
  width: var(--ko-board-w, 0); height: var(--ko-board-w, 0); border-radius: 28px;
  background: rgba(2, 20, 38, 0.45); box-shadow: inset 0 0 0 1px rgba(160, 220, 255, 0.12);
}
.ko-canvas { position: absolute; inset: 0; z-index: 1; touch-action: none; outline: none; }
/* Tab tới bàn chữ (chơi bằng bàn phím, renderer.js key()) → viền khung bàn sáng lên */
.ko-stage:has(.ko-canvas:focus-visible) .ko-board-bg { box-shadow: inset 0 0 0 2px var(--ko-cyan); }
.ko-canvas canvas { display: block; }

/* ── Lớp giao diện trên canvas (chỉ nút/khung nhận chạm, còn lại cho chạm xuyên xuống bàn) ── */
.ko-ui { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.ko-ui button, .ko-matched { pointer-events: auto; }

.ko-glass {
  background: var(--ko-glass); border: 1px solid var(--ko-glass-line); border-radius: 14px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: var(--ko-on-glass);
}
.ko-lbl { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ko-label); margin: 0; }
.ko-gbtn {
  height: 44px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ko-glass); border: 1px solid var(--ko-glass-line); border-radius: 14px; color: var(--ko-on-glass);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.ko-gbtn:hover { background: var(--ko-glass-hover); }
.ko-gbtn:focus-visible, .ko-btn:focus-visible, .ko-rv-speak:focus-visible { outline: 2px solid var(--ko-cyan); outline-offset: 2px; }
.ko-gbtn:active { transform: translateY(1px); }
.ko-icon { width: 44px; padding: 0; }

/* HUD (Main.dc.html): Điểm | vòng combo 5 giây + hệ số | Màn N, mm:ss, thanh thời gian */
.ko-top {
  position: absolute; top: 20px; left: 24px; right: 24px;
  display: flex; align-items: flex-start; gap: 10px;
}
.ko-x { display: none; }
.ko-hud { display: flex; align-items: center; gap: 20px; padding: 12px 18px; }
.ko-hud-sep { width: 1px; height: 40px; background: rgba(160, 220, 255, 0.2); }
.ko-hud-score, .ko-hud-col { display: flex; flex-direction: column; gap: 2px; }
.ko-hud-score .ko-num { font-size: 30px; line-height: 1; min-width: 3ch; }
.ko-hud-combo { display: flex; align-items: center; gap: 10px; }
.ko-ring { width: 44px; height: 44px; transform: rotate(-90deg); flex-shrink: 0; }
.ko-ring circle { fill: none; stroke-width: 5; }
.ko-ring-bg { stroke: rgba(255, 255, 255, 0.14); }
.ko-ring-fg { stroke: var(--ko-gold); stroke-linecap: round; opacity: 0; transition: opacity 0.2s; }
.ko-hud-combo.is-on .ko-ring-fg { opacity: 1; }
.ko-mult { font-size: 26px; line-height: 1; color: var(--ko-on-glass); opacity: 0.8; white-space: nowrap; }
.ko-hud-combo.is-on .ko-mult { color: var(--ko-gold); opacity: 1; }
.ko-hud-combo.is-bump .ko-mult { animation: ko-bump 0.28s ease-out; }
.ko-hud-combo.is-drop .ko-mult { opacity: 1; font-size: 20px; }
.ko-mult s { color: var(--ko-gold); opacity: 0.6; }
@keyframes ko-bump { 40% { transform: scale(1.22); } }
.ko-hud-time { display: flex; flex-direction: column; gap: 6px; width: 150px; }
.ko-hud-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ko-hud-time .ko-num { font-size: 22px; line-height: 1; }
.ko-track { display: block; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.ko-track i { display: block; height: 100%; border-radius: 3px; background: var(--ko-bar); transform-origin: left center; }
.ko-track-thin { display: none; }
.ko-actions { margin-left: auto; display: flex; gap: 10px; }
.ko-shuffle-bottom { display: none; }

/* Cột trái "Đã ghép trong màn" (chỉ màn rộng) */
.ko-matched {
  position: absolute; left: 24px; bottom: 20px; width: 250px; padding: 14px 16px; display: none;
}
.ko-matched-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ko-matched-list li { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.ko-matched-list b { font-size: 22px; font-weight: 700; }
.ko-matched-read { font-size: 13px; color: var(--ko-label); white-space: nowrap; }
.ko-matched-mean { margin-left: auto; font-size: 13px; color: var(--ko-sub); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ko-matched-list .ko-matched-empty { font-size: 13px; line-height: 1.5; color: var(--ko-label); }
@media (min-width: 1100px) {
  .ko-play[data-layout="desk"] .ko-matched { display: block; }
}

/* Ô xem trước khi kéo: "食 + 事 → 食事 · しょくじ · bữa ăn · trúng cá" (JS đặt left theo bề rộng thật) */
.ko-preview {
  position: absolute; top: var(--ko-pill-y); left: var(--ko-pill-x);
  display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 18px; max-width: calc(100% - 24px);
  border-radius: 22px; background: rgba(255, 255, 255, 0.95); box-shadow: 0 8px 24px rgba(0, 20, 40, 0.35);
  color: var(--ko-ink); white-space: nowrap; overflow: hidden;
}
.ko-preview[hidden] { display: none; }
.ko-pv-parts, .ko-pv-word { font-size: 22px; }
.ko-pv-arrow { color: var(--ko-ink-soft); flex-shrink: 0; }
.ko-preview:not(.is-word) .ko-pv-word { color: var(--ko-muted); }
.ko-pv-read { font-size: 14px; color: var(--ko-ink-soft); font-weight: 500; }
.ko-pv-mean { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ko-pv-hit { font-size: 12px; font-weight: 600; color: var(--ko-white); background: var(--ko-hit); padding: 3px 8px; border-radius: 999px; flex-shrink: 0; }

/* Điểm bay lên chỗ cá trúng đạn / từ nổi lên khỏi bàn */
.ko-fx { position: absolute; inset: 0; overflow: hidden; }
.ko-pop {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); opacity: 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px; white-space: nowrap; pointer-events: none;
}
.ko-pop.is-on { animation: ko-rise 1.05s ease-out forwards; }
.ko-burst b { font-size: 34px; line-height: 1; color: var(--ko-gold-hi); text-shadow: 0 2px 0 var(--ko-gold-shadow), 0 0 18px rgba(255, 209, 102, 0.8); }
.ko-burst span { font-family: var(--ko-nums); font-weight: 600; font-size: 18px; color: var(--ko-white); text-shadow: 0 1px 6px rgba(0, 20, 40, 0.6); }
.ko-wordpop b { font-size: 30px; color: var(--ko-white); text-shadow: 0 2px 10px rgba(0, 30, 60, 0.7); }
.ko-wordpop span { font-size: 13px; font-weight: 600; color: var(--ko-sub); text-shadow: 0 1px 6px rgba(0, 20, 40, 0.7); }
.ko-wordpop.is-on { animation-duration: 1.25s; }
@keyframes ko-rise {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(1); }
}

/* Ghép sai: "山月 không phải từ — mất combo" (KO_Wrong) */
.ko-toast {
  position: absolute; left: 50%; top: 108px; transform: translate(-50%, -8px); opacity: 0;
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 18px; max-width: calc(100% - 24px);
  border-radius: 22px; background: var(--ko-white); box-shadow: 0 8px 24px rgba(0, 20, 40, 0.35);
  color: var(--ko-bad); font-size: 14px; font-weight: 600; white-space: nowrap; transition: opacity 0.2s, transform 0.2s;
}
.ko-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.ko-toast-word { font-size: 20px; }

/* Cá thoát: viền đỏ + thẻ lộ đáp án (KO_Escape) */
.ko-vignette { position: absolute; inset: 0; box-shadow: inset 0 0 90px 30px rgba(255, 60, 50, 0.55); opacity: 0; }
.ko-vignette.is-on { animation: ko-flash 1.4s ease-out forwards; }
@keyframes ko-flash { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }
.ko-escape {
  position: absolute; left: 50%; top: 108px; transform: translate(-50%, -8px); opacity: 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 22px; max-width: calc(100% - 24px);
  border-radius: 16px; background: var(--ko-white); box-shadow: 0 10px 30px rgba(0, 10, 25, 0.45);
  transition: opacity 0.25s, transform 0.25s;
}
.ko-escape.is-on { opacity: 1; transform: translate(-50%, 0); }
.ko-esc-k { font-size: 13px; font-weight: 600; color: var(--ko-bad); }
.ko-esc-word { display: flex; align-items: baseline; gap: 10px; color: var(--ko-ink); flex-wrap: wrap; justify-content: center; }
.ko-esc-word b { font-size: 30px; }
.ko-esc-read { font-size: 15px; font-weight: 500; color: var(--ko-ink-soft); }
.ko-esc-mean { font-size: 15px; font-weight: 600; }
.ko-esc-need { font-size: 12px; color: var(--ko-muted); }
.ko-toast.is-on ~ .ko-escape.is-on { top: 162px; }

/* ── Hộp phủ: tạm dừng, ôn thẻ, tổng kết ─────────────────────────── */
.ko-layer {
  position: absolute; inset: 0; z-index: 5; padding: 16px; overflow-y: auto; touch-action: pan-y;
  display: flex; align-items: center; justify-content: center;
}
.ko-layer[hidden] { display: none; }
.ko-layer-dim { background: rgba(2, 16, 30, 0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.ko-layer-sea { background: linear-gradient(180deg, var(--ko-sea-2) 0%, var(--ko-sea-4) 100%); }
.ko-layer-rays { background: linear-gradient(180deg, var(--ko-sea-1) 0%, var(--ko-sea-3) 60%, var(--ko-sea-4) 100%); }
.ko-layer-rays::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(100deg, transparent 10%, rgba(191, 233, 255, 0.08) 10% 19%, transparent 19%),
    linear-gradient(78deg, transparent 72%, rgba(191, 233, 255, 0.08) 72% 80%, transparent 80%);
}
.ko-layer-rays > * { position: relative; }
.ko-card {
  width: 420px; max-width: 100%; padding: 24px; border-radius: 20px; background: var(--ko-white);
  box-shadow: 0 24px 60px rgba(0, 10, 25, 0.5); color: var(--ko-ink); margin: auto;
}
.ko-card-title { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
.ko-card-text { margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: var(--ko-muted); }
.ko-card-actions { display: flex; gap: 10px; }
.ko-card-actions .ko-btn { flex: 1 1 0; }
.ko-btn {
  height: 48px; padding: 0 20px; border-radius: 12px; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 15px; font-weight: 600; white-space: nowrap;
}
.ko-btn-ghost { border: 1px solid var(--ko-btn-line); background: var(--ko-white); color: var(--ko-text); }
.ko-btn-ghost:hover { border-color: var(--ko-muted); }
.ko-btn-main, .ko-btn-dark { background: var(--ko-dark); color: var(--ko-white); font-weight: 700; }
.ko-btn-main:hover, .ko-btn-dark:hover { filter: brightness(1.12); }

/* Ôn thẻ (KO_Review) */
.ko-rv { width: 100%; max-width: 460px; display: flex; flex-direction: column; align-items: center; gap: 22px; margin: auto; }
.ko-rv-head { display: flex; align-items: center; gap: 12px; color: var(--ko-sub); font-size: 15px; font-weight: 600; }
.ko-rv-track { width: 180px; }
.ko-rv-card {
  width: 100%; box-sizing: border-box; padding: 34px 36px 30px; border-radius: 24px; background: var(--ko-card);
  box-shadow: 0 24px 60px rgba(0, 10, 25, 0.5); color: var(--ko-ink); outline: none;
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  transition: transform 0.25s ease-in, opacity 0.25s ease-in;
}
.ko-rv-card.is-in { animation: ko-card-in 0.28s ease-out; }
.ko-rv-card.is-out-left { transform: translateX(-120%) rotate(-8deg); opacity: 0; }
.ko-rv-card.is-out-right { transform: translateX(120%) rotate(8deg); opacity: 0; }
@keyframes ko-card-in { from { transform: scale(0.9); opacity: 0; } }
.ko-rv-word { font-size: 72px; font-weight: 900; line-height: 1.1; }
.ko-rv-reading { font-size: 20px; font-weight: 500; color: var(--ko-ink-soft); }
.ko-rv-meaning { font-size: 22px; font-weight: 700; }
.ko-rv-line { width: 100%; height: 1px; background: var(--ko-card-line); margin: 8px 0; }
.ko-rv-example { font-size: 17px; font-weight: 500; color: var(--ko-text); }
.ko-rv-example[hidden] { display: none; }
.ko-rv-speak {
  margin-top: 6px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--ko-btn-line);
  background: var(--ko-white); color: var(--ko-dark); display: grid; place-items: center; cursor: pointer;
}
.ko-rv-actions { display: flex; gap: 14px; }
.ko-rv-actions .ko-btn { height: 52px; min-width: 190px; border-radius: 14px; font-size: 16px; font-weight: 700; }
.ko-btn-forget { border: 1.5px solid rgba(255, 190, 150, 0.7); background: rgba(255, 140, 90, 0.14); color: #ffd9c4; }
.ko-btn-know { background: var(--ko-cyan); color: #05314f; }
.ko-btn-forget:hover { background: rgba(255, 140, 90, 0.24); }
.ko-btn-know:hover { filter: brightness(1.06); }

/* Tổng kết màn (KO_Clear) */
.ko-cl-card { width: 600px; padding: 32px 36px; border-radius: 24px; display: flex; flex-direction: column; gap: 20px; color: var(--ink); }
.ko-cl-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ko-cl-titles { display: flex; flex-direction: column; gap: 4px; }
.ko-cl-kicker { font-size: 13px; font-weight: 600; color: var(--ko-ink-soft); letter-spacing: 0.06em; text-transform: uppercase; }
.ko-cl-title { margin: 0; font-size: 30px; font-weight: 700; color: var(--ko-ink); }
.ko-cl-stats { display: flex; gap: 24px; }
.ko-cl-stats div { display: flex; flex-direction: column; align-items: flex-end; }
.ko-cl-stats span { font-size: 12px; color: var(--ko-muted); }
.ko-cl-stats b { font-size: 32px; color: var(--ko-ink); line-height: 1.2; }
.ko-cl-chips {
  list-style: none; margin: 0; padding: 0; max-height: 34vh; overflow-y: auto;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
}
.ko-chip { display: flex; align-items: baseline; gap: 8px; padding: 10px 14px; border-radius: 12px; background: var(--ko-chip); color: var(--ko-ink); min-width: 0; }
.ko-chip b { font-size: 22px; flex-shrink: 0; }
.ko-chip span { font-size: 13px; color: var(--ko-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ko-chip-empty { grid-column: 1 / -1; font-size: 14px; color: var(--ko-muted); }
.ko-cl-note { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--ko-note-bg); color: var(--ko-note); font-size: 14px; }
.ko-cl-note .icon { flex-shrink: 0; }
.ko-cl-actions { display: flex; gap: 12px; justify-content: flex-end; }

.ko-loading {
  position: absolute; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; color: var(--ko-sub); font-size: 14px;
}
.ko-loading[hidden] { display: none; }
.ko-loading .gs-spin { border-color: rgba(255, 255, 255, 0.18); border-top-color: var(--ko-cyan); }

/* ── Điện thoại dọc (KO_Mobile) ───────────────────────────────────── */
.ko-play[data-layout="phone"] .ko-top,
.ko-play[data-layout="land"] .ko-top { top: var(--ko-top); left: 12px; right: 12px; gap: 8px; align-items: center; }
.ko-play:not([data-layout="desk"]) .ko-x { display: grid; }
.ko-play:not([data-layout="desk"]) .ko-glass, .ko-play:not([data-layout="desk"]) .ko-gbtn { border-radius: 12px; }
.ko-play:not([data-layout="desk"]) .ko-hud {
  flex: 1 1 auto; min-width: 0; height: 44px; box-sizing: border-box; padding: 0 12px; gap: 6px; justify-content: space-between;
}
.ko-play:not([data-layout="desk"]) .ko-hud-sep,
.ko-play:not([data-layout="desk"]) .ko-combo-lbl,
.ko-play:not([data-layout="desk"]) .ko-track-in,
.ko-play:not([data-layout="desk"]) .ko-shuffle-top,
.ko-play:not([data-layout="desk"]) .ko-pause-btn span { display: none; }
.ko-play:not([data-layout="desk"]) .ko-lbl { font-size: 10px; }
.ko-play:not([data-layout="desk"]) .ko-hud-score .ko-num,
.ko-play:not([data-layout="desk"]) .ko-mult,
.ko-play:not([data-layout="desk"]) .ko-hud-time .ko-num { font-size: 18px; line-height: 1.05; }
.ko-play:not([data-layout="desk"]) .ko-hud-combo { gap: 6px; }
.ko-play:not([data-layout="desk"]) .ko-ring { width: 26px; height: 26px; }
.ko-play:not([data-layout="desk"]) .ko-ring circle { stroke-width: 6; }
.ko-play:not([data-layout="desk"]) .ko-hud-time { width: auto; gap: 0; }
.ko-play:not([data-layout="desk"]) .ko-hud-row { flex-direction: column; align-items: flex-end; gap: 0; }
.ko-play:not([data-layout="desk"]) .ko-actions { margin-left: 0; }
.ko-play:not([data-layout="desk"]) .ko-pause-btn { width: 44px; padding: 0; }
.ko-play:not([data-layout="desk"]) .ko-track-thin {
  display: block; position: absolute; top: calc(var(--ko-top) + 48px); left: 68px; right: 68px; height: 4px;
}
.ko-play[data-layout="phone"] .ko-shuffle-bottom { display: inline-flex; position: absolute; left: 12px; right: 12px; bottom: 12px; }
.ko-play[data-layout="phone"] .ko-board-bg { border-radius: 26px; }
.ko-play:not([data-layout="desk"]) .ko-preview { height: 40px; gap: 8px; padding: 0 14px; border-radius: 20px; }
.ko-play:not([data-layout="desk"]) .ko-pv-parts,
.ko-play:not([data-layout="desk"]) .ko-pv-word { font-size: 19px; }
.ko-play:not([data-layout="desk"]) .ko-pv-read,
.ko-play:not([data-layout="desk"]) .ko-pv-mean { font-size: 13px; }
.ko-play[data-layout="phone"] .ko-pv-read { display: none; }   /* KO_Mobile: bỏ cách đọc cho vừa bề ngang */
.ko-play:not([data-layout="desk"]) .ko-toast,
.ko-play:not([data-layout="desk"]) .ko-escape { top: calc(var(--ko-top) + 64px); }
.ko-play:not([data-layout="desk"]) .ko-toast.is-on ~ .ko-escape.is-on { top: calc(var(--ko-top) + 116px); }
.ko-play:not([data-layout="desk"]) .ko-coral { width: 46vw; }

/* ── Điện thoại ngang: bàn bên phải, cá bơi bên trái ──────────────── */
.ko-play[data-layout="land"] .ko-top { right: calc(100% - var(--ko-lane-x) - var(--ko-lane-w)); }
.ko-play[data-layout="land"] .ko-track-thin { right: calc(100% - var(--ko-lane-x) - var(--ko-lane-w) + 56px); }
.ko-play[data-layout="land"] .ko-reef { left: var(--ko-lane-x); right: auto; width: var(--ko-lane-w); }
.ko-play[data-layout="land"] .ko-shuffle-bottom { display: inline-flex; position: absolute; left: 12px; bottom: 12px; width: 44px; padding: 0; }
.ko-play[data-layout="land"] .ko-shuffle-bottom span { display: none; }
.ko-play[data-layout="land"] .ko-toast,
.ko-play[data-layout="land"] .ko-escape { left: calc(var(--ko-lane-x) + var(--ko-lane-w) / 2); }
.ko-play[data-layout="land"] .ko-coral { width: 28vw; }

/* App điện thoại: nút quay lại của app nằm góc trên trái → chừa chỗ, ẩn nút thoát của web. */
.gs.is-mobile .ko-top { left: 60px; }
.gs.is-mobile .ko-x { display: none; }
.gs.is-mobile .ko-play:not([data-layout="desk"]) .ko-track-thin { left: 64px; }

/* Hộp phủ trên điện thoại */
@media (max-width: 560px) {
  .ko-rv-card { padding: 26px 22px 22px; }
  .ko-rv-word { font-size: 56px; }
  .ko-rv-actions { width: 100%; }
  .ko-rv-actions .ko-btn { flex: 1 1 0; min-width: 0; }
  .ko-cl-card { padding: 22px 18px; gap: 16px; }
  .ko-cl-title { font-size: 24px; }
  .ko-cl-stats b { font-size: 26px; }
  .ko-chip { padding: 8px 10px; }
  .ko-chip b { font-size: 19px; }
  .ko-cl-actions .ko-btn { flex: 1 1 0; padding: 0 12px; }
}
@media (max-height: 480px) {
  .ko-rv { gap: 12px; }
  .ko-rv-card { padding: 16px 22px; gap: 4px; }
  .ko-rv-word { font-size: 44px; }
  .ko-rv-line { margin: 2px 0; }
  .ko-rv-actions .ko-btn { height: 44px; }
  .ko-cl-card { padding: 18px 22px; gap: 12px; }
  .ko-cl-chips { max-height: 28vh; }
}

@media (prefers-reduced-motion: reduce) {
  .ko-rays-g { animation: none; }
  .ko-pop.is-on { animation-duration: 0.9s; }
  .ko-rv-card, .ko-toast, .ko-escape { transition: none; }
  .ko-rv-card.is-in, .ko-hud-combo.is-bump .ko-mult { animation: none; }
}
