:root {
  --bg: #0c0d10; --body: #17191e; --raise: #20232a; --line: #2c3039; --text: #eef0f4; --dim: #8b919e;
  --accent: #ff7a00; --lcd: #9effb3; --lcd-bg: #0f241a; --rx: #40f273; --tx: #ff382e; --warn: #ffc23d;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif; }
button, input, select { font: inherit; color: inherit; }
h1, h2 { margin: 0; font-weight: 800; }
h1 { font-size: 20px; letter-spacing: .28em; color: var(--accent); }
h2 { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--line); background: var(--body); position: sticky; top: 0; z-index: 2; }
.brand { display: flex; align-items: center; gap: 12px; }
.sub { color: var(--dim); font-size: 12px; letter-spacing: .08em; }
.links { display: flex; gap: 8px; flex-wrap: wrap; }
.led { width: 12px; height: 12px; border-radius: 50%; background: #444; box-shadow: none; }
.led.on { background: var(--rx); box-shadow: 0 0 10px var(--rx); }
.led.off { background: var(--tx); box-shadow: 0 0 10px var(--tx); }
.chip { padding: 4px 10px; border-radius: 999px; background: var(--raise); border: 1px solid var(--line); color: var(--dim); font-size: 12px; font-family: ui-monospace, Menlo, monospace; }
.chip.ok { color: var(--lcd); border-color: #2b5a3c; }
.chip.bad { color: var(--tx); border-color: #6b2a27; }

.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; padding: 16px 24px 0; }
.card { background: var(--body); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card .label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; font-weight: 700; }
.hint { color: var(--dim); font-size: 12px; margin-top: 8px; }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.unit { color: var(--dim); font-size: 12px; margin-right: 4px; }

button { background: var(--raise); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; transition: background .12s, border-color .12s; white-space: nowrap; }
button:hover:not(:disabled) { border-color: #4a505c; background: #282c34; }
button:disabled { opacity: .4; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #111; font-weight: 700; }
button.primary:hover:not(:disabled) { background: #ff8d24; }
button.danger { background: #3a1513; border-color: #6b2a27; color: #ffb3ad; font-weight: 700; }
button.danger:hover:not(:disabled) { background: #4a1916; }
button.on { background: #2a1210; border-color: var(--tx); color: #ffb3ad; }
button.small { padding: 4px 9px; font-size: 12px; }
button.big { width: 100%; padding: 12px; font-size: 15px; }
input[type=number] { width: 64px; background: var(--raise); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
select { background: var(--raise); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; }

.switch { width: 64px; height: 34px; border-radius: 999px; padding: 3px; background: #2a2d35; border: 1px solid var(--line); position: relative; }
.switch .knob { display: block; width: 26px; height: 26px; border-radius: 50%; background: #9aa0ab; transition: transform .18s, background .18s; }
.switch[aria-pressed=true] { background: #3a1513; border-color: var(--tx); }
.switch[aria-pressed=true] .knob { transform: translateX(30px); background: var(--tx); box-shadow: 0 0 12px var(--tx); }

.lcd { font-family: ui-monospace, Menlo, monospace; font-size: 34px; font-weight: 800; color: var(--lcd); background: var(--lcd-bg); border-radius: 8px; padding: 4px 12px; margin-bottom: 8px; text-align: center; letter-spacing: .06em; }
.lcd.low { color: var(--warn); }
.lcd.out { color: var(--tx); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; padding: 14px 24px 32px; }
@media (max-width: 1050px) { .layout { grid-template-columns: 1fr; } }
.side { display: flex; flex-direction: column; gap: 14px; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.spacer { flex: 1; }
.count { background: var(--raise); border-radius: 999px; padding: 1px 8px; font-size: 12px; color: var(--dim); font-family: ui-monospace, Menlo, monospace; }
.gm-pick { color: var(--dim); font-size: 12px; display: flex; gap: 6px; align-items: center; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid #22252c; vertical-align: middle; }
tr.offline td { opacity: .45; }
tr.gm td:nth-child(2) { color: var(--accent); }
.name { font-weight: 700; font-family: ui-monospace, Menlo, monospace; }
.platform { color: var(--dim); font-size: 11px; margin-left: 6px; }
.talk { width: 12px; height: 12px; border-radius: 50%; background: #333; }
.talk.live { background: var(--rx); box-shadow: 0 0 10px var(--rx); }
.badges { display: flex; gap: 4px; flex-wrap: wrap; }
.badge { font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 2px 6px; border-radius: 4px; background: var(--raise); color: var(--dim); }
.badge.red { background: #3a1513; color: #ff9b94; }
.badge.green { background: #12301e; color: var(--lcd); }
.badge.amber { background: #362a0e; color: var(--warn); }
.actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.actions-col { text-align: right; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.list li { display: flex; align-items: center; gap: 8px; background: var(--raise); border-radius: 8px; padding: 8px 10px; }
.list li .grow { flex: 1; min-width: 0; }
.list .meta { color: var(--dim); font-size: 12px; }
.bar { height: 4px; border-radius: 2px; background: #333; margin-top: 5px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--rx); }
.secs { font-family: ui-monospace, Menlo, monospace; font-weight: 800; color: var(--lcd); min-width: 34px; text-align: right; }
.secs.expired { color: var(--tx); }
li.playing { outline: 1px solid var(--accent); }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { min-width: 40px; text-align: center; padding: 6px 0; border-radius: 8px; font-family: ui-monospace, Menlo, monospace; font-weight: 700; }
.pill.listening { background: #12301e; border-color: var(--rx); color: var(--lcd); }
.pill.busy::after { content: " •"; color: var(--rx); }

.empty { color: var(--dim); margin: 6px 0 0; }
.empty.small { font-size: 12px; }
.hidden { display: none !important; }

/* GM login (server deployment) */
body.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(340px, 100%); display: grid; gap: 12px; text-align: center; }
.login-card input { background: var(--raise); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; text-align: center; }
.login-card button { padding: 10px; }
.login-error { color: var(--tx); font-size: 13px; }

/* Phones: each radio becomes a small card instead of a table row. */
@media (max-width: 640px) {
  .top, .controls, .layout { padding-left: 16px; padding-right: 16px; }
  .top { flex-wrap: wrap; }
  .players thead { display: none; }
  .players table, .players tbody { display: block; }
  .players tr { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 6px 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid #22252c; }
  .players td { padding: 0; border: 0; min-width: 0; }
  .players td:nth-child(4), .players td:nth-child(5) { grid-column: 1 / -1; }
  .players td:nth-child(5) .actions { justify-content: flex-start; gap: 6px; }
  .gm-pick select { max-width: 130px; }
}
