/* =====================================================================
   EVO RACE — gaya bersama panel admin, juri, dan login.
   Gelap (dipakai malam hari di venue), aksen hijau lendir & ungu angker.
   ===================================================================== */
:root {
    --bg: #07060b;
    --surface: #110e19;
    --surface-2: #1a1625;
    --surface-3: #241e33;
    --line: #2c2540;
    --text: #efeaf8;
    --muted: #9d94b3;
    --slime: #8dff3a;
    --slime-dim: #5fbf1f;
    --slime-ink: #0d1c02;
    --haunt: #9b6bff;
    --haunt-dim: #5b3aa8;
    --ember: #ff8a1f;
    --danger: #ff4d6d;
    --warn: #ffc53d;
    --radius: 12px;
    --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 var(--font-body);
}
a { color: var(--slime); }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: .02em; margin: 0 0 .5em; line-height: 1.1; }
h1 { font-size: 30px; } h2 { font-size: 24px; } h3 { font-size: 19px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }

/* ---------- Tombol ---------- */
.btn {
    appearance: none;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 40px; padding: 8px 16px;
    border-radius: 10px; border: 1px solid var(--line);
    background: var(--surface-3); color: var(--text);
    font: 600 14px/1 var(--font-body);
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--haunt-dim); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--slime); color: var(--slime-ink); border-color: var(--slime); }
.btn-primary:hover { background: #a6ff6a; border-color: #a6ff6a; }
.btn-haunt { background: var(--haunt); color: #fff; border-color: var(--haunt); }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(255, 77, 109, .45); }
.btn-danger:hover { background: rgba(255, 77, 109, .12); border-color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 32px; padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-xl { min-height: 64px; font-size: 20px; font-family: var(--font-display); letter-spacing: .04em; text-transform: uppercase; border-radius: 14px; }

/* ---------- Form ---------- */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .05em; }
input, select, textarea {
    width: 100%;
    min-height: 40px; padding: 8px 12px;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--line); border-radius: 10px;
    font: 15px var(--font-body);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--slime-dim); box-shadow: 0 0 0 3px rgba(141, 255, 58, .15); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; padding: 0; accent-color: var(--slime); }
textarea { min-height: 80px; resize: vertical; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }

/* ---------- Kartu & panel ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }

.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; white-space: pre-line; }
.alert-error { background: rgba(255, 77, 109, .12); border: 1px solid rgba(255, 77, 109, .4); color: #ffc2cd; }
.alert-ok { background: rgba(141, 255, 58, .1); border: 1px solid rgba(141, 255, 58, .35); color: #d6ffbd; }
.alert-warn { background: rgba(255, 197, 61, .1); border: 1px solid rgba(255, 197, 61, .35); color: #ffe7a8; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--surface-3); color: var(--muted); border: 1px solid var(--line); }
.badge-slime { background: rgba(141, 255, 58, .14); color: var(--slime); border-color: rgba(141, 255, 58, .35); }
.badge-haunt { background: rgba(155, 107, 255, .16); color: #cdb6ff; border-color: rgba(155, 107, 255, .4); }
.badge-ember { background: rgba(255, 138, 31, .15); color: #ffc08a; border-color: rgba(255, 138, 31, .4); }
.badge-danger { background: rgba(255, 77, 109, .14); color: #ff9db0; border-color: rgba(255, 77, 109, .4); }

/* ---------- Tabel ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Login ---------- */
.auth-page {
    min-height: 100vh; display: grid; place-items: center; padding: 16px;
    background:
        radial-gradient(ellipse at 50% -10%, rgba(155, 107, 255, .35), transparent 60%),
        radial-gradient(ellipse at 50% 120%, rgba(141, 255, 58, .18), transparent 55%),
        var(--bg);
}
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); }
.auth-brand { text-align: center; margin-bottom: 22px; }
.brand-mark { display: block; font: 800 34px/1 var(--font-display); letter-spacing: .08em; color: var(--slime); text-shadow: 0 0 22px rgba(141, 255, 58, .45); }
.brand-sub { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; letter-spacing: .2em; text-transform: uppercase; }

