/* Ball vs Ball — arcade night palette, single dark theme by design.
   Layout: one phone-width column; each menu is its own full-height screen
   (top bar · scrolling body · bottom action bar). */
@font-face { font-family: "Lilita One"; src: url("../fonts/lilita-400.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Kanit"; src: url("../fonts/kanit-400.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Kanit"; src: url("../fonts/kanit-500.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Kanit"; src: url("../fonts/kanit-600.woff") format("woff"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Noto Sans Lao"; src: url("../fonts/lao-500.woff") format("woff"); font-weight: 400 500; font-display: swap; unicode-range: U+0E80-0EFF, U+200B-200D, U+25CC; }
@font-face { font-family: "Noto Sans Lao"; src: url("../fonts/lao-700.woff") format("woff"); font-weight: 600 900; font-display: swap; unicode-range: U+0E80-0EFF, U+200B-200D, U+25CC; }

:root {
  --bg: #0b1530; --bg-deep: #070f24; --panel: #13234a; --panel-2: #1b2f5e; --line: #2b4380;
  --fg: #ecf1ff; --muted: #9fb0d8; --dim: #6f82b3;
  --gold: #ffb423; --gold-hi: #ffd45c; --gold-lo: #c27a00; --gold-ink: #2a1600;
  --blue: #2f7bff; --blue-hi: #5aa0ff; --blue-lo: #1a4fb8;
  --p1: #3fa9ff; --p2: #ff5a6e; --good: #4ade80; --danger: #ff6b6b;
  --display: "Lilita One", "Noto Sans Lao", "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  --body: "Kanit", "Noto Sans Lao", "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  --fire: #ff5a36; --fire-hi: #ffd25a;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; background: var(--bg-deep); color: var(--fg); }
body {
  font-family: var(--body); font-size: 15px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
  background: radial-gradient(120% 60% at 50% 0%, #17295a 0%, var(--bg) 45%, var(--bg-deep) 100%) fixed;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 2px; }
img { max-width: 100%; }

#app { position: relative; height: 100%; max-width: 560px; margin: 0 auto; overflow: hidden; }
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: enter .22s ease-out;
}
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.scroll {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-left: var(--gutter-l); padding-right: var(--gutter-r); padding-block: 4px 20px;
  display: flex; flex-direction: column; gap: 14px;
}

/* ---------- icons + buttons ---------- */
.ico { width: 22px; height: 22px; flex: none; }
.bigbtn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: 0; border-radius: 16px; padding: 14px 18px; text-align: left;
  font-weight: 600; transition: transform .08s ease, box-shadow .08s ease, filter .15s;
}
.bigbtn .ico { width: 28px; height: 28px; }
.bigbtn .bb-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.bigbtn b { font-size: 19px; font-weight: 600; }
.bigbtn small { font-size: 13px; font-weight: 400; opacity: .85; }
.bigbtn.gold { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); color: var(--gold-ink); box-shadow: 0 5px 0 var(--gold-lo), 0 10px 24px -10px rgba(255,180,35,.6); }
.bigbtn.blue { background: linear-gradient(180deg, var(--blue-hi), var(--blue)); color: #fff; box-shadow: 0 5px 0 var(--blue-lo), 0 10px 24px -10px rgba(47,123,255,.6); }
.bigbtn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.35); }
.bigbtn:disabled { filter: grayscale(.85) brightness(.6); box-shadow: 0 5px 0 #2a3557; }
.bigbtn.wide { justify-content: center; text-align: center; }
.bigbtn.wide .bb-text { align-items: center; }
.midbtn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; font-weight: 500; box-shadow: 0 4px 0 #0c1838;
  transition: transform .08s ease, box-shadow .08s ease;
}
.midbtn:active { transform: translateY(2px); box-shadow: 0 2px 0 #0c1838; }
.midbtn.wide { width: 100%; }
.iconbtn {
  width: 44px; height: 44px; border-radius: 14px; flex: none;
  display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); padding: 0;
}
.iconbtn svg { width: 22px; height: 22px; }
.iconbtn.ghost { visibility: hidden; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  border-radius: 999px; padding: 8px 14px; background: var(--panel-2); border: 1px solid var(--line);
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
.pill .ico { width: 18px; height: 18px; }
.pill.danger { color: #ffb3b3; border-color: #6b2b3e; }

/* ---------- top / bottom bars ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding-left: var(--gutter-l); padding-right: var(--gutter-r); padding-block: 12px 10px;
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 600; text-align: center; flex: 1; min-width: 0; }
.topbar.slim { padding-block: 8px 4px; }
.bottombar {
  padding-left: var(--gutter-l); padding-right: var(--gutter-r); padding-block: 10px 14px;
  background: linear-gradient(180deg, rgba(7,15,36,0), rgba(7,15,36,.9) 30%);
  display: flex; flex-direction: column; gap: 8px;
}

/* ---------- home ---------- */
.home { overflow: hidden; }
.showcase { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; }
.home::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(80% 45% at 50% 32%, rgba(11,21,48,.15), rgba(7,15,36,.82) 70%),
              linear-gradient(180deg, rgba(7,15,36,0) 50%, rgba(7,15,36,.9));
}
.home-inner {
  position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 18px;
  padding-left: var(--gutter-l); padding-right: var(--gutter-r); padding-block: 24px 16px;
}
.logo {
  display: flex; flex-direction: column; align-items: center; line-height: .86;
  transform: rotate(-4deg); margin-bottom: 4px; animation: bob 4s ease-in-out infinite;
}
@keyframes bob { 50% { transform: rotate(-4deg) translateY(-6px); } }
.logo-word {
  font-family: var(--display); font-size: clamp(64px, 21vw, 104px); letter-spacing: .02em; color: #fff;
  text-shadow: 0 7px 0 #08122b, 4px 4px 0 #08122b, -4px 4px 0 #08122b, 4px -3px 0 #08122b, -4px -3px 0 #08122b, 0 -4px 0 #08122b, 0 14px 30px rgba(0,0,0,.5);
}
.logo-vs {
  font-family: var(--display); font-size: clamp(30px, 9vw, 44px); color: var(--gold-ink);
  background: linear-gradient(180deg, var(--gold-hi), #ff9a1f); border-radius: 50%;
  width: 1.9em; height: 1.9em; display: grid; place-items: center; margin: -.32em 0;
  position: relative; z-index: 1; transform: rotate(8deg);
  box-shadow: 0 0 0 6px #08122b, 0 0 30px rgba(255,190,60,.55);
}
.tagline { margin: 0; color: var(--muted); font-size: 15px; text-align: center; }
.home-menu { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.home-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.home-foot { display: flex; align-items: center; gap: 12px; color: var(--dim); font-size: 12px; margin-top: 4px; }

/* ---------- character select ---------- */
.vs-slots { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); gap: 8px; align-items: center; }
.slot {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0;
  background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 10px 8px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.slot-tag { font-size: 12px; font-weight: 600; padding: 1px 10px; border-radius: 999px; color: #fff; }
.slot.p1 .slot-tag { background: var(--p1); }
.slot.p2 .slot-tag { background: var(--p2); }
.slot-orb { width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-deep); border: 2px dashed var(--line); }
.slot-orb img { width: 72px; height: 72px; }
.slot-orb i { font-style: normal; font-family: var(--display); font-size: 30px; color: var(--dim); }
.slot.filled .slot-orb { border: 0; background: none; }
.slot-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.slot.active.p1 { border-color: var(--p1); box-shadow: 0 0 0 3px rgba(63,169,255,.25); }
.slot.active.p2 { border-color: var(--p2); box-shadow: 0 0 0 3px rgba(255,90,110,.25); }
.vs-badge {
  font-family: var(--display); font-size: 22px; color: var(--gold-ink); width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; background: linear-gradient(180deg, var(--gold-hi), #ff9a1f); box-shadow: 0 0 0 4px #08122b;
}
.hint { margin: 0; text-align: center; color: var(--muted); font-size: 14px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 10px 4px 8px;
  transition: transform .1s, border-color .15s, background .15s;
}
.tile:active { transform: scale(.96); }
.tile img { width: 58px; height: 58px; }
.tile .t-th { font-weight: 600; font-size: 14px; line-height: 1.2; }
.tile .t-en { font-family: var(--display); font-size: 11px; letter-spacing: .06em; color: var(--muted); }
.tile.focus { background: var(--panel-2); border-color: var(--c); }
.tile .badge {
  position: absolute; top: 6px; width: 22px; height: 22px; border-radius: 50%; color: #fff;
  font-family: var(--display); font-size: 13px; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--panel);
}
.tile .badge.b1 { left: 6px; background: var(--p1); }
.tile .badge.b2 { right: 6px; background: var(--p2); }
.tiles.compact .tile img { width: 48px; height: 48px; }
.tile.wide {
  grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 14px; padding: 10px 14px; text-align: left;
  background: linear-gradient(110deg, #3a160f 0%, var(--panel) 55%); border-color: #7a3220;
}
.tile.wide img { width: 72px; height: 72px; flex: none; }
.tiles.compact .tile.wide img { width: 60px; height: 60px; }
.tile.wide .t-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile.wide .t-th { font-size: 20px; font-weight: 700; color: var(--fire-hi); }
.tile.wide .t-en { font-size: 12px; }
.tile.wide .t-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tile.wide.focus { background: linear-gradient(110deg, #57200f 0%, var(--panel-2) 60%); border-color: var(--c); }
.tile.wide .badge.b1 { left: auto; right: 34px; }
.lao { font-family: var(--body) !important; font-weight: 700; letter-spacing: 0 !important; }
.nm .en.lao { color: var(--fire-hi); }
.r-name.lao { font-size: clamp(34px, 10vw, 46px); line-height: 1.25; }
.chip.new { background: linear-gradient(180deg, var(--fire-hi), var(--fire)); color: #2a0e00; font-weight: 600; }
.tiles.compact .tile.mine { border-color: var(--gold); background: var(--panel-2); }
.info {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px;
  display: grid; grid-template-columns: auto minmax(0,1fr); gap: 6px 14px; align-items: start;
}
.info img { width: 64px; height: 64px; grid-row: span 3; }
.info .i-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.info .i-en { font-family: var(--display); font-size: 22px; letter-spacing: .03em; line-height: 1; color: var(--c); }
.info .i-th { color: var(--muted); }
.info .i-skill { font-weight: 600; color: var(--c); }
.info p { margin: 0; color: var(--muted); font-size: 14px; grid-column: 1 / -1; }
.stats { display: flex; flex-wrap: wrap; gap: 6px; grid-column: 1 / -1; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); color: var(--fg); font-variant-numeric: tabular-nums; }
.chip.role { background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--c); }

/* ---------- battle ---------- */
.battle .topbar .clock { font-family: var(--display); font-size: 22px; letter-spacing: .04em; font-variant-numeric: tabular-nums; color: var(--muted); }
.hud {
  display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); gap: 8px; align-items: start;
  padding-left: var(--gutter-l); padding-right: var(--gutter-r); padding-block: 2px 8px;
}
.side { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.nm { display: flex; align-items: center; gap: 6px; min-width: 0; }
.side.r .nm { flex-direction: row-reverse; }
.nm img { width: 26px; height: 26px; flex: none; }
.nm .en { font-family: var(--display); font-size: 17px; letter-spacing: .03em; line-height: 1; color: var(--c); white-space: nowrap; }
.nm .who { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bar { height: 12px; border-radius: 6px; background: var(--panel-2); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); display: flex; }
.side.r .bar { justify-content: flex-end; }
.bar i { display: block; height: 100%; width: 100%; background: var(--c); transition: width .15s ease-out; }
.meta { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.side.r .meta { flex-direction: row-reverse; }
.meta b { color: var(--fg); font-weight: 600; }
.skt { overflow: hidden; text-overflow: ellipsis; }
.cd { height: 4px; border-radius: 2px; background: var(--panel-2); overflow: hidden; display: flex; }
.side.r .cd { justify-content: flex-end; }
.cd i { display: block; height: 100%; width: 0; background: var(--c); opacity: .85; }
.ult { height: 6px; border-radius: 3px; background: #2a1410; overflow: hidden; display: flex; box-shadow: inset 0 0 0 1px #5a2418; }
.side.r .ult { justify-content: flex-end; }
.ult i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--fire), var(--fire-hi)); transition: width .2s ease-out; }
.ult.full { box-shadow: inset 0 0 0 1px var(--fire-hi), 0 0 10px rgba(255,140,60,.7); animation: ultpulse .8s ease-in-out infinite alternate; }
@keyframes ultpulse { to { box-shadow: inset 0 0 0 1px var(--fire-hi), 0 0 2px rgba(255,140,60,.3); } }
.hud .chips { display: flex; gap: 4px; min-height: 18px; flex-wrap: wrap; }
.side.r .chips { justify-content: flex-end; }
.hud .chips span { font-size: 11px; line-height: 1; padding: 3px 7px; border-radius: 999px; background: var(--panel-2); }
.vsmark { font-family: var(--display); color: var(--gold); font-size: 20px; padding-top: 4px; }
.stage-wrap { flex: none; display: grid; place-items: center; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.battle .topbar { margin-top: auto; }
.battle .battle-foot { margin-bottom: auto; }
.stage {
  position: relative; width: min(100%, max(260px, calc(100dvh - 252px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))));
  aspect-ratio: 1; max-width: 100%; border-radius: 16px; overflow: hidden;
  box-shadow: 0 0 0 1px var(--line), 0 18px 40px -18px rgba(0,0,0,.6);
}
.stage canvas { display: block; width: 100%; height: 100%; touch-action: manipulation; background: #0a1430; }
.battle-foot { display: flex; justify-content: center; align-items: center; gap: 10px; padding-block: 10px 12px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.online-tag { font-size: 13px; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { font-family: var(--display); font-size: 16px; letter-spacing: .03em; color: var(--muted); background: var(--panel); border: 0; padding: 10px 16px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--panel-2); color: var(--gold); }
.seg.small button { padding: 8px 12px; font-size: 14px; }
.countdown {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  font-family: var(--display); font-size: clamp(80px, 30vw, 150px); color: #fff;
  text-shadow: 0 6px 0 #08122b, 4px 4px 0 #08122b, -4px 4px 0 #08122b, 0 -4px 0 #08122b, 0 0 40px rgba(255,190,60,.5);
}
.countdown.go { font-family: var(--body); font-weight: 600; color: var(--gold-hi); }
.countdown span { animation: pop .7s ease-out both; }
@keyframes pop { 0% { transform: scale(1.8); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 80% { opacity: 1; } 100% { transform: scale(.85); opacity: 0; } }
.overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(7,13,30,.78); padding: 16px; animation: fade .2s ease-out; }
@keyframes fade { from { opacity: 0; } }
.ov-card {
  width: min(100%, 300px); display: flex; flex-direction: column; align-items: stretch; gap: 10px; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 18px 16px; box-shadow: 0 20px 50px -20px rgba(0,0,0,.7);
}
.ov-card h2 { margin: 0 0 4px; font-size: 20px; }
.ov-card.result { align-items: center; }
.ov-k { font-size: 15px; color: var(--muted); font-weight: 500; }
.r-orb { width: 96px; height: 96px; animation: winpop .5s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes winpop { from { transform: scale(.3) rotate(-40deg); } }
.r-name { font-family: var(--display); font-size: clamp(36px, 11vw, 50px); line-height: 1; color: var(--c, var(--fg)); }
.r-sub { color: var(--muted); font-size: 14px; }
.r-btns { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

/* ---------- roster ---------- */
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 10px; }
.rcard { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rcard .top { display: flex; align-items: center; gap: 10px; }
.rcard img { width: 52px; height: 52px; flex: none; }
.rcard .en { font-family: var(--display); font-size: 19px; letter-spacing: .03em; line-height: 1; color: var(--c); }
.rcard .th { font-size: 13px; color: var(--muted); }
.rcard .sk { font-weight: 600; color: var(--c); }
.rcard p { margin: 0; font-size: 14px; color: var(--muted); }
.rcard.special { background: linear-gradient(160deg, #3a160f, var(--panel) 60%); border-color: #7a3220; }
.rcard.special .th { font-size: 16px; font-weight: 700; color: var(--fire-hi); }
.ult-line { display: flex; flex-direction: column; gap: 2px; grid-column: 1 / -1; padding: 8px 10px; border-radius: 12px; background: rgba(255,90,54,.12); border: 1px solid rgba(255,120,60,.35); font-size: 13px; color: var(--muted); }
.ult-line b { color: var(--fire-hi); font-weight: 600; font-size: 14px; }

/* ---------- settings ---------- */
.group { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.group-h { margin: 0; padding: 12px 14px 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; min-height: 56px; }
.row + .row { border-top: 1px solid var(--line); }
.row > span { display: flex; flex-direction: column; min-width: 0; }
.row small { color: var(--muted); font-size: 12px; }
.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 999px; background: #34406a; position: relative; flex: none; cursor: pointer; transition: background .15s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch:checked { background: var(--good); }
.switch:checked::after { transform: translateX(20px); }
.fine { color: var(--dim); font-size: 12px; text-align: center; margin: 4px 0 0; }

/* ---------- online ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card-h { margin: 0; font-size: 17px; font-weight: 600; }
.card-p { margin: -6px 0 0; color: var(--muted); font-size: 14px; }
.lab { font-size: 13px; color: var(--muted); }
.field { width: 100%; background: var(--bg-deep); border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 17px; }
.field:focus { border-color: var(--gold); outline: none; }
.field.code { font-family: var(--display); font-size: 30px; letter-spacing: .4em; text-align: center; padding: 10px 0 10px .4em; }
.or { display: flex; align-items: center; gap: 12px; color: var(--dim); font-size: 13px; }
.or::before, .or::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.status-line { margin: 0; text-align: center; min-height: 22px; color: var(--muted); }
.status-line.err { color: #ffb3b3; }
.code-card { align-items: center; text-align: center; }
.room-code { font-family: var(--display); font-size: clamp(44px, 14vw, 60px); letter-spacing: .18em; line-height: 1.1; color: var(--gold-hi); padding-left: .18em; font-variant-numeric: tabular-nums; }
.code-actions { display: flex; gap: 8px; }
.players { display: flex; flex-direction: column; gap: 8px; }
.prow { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--sc); border-radius: 14px; padding: 10px 12px; }
.prow img, .prow .empty { width: 44px; height: 44px; }
.prow .empty { border-radius: 50%; border: 2px dashed var(--line); }
.prow .pn { display: flex; flex-direction: column; min-width: 0; }
.prow .pn b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.prow .pn b svg { width: 16px; height: 16px; color: var(--gold); flex: none; }
.prow .pn small { color: var(--muted); font-size: 12px; }
.state { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.state.ok { background: rgba(74,222,128,.16); color: var(--good); }
.score { text-align: center; color: var(--muted); font-size: 14px; }
.score b { font-family: var(--display); font-size: 22px; color: var(--fg); letter-spacing: .06em; }
.sec-h { margin: 4px 0 0; font-size: 15px; font-weight: 600; }
.lb-msg { margin: 0; text-align: center; color: var(--muted); font-size: 14px; min-height: 21px; }
.conn { width: 44px; height: 44px; display: grid; place-items: center; flex: none; }
.conn::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 4px rgba(255,107,107,.2); }
.conn.up::before { background: var(--good); box-shadow: 0 0 0 4px rgba(74,222,128,.2); }

/* ---------- modal + toast ---------- */
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: rgba(5,10,24,.7); animation: fade .15s ease-out; }
.modal-card { width: min(100%, 360px); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.modal-card h2 { margin: 0; font-size: 19px; }
.modal-body { color: var(--muted); font-size: 15px; }
.modal-body ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.modal-body b { color: var(--fg); }
.modal-btns { display: flex; gap: 10px; }
.apk-note { margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.row:has(> [data-apk][hidden]) { display: none; }
.modal-btns > * { flex: 1; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 40;
  max-width: calc(100% - 32px); background: #1f356b; border: 1px solid var(--line); color: var(--fg);
  padding: 10px 16px; border-radius: 14px; font-size: 14px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.6); animation: fade .2s ease-out;
}

@media (min-width: 600px) {
  #app { border-left: 1px solid rgba(43,67,128,.5); border-right: 1px solid rgba(43,67,128,.5); }
}
@media (max-height: 640px) {
  .logo-word { font-size: clamp(52px, 15vw, 80px); }
  .home-inner { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
