/* Fonts are self-hosted (SIL OFL, licenses in fonts/). */
@font-face { font-family: "Space Grotesk"; font-weight: 600; font-display: swap; src: url(fonts/space-grotesk-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Space Grotesk"; font-weight: 600; font-display: swap; src: url(fonts/space-grotesk-vietnamese-600-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Space Grotesk"; font-weight: 700; font-display: swap; src: url(fonts/space-grotesk-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Space Grotesk"; font-weight: 700; font-display: swap; src: url(fonts/space-grotesk-vietnamese-700-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-vietnamese-400-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-vietnamese-500-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-vietnamese-600-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url(fonts/jetbrains-mono-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url(fonts/jetbrains-mono-vietnamese-500-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }

:root {
  --primary: #7C3AED;
  --primary-deep: #4C1D95;
  --magenta: #C026D3;
  --bg: #0E0918;
  --bar: #130C21;
  --surface: #181026;
  --surface-2: #221836;
  --line: #2A1F40;
  --border: #34264F;
  --text: #F1ECFA;
  --text-2: #C9BCE3;
  --muted: #A897C6;
  --link: #C4B5FD;
  --ok: #34D399;
  --ok-text: #6EE7B7;
  --ok-bg: #10261F;
  --warn: #F59E0B;
  --err: #F87171;
  --radius: 14px;
  --display: "Space Grotesk", "IBM Plex Sans", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
[data-theme="light"] {
  --bg: #F6F3FC;
  --bar: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F1ECFB;
  --line: #E6DDF5;
  --border: #D9CCEF;
  --text: #1E1033;
  --text-2: #3D2D5C;
  --muted: #5F4E80;
  --link: #6D28D9;
  --ok: #059669;
  --ok-text: #047857;
  --ok-bg: #E7F8F1;
  --err: #DC2626;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--body); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--err); min-height: 1.2em; margin: 0; }
a { color: var(--link); }
h1, h2 { margin: 0; font-family: var(--display); }
h2 { font-size: 16px; font-weight: 600; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--bar); position: sticky; top: 0; z-index: 5; }
.brand { text-decoration: none; color: var(--text); font: 700 20px/1 var(--display); letter-spacing: .5px; }
.brand-sub { color: var(--muted); font-weight: 600; }
.topnav { display: flex; gap: 8px; align-items: center; }

main { max-width: 1440px; margin: 0 auto; padding: 20px 24px 40px; }
#view-sessions, #view-login { max-width: 1100px; margin: 0 auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.narrow { max-width: 380px; margin: 48px auto; display: grid; gap: 12px; }
label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
input, select { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font: inherit; min-width: 0; min-height: 44px; }
input:focus-visible, select:focus-visible, canvas:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; padding: 0 14px; min-height: 44px; font: 500 15px var(--body); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--primary-deep); border-color: var(--primary-deep); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--err); }
.btn.dashed { background: transparent; border-style: dashed; color: var(--link); }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { width: 44px; height: 44px; flex: none; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

/* ---- sessions list ---- */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-val { font: 700 22px var(--display); }
.row-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 16px; }
.row-form .error { grid-column: 1 / -1; }
.session-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.session { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 8px; animation: fade .2s ease; }
.session-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.session-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }
.badge.running { color: var(--ok-text); background: var(--ok-bg); border-color: transparent; }
.badge.running::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: var(--ok); }
.badge.starting, .badge.stopping { color: var(--warn); }
.badge.backoff { color: var(--err); }
.session-meta { color: var(--muted); font-size: 13px; display: grid; gap: 2px; }
.session-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.events { max-height: 140px; overflow: auto; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 6px; }
.events .error { color: var(--err); }
.events .warn { color: var(--warn); }
.admin-games { margin-top: 20px; display: grid; gap: 10px; }
.admin-games p { margin: 0; }
.admin-games .row-form { margin-bottom: 0; align-items: center; }
.game-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.game-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface-2); border-radius: 10px; font-size: 13px; overflow-wrap: anywhere; }
.ok { color: var(--ok-text); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.proxy-form { display: grid; gap: 8px; }
.proxy-form textarea { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font: 13px/1.5 ui-monospace, Consolas, monospace; resize: vertical; min-height: 110px; width: 100%; box-sizing: border-box; }
.proxy-form textarea:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.proxy-form-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.proxy-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 12px; max-height: 260px; overflow: auto; }
.proxy-results li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); overflow-wrap: anywhere; }
.proxy-results li > .muted { grid-column: 1 / -1; }
.proxy-results .added b { color: var(--ok-text); }
.proxy-results .duplicate b { color: var(--warn); }
.proxy-results .failed b { color: var(--err); }

