@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"); }
@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"); }
@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"); }
@font-face { font-family: "IBM Plex Sans Condensed"; font-weight: 600; font-display: swap; src: url("/fonts/ibm-plex-sans-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Condensed"; font-weight: 700; font-display: swap; src: url("/fonts/ibm-plex-sans-condensed-latin-700-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --ink: #12263f;
  --muted: #566579;
  --paper: #e9eef0;
  --panel: #ffffff;
  --line: #d3dce1;
  --accent: #1656c9;
  --accent-soft: #bcd0f2;
  --agree: #0a7570;
  --disagree: #bd4a2f;
  --display: "IBM Plex Sans Condensed", "Arial Narrow", Arial, sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font-family: var(--body); }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--display); text-wrap: balance; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Vote page: one column, thumb-sized targets */
.vote { max-width: 560px; margin: 0 auto; padding: 20px 16px 32px; font-size: 16px; }
.vote h1 { margin: 0; font-size: 26px; line-height: 1.1; }
.lead { margin: 4px 0 14px; color: var(--muted); }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 14px 0 16px; min-width: 0; }
legend { float: left; width: 100%; padding: 0; margin-bottom: 10px; font-weight: 600; line-height: 1.28; }
legend + * { clear: both; }
.opts { display: flex; flex-wrap: wrap; gap: 7px; }
.opts.stack { flex-direction: column; }
.opt { position: relative; cursor: pointer; }
.opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.opt span { display: block; min-height: 44px; padding: 10px 13px; background: var(--panel); border: 1px solid #aebbc5; border-radius: 5px; line-height: 1.25; }
.opt input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.opt input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.pair .opt { flex: 1; text-align: center; }
.pair .ag input:checked + span { background: var(--agree); border-color: var(--agree); }
.pair .di input:checked + span { background: var(--disagree); border-color: var(--disagree); }
.statement { clear: both; margin-bottom: 14px; }
.statement:last-child { margin-bottom: 0; }
.statement p { margin: 0 0 7px; line-height: 1.3; }
.txt { width: 100%; min-height: 44px; padding: 9px 11px; margin-top: 8px; background: var(--panel); border: 1px solid #8796a6; border-radius: 5px; font-size: 16px; }
.send, .secondary, .save, .danger, .button { min-height: 44px; padding: 9px 16px; border-radius: 5px; border: 1px solid transparent; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.send { width: 100%; background: var(--accent); color: #fff; }
.send:disabled { background: #cfd8df; color: #4c5a69; cursor: not-allowed; }
.secondary { background: var(--panel); border-color: #8796a6; color: var(--ink); }
.error { margin: 0 0 12px; padding: 9px 11px; background: #fbe9e4; color: #8f2f1a; border-radius: 5px; }
.notice { padding: 16px 0; border-top: 1px solid var(--line); margin-top: 14px; }
.notice h2 { margin: 0 0 4px; font-size: 24px; }
.notice p { margin: 0 0 14px; color: var(--muted); }

/* Room screen: fits one 16:9 display at any resolution */
.wall-page, .wall-page body { height: 100%; }
html:has(.wall-page) { height: 100%; }
.wall-page { height: 100%; overflow: hidden; }
.wall { height: 100%; padding: 1.2vw 1.4vw; container-type: size; display: flex; }
.wall-inner { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 1vw; font-size: clamp(12px, 1.25vw, 40px); }
.wall-head { flex: none; display: flex; align-items: center; gap: 1.2em; }
.wall-head h1 { margin: 0; font-size: 2.2em; line-height: 1.05; font-weight: 700; }
.wall-head p { margin: .15em 0 0; color: var(--muted); }
.titles { flex: 1; min-width: 0; }
.offline { padding: .25em .7em; background: var(--disagree); color: #fff; border-radius: 4px; margin: 0; }
.counter { text-align: right; white-space: nowrap; font-family: var(--display); font-variant-numeric: tabular-nums; }
.counter b { font-size: 2.7em; line-height: 1; color: var(--accent); font-weight: 700; }
.counter i { font-style: normal; font-size: 1.5em; font-weight: 600; color: var(--muted); }
.counter span { display: block; font-family: var(--body); color: var(--muted); font-size: .85em; }
.qr svg { display: block; width: 100%; height: 100%; }
.qr.small { flex: none; width: 5.2em; height: 5.2em; }
.lobby { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 5vw; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 2vw; }
.qr.large { flex: none; height: min(66vh, 42vw); aspect-ratio: 1; }
.lobby-text { flex: 0 1 36vw; min-width: 0; }
.lobby-text h2 { margin: 0; font-size: 4.4em; line-height: 1; }
.join { margin: .35em 0 1.2em; font-size: 1.7em; font-weight: 600; color: var(--accent); overflow-wrap: anywhere; }
.progress { height: 1em; background: var(--paper); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .35s; }
.lobby-text > p:last-child { margin: .6em 0 0; color: var(--muted); font-size: 1.15em; }

.grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); gap: 1vw; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: .9em 1.1em; display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.card h2 { flex: none; margin: 0 0 .55em; font-size: 1.32em; font-weight: 600; line-height: 1.14; }
.hist { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)); gap: .6em; }
.col { display: flex; flex-direction: column; min-height: 0; text-align: center; font-variant-numeric: tabular-nums; }
.col .track { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; }
.col .val { font-weight: 600; margin-bottom: .15em; }
.col .bar { min-height: 2px; background: var(--accent-soft); border-radius: 3px 3px 0 0; transition: height .35s; }
.col.peak .bar { background: var(--accent); }
.col .lab { border-top: 1px solid var(--ink); padding-top: .25em; font-size: .92em; white-space: nowrap; }
.statements { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: space-evenly; gap: .5em; }
.st p { margin: 0 0 .25em; line-height: 1.2; font-weight: 500; }
.chip { display: inline-block; margin-left: .4em; padding: 0 .45em; background: var(--ink); color: #fff; border-radius: 3px; font-size: .76em; font-weight: 600; white-space: nowrap; }
.split { display: flex; height: 1.6em; border-radius: 3px; overflow: hidden; color: #fff; font-weight: 600; font-size: .93em; font-variant-numeric: tabular-nums; }
.split div { display: flex; align-items: center; padding: 0 .5em; white-space: nowrap; overflow: hidden; transition: width .35s; }
.split .a { background: var(--agree); }
.split .d { background: var(--disagree); justify-content: flex-end; }
.rank { position: relative; flex: none; }
.row { position: absolute; left: 0; right: 0; height: 2.15em; display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(0, 1fr) 2.8em; gap: .6em; align-items: center; line-height: 1.06; transition: top .35s; }
.rb { height: 1.15em; background: var(--paper); border-radius: 2px; overflow: hidden; }
.rb i { display: block; height: 100%; background: var(--accent-soft); transition: width .35s; }
.row.top .rb i { background: var(--accent); }
.row.top .rl { font-weight: 600; }
.rp { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.others { margin: .3em 0 0; color: var(--muted); font-size: .9em; line-height: 1.18; overflow: hidden; }
.cloud { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.w { position: absolute; left: 0; top: 0; font-family: var(--display); font-weight: 600; line-height: 1.1; white-space: nowrap; transition: transform .35s, font-size .35s; }

/* Admin */
.admin-page { font-size: 15px; }
.admin-bar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; padding: 10px 16px; background: var(--ink); color: #fff; }
.admin-bar h1 { margin: 0; font-size: 21px; }
.live-count { margin: 0; flex: 1; }
.live-count b { font-size: 20px; font-variant-numeric: tabular-nums; }
.admin-bar nav { display: flex; gap: 14px; }
.admin-bar a { color: #fff; }
.toast { position: fixed; z-index: 3; right: 16px; bottom: 16px; margin: 0; padding: 11px 15px; background: var(--agree); color: #fff; border-radius: 5px; max-width: min(420px, calc(100vw - 32px)); }
.toast.bad { background: var(--disagree); }
.admin { max-width: 980px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 16px; }
.box h2 { margin: 0 0 8px; font-size: 22px; }
.box h3 { margin: 18px 0 8px; font-size: 18px; }
.box h4 { margin: 12px 0 4px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.box-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.help { margin: 4px 0 8px; color: var(--muted); font-size: 14px; }
.controls-grid { display: grid; grid-template-columns: auto 1fr 130px; gap: 18px; align-items: start; }
.controls-grid h3 { margin-top: 0; }
.seg { display: inline-flex; border: 1px solid #8796a6; border-radius: 5px; overflow: hidden; }
.seg button { min-height: 42px; padding: 7px 14px; background: var(--panel); border: 0; border-right: 1px solid #8796a6; cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 600; }
.qr-admin .qr { width: 120px; height: 120px; }
.qr-admin .help { overflow-wrap: anywhere; font-size: 12px; }
.mod-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mod-grid h3 { margin-top: 6px; }
.mod { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.mod li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.mod li.off span { color: var(--muted); text-decoration: line-through; }
.mini { flex: none; min-height: 32px; padding: 3px 10px; background: var(--panel); border: 1px solid #8796a6; border-radius: 4px; cursor: pointer; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.fields.one { grid-template-columns: 1fr; }
.fields label { display: flex; flex-direction: column; gap: 3px; font-weight: 500; font-size: 14px; }
.fields input, .fields textarea, .item-text { width: 100%; min-height: 38px; padding: 7px 9px; background: var(--panel); border: 1px solid #8796a6; border-radius: 4px; font-weight: 400; }
.pill { display: inline-block; padding: 1px 8px; margin-left: 6px; background: var(--paper); border-radius: 10px; font-family: var(--body); font-size: 13px; font-weight: 500; }
.pill.bad { background: #fbe9e4; color: #8f2f1a; }
.item { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 3px 0; }
.pick { width: 20px; height: 20px; margin: 0; }
#addSt, #addPr { margin-top: 8px; }
form.box > .save:last-child { margin-top: 18px; }
.save { background: var(--accent); color: #fff; }
.danger { background: var(--panel); border-color: var(--disagree); color: var(--disagree); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 680px) {
  .controls-grid, .mod-grid, .fields { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
