:root {
  --bg: #0b0d13;
  --bg2: #10131c;
  --panel: #161b27;
  --panel2: #1d2331;
  --line: #262d3d;
  --line2: #333c50;
  --ink: #e8ecf5;
  --ink2: #a7b0c4;
  --ink3: #6c7791;
  --acc: #7c5cff;
  --acc2: #5ecfd6;
  --good: #46d18a;
  --warn: #ffc857;
  --bad: #ff6b7a;
  --gold: #ffd166;
  --silver: #cfd6e4;
  --bronze: #d98f52;
  --r: 14px;
  --r2: 10px;
  --shadow: 0 12px 32px rgba(0,0,0,.45);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background:
    radial-gradient(1100px 620px at 12% -10%, #221a4d 0%, transparent 60%),
    radial-gradient(900px 500px at 105% 8%, #0d3a44 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.02em; }
ol, ul { margin: 0; padding: 0; list-style: none; }

.screen { display: none; min-height: 100vh; }
.screen.on { display: block; }
.muted { color: var(--ink2); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ---------- buttons ---------- */
.btn {
  background: var(--panel2);
  border: 1px solid var(--line2);
  color: var(--ink);
  padding: 9px 15px;
  border-radius: var(--r2);
  cursor: pointer;
  font-weight: 600;
  transition: transform .08s ease, background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { background: #262e40; border-color: #43506d; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #8a6bff, #6a48f0); border-color: #8f74ff; box-shadow: 0 6px 18px rgba(124,92,255,.3); }
.btn.primary:hover { background: linear-gradient(180deg, #9a7dff, #7a58ff); }
.btn.good { background: linear-gradient(180deg, #3fd68c, #27b473); border-color: #4fe09a; color: #07251a; }
.btn.warn { background: #2a2418; border-color: #6b5a2c; color: var(--warn); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink2); }
.btn.ghost:hover { color: var(--ink); border-color: var(--line2); background: rgba(255,255,255,.03); }
.btn.big { padding: 13px 22px; font-size: 16px; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.tiny { padding: 4px 9px; font-size: 11.5px; border-radius: 7px; }
.btn.wide { width: 100%; }
.btn.on { background: linear-gradient(180deg, #3fd68c, #27b473); border-color: #4fe09a; color: #07251a; }

input[type=text], input:not([type]) {
  background: #0d111a; border: 1px solid var(--line2); border-radius: var(--r2);
  padding: 10px 13px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(124,92,255,.18); }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,0)) , var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card-h { font-size: 13px; text-transform: uppercase; letter-spacing: .09em; color: var(--ink2); margin-bottom: 12px; font-weight: 700; }

/* ---------- home ---------- */
.home-wrap { max-width: 1180px; margin: 0 auto; padding: 40px 20px 60px; }
.brand { display: flex; align-items: center; gap: 18px; margin-bottom: 30px; }
.brand-mark {
  font-size: 44px; width: 78px; height: 78px; display: grid; place-items: center;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 20px; box-shadow: var(--shadow);
}
.brand h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1; }
.brand h1 span { background: linear-gradient(92deg, var(--acc), var(--acc2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { margin: 8px 0 0; color: var(--ink2); font-size: 15px; }

.home-grid { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.field span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink2); margin-bottom: 6px; font-weight: 700; }
.join-actions { margin-top: 16px; }
.join-actions .btn.big { width: 100%; }
.or { text-align: center; margin: 14px 0; position: relative; color: var(--ink3); font-size: 12px; }
.or::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line); }
.or span { position: relative; background: var(--panel); padding: 0 12px; }
.code-row { display: flex; gap: 8px; }
.code-row input { text-transform: uppercase; letter-spacing: .28em; font-family: var(--mono); font-weight: 700; text-align: center; }
.presets-inline { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  background: var(--panel2); border: 1px solid var(--line2); border-radius: 999px;
  padding: 5px 12px; font-size: 12.5px; cursor: pointer; font-weight: 600;
}
.chip:hover { border-color: var(--acc); color: #fff; }

.room-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow: auto; }
.room-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r2); padding: 9px 12px; cursor: pointer;
}
.room-row:hover { border-color: var(--acc); }
.room-row .rcode { font-family: var(--mono); font-weight: 700; letter-spacing: .12em; }

.board li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.board li:last-child { border: 0; }
.board .rk { color: var(--ink3); font-family: var(--mono); font-size: 12px; }
.board .pts { font-family: var(--mono); color: var(--acc2); font-weight: 700; }

.gallery-card { margin-bottom: 16px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.gtile { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r2); padding: 12px; }
.gtile .gt-h { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 5px; }
.gtile .gt-h i { font-style: normal; font-size: 19px; }
.gtile p { margin: 0; font-size: 12.5px; color: var(--ink2); line-height: 1.45; }
.cat { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; padding: 2px 7px; border-radius: 999px; margin-left: auto; }

.foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); vertical-align: middle; }
.dot.ok { background: var(--good); box-shadow: 0 0 8px var(--good); }

/* ---------- lobby ---------- */
.lobby-wrap { max-width: 1280px; margin: 0 auto; padding: 24px 20px 50px; }
.lobby-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 14px; flex-wrap: wrap; }
.room-id { display: flex; align-items: center; gap: 12px; }
.code {
  font-family: var(--mono); font-size: 30px; font-weight: 800; letter-spacing: .2em;
  background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r2);
  padding: 6px 16px; cursor: pointer; color: var(--acc2);
}
.code:hover { border-color: var(--acc2); }
.lobby-grid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.col-left, .col-right { display: flex; flex-direction: column; gap: 16px; }

.players { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.prow { display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r2); padding: 8px 11px; }
.prow.me { border-color: var(--acc); }
.prow.off { opacity: .45; }
.av { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #0a0c11; flex: none; }
.pname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; padding: 2px 6px; border-radius: 5px; background: var(--line); color: var(--ink2); font-weight: 800; }
.tag.host { background: #3b2f12; color: var(--gold); }
.tag.ready { background: #10331f; color: var(--good); }
.tag.spec { background: #1a2733; color: var(--acc2); }
.tag.out { background: #331717; color: var(--bad); }
.kick { margin-left: auto; background: none; border: 0; color: var(--ink3); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.kick:hover { color: var(--bad); background: rgba(255,107,122,.1); }
.ready-bar { display: flex; gap: 8px; margin-bottom: 8px; }
.ready-bar .btn { flex: 1; }

.preset-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.preset {
  text-align: left; background: var(--panel2); border: 1px solid var(--line);
  border-radius: var(--r2); padding: 11px 12px; cursor: pointer;
}
.preset:hover { border-color: var(--acc); }
.preset b { display: block; font-size: 14px; margin-bottom: 3px; }
.preset span { font-size: 11.5px; color: var(--ink2); line-height: 1.4; display: block; }

.pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 7px; }
.pool-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer;
  background: #11151f; border: 1px solid var(--line); border-radius: var(--r2);
  font-size: 13px; font-weight: 600; transition: all .12s;
}
.pool-item i { font-style: normal; font-size: 17px; }
.pool-item.on { background: var(--panel2); border-color: currentColor; }
.pool-item:not(.on) { opacity: .42; }
.pool-item:hover { opacity: 1; }
.pool-item span { color: var(--ink); }

.config-groups { display: flex; flex-direction: column; gap: 10px; }
.cgroup { border: 1px solid var(--line); border-radius: var(--r2); overflow: hidden; background: #11151f; }
.cgroup > summary {
  padding: 11px 14px; cursor: pointer; font-weight: 700; font-size: 13.5px;
  display: flex; align-items: center; gap: 9px; list-style: none; user-select: none;
}
.cgroup > summary::-webkit-details-marker { display: none; }
.cgroup > summary::after { content: '▾'; margin-left: auto; color: var(--ink3); transition: transform .15s; }
.cgroup[open] > summary::after { transform: rotate(180deg); }
.cbody { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 13px; }
.citem { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.citem .cname { font-size: 13.5px; font-weight: 600; }
.citem .chelp { grid-column: 1 / -1; font-size: 11.5px; color: var(--ink3); line-height: 1.4; margin-top: -2px; }
.citem .cval { font-family: var(--mono); font-size: 13px; color: var(--acc2); font-weight: 700; min-width: 54px; text-align: right; }
.citem input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--acc); margin: 2px 0 0; }
.seg { display: flex; gap: 4px; flex-wrap: wrap; grid-column: 1 / -1; margin-top: 3px; }
.seg button {
  flex: 1 1 auto; background: #0e121b; border: 1px solid var(--line); color: var(--ink2);
  padding: 6px 10px; border-radius: 8px; cursor: pointer; font-size: 12.5px; font-weight: 600;
}
.seg button.on { background: var(--acc); border-color: var(--acc); color: #fff; }
.toggle { width: 46px; height: 26px; border-radius: 999px; background: #1b2130; border: 1px solid var(--line2); position: relative; cursor: pointer; transition: background .15s; }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink3); transition: .16s; }
.toggle.on { background: rgba(70,209,138,.25); border-color: var(--good); }
.toggle.on::after { left: 22px; background: var(--good); }

.chat-card { min-height: 240px; display: flex; flex-direction: column; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; font-size: 13px; max-height: 300px; padding-right: 4px; }
.chat-log .cm { line-height: 1.45; word-break: break-word; }
.chat-log .cm b { font-weight: 700; }
.chat-log .sys { color: var(--ink3); font-style: italic; font-size: 12px; }
.chat-form { display: flex; gap: 7px; margin-top: 10px; }

/* ---------- round ---------- */
#screen-round { display: none; flex-direction: column; height: 100vh; height: 100dvh; }
#screen-round.on { display: flex; }
.round-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px; background: rgba(11,13,19,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.rh-left, .rh-right { display: flex; align-items: center; gap: 10px; }
.round-pill { font-family: var(--mono); font-size: 12px; color: var(--ink2); background: var(--panel2); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); }
.game-title { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.diff-pill { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; padding: 3px 9px; border-radius: 999px; }
.diff-chill { background: #10331f; color: var(--good); }
.diff-normal { background: #1a2733; color: var(--acc2); }
.diff-hard { background: #3a2412; color: #ff9f5a; }
.diff-brutal { background: #3a1420; color: var(--bad); }
.sd-pill { background: var(--bad); color: #180007; font-size: 10.5px; font-weight: 900; letter-spacing: .12em; padding: 3px 9px; border-radius: 999px; animation: pulse 1s infinite; }
.clock { font-family: var(--mono); font-size: 26px; font-weight: 800; min-width: 92px; text-align: right; letter-spacing: -.02em; }
.clock.low { color: var(--bad); animation: pulse .9s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.timebar { height: 3px; background: var(--line); }
.timebar-fill { height: 100%; background: linear-gradient(90deg, var(--acc), var(--acc2)); transition: width .3s linear; }
.timebar-fill.low { background: var(--bad); }

.round-body { flex: 1; display: grid; grid-template-columns: 232px 1fr; gap: 0; min-height: 0; }
.rivals { border-right: 1px solid var(--line); padding: 14px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; background: rgba(0,0,0,.16); }
.rv { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); padding: 8px 10px; }
.rv.me { border-color: var(--acc); }
.rv-top { display: flex; align-items: center; gap: 7px; font-size: 13px; margin-bottom: 6px; }
.rv-top .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-top .pl { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--gold); font-weight: 800; }
.rv-bar { height: 6px; background: #0c1018; border-radius: 999px; overflow: hidden; }
.rv-bar i { display: block; height: 100%; border-radius: 999px; transition: width .4s ease; }
.rv-meta { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink3); margin-top: 4px; font-family: var(--mono); }

.stage { padding: 20px; overflow: auto; display: flex; flex-direction: column; align-items: center; min-height: 0; }
.game-root { width: 100%; max-width: 900px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.rules-line { max-width: 760px; text-align: center; color: var(--ink3); font-size: 12.5px; line-height: 1.5; margin: 18px 0 0; }
.banner { width: 100%; max-width: 760px; padding: 11px 15px; border-radius: var(--r2); font-weight: 700; text-align: center; margin-bottom: 4px; }
.banner.good { background: rgba(70,209,138,.14); color: var(--good); border: 1px solid rgba(70,209,138,.35); }
.banner.bad { background: rgba(255,107,122,.12); color: var(--bad); border: 1px solid rgba(255,107,122,.3); }
.banner.info { background: rgba(94,207,214,.1); color: var(--acc2); border: 1px solid rgba(94,207,214,.28); }

.taunt-bar { display: flex; gap: 6px; justify-content: center; padding: 8px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.taunt-bar button { background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: 5px 11px; cursor: pointer; font-size: 15px; }
.taunt-bar button:hover { border-color: var(--acc); transform: translateY(-2px); }

.feed { position: fixed; right: 16px; top: 74px; display: flex; flex-direction: column; gap: 7px; pointer-events: none; z-index: 40; max-width: 300px; }
.feed .fi {
  background: rgba(22,27,39,.95); border: 1px solid var(--line2); border-radius: var(--r2);
  padding: 8px 12px; font-size: 13px; box-shadow: var(--shadow); animation: slidein .25s ease;
}
.feed .fi.solve { border-color: var(--good); }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } }

.chat-toggle {
  position: fixed; right: 16px; bottom: 16px; width: 46px; height: 46px; border-radius: 50%;
  background: var(--panel2); border: 1px solid var(--line2); cursor: pointer; font-size: 19px; z-index: 50; box-shadow: var(--shadow);
}
.chat-toggle .badge { position: absolute; top: -3px; right: -3px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 800; border-radius: 999px; padding: 1px 5px; }
.chat-drawer {
  position: fixed; right: 16px; bottom: 72px; width: 320px; max-height: 46vh;
  background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); padding: 12px; z-index: 50;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
}

/* ---------- break / end ---------- */
.break-wrap, .end-wrap { max-width: 1200px; margin: 0 auto; padding: 30px 20px 60px; }
.break-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.break-head h2 { font-size: 30px; }
.next-in { text-align: right; }
.next-in span { font-family: var(--mono); font-size: 40px; font-weight: 800; color: var(--acc2); display: block; line-height: 1; }
.next-in small { color: var(--ink3); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.break-grid { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 16px; align-items: start; }
.round-rows { display: flex; flex-direction: column; gap: 7px; }
.rr { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r2); padding: 10px 12px; }
.rr.win { border-color: var(--good); }
.rr-top { display: flex; align-items: center; gap: 9px; }
.rr-top .pts { margin-left: auto; font-family: var(--mono); font-weight: 800; color: var(--acc2); }
.rr-parts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.part { font-size: 11px; background: #0e121b; border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; color: var(--ink2); }
.part.neg { color: var(--bad); border-color: rgba(255,107,122,.3); }

.answer-box { font-size: 15px; line-height: 1.55; word-break: break-word; }
.answer-box .big-ans { font-family: var(--mono); font-size: 26px; font-weight: 800; color: var(--good); letter-spacing: .06em; margin-bottom: 8px; }
.answer-box .extra { color: var(--ink2); font-size: 13px; margin-top: 8px; }
.mini-grid { display: grid; gap: 2px; margin-top: 10px; }
.mini-grid i { aspect-ratio: 1; border-radius: 2px; background: #0e121b; }
.mini-grid i.on { background: var(--ink); }

.vote-panel { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.vote-options { display: flex; flex-direction: column; gap: 7px; }
.vopt { display: flex; align-items: center; gap: 9px; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r2); padding: 10px 12px; cursor: pointer; text-align: left; }
.vopt:hover { border-color: var(--acc); }
.vopt.on { border-color: var(--acc); background: rgba(124,92,255,.12); }
.vopt .cnt { margin-left: auto; font-family: var(--mono); font-weight: 800; color: var(--acc2); }

.standings { display: flex; flex-direction: column; gap: 5px; }
.sr { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--r2); background: var(--panel2); border: 1px solid var(--line); font-size: 14px; }
.sr.me { border-color: var(--acc); }
.sr.out { opacity: .45; }
.sr .rk { font-family: var(--mono); color: var(--ink3); width: 22px; font-size: 12px; }
.sr .sc { margin-left: auto; font-family: var(--mono); font-weight: 800; }
.sr .delta { font-family: var(--mono); font-size: 11.5px; color: var(--good); }
.standings.big .sr { padding: 11px 13px; font-size: 15px; }

.end-title { font-size: 34px; text-align: center; margin-bottom: 24px; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 14px; margin-bottom: 30px; }
.pod { text-align: center; }
.pod .av { width: 52px; height: 52px; font-size: 22px; border-radius: 14px; margin: 0 auto 8px; }
.pod .nm { font-weight: 800; margin-bottom: 3px; }
.pod .sc { font-family: var(--mono); color: var(--acc2); font-weight: 800; font-size: 15px; }
.pod .plinth { margin-top: 10px; border-radius: 10px 10px 0 0; display: grid; place-items: center; font-size: 28px; font-weight: 900; color: rgba(0,0,0,.45); width: 116px; }
.pod.p1 .plinth { height: 118px; background: linear-gradient(180deg, var(--gold), #b8912f); }
.pod.p2 .plinth { height: 88px; background: linear-gradient(180deg, var(--silver), #8b93a3); }
.pod.p3 .plinth { height: 64px; background: linear-gradient(180deg, var(--bronze), #93602f); }
.end-grid { display: grid; grid-template-columns: 1.2fr 1fr 1.3fr; gap: 16px; align-items: start; }
.awards { display: flex; flex-direction: column; gap: 8px; }
.aw { display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r2); padding: 10px 12px; }
.aw .ic { font-size: 20px; }
.aw .lb { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink3); font-weight: 800; }
.aw .nm { font-weight: 700; }
.aw .vl { margin-left: auto; font-family: var(--mono); color: var(--acc2); font-weight: 700; font-size: 13px; }
.history { overflow-x: auto; }
.history table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.history th, .history td { padding: 6px 8px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.history th { color: var(--ink3); font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; }
.history td.nm { text-align: left; font-weight: 600; }
.history td.hit { color: var(--good); font-family: var(--mono); font-weight: 700; }
.history td.miss { color: var(--ink3); font-family: var(--mono); }
.end-actions { display: flex; gap: 10px; justify-content: center; margin-top: 28px; }

/* ---------- toasts & modal ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-radius: var(--r2); padding: 10px 16px; box-shadow: var(--shadow); font-size: 14px; animation: rise .2s ease; max-width: 82vw; }
.toast.err { border-color: var(--bad); color: #ffd2d7; }
.toast.ok { border-color: var(--good); color: #ccffe6; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
.modal { position: fixed; inset: 0; background: rgba(4,6,11,.78); display: grid; place-items: center; z-index: 300; padding: 20px; }
.modal-card { background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); padding: 24px; max-width: 520px; box-shadow: var(--shadow); }
.modal-card h3 { font-size: 21px; margin-bottom: 12px; }
.modal-card #modalBody { color: var(--ink2); line-height: 1.6; margin-bottom: 18px; font-size: 14.5px; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .home-grid, .break-grid, .end-grid { grid-template-columns: 1fr 1fr; }
  .lobby-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .home-grid, .break-grid, .end-grid { grid-template-columns: 1fr; }
  .round-body { grid-template-columns: 1fr; }
  .rivals { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px; }
  .rv { min-width: 156px; flex: none; }
  .stage { padding: 14px 10px; }
  .game-title { font-size: 16px; }
  .clock { font-size: 21px; min-width: 70px; }
  .chat-drawer { width: calc(100vw - 32px); }
  .brand-mark { width: 58px; height: 58px; font-size: 32px; }
}

.pause-veil {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center;
  background: rgba(6,8,14,.82); backdrop-filter: blur(6px);
}
.pause-card { text-align: center; padding: 34px 44px; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); box-shadow: var(--shadow); }
.pause-card h2 { font-size: 26px; margin-bottom: 8px; }
.pause-card p { margin: 0 0 18px; }
.pause-icon { font-size: 52px; margin-bottom: 10px; animation: pulse 1.6s infinite; }
#btnSkip.voted { background: linear-gradient(180deg, #3fd68c, #27b473); border-color: #4fe09a; color: #07251a; }
#btnPause.on { background: var(--warn); border-color: var(--warn); color: #23190a; }
.skip-note { color: var(--warn); }