/* ---- play screen ---- */
.play { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.play-tabs { flex: 1 1 220px; max-width: 260px; display: flex; flex-direction: column; gap: 10px; }
.play-main { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.play-side { flex: 1 1 290px; max-width: 330px; display: flex; flex-direction: column; gap: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.tab-list { display: flex; flex-direction: column; gap: 8px; }
.tab-item { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--text); }
.tab-item:hover { border-color: var(--border); }
.tab-item[aria-current="page"] { background: var(--surface-2); border-color: var(--primary); }
.tab-item .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tab-item b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-item .dot { width: 10px; height: 10px; border-radius: 999px; flex: none; background: #5B4C78; }
.tab-item .dot.on { background: var(--ok); }
.tab-item span { font-size: 13px; color: var(--muted); }

.play-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.play-head .icon-btn { display: none; }
.play-title { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; } /* actions wrap below before the name is cut */
.play-title h1 { font-size: 28px; font-weight: 700; letter-spacing: -.3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.quality { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
#textBtn[aria-pressed="true"] { background: var(--primary-deep); border-color: var(--magenta); }

.stage { padding: 20px; border-radius: 18px; background: var(--bar); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.screen-wrap { position: relative; width: 100%; height: clamp(360px, calc(100vh - 250px), 1000px); border-radius: 12px; background: #07040D; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.screen-wrap:fullscreen { height: 100%; border-radius: 0; }
#screen { display: block; touch-action: none; image-rendering: auto; border-radius: 4px; box-shadow: 0 0 0 2px var(--primary); }
#screen.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }
.title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.live-badge { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font: 600 12px var(--body); color: var(--text); letter-spacing: .5px; }
.live-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--magenta); animation: pulse 1.6s ease-in-out infinite; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; background: rgba(14, 9, 24, .78); color: #fff; cursor: pointer; }
.grant-slots { display: grid; gap: 6px; }
.grant-slots > label { font-size: 13px; color: var(--muted); }
.grant-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.grant-row input, .grant-row select { width: 100%; min-width: 0; }
.grant-row .btn { white-space: nowrap; }
.stepper { display: inline-flex; align-items: center; gap: 8px; }
.stepper input { width: 84px; text-align: center; font-size: 18px; font-weight: 600; }
.stepper .btn { min-width: 44px; font-size: 18px; }
.text-bar { display: grid; gap: 6px; }
.text-bar input { width: 100%; font-size: 16px; border-color: var(--primary); background: var(--bg); } /* >=16px stops iOS zooming on focus */
.stage-note { margin: 0; }

.panel { padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.panel p { margin: 0; }
.panel .text { color: var(--text); }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mini { padding: 9px 12px; border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mini span { font-size: 12px; color: var(--muted); }
.mini b { font: 500 15px var(--mono); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.meters { display: grid; gap: 12px; }
.meters-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.meter { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--muted); }
.meter-head b { font: 500 15px var(--mono); color: var(--text); }
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--primary); transition: width .6s ease, background-color .3s; }
.bar.warn span { background: var(--warn); }
.bar.high span { background: var(--err); }
.slots { display: grid; gap: 10px; }
.slots:empty { display: none; }
.slot { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.slot-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.slot-head span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.slot-head b { font: 500 15px var(--mono); white-space: nowrap; }
.slot-note { font-size: 12px; color: var(--muted); }
.slot-note.full { color: var(--err); font-weight: 600; }
.slot-note.near { color: var(--warn); }
.online-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.online-tag::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: #5B4C78; }
.online-tag.on::before { background: var(--ok); }
.limit-form { display: flex; align-items: center; gap: 6px; }
.limit-form input { width: 76px; min-height: 36px; padding: 6px 8px; }
.limit-form .btn { min-height: 36px; padding: 0 10px; font-size: 13px; }
.host-card { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }

.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; user-select: none; -webkit-user-select: none; }
.keypad button { min-height: 52px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: 600 16px var(--body); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; touch-action: none; -webkit-tap-highlight-color: transparent; transition: background .08s; }
.keypad button small { font-size: 10px; font-weight: 500; letter-spacing: 1px; color: var(--muted); }
.keypad button.soft { background: var(--bar); color: var(--link); font-size: 13px; }
.keypad button.fire { background: var(--primary); border-color: var(--primary); color: #fff; }
.keypad button.fire small { color: #E9DDFE; }
.keypad button.down, .keypad button:active { background: var(--primary-deep); border-color: var(--magenta); color: #fff; }
.keypad .digit-5 { visibility: hidden; }
.show-sm { display: none; }
.small-btn { min-height: 40px; font-size: 14px; }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: .35; } }
/* ---- admin (A3 tabs, A4 IP, A5 games) ---- */
.brand-wrap { display: flex; align-items: center; gap: 12px; }
.admin-badge { font-size: 12px; font-weight: 700; letter-spacing: 1px; padding: 3px 10px; border-radius: 999px; background: var(--magenta); color: #fff; }
main:has(#view-admin:not(.hidden)) { max-width: none; padding: 0; }
.admin { display: flex; flex-wrap: wrap; min-height: calc(100vh - 69px); }
.admin-nav { flex: 1 1 220px; max-width: 250px; padding: 16px 12px; border-right: 1px solid var(--line); background: var(--bar); display: flex; flex-direction: column; gap: 4px; }
.admin-nav a { min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--text-2); text-decoration: none; display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 14px; }
.admin-nav a:hover { background: var(--surface-2); color: var(--text); }
.admin-nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); box-shadow: inset 3px 0 0 var(--primary); }
.admin-main { flex: 999 1 560px; min-width: 0; padding: 24px; }
.admin-page { display: flex; flex-direction: column; gap: 16px; }
.admin-page h1 { font-size: 28px; font-weight: 700; }
.admin-section { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.admin-section p, .admin-page > p { margin: 0; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.chip { padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; }
.chip span { color: var(--muted); font-size: 13px; }
.chip b { font: 700 22px var(--display); }
.chip.err b { color: var(--err); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.filters label { font-size: 12px; }
.filters select, .filters input { min-height: 40px; padding: 8px 10px; font-size: 14px; }
.filters input[type="search"] { margin-left: auto; width: 220px; max-width: 100%; }
.table-card { padding: 0; overflow-x: auto; }
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
.table-card table.data { min-width: 1080px; }
table.data th { color: var(--muted); font-weight: 500; text-align: left; padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; }
table.data th.wide { width: 36%; }
table.data .empty { text-align: center; padding: 24px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.err-text { color: var(--err); }
.cell-stack { display: flex; flex-direction: column; }
.cell-stack b { font-weight: 600; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.icon-btn.sm { width: 36px; height: 36px; border-radius: 8px; background: transparent; cursor: pointer; }
.icon-btn.sm.danger { color: var(--err); }
.icon-btn.sm:disabled { opacity: .5; cursor: default; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.online-dot { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--muted); }
.online-dot::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: #5B4C78; }
.online-dot.on { color: var(--text); }
.online-dot.on::before { background: var(--ok); }
.in-admin .brand-sub, .in-admin #themeBtn, .in-admin #logoutBtn { display: none; }
.admin-search { width: 260px; max-width: 100%; min-height: 44px; padding: 8px 12px; font-size: 14px; }
.admin-nav a[aria-disabled="true"] { color: var(--muted); opacity: .6; cursor: default; }
.admin-nav a[aria-disabled="true"]:hover { background: transparent; color: var(--muted); }
.admin-nav a span { flex: 1; }
.admin-nav small { font-size: 11px; }
.node-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.node-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.node-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.node-title { display: flex; flex-direction: column; }
.node-title b { font: 500 18px var(--mono); }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mini-stats div { padding: 9px 12px; border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; }
.mini-stats span { font-size: 12px; color: var(--muted); }
.mini-stats b { font: 500 15px var(--mono); }
.node-add { padding: 20px; border-style: dashed; border-color: var(--border); display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.node-add p { margin: 0; }
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0; border: 0; background: transparent; color: var(--text-2); font: inherit; cursor: pointer; white-space: nowrap; }
.switch .track { width: 40px; height: 24px; border-radius: 999px; background: var(--border); display: inline-flex; align-items: center; padding: 2px; transition: background .15s; }
.switch .thumb { width: 20px; height: 20px; border-radius: 999px; background: #fff; transition: transform .15s; }
.switch[aria-checked="true"] .track { background: var(--primary); }
.switch[aria-checked="true"] .thumb { transform: translateX(16px); }
.switch:disabled { opacity: .5; }
.proxy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.bar-cell { display: flex; align-items: center; gap: 10px; }
.bar-cell .bar { flex: 1; }
.bar-cell b { font-weight: 500; white-space: nowrap; }
.rules { margin: 0; padding-left: 20px; color: var(--text-2); display: grid; gap: 4px; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 140px; padding: 20px; border: 2px dashed var(--border); border-radius: var(--radius); background: var(--bar); color: var(--text-2); text-align: center; cursor: pointer; position: relative; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); }
.dropzone:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.dropzone.busy { opacity: .6; pointer-events: none; }
.notice { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--ok-bg); color: var(--ok-text); font-size: 14px; }

/* ---- shared bits for the customer/admin pages ---- */
.mainnav { display: flex; flex-wrap: wrap; gap: 4px; }
.mainnav a { padding: 10px 12px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 15px; }
.mainnav a:hover { color: var(--text); background: var(--surface-2); }
.mainnav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.brand-wrap { flex-wrap: wrap; gap: 12px 24px; }
.balance-chip { min-height: 44px; padding: 0 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.balance-chip b { font-weight: 500; }
.nav-count { min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--magenta); color: #fff; font-size: 12px; font-weight: 700; text-align: center; }
.page { display: flex; flex-direction: column; gap: 20px; max-width: 1100px; margin: 0 auto; }
.page h1 { font-size: 28px; }
.page h2, .admin-page h2 { font-size: 16px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.card.stack { padding: 20px; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.center { text-align: center; }
.check { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; color: var(--text-2); font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; margin: 2px 0 0; accent-color: var(--primary); }
input.invalid { border-color: var(--err); }
.wide-narrow { max-width: 440px; padding: 28px; gap: 16px; }
.notice.warn { background: #2A1F0A; color: #FBBF24; }
[data-theme="light"] .notice.warn { background: #FEF3C7; color: #92400E; }
.warn-text { color: var(--warn); }
.badge.warn-badge { color: #FBBF24; background: #2A1F0A; border-color: transparent; }
.badge.err-badge { color: #FCA5A5; background: #2E1219; border-color: transparent; }
[data-theme="light"] .badge.warn-badge { color: #92400E; background: #FEF3C7; }
[data-theme="light"] .badge.err-badge { color: #B91C1C; background: #FEE2E2; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }
.kv.compact dd { text-align: left; }
.kv .total { padding-top: 10px; border-top: 1px solid var(--line); font-weight: 600; color: var(--text); }
.kv dd.total { font: 700 22px var(--display); }
.btn.lg { min-height: 48px; font-size: 16px; }
.btn.danger-outline { border-color: #5B2333; color: #FCA5A5; background: transparent; font-weight: 600; }
.tag { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--primary); color: #fff; }
.tag.sm { margin-left: 8px; font-size: 11px; padding: 2px 8px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 50; max-width: min(560px, calc(100vw - 32px));
  padding: 12px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0,0,0,.35); transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.ok { border-color: var(--ok); }
#toast.err { border-color: var(--err); color: var(--err); }

/* landing (5) */
main:has(#view-welcome:not(.hidden)) { max-width: none; padding: 0; }
.landing { font-size: 16px; }
.hero { max-width: 1200px; margin: 0 auto; padding: 80px 24px 72px; display: flex; flex-wrap: wrap; gap: 56px; align-items: center; }
.hero-text { flex: 1 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.hero h1 { font-size: clamp(34px, 5vw, 56px); line-height: 1.08; letter-spacing: -1px; }
.lead { margin: 0; font-size: 19px; color: var(--text-2); max-width: 560px; }
.pill { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--text-2); }
.pill .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--ok); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-cta .btn { min-height: 52px; padding: 0 24px; font-size: 17px; border-radius: 12px; }
.hero-points { display: flex; flex-wrap: wrap; gap: 24px; font-size: 14px; }
.hero-demo { flex: 1 1 380px; display: flex; justify-content: center; }
.demo-card { width: 360px; max-width: 100%; padding: 20px; border-radius: 24px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; }
.demo-head { display: flex; justify-content: space-between; align-items: center; font: 600 18px var(--display); }
.demo-screen { height: 400px; border-radius: 10px; box-shadow: 0 0 0 2px var(--primary); background: repeating-linear-gradient(45deg, #120B1F 0 12px, #160E26 12px 24px); display: flex; align-items: center; justify-content: center; color: var(--muted); font: 13px var(--mono); }
.demo-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.demo-stats div { padding: 8px; border-radius: 10px; background: var(--surface-2); text-align: center; display: flex; flex-direction: column; }
.demo-stats span { font-size: 12px; color: var(--muted); }
.demo-stats b { font: 500 15px var(--mono); }
.band { background: var(--bar); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.band-inner, .band-plain { max-width: 1200px; margin: 0 auto; padding: 72px 24px; display: flex; flex-direction: column; gap: 32px; }
.band h2, .band-plain h2 { font-size: 36px; font-weight: 700; }
.band p { margin: 6px 0 0; }
.feature-grid, .steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.feature { padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.feature h3 { margin: 0; font: 600 19px var(--display); }
.feature p, .steps p { margin: 0; font-size: 15px; }
.feature-icon { width: 44px; height: 44px; border-radius: 12px; background: #24173F; color: var(--link); display: inline-flex; align-items: center; justify-content: center; }
.feature-icon svg { width: 22px; height: 22px; }
.steps > div { display: flex; gap: 16px; align-items: flex-start; }
.steps h3 { margin: 0 0 4px; font-size: 18px; }
.step-n { flex: none; width: 44px; height: 44px; border-radius: 999px; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font: 700 18px var(--display); }
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.price-card { padding: 24px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.price-card.popular { border: 2px solid var(--primary); }
.price-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 26px; }
.price-head h3 { margin: 0; font: 600 20px var(--display); }
.price-card .price { font: 700 34px var(--display); }
.price-card ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 14px; }
.price-card .btn { margin-top: auto; }
.faq { max-width: 860px; gap: 20px; }
.faq-item { padding: 16px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.faq-item summary { cursor: pointer; font-weight: 600; }
.faq-item p { margin: 10px 0 0; }
.site-footer { border-top: 1px solid var(--line); background: var(--bar); padding: 28px 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 14px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 20px; }
body[data-mode="public"] .topbar .brand-wrap { gap: 24px; }

/* plans (7) */
.current-plan { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.current-plan > div { display: flex; flex-direction: column; }
.current-plan b { font: 700 20px var(--display); }
.current-plan .right { align-items: flex-end; }
.current-plan .right b { font: 500 15px var(--mono); }
.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.split.even > * { flex: 1 1 420px; min-width: 0; }
.summary { flex: 1 1 320px; max-width: 380px; padding: 20px; display: flex; flex-direction: column; gap: 12px; border-color: var(--border); }
.plan-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.plan-option { text-align: left; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 2px solid var(--line); color: var(--text); font: inherit; display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.plan-option.on { background: var(--surface-2); border-color: var(--primary); }
.plan-option .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; }
.plan-option .row b { font: 600 18px var(--display); }
.plan-option .price { font: 700 24px var(--display); }
.plan-option .price small { font: 400 14px var(--body); }
.pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-group .pill, .amount { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 600 15px var(--body); cursor: pointer; align-self: auto; }
.pill-group .pill.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.promo { max-width: 320px; }

/* billing (8) */
.big-money { display: block; font: 700 36px var(--display); }
.amount-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.amount { min-height: 48px; border-radius: 10px; border-width: 2px; font: 500 15px var(--mono); }
.amount.on { border-color: var(--primary); background: var(--surface-2); }
.qr-card { border-color: var(--border); }
.qr-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.qr-img { flex: none; width: 180px; min-height: 180px; border-radius: 12px; background: #fff; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.qr-img img { width: 100%; height: auto; display: block; }
.qr-row .kv { flex: 1 1 200px; }
.transfer-code { padding: 12px; border-radius: 10px; background: var(--surface-2); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.transfer-code > div { display: flex; flex-direction: column; }
.transfer-code b { font-size: 20px; letter-spacing: 1px; font-weight: 500; }
.invoice { padding: 28px; max-width: 640px; display: flex; flex-direction: column; gap: 18px; }
.invoice-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.invoice-head > div { display: flex; flex-direction: column; }
.brand-inv { font: 700 20px var(--display); }
.row-actions.left { justify-content: flex-start; }

/* account (9) */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; align-items: start; }
.toggle-list, .device-list { display: flex; flex-direction: column; gap: 8px; }
.toggle-row { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--text); font-size: 14px; cursor: pointer; }
.toggle-row input { width: 20px; height: 20px; min-height: 0; accent-color: var(--primary); flex: none; }
.device { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.device > div { display: flex; flex-direction: column; }

/* admin: overview (A1) */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.kpi { padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; display: flex; flex-direction: column; gap: 2px; }
.kpi:hover { border-color: var(--border); }
.kpi b { font: 700 30px var(--display); }
.ov-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; }
.grow2 { flex: 2 1 520px; min-width: 0; }
.grow1 { flex: 1 1 380px; min-width: 0; }
.chart { display: flex; gap: 8px; }
.chart-axis { display: flex; flex-direction: column; justify-content: space-between; height: 220px; color: var(--muted); font-size: 12px; text-align: right; min-width: 28px; }
.chart-bars { flex: 1; height: 220px; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--border); background: linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 33.33%; }
.cbar { flex: 1; background: #8B5CF6; border-radius: 4px 4px 0 0; }
.cbar:hover { background: #A78BFA; }
.chart-x { display: flex; justify-content: space-between; padding-left: 36px; color: var(--muted); font-size: 12px; }
.ov-node { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 10px; background: var(--surface-2); }
.ov-node .bar { background: var(--surface); }
.alerts { display: flex; flex-direction: column; gap: 10px; }
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.alert > div { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.alert a { flex: none; }
.lv { flex: none; font-size: 11px; font-weight: 700; letter-spacing: .5px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.lv-err { color: #FCA5A5; background: #2E1219; }
.lv-warn { color: #FBBF24; background: #2A1F0A; }
.lv-info { color: #C4B5FD; background: #24173F; }
table.data.slim { min-width: 420px; }
table.data.slim td { padding: 9px 10px; }

/* admin: customers / plans / orders / settings */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.page-head h1 span { font-size: 18px; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.form-end { display: flex; align-items: center; gap: 10px; }
.chip-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text); font: 500 14px var(--body); cursor: pointer; }
.chip-btn.on { background: var(--surface-2); border-color: var(--primary); }
.filters .chip-filters + input[type="search"] { margin-left: auto; width: 240px; }
.with-panel { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.with-panel > .table-card { flex: 999 1 560px; min-width: 0; }
.side-panel { flex: 1 1 320px; max-width: 400px; padding: 20px; border-color: var(--primary); display: flex; flex-direction: column; gap: 14px; }
.side-panel h3 { margin: 4px 0 0; font-size: 14px; color: var(--text-2); }
.side-panel textarea, .side-panel select { width: 100%; }
textarea { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font: inherit; resize: vertical; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td, tr.sel td { background: var(--surface-2); }
.panel-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.panel-name { font: 700 20px var(--display); }
.mini-stats.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mini-stats.two b { font: 600 14px var(--body); }
.inline-form { display: flex; gap: 8px; align-items: flex-end; }
.inline-form label { flex: 1; }
.btn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab { min-height: 44px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--text-2); font: 500 14px var(--body); cursor: pointer; }
.tab.on { color: var(--text); border-bottom-color: var(--primary); }
.unmatched { display: flex; flex-direction: column; gap: 8px; }
.unmatched-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; background: var(--surface-2); }
.unmatched-row label { flex-direction: row; display: flex; align-items: center; gap: 8px; margin-left: auto; }
.unmatched-row select { min-height: 40px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.setting-row > span, .setting-row > label { display: flex; flex-direction: column; gap: 2px; color: var(--text); font-size: 14px; }
.setting-row b { font-weight: 500; }
.setting-row small { color: var(--muted); font-size: 12px; }
.setting-row input:not([type="checkbox"]) { width: 120px; flex: none; }
.setting-row input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--primary); }
#payForm input, #payForm select, #opsForm .form-end { width: 100%; }

/* servers (nodes) */
.badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.badge.lock-badge { color: #FBBF24; background: #2A1F0A; border-color: transparent; }
[data-theme="light"] .badge.lock-badge { color: #92400E; background: #FEF3C7; }
.row-form:has(#serverSelect:not(.hidden)) { grid-template-columns: 1fr 1fr 1fr auto; }
.node-cards { display: contents; }
.node-card.installing { border-color: var(--primary); }
.node-add { gap: 12px; }
.node-add form, .node-add .two-col { width: 100%; }
.node-add label { width: 100%; }
.node-add .attach { margin-top: 10px; }
.row-actions.wrap { flex-wrap: wrap; align-items: center; }
.install { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 10px; background: var(--surface-2); }
.install-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.install-steps li { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.install-steps .st-icon { width: 20px; height: 20px; flex: none; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; border: 1px solid var(--border); }
.install-steps .st-done { color: var(--text); }
.install-steps .st-done .st-icon { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.install-steps .st-running { color: var(--text); font-weight: 600; }
.install-steps .st-running .st-icon { border-color: var(--primary); color: var(--primary); animation: pulse 1s ease-in-out infinite; }
.install-steps .st-error { color: var(--err); }
.install-steps .st-error .st-icon { background: #2E1219; color: #FCA5A5; border-color: transparent; }
.install-log { margin: 8px 0 0; max-height: 240px; overflow: auto; padding: 10px; border-radius: 8px; background: var(--bg); color: var(--text-2); font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; }
@keyframes pulse { 50% { opacity: .4; } }

/* customer: own games; admin-only blocks */
body:not([data-role="admin"]) .admin-only { display: none !important; }
.my-games { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.my-games p { margin: 0; }
.small-drop { min-height: 96px; }
.my-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.my-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
#myErr ul { margin: 6px 0 0; padding-left: 18px; }

/* pagination */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 2px 0; }
.table-card > .pager { padding: 10px 12px; border-top: 1px solid var(--line); position: sticky; left: 0; }
.pg-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.pg { min-width: 36px; min-height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--text); font: 500 13px var(--body); cursor: pointer; }
.pg:hover:not(:disabled) { background: var(--surface-2); }
.pg.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pg:disabled:not(.on) { opacity: .4; cursor: default; }
.pg-gap { padding: 0 4px; }
.pager select { min-height: 36px; padding: 4px 8px; font-size: 13px; }

@media print {
  .topbar, .row-actions, #toast { display: none !important; }
  body, .card { background: #fff !important; color: #000 !important; border-color: #ccc !important; }
}

@media (prefers-reduced-motion: reduce) { .live-dot, .session { animation: none; } }

@media (max-width: 1100px) {
  .play-tabs { display: none; }
}
@media (max-width: 760px) {
  .admin-nav { max-width: none; flex-basis: 100%; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; }
  .admin-nav a { flex: none; }
  .admin-main { padding: 16px; }
  .brand-sub { display: none; }
  .account-grid { grid-template-columns: 1fr; }
  .summary, .side-panel { max-width: none; }
  .topbar { flex-wrap: wrap; }
  .mainnav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .mainnav a { flex: none; padding: 8px 10px; font-size: 14px; }
  .filters .chip-filters + input[type="search"] { margin-left: 0; width: 100%; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .btn-grid { grid-template-columns: 1fr; }
  .unmatched-row label { margin-left: 0; }
  .hero { padding: 40px 16px; gap: 32px; }
  .band-inner, .band-plain { padding: 48px 16px; }
  .band h2, .band-plain h2 { font-size: 28px; }
  main { padding: 8px 8px 20px; }
  .topbar { padding: 10px 12px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .row-form { grid-template-columns: 1fr; }
  .play { gap: 12px; }
  .play-side { max-width: none; flex-basis: 100%; }
  .play-head .icon-btn { display: inline-flex; }
  .play-title h1 { font-size: 20px; }
  .hide-sm { display: none !important; }
  .show-sm { display: inline-flex; }
  .stage { padding: 0; border: 0; background: transparent; gap: 8px; }
  .stage-note { display: none; }
  /* As large as the phone allows: full width, leaving room below for the
     compact keypad (~4 rows) so playing needs no scrolling. */
  .screen-wrap {
    height: clamp(300px, min(calc((100vw - 16px) * 4 / 3), calc(100vh - 350px)), 2000px);
    height: clamp(300px, min(calc((100vw - 16px) * 4 / 3), calc(100svh - 350px)), 2000px);
    border-radius: 8px;
  }
  .play-side > .keypad-panel { order: -1; }   /* keypad right under the screen */
  /* One compact row: back · name · type · reconnect · fullscreen */
  .play-head { gap: 6px; flex-wrap: nowrap; }
  .play-title { flex: 1 1 0; }
  .play-title .muted { display: none; }
  .play-title h1 { font-size: 18px; }
  .play-actions { flex-wrap: nowrap; gap: 6px; }
  .play-actions .btn { width: 44px; padding: 0; }
  #me { display: none; }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .mini { padding: 6px 8px; align-items: center; }
  .panel { padding: 0; border: 0; background: transparent; gap: 8px; }
  .keypad { gap: 6px; }
  .keypad button { min-height: 48px; }
  .keypad .digit { display: none; }
  .keypad .digit-5 { visibility: visible; }
  .keypad.digits .digit { display: flex; }
  .keypad.digits .digit-5 { visibility: hidden; }
  .panel-head { justify-content: flex-end; }
  .host-panel .panel-head { justify-content: space-between; }
  .host-panel .meters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .meters-row { grid-template-columns: 1fr; gap: 12px; }
}
