:root {
  --g-bg-1: #1e1b4b; --g-bg-2: #0f172a;
  --text: #e5e7eb; --muted: #b4bac6; --accent: #6366f1; --accent-soft: #a5b4fc;
  --ok: #34d399; --warn: #fbbf24; --bad: #f87171;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); }
h1, h2 { margin: 0; color: #fff; line-height: 1.15; }
h1 { font-size: clamp(1.7rem, 5vw, 2.3rem); font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 16px 90px; }
.wrap.narrow { max-width: 480px; padding-top: 8vh; }
.card { margin-bottom: 18px; padding: 24px; border-radius: 20px; border: 1px solid var(--g-border);
  background: var(--g-glass); -webkit-backdrop-filter: blur(var(--g-blur)) saturate(var(--g-sat)); backdrop-filter: blur(var(--g-blur)) saturate(var(--g-sat)); }
.card.center { text-align: center; padding: 56px 24px; }
.badge, .pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #c7d2fe; background: rgba(99,102,241,.2); border: 1px solid rgba(165,180,252,.4); }
.badge { margin-bottom: 14px; }
.pill.open { color: #a7f3d0; background: rgba(52,211,153,.15); border-color: rgba(52,211,153,.45); }
.pill.ended { color: #d1d5db; background: rgba(148,163,184,.15); border-color: rgba(148,163,184,.4); }
.lead { color: #cbd5e1; margin: 8px 0 18px; }
.hint { color: var(--muted); font-size: .9rem; margin: 6px 0 0; }
.note { color: #fde68a; }
label { display: block; margin: 16px 0 6px; font-weight: 600; font-size: .95rem; color: #fff; }
input { width: 100%; padding: 12px 14px; font: inherit; color: #fff; border-radius: 12px; border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.07); transition: border-color var(--g-dur, .2s), background-color var(--g-dur, .2s), box-shadow var(--g-dur, .2s); }
input::placeholder { color: #9ca3af; opacity: 1; }
input:focus { outline: none; border-color: var(--accent-soft); background: rgba(255,255,255,.11); box-shadow: 0 0 0 3px rgba(165,180,252,.25); }
.code-input { font: 700 1.9rem/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .3em; text-align: center; text-transform: uppercase; padding: 14px 8px; }
.msg { min-height: 1.4em; margin: 14px 0 0; font-weight: 600; }
.msg.bad { color: var(--bad); } .msg.ok { color: var(--ok); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; font: inherit; font-weight: 600; color: #fff; text-decoration: none;
  cursor: pointer; border-radius: 12px; border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.08);
  transition: background-color var(--g-dur, .2s), transform var(--g-dur, .2s), border-color var(--g-dur, .2s), opacity var(--g-dur, .2s); }
.btn:hover { background: rgba(255,255,255,.16); }
.btn:active { transform: scale(.97); }
.btn:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }
.btn.primary { width: 100%; margin-top: 18px; background: #4f46e5; border-color: var(--accent-soft); }
.btn.primary:hover { background: #6366f1; }
.btn.small { padding: 8px 14px; font-size: .9rem; }
.btn.warn { background: rgba(251,191,36,.16); border-color: rgba(251,191,36,.5); color: #fde68a; }
.btn.danger { background: rgba(248,113,113,.14); border-color: rgba(248,113,113,.5); color: #fecaca; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn.busy { opacity: .7; pointer-events: none; }
[hidden] { display: none !important; }

/* participant success */
.done { text-align: center; }
.check { width: 84px; height: 84px; margin: 4px auto 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(52,211,153,.15); border: 2px solid rgba(52,211,153,.6); }
.check svg { width: 44px; height: 44px; fill: none; stroke: var(--ok); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .6s .15s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.facts { margin: 20px 0 4px; text-align: left; display: grid; gap: 8px; }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 14px; border-radius: 12px; background: rgba(255,255,255,.06); }
.facts dt { color: var(--muted); } .facts dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }

/* admin */
.bar { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--g-border-soft);
  background: var(--g-nav); -webkit-backdrop-filter: blur(var(--g-blur-strong)) saturate(var(--g-sat)); backdrop-filter: blur(var(--g-blur-strong)) saturate(var(--g-sat)); }
.bar-in { max-width: 1180px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; align-items: start; }
.side .card { padding: 20px; }
.side h2 { margin-bottom: 4px; }
.list { display: grid; gap: 8px; margin-top: 12px; max-height: 52vh; overflow: auto; }
.item { text-align: left; width: 100%; padding: 12px 14px; font: inherit; color: var(--text); cursor: pointer; border-radius: 14px;
  border: 1px solid var(--g-border-soft); background: var(--g-glass-soft); transition: background-color var(--g-dur, .2s), border-color var(--g-dur, .2s), transform var(--g-dur, .2s); }
.item:hover { background: var(--g-glass-hover); }
.item[aria-current="true"] { border-color: var(--accent-soft); background: rgba(99,102,241,.25); }
.item b { display: block; color: #fff; overflow-wrap: anywhere; }
.item span { display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; color: var(--muted); margin-top: 2px; }
.item .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #94a3b8; }
.item .dot.open { background: var(--ok); box-shadow: 0 0 0 3px rgba(52,211,153,.25); }
.codebox { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin: 16px 0; padding: 16px 20px;
  border-radius: 16px; background: rgba(0,0,0,.25); border: 1px solid var(--g-border-soft); }
.small-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.bigcode { font: 800 clamp(2rem, 6vw, 3.2rem)/1.1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .22em; color: #fff; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions.wide .btn { flex: 1 1 130px; }
.count { display: inline-block; margin-left: 6px; padding: 1px 10px; border-radius: 999px; font-size: .95rem; background: rgba(99,102,241,.3); }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: .85rem; font-weight: 700; color: #a7f3d0; }
.live i { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); animation: pulse 1.6s infinite; }
.live.stale { color: #fde68a; } .live.stale i { background: var(--warn); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.6); } 100% { box-shadow: 0 0 0 10px rgba(52,211,153,0); } }
#filter { margin: 14px 0 10px; }
.tablewrap { max-height: 60vh; overflow: auto; border-radius: 12px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }   /* "separate" so the sticky header keeps its lines */
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--g-border-soft); }
th { position: sticky; top: 0; z-index: 1; background: #151833; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
th:first-child { border-top-left-radius: 12px; } th:last-child { border-top-right-radius: 12px; }
tbody tr:last-child td { border-bottom: 0; }
td.num { color: var(--muted); width: 48px; } td.time { white-space: nowrap; color: #cbd5e1; font-variant-numeric: tabular-nums; }
td.name { overflow-wrap: anywhere; }
tr.new { animation: flash 1.8s ease-out; }
@keyframes flash { from { background: rgba(52,211,153,.35); } to { background: transparent; } }
.x { width: 30px; height: 30px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: #9ca3af; font-size: 1.2rem; line-height: 1; cursor: pointer; }
.x:hover { background: rgba(248,113,113,.18); color: #fecaca; }
.screen { position: fixed; inset: 0; z-index: 2147483000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center;
  background: rgba(8,10,24,.96); }
.screen .btn { position: absolute; top: 18px; right: 18px; }
.screen-title { margin: 0; font-size: clamp(1.4rem, 4vw, 2.4rem); font-weight: 700; color: #fff; }
.screen-code { margin: 0; font: 800 clamp(3.5rem, 17vw, 13rem)/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .12em; color: #fff; }
.screen-url { margin: 0; font-size: clamp(1.1rem, 3vw, 2rem); color: var(--accent-soft); }
.screen-count { margin: 18px 0 0; font-size: clamp(1.1rem, 2.5vw, 1.8rem); color: #a7f3d0; }
@media (max-width: 860px) { .admin { grid-template-columns: 1fr; } .list { max-height: 36vh; } }
@media (max-width: 480px) { .card { padding: 20px 16px; } .codebox { padding: 14px; } .code-input { letter-spacing: .2em; } th, td { padding: 8px 6px; } }
@media (prefers-reduced-motion: reduce) { .check svg { animation: none; stroke-dashoffset: 0; } .live i { animation: none; } }
html[data-g-motion="off"] .check svg { animation: none; stroke-dashoffset: 0; }

.topbar { display: flex; justify-content: flex-end; padding: 12px 16px 0; }
.topbar + .wrap.narrow { padding-top: 4vh; }

select { width: 100%; padding: 11px 14px; font: inherit; color: #fff; border-radius: 12px; border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.07); }
select option { color: #111; background: #fff; }
select:focus { outline: none; border-color: var(--accent-soft); box-shadow: 0 0 0 3px rgba(165,180,252,.25); }
.actions.tight { margin-top: 12px; }
.inline-form { margin-top: 12px; padding-top: 4px; border-top: 1px solid var(--g-border-soft); }
.btn.primary.compact { width: auto; margin-top: 0; }
.screen-event { margin: 0; font-size: clamp(1rem, 2.4vw, 1.5rem); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-soft); }
.event-line { display: inline-block; margin-bottom: 14px; padding: 4px 12px; border-radius: 999px; font-size: .85rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: #c7d2fe; background: rgba(99,102,241,.2); border: 1px solid rgba(165,180,252,.4); max-width: 100%; overflow-wrap: anywhere; }
.pill.archived { color: #fde68a; background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.4); }
.found { margin: 10px 0 0; padding: 9px 14px; border-radius: 12px; font-size: .95rem; color: #a7f3d0; background: rgba(52,211,153,.12); border: 1px solid rgba(52,211,153,.4); overflow-wrap: anywhere; }
.found.closed { color: #fde68a; background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.4); }
.found b { color: #fff; }
