/* games/games.css — Trò chơi luyện gõ (SPEC §11). Uses the theme tokens of style.css (cute default, neon). */

/* ---------------------------------------------------------------- hub card (7th tool card, full row) */
.tools-grid .tool-card.games-card { grid-column: 1 / -1; min-height: 0; grid-template-columns: auto 1fr minmax(180px, 34%); grid-template-rows: auto auto 1fr; column-gap: 18px; align-items: center; }
.tool-card.games-card .tc-icon { grid-row: 1 / span 3; align-self: center; }
.tool-card.games-card h2 { grid-column: 2; margin: 0; }
.tool-card.games-card p { grid-column: 2; margin: 0; }
.tool-card.games-card .tc-foot { grid-column: 2; }
.tool-card.games-card .gc-art { grid-column: 3; grid-row: 1 / span 3; display: block; height: 100%; min-height: 104px; border-radius: 16px; overflow: hidden; border: var(--border-w) solid var(--line); }
.tool-card.games-card .gc-art svg { width: 100%; height: 100%; display: block; }

/* ---------------------------------------------------------------- lobby */
.gm-lobby-head { display: grid; grid-template-columns: 1.4fr minmax(220px, 1fr); gap: 22px; align-items: center; margin-bottom: 22px; }
.gm-lobby-head h1 { font-size: clamp(30px, 4vw, 44px); margin: 0 0 8px; }
.gm-lobby-head .lead { color: var(--ink-soft); font-size: 17px; max-width: 640px; margin: 0; }
.gm-lobby-art { display: block; border-radius: var(--r-card); overflow: hidden; box-shadow: var(--shadow-card); aspect-ratio: 8 / 3; }
.gm-lobby-art svg { width: 100%; height: 100%; display: block; }
.gm-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.gm-card { display: grid; grid-template-rows: auto 1fr; height: 100%; background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-card);
  border: var(--border-w) solid var(--line); overflow: hidden; color: var(--ink); text-decoration: none; transition: transform .18s, border-color .18s; }
html[data-theme="neon"] .gm-card { border-color: transparent; }
.gm-card:hover { transform: translateY(-3px); border-color: var(--primary); }
.gm-card:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.gm-thumb { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); }
.gm-thumb svg { width: 100%; height: 100%; display: block; }
.gm-card-body { display: grid; gap: 6px; padding: 14px 16px 16px; align-content: start; }
.gm-card-kind { font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.gm-card h2 { margin: 0; font-size: 21px; }
.gm-card p { margin: 0; color: var(--ink-soft); font-size: 14.5px; line-height: 1.45; }
.gm-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.gm-card-best { font-size: 13px; font-weight: 800; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- game page */
.gm-page { padding-top: 12px; }
.gm-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.gm-head h1 { margin: 0; font-size: clamp(22px, 2.6vw, 30px); flex: 1; min-width: 0; }
.gm-head-best { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; color: var(--ink-soft); }
.gm-box { position: relative; }

/* setup */
.gm-setup { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.25fr); gap: 26px; padding: 22px; }
.gm-setup-art .gm-thumb.big { border-radius: 18px; border: var(--border-w) solid var(--line); margin-bottom: 12px; }
.gm-setup-art h2 { font-size: 18px; margin: 4px 0 6px; }
.gm-howto { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-soft); font-size: 15px; line-height: 1.45; }
.gm-setup-form { display: grid; gap: 14px; align-content: start; }
.gm-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; align-items: center; }
.gm-row-label { font-weight: 800; font-size: 14.5px; color: var(--ink-soft); }
.gm-sub { margin-left: 124px; margin-top: -6px; }
.gm-sub .gm-row { display: block; }
.gm-sub .gm-row .gm-row-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.gm-row.gm-sub { display: block; }
.gm-row.gm-sub .gm-row-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.gm-select { max-width: 520px; }
.gm-seg button[disabled] { opacity: .5; cursor: not-allowed; }
.gm-seg button .ic { margin-right: 4px; }
.gm-switch small { display: block; font-weight: 600; }
.gm-go-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.gm-go { min-width: 220px; }
.gm-kbd { font: 800 12px var(--font); padding: 2px 7px; border-radius: 6px; border: 1.5px solid currentColor; opacity: .8; margin-left: 4px; }
.gm-lat-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gm-lat-row input[type="range"] { width: min(240px, 100%); accent-color: var(--primary); }
.gm-lat { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 64px; }

/* below: chart + other games */
.gm-below { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; margin-top: 18px; }
.gm-below h2 { font-size: 17px; margin: 0 0 10px; display: flex; align-items: center; gap: 6px; }
.gm-empty { padding: 26px 0; text-align: center; }
.gm-others-list { display: grid; gap: 10px; }
.gm-mini { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; text-decoration: none; color: var(--ink); padding: 6px; border-radius: 14px; border: var(--border-w) solid var(--line); }
.gm-mini:hover { border-color: var(--primary); }
.gm-mini .gm-thumb { border-radius: 10px; }
.gm-mini b { display: block; }
.gm-mini small { color: var(--ink-faint); font-weight: 700; }