/* ---------- Layout aplikasi (admin & juri) ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 14px;
    padding: 10px 16px;
    background: rgba(7, 6, 11, .88); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.topbar .brand-mark { font-size: 22px; display: inline; }
.topbar .event-pill { font-size: 13px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--surface); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 12px 14px; border: 0; background: none; color: var(--muted); font: 600 14px var(--font-body); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--slime); border-bottom-color: var(--slime); }
.page { max-width: 1280px; margin: 0 auto; padding: 20px 16px 80px; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .7); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.modal.wide { max-width: 900px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; left: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 80; pointer-events: none; }
.toast { pointer-events: auto; max-width: 420px; background: var(--surface-3); border: 1px solid var(--line); border-left: 4px solid var(--slime); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; white-space: pre-line; }
.toast.error { border-left-color: var(--danger); }

/* ---------- Scheduler wave ---------- */
.sched { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.pool { position: sticky; top: 110px; max-height: calc(100vh - 130px); overflow: auto; }
.wave-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.wave-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 140px; transition: border-color .15s, background .15s; }
.wave-card.drag-over, .pool.drag-over { border-color: var(--slime); background: rgba(141, 255, 58, .05); }
.wave-card.locked { opacity: .8; }
.wave-card header { display: flex; justify-content: space-between; align-items: start; gap: 8px; margin-bottom: 8px; }
.wave-card h3 { margin: 0; font-size: 20px; }
.chip {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 7px 10px; margin-bottom: 6px;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
    font-size: 13px; cursor: grab; user-select: none;
}
.chip:active { cursor: grabbing; }
.chip.dragging { opacity: .4; }
.chip .chip-sub { color: var(--muted); font-size: 11px; }
.chip select { width: auto; min-height: 28px; padding: 2px 6px; font-size: 12px; }

/* ---------- Juri ---------- */
.judge-body { padding-bottom: 90px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; color: var(--muted); padding: 8px 14px; border-radius: 9px; font: 700 14px var(--font-body); cursor: pointer; }
.seg button.active { background: var(--slime); color: var(--slime-ink); }
.wave-pick { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.wave-pick button { flex: 0 0 auto; text-align: left; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 12px; padding: 10px 14px; cursor: pointer; min-width: 120px; }
.wave-pick button.active { border-color: var(--slime); box-shadow: 0 0 0 2px rgba(141, 255, 58, .25) inset; }
.wave-pick strong { display: block; font: 800 18px var(--font-display); }
.big-clock { font: 800 clamp(44px, 10vw, 84px)/1 var(--font-display); font-variant-numeric: tabular-nums; color: var(--slime); text-shadow: 0 0 28px rgba(141, 255, 58, .35); letter-spacing: .02em; }
.team-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.team-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.team-card.is-running { border-color: var(--slime-dim); box-shadow: 0 0 0 1px rgba(141, 255, 58, .25), 0 0 24px rgba(141, 255, 58, .08); }
.team-card.is-done { opacity: .72; }
.team-card .tc-head { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.team-card .tc-name { font: 800 20px/1.1 var(--font-display); }
.team-card .tc-members { color: var(--muted); font-size: 13px; }
.team-card .tc-timer { font: 800 34px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.team-card .tc-actions { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }
.section-label { font: 700 12px var(--font-body); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.netbar { position: fixed; left: 0; right: 0; bottom: 0; padding: 8px 16px; font-size: 13px; text-align: center; background: var(--warn); color: #2a1d00; font-weight: 700; z-index: 40; }
.netbar.offline { background: var(--danger); color: #fff; }

@media (max-width: 860px) {
    .sched { grid-template-columns: 1fr; }
    .pool { position: static; max-height: 360px; }
}
@media (max-width: 520px) {
    .page { padding: 16px 12px 80px; }
    .card { padding: 14px; }
    .topbar .event-pill { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
