:root {
  --bg: #0e0f13;
  --panel: #181a21;
  --line: #2a2d37;
  --text: #f4f1ea;
  --muted: #9a978f;
  --accent: #d9b26a;        /* ballroom gold */
  --accent-ink: #1a1408;
  --danger: #ff7a6b;
  --status-bg: #2a2416;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

.label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.85rem;
  color: var(--muted);
}
.heat {
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.heat.flash { animation: flash 1.2s ease-out; }
@keyframes flash {
  0%   { color: var(--accent); transform: scale(1.06); }
  100% { color: var(--text);   transform: scale(1); }
}
.status {
  background: var(--status-bg);
  color: var(--accent);
  border: 1px solid #4a3d22;
  border-radius: 12px;
  padding: 0.5em 0.9em;
  font-weight: 600;
  text-align: center;
  max-width: 92vw;
}
.meta { color: var(--muted); font-size: 0.85rem; }
body.offline .conn, body.offline .conn-badge { color: var(--danger); }

/* ---------------------------------------------------------- public (phones) */
.public {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
.public .event {
  text-align: center;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--accent);
}
.public .center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.public .heat { font-size: min(38vh, calc(125vw / max(var(--len, 3), 2.5))); }
.public .status { font-size: 1.15rem; }
.public .meta { text-align: center; display: flex; gap: 8px; justify-content: center; }

/* ---------------------------------------------------------- display (monitors) */
.display {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 3vh 4vw;
  position: relative;
  overflow: hidden;
}
.display .event {
  text-align: center;
  font-size: 5vh;
  font-weight: 600;
  color: var(--accent);
}
.display .center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2vh;
}
.display .label { font-size: 4vh; }
.display .heat { font-size: min(52vh, calc(140vw / max(var(--len, 3), 2.5))); }
.display .status { font-size: 5vh; border-radius: 2vh; }
.qr-corner {
  position: absolute;
  right: 2.5vw;
  bottom: 3vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8vh;
  color: var(--muted);
  font-size: 1.8vh;
}
.qr-corner img { width: 14vh; height: 14vh; border-radius: 1vh; background: #fff; }
.conn-badge { position: absolute; left: 2.5vw; bottom: 3vh; font-size: 2.2vh; }
.fs-hint {
  position: absolute;
  top: 2vh;
  right: 2vw;
  font-size: 1.8vh;
  color: var(--muted);
  transition: opacity 1s;
}
.fs-hint.fade { opacity: 0; }
body.no-cursor, body.no-cursor * { cursor: none !important; }

/* ---------------------------------------------------------- control (admin) */
.control {
  max-width: 520px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.topbar { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.topbar form { margin: 0; }
.event-mini { color: var(--accent); font-weight: 600; }
.spacer { flex: 1; }
.now {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.now .heat { font-size: min(110px, calc(100vw / max(var(--len, 3), 2.5))); }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.98); }
.btn:disabled, .btn.primary:disabled { opacity: 0.35; cursor: not-allowed; background: var(--panel); color: var(--muted); border-color: var(--line); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.wide { width: 100%; }
.btn.link, button.link {
  background: none; border: none; color: var(--muted); font: inherit; cursor: pointer; padding: 6px;
}
.stepper { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.btn.big { font-size: 2.2rem; padding: 26px 0; border-radius: 18px; }

.row { display: flex; gap: 8px; margin: 0; }
.row input { flex: 1; min-width: 0; }
input {
  font: inherit;
  font-size: 16px;            /* stops iOS zoom on focus */
  color: var(--text);
  background: #101218;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}
#clear-status { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.9rem; margin: -4px 0 0; text-align: center; }
.msg {
  min-height: 1.4em;
  text-align: center;
  font-size: 0.95rem;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.2s;
}
.msg.show { opacity: 1; }
.msg.error { color: var(--danger); }
.settings {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.settings summary { color: var(--muted); cursor: pointer; padding: 6px 0; }
.settings .row { margin-top: 10px; }
.links { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; }
.links a { color: var(--accent); }

/* ---------------------------------------------------------- login */
.login {
  max-width: 360px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login h1 { text-align: center; color: var(--accent); font-weight: 700; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.error { color: var(--danger); margin: 0; }

/* ---------------------------------------------------------- printable QR sign */
.page-qr { background: #fff; color: #111; }
.qrsign {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 16px;
  text-align: center;
}
.qrsign h1 { font-size: 2rem; margin: 0 0 8px; }
.qrsign h2 { font-size: 1.5rem; font-weight: 600; margin: 0 0 24px; }
.qrsign img { width: min(420px, 90vw); height: auto; }
.qrsign .scan { font-size: 1.3rem; font-weight: 600; }
.qrsign .url { color: #555; word-break: break-all; }
.page-qr .btn { background: #111; color: #fff; border-color: #111; }
@media print { .noprint { display: none; } }