/* ---------------------------------------------------------------- play area */
.gm-play { display: grid; gap: 8px; }
.gm-hud { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 48px; }
.gm-hud-src { font-size: 12.5px; font-weight: 800; color: var(--ink-faint); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-hud-items { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; justify-content: center; }
.gm-hud-item { display: inline-grid; padding: 4px 12px; border-radius: 12px; background: var(--surface); border: var(--border-w) solid var(--line); min-width: 74px; text-align: center; }
.gm-hud-item small { font-size: 11px; font-weight: 800; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .03em; }
.gm-hud-item b { font: 800 19px/1.15 var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gm-hud-item.hot b { color: var(--accent); }
.gm-hud-item.warn b { color: var(--bad); }
.gm-hud-btns { display: flex; gap: 8px; align-items: center; }
.gm-stage { position: relative; height: clamp(320px, calc(100dvh - 210px), 760px); border-radius: 24px; overflow: hidden; background: #241E4A;
  border: var(--border-w) solid var(--line-strong); box-shadow: var(--shadow-card); outline: none; touch-action: manipulation; }
.gm-stage:focus-within { border-color: var(--primary); }
.gm-play.has-compose .gm-stage { height: clamp(300px, calc(100dvh - 268px), 700px); }
.gm-canvas { position: absolute; inset: 0; display: block; }
.gm-stage .hidden-input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; resize: none; }
.gm-compose { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 8px 14px; border-radius: 14px; background: var(--surface); border: var(--border-w) solid var(--line-strong); }
.gm-compose span { font-weight: 800; font-size: 13px; color: var(--ink-faint); }
.gm-compose b { font: 800 26px/1.1 var(--font-display); min-width: 2ch; color: var(--primary); }
.gm-compose[hidden] { display: none; }

/* overlays */
.gm-overlay { position: absolute; inset: 0; display: grid; place-items: center; z-index: 5; }
.gm-count { pointer-events: none; background: rgba(20, 14, 50, .18); }
.gm-count-n { font: 900 clamp(70px, 14vw, 150px)/1 var(--font-display); color: #FFF6D8; -webkit-text-stroke: 4px #2B2350; paint-order: stroke fill; text-shadow: 0 6px 0 rgba(43, 35, 80, .35); }
.gm-count-n.pop { animation: gm-pop .6s var(--ease-pop) both; }
@keyframes gm-pop { from { transform: scale(.4); opacity: 0; } 60% { opacity: 1; } to { transform: scale(1); opacity: 1; } }
.gm-pause { background: rgba(20, 14, 50, .55); backdrop-filter: blur(3px); }
html[data-theme="cute"] .gm-pause { background: rgba(43, 35, 80, .42); }
.gm-pause-box { background: var(--surface); border-radius: var(--r-modal); padding: 24px 26px; box-shadow: var(--shadow-card), 0 30px 80px rgba(0, 0, 0, .35); text-align: center; max-width: min(520px, calc(100% - 24px)); border: var(--border-w) solid var(--line-strong); }
.gm-pause-box h2 { margin: 0 0 6px; font-size: 26px; }
.gm-pause-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }

/* end screen */
.gm-end { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 14px; background: rgba(20, 14, 50, .5); overflow: auto; animation: fade-in .25s ease-out; }
html[data-theme="cute"] .gm-end { background: rgba(43, 35, 80, .36); }
.gm-end-card { width: min(640px, 100%); background: var(--surface); border-radius: var(--r-modal); padding: 20px 22px; box-shadow: var(--shadow-card), 0 30px 80px rgba(0, 0, 0, .35);
  border: var(--border-w) solid var(--line-strong); display: grid; gap: 12px; animation: pop-in .3s var(--ease-pop); max-height: 100%; overflow: auto; }
.gm-end-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.gm-end-top h2 { margin: 0; font-size: clamp(22px, 2.6vw, 30px); }
.gm-end-kicker { margin: 0; font-size: 13px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.gm-stars { display: inline-flex; gap: 4px; }
.gm-star .ic { width: 40px; height: 40px; color: var(--line-strong); }
.gm-star.on .ic { color: var(--star); filter: drop-shadow(0 2px 0 rgba(43, 35, 80, .25)); }
.gm-star.on { animation: gm-star .5s var(--ease-pop) both; animation-delay: calc(var(--i) * 180ms + 150ms); }
@keyframes gm-star { from { transform: scale(0) rotate(-40deg); } to { transform: none; } }
.gm-end-score { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.gm-end-score span:first-child { font-weight: 800; color: var(--ink-faint); }
.gm-end-score > b { font: 900 52px/1 var(--font-display); color: var(--primary); font-variant-numeric: tabular-nums; }
.gm-record { align-self: center; }
.gm-end-main { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gm-end-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.gm-stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; min-width: 0; }
.gm-stat b { display: block; font: 800 22px/1.15 var(--font-display); font-variant-numeric: tabular-nums; }
.gm-stat span { font-size: 12px; font-weight: 700; color: var(--ink-faint); }
.gm-stat.big b { font-size: 38px; }
.gm-stat.big span { font-size: 14px; }
.gm-stat.coin b { color: var(--warn); }
.gm-end-note { margin: 0; color: var(--ink-soft); font-size: 14px; }
.gm-end-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.gm-unlock { margin: 0; color: var(--good); font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 4px; }
.gm-weak { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gm-weak > span { font-weight: 800; font-size: 13px; color: var(--ink-faint); margin-right: 2px; }
.gm-key { display: inline-flex; align-items: baseline; gap: 4px; min-width: 44px; justify-content: center; padding: 6px 10px; border-radius: 10px; font: 800 17px var(--font-mono);
  background: var(--key-bg); color: var(--key-ink); border: var(--border-w) solid var(--line-strong); box-shadow: 0 3px 0 var(--line-strong); text-decoration: none; }
a.gm-key:hover { border-color: var(--primary); color: var(--primary); }
.gm-key small { font: 700 11px var(--font); color: var(--bad); }
.gm-end-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* DOM pieces some renderers use */
.gm-layer { position: absolute; inset: 0; pointer-events: none; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1000px) {
  .gm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gm-setup { grid-template-columns: 1fr; }
  .gm-setup-art { display: grid; grid-template-columns: 200px 1fr; gap: 0 16px; }
  .gm-setup-art .gm-thumb.big { grid-row: 1 / span 2; }
  .gm-below { grid-template-columns: 1fr; }
  .tools-grid .tool-card.games-card { grid-template-columns: auto 1fr; }
  .tool-card.games-card .gc-art { display: none; }
}
@media (max-width: 640px) {
  .gm-lobby-head { grid-template-columns: 1fr; }
  .gm-lobby-art { display: none; }
  .gm-grid { grid-template-columns: 1fr; }
  .gm-setup { padding: 16px; gap: 16px; }
  .gm-setup-art { grid-template-columns: 1fr; }
  .gm-setup-art .gm-thumb.big { grid-row: auto; }
  .gm-row { grid-template-columns: 1fr; gap: 6px; }
  .gm-sub { margin-left: 0; }
  .gm-go { width: 100%; }
  .gm-hud { gap: 6px; }
  .gm-hud-src { display: none; }
  .gm-hud-items { justify-content: flex-start; gap: 5px; }
  .gm-hud-item { min-width: 0; padding: 3px 8px; }
  .gm-hud-item b { font-size: 16px; }
  .gm-hide-sm { display: none; }
  .gm-stage { height: clamp(300px, 56dvh, 560px); border-radius: 18px; }
  .gm-end { padding: 8px; place-items: start center; }
  .gm-end-card { padding: 14px; gap: 10px; }
  .gm-end-score > b { font-size: 40px; }
  .gm-stat.big b { font-size: 30px; }
  .gm-end-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gm-star .ic { width: 30px; height: 30px; }
  .gm-pause-box { padding: 18px 14px; }
}
@media (max-width: 640px) { .gm-end { position: fixed; inset: 0; z-index: 60; place-items: center; padding: 10px; } .gm-end-card { max-height: calc(100dvh - 20px); } }
body.is-phone .gm-play.phone .gm-stage { height: clamp(280px, 52dvh, 520px); }

/* ---------------------------------------------------------------- reduced motion */
html[data-motion="reduced"] .gm-count-n.pop, html[data-motion="reduced"] .gm-star.on, html[data-motion="reduced"] .gm-end, html[data-motion="reduced"] .gm-end-card { animation: none; }
html[data-motion="reduced"] .gm-card:hover { transform: none; }

/* ================================================================ per-game blocks (each game edits only its own block) */
/* @@ qua-suoi @@ */
/* qua-suoi draws everything on its canvas (games/ui/qua-suoi.js); no extra DOM styles needed. */
/* @@ dua-ghe @@ */
.dg-read { position: absolute; left: 0; right: 0; bottom: 0; height: clamp(132px, 30%, 162px); overflow: hidden; padding: 14px 22px;
  background: var(--surface); border-top: var(--border-w) solid var(--line-strong); z-index: 1; }
html[data-theme="cute"] .dg-read { background: #FFFDF5; }
.dg-lines { font: 700 26px/1.62 var(--font); color: var(--text-pending); letter-spacing: .01em; transition: transform .18s ease-out; word-break: normal; }
.dg-w { position: relative; display: inline; border-radius: 6px; }
.dg-w.cur { background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-soft); }
.dg-c { position: relative; }
.dg-c.ok { color: var(--good); }
.dg-c.comp { color: var(--primary); }
.dg-c.caret { color: var(--ink); }
.dg-c.caret::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 4px; border-radius: 2px; background: var(--caret); animation: dg-blink 1s steps(1) infinite; }
.dg-sp.caret::after { left: 2px; right: 2px; }
.dg-c.bad { color: #8A3A00; background: #FFE1C2; border-radius: 4px; box-shadow: 0 0 0 2px #B4500A; }
html[data-theme="neon"] .dg-c.bad { color: #FFD9B0; background: rgba(255, 140, 50, .25); box-shadow: 0 0 0 2px #FF9A4D; }
.dg-c.bad::after { background: #B4500A; }
.dg-comp { position: absolute; left: 0; top: -1.15em; font: 800 17px/1 var(--font); color: var(--on-primary); background: var(--primary); padding: 3px 7px; border-radius: 7px; white-space: nowrap; z-index: 2; }
.dg-comp[hidden] { display: none; }
.dg-read.shake { animation: dg-shake .22s linear; }
@keyframes dg-blink { 50% { opacity: 0; } }
@keyframes dg-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
html[data-motion="reduced"] .dg-read.shake, html[data-motion="reduced"] .dg-c.caret::after { animation: none; }
html[data-motion="reduced"] .dg-lines { transition: none; }
@media (max-width: 640px) { .dg-read { padding: 10px 12px; height: 46%; } .dg-lines { font-size: 24px; line-height: 1.55; } }
/* @@ hai-dang @@ */
/* @@ cho-phien @@ */
.gm-stage.cp-stage { background: #FFE9C7; }
html[data-theme="neon"] .gm-stage.cp-stage { background: #121833; }
.cp-layer { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: max(58px, 13.5%) 16px 14px; pointer-events: none; }
.cp-ticket-wrap { perspective: 1200px; width: min(540px, 62%); display: grid; gap: 6px; flex: 0 1 auto; min-height: 0; }
.cp-card { position: relative; transform-style: preserve-3d; transition: transform .45s cubic-bezier(.4, .1, .3, 1); transform: rotate(-1.2deg); }
.cp-card.down { transform: rotate(-1.2deg) rotateY(180deg); }
.cp-card.rm { transition: none; }
.cp-face { background: #FFFDF5; color: #2B2350; border: 3px solid #2B2350; border-radius: 16px; padding: 12px 20px 14px;
  box-shadow: 0 6px 0 rgba(43, 35, 80, .22); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.cp-front { min-height: calc(62px + var(--n, 2) * 44px); }
.cp-back { position: absolute; inset: 0; transform: rotateY(180deg); display: grid; place-items: center;
  background: repeating-linear-gradient(45deg, #FFE7C2 0 14px, #FFD9A0 14px 28px); }
html[data-theme="neon"] .cp-back { background: repeating-linear-gradient(45deg, #2A2150 0 14px, #1F1940 14px 28px); border-color: #C084FC; }
.cp-back-mark { background: #FFFDF5; border: 3px solid #2B2350; border-radius: 14px; padding: 10px 18px; text-align: center; display: grid; gap: 2px; }
.cp-back-mark span { font: 900 24px/1.2 var(--font-display); }
.cp-back-mark small { font-size: 14px; font-weight: 700; color: #57527C; }
.cp-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px dashed #CFC2EE; padding-bottom: 6px; margin-bottom: 6px; }
.cp-head span { font-weight: 800; font-size: 14px; color: #8A3B12; text-transform: uppercase; letter-spacing: .05em; }
.cp-head b { font-weight: 800; font-size: 14px; color: #57527C; }
.cp-items { margin: 0; padding: 0 0 0 30px; display: grid; gap: 2px; font: 800 28px/1.45 var(--font); }
.cp-items li::marker { color: #8A85AC; font-size: 20px; }
.cp-items.review li { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cp-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-size: 18px; color: #fff; align-self: center; flex: none; }
.cp-correct .cp-mark { background: #1B8A57; } .cp-correct .cp-word { color: #146B43; }
.cp-wrong .cp-mark { background: #B4500A; } .cp-wrong .cp-word { color: #8F3F06; }
.cp-missing .cp-mark { background: #6B6790; } .cp-missing .cp-word { color: #57527C; }
.cp-typed { font-size: 18px; font-weight: 700; color: #6B6790; }
.cp-tiles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 8px 0 4px; }
.cp-tile { min-width: 46px; padding: 6px 12px; text-align: center; font: 900 30px/1.2 var(--font); background: #FFF0CF; border: 3px solid #2B2350; border-radius: 12px; box-shadow: 0 4px 0 #2B2350; }
.cp-tiles.syl .cp-tile { padding: 6px 16px; }
.cp-timer { height: 8px; border-radius: 99px; background: rgba(43, 35, 80, .16); overflow: hidden; }
.cp-timer i { display: block; height: 100%; background: #E86A1C; transform-origin: left center; }
html[data-theme="neon"] .cp-timer { background: rgba(234, 240, 255, .14); } html[data-theme="neon"] .cp-timer i { background: #22D3EE; }
.cp-slate { margin-top: auto; width: min(760px, 78%); background: #2F5A4C; border: 6px solid #9A6232; border-radius: 16px; padding: 10px 18px 8px;
  box-shadow: 0 6px 0 rgba(43, 35, 80, .25); display: grid; gap: 4px; }
html[data-theme="neon"] .cp-slate { background: #0B1020; border-color: #22D3EE; box-shadow: 0 0 18px rgba(34, 211, 238, .35); }
.cp-line { min-height: 46px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font: 800 30px/1.3 var(--font); color: #FFFFFF; }
.cp-tok.cur { display: inline-flex; align-items: center; min-width: 4px; }
.cp-caret { display: inline-block; width: 3px; height: 1.05em; background: #FFE27A; margin-left: 2px; animation: cp-blink 1s steps(1) infinite; }
@keyframes cp-blink { 50% { opacity: 0; } }
.cp-ph { font-size: 22px; font-weight: 700; color: #CDE8DD; }
html[data-theme="neon"] .cp-ph { color: #A9B4D6; }
.cp-hint { font-size: 14px; font-weight: 700; color: #E3F2EC; border-top: 1px dashed rgba(255, 255, 255, .3); padding-top: 4px; }
html[data-theme="neon"] .cp-hint { color: #C7D2FE; }
.cp-slate.shake { animation: cp-shake .35s ease-out; }
@keyframes cp-shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.cp-banner { position: absolute; bottom: 61%; left: max(14px, 2.5%); max-width: min(330px, 30%); opacity: 0; transform: translateY(-8px) scale(.9); transition: opacity .2s, transform .25s var(--ease-pop); }
.cp-banner.on { opacity: 1; transform: none; }
.cp-banner.rm { transition: none; }
.cp-banner span::after { content: ""; position: absolute; left: 34px; bottom: -11px; width: 16px; height: 16px; background: inherit; border-right: 3px solid #2B2350; border-bottom: 3px solid #2B2350; transform: rotate(45deg); }
.cp-banner span { position: relative; display: inline-block; border-radius: 22px !important; font: 900 24px/1.2 var(--font-display); padding: 8px 18px; border-radius: 999px; border: 3px solid #2B2350; background: #FFFDF5; color: #2B2350; box-shadow: 0 4px 0 rgba(43, 35, 80, .3); }
.cp-banner.good span { background: #DDF5E9; color: #146B43; }
.cp-banner.gold span { background: #FFD23F; color: #2B2350; }
.cp-banner.bad span { background: #FFE1C2; color: #8F3F06; }
html[data-motion="reduced"] .cp-card, html[data-motion="reduced"] .cp-banner { transition: none; }
html[data-motion="reduced"] .cp-slate.shake, html[data-motion="reduced"] .cp-caret { animation: none; }
@media (min-width: 1500px) {
  .cp-ticket-wrap { width: min(640px, 56%); }
  .cp-items { font-size: 32px; }
  .cp-front { min-height: calc(66px + var(--n, 2) * 50px); }
  .cp-line { font-size: 34px; }
}
@media (max-width: 900px) {
  .cp-ticket-wrap { width: min(520px, 74%); }
  .cp-slate { width: 92%; }
}
@media (max-width: 640px) {
  .cp-layer { padding: 54px 8px 8px; gap: 8px; }
  .cp-ticket-wrap { width: 100%; max-width: 360px; margin-left: 58px; width: calc(100% - 58px); }
  .cp-face { padding: 8px 12px 10px; }
  .cp-front { min-height: calc(48px + var(--n, 2) * 36px); }
  .cp-items { font-size: 24px; line-height: 1.4; padding-left: 24px; }
  .cp-tile { font-size: 26px; min-width: 38px; padding: 4px 8px; }
  .cp-slate { width: 100%; padding: 6px 10px; border-width: 4px; }
  .cp-line { font-size: 24px; min-height: 36px; }
  .cp-hint { font-size: 12.5px; }
  .cp-banner { top: auto; bottom: 30%; left: 50%; max-width: 90%; transform: translateX(-50%); }
  .cp-banner.on { transform: translateX(-50%); }
  .cp-banner span { white-space: nowrap; }
  .cp-banner span { font-size: 20px; }
}
/* @@ trong-hoi @@ */
.th-cal-stage { display: flex; align-items: center; gap: 18px; padding: 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.th-cal-dot { width: 54px; height: 54px; border-radius: 50%; background: var(--surface-3); border: 3px solid var(--ink); flex: none; transition: background .06s; }
.th-cal-dot.on { background: var(--star); box-shadow: 0 0 0 8px rgba(232, 155, 12, .25); }
.th-cal-count { font: 800 20px var(--font-display); font-variant-numeric: tabular-nums; }
.th-cal-out { font: 800 18px var(--font-display); color: var(--primary); }
html[data-motion="reduced"] .th-cal-dot.on { box-shadow: none; }
/* end trong-hoi */

/* @@ phieu-luu @@ — Cốm Phiêu Lưu (SPEC-game-phieu-luu §3) */
.pl-page { padding-top: 10px; }
.pl-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.pl-title { display: grid; min-width: 0; }
.pl-title small { font-weight: 800; font-size: 12.5px; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.pl-title h1 { margin: 0; font-size: clamp(20px, 2.4vw, 28px); }
.pl-play { display: grid; gap: 8px; justify-items: center; }
.pl-stage { position: relative; width: min(100%, calc((100dvh - 190px) * 16 / 9)); aspect-ratio: 16 / 9; min-height: 180px; border-radius: 24px; overflow: hidden;
  background: #BFE6FF; border: var(--border-w) solid var(--line-strong); box-shadow: var(--shadow-card), 0 18px 40px rgba(43, 35, 80, .18); outline: none; touch-action: manipulation; }
.pl-stage:focus-within { border-color: var(--primary); }
html[data-theme="neon"] .pl-stage { background: #141A46; box-shadow: 0 0 0 1px rgba(34, 211, 238, .25), 0 18px 50px rgba(0, 0, 0, .5); }
.pl-stage .pl-canvas { position: absolute; inset: 0; display: block; }
.pl-stage .hidden-input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; resize: none; }
.pl-hud { position: absolute; left: 10px; right: 64px; top: 10px; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; pointer-events: none; z-index: 2; }
.pl-hud-l, .pl-hud-r { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pl-hud-r { justify-content: flex-end; }
.pl-hud-c { flex: 1; display: flex; justify-content: center; padding-top: 6px; min-width: 120px; }
.pl-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; min-height: 36px; border-radius: 999px; background: rgba(255, 248, 231, .94); color: #3B2416;
  border: 2.5px solid #4A2F1D; box-shadow: 0 3px 0 rgba(74, 47, 29, .35); font-weight: 800; }
.pl-chip i { width: 20px; height: 20px; display: inline-grid; }
.pl-chip i svg { width: 100%; height: 100%; }
.pl-chip small { font-size: 11px; font-weight: 800; color: #7A5A3E; text-transform: uppercase; letter-spacing: .03em; }
.pl-chip b { font: 800 19px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.pl-chip em { font-style: normal; font: 900 14px/1 var(--font-display); color: #fff; background: #E2513C; border-radius: 999px; padding: 3px 7px; }
.pl-chip.power { position: relative; padding-left: 38px; }
.pl-chip.power .pl-ring { position: absolute; left: 6px; width: 26px; height: 26px; border-radius: 50%; background: conic-gradient(#5DBE5A calc(var(--p) * 1%), rgba(74, 47, 29, .15) 0); border: 2px solid #4A2F1D; }
.pl-hearts { display: inline-flex; gap: 2px; padding: 4px 8px; border-radius: 999px; background: rgba(255, 248, 231, .94); border: 2.5px solid #4A2F1D; box-shadow: 0 3px 0 rgba(74, 47, 29, .35); }
.pl-hearts.shield { box-shadow: 0 0 0 3px #E8C35A, 0 3px 0 rgba(74, 47, 29, .35); }
.pl-hearts i { width: 24px; height: 24px; display: inline-grid; }
.pl-hearts i svg { width: 100%; height: 100%; }
.pl-prog { position: relative; display: block; width: min(340px, 100%); height: 14px; border-radius: 999px; background: rgba(255, 248, 231, .85); border: 2.5px solid #4A2F1D; }
.pl-prog > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, #9EE07A, #3E9A4A); transition: width .2s; }
.pl-prog.boss > i { background: linear-gradient(90deg, #FFB15A, #E2513C); }
.pl-prog small { position: absolute; top: 16px; left: 0; right: 0; text-align: center; font-weight: 800; font-size: 12px; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.pl-prog-com { position: absolute; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #C6F09A, #5FAE3E); border: 2.5px solid #4A2F1D; transition: left .2s; }
.pl-prog-cp { position: absolute; top: -9px; width: 4px; height: 26px; margin-left: -2px; background: #9A6A3A; border-radius: 2px; }
.pl-prog-cp::after { content: ""; position: absolute; left: 4px; top: 0; border: 6px solid transparent; border-left: 10px solid #E8C35A; }
.pl-prog-cp.on::after { border-left-color: #5DBE5A; }
.pl-prog-gate { position: absolute; right: -6px; top: -8px; width: 12px; height: 26px; border: 3px solid #7AA040; border-bottom: 0; border-radius: 4px 4px 0 0; }
.pl-pause { position: absolute; top: 8px; right: 10px; z-index: 3; width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(255, 248, 231, .95); border: 2.5px solid #4A2F1D; box-shadow: 0 3px 0 rgba(74, 47, 29, .4); cursor: pointer; }
.pl-pause span { width: 6px; height: 18px; border-radius: 3px; background: #4A2F1D; }
.pl-pause:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.pl-bigcard { width: min(100%, 720px); text-align: center; padding: 10px 16px; border-radius: 22px; background: #FFF8E7; border: 3px solid #4A2F1D; box-shadow: 0 4px 0 rgba(74, 47, 29, .35);
  font: 800 clamp(26px, 7vw, 40px)/1.25 var(--font-display); color: #3B2416; word-break: break-word; }
.pl-bigcard[hidden] { display: none; }
.pl-bigcard span.ok { color: #17803D; text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 4px; }
.pl-bigcard span.cur { box-shadow: inset 3px 0 0 #5B4BDB; }
.pl-bigcard span.bad { color: #A94508; background: #FFE1C2; outline: 2.5px solid #C2560C; border-radius: 6px; }
.pl-compose { width: min(100%, 720px); }
.pl-hints { width: min(100%, 860px); display: grid; gap: 6px; justify-items: center; }
.pl-hints[hidden] { display: none; }
.pl-dom-bubble { margin: 0; padding: 6px 14px 6px 40px; border-radius: 999px; background: #FFF8E7; color: #3B2416; border: 2.5px solid #4A2F1D; font-weight: 800; position: relative; }
.pl-dom-bubble::before { content: ""; position: absolute; left: 10px; top: 50%; width: 20px; height: 20px; margin-top: -10px; border-radius: 50%; background: radial-gradient(circle, #FFFBD0 0 30%, #FFD84A 55%, rgba(255, 216, 74, 0) 72%); }
.pl-dom-bubble[hidden] { display: none; }
.pl-kb { width: 100%; }
.pl-kb .kb-wrap { margin: 0 auto; }
.pl-phone-note { margin: 0 0 6px; }
.pl-overlay .gm-pause-box { max-width: min(560px, calc(100% - 24px)); }
.pl-pause-more { margin-top: 12px; text-align: left; }
.pl-pause-more summary { cursor: pointer; font-weight: 800; }
.pl-pause-set { display: grid; gap: 10px; margin-top: 8px; }

/* results */
.pl-end { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 14px; background: rgba(43, 35, 80, .45); backdrop-filter: blur(3px); overflow: auto; animation: fade-in .25s ease-out; }
.pl-end-card { width: min(680px, 100%); max-height: calc(100dvh - 28px); overflow: auto; display: grid; gap: 12px; padding: 18px 22px 20px; border-radius: 28px; background: var(--surface);
  border: 3px solid #4A2F1D; box-shadow: 0 8px 0 rgba(74, 47, 29, .35), 0 30px 80px rgba(0, 0, 0, .35); animation: pop-in .35s var(--ease-pop); }
.pl-end.win .pl-end-card { background: linear-gradient(180deg, #FFF8E7, var(--surface) 46%); }
html[data-theme="neon"] .pl-end.win .pl-end-card { background: linear-gradient(180deg, #2A2150, var(--surface) 46%); }
.pl-end-hero { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.pl-end-art { width: 220px; height: 190px; }
.pl-end-title h2 { margin: 2px 0 8px; font-size: clamp(24px, 3.2vw, 34px); }
.pl-end-main { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pl-end-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pl-stat { background: var(--surface-2); border: 2px solid var(--line); border-radius: 16px; padding: 8px 12px; min-width: 0; }
.pl-stat b { display: block; font: 800 22px/1.15 var(--font-display); font-variant-numeric: tabular-nums; }
.pl-stat span { font-size: 12px; font-weight: 700; color: var(--ink-faint); }
.pl-stat.big { border-color: #4A2F1D; background: #FFF8E7; color: #3B2416; }
html[data-theme="neon"] .pl-stat.big { background: #1A2040; color: var(--ink); border-color: #22D3EE; }
.pl-stat.big b { font-size: 44px; color: #17803D; }
html[data-theme="neon"] .pl-stat.big b { color: #4ADE80; }
.pl-stat.big span { font-size: 14px; color: inherit; opacity: .8; }
.pl-stat.coin b { color: var(--warn); } .pl-stat.grain b { color: #C88A0A; }
.pl-end-chips { display: flex; gap: 8px; flex-wrap: wrap; } .pl-end-chips:empty { display: none; }
.pl-weak h3 { font-size: 15px; margin: 0 0 6px; }
.pl-weak ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pl-weak li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pl-end-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* map */
.pl-map-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: end; margin-bottom: 12px; }
.pl-map-title h1 { margin: 6px 0 4px; font-size: clamp(28px, 4vw, 42px); }
.pl-map-title .lead { margin: 0; color: var(--ink-soft); max-width: 640px; }
.pl-map-stats { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pl-total { display: inline-grid; text-align: center; padding: 6px 14px; border-radius: 16px; background: var(--surface); border: 2.5px solid #4A2F1D; box-shadow: 0 3px 0 rgba(74, 47, 29, .3); }
.pl-total b { font: 900 22px/1.1 var(--font-display); } .pl-total small { font-size: 11.5px; font-weight: 800; color: var(--ink-faint); }
.pl-seeds { display: inline-flex; gap: 4px; padding: 8px 10px; border-radius: 16px; background: var(--surface); border: 2.5px solid #4A2F1D; }
.pl-seeds i, .pl-seed { width: 24px; height: 24px; display: inline-grid; filter: grayscale(1) opacity(.35); }
.pl-seeds i.on, .pl-seed.on { filter: none; } .pl-seeds i svg, .pl-seed svg { width: 100%; height: 100%; }
.pl-map-bar { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.pl-map-bar .gm-row { grid-template-columns: auto minmax(0, 1fr); }
.pl-map-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.pl-scroll { overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; padding: 6px 2px 14px; border-radius: 24px; }
.pl-track { display: flex; gap: 0; align-items: stretch; width: max-content; padding: 0 4px; }
.pl-roller { flex: 0 0 22px; border-radius: 12px; background: linear-gradient(90deg, #8A5230, #E8B07A 45%, #8A5230); border: 3px solid #4A2F1D; margin: -6px 0; }
.pl-panel { flex: 0 0 min(560px, 78vw); scroll-snap-align: start; display: grid; grid-template-rows: auto 1fr auto; background: #FFF4DA; border-top: 3px solid #4A2F1D; border-bottom: 3px solid #4A2F1D; position: relative; }
html[data-theme="neon"] .pl-panel { background: #1A1640; }
.pl-panel + .pl-panel { border-left: 3px dashed rgba(74, 47, 29, .35); }
.pl-panel-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.pl-panel-head b { display: block; font: 800 18px/1.15 var(--font-display); } .pl-panel-head small { color: var(--ink-faint); font-weight: 700; font-size: 12.5px; }
.pl-panel-head > div { flex: 1; min-width: 0; }
.pl-panel-n { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 900 17px var(--font-display); background: #E2513C; color: #fff; border: 2.5px solid #4A2F1D; }
.pl-panel-art svg { display: block; width: 100%; height: auto; }
.pl-panel.locked .pl-panel-head { opacity: .7; }
.pl-skip { position: absolute; right: 12px; bottom: 12px; }
.pl-node { cursor: pointer; outline: none; }
.pl-node.locked { cursor: not-allowed; }
.pl-node:focus-visible > path:first-of-type, .pl-node:hover > path:first-of-type { stroke: #5B4BDB; stroke-width: 5; }
.pl-node:focus-visible { filter: drop-shadow(0 0 6px rgba(91, 75, 219, .8)); }
.pl-pulse { transform-box: fill-box; transform-origin: center; animation: pl-pulse 1.3s ease-in-out infinite; }
@keyframes pl-pulse { 0%, 100% { opacity: .35; transform: scale(.92); } 50% { opacity: 1; transform: scale(1.06); } }
html[data-motion="reduced"] .pl-pulse { animation: none; opacity: 1; stroke-width: 7; }
.pl-settings { margin-top: 14px; } .pl-settings summary { cursor: pointer; font-weight: 800; }
.pl-set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 22px; margin-top: 12px; }
.pl-goal-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .pl-goal { width: 90px; }
.pl-stats { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.pl-stats > * { min-width: 0; overflow-x: auto; }
.pl-stats h2 { font-size: 17px; margin: 0 0 10px; display: flex; align-items: center; gap: 6px; }
.pl-heat-card { grid-column: 1 / -1; }
.pl-grid { width: 100%; border-collapse: collapse; } .pl-grid caption { text-align: left; color: var(--ink-faint); font-size: 13px; padding-bottom: 6px; }
.pl-grid th, .pl-grid td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: center; font-size: 14px; } .pl-grid th[scope="row"] { text-align: left; }
.pl-st { letter-spacing: 1px; color: var(--line-strong); } .pl-st.s1, .pl-st.s2, .pl-st.s3 { color: var(--star); }
.pl-outfit-body { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: start; }
.pl-outfit-row { display: flex; gap: 8px; flex-wrap: wrap; } .pl-outfits h3 { font-size: 15px; margin: 10px 0 6px; }
.pl-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 2px solid #4A2F1D; margin-right: 4px; }
@media (max-width: 760px) {
  .pl-map-head { grid-template-columns: 1fr; }
  .pl-scroll { overflow: visible; padding: 0; }
  .pl-track { flex-direction: column; width: 100%; padding: 0; }
  .pl-roller { flex: 0 0 18px; margin: 0 -4px; }
  .pl-panel { flex: none; width: 100%; border: 3px solid #4A2F1D; border-top: 0; border-bottom: 0; }
  .pl-panel + .pl-panel { border-left: 3px solid #4A2F1D; border-top: 3px dashed rgba(74, 47, 29, .35); }
  .pl-set-grid, .pl-stats { grid-template-columns: 1fr; }
  .pl-grid th, .pl-grid td { padding: 5px 3px; font-size: 12.5px; }
  .pl-stage { width: 100%; border-radius: 16px; }
  .pl-hud { left: 6px; right: 52px; top: 6px; gap: 4px; }
  .pl-hud-c { display: none; }
  .pl-chip { min-height: 28px; padding: 2px 8px; border-width: 2px; } .pl-chip b { font-size: 15px; } .pl-chip small { display: none; }
  .pl-hearts { padding: 2px 5px; border-width: 2px; } .pl-hearts i { width: 17px; height: 17px; }
  .pl-pause { width: 44px; height: 44px; top: 4px; right: 4px; }
  .pl-end-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .pl-end-art { width: 170px; height: 147px; }
  .pl-end-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pl-stat.big b { font-size: 34px; }
  .pl-outfit-body { grid-template-columns: 1fr; justify-items: center; }
}
html[data-motion="reduced"] .pl-end, html[data-motion="reduced"] .pl-end-card { animation: none; }
/* end phieu-luu */
