:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --text: #1f2a24;
  --muted: #5f6b64;
  --line: #ddd8cc;
  --accent: #2f6b4f;
  --accent-text: #ffffff;
  --danger: #a33a2c;
  --ok: #2f9a5f;
  --warn: #c98a12;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141816;
    --card: #1d2320;
    --text: #eef1ec;
    --muted: #a3ada7;
    --line: #333b37;
    --accent: #5bb68a;
    --accent-text: #0d1a13;
    --danger: #e0715f;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[hidden] { display: none !important; }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  color: var(--muted);
}
.bar strong { color: var(--text); }

.status { display: inline-flex; align-items: center; gap: 6px; }
.status::before {
  content: "";
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--warn);
}
.status.open::before { background: var(--ok); }
.status.closed::before { background: var(--danger); }

main { max-width: 680px; margin: 0 auto; padding: 24px 16px 48px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

h1, h2 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 28px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }

label { display: block; font-weight: 600; margin: 0 0 6px; }
input, textarea {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
textarea { min-height: 140px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field { margin-bottom: 16px; }

button {
  font: inherit;
  font-weight: 600;
  min-height: 48px;
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}
button.secondary { background: transparent; color: var(--text); border-color: var(--line); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.wide { width: 100%; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; min-height: 0; padding: 0; font-weight: 400; }

/* The pushed screen */
.screen { text-align: center; padding: 8px 0; }
.screen-title { font-size: clamp(28px, 8vw, 44px); margin-bottom: 16px; overflow-wrap: anywhere; }
.screen-body { font-size: clamp(19px, 5vw, 24px); white-space: pre-wrap; overflow-wrap: anywhere; text-align: left; }
.screen-image { display: block; max-width: 100%; max-height: 60vh; margin: 20px auto 0; border-radius: 10px; }
.waiting { text-align: center; padding: 48px 0; }

.error { color: var(--danger); font-weight: 600; }

/* Presenter */
.console { max-width: 1100px; }
.grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.count { font-size: 56px; font-weight: 700; line-height: 1; color: var(--accent); }
.names { margin: 12px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.names li { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 14px; }
.preview { border: 2px dashed var(--line); border-radius: var(--radius); padding: 16px; min-height: 120px; }
.log { font: 13px/1.4 ui-monospace, Consolas, monospace; max-height: 200px; overflow: auto; margin: 0; white-space: pre-wrap; }

/* Presenter ON/OFF switch */
.switch-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.switch-card p { margin: 0; }
.live-label { font-size: 32px; font-weight: 800; letter-spacing: .04em; color: var(--muted); }
.live-label.on { color: var(--ok); }
.switch {
  position: relative; flex: none;
  width: 96px; min-height: 0; height: 52px; padding: 0;
  border-radius: 999px; background: var(--line); border: 0;
}
.switch span {
  position: absolute; top: 6px; left: 6px;
  width: 40px; height: 40px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform .15s;
}
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"] span { transform: translateX(44px); }
.switch:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
