:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1a1d23;
  --muted: #6b7280;
  --line: #e3e6ea;
  --accent: #2f6fed;
  --accent-dark: #2358c4;
  --danger: #d7263d;
  --ok: #17a05a;
  --warn: #d98a00;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: .3em 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, Consolas, "Courier New", monospace; letter-spacing: .08em; }
.hidden { display: none !important; }

.container { max-width: 1100px; margin: 0 auto; padding: 20px 16px 80px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar .brand { font-weight: 700; font-size: 1.15rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.grid { display: grid; gap: 14px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; transition: background .12s, border-color .12s; white-space: nowrap; }
.btn:hover { background: #f7f8fa; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { color: var(--danger); border-color: #f1c4ca; }
.btn.danger:hover { background: #fdf1f2; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: .85rem; }
.btn.lg { padding: 13px 22px; font-size: 1.05rem; }

label.field { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: .9rem; }
label.field span.hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
input[type=text], input[type=password], input[type=tel], input[type=number], select, textarea {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,111,237,.15); }
textarea { min-height: 70px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 4px; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pill.draft { background: #e9ecf1; color: #55606f; }
.pill.open { background: #dff5e8; color: #157a45; }
.pill.closed { background: #ffe8ea; color: #a41a2c; }
.pill.submitted { background: #dff5e8; color: #157a45; text-transform: none; }
.pill.inprogress { background: #fff3d6; color: #8a5a00; text-transform: none; }
.pill.notstarted { background: #e9ecf1; color: #55606f; text-transform: none; }
.pill.pending { background: #fff3d6; color: #8a5a00; text-transform: none; }
.pill.rejected { background: #ffe8ea; color: #a41a2c; text-transform: none; }
.pickphoto { display: flex; align-items: center; gap: 14px; cursor: pointer; padding: 8px; border: 1px dashed #3b4250; border-radius: 12px; }
.notice { border: 1px solid #33406a; background: #151b2e; border-radius: 12px; padding: 12px 14px; font-size: .9rem; }
.notice-text { max-height: 180px; overflow-y: auto; margin-top: 6px; color: #cfd6ea; line-height: 1.5; font-size: .85rem; }
.entry-thumb { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; background: #111; flex: none; }
.entry.approved { border-color: #1f6b37; }
.entry.rejected { opacity: .6; }
.review-card { display: grid; grid-template-columns: 200px 1fr; gap: 14px; align-items: start; }
.review-card .thumb img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; background: #111; display: block; }
.review-card input, .review-card textarea { padding: 7px 9px; font-size: .9rem; }
@media (max-width: 560px) { .review-card { grid-template-columns: 1fr; } .entry-thumb { width: 84px; height: 64px; } }
.photo-card .cap { padding: 6px 10px; font-size: .82rem; color: #cfd5e0; border-top: 1px solid #262a33; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vmeta { text-align: center; }
.vmeta b { font-size: 1.05rem; }
.vmeta p { color: #b6bfcf; font-size: .9rem; margin: 2px 0 0; }

.orgswitch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: #fff; }
.orgswitch button { border: none; background: none; padding: 5px 14px; border-radius: 999px; cursor: pointer; font-weight: 700; color: var(--muted); }
.orgswitch button.active { background: var(--accent); color: #fff; }
body.judge .tabs { border-bottom-color: #2f343e; }
body.judge .tabs button { color: #9aa3b2; }
body.judge .tabs button.active { color: #fff; border-bottom-color: var(--accent); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 16px; overflow-x: auto; }
.tabs button { background: none; border: none; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

.sharebox { display: flex; gap: 8px; align-items: center; background: #eef3ff; border: 1px solid #cfdcfb; border-radius: 10px; padding: 10px 12px; flex-wrap: wrap; }
.sharebox code { flex: 1; min-width: 200px; font-size: .95rem; word-break: break-all; }

.dropzone { border: 2px dashed #c9d0da; border-radius: var(--radius); padding: 34px 20px; text-align: center; background: #fbfcfe; cursor: pointer; transition: border-color .12s, background .12s; }
.dropzone.over { border-color: var(--accent); background: #eef3ff; }
.progress { height: 10px; border-radius: 999px; background: #e6e9ee; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 0%; transition: width .2s; }

.photo-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.photo-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.photo-card .thumb { position: relative; aspect-ratio: 4/3; background: #111; }
.photo-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-card .num { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.65); color: #fff; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.photo-card .body { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.photo-card input { padding: 7px 9px; font-size: .9rem; }
.photo-card .saved { font-size: .75rem; color: var(--ok); height: 1em; }

table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.list th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
table.list td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.code-big { font-size: 1.3rem; font-weight: 700; }

.winners { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.winner { position: relative; border-radius: var(--radius); overflow: hidden; background: #111; aspect-ratio: 4/3; border: 1px solid var(--line); }
.winner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.winner .rank { position: absolute; top: 8px; left: 8px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: #555; }
.winner .rank.r1 { background: #d4a017; } .winner .rank.r2 { background: #9aa3ad; } .winner .rank.r3 { background: #b1682c; }
.winner .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px; background: linear-gradient(transparent, rgba(0,0,0,.85)); color: #fff; font-size: .85rem; }
.winner .cap b { display: block; font-size: 1rem; }
.mini { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; background: #111; display: block; }

.avatar { border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; background: #dfe4ec; color: #4b5563; font-weight: 800; flex: none; vertical-align: middle; }
.avatar.placeholder { background: linear-gradient(135deg, #5b7cfa, #8e5bfa); color: #fff; }
.judge-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.judge-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 14px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.judge-card .judge-photo { cursor: pointer; margin-bottom: 4px; }
.judge-card .judge-photo:hover .avatar { outline: 3px solid var(--accent); }
.judge-pick { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.judge-pick .pick { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 118px; padding: 10px 6px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer; font-weight: 600; font-size: .85rem; }
.judge-pick .pick:hover { border-color: var(--accent); background: #eef3ff; }
.judge-pick .pick:disabled { opacity: .5; cursor: wait; }
.judge-pick .pick .plus { color: var(--accent); font-size: .8rem; }
body.judge .avatar { background: #2a2f38; color: #e9ecf1; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1a1d23; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.25); z-index: 1000; font-weight: 600; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.err { background: var(--danger); }

.auth { max-width: 380px; margin: 12vh auto 0; }
.auth h1 { text-align: center; }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }

/* ---------- Judge view ---------- */
html:has(body.judge) { background: #101216; }
body.judge { background: #101216; color: #e9ecf1; min-height: 100vh; }
body.judge .card { background: #181b21; border-color: #262a33; box-shadow: none; }
body.judge .btn { background: #22262e; border-color: #2f343e; color: #e9ecf1; }
body.judge .btn:hover { background: #2a2f38; }
body.judge .btn.primary { background: var(--accent); border-color: var(--accent); }
body.judge .btn.ok { background: var(--ok); border-color: var(--ok); }
body.judge input, body.judge textarea, body.judge select { background: #0e1014; border-color: #2f343e; color: #e9ecf1; }
body.judge .muted { color: #9aa3b2; }
body.judge .progress { background: #262a33; }
body.judge .photo-card { background: #181b21; border-color: #262a33; cursor: pointer; }
body.judge .photo-card:hover { border-color: #3b4250; }
body.judge .photo-card .thumb { aspect-ratio: 1/1; }
.theme-banner { background: linear-gradient(135deg, #1e2a48, #2b1e48); border: 1px solid #33406a; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.theme-banner .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: #a9b4d8; }
.theme-banner .theme { font-size: 1.35rem; font-weight: 700; }
.score-badge { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.7); color: #fff; padding: 3px 9px; border-radius: 999px; font-weight: 800; font-size: .9rem; }
.score-badge.none { background: rgba(255,255,255,.18); color: #cfd5e0; font-weight: 600; }
.photo-card.scored .thumb::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 3px var(--ok); border-radius: inherit; pointer-events: none; }

.codebox { width: 100%; font-size: 2.2rem; text-align: center; letter-spacing: .5em; padding: 14px; font-family: ui-monospace, Consolas, monospace; }

.banner { border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; font-weight: 600; }
.banner.ok { background: #14361f; border: 1px solid #1f6b37; color: #b6f0c8; }
.banner.warn { background: #3a2d0b; border: 1px solid #7a5d10; color: #ffe6a8; }
.banner.info { background: #172a4a; border: 1px solid #2a4a80; color: #cfe0ff; }

.submitbar { position: fixed; left: 0; right: 0; bottom: 0; background: #181b21; border-top: 1px solid #2f343e; padding: 12px 16px; display: flex; gap: 12px; align-items: center; justify-content: center; z-index: 50; }

/* Viewer overlay */
.viewer { position: fixed; inset: 0; background: #0b0c0f; z-index: 100; display: grid; grid-template-rows: auto 1fr auto; }
.viewer .vtop { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid #22262e; gap: 10px; }
.viewer .vimg { position: relative; overflow: hidden; display: grid; place-items: center; min-height: 0; }
.viewer .vimg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.viewer .vimg img { cursor: zoom-in; }
.viewer .vloading { position: absolute; inset: 0; display: grid; place-items: center; color: #9aa3b2; font-size: .9rem; pointer-events: none; }
.viewer .fsbar { display: none; position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 14px; align-items: center; justify-content: space-between; gap: 10px; background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #e9ecf1; font-size: .9rem; }
.viewer.fs { grid-template-rows: 1fr; background: #000; }
.viewer.fs .vtop, .viewer.fs .vpanel { display: none; }
.viewer.fs .vimg img { cursor: zoom-out; }
.viewer.fs .fsbar { display: flex; }
.viewer .vnav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.5); border: none; color: #fff; width: 44px; height: 64px; font-size: 1.6rem; cursor: pointer; border-radius: 8px; }
.viewer .vnav.prev { left: 8px; } .viewer .vnav.next { right: 8px; }
.viewer .vpanel { border-top: 1px solid #22262e; padding: 12px 14px 14px; background: #131519; display: grid; gap: 10px; max-width: 900px; width: 100%; margin: 0 auto; }
.scoreval { font-size: 2.6rem; font-weight: 800; line-height: 1; min-width: 96px; text-align: center; font-variant-numeric: tabular-nums; }
.scoreval.none { color: #6b7280; font-size: 1.4rem; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.chips button { min-width: 40px; height: 40px; border-radius: 9px; border: 1px solid #2f343e; background: #22262e; color: #e9ecf1; font-weight: 700; cursor: pointer; }
.chips button.active { background: var(--accent); border-color: var(--accent); }
.chips button:disabled { opacity: .4; cursor: not-allowed; }
.stepbtn { width: 48px; height: 48px; border-radius: 50%; font-size: 1.4rem; font-weight: 800; display: grid; place-items: center; padding: 0; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.savestate { font-size: .8rem; color: #9aa3b2; min-width: 60px; text-align: right; }

@media (max-width: 640px) {
  .container { padding: 14px 12px 90px; }
  .viewer .vpanel { padding: 10px 10px 12px; }
  .scoreval { font-size: 2rem; min-width: 80px; }
  .chips button { min-width: 34px; height: 36px; }
}

/* Yes / No segmented toggle */
.yn { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; }
.yn button { border: none; background: none; padding: 5px 14px; font-weight: 700; cursor: pointer; color: var(--muted); }
.yn button.yes.active { background: var(--ok); color: #fff; }
.yn button.no.active { background: #e9ecf1; color: #55606f; }
.yn button:disabled { cursor: wait; opacity: .6; }
tr.pending-row { background: #fffaf0; }

/* Results tab: selection bar + "which email" dialog */
.sendbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 12px; background: #f4f6fa; border: 1px solid var(--line); border-radius: 10px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 500; padding: 16px; overflow-y: auto; }
.modal > * { margin: auto; }
.modal-box { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-box .choice { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; white-space: normal; padding: 12px 14px; }
.modal-box .choice:hover { border-color: var(--accent); background: #eef3ff; }

/* one-click contact buttons */
.contact { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cbtn { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: .78rem; font-weight: 600; color: var(--text); cursor: pointer; white-space: nowrap; text-decoration: none; }
.cbtn:hover { border-color: var(--accent); color: var(--accent); }
.cbtn.copy { padding: 3px 7px; margin-left: -2px; color: var(--muted); }
.cbtn.ig { color: #c13584; border-color: #f0c4dc; }
.cbtn.fb { color: #1877f2; border-color: #c5dafb; }

/* Workshops & payment */
.brands { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 10px; margin-top: 4px; }
.brands .brand { font-weight: 500; font-size: .9rem; align-items: center; }
.brands .brand input { margin-top: 0; }
.paylines { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.payline { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid #3a3020; border-radius: 10px; background: #14110a; }
.payline b { word-break: break-all; }
@media (max-width: 520px) { .payline { grid-template-columns: 1fr auto; } .payline .small { grid-column: 1 / -1; } }
.qr { width: 180px; height: 180px; object-fit: contain; background: #fff; border-radius: 10px; padding: 6px; }
.proof-thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; background: #111; }
.modeswitch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: #fff; }
.modeswitch button { border: none; background: none; padding: 5px 14px; border-radius: 999px; cursor: pointer; font-weight: 700; color: var(--muted); }
.modeswitch button.active { background: #1a1d23; color: #fff; }
.pill.joined { background: #dff5e8; color: #157a45; text-transform: none; }
.pill.confirmed { background: #dff5e8; color: #157a45; text-transform: none; }
.pill.proof_sent { background: #fff3d6; color: #8a5a00; text-transform: none; }
.pill.unpaid { background: #e9ecf1; color: #55606f; text-transform: none; }
.paylines.light .payline { background: #f7f8fa; border-color: var(--line); }
.qr.light { background: #fff; border: 1px solid var(--line); }

.kindpick { cursor: pointer; }
.kindpick.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
body.judge .pill.draft { background: #2a2f38; color: #cfd5e0; }

.teamopt { border: 1px solid #2f343e; border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.teamopt:has(input:checked) { border-color: var(--accent); background: #172a4a; }

.teamopt.full { opacity: .5; cursor: not-allowed; }

/* Terms & Conditions fine print */
.fineprint { max-height: 300px; overflow-y: auto; padding: 12px 14px; border: 1px solid #33406a; border-radius: 10px; background: #0e1014; color: #cfd6ea; font-size: .74rem; line-height: 1.45; text-align: justify; font-family: Georgia, "Times New Roman", serif; }
.fineprint p { margin: 0 0 .55em; }
.fineprint .fp-title { text-align: center; font-weight: 800; font-size: .95rem; margin: .2em 0 .1em; color: #fff; }
.fineprint .fp-sub { text-align: center; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin: .2em 0 .6em; color: #e9ecf1; }
.fineprint .fp-rule { border: 0; border-top: 1px solid #33406a; margin: .8em 0; }

/* Check-in welcome screen */
.modal.welcome { background: radial-gradient(circle at 50% 20%, #2b3a7a, #0b0c0f 70%); }
.welcome-card { text-align: center; color: #fff; max-width: 420px; width: 100%; padding: 28px 22px; border-radius: 20px; background: linear-gradient(160deg, #1e2a48, #2b1e48); border: 1px solid #4a5aa8; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.welcome-card .avatar { display: block; }
.welcome-team { margin: 12px 0 6px; font-size: 1.25rem; line-height: 1.25; }
.welcome-team b { display: block; font-size: 2.4rem; letter-spacing: .02em; color: #ffd166; text-shadow: 0 2px 12px rgba(0,0,0,.4); }
.welcome-check { width: 72px; height: 72px; margin: 10px auto; border-radius: 50%; background: var(--ok); color: #fff; font-size: 2.4rem; font-weight: 900; display: grid; place-items: center; box-shadow: 0 0 0 10px rgba(23,160,90,.25); }
