/* HVSC Game — engine shell (chung cho mọi template) */
@import url("tpl-A.css");
@import url("tpl-F.css");
@import url("styles.css");
.game { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-rows: auto 1fr; background: var(--stage-bg); color: var(--c-ink); font-family: var(--font); overflow: hidden; }
.game-bar { display: flex; align-items: center; gap: .6rem; padding: max(10px, env(safe-area-inset-top)) clamp(10px, 2vw, 40px) 10px; }
.game-title { flex: 1; min-width: 0; font-weight: 800; font-size: clamp(1rem, .8rem + .8vw, 1.6rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-flex; align-items: center; gap: .45em; min-height: clamp(44px, 5.2vh, 64px); padding: 0 1em; border-radius: 999px; background: var(--c-surface); box-shadow: var(--shadow-card); font-weight: 800; font-size: clamp(.95rem, .8rem + .5vw, 1.45rem); font-variant-numeric: tabular-nums; }
.pill .icon { color: var(--c-primary); }
.pill.warn { background: var(--c-bad); color: #fff; animation: pulse 1s infinite; }
.pill.warn .icon { color: #fff; }
.game-bar .btn-icon { width: clamp(44px, 5.2vh, 64px); min-height: clamp(44px, 5.2vh, 64px); background: var(--c-surface); box-shadow: var(--shadow-card); }
.game-bar .btn-icon .icon { width: 1.4em; height: 1.4em; }
.game-progress { position: absolute; left: 0; right: 0; top: 0; height: 5px; background: transparent; }
.game-progress i { display: block; height: 100%; width: 0; background: var(--c-primary); transition: width .4s var(--ease-out); border-radius: 0 4px 4px 0; }
.game-stage { position: relative; min-height: 0; overflow: auto; display: grid; padding: clamp(8px, 2vh, 32px) clamp(12px, 3vw, 64px) clamp(16px, 3vh, 48px); }
.lives { display: inline-flex; gap: 2px; color: var(--c-bad); }
@keyframes pulse { 50% { transform: scale(1.06); } }
@media (max-width: 520px) { .game-bar .hide-xs { display: none; } .pill { padding: 0 .8em; } }

/* Start + result overlay */
.overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 20px; overflow: auto; }
.start-card, .result-card { width: min(720px, 100%); background: var(--c-surface); border-radius: var(--r-xl); box-shadow: var(--shadow-card); padding: clamp(20px, 3.5vw, 56px); display: grid; gap: clamp(12px, 2vh, 24px); justify-items: center; text-align: center; animation: pop .3s var(--ease-out); }
.start-art { width: clamp(140px, 22vmin, 260px); aspect-ratio: 4/3; }
.start-art svg { width: 100%; height: 100%; }
.start-card h1 { font-size: clamp(1.6rem, 1rem + 2.6vw, 3.4rem); font-weight: 900; }
.start-card .meta { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.start-card .meta .badge { font-size: clamp(.8rem, .7rem + .3vw, 1.1rem); padding: .3em .8em; }
.start-card .input { max-width: 420px; text-align: center; font-size: clamp(1rem, .9rem + .4vw, 1.4rem); min-height: clamp(52px, 6vh, 72px); }
.start-card .btn-xl { min-height: clamp(64px, 9vh, 110px); font-size: clamp(1.3rem, 1rem + 1.4vw, 2.4rem); padding: 0 2.2em; }
.kbd-hint { font-size: .85rem; color: var(--c-muted); }
kbd { display: inline-block; min-width: 1.6em; padding: .05em .4em; border-radius: 6px; border: 1px solid var(--c-line); border-bottom-width: 3px; background: var(--c-surface-2); font-family: inherit; font-weight: 700; font-size: .85em; }
@media (max-width: 760px) { .kbd-hint { display: none; } }

.result-card { width: min(1100px, 100%); justify-items: stretch; text-align: left; }
.result-top { display: grid; grid-template-columns: auto 1fr; gap: clamp(16px, 3vw, 48px); align-items: center; }
.score-ring { --p: 0; width: clamp(140px, 22vmin, 260px); aspect-ratio: 1; border-radius: 50%; background: conic-gradient(var(--c-primary) calc(var(--p) * 1%), var(--c-surface-2) 0); display: grid; place-items: center; }
.score-ring > div { width: 78%; aspect-ratio: 1; border-radius: 50%; background: var(--c-surface); display: grid; place-content: center; text-align: center; }
.score-ring b { font-size: clamp(2rem, 1.4rem + 3vw, 4.6rem); font-weight: 900; line-height: 1; }
.score-ring small { color: var(--c-muted); font-weight: 700; }
.result-top h2 { font-size: clamp(1.5rem, 1rem + 2vw, 3rem); font-weight: 900; }
.result-stats { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .8rem; }
.result-cols { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(16px, 2vw, 32px); }
.result-cols h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: .5rem; }
.review { display: grid; gap: .4rem; max-height: 42vh; overflow: auto; padding-right: .3rem; }
.review-row { display: grid; grid-template-columns: 28px 1fr; gap: .5rem; padding: .55rem .7rem; border-radius: 12px; background: var(--c-surface-2); font-size: .95rem; }
.review-row .ok { color: var(--c-ok); } .review-row .bad { color: var(--c-bad); }
.review-row small { color: var(--c-muted); display: block; }
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; counter-reset: rank; }
.board li { display: grid; grid-template-columns: 34px 1fr auto auto; gap: .6rem; align-items: center; padding: .55rem .7rem; border-radius: 12px; background: var(--c-surface-2); counter-increment: rank; font-variant-numeric: tabular-nums; }
.board li::before { content: counter(rank); width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--c-surface); font-weight: 800; }
.board li:nth-child(1)::before { background: #ffc53d; } .board li:nth-child(2)::before { background: #d9d4e8; } .board li:nth-child(3)::before { background: #f3b48a; }
.board li.me { outline: 3px solid var(--c-primary); }
.board .t { color: var(--c-muted); font-size: .85rem; }
.result-actions { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }
@media (max-width: 760px) { .result-top, .result-cols { grid-template-columns: 1fr; justify-items: center; text-align: center; } .result-stats { justify-content: center; } }

/* Feedback flash */
.flash { position: absolute; inset: 0; pointer-events: none; z-index: 4; animation: flash .5s ease-out forwards; }
.flash.ok { background: radial-gradient(circle, color-mix(in srgb, var(--c-ok) 30%, transparent), transparent 70%); }
.flash.bad { background: radial-gradient(circle, color-mix(in srgb, var(--c-bad) 30%, transparent), transparent 70%); }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.confetti { position: absolute; inset: 0; pointer-events: none; z-index: 6; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- Template: Quiz ---------- */
.tq { display: grid; grid-template-rows: auto 1fr auto; gap: clamp(12px, 2.4vh, 36px); width: 100%; max-width: 1760px; margin: 0 auto; min-height: 100%; }
.tq-head { display: flex; justify-content: center; }
.tq-count { font-weight: 800; color: var(--c-muted); font-size: clamp(.95rem, .8rem + .5vw, 1.5rem); }
.tq-q { display: grid; place-items: center; gap: clamp(10px, 2vh, 28px); text-align: center; background: var(--c-surface); border-radius: var(--r-xl); box-shadow: var(--shadow-card); padding: clamp(16px, 3vh, 48px) clamp(16px, 3vw, 64px); }
.tq-q h2 { font-size: clamp(1.35rem, .9rem + 2.4vw, 4rem); font-weight: 800; line-height: 1.2; }
.tq-q img { max-height: min(32vh, 380px); width: auto; border-radius: var(--r); object-fit: contain; }
.tq-opts { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 1.6vw, 28px); }
.tq-opt { position: relative; display: flex; align-items: center; gap: clamp(10px, 1.2vw, 24px); min-height: clamp(64px, 12vh, 150px); padding: 0 clamp(14px, 1.8vw, 36px); border: 0; border-radius: var(--r-lg); background: var(--opt); color: #fff; font-weight: 800; font-size: clamp(1.05rem, .7rem + 1.4vw, 2.6rem); text-align: left; cursor: pointer; box-shadow: 0 6px 0 color-mix(in srgb, var(--opt) 60%, #000); transition: transform .12s var(--ease-out), filter .2s, opacity .2s; touch-action: manipulation; }
.tq-opt:hover:not([disabled]) { transform: translateY(-3px); }
.tq-opt:active:not([disabled]) { transform: translateY(3px); box-shadow: 0 2px 0 color-mix(in srgb, var(--opt) 60%, #000); }
.tq-opt .shape { flex: none; width: clamp(34px, 3vw, 64px); aspect-ratio: 1; border-radius: 12px; background: rgba(255,255,255,.22); display: grid; place-items: center; font-size: .7em; }
.tq-opt .shape svg { width: 62%; height: 62%; fill: #fff; }
.tq-opt .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }
.tq-opt .key { position: absolute; right: 12px; top: 10px; font-size: .45em; opacity: .75; font-weight: 700; }
.tq-opt.dim { opacity: .35; filter: grayscale(.5); }
.tq-opt.ok { outline: 6px solid var(--c-ok); outline-offset: 3px; }
.tq-opt.bad { animation: shake .4s; outline: 6px solid var(--c-bad); outline-offset: 3px; }
.tq-opt .mark { position: absolute; right: -10px; top: -14px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--c-ok); box-shadow: var(--shadow-card); font-size: 1.4rem; }
.tq-opt.bad .mark { color: var(--c-bad); }
@media (max-width: 760px) { .tq-opts { grid-template-columns: 1fr; } .tq-opt .key { display: none; } }

/* ---------- Template: Match up ---------- */
.tm { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .42fr); gap: clamp(14px, 2vw, 40px); width: 100%; max-width: 1760px; margin: 0 auto; align-content: start; }
.tm-rows { display: grid; gap: clamp(8px, 1.4vh, 18px); align-content: start; }
.tm-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(8px, 1vw, 18px); align-items: stretch; }
.tm-prompt { display: flex; align-items: center; gap: .8rem; padding: clamp(10px, 1.2vh, 18px) clamp(12px, 1.2vw, 24px); background: var(--c-surface); border-radius: var(--r); box-shadow: var(--shadow-card); font-weight: 700; font-size: clamp(1rem, .7rem + 1vw, 2rem); min-height: clamp(56px, 8.5vh, 104px); line-height: 1.2; }
.tm-prompt img { width: clamp(44px, 6vh, 88px); height: clamp(44px, 6vh, 88px); object-fit: cover; border-radius: 12px; flex: none; }
.tm-slot { display: flex; align-items: center; justify-content: center; border-radius: var(--r); border: 3px dashed color-mix(in srgb, var(--c-primary) 45%, var(--c-line)); background: color-mix(in srgb, var(--c-surface) 55%, transparent); min-height: clamp(56px, 8.5vh, 104px); padding: 6px; cursor: pointer; transition: background .15s, border-color .15s; }
.tm-slot.hover, .tm-slot:focus-visible { background: var(--c-primary-soft); border-color: var(--c-primary); }
.tm-slot.filled { border-style: solid; border-color: transparent; background: transparent; padding: 0; }
.tm-slot.ok .tm-chip { background: var(--c-ok); box-shadow: 0 4px 0 color-mix(in srgb, var(--c-ok) 60%, #000); }
.tm-slot.bad .tm-chip { background: var(--c-bad); box-shadow: 0 4px 0 color-mix(in srgb, var(--c-bad) 60%, #000); }
.tm-slot .fix { font-size: .8em; opacity: .9; }
.tm-bank { display: flex; flex-wrap: wrap; align-content: flex-start; gap: clamp(8px, 1vw, 16px); padding: clamp(10px, 1.2vw, 20px); border-radius: var(--r-lg); background: color-mix(in srgb, var(--c-surface) 60%, transparent); border: 2px solid var(--c-line); position: sticky; top: 0; }
.tm-bank-title { width: 100%; font-weight: 800; color: var(--c-muted); font-size: .9rem; }
.tm-chip { display: inline-flex; align-items: center; justify-content: center; min-height: clamp(48px, 7vh, 88px); padding: 0 1em; border: 0; border-radius: 14px; background: var(--c-accent); color: #fff; font-weight: 800; font-size: clamp(.95rem, .65rem + .9vw, 1.8rem); cursor: grab; box-shadow: 0 4px 0 color-mix(in srgb, var(--c-accent) 60%, #000); touch-action: none; user-select: none; transition: transform .12s; width: auto; text-align: center; line-height: 1.15; }
.tm-slot .tm-chip { width: 100%; height: 100%; }
.tm-chip.sel { outline: 4px solid var(--c-primary); outline-offset: 3px; transform: translateY(-3px); }
.tm-chip.ghost { position: fixed; z-index: 70; pointer-events: none; transform: rotate(-3deg) scale(1.05); box-shadow: 0 16px 30px rgba(0,0,0,.3); }
.tm-chip.lifting { opacity: .3; }
.tm-foot { grid-column: 1 / -1; display: flex; justify-content: center; gap: .8rem; padding-top: .5rem; }
@media (max-width: 760px) {
  .tm { grid-template-columns: 1fr; }
  .tm-bank { position: sticky; bottom: 0; top: auto; order: 2; background: var(--c-surface); box-shadow: 0 -8px 24px -12px rgba(0,0,0,.25); }
  .tm-foot { order: 3; }
}
/* chống nội dung đẩy rộng khung chơi trên điện thoại */
.game, .game-stage { grid-template-columns: minmax(0, 1fr); }
.game-stage > *, .game-bar > * { min-width: 0; }
.game-bar > .pill, .game-bar > .btn-icon { flex: none; }
@media (max-width: 420px) { .game-bar { gap: .35rem; } .pill { padding: 0 .6em; } .game-bar .btn-icon { width: 40px; min-height: 40px; } }

/* ---- nút 🔊 nghe câu (ctx.sayBtn) + bật/tắt Tự đọc ---- */
.say-btn { display: inline-grid; place-items: center; flex: none; width: clamp(44px, 4.4vh, 52px); height: clamp(44px, 4.4vh, 52px); margin: 0 .35em; border: 0; border-radius: 50%; background: var(--c-surface); box-shadow: var(--shadow-card), inset 0 0 0 2px var(--c-primary); font-size: clamp(1rem, .8rem + .6vw, 1.5rem); line-height: 1; cursor: pointer; vertical-align: middle; color: inherit; }
.say-btn:hover { transform: scale(1.08); }
.say-btn:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 2px; }
.say-toggle[aria-pressed="false"] { opacity: .5; filter: grayscale(1); }

/* ===== Khung chơi kiểu game lớp học trên máy tính: nằm giữa trang, vừa đủ màn hình (không phải cuộn), toàn màn hình khi bấm nút ⛶ / phím F ===== */
@media (min-width: 1001px) {
  body[data-view="play"][data-playmode="window"] { background: #fff; }
  body[data-view="play"][data-playmode="window"] .app-header { display: flex; }
  body[data-view="play"][data-playmode="window"] .app-main { padding: 0 var(--page-pad) var(--sp-6); }
  body[data-view="play"][data-playmode="window"] .game {
    position: relative; inset: auto; z-index: 1; margin: 12px auto 0;
    width: min(100%, 1280px); height: max(520px, calc(100dvh - var(--header-h) - 28px));
    border-radius: 12px; box-shadow: 0 2px 12px rgba(16, 24, 40, .12); border: 1px solid #dfe3e8;
  }
}
.tq-opt .key { font-size: .55em; opacity: 1; background: rgba(255,255,255,.28); border-radius: 8px; min-width: 1.7em; text-align: center; padding: .1em .35em; }
@media (max-width: 760px) { .tq-opt .key { display: block; } }
/* điện thoại/máy tính bảng: cũng chơi trong khung dưới thanh đầu trang (như game lớp học), bấm ⛶ mới toàn màn hình */
@media (max-width: 1000px) {
  body[data-view="play"][data-playmode="window"] .app-header { display: flex; }
  body[data-view="play"][data-playmode="window"] .app-main { padding: 0 8px 8px; }
  body[data-view="play"][data-playmode="window"] .game { position: relative; inset: auto; z-index: 1; margin-top: 8px; height: calc(100dvh - var(--header-h) - 20px); border-radius: 12px; border: 1px solid #dfe3e8; box-shadow: 0 2px 12px rgba(16,24,40,.12); }
  body[data-view="play"][data-playmode="window"] { background: #fff; }
}

/* trong khung cửa sổ, co nội dung để vừa khung, không phải cuộn */
body[data-view="play"][data-playmode="window"] .game-stage { padding: clamp(8px, 1.4vh, 20px) clamp(12px, 2vw, 40px) clamp(10px, 1.6vh, 24px); }
body[data-view="play"][data-playmode="window"] .tq-q img { max-height: min(26vh, 300px); }
body[data-view="play"][data-playmode="window"] .tq-q { padding: clamp(10px, 2vh, 28px) clamp(14px, 2vw, 40px); }
body[data-view="play"][data-playmode="window"] .tq-opt { min-height: clamp(52px, 9vh, 110px); }
body[data-view="play"][data-playmode="window"] .tm-slot, body[data-view="play"][data-playmode="window"] .tm-prompt { min-height: clamp(48px, 7vh, 84px); }
body[data-view="play"][data-playmode="window"] .tm-chip { min-height: clamp(44px, 6vh, 72px); }

/* ===== Trang chơi kiểu game lớp học (views/play.js): khung 16:10 + cột phải, dưới là thông tin bài + bảng xếp hạng ===== */
@font-face { font-family: "HV Montserrat"; src: url("../assets/fonts/Montserrat-VF.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "HV Patrick Hand"; src: url("../assets/fonts/PatrickHand-Regular.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "HV Playfair"; src: url("../assets/fonts/PlayfairDisplay-VF.ttf") format("truetype"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "HV Oswald"; src: url("../assets/fonts/Oswald-VF.ttf") format("truetype"); font-weight: 200 700; font-display: swap; }
.game[data-font] :is(button, input, h1, h2, h3, .pill) { font-family: inherit; }

.game-tools { display: flex; align-items: center; gap: inherit; flex: none; min-width: 0; }
.play-page { --side-w: clamp(240px, 18vw, 280px); --play-gap: 16px; width: 100%; max-width: 1560px; margin: 0 auto; padding: 12px var(--page-pad) 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.play-top { display: grid; gap: var(--play-gap); align-items: start; justify-content: center;
  grid-template-columns: minmax(0, min(calc(100% - var(--side-w) - var(--play-gap)), calc((100dvh - var(--header-h) - 26px) * 1.6))) var(--side-w); }
.play-frame { position: relative; min-width: 0; width: 100%; aspect-ratio: 16 / 10; min-height: 0; }
body[data-view="play"][data-playmode="window"] .play-frame > .game { position: absolute; inset: 0; margin: 0; width: 100%; height: 100%; z-index: 1; }
.play-side { display: grid; gap: 12px; align-content: start; min-width: 0; }
@media (min-width: 1001px) { .play-top { align-items: stretch; } .play-side { height: 0; min-height: 100%; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-right: 2px; } }
.side-sec { position: relative; background: linear-gradient(180deg, #fff, #fbfcfe); border: 1px solid #e3e7ee; border-radius: 16px; padding: 12px 12px 13px; display: grid; gap: 9px; min-width: 0;
  box-shadow: 0 1px 2px rgba(16,24,40,.05), 0 10px 24px -16px rgba(16,24,40,.28); transition: box-shadow .25s ease, transform .25s ease; animation: playRise .45s cubic-bezier(.2,.8,.2,1) both; }
.side-sec:nth-child(2) { animation-delay: .06s; } .side-sec:nth-child(3) { animation-delay: .12s; }
.side-sec:hover { box-shadow: 0 1px 2px rgba(16,24,40,.06), 0 16px 32px -16px rgba(16,24,40,.34); }
.side-sec h3 { display: flex; align-items: center; gap: .45rem; font-size: .76rem; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; color: #5b6475; margin: 0; }
.side-sec h3::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: linear-gradient(135deg, var(--c-primary), #8b5cf6); box-shadow: 0 0 0 3px var(--c-primary-soft); }
.side-sec:nth-child(2) h3::before { background: linear-gradient(135deg, #f97316, #f43f5e); box-shadow: 0 0 0 3px #ffe4d6; }
.side-sec:nth-child(3) h3::before { background: linear-gradient(135deg, #10b981, #06b6d4); box-shadow: 0 0 0 3px #d5f5ea; }
.side-note { margin: 0; font-size: .74rem; color: var(--c-muted); line-height: 1.35; }
.switch-btn { display: grid; grid-template-columns: auto 1fr auto; column-gap: .6rem; justify-items: start; text-align: left; width: 100%; min-height: 56px; padding: .5rem .8rem; border-radius: 14px;
  background: linear-gradient(135deg, var(--c-primary-soft), #f1ebff); transition: transform .18s ease, box-shadow .2s ease; }
.switch-btn::after { content: "›"; grid-row: 1 / span 2; grid-column: 3; align-self: center; font-size: 1.5rem; line-height: 1; color: var(--c-primary); transition: transform .25s ease; }
.switch-btn[aria-expanded="true"]::after { transform: rotate(90deg); }
.switch-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px -10px var(--c-primary); }
.switch-btn .icon { grid-row: span 2; align-self: center; width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: #fff; color: var(--c-primary); box-shadow: 0 2px 6px -2px rgba(16,24,40,.25); transition: transform .35s ease; }
.switch-btn:hover .icon { transform: rotate(180deg); }
.switch-btn span { font-weight: 800; }
.switch-btn small { font-size: .78rem; color: var(--c-muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
body[data-view="play"] .play-side .switch-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-height: min(52vh, 460px); overflow: auto; padding: 2px; animation: playRise .3s ease both; }
body[data-view="play"] .play-side .switch-list[hidden] { display: none; }
body[data-view="play"] .play-side .switch-item { width: auto; transition: transform .16s ease, box-shadow .2s ease; }
body[data-view="play"] .play-side .switch-item:hover { transform: translateY(-2px); }
.play-side .style-picker { gap: .4rem; }
.play-side .style-opt { font-size: .85rem; transition: transform .16s ease; }
.play-side .style-opt:hover { transform: translateY(-1px); }
.font-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.font-opt { min-height: 42px; padding: .3rem .5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 2px solid #e6e9ef; border-radius: 12px; background: #fff; color: var(--c-ink); font-size: .92rem; font-weight: 700; cursor: pointer; line-height: 1.15;
  transition: transform .16s ease, border-color .2s ease, box-shadow .2s ease, background .2s ease; }
.font-opt:hover { transform: translateY(-1px); border-color: #cfd5df; box-shadow: 0 6px 14px -10px rgba(16,24,40,.4); }
.font-opt:active { transform: scale(.97); }
.font-opt[aria-pressed="true"] { border-color: var(--c-primary); background: var(--c-primary-soft); color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-soft); }
.font-opt:focus-visible, .switch-btn:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 2px; }

.play-info { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; padding: 18px 20px; border-radius: 18px; background: linear-gradient(120deg, #fff 55%, #f4f0ff);
  border: 1px solid #e6e3f3; box-shadow: 0 1px 2px rgba(16,24,40,.05), 0 14px 30px -20px rgba(76,29,149,.35); animation: playRise .5s cubic-bezier(.2,.8,.2,1) .05s both; }
.play-info-txt { min-width: 0; flex: 1 1 380px; }
.play-title { margin: 0; font-size: clamp(1.3rem, 1rem + 1vw, 1.95rem); font-weight: 900; line-height: 1.2; letter-spacing: -.01em; overflow-wrap: anywhere; text-wrap: balance; }
.play-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: .55rem 0 0; color: #5b6475; font-weight: 700; font-size: .88rem; }
.meta-who { display: inline-flex; align-items: center; gap: .45rem; margin-right: 4px; color: var(--c-ink); }
.meta-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .65rem; border-radius: 999px; background: #eef1f6; }
.meta-chip.tpl { background: var(--c-primary-soft); color: var(--c-primary); }
.meta-chip .icon { width: 1em; height: 1em; }
.play-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.play-actions .btn { min-height: 44px; border-radius: 12px; transition: transform .16s ease, box-shadow .2s ease, background .2s ease; }
.play-actions .btn:hover { transform: translateY(-2px); box-shadow: 0 10px 18px -12px rgba(16,24,40,.5); }
.play-actions .btn:active { transform: translateY(0) scale(.97); }

.play-board { display: grid; gap: 0; max-width: 820px; border-radius: 18px; overflow: hidden; background: #fff; border: 1px solid #cdebdc;
  box-shadow: 0 1px 2px rgba(16,24,40,.05), 0 18px 36px -22px rgba(5,122,85,.45); animation: playRise .55s cubic-bezier(.2,.8,.2,1) .1s both; }
.lb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(120deg, #0f9f6e, #22c55e 60%, #4ade80); }
.lb-head::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.28) 50%, transparent 70%); transform: translateX(-100%); animation: lbShine 4.5s ease-in-out 1s infinite; pointer-events: none; }
.play-board h2 { display: flex; align-items: center; gap: .55rem; margin: 0; font-size: 1.2rem; font-weight: 900; text-shadow: 0 1px 2px rgba(0,0,0,.18); }
.play-board h2 .icon { color: #ffd84d; width: 1.35em; height: 1.35em; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); animation: lbStar 2.6s ease-in-out infinite; }
.lb-count { font-size: .8rem; font-weight: 800; padding: .25rem .7rem; border-radius: 999px; background: rgba(255,255,255,.22); }
.lb-count:empty { display: none; }
.lb-wrap { overflow: hidden; }
.lb { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; background: #fff; table-layout: fixed; }
.lb th { background: #effaf4; color: #0b7a52; text-align: left; font-weight: 800; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; padding: .55rem .9rem; border-bottom: 1px solid #d6efe2; }
.lb td { padding: .5rem .9rem; border-top: 1px solid #edf5f0; font-weight: 700; transition: background .2s ease; }
.lb tbody tr { animation: lbRow .45s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 45ms); }
.lb tbody tr:nth-child(even) td { background: #f7fcf9; }
.lb tbody tr:hover td { background: #eafaf1; }
.lb tr.me td { background: #fff6d6 !important; }
.lb tr.me .lb-name > span:last-child::after { content: " (bạn)"; color: #b7791f; font-weight: 800; }
.lb th:nth-child(1), .lb td:nth-child(1) { width: 4.6rem; text-align: center; }
.lb th:nth-child(3), .lb td:nth-child(3), .lb th:nth-child(4), .lb td:nth-child(4) { width: 6.5rem; text-align: right; }
.lb td:nth-child(3) { color: #0b7a52; font-weight: 900; font-size: 1.05rem; }
.lb td:nth-child(4) { color: #5b6475; }
.lb-name { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.lb-name > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-ava { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-size: .85rem; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, hsl(var(--hue, 210) 75% 58%), hsl(calc(var(--hue, 210) + 40) 70% 48%)); box-shadow: 0 2px 6px -2px hsl(var(--hue, 210) 60% 40% / .6); }
.lb-rank { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: #e8f3ed; color: #3f5a4c; font-weight: 900; }
.lb-rank.r1, .lb-rank.r2, .lb-rank.r3 { border-radius: 50%; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.25); position: relative; }
.lb-rank.r1 { background: radial-gradient(circle at 35% 30%, #fff3b0, #f5b301 55%, #c98a00); box-shadow: 0 0 0 3px #fff1c2, 0 4px 10px -3px #c98a00; animation: lbGold 2.4s ease-in-out infinite; }
.lb-rank.r2 { background: radial-gradient(circle at 35% 30%, #fff, #b8c1cc 55%, #8a94a3); box-shadow: 0 0 0 3px #eef1f5, 0 4px 10px -3px #8a94a3; }
.lb-rank.r3 { background: radial-gradient(circle at 35% 30%, #ffe0c7, #e08a4f 55%, #b5612b); box-shadow: 0 0 0 3px #fbe6d6, 0 4px 10px -3px #b5612b; }
.lb tbody tr:nth-child(1) td { background: #fffbea; }
.lb th { white-space: nowrap; }
.lb-rank.r1 { color: #6b4700; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.lb-empty { text-align: center; color: var(--c-muted); padding: 1.4rem 1rem !important; font-weight: 700; }
@keyframes playRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes lbRow { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
@keyframes lbShine { 0%, 60% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes lbStar { 0%, 100% { transform: rotate(0) scale(1); } 50% { transform: rotate(-12deg) scale(1.12); } }
@keyframes lbGold { 0%, 100% { box-shadow: 0 0 0 3px #fff1c2, 0 4px 10px -3px #c98a00; } 50% { box-shadow: 0 0 0 5px #ffe58a, 0 6px 16px -3px #e0a100; } }
@media (prefers-reduced-motion: reduce) { .side-sec, .play-info, .play-board, .lb tbody tr, .lb-head::after, .play-board h2 .icon, .lb-rank.r1, .switch-list { animation: none !important; } }
.play-page > .ai-credits, .play-page > :last-child:not(.play-board) { max-width: 100%; }
body[data-view="play"][data-playmode="full"] .play-side { visibility: hidden; }
/* cột phải đã có Kiểu nền → ẩn nút trùng trên thanh khung (vẫn có khi toàn màn hình) */
body[data-playmode="window"] .play-frame .game-bar .style-btn { display: none; }

/* khung chơi nhỏ hơn màn hình → co thanh trên + nội dung cho vừa khung */
@media (min-width: 1001px) {
  body[data-view="play"][data-playmode="window"] .play-frame .game-bar { padding: 8px 14px; }
  body[data-view="play"][data-playmode="window"] .play-frame .pill { min-height: 40px; font-size: 1rem; }
  body[data-view="play"][data-playmode="window"] .play-frame .game-bar .btn-icon { width: 40px; min-height: 40px; }
  body[data-view="play"][data-playmode="window"] .play-frame .game-title { font-size: 1.15rem; }
  /* màn bắt đầu/kết quả co theo khung */
  body[data-view="play"][data-playmode="window"] .play-frame .start-card { padding: clamp(16px, 2.4vh, 32px) clamp(18px, 2.4vw, 40px); gap: clamp(8px, 1.4vh, 16px); }
  body[data-view="play"][data-playmode="window"] .play-frame .start-art { width: clamp(110px, 15vh, 180px); }
  body[data-view="play"][data-playmode="window"] .play-frame .start-card h1 { font-size: clamp(1.4rem, .8rem + 1.6vw, 2.4rem); line-height: 1.15; }
  body[data-view="play"][data-playmode="window"] .play-frame .start-card .btn-xl { min-height: clamp(54px, 7.5vh, 78px); font-size: clamp(1.15rem, .9rem + .8vw, 1.7rem); }
  body[data-view="play"][data-playmode="window"] .play-frame .result-card { padding: clamp(14px, 2vh, 28px); gap: 12px; }
  body[data-view="play"][data-playmode="window"] .play-frame .score-ring { width: clamp(110px, 16vh, 170px); }
  body[data-view="play"][data-playmode="window"] .play-frame .review { max-height: 24vh; }
}
/* máy tính bảng/điện thoại: cột phải xuống dưới khung, khung cao gần hết màn hình */
@media (max-width: 1000px) {
  .play-page { padding: 8px 8px 28px; gap: 14px; }
  .play-top { grid-template-columns: minmax(0, 1fr); }
  .play-frame { aspect-ratio: auto; height: calc(100dvh - var(--header-h) - 18px); min-height: 460px; }
  .play-side { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  body[data-view="play"][data-playmode="full"] .play-side { display: none; }
  .play-top { display: contents; }
  .play-page > * , .play-top > * { min-width: 0; }
  .play-frame { order: 1; } .play-info { order: 2; } .play-side { order: 3; } .play-board { order: 4; width: 100%; max-width: none; } .play-page > .ai-credits { order: 5; }
}
@media (max-width: 760px) {
  body[data-view="play"] .app-header { height: 46px; --header-h: 46px; }
  body[data-view="play"] { --header-h: 46px; }
  body[data-view="play"] .brand-logo { width: 96px; }
  body[data-view="play"] .app-header .btn-icon { width: 36px; min-height: 36px; }
  .play-info { flex-direction: column; align-items: stretch; }
  .play-info-txt { flex: none; }
  .play-actions .btn { flex: 1 1 auto; justify-content: center; }
  .play-info { padding: 14px; border-radius: 16px; }
  .lb th, .lb td { padding: .5rem .45rem; }
  .lb th:nth-child(1), .lb td:nth-child(1) { width: 3rem; }
  .lb th:nth-child(3), .lb td:nth-child(3) { width: 3.4rem; }
  .lb th:nth-child(4), .lb td:nth-child(4) { width: 4.9rem; }
  .lb th { font-size: .68rem; letter-spacing: .03em; }
  .lb-ava { width: 26px; height: 26px; font-size: .78rem; }
  .lb-name { gap: .45rem; }
}
/* điện thoại: thanh trên 1 hàng (tên bài tối đa 2 dòng nhỏ bên trái, nút gọn bên phải, nút X luôn trong khung) */
@media (max-width: 600px) {
  .game-bar { flex-wrap: nowrap; gap: 6px; padding: max(6px, env(safe-area-inset-top)) 8px 6px 10px; align-items: center; }
  .game-title { flex: 1 1 auto; min-width: 0; white-space: normal; text-overflow: clip; font-size: .9rem; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
  .game-tools { flex: none; justify-content: flex-end; gap: 3px; flex-wrap: nowrap; }
  .game-tools > .pill { min-height: 32px; padding: 0 .45em; font-size: .85rem; gap: .25em; }
  .game-tools > .pill.lives { padding: 0 .25em; }
  .game-tools > .pill .icon { width: .95em; height: .95em; }
  .game-tools > .btn-icon { width: 32px !important; min-height: 32px !important; }
  .game-tools > .btn-icon .icon { width: 1.1em; height: 1.1em; }
  .game-bar .embed-brand { flex: none; }
}
@media (max-width: 360px) { .game-tools > .full-hide-xs, .game-tools > .btn-icon[aria-label^="Toàn màn"] { display: none; } }
/* lớp phủ bắt đầu/kết quả: nội dung cao hơn khung thì cuộn từ đầu (không bị cắt phía trên như place-items:center) */
.overlay { display: flex; flex-direction: column; align-items: center; }
.overlay > * { margin: auto; flex: none; }
@media (max-width: 760px) {
  .result-cols { text-align: left; justify-items: stretch; }
  .result-cols > * { min-width: 0; width: 100%; }
  .result-cols h3 { text-align: left; }
}
@media (max-width: 600px) {
  .overlay { padding: 8px; }
  .result-card { padding: 14px 12px; gap: 12px; border-radius: 18px; }
  .result-top { grid-template-columns: auto 1fr !important; justify-items: start !important; text-align: left !important; gap: 12px; }
  .result-top .score-ring { width: 96px; }
  .result-top .score-ring b { font-size: 1.6rem; }
  .result-top h2 { font-size: 1.2rem; line-height: 1.2; }
  .result-top .muted { font-size: .85rem; overflow-wrap: anywhere; }
  .result-stats { justify-content: flex-start !important; margin-top: .4rem; gap: .35rem; }
  .result-stats .pill { min-height: 30px; font-size: .85rem; }
  .review { max-height: none; overflow: visible; padding-right: 0; }
  .review-row { grid-template-columns: 20px minmax(0, 1fr); gap: .45rem; padding: .5rem .6rem; font-size: .9rem; align-items: start; text-align: left; }
  .review-row > span:first-child { display: grid; place-items: center; height: 1.35em; }
  .review-row b { overflow-wrap: anywhere; }
  .result-actions .btn-lg { flex: 1 1 auto; min-height: 46px; }
}
/* trang chơi: bảng xếp hạng đã có ngay dưới khung → trên máy nhỏ bỏ bản trùng trong màn kết quả cho gọn */
body[data-view="play"][data-playmode="window"] .play-frame .result-board { display: none; }
body[data-view="play"][data-playmode="window"] .play-frame .result-cols { grid-template-columns: 1fr; }
@media (min-width: 1001px) { body[data-view="play"][data-playmode="window"] .play-frame .review { grid-template-columns: 1fr 1fr; align-content: start; } }
}
/* khung thấp (nhúng iframe, máy tính bảng ngang): màn bắt đầu/kết quả co theo chiều cao, không bị cắt */
@media (max-height: 640px) {
  .game .start-card { padding: clamp(12px, 3vh, 26px) clamp(16px, 3vw, 32px); gap: clamp(6px, 1.6vh, 12px); }
  .game .start-art { width: clamp(70px, 14vh, 120px); }
  .game .start-card h1 { font-size: clamp(1.2rem, .6rem + 3vh, 2rem); line-height: 1.15; }
  .game .start-card .btn-xl { min-height: clamp(46px, 9vh, 64px); font-size: clamp(1.05rem, .7rem + 2vh, 1.45rem); }
}

/* ===== Điện thoại: khung chơi tràn hết chiều rộng + cao (bỏ thanh đầu trang, lề, bo góc) — thanh trình duyệt đã ăn chiều cao nên không để thêm chrome ===== */
@media (max-width: 700px) {
  /* header + menu dưới KHÔNG đè lên game: nằm ngay dưới khung chơi, cuộn xuống 1 chút là thấy */
  body[data-view="play"][data-playmode="window"] #app { display: flex; flex-direction: column; min-height: 100dvh; }
  body[data-view="play"][data-playmode="window"] .app-main, body[data-view="play"][data-playmode="window"] .play-page { display: contents; }
  body[data-view="play"][data-playmode="window"] .play-frame { order: 1; }
  body[data-view="play"][data-playmode="window"] .app-header { order: 2; position: static; display: flex; margin-top: 8px; }
  body[data-view="play"][data-playmode="window"] .app-tabbar-fix, body[data-view="play"][data-playmode="window"] nav.tabbar { order: 3; display: grid !important; position: static; margin: 8px 12px 8px; width: auto; }
  body[data-view="play"][data-playmode="window"] .play-info { order: 12; } body[data-view="play"][data-playmode="window"] .play-side { order: 13; }
  body[data-view="play"][data-playmode="window"] .play-board { order: 14; } body[data-view="play"][data-playmode="window"] .play-page > .ai-credits { order: 15; }
  body[data-view="play"][data-playmode="window"] .play-page { padding-inline: 0; }
  body[data-view="play"][data-playmode="window"] .play-top { gap: 8px; }
  body[data-view="play"][data-playmode="window"] .play-frame { aspect-ratio: auto; height: 100dvh; }
  body[data-view="play"][data-playmode="window"] .play-frame > .game { margin: 0; border-radius: 0; border: 0; box-shadow: none; width: 100%; height: 100%; }
  body[data-view="play"][data-playmode="window"] .play-frame .game-bar { padding: max(4px, env(safe-area-inset-top)) 6px 4px 8px; }
  body[data-view="play"][data-playmode="window"] .game-stage { padding: 6px 8px max(8px, env(safe-area-inset-bottom)); }
  body[data-view="play"][data-playmode="window"] .play-side, body[data-view="play"][data-playmode="window"] .play-info, body[data-view="play"][data-playmode="window"] .play-board { margin-inline: 8px; }
}
/* nút đổi mẫu trên thanh + bảng chọn ngay trong khung */
.game .switch-pop { position: absolute; z-index: 60; top: 52px; right: 6px; left: 6px; max-width: 460px; margin-left: auto; max-height: calc(100% - 64px); overflow: auto; background: #fff; color: #1b2330; border-radius: 12px; padding: 10px; box-shadow: 0 10px 30px rgba(16,24,40,.28); border: 1px solid #dfe3e8; }
.game .switch-pop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.game .switch-pop .switch-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; overflow: visible; }
.game .switch-pop .switch-item { width: auto; display: grid; gap: 6px; padding: 6px; border: 1px solid #dfe3e8; border-radius: 8px; background: #fff; cursor: pointer; font: inherit; color: inherit; text-align: center; min-height: 44px; }
.game .switch-pop .switch-item[aria-current="true"] { border-color: #1f6feb; box-shadow: 0 0 0 2px #cfe0fc; }
.game .switch-pop .switch-thumb { display: block; aspect-ratio: 16/10; background: #f3f4f6; border-radius: 6px; overflow: hidden; }
.game .switch-pop .switch-thumb svg { width: 100%; height: 100%; }
.game .switch-pop .switch-name { font-size: .8rem; font-weight: 700; }
/* thanh trên điện thoại: nút bấm ≥40px */
@media (max-width: 520px) { .game-tools > .btn-icon { width: 38px !important; min-height: 38px !important; } .game-tools { gap: 2px; } }
@media (max-width: 360px) { .game-tools > .btn-icon[aria-label^="Toàn màn"] { display: inline-grid; } }
@media (max-width: 700px) { body[data-view="play"] .play-board { overflow-x: auto; } body[data-view="play"] .play-board table { max-width: 100%; } }
@media (max-width: 700px) { body[data-view="play"][data-playmode="window"] :is(.play-side,.play-info,.play-board) { width: auto; max-width: calc(100vw - 16px); box-sizing: border-box; } }

/* Cột phải trên điện thoại: không để nút/nhãn dài đẩy trang rộng ra (Giọng đọc, Nguồn giọng…) */
.play-side > *, .play-side .side-sec { min-width: 0; max-width: 100%; box-sizing: border-box; }
.play-side .font-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; }
.play-side .font-opt, .play-side .btn { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: center; line-height: 1.25; }
.play-side h3 { overflow-wrap: anywhere; }

/* HUD hẹp (mẫu có thanh mạng như mê cung): cho nút xuống dòng thay vì tràn mất nút Thoát */
@media (max-width: 520px) {
  .game-bar { flex-wrap: wrap; row-gap: 4px; }
  .game-tools { flex-wrap: wrap; justify-content: flex-end; gap: 4px; max-width: 100%; min-width: 0; margin-left: auto; }
  .game-tools > .pill, .game-tools > .game-pill { padding-inline: 8px; }
}

/* v-gập: cột phải gọn, mục gập/mở bằng +/− (02/11) */
.play-side { gap: 8px; }
.side-sec { padding: 8px 10px; gap: 8px; }
.side-sec[data-open="0"] { padding-block: 4px; }
.side-sec h3 { display: block; }
.side-sec h3::before { display: none; }
.side-tog { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: .45rem; width: 100%; min-height: 36px; cursor: pointer; font: inherit; font-size: .76rem; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; color: #5b6475; }
.side-tog::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 3px; background: linear-gradient(135deg, var(--c-primary), #8b5cf6); box-shadow: 0 0 0 3px var(--c-primary-soft); }
.side-sec:nth-child(2) .side-tog::before { background: linear-gradient(135deg, #f97316, #f43f5e); box-shadow: 0 0 0 3px #ffe4d6; }
.side-sec:nth-child(3) .side-tog::before { background: linear-gradient(135deg, #10b981, #06b6d4); box-shadow: 0 0 0 3px #d5f5ea; }
.side-ttl { flex: 1; }
.side-pm { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: #eef1f6; color: #374151; font-size: 1.1rem; font-weight: 800; line-height: 1; letter-spacing: 0; }
.side-tog:hover .side-pm { background: var(--c-primary-soft); color: var(--c-primary); }
.side-tog:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 2px; border-radius: 8px; }
.side-body { display: grid; gap: 8px; min-width: 0; }
.side-body[hidden] { display: none; }
.play-side .font-picker { display: flex; flex-wrap: wrap; gap: 5px; }
.play-side .font-opt { flex: 1 1 auto; min-height: 34px; padding: .2rem .6rem; font-size: .84rem; white-space: nowrap; overflow-wrap: normal; border-width: 1.5px; border-radius: 10px; }
.play-side .btn.switch-btn { min-height: 44px; }
.play-side .btn:not(.switch-btn) { min-height: 36px; font-size: .84rem; padding: .3rem .6rem; }
.fs-row { display: flex; align-items: center; gap: 6px; }
.fs-lbl { flex: 1; font-size: .8rem; font-weight: 700; color: #5b6475; }
.fs-val { min-width: 2.6rem; text-align: center; font-size: .8rem; font-weight: 800; }
.fs-btn { min-width: 44px; min-height: 36px; padding: 0 .5rem; border: 1.5px solid #e6e9ef; border-radius: 10px; background: #fff; color: var(--c-ink); font: inherit; font-weight: 800; font-size: .88rem; cursor: pointer; }
.fs-btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.play-side .style-picker { grid-template-columns: repeat(2, 1fr); }
.game-stage { zoom: var(--fs-scale, 1); }
/* một thanh cuộn thôi: cột phải chỉ cuộn khi mục mở dài; khung trò chơi không hiện thanh cuộn riêng */
.play-side { scrollbar-width: thin; }
body[data-view="play"] .play-frame .game-stage { scrollbar-width: none; }
body[data-view="play"] .play-frame .game-stage::-webkit-scrollbar { display: none; }

/* thanh mở/thu gọn tất cả: icon nhỏ */
.side-tools { display: flex; justify-content: flex-end; gap: 4px; margin: 0 0 4px; }
.side-all { width: 28px; height: 28px; min-width: 0; padding: 0; border-radius: 8px; border: 1px solid var(--line, #dde3ee); background: #fff; color: #5b6478; display: inline-grid; place-items: center; cursor: pointer; }
.side-all:hover, .side-all:focus-visible { background: #eef3ff; color: #2455d6; }

/* Phông chữ thêm (Google Fonts, giấy phép OFL; tự host; chỉ tải khi dùng). Tập vietnamese+latin+latin-ext. */
@font-face {
  font-family: "HV Nunito";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../assets/fonts/g/Nunito-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "HV Nunito";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../assets/fonts/g/Nunito-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "HV Nunito";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../assets/fonts/g/Nunito-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "HV Quicksand";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/g/Quicksand-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "HV Quicksand";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/g/Quicksand-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "HV Quicksand";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/g/Quicksand-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "HV Baloo 2";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../assets/fonts/g/Baloo2-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "HV Baloo 2";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../assets/fonts/g/Baloo2-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "HV Baloo 2";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../assets/fonts/g/Baloo2-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "HV Lexend";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../assets/fonts/g/Lexend-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "HV Lexend";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../assets/fonts/g/Lexend-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "HV Lexend";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../assets/fonts/g/Lexend-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "HV Comfortaa";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/g/Comfortaa-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "HV Comfortaa";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/g/Comfortaa-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "HV Comfortaa";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/g/Comfortaa-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "HV Pacifico";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/g/Pacifico-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "HV Pacifico";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/g/Pacifico-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "HV Pacifico";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/g/Pacifico-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "HV Dancing Script";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/g/DancingScript-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "HV Dancing Script";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/g/DancingScript-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "HV Dancing Script";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/g/DancingScript-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "HV Lobster";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/g/Lobster-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "HV Lobster";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/g/Lobster-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "HV Lobster";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/g/Lobster-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "HV Merriweather";
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url("../assets/fonts/g/Merriweather-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "HV Merriweather";
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url("../assets/fonts/g/Merriweather-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "HV Merriweather";
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url("../assets/fonts/g/Merriweather-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "HV Merriweather";
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: swap;
  src: url("../assets/fonts/g/Merriweather-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "HV Merriweather";
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: swap;
  src: url("../assets/fonts/g/Merriweather-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "HV Merriweather";
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: swap;
  src: url("../assets/fonts/g/Merriweather-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "HV Roboto Slab";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../assets/fonts/g/RobotoSlab-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "HV Roboto Slab";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../assets/fonts/g/RobotoSlab-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "HV Roboto Slab";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../assets/fonts/g/RobotoSlab-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "HV Anton";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/g/Anton-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "HV Anton";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/g/Anton-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "HV Anton";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/g/Anton-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "HV Bangers";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/g/Bangers-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "HV Bangers";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/g/Bangers-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "HV Bangers";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/g/Bangers-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "HV Mali";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/g/Mali-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "HV Mali";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/g/Mali-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "HV Mali";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/g/Mali-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "HV Mali";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/g/Mali-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "HV Mali";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/g/Mali-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "HV Mali";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/g/Mali-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---- Cửa sổ chọn mẫu (thoáng) ---- */
.modal.modal-wide { width: min(980px, 100%); }
.modal-wide .sw-body { display: grid; gap: 22px; }
.modal-wide .sw-sec h3 { margin: 0 0 10px; font-size: 1rem; font-weight: 800; }
.modal-wide .sw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.modal-wide .switch-item { width: auto !important; display: grid; gap: 8px; padding: 10px; border: 1px solid var(--c-line); border-radius: 14px; background: var(--c-surface); cursor: pointer; font: inherit; color: inherit; text-align: center; min-height: 44px; transition: transform .16s ease, box-shadow .2s ease; }
.modal-wide .switch-item:hover { transform: translateY(-2px); box-shadow: 0 8px 20px -10px rgba(0,0,0,.35); }
.modal-wide .switch-item[aria-current="true"] { border-color: #1f6feb; box-shadow: 0 0 0 3px #cfe0fc; }
.modal-wide .switch-thumb { display: block; aspect-ratio: 16/10; background: #f3f4f6; border-radius: 10px; overflow: hidden; }
.modal-wide .switch-thumb svg { width: 100%; height: 100%; }
.modal-wide .switch-name { font-weight: 700; font-size: .95rem; }
.modal-wide .switch-note { color: var(--c-muted); font-size: .78rem; margin-top: -4px; }
@media (max-width: 520px) { .modal-wide .sw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }

/* ---- Bảng âm thanh ---- */
.game .snd-pop { position: absolute; z-index: 60; top: 52px; right: 6px; width: min(340px, calc(100% - 12px)); background: #fff; color: #1b2330; border-radius: 14px; padding: 14px; box-shadow: 0 12px 34px rgba(16,24,40,.3); border: 1px solid #dfe3e8; display: grid; gap: 12px; }
.snd-head { display: flex; align-items: center; justify-content: space-between; }
.snd-mute { min-height: 44px; border-radius: 10px; border: 1px solid #dfe3e8; background: #f5f6f8; font: inherit; font-weight: 700; cursor: pointer; }
.snd-mute[aria-pressed="true"] { background: #fde8e8; border-color: #f5b5b5; }
.snd-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-weight: 700; }
.snd-row input[type=range] { width: 100%; min-height: 32px; accent-color: #e31e25; }
.snd-pct { min-width: 3ch; text-align: right; }
.snd-sub { font-weight: 800; font-size: .85rem; color: #52514e; }
.snd-packs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.snd-pack { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 10px; border: 1px solid #dfe3e8; border-radius: 12px; background: #fff; font: inherit; font-weight: 700; font-size: .85rem; cursor: pointer; text-align: left; }
.snd-pack[aria-pressed="true"] { border-color: #1f6feb; box-shadow: 0 0 0 2px #cfe0fc; background: #f2f7ff; }
.snd-emo { font-size: 1.4rem; }
.snd-note { margin: 0; font-size: .75rem; color: #6b7280; }

.name-row { display: flex; gap: 8px; align-items: center; justify-content: center; width: min(420px, 100%); }
.name-row .input { flex: 1 1 auto; min-width: 0; }
.name-dice { min-width: 48px; min-height: 48px; font-size: 1.4rem; flex: none; }

/* Máy tính: khung chơi cao TỰ ĐỘNG theo nội dung (tối thiểu tỉ lệ 16:10), không cuộn trong khung. Điện thoại/tablet vẫn khung cố định cho dễ thao tác. */
@media (min-width: 1001px) {
  body[data-view="play"][data-playmode="window"] .play-frame { display: grid; height: auto; min-height: auto; }
  body[data-view="play"][data-playmode="window"] .play-frame > .game:not(:fullscreen) { position: relative; inset: auto; height: auto; min-height: auto; overflow: visible; }
  body[data-view="play"][data-playmode="window"] .play-frame > .game:not(:fullscreen) .game-stage { overflow: visible; }
}
.game-stage { --stage-min: 0; }
body[data-view="play"][data-playmode="window"] .play-frame > .game:not(:fullscreen) .game-stage { min-height: auto; }
@keyframes fs-blink { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,106,19,.0); transform: scale(1); } 50% { box-shadow: 0 0 0 8px rgba(255,106,19,.45); transform: scale(1.12); } }
.fs-nudge { animation: fs-blink 1s ease-in-out infinite; background: var(--c-primary, #ff6a13) !important; color: #fff; }
.fs-hint { position: absolute; z-index: 20; top: calc(max(10px, env(safe-area-inset-top)) + 58px); right: 10px; max-width: min(78vw, 300px); padding: .5rem .8rem; border-radius: 12px; background: #1f2937; color: #fff; font-weight: 700; font-size: .9rem; line-height: 1.25; box-shadow: 0 8px 20px rgba(0,0,0,.3); pointer-events: none; }
.fs-hint::before { content: ''; position: absolute; top: -6px; right: 78px; border: 6px solid transparent; border-top: 0; border-bottom-color: #1f2937; }
@media (prefers-reduced-motion: reduce) { .fs-nudge { animation: none; outline: 3px solid #ff6a13; } }

/* Linh vật phản ứng khi rê/chạm (engine/mascot-fx.js) — dùng thuộc tính scale/rotate riêng, không đụng animation tâm trạng */
.poke-able { cursor: pointer; pointer-events: auto !important; -webkit-tap-highlight-color: transparent; }
.poke-able.poke.poke.poke { animation: sc-poke .7s cubic-bezier(.3,1.5,.5,1) 1; }
@keyframes sc-poke { 0% { scale: 1 1; rotate: 0deg; } 15% { scale: 1.12 .84; rotate: -4deg; } 40% { scale: .92 1.12; rotate: 5deg; } 65% { scale: 1.04 .97; rotate: -3deg; } 100% { scale: 1 1; rotate: 0deg; } }

/* Mẫu chưa dùng được cho bài này — cuối cửa sổ Đổi mẫu, có nút Ẩn/Hiện */
.sw-off h3 { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sw-off-tog { min-height: 44px; padding: 0 16px; }
.switch-off { opacity: .45; filter: grayscale(.6); cursor: not-allowed; }

/* ===== 03/11 mục 5: đầu cột "Tuỳ chỉnh", thu gọn cột, chế độ rạp, nút i, tooltip, Đổi mẫu nổi bật ===== */
.side-head { display: flex; align-items: center; gap: 6px; justify-content: space-between; margin: 0 0 2px; padding: 2px 0 6px; border-bottom: 1px solid var(--line, #e3e7ee); }
.side-head .side-h { margin: 0; white-space: nowrap; font-size: .98rem; font-weight: 800; letter-spacing: .01em; color: #1f2a44; flex: 1; min-width: 0; }
.side-head-btns { display: flex; align-items: center; gap: 4px; }
.side-head .side-all { width: 44px; height: 44px; }
@media (min-width: 1001px) and (pointer: fine) { .side-head .side-all { width: 34px; height: 34px; } .side-head .side-col-btn { min-height: 34px; padding: 0 10px; } }
.side-col-btn { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line, #dde3ee); background: #fff; color: #2455d6; font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer; }
.side-col-btn:hover, .side-col-btn:focus-visible { background: #eef3ff; }
.side-open-btn { display: none; }
.play-side .side-tog { min-height: 44px; }
/* cột đã thu gọn: còn 1 thanh mảnh có nút Mở */
.play-page.side-min .play-side > :not(.side-head) { display: none !important; }
.play-page.side-min .side-head { border: 0; padding: 0; }
.play-page.side-min .side-head > :not(.side-open-btn) { display: none; }
.play-page.side-min .side-open-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line, #dde3ee); background: #fff; color: #2455d6; font: inherit; font-weight: 700; cursor: pointer; }
.side-open-btn svg { flex: none; }
@media (min-width: 1001px) {
  .play-page.side-min { --side-w: 52px; }
  .play-page.side-min .play-side { overflow: visible; }
  .play-page.side-min .side-open-btn { width: 52px; min-height: 96px; padding: 10px 0; flex-direction: column; font-size: .82rem; }
}
@media (max-width: 1000px) { .play-page.side-min .play-side { grid-template-columns: 1fr; } .play-page.side-min .side-open-btn { width: 100%; } }

/* chế độ rạp (máy tính): khung rộng hết trang, cột phải xuống dưới thành lưới */
.game-tools > .th-btn[aria-pressed="true"] { background: #2455d6; color: #fff; }
@media (max-width: 1000px) { .game-tools > .th-btn { display: none !important; } }
@media (min-width: 1001px) {
  .play-page.theater { max-width: none; }
  .play-page.theater .play-top { grid-template-columns: minmax(0, 1fr); }
  body[data-view="play"] .play-page.theater .play-frame { aspect-ratio: auto; height: auto; min-height: max(520px, calc(100dvh - var(--header-h) - 24px)); }
  body[data-view="play"][data-playmode="window"] .play-page.theater .play-frame > .game:not(:fullscreen) { min-height: max(520px, calc(100dvh - var(--header-h) - 24px)); }
  .play-page.theater .play-side { height: auto; min-height: 0; overflow: visible; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .play-page.theater .play-side > .side-head { grid-column: 1 / -1; }
  .play-page.theater.side-min .play-side { grid-template-columns: 1fr; }
  .play-page.theater.side-min .side-open-btn { width: auto; min-height: 44px; flex-direction: row; padding: 0 16px; }
}

/* tooltip cho biểu tượng (rê chuột / Tab tới) */
.game-tools [data-tip], .side-head [data-tip] { position: relative; }
.game-tools [data-tip]::after, .side-head [data-tip]::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 6px); right: 0; z-index: 90; width: max-content; max-width: 220px;
  padding: 5px 9px; border-radius: 8px; background: #1f2a44; color: #fff; font: 600 .78rem/1.3 system-ui, sans-serif; text-align: left; white-space: normal;
  pointer-events: none; opacity: 0; visibility: hidden; transform: translateY(-3px); transition: opacity .15s ease, transform .15s ease, visibility 0s .15s; }
.game-tools [data-tip]:hover::after, .game-tools [data-tip]:focus-visible::after, .side-head [data-tip]:hover::after, .side-head [data-tip]:focus-visible::after { opacity: 1; visibility: visible; transform: none; transition: opacity .15s ease .25s, transform .15s ease .25s, visibility 0s .25s; }
@media (hover: none) { .game-tools [data-tip]:hover:not(:focus-visible)::after { opacity: 0; } }
.game-tools > .gt-more.open [data-tip]::after { top: auto; bottom: calc(100% + 6px); }

/* Đổi mẫu: màu nhấn + nhãn chữ thỉnh thoảng hiện */
.game-tools .switch-icon.sw-hi { background: #fff4e0; color: #c2410c; border-color: #fdba74; box-shadow: inset 0 0 0 1px #fdba74; overflow: visible; }
.game-tools .switch-icon.sw-hi:hover, .game-tools .switch-icon.sw-hi:focus-visible { background: #ffe8c2; }
.switch-icon .sw-lbl { position: absolute; right: 50%; top: calc(100% + 8px); transform: translate(50%, -4px); z-index: 91; box-shadow: 0 6px 16px -6px rgba(194,65,12,.6); white-space: nowrap; padding: 4px 10px; border-radius: 999px; background: #c2410c; color: #fff; font: 700 .8rem/1.2 system-ui, sans-serif; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .3s ease, transform .3s ease, visibility 0s .3s; }
.switch-icon.sw-peek .sw-lbl { visibility: visible; transition: opacity .3s ease, transform .3s ease; opacity: 1; transform: translate(50%, 0); }
.switch-icon.sw-peek::after { opacity: 0 !important; }
@media (prefers-reduced-motion: reduce) { .switch-icon .sw-lbl { display: none; } .game-tools [data-tip]::after { transition: none; } }

/* hộp "Cách chơi" */
.how-body { display: grid; gap: 10px; font-size: .95rem; line-height: 1.5; }
.how-lead { margin: 0; }
.how-steps { margin: 0; padding-left: 1.3em; display: grid; gap: 4px; }
.how-h { margin: 6px 0 0; font-size: .95rem; }
.how-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.how-row { display: flex; align-items: center; gap: 10px; }
.how-ic { width: 32px; height: 32px; flex: none; display: inline-grid; place-items: center; border-radius: 8px; background: #eef3ff; color: #2455d6; }
.how-ic svg { width: 18px; height: 18px; }
.how-keys, .how-note { margin: 0; color: #5b6478; font-size: .88rem; }
.how-keys kbd { display: inline-block; min-width: 1.6em; padding: 0 .4em; border: 1px solid #cfd6e4; border-bottom-width: 2px; border-radius: 5px; background: #f7f9fc; font: 600 .8rem/1.5 ui-monospace, monospace; text-align: center; }

/* ===== Hướng dẫn chơi lần đầu (VI+EN) + nút ? ===== */
.howto-btn { position: absolute; right: 10px; bottom: 10px; z-index: 6; width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(255,255,255,.9); background: #e31e25; color: #fff; font: 800 22px/1 system-ui, sans-serif; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.35); touch-action: manipulation; }
.howto-btn:hover, .howto-btn:focus-visible { background: #b9151b; outline: 3px solid #fff; }
.howto-ov { position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; padding: 10px; background: rgba(15,20,30,.72); overflow: auto; }
.howto-card { background: #fff; color: #1f2937; border-radius: 16px; padding: 16px 18px; width: min(640px, 100%); max-height: 100%; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.howto-card h3 { margin: 0 0 8px; font-size: 20px; }
.howto-card h4 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: #e31e25; }
.howto-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.howto-card ol { margin: 0; padding-left: 20px; font-size: 15px; line-height: 1.45; }
.howto-keys { margin: 8px 0 0; font-size: 12.5px; color: #4b5563; }
.howto-go { margin-top: 12px; min-height: 48px; width: 100%; font-size: 17px; font-weight: 700; }
.howto-note { margin: 8px 0 0; font-size: 12px; color: #6b7280; text-align: center; }
@media (max-width: 560px) { .howto-cols { grid-template-columns: 1fr; } .howto-card ol { font-size: 14px; } }
