:root {
    --navy: #0b2851;
    --navy-deep: #061b38;
    --teal: #078b83;
    --teal-dark: #006a66;
    --teal-soft: #e7f6f3;
    --sand: #d8b879;
    --sand-soft: #fbf5e9;
    --red: #b93131;
    --red-soft: #fff0ef;
    --green: #19734a;
    --green-soft: #eaf8f0;
    --ink: #14243c;
    --muted: #67758a;
    --line: #dce4eb;
    --surface: #fff;
    --background: #f4f7fa;
    --shadow: 0 14px 38px rgba(12, 40, 75, .09);
    --radius: 20px;
    font-family: Tahoma, "Segoe UI", Arial, sans-serif;
}
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--background); line-height: 1.65; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.site-header {
    min-height: 82px; padding: 12px clamp(18px, 5vw, 72px); background: rgba(255,255,255,.96);
    border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between;
    gap: 24px; position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-logo { width: 168px; height: 54px; object-fit: contain; }
.brand strong { display: block; color: var(--navy); font-size: 1rem; }
.brand small { display: block; color: var(--teal-dark); }
.brand-mark {
    width: 50px; height: 50px; border-radius: 17px 8px 17px 8px; display: grid; place-items: center;
    color: #fff; font-weight: 900; font-size: 1.45rem; background: linear-gradient(145deg, var(--teal), #0bb6a5);
    box-shadow: 0 8px 20px rgba(7,139,131,.22); transform: rotate(-3deg);
}
.manager-nav { display: flex; align-items: center; gap: 18px; font-size: .92rem; }
.manager-nav a, .subtle-link, .link-button { color: var(--navy); text-decoration: none; font-weight: 700; }
.manager-nav form { margin: 0; }
.link-button { border: 0; background: transparent; padding: 0; }
.manager-name { color: var(--muted); border-right: 1px solid var(--line); padding-right: 18px; }
.page-shell { width: min(1240px, calc(100% - 32px)); margin: 36px auto 70px; }
.site-footer { padding: 28px 20px; text-align: center; color: var(--muted); border-top: 1px solid var(--line); background: #fff; font-size: .88rem; }

.card { background: var(--surface); border: 1px solid rgba(199,211,221,.75); border-radius: var(--radius); box-shadow: var(--shadow); }
.hero {
    border-radius: 28px; padding: clamp(34px, 6vw, 74px); color: #fff; overflow: hidden; position: relative;
    display: flex; align-items: center; justify-content: space-between; min-height: 320px;
    background: radial-gradient(circle at 10% 10%, rgba(216,184,121,.35), transparent 28%), linear-gradient(120deg, var(--navy-deep), var(--navy) 55%, var(--teal));
}
.hero h1 { font-size: clamp(2rem, 5vw, 4.3rem); line-height: 1.15; margin: 8px 0 16px; max-width: 760px; }
.hero p { font-size: 1.1rem; color: #dceaf4; }
.hero .eyebrow { color: #f7dca7; }
.hero-orbit { width: 210px; height: 210px; flex: 0 0 210px; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; display: grid; place-items: center; position: relative; }
.hero-orbit::before, .hero-orbit::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.17); border-radius: 50%; inset: 20px; }
.hero-orbit::after { inset: -22px; }
.hero-orbit span { width: 110px; height: 110px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.12); backdrop-filter: blur(8px); font-weight: 800; }

.eyebrow { color: var(--teal-dark); font-weight: 800; font-size: .82rem; letter-spacing: .04em; }
.muted { color: var(--muted); }
.event-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 20px; margin-top: 26px; }
.event-card { padding: 26px; }
.event-card h2 { margin: 15px 0 6px; }
.event-card > p { color: var(--muted); min-height: 52px; }
.event-meta { margin: 20px 0; display: grid; gap: 10px; }
.event-meta div { border-right: 3px solid var(--teal); padding-right: 12px; }
.event-meta dt { color: var(--muted); font-size: .78rem; }
.event-meta dd { margin: 0; font-weight: 700; }
.status-pill { display: inline-flex; align-items: center; border-radius: 999px; background: #ecf1f6; color: var(--navy); padding: 5px 11px; font-size: .76rem; font-weight: 800; }
.status-pill.open { background: var(--green-soft); color: var(--green); }

.button { border: 0; border-radius: 12px; padding: 11px 19px; display: inline-flex; justify-content: center; align-items: center; gap: 7px; text-decoration: none; font-weight: 800; transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: linear-gradient(135deg, var(--teal-dark), var(--teal)); box-shadow: 0 8px 20px rgba(7,139,131,.19); }
.button-secondary { background: #e9eff6; color: var(--navy); }
.button-ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.button-danger { color: #fff; background: var(--red); }
.button-wide { width: 100%; }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.split-layout { display: grid; grid-template-columns: minmax(260px, .7fr) minmax(0, 1.3fr); gap: 24px; align-items: start; }
.event-summary { padding: 30px; position: sticky; top: 110px; background: linear-gradient(160deg, #fff, var(--teal-soft)); }
.event-summary h1 { font-size: 2rem; line-height: 1.3; }
.registration-card, .form-card { padding: clamp(24px, 4vw, 42px); }
.registration-card h2 { margin: 5px 0 25px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 19px; }
.form-stack { display: grid; gap: 12px; }
.form-full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field legend, .form-stack label { color: var(--navy); font-size: .9rem; font-weight: 800; }
input, select, textarea {
    width: 100%; min-height: 48px; border: 1px solid #cbd7e1; border-radius: 11px; color: var(--ink); background: #fff;
    padding: 10px 13px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(7,139,131,.11); }
.field small { color: var(--muted); font-size: .74rem; }
.choice-field { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; display: flex; flex-direction: row; flex-wrap: wrap; gap: 20px; }
.choice-field legend { padding: 0 5px; }
.choice-field label, .check { display: flex; align-items: center; gap: 8px; }
.choice-field input, .check input { width: 18px; min-height: 18px; accent-color: var(--teal); }
.privacy-box { border: 1px solid #b9ded8; background: var(--teal-soft); border-radius: 14px; padding: 18px; }
.privacy-box h3 { margin: 0; font-size: 1rem; }
.privacy-box p { color: #3e615e; font-size: .83rem; }
.privacy-box .check { margin-top: 10px; font-weight: 700; font-size: .86rem; }
.validation { color: var(--red); font-size: .82rem; }
.validation:empty { display: none; }
.option-list { display: grid; gap: 13px; border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.auth-card { width: min(470px, 100%); margin: 7vh auto; padding: 40px; }
.auth-card h1 { margin-bottom: 5px; }
.auth-card .form-stack { margin-top: 25px; }
.empty-state, .success-card { text-align: center; padding: clamp(38px, 7vw, 80px); }
.empty-icon, .success-check { margin: 0 auto 20px; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-size: 2.1rem; font-weight: 900; }
.empty-icon { background: var(--sand-soft); color: #8e6b28; }
.success-check { background: var(--green-soft); color: var(--green); }
.receipt-number { display: inline-flex; flex-direction: column; min-width: 260px; padding: 14px 25px; margin: 16px 0; background: #f0f4f8; border-radius: 14px; }
.receipt-number small { color: var(--muted); }
.receipt-number strong { color: var(--navy); font-size: 1.35rem; direction: ltr; }

.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; }
.page-heading h1 { margin: 5px 0 0; font-size: clamp(1.8rem, 4vw, 2.8rem); }
.page-heading p { margin: 4px 0; }
.manager-event-list { display: grid; gap: 14px; }
.manager-event-row { padding: 20px 24px; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 25px; }
.manager-event-row h2 { margin: 7px 0 1px; }
.mini-metrics { display: flex; gap: 18px; }
.mini-metrics span { display: flex; flex-direction: column; color: var(--muted); font-size: .78rem; }
.mini-metrics b { color: var(--navy); font-size: 1.1rem; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.metric { padding: 22px; display: flex; flex-direction: column; border-top: 4px solid var(--teal); }
.metric strong { font-size: 2rem; color: var(--navy); }
.metric span { color: var(--muted); }
.metric.male { border-color: #2b79be; }
.metric.female { border-color: #a65bb3; }
.admin-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.admin-panel { padding: 25px; }
.admin-panel h2 { margin-top: 0; }
.field-list { padding-right: 20px; }
.field-list li { margin: 7px 0; display: flex; justify-content: space-between; gap: 12px; }
.danger-text { color: var(--red); }
.qr-image { width: 190px; height: 190px; display: block; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 12px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { min-width: 0; direction: ltr; text-align: left; }
.readiness { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.readiness div { padding: 15px; border-radius: 12px; background: #f0f5f8; display: flex; flex-direction: column; }
.readiness span { color: var(--muted); font-size: .8rem; }
.readiness strong { font-size: 1.4rem; color: var(--navy); }
.table-card { padding: 24px; margin-top: 20px; }
.table-card h2 { margin-top: 0; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: .78rem; }
.section-title { display: flex; align-items: center; justify-content: space-between; }

.alert { padding: 13px 17px; border-radius: 12px; margin-bottom: 18px; border: 1px solid; font-weight: 700; }
.alert-success { color: var(--green); background: var(--green-soft); border-color: #bfe3cf; }
.alert-error { color: var(--red); background: var(--red-soft); border-color: #efc3c0; }
.danger-zone { padding: 28px; border-color: #d8c9a9; background: var(--sand-soft); margin-bottom: 20px; }
.draw-control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.pool-card { padding: 28px; display: flex; flex-direction: column; gap: 9px; border-top: 5px solid; }
.pool-card.male { border-color: #2b79be; }
.pool-card.female { border-color: #a65bb3; }
.pool-card > span { font-weight: 800; color: var(--muted); }
.pool-card > strong { font-size: 2.8rem; color: var(--navy); }
.pool-card > small { margin-bottom: 13px; }
.pending-winner { text-align: center; margin-top: 20px; padding: 36px; background: radial-gradient(circle at top, var(--teal-soft), #fff 55%); }
.pending-winner h2 { font-size: 2.2rem; margin: 7px 0; color: var(--navy); }
.decision-actions { display: flex; justify-content: center; gap: 13px; flex-wrap: wrap; margin-top: 18px; }
.reject-form { display: flex; gap: 8px; }
.reject-form input { width: 260px; }

.stage-body { overflow: hidden; background: #04152d; color: #fff; }
.stage { min-height: 100vh; padding: 24px clamp(25px, 5vw, 80px); position: relative; overflow: hidden; display: flex; flex-direction: column; background: radial-gradient(circle at 50% 47%, rgba(8,139,131,.24), transparent 29%), radial-gradient(circle at 8% 12%, rgba(216,184,121,.18), transparent 24%), linear-gradient(145deg, #041329, #0b2851 62%, #064c55); }
.stage::before { content: ""; position: absolute; inset: 0; opacity: .22; pointer-events: none; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 42px 42px; mask-image: linear-gradient(to bottom, #000, transparent 70%); }
.stage-header { display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 2; }
.stage-brand { display: flex; align-items: center; gap: 13px; font-weight: 800; }
.stage-logo-wrap { width: 168px; height: 56px; display: grid; place-items: center; border-radius: 12px; background: rgba(255,255,255,.94); padding: 5px; }
.stage-logo-wrap img { width: 100%; height: 100%; object-fit: contain; }
.live-badge { display: flex; align-items: center; gap: 8px; padding: 7px 13px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; background: rgba(255,255,255,.08); }
.live-badge i { width: 9px; height: 9px; border-radius: 50%; background: #41e1b0; box-shadow: 0 0 0 6px rgba(65,225,176,.12); animation: pulse 1.5s infinite; }
.stage-title { text-align: center; position: relative; z-index: 2; }
.stage-title span { color: #f3d596; font-weight: 800; }
.stage-title h1 { margin: 3px 0; font-size: clamp(2rem, 4.5vw, 4.2rem); line-height: 1.2; }
.stage-title p { margin: 0; color: #bfd0df; }
.winner-reveal { flex: 1; display: flex; min-height: 390px; align-items: center; justify-content: center; flex-direction: column; text-align: center; position: relative; z-index: 2; }
.stage-orbit { width: clamp(140px, 13vw, 210px); height: clamp(140px, 13vw, 210px); display: grid; place-items: center; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; position: relative; margin-bottom: 13px; }
.stage-orbit::before, .stage-orbit::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.11); border-radius: 50%; inset: -24px; }
.stage-orbit::after { inset: 22px; }
.trophy { width: 85px; height: 85px; border-radius: 50%; display: grid; place-items: center; font-size: 3rem; color: #f5d78f; background: rgba(255,255,255,.08); box-shadow: 0 0 50px rgba(216,184,121,.18); }
.winner-reveal > span { color: #79e1d6; font-size: 1.2rem; font-weight: 800; }
.winner-reveal h2 { margin: 3px 0; max-width: 1000px; font-size: clamp(2.6rem, 7vw, 7.2rem); line-height: 1.15; text-shadow: 0 8px 40px rgba(0,0,0,.25); }
.winner-reveal p { color: #f3d596; font-size: 1.15rem; }
.winner-reveal.reveal-animation .stage-orbit { animation: winnerPop 1s cubic-bezier(.17,.89,.32,1.3); }
.winner-reveal.reveal-animation h2 { animation: nameReveal 1.2s ease both; }
.stage-progress { display: flex; justify-content: center; gap: 14px; position: relative; z-index: 2; }
.stage-progress div { min-width: 160px; padding: 10px 20px; border-radius: 13px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.12); display: flex; justify-content: space-between; gap: 24px; }
.stage-progress span { color: #bcd0df; }
.stage.presenter-mode { padding-bottom: 126px; }
.presenter-dock { position: fixed; z-index: 12; inset-inline: clamp(18px, 5vw, 80px); bottom: 15px; min-height: 88px; padding: 13px 18px; border: 1px solid rgba(255,255,255,.2); border-radius: 18px; background: rgba(4,21,45,.92); box-shadow: 0 18px 60px rgba(0,0,0,.35); backdrop-filter: blur(18px); display: grid; grid-template-columns: minmax(190px,1fr) auto; align-items: center; gap: 16px; }
.presenter-heading { display: flex; flex-direction: column; }
.presenter-heading strong { color: #fff; }
.presenter-heading span { color: #bcd0df; font-size: .82rem; }
.presenter-actions { display: flex; gap: 10px; }
.presenter-button { min-width: 180px; border: 1px solid rgba(255,255,255,.18); border-radius: 13px; padding: 12px 20px; color: #fff; font-weight: 900; box-shadow: 0 8px 22px rgba(0,0,0,.18); }
.presenter-button.male { background: #176cb1; }
.presenter-button.female { background: #9453a5; }
.presenter-button.confirm { background: #078b83; }
.presenter-button.reject { background: #a92e36; }
.presenter-button:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.confetti { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.confetti i { width: 10px; height: 18px; position: absolute; top: -30px; animation: confettiFall 3.8s linear forwards; }

@keyframes pulse { 50% { opacity: .4; transform: scale(.8); } }
@keyframes winnerPop { 0% { transform: scale(.4) rotate(-16deg); opacity: 0; } 70% { transform: scale(1.1) rotate(3deg); } 100% { transform: scale(1); opacity: 1; } }
@keyframes nameReveal { from { transform: translateY(35px); opacity: 0; filter: blur(10px); } to { transform: none; opacity: 1; filter: none; } }
@keyframes confettiFall { to { transform: translate3d(var(--drift), 110vh, 0) rotate(900deg); } }

@media (max-width: 900px) {
    .manager-nav a, .manager-name { display: none; }
    .hero-orbit { display: none; }
    .split-layout, .admin-grid { grid-template-columns: 1fr; }
    .event-summary { position: static; }
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .manager-event-row { grid-template-columns: 1fr; gap: 14px; }
    .mini-metrics { flex-wrap: wrap; }
    .presenter-dock { grid-template-columns: 1fr; }
    .presenter-actions { width: 100%; }
    .presenter-button { flex: 1; min-width: 0; }
}
@media (max-width: 620px) {
    .site-header { align-items: flex-start; }
    .brand-logo { width: 118px; height: 46px; }
    .brand strong { font-size: .82rem; }
    .brand small, .subtle-link { font-size: .72rem; }
    .page-shell { width: min(100% - 20px, 1240px); margin-top: 18px; }
    .form-grid, .draw-control-grid { grid-template-columns: 1fr; }
    .form-full { grid-column: auto; }
    .page-heading { align-items: stretch; flex-direction: column; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
    .copy-row, .reject-form { flex-direction: column; }
    .reject-form input { width: 100%; }
    .stage { padding: 18px; }
    .stage-title h1 { font-size: 1.7rem; margin-top: 18px; }
    .winner-reveal { min-height: 350px; }
    .winner-reveal h2 { font-size: 2.7rem; }
    .stage-progress div { min-width: 130px; padding: 9px 12px; }
    .stage.presenter-mode { padding-bottom: 178px; }
    .presenter-dock { inset-inline: 10px; bottom: 10px; padding: 11px; }
    .presenter-actions { flex-direction: column; }
    .presenter-button { width: 100%; padding: 9px 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; } }
