:root {
  --bg-0: #0b1020;
  --bg-1: #111936;
  --bg-2: #161f44;
  --panel: rgba(255, 255, 255, 0.05);
  --panel-2: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #eef2ff;
  --muted: #9aa7c7;
  --muted-2: #6b78a0;
  --gold: #ffce4a;
  --felt: #0f6b4f;
  --felt2: #0c5a42;

  --brand: #7c5cff;
  --brand-2: #20d0ff;
  --brand-grad: linear-gradient(135deg, #7c5cff 0%, #20d0ff 100%);

  --red: #ff5d6c;
  --blue: #2f7be6;
  --green: #28d17c;
  --orange: #f0922f;

  --radius: 16px;
  --shadow: 0 18px 50px rgba(2, 6, 23, 0.55);
  --glow: 0 0 0 1px rgba(124, 92, 255, 0.4), 0 12px 40px rgba(124, 92, 255, 0.25);
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(124, 92, 255, 0.22), transparent 60%),
    radial-gradient(1000px 600px at 100% 0%, rgba(32, 208, 255, 0.15), transparent 55%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 60%, var(--bg-2) 100%);
  overflow: hidden;
}

.screen { display: none; height: 100vh; }
.screen.active { display: flex; }
.hidden { display: none !important; }

/* ============ Nút ============ */
.btn {
  font-family: inherit; font-weight: 700; border: none; border-radius: 12px;
  padding: 11px 18px; cursor: pointer; font-size: 15px; color: #fff;
  transition: transform .1s ease, filter .15s ease, background .15s ease, box-shadow .15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: var(--glow); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost { background: var(--panel); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--panel-2); }
.btn-lg { padding: 15px 26px; font-size: 16px; }
.btn-mini { padding: 7px 12px; font-size: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.btn-mini:hover { background: var(--panel-2); }
.btn-mini.danger { background: rgba(255, 93, 108, .18); border-color: rgba(255,93,108,.4); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-family: inherit; font-size: 14px; text-decoration: underline; }
.link-btn:hover { color: var(--text); }

.card-surface {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 22px; box-shadow: var(--shadow); backdrop-filter: blur(12px);
}

/* ============ Trang chủ ============ */
#screen-home { flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 16px; }
.home-card { padding: 18px 36px 34px; width: min(440px, 92vw); text-align: center; position: relative;
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.home-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 22px; }
.back-hub {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--muted); text-decoration: none;
  background: var(--panel); border: 1px solid var(--line);
  transition: background .15s, color .15s, border-color .15s;
}
.back-hub:hover { background: var(--panel-2); color: var(--text); border-color: var(--line-strong); }
.logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 4px 0 6px; }
.logo h1 { font-size: 38px; letter-spacing: 4px; margin: 0; font-weight: 800; background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.suit { font-size: 26px; }
.s-spade, .s-club { color: #cfe2f5; }
.s-heart, .s-diamond { color: var(--red); }
.tagline { color: var(--muted); margin: 8px 0 24px; line-height: 1.5; }
.field { display: block; text-align: left; margin-bottom: 18px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text] {
  width: 100%; font-family: inherit; font-size: 16px; padding: 12px 14px;
  border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .25); color: var(--text); outline: none;
}
input[type=text]:focus { border-color: var(--brand); }
.home-actions { display: flex; flex-direction: column; gap: 14px; }
.or { color: var(--muted); font-size: 13px; }
.join-row { display: flex; gap: 10px; }
.code-input { text-transform: uppercase; letter-spacing: 6px; text-align: center; font-weight: 700; flex: 1; }
.home-foot { color: var(--muted); font-size: 12px; opacity: .7; }

/* chip đăng nhập nhỏ */
.mini-auth { display: inline-flex; align-items: center; gap: 8px; }
.mini-auth .btn-google { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 10px; background: #fff; color: #1f2330; font-weight: 700; font-size: 13px; border: none; cursor: pointer; }
.mini-auth .btn-google svg { width: 16px; height: 16px; }
.mini-auth .me-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.mini-auth .me-chip img, .mini-auth .me-chip .av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--brand-grad); display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 12px; }

