/* Witflix Event Portal — brand: red #E8333A, ink black, warm off-white. */
:root {
  --red: #E8333A;
  --red-dark: #C6252C;
  --red-soft: #FDECEC;
  --ink: #141414;
  --ink-2: #3a3a3a;
  --muted: #6d6d6d;
  --bg: #F6F6F6;
  --card: #ffffff;
  --line: #E6E4E1;
  --ok: #138A4E;
  --ok-soft: #E3F5EB;
  --warn: #B86E00;
  --warn-soft: #FFF2DB;
  --info: #2457C5;
  --info-soft: #E7EEFC;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  --display: 'Anton', 'Impact', 'Arial Narrow', sans-serif;
  --body: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--body); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 700; }
a { color: var(--red-dark); }
code { background: #f0efed; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, 'SF Mono', Consolas, monospace; }
.strong { font-weight: 700; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- top bar */
.wordmark { font-family: var(--display); color: var(--red); letter-spacing: .04em; font-size: 1.7rem; line-height: 1; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 10px 24px; background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand-sub { color: #bdbdbd; font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav a { white-space: nowrap; color: #d6d6d6; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: .92rem; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a.active { color: #fff; background: var(--red); }
.nav-user { margin-left: auto; color: #fff; font-size: .9rem; font-weight: 600; padding-right: 6px; white-space: nowrap; }
.nav-user small { display: inline-block; margin-left: 6px; color: #aaa; font-weight: 500; }
.nav a.nav-logout { color: #aaa; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; }

/* Scanners have a single link, so their bar never needs the collapsed menu. */
@media (max-width: 1080px) {
  .topbar:has(.nav a:nth-of-type(4)) { flex-wrap: wrap; padding: 10px 16px; gap: 8px; }
  .topbar:has(.nav a:nth-of-type(4)) .nav-toggle { display: block; }
  .topbar:has(.nav a:nth-of-type(4)) .nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: 8px; }
  body.nav-open .topbar .nav { display: flex; }
  .topbar:has(.nav a:nth-of-type(4)) .nav-user { margin: 8px 0 0; padding: 8px 12px; border-top: 1px solid #333; }
}
@media (max-width: 520px) {
  .brand-sub { display: none; }
  .nav-user small { display: none; }
}

/* ---------------------------------------------------------------- layout */
.container { max-width: 1200px; margin: 0 auto; padding: 28px 24px 60px; }
@media (max-width: 640px) { .container { padding: 20px 16px 48px; } }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 0; max-width: 720px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-2-1 { grid-template-columns: 2fr 1fr; align-items: start; }
@media (max-width: 900px) { .grid-2, .grid-2-1 { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 20px; }
.grid > .card { margin-bottom: 0; }
.card-flush { padding: 0; overflow: hidden; }
.card-quiet { background: transparent; box-shadow: none; border-style: dashed; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }

/* ---------------------------------------------------------------- forms */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .88rem; color: var(--ink-2); }
label.sm { font-size: .8rem; }
input[type=text], input[type=email], input[type=password], input[type=search], input:not([type]), select {
  font: inherit; font-weight: 500; color: var(--ink);
  padding: 10px 12px; border: 1px solid #d5d2ce; border-radius: 9px; background: #fff; width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(232,51,58,.15); }
input[type=file] { font: inherit; }
.seg { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg label { flex-direction: row; align-items: flex-start; gap: 8px; padding: 10px 12px; border: 1px solid #d5d2ce; border-radius: 9px; cursor: pointer; }
.seg label:has(input:checked) { border-color: var(--red); background: var(--red-soft); }
.seg input { accent-color: var(--red); margin-top: 3px; }
.seg span { display: flex; flex-direction: column; }
.seg small { font-weight: 500; color: var(--muted); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: .92rem; line-height: 1;
  padding: 11px 16px; border-radius: 9px; border: 1px solid #d5d2ce;
  background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #f4f3f1; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(0,0,0,.05); }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--red-dark); }
.btn-danger-ghost:hover { background: var(--red-soft); }
.btn-light { background: #fff; color: var(--ink); border-color: #fff; }
.btn-ghost-light { background: transparent; color: #ddd; border-color: #555; }
.btn-ghost-light:hover { background: rgba(255,255,255,.08); }
.btn-sm { padding: 7px 10px; font-size: .82rem; }
.btn-lg { padding: 14px 22px; font-size: 1rem; }
.btn-xl { padding: 18px 34px; font-size: 1.15rem; border-radius: 999px; }
.btn-block { width: 100%; }
.linklike { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

/* ---------------------------------------------------------------- alerts & badges */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; border: 1px solid transparent; }
.alert-success { background: var(--ok-soft); color: #0d5f36; border-color: #bfe6cf; }
.alert-error { background: var(--red-soft); color: #9b1a20; border-color: #f6c6c8; }
.alert-warning { background: var(--warn-soft); color: #7a4a00; border-color: #f3dcae; }
.alert-info { background: var(--info-soft); color: #1d428f; border-color: #cbd9f6; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-bad { background: var(--red-soft); color: var(--red-dark); }
.badge-neutral { background: #EEEDEB; color: #555; }
.badge-brand { background: var(--ink); color: #fff; }
.err-note { color: var(--red-dark); font-size: .78rem; margin-top: 3px; }

/* ---------------------------------------------------------------- stats & progress */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.stat-n { font-family: var(--display); font-size: 2.4rem; line-height: 1.1; letter-spacing: .02em; }
.stat-l { color: var(--muted); font-weight: 600; font-size: .85rem; }
.stat-brand { background: var(--ink); border-color: var(--ink); color: #fff; }
.stat-brand .stat-n { color: var(--red); }
.stat-brand .stat-l { color: #bbb; }
.stat-warn .stat-n { color: var(--warn); }
.progress-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 12px; }
.progress { height: 12px; background: #EEEDEB; border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--red); border-radius: 999px; transition: width .3s; }

/* ---------------------------------------------------------------- lists & tables */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.log { list-style: none; margin: 14px 0 0; padding: 0; max-height: 320px; overflow: auto; font-size: .85rem; }
.log li { padding: 6px 10px; border-radius: 6px; margin-bottom: 4px; }
.log li.ok { background: var(--ok-soft); color: #0d5f36; }
.log li.bad { background: var(--red-soft); color: #9b1a20; }
.send-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 10px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; border-radius: 9px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .88rem; }
.tabs a:hover { background: rgba(0,0,0,.05); }
.tabs a.active { background: var(--ink); color: #fff; }
.tabs .count { opacity: .6; margin-left: 3px; }
.search { min-width: 260px; flex: 0 1 340px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 12px 16px; background: #FAFAF9; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #FCFBFA; }
.table .actions { text-align: right; width: 1%; }
.row-muted td { opacity: .55; }
.empty { text-align: center; padding: 48px 20px; }
.empty p { margin: 4px 0; }

/* dropdown menu built on <details> */
.menu { position: relative; display: inline-block; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-body { position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; min-width: 210px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 8px; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.menu-body form .btn { width: 100%; justify-content: flex-start; }
.menu-body .stack-sm { padding: 4px 4px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }

dialog.dialog { border: 0; border-radius: 14px; padding: 24px; width: min(460px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10,10,10,.55); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------------------------------------------------------------- auth */
.auth-page { background: #F7F7F7; }
.auth-wrap { min-height: calc(100vh - 60px); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-wrap > .alert { width: min(420px, 100%); }
.auth-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; box-shadow: 0 10px 40px rgba(0,0,0,.07); }
.auth-logo { display: block; width: 100%; max-width: 260px; margin: 0 auto 18px; mix-blend-mode: multiply; }
.auth-card h1 { text-align: center; font-size: 1.3rem; }
.auth-card > p { text-align: center; margin: 0 0 20px; }

/* ================================================================ dark screens */
.theme-dark { background: #0C0C0D; color: #f2f2f2; }
.theme-dark .muted { color: #9a9a9a; }
.theme-dark .alert { margin: 12px 16px 0; }

/* ---------------------------------------------------------------- check-in desk */
.desk { max-width: 560px; margin: 0 auto; padding: 16px 16px 40px; }
.desk-top { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.desk-count { font-weight: 600; font-size: 1rem; text-align: center; }
.desk-count #c-in { font-family: var(--display); font-size: 2.2rem; color: var(--red); letter-spacing: .02em; }
.seg-tabs { display: grid; grid-template-columns: 1fr 1fr; background: #1c1c1e; border-radius: 12px; padding: 4px; }
.seg-tabs button { font: inherit; font-weight: 600; background: none; border: 0; color: #aaa; padding: 11px; border-radius: 9px; cursor: pointer; }
.seg-tabs button.active { background: #fff; color: var(--ink); }

.scanner-frame { position: relative; aspect-ratio: 1; background: #1a1a1c; border-radius: 18px; overflow: hidden; border: 2px solid #2a2a2c; }
#reader { width: 100%; height: 100%; }
#reader video { width: 100% !important; height: 100% !important; object-fit: cover; }
#reader img[alt="Info icon"], #reader__dashboard_section_csr span { display: none !important; }
.scanner-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; padding: 24px; color: #bbb; }
.desk-hint { text-align: center; color: #9a9a9a; font-size: .88rem; margin: 12px 4px; }
.desk-hint.error { color: #ff8a8e; }

.desk-search { font-size: 1.05rem !important; padding: 14px 16px !important; background: #1c1c1e !important; color: #fff !important; border-color: #333 !important; border-radius: 12px !important; }
.results { list-style: none; margin: 12px 0 0; padding: 0; }
.results li { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #1a1a1c; border: 1px solid #2a2a2c; border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.results li.done { opacity: .7; }
.r-info { display: flex; flex-direction: column; min-width: 0; }
.r-info strong { font-size: 1rem; }
.r-info span { color: #9a9a9a; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-done { color: #5fd697; font-weight: 700; font-size: .85rem; white-space: nowrap; }
.results-empty { justify-content: center !important; color: #9a9a9a; }

.result-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.6); }
.result-card { width: min(460px, 100%); border-radius: 22px; padding: 34px 26px 26px; text-align: center; color: #fff; background: #222; box-shadow: 0 20px 60px rgba(0,0,0,.5); animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.result-icon { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 50%; background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; font-size: 2.8rem; font-weight: 700; }
.result-icon:empty { display: none; }
.result-title { font-size: 1.1rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; opacity: .9; }
.result-name { font-size: 1.9rem; font-weight: 700; line-height: 1.2; margin: 8px 0 4px; word-break: break-word; }
.result-id { font-family: var(--display); font-size: 2.2rem; letter-spacing: .06em; white-space: pre; }
.result-meta { font-size: .92rem; opacity: .9; margin: 10px 0 20px; }
.result-card .btn { width: 100%; }
.state-ok .result-card { background: #12814A; }
.state-already .result-card { background: #C77700; }
.state-invalid .result-card, .state-error .result-card { background: #C1272D; }
.state-loading .result-card { background: #222; }

/* ---------------------------------------------------------------- raffle stage */
.stage { padding: 0; }
.stage-grid { display: grid; grid-template-columns: 1fr 320px; min-height: calc(100vh - 56px); }
.stage-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; gap: 28px;
  background: radial-gradient(ellipse at center, rgba(232,51,58,.16), transparent 65%); }
.stage-logo { text-align: center; }
.wordmark-xl { font-size: clamp(3rem, 8vw, 6rem); display: block; }
.stage-tag { color: var(--red); font-weight: 600; letter-spacing: .04em; font-size: clamp(.9rem, 1.6vw, 1.2rem); }
.drum { width: min(900px, 100%); min-height: 260px; border-radius: 26px; border: 3px solid #2c2c2e; background: #141416;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px; text-align: center; transition: border-color .3s, box-shadow .3s; }
.drum-prize { color: var(--red); font-weight: 700; text-transform: uppercase; letter-spacing: .12em; min-height: 1.4em; }
.drum-name { font-size: clamp(2rem, 5.5vw, 4.4rem); font-weight: 700; line-height: 1.1; margin: 10px 0; word-break: break-word; }
.drum-id { font-family: var(--display); font-size: clamp(1.1rem, 2.4vw, 1.8rem); color: #bdbdbd; letter-spacing: .05em; }
.drum.spinning { border-color: #555; }
.drum.spinning .drum-name { color: #9a9a9a; filter: blur(.4px); }
.drum.won { border-color: var(--red); box-shadow: 0 0 0 6px rgba(232,51,58,.15), 0 0 80px rgba(232,51,58,.35); }
.drum.won .drum-name { color: #fff; animation: pop .35s ease-out; }
.drum.won .drum-id { color: var(--red); }
.stage-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center; }
.stage-input { width: 320px !important; background: #1c1c1e !important; color: #fff !important; border-color: #333 !important; border-radius: 999px !important; padding: 16px 20px !important; }
.stage-hint { color: #8a8a8a; font-size: .85rem; margin: 0; }
kbd { background: #2a2a2c; border-radius: 4px; padding: 1px 6px; font-family: inherit; }
.stage-side { border-left: 1px solid #222; padding: 28px 22px; background: #111113; overflow-y: auto; max-height: calc(100vh - 56px); }
.stage-side h2 { text-transform: uppercase; letter-spacing: .1em; font-size: .85rem; color: #9a9a9a; }
.winners { list-style: none; padding: 0; margin: 12px 0 0; counter-reset: w; }
.winners li { display: flex; flex-direction: column; padding: 12px 14px; border-radius: 12px; background: #1a1a1c; margin-bottom: 8px; border-left: 3px solid var(--red); }
.winners li span { color: #9a9a9a; font-size: .82rem; }
.winners li.absent { border-left-color: #444; opacity: .55; }
.winners li.absent strong { text-decoration: line-through; }
@media (max-width: 900px) {
  .stage-grid { grid-template-columns: 1fr; }
  .stage-side { border-left: 0; border-top: 1px solid #222; max-height: none; }
  .stage-input { width: 100% !important; }
}
:fullscreen .topbar { display: none; }

/* ---------------------------------------------------------------- credit footer */
.site-footer { text-align: center; font-size: .8rem; color: var(--muted); padding: 18px 16px 24px; }
.site-footer a { color: inherit; font-weight: 600; text-decoration: none; }
.site-footer a:hover { color: var(--red); }
.theme-dark .site-footer { color: #777; }
.stage + .site-footer { position: fixed; left: 0; bottom: 0; width: calc(100% - 320px); padding: 10px; }
@media (max-width: 900px) { .stage + .site-footer { position: static; width: auto; } }
:fullscreen .stage-grid { min-height: 100vh; }
