:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f242d;
  --border: #2a3039;
  --text: #e7eaf0;
  --muted: #9aa3b2;
  --accent: #5b8cff;
  --accent-2: #3d6ad6;
  --good: #46c46a;
  --warn: #e2a93b;
  --danger: #e2574b;
  --radius: 10px;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* layout */
header.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
  flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 17px; letter-spacing: .2px; display: flex; align-items: center; }
.brand small { display:block; font-weight: 400; color: var(--muted); font-size: 12px; }
.brand-logo { height: 40px; width: auto; display: block; }
.brand-text { line-height: 1.1; }
.welcome-card { text-align: center; }
.welcome-logo { max-height: 72px; width: auto; margin: 4px auto 8px; display: block; }
nav.main { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
nav.main button {
  background: transparent; border: none; color: var(--muted);
  padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
nav.main button:hover { background: var(--surface-2); color: var(--text); }
nav.main button.active { background: var(--accent-2); color: #fff; }
.topbar .spacer { flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

main { max-width: 1080px; margin: 0 auto; padding: 24px 20px 80px; }

/* generic */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px;
}
h1 { font-size: 24px; margin: 4px 0 18px; }
h2 { font-size: 19px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 16px 0 8px; }
p.muted, .muted { color: var(--muted); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); padding: 9px 11px; border-radius: 8px; font-size: 14px; font-family: inherit;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

button.btn {
  background: var(--accent-2); color: #fff; border: none; padding: 9px 16px;
  border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600;
}
button.btn:hover { background: var(--accent); }
button.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
button.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
button.btn.danger:hover { background: var(--danger); color: #fff; }
button.btn.small { padding: 6px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: not-allowed; }

.pill { display:inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.pill.open { color: #1c2a1c; background: var(--good); border-color: var(--good); }
.pill.closed { color: #fff; background: var(--surface-2); }
.badge-award { display:inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 600; }
tr.unscored td { opacity: .6; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border); padding: 12px 18px;
  border-radius: 10px; box-shadow: var(--shadow); z-index: 100; max-width: 90%; }
.toast.error { border-color: var(--danger); }
.toast.ok { border-color: var(--good); }

.lang-switch button { background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 4px 9px; border-radius: 6px; cursor: pointer; }
.lang-switch button.active { background: var(--accent-2); color: #fff; border-color: var(--accent-2); }

/* auth */
.auth-wrap { max-width: 420px; margin: 60px auto; }

/* submissions grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; align-items: start; }
.thumb { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; position: relative; }
.thumb img { width: 100%; height: 150px; object-fit: cover; display: block; cursor: zoom-in; background:#000; }
.thumb .meta { padding: 8px 10px; font-size: 13px; }
.thumb .code { font-family: ui-monospace, monospace; color: var(--muted); }
.scored-tag { font-size: 12px; }
.scored-tag.yes { color: var(--good); }
.scored-tag.no { color: var(--warn); }

/* score band table */
.bands td:first-child { font-family: ui-monospace, monospace; white-space: nowrap; }

/* progress */
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; background: var(--accent); }

/* modal / lightbox */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 50;
  display: flex; align-items: stretch; }
.judging-modal { display: flex; width: 100%; height: 100%; }
.judging-stage { flex: 1; overflow: hidden; position: relative; background: #000; cursor: grab; touch-action: none; }
.judging-stage.grabbing { cursor: grabbing; }
.judging-stage img { position: absolute; top: 0; left: 0; transform-origin: 0 0;
  user-select: none; -webkit-user-drag: none; max-width: none; }
.judging-side { width: 440px; max-width: 40vw; background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; }
.side-header { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.judging-scroll { flex: 1; overflow-y: auto; padding: 14px 16px; }
.judging-actions { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.zoom-hint { position: absolute; bottom: 12px; left: 12px; background: rgba(0,0,0,.55);
  padding: 6px 10px; border-radius: 8px; font-size: 12px; color: #ddd; }

/* fullscreen image lightbox (participant/admin) */
.lightbox-close { position: fixed; top: 16px; right: 16px; z-index: 60;
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(0,0,0,.6); color: #fff; font-size: 20px; line-height: 44px; text-align: center; }
.lightbox-close:hover { background: rgba(0,0,0,.85); }
.lightbox-hint { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: rgba(0,0,0,.6); padding: 8px 14px; border-radius: 20px; font-size: 12px; color: #ddd;
  max-width: 92vw; text-align: center; }
.lightbox-hint a { color: #fff; text-decoration: underline; }

/* grouped score bands (juror scoring) */
.band-group { margin-bottom: 16px; }
.band-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.band-desc { color: var(--muted); font-size: 12.5px; margin: 3px 0 7px; line-height: 1.4; }
.band-scores { display: flex; flex-wrap: wrap; gap: 6px; }
.band-scores button { min-width: 44px; padding: 9px 0; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); border-radius: 7px; cursor: pointer;
  font-variant-numeric: tabular-nums; font-size: 14px; }
.band-scores button:hover { border-color: var(--accent); }
.band-scores button.sel { background: var(--accent-2); border-color: var(--accent); color: #fff; font-weight: 700; }
.abstain-btn { width: 100%; margin-top: 10px; padding: 11px; border-radius: 8px;
  border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; font-size: 14px; }
.abstain-btn:hover { border-color: var(--warn); }
.abstain-btn.active { background: var(--warn); color: #1a1d22; border-color: var(--warn); font-weight: 700; }
.band-hint { font-size: 13px; color: var(--muted); min-height: 20px; }

.comment-guide { margin: 6px 0 8px; border: 1px solid var(--border); border-left: 3px solid var(--accent, #6aa6ff);
  border-radius: 8px; background: rgba(106,166,255,0.06); padding: 8px 12px; }
.comment-guide > summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text); list-style: none; }
.comment-guide > summary::-webkit-details-marker { display: none; }
.comment-guide > summary::before { content: "💬 "; }
.comment-guide-body { margin-top: 8px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }

.thumb.assigned { outline: 2px solid var(--accent, #6aa6ff); outline-offset: -2px; }
.assign-badge { position: absolute; right: 4px; top: 4px; z-index: 1; background: var(--accent, #6aa6ff);
  color: #0b1220; border-radius: 4px; padding: 1px 6px; font-size: 11px; font-weight: 700; }
.assign-note { margin: 6px 0 8px; padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: rgba(106,166,255,0.12); border: 1px solid var(--accent, #6aa6ff); color: var(--text); }

.juror-row { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.juror-edit { border-top: 1px dashed var(--border); padding-top: 10px; }

.cta-current { border: 1px solid var(--accent, #6aa6ff); background: rgba(106,166,255,0.08); }
.cta-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--border); }
.cta-row:first-of-type { border-top: none; }
.cta-row .btn { white-space: nowrap; }

.stat-grid { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.stat { flex: 1; min-width: 140px; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; text-align: center; }
.stat-num { font-size: 30px; font-weight: 800; line-height: 1.1; }
.stat-lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }

.feedback-tips { border-left: 3px solid var(--accent, #6aa6ff); background: rgba(106,166,255,0.08);
  padding: 10px 14px; border-radius: 8px; font-size: 13px; line-height: 1.5; margin-top: 10px; }
.fb-resolved { opacity: 0.6; }

.fb-comment { border-left: 3px solid var(--accent, #6aa6ff); background: rgba(106,166,255,0.08);
  padding: 8px 12px; border-radius: 6px; margin-top: 6px; line-height: 1.5; white-space: pre-wrap; }

/* calibration patterns */
.cal-wedge { display: flex; height: 46px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.cal-wedge > div { flex: 1; }
.cal-patches { display: flex; gap: 4px; margin: 8px 0; }
.cal-patches > div { width: 46px; height: 46px; border-radius: 4px; }
.cal-sharp { height: 60px; border-radius: 6px;
  background-image: repeating-linear-gradient(90deg, #000 0 1px, #fff 1px 2px); }
.cal-sharp.v { background-image: repeating-linear-gradient(0deg, #000 0 1px, #fff 1px 2px); }

.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.list-item { display:flex; justify-content: space-between; align-items:center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border); }
.tag { font-size: 12px; color: var(--muted); }
details summary { cursor: pointer; color: var(--accent); }
.section-tabs { display:flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.section-tabs button { background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; }
.section-tabs button.active { background: var(--accent-2); color: #fff; border-color: var(--accent-2); }
pre.block { white-space: pre-wrap; font-family: inherit; margin: 0; }
@media (max-width: 720px) {
  .judging-side { width: 300px; }
}