/* ============ Phòng chờ ============ */
#screen-lobby { align-items: center; justify-content: center; padding: 16px; }
.lobby-card { padding: 30px 36px; width: min(460px, 94vw); max-height: 94vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.lobby-card h2 { margin: 0 0 18px; }
.room-code-box { display: flex; align-items: center; gap: 12px; background: rgba(0, 0, 0, .25); border: 1px dashed var(--line); border-radius: 12px; padding: 12px 16px; }
.rc-label { color: var(--muted); font-size: 13px; }
.rc-code { font-size: 30px; font-weight: 800; letter-spacing: 8px; color: var(--brand-2); flex: 1; }
.btn-share { width: 100%; margin-top: 12px; }
.lobby-hint { color: var(--muted); font-size: 13px; margin: 10px 2px 18px; }
.player-list { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-direction: column; gap: 8px; }
.player-list li { display: flex; align-items: center; gap: 12px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.pdot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }
.pname { font-weight: 600; }
.tag-host { margin-left: auto; font-size: 11px; background: var(--gold); color: #3a2a00; padding: 2px 8px; border-radius: 20px; font-weight: 700; }
.tag-off { margin-left: auto; font-size: 11px; color: var(--muted); }
.tag-reg { font-size: 11px; color: var(--brand-2); }
.mode-select { margin: 18px 0; }
.ms-label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 8px; }
.ms-options { display: flex; gap: 10px; }
.ms-btn { flex: 1; font-family: inherit; font-size: 14px; font-weight: 600; padding: 12px; border-radius: 10px; cursor: pointer; color: var(--text); background: rgba(255, 255, 255, .05); border: 2px solid var(--line); transition: all .15s ease; }
.ms-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .12); }
.ms-btn.active { border-color: var(--brand); background: rgba(124, 92, 255, .18); color: #fff; }
.ms-btn:disabled { cursor: not-allowed; opacity: .5; }
.ms-desc { font-size: 12px; color: var(--muted); margin: 8px 2px 0; min-height: 16px; }
.team-divider { list-style: none; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin: 4px 0 -2px; padding-left: 4px; }
.lobby-rules { background: rgba(0, 0, 0, .2); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 18px; }
.lobby-actions { display: flex; gap: 12px; }
.lobby-actions .btn-lg { flex: 1; }
.muted { color: var(--muted); font-size: 13px; margin-top: 12px; text-align: center; }

/* ============ Khung game ============ */
#screen-game { flex-direction: column; overflow: hidden; }
.game-top { display: flex; align-items: center; justify-content: space-between; padding: 7px 16px; background: rgba(11, 16, 32, 0.6); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.gt-left { display: flex; align-items: center; gap: 18px; }
.gt-logo { font-weight: 800; letter-spacing: 1px; }
.gt-logo b { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gt-room { color: var(--muted); font-size: 14px; }
.gt-room b { color: var(--brand-2); letter-spacing: 2px; }
.gt-right { display: flex; gap: 8px; }

.game-layout { flex: 1; display: grid; grid-template-columns: 215px 1fr 235px; gap: 14px; padding: 12px 16px; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.panel h3 { margin: 0 0 12px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

.side-left { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.players-panel { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pp-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line); position: relative;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.pp-item.is-turn { border-color: var(--gold); background: rgba(255, 206, 74, .1); box-shadow: 0 0 0 1px var(--gold), 0 8px 22px rgba(255, 206, 74, .16); }
.pp-item.is-off { border-color: rgba(255, 93, 108, .45); background: rgba(255, 93, 108, .08); }
.pp-item.is-forfeited { opacity: .5; }

.pp-av {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 15px;
  box-shadow: 0 0 0 2px var(--ring, var(--line));
}
.pp-item.is-off .pp-av { filter: grayscale(.7); }

.pp-main { flex: 1; min-width: 0; }
.pp-name { font-weight: 700; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pp-you { font-size: 10px; font-weight: 800; color: var(--brand-2); background: rgba(32, 208, 255, .14); padding: 1px 6px; border-radius: 8px; }
.pp-meta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.seq-pips { display: inline-flex; gap: 3px; margin-left: 2px; }
.seq-pip { width: 16px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .14); }
.seq-pip.on { background: var(--brand-grad); }

.log-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.game-log { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; font-size: 13px; line-height: 1.5; }
.game-log li { padding: 4px 0; border-bottom: 1px solid rgba(255, 255, 255, .05); color: var(--muted); }
.game-log li.hl { color: var(--gold); font-weight: 600; }
.game-log:empty::before, .chat-box:empty::before { content: attr(data-empty); color: var(--muted-2); font-style: italic; font-size: 13px; }

/* ====== Bàn cờ ====== */
.board-area {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto; /* banner · bàn cờ co giãn · gợi ý */
  justify-items: center; align-items: center;
  min-height: 0; gap: 6px;
}
.turn-banner { font-weight: 700; font-size: 15px; padding: 7px 20px; border-radius: 30px; background: var(--panel); border: 1px solid var(--line); text-align: center; max-width: 100%; }
.turn-banner.my-turn { background: var(--brand-grad); color: #fff; box-shadow: var(--glow); }
.turn-banner.low-time { animation: lowtime .8s ease-in-out infinite; }
.turn-banner.low-time:not(.my-turn) { background: rgba(255, 93, 108, .2); border-color: rgba(255,93,108,.5); color: #ffd2d6; }
@keyframes lowtime { 0%,100% { box-shadow: 0 0 0 1px rgba(255,93,108,.4); } 50% { box-shadow: 0 0 16px rgba(255,93,108,.7); } }

.pp-status { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 10px; display: inline-flex; align-items: center; gap: 3px; }
.pp-status.off { background: rgba(255,93,108,.2); color: #ff9aa2; animation: lowtime 1.1s ease-in-out infinite; }
.pp-status.forfeit { background: rgba(255,93,108,.28); color: var(--red); }

.board {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px;
  background: linear-gradient(160deg, var(--felt), var(--felt2));
  padding: clamp(5px, 1vmin, 12px); border-radius: 16px;
  box-shadow: var(--shadow), inset 0 0 60px rgba(0, 0, 0, .25);
  /* Lấp ĐẦY chiều cao khả dụng (desktop bị giới hạn bởi chiều cao) — luôn vuông */
  height: 100%; width: auto;
  max-width: 100%;
  aspect-ratio: 1 / 1; border: 3px solid #0a4a36;
}
.cell {
  position: relative; border-radius: 8px;
  background: linear-gradient(180deg, #fefefe, #e9eef3); color: #20303f;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800; font-size: clamp(11px, 1.7vmin, 21px); line-height: 1;
  cursor: default; user-select: none; border: 1.5px solid transparent;
  transition: transform .08s ease, box-shadow .12s ease, border-color .12s ease;
}
.cell .rank { font-size: 1.1em; }
.cell .suit-s { font-size: 1em; margin-top: .08em; }
.cell.red-suit { color: #d2272f; }
.cell.black-suit { color: #1c2733; }
.cell.corner { background: radial-gradient(circle at 50% 40%, #ffe9a8, #f3c84e); color: #6b4e00; font-size: clamp(9px, 1.2vmin, 15px); }
.cell.corner::after { content: '★'; font-size: 1.6em; }
.cell.playable { cursor: pointer; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255, 206, 74, .5), 0 0 14px rgba(255, 206, 74, .55); }
.cell.playable:hover { transform: scale(1.07); z-index: 3; }
.cell.removable { cursor: pointer; box-shadow: 0 0 0 2px #ff6b74, 0 0 14px rgba(255, 107, 116, .6); }
.cell.removable:hover { transform: scale(1.07); z-index: 3; }

.chip { position: absolute; width: 66%; height: 66%; border-radius: 50%;
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, .35), inset 0 3px 4px rgba(255, 255, 255, .5), 0 2px 4px rgba(0, 0, 0, .3); }
.chip::after { content: ''; position: absolute; inset: 22%; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .5); }
.chip.red { background: radial-gradient(circle at 35% 30%, #ff8f98, var(--red)); }
.chip.blue { background: radial-gradient(circle at 35% 30%, #6fa8f0, var(--blue)); }
.chip.green { background: radial-gradient(circle at 35% 30%, #6fe0a3, var(--green)); }
.chip.orange { background: radial-gradient(circle at 35% 30%, #ffc07a, var(--orange)); }
.cell.in-seq .chip { box-shadow: inset 0 -3px 6px rgba(0,0,0,.35), 0 0 0 3px var(--gold), 0 0 12px rgba(255,206,74,.8); }

/* Chỉ số lá bài ở góc ô — luôn đọc được kể cả khi đã có chip */
.cell-idx {
  position: absolute;
  top: 2px; left: 3px;
  font-size: clamp(8px, 1.15vmin, 14px);
  font-weight: 800;
  line-height: 1;
  color: #11202e;
  z-index: 5;
  pointer-events: none;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff;
}
.cell-idx.red { color: #d2272f; }
.cell.last-seq { animation: pop .5s ease; }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }

.action-hint { min-height: 20px; color: var(--gold); font-size: 14px; font-weight: 600; text-align: center; }

/* ====== Chat ====== */
.side-right { min-height: 0; }
.chat-panel { height: 100%; display: flex; flex-direction: column; }
.chat-box { list-style: none; margin: 0 0 10px; padding: 0; overflow-y: auto; flex: 1; font-size: 13px; line-height: 1.5; }
.chat-box li { margin-bottom: 6px; word-wrap: break-word; }
.chat-box .cn { font-weight: 700; color: var(--brand-2); }
.chat-form { display: flex; gap: 6px; }
.chat-form input { flex: 1; padding: 8px 10px; font-size: 13px; }

/* ====== Bài trên tay (CĂN GIỮA) ====== */
.hand-bar {
  background: rgba(11, 16, 32, 0.7); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding: 6px 14px 10px;
  display: flex; flex-direction: column; align-items: center;   /* căn giữa */
}
.hand-label { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.hand {
  display: flex; gap: 10px; flex-wrap: wrap;
  align-items: center; justify-content: center;   /* căn giữa */
  max-width: 1000px;
}
.card {
  width: 64px; height: 90px; border-radius: 9px;
  background: linear-gradient(180deg, #fff, #eef2f6); color: #1c2733;
  display: flex; flex-direction: column; justify-content: space-between; padding: 7px 8px;
  cursor: pointer; box-shadow: 0 4px 10px rgba(0, 0, 0, .3); border: 2px solid transparent;
  transition: transform .1s ease, box-shadow .12s ease, border-color .12s ease;
  position: relative; flex-shrink: 0;
}
.card:hover { transform: translateY(-8px); box-shadow: 0 10px 20px rgba(0, 0, 0, .4); }
.card.selected { border-color: var(--gold); transform: translateY(-12px); box-shadow: 0 12px 24px rgba(255, 206, 74, .4); }
.card.red-suit { color: #d2272f; }
.card .c-top { font-size: 17px; font-weight: 800; line-height: 1; }
.card .c-mid { font-size: 26px; text-align: center; }
.card .c-bot { font-size: 17px; font-weight: 800; align-self: flex-end; transform: rotate(180deg); }
.card.dead { opacity: .5; }
.card .deadtag { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); background: #4b1f24; color: #ff9aa2; font-size: 9px; padding: 1px 6px; border-radius: 10px; white-space: nowrap; }
.card .jacktag { position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%); font-size: 9px; padding: 1px 6px; border-radius: 10px; white-space: nowrap; color: #fff; }
.card .jacktag.wild { background: #1f5a3a; }
.card .jacktag.remove { background: #5a1f2a; }

/* ====== Thanh điều hướng game (mobile) ====== */
.game-mobile-nav { display: none; }

/* ====== Modal ====== */
.modal { display: none; position: fixed; inset: 0; background: rgba(4, 12, 20, .75); backdrop-filter: blur(4px); z-index: 80; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal-card { background: linear-gradient(180deg, #15203f, #111936); border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: var(--shadow); padding: 28px 30px; width: min(560px, 94vw); max-height: 88vh; overflow-y: auto; position: relative; }
.modal-card h2 { margin: 0 0 16px; }
.modal-close { position: absolute; top: 14px; right: 16px; background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.rules-body { line-height: 1.65; color: #d6e4f2; }
.rules-body ul { padding-left: 20px; }
.rules-body b { color: var(--gold); }
.end-card { text-align: center; }
.trophy { font-size: 60px; }
#end-title { font-size: 30px; }
#end-sub { color: var(--muted); margin: 6px 0 24px; font-size: 17px; }
.end-actions { display: flex; gap: 12px; justify-content: center; }

/* ====== Toast ====== */
.toast { position: fixed; bottom: 130px; left: 50%; transform: translateX(-50%) translateY(20px); background: #2a1216; color: #ffd2d6; border: 1px solid #6e2b30; padding: 12px 22px; border-radius: 12px; opacity: 0; pointer-events: none; transition: all .3s ease; z-index: 90; font-weight: 600; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: #0f2e1f; color: #b9f0cf; border-color: #1f5a3a; }

/* ====== Responsive ====== */
@media (max-width: 1080px) {
  .game-layout { grid-template-columns: 200px 1fr; }
  .side-right { display: none; }
}

@media (max-width: 760px) {
  .game-top { padding: 8px 12px; }
  .gt-left { gap: 10px; }
  .gt-logo { font-size: 15px; }

  /* Bố cục dọc: bàn cờ giữa, các panel thành "sheet" trượt lên */
  .game-layout { display: flex; flex-direction: column; min-height: 0; padding: 10px; flex: 1; overflow: hidden; }
  .board-area { flex: 1; min-height: 0; gap: 8px; width: 100%; }
  .board { width: 100%; height: auto; max-width: 100%; max-height: 100%; }

  /* side panels -> sheet ẩn, mở bằng thanh nav dưới */
  .side-left, .side-right {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    max-height: 70vh; padding: 14px 14px calc(80px + env(safe-area-inset-bottom, 0));
    background: rgba(11, 16, 32, 0.97); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line-strong); border-radius: 18px 18px 0 0;
    transform: translateY(110%); transition: transform .25s ease; overflow-y: auto;
    flex-direction: column; display: flex;
  }
  .side-left.open, .side-right.open { transform: translateY(0); }
  .side-left .panel, .side-right .panel { background: transparent; border: none; padding: 0; }
  .log-panel { max-height: 40vh; }

  /* bài trên tay: chừa chỗ cho thanh nav dưới, không xuống dòng -> cuộn ngang */
  .hand-bar { padding: 8px 10px calc(64px + env(safe-area-inset-bottom, 0)); }
  .hand { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; min-height: 84px; max-width: 100%; padding: 4px 6px 8px; -webkit-overflow-scrolling: touch; }
  .hand::-webkit-scrollbar { height: 5px; }
  .card { width: 54px; height: 76px; }
  .card .c-mid { font-size: 21px; }
  .card .c-top, .card .c-bot { font-size: 15px; }

  /* thanh nav dưới của game */
  .game-mobile-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 75;
    height: 60px; background: rgba(11, 16, 32, 0.96); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .game-mobile-nav button {
    flex: 1; background: none; border: none; color: var(--muted); font-family: inherit;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 11px; font-weight: 600; cursor: pointer;
  }
  .game-mobile-nav button .gn-ico { font-size: 20px; line-height: 1; position: relative; }
  .game-mobile-nav button.active { color: var(--brand-2); }
  .game-mobile-nav .gn-badge { position: absolute; top: -4px; right: -8px; background: var(--red); color: #fff; font-size: 9px; min-width: 15px; height: 15px; border-radius: 8px; display: grid; place-items: center; padding: 0 3px; }

  .toast { bottom: 80px; }
  .modal { padding: 12px; }
  .modal-card { padding: 22px 18px; }
}

@media (max-width: 420px) {
  .board { width: 96vw; }
  .card { width: 48px; height: 68px; }
}
