@font-face { font-family: "Red Hat Display"; src: url("/static/fonts/RedHatDisplay-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Red Hat Display"; src: url("/static/fonts/RedHatDisplay-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Red Hat Display"; src: url("/static/fonts/RedHatDisplay-Bold.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Red Hat Display"; src: url("/static/fonts/RedHatDisplay-ExtraBold.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Red Hat Display"; src: url("/static/fonts/RedHatDisplay-Black.woff2") format("woff2"); font-weight: 900 1000; font-display: swap; }
/* Arabic glyphs are not in Red Hat Display: Cairo takes over for them through the font stack. */
@font-face { font-family: "Cairo"; src: url("/static/fonts/Cairo.ttf") format("truetype"); font-weight: 200 1000; font-display: swap; }

/* CG Foundry brand: red #FF0000, ink #1F0F13, cream #FFE9CF, grey #888888, cyan #00FDFF */
:root {
  --bg: #170b0e; --surface: #1f0f13; --ink: #fff4e6; --muted: #b8a49d; --line: #3a2328;
  --brand: #ff0000; --brand-deep: #c80000; --sun: #ffe9cf; --danger: #ff6b6b; --ok: #4fd9a6; --warn: #ffc15e;
  --soft: #2c171b; --cream: #ffe9cf; --cyan: #00fdff; --grey: #888888;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 "Red Hat Display", "Cairo", system-ui, sans-serif; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h2 { font-size: 19px; font-weight: 800; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }
[dir="auto"], .name { unicode-bidi: plaintext; }

#top { display: flex; align-items: center; gap: 14px; padding: 12px 24px; background: #0f0608; color: var(--ink); flex-wrap: wrap; border-bottom: 3px solid var(--brand); }
#top .brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 15px; letter-spacing: 3px; text-transform: uppercase; margin-inline-end: 8px; color: var(--cream); }
#top .brand img { height: 30px; }
#top select { background: transparent; border: 1px solid #ffffff55; border-radius: 8px; padding: 5px 10px; color: inherit; max-width: 260px; }
#top select option { color: #1f0f13; background: #fff4e6; }
#top .grow { flex: 1; }
#top button.link { color: inherit; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 800; font-size: 13px; }
.badge.rehearsal { background: var(--cream); color: #1f0f13; letter-spacing: 1px; }
.badge.live { background: var(--brand); color: #fff; letter-spacing: 1px; }
.badge.ok { background: #0f3b2c; color: #7ff0c4; }
.badge.warn { background: #3d2a0c; color: #ffd28a; }
.badge.bad { background: #4a1014; color: #ffb3b3; }
.badge.neutral { background: var(--soft); color: var(--ink); }

#tabs { display: flex; gap: 4px; padding: 10px 24px 0; border-bottom: 1px solid var(--line); background: var(--surface); }
#tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 18px; font-weight: 800; color: var(--muted); cursor: pointer; text-transform: uppercase; letter-spacing: 1.5px; font-size: 13px; border-radius: 0; }
#tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--brand); }

#view { padding: 24px; max-width: 1280px; margin: 0 auto; display: grid; gap: 20px; }
.grid2 { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
.grid3 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } #view { padding: 14px; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 20px; display: grid; gap: 14px; }
.card h2 { text-transform: uppercase; letter-spacing: .5px; }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.next { position: relative; background: #1f0f13; color: #fff; border: 0; border-left: 8px solid var(--brand); padding: 28px 120px 28px 28px; gap: 18px; overflow: hidden; }
.next::after { content: ""; position: absolute; right: 0; top: 0; width: 84px; height: 84px; background: var(--brand); }
.next::before { content: ""; position: absolute; right: 0; bottom: 18px; width: 160px; height: 46px; background: repeating-linear-gradient(to bottom, var(--cream) 0 4px, transparent 4px 11px); opacity: .7; }
.next h2 { font-size: 30px; font-weight: 900; }
.next .muted { color: var(--cream); opacity: .85; }
.next .actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.next .secret { font-size: 40px; font-weight: 900; padding: 10px 18px; border-radius: 4px; background: #0f0608; display: inline-block; unicode-bidi: plaintext; }
.next .secret.hidden { filter: blur(14px); user-select: none; }

button { border: 1px solid var(--line); background: var(--soft); border-radius: 4px; padding: 8px 14px; font-weight: 700; cursor: pointer; }
button:hover { background: #3a2328; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: var(--brand-deep); }
button.big { font-size: 22px; padding: 14px 28px; border-radius: 10px; }
.next button.big { background: var(--cream); color: #1f0f13; border-color: var(--cream); text-transform: uppercase; letter-spacing: 1px; }
.next button.big:hover { background: #fff; }
.next button.ghost { background: transparent; color: #fff; border-color: #ffffff77; }
button.danger { color: var(--danger); border-color: currentColor; }
button.link { background: none; border: 0; padding: 0; text-decoration: underline; font-weight: 600; }

label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
label.row { display: flex; align-items: center; gap: 8px; font-weight: 500; }
input, select, textarea { border: 1px solid var(--line); background: #140a0c; border-radius: 4px; padding: 8px 10px; width: 100%; }
input[type="checkbox"], input[type="radio"] { width: auto; }
textarea { min-height: 120px; resize: vertical; }
.form { display: grid; gap: 12px; }
.cols { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.stat { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat b { font-size: 26px; font-weight: 900; display: block; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 700; }
.tablewrap { overflow-x: auto; }
tr.out td { color: var(--muted); }

ol.prizes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
ol.prizes li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
ol.prizes li.current { border-color: var(--brand); box-shadow: inset 4px 0 0 var(--brand); }
ol.prizes .n { width: 30px; height: 30px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; font-weight: 800; }
ol.prizes li.won .n { background: var(--ok); color: #fff; }

ul.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
ul.checks li { display: flex; gap: 10px; align-items: baseline; }
ul.checks i { font-style: normal; font-weight: 900; width: 18px; text-align: center; }
ul.checks .ok i { color: var(--ok); } ul.checks .warn i { color: var(--warn); }

.note { padding: 10px 14px; border-radius: 8px; background: var(--soft); }
.note.warn { background: #3d2a0c; color: #ffd28a; }
.note.bad { background: #4a1014; color: #ffb3b3; }
.result { background: var(--soft); border-radius: 8px; padding: 12px 14px; display: grid; gap: 4px; }

dialog { border: 1px solid var(--line); border-radius: 14px; padding: 24px; width: min(480px, 92vw); background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgba(10, 4, 6, .75); }
dialog form { display: grid; gap: 14px; }
dialog .actions { display: flex; gap: 10px; justify-content: flex-end; }

#toasts { position: fixed; bottom: 18px; inset-inline-start: 18px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; max-width: 420px; font-weight: 600; }
.toast.err { background: var(--danger); color: #fff; }

#login { max-width: 420px; margin: 12vh auto; display: grid; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-top: 6px solid var(--brand); padding: 30px; border-radius: 4px; }
#login .logo { height: 46px; justify-self: start; }
#login h1 { text-transform: uppercase; font-size: 22px; letter-spacing: 1px; }
#login-err { color: var(--danger); min-height: 1.4em; font-weight: 600; }
body.plain { display: grid; place-items: center; min-height: 100vh; }
#lookup { max-width: 440px; width: 92vw; display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--line); padding: 28px; border-radius: 14px; }
#lookup .ar { font-weight: 600; }
.qr img { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 8px; }
.col { display: grid; gap: 20px; align-content: start; }
.copy { display: flex; gap: 8px; }
.copy input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.dropzone { border: 2px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; }
.dropzone.over { border-color: var(--brand); background: var(--soft); }
pre.text { white-space: pre-wrap; background: var(--soft); padding: 12px; border-radius: 8px; margin: 0; font: inherit; }
a.btn { display: inline-block; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 14px; font-weight: 700; color: inherit; text-decoration: none; }
a.btn:hover { background: var(--soft); }

#top button { background: transparent; color: inherit; border-color: #ffffff66; }
#top button:hover { background: #ffffff22; }
#top button.link { border: 0; }

/* join link + QR (audience sign-up) */
.joinbox { display: grid; grid-template-columns: 170px 1fr; gap: 16px; align-items: center; }
.joinbox .qrsvg { background: #fff; padding: 8px; border-radius: 4px; width: 170px; height: 170px; }
.joinbox .qrsvg svg { width: 100%; height: 100%; display: block; }
@media (max-width: 600px) { .joinbox { grid-template-columns: 1fr; } }
