:root {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #e8edf5;
  background: #0c1220;
  line-height: 1.5;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 10% 0, #1b2c4b 0, #0c1220 42%, #080c15 100%); }
button, input, select { font: inherit; }
button { touch-action: manipulation; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(30px, 4vw, 48px); }
h2 { margin-bottom: 12px; font-size: 22px; }
h3 { margin-bottom: 12px; font-size: 17px; }

.topbar { min-height: 64px; padding: 10px 5vw; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #25324a; background: #0d1524ee; backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20; }
.container { width: min(1440px, 100%); margin: 0 auto; padding: 28px 4vw 64px; }
.card { background: #121c2e; border: 1px solid #2a3b59; border-radius: 18px; padding: 22px; box-shadow: 0 18px 50px #0004; }
.narrow { max-width: 440px; width: min(440px, calc(100vw - 32px)); }
.center-page { display: grid; place-items: center; padding: 24px; }
.login-mode .admin-container { min-height: calc(100vh - 64px); display: grid; place-items: center; }
.login-card { text-align: center; }
.login-card form { text-align: left; margin-top: 22px; }
.landing, .signup-card { text-align: center; }
.signup-card form { text-align: left; margin-top: 20px; }

.brand-mark { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; background: linear-gradient(135deg, #67e8f9, #818cf8); color: #07101d; font-size: 28px; font-weight: 800; }
.brand-mark.small { width: 30px; height: 30px; border-radius: 10px; font-size: 18px; vertical-align: middle; margin-right: 8px; }
.eyebrow { margin-bottom: 10px; letter-spacing: .18em; font-size: 11px; color: #7dd3fc; font-weight: 700; }
.muted { color: #91a4bf; }
.notice { color: #86efac; min-height: 20px; }
.error { color: #fca5a5; min-height: 20px; }
.notice-bar { margin: -8px 0 12px; }
.mini-message { min-height: 22px; margin: 8px 0 0; font-size: 13px; }

.page-head { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 18px; }
.admin-head p:last-child { margin-bottom: 0; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.section-title h2, .section-title h3 { margin-bottom: 0; }
.count-badge { min-width: 30px; height: 30px; display: inline-grid; place-items: center; border: 1px solid #3c5171; border-radius: 999px; color: #a5f3fc; font-size: 12px; }
.grid { display: grid; gap: 18px; }
.two { grid-template-columns: 1fr 1fr; }
.three { grid-template-columns: 1.2fr 1fr 1fr; }
.stack { display: grid; gap: 12px; }
.actions, .event-actions, .link-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

input, select { width: 100%; min-width: 0; border: 1px solid #344967; border-radius: 10px; background: #0d1626; color: #e8edf5; padding: 11px 12px; }
select option { background: #101a2b; color: #f8fafc; }
input:focus, select:focus { outline: 2px solid #38bdf866; border-color: #67e8f9; }
label { font-size: 13px; color: #9fb0c8; display: grid; gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }
.datetime-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.datetime-trigger { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid #344967; border-radius: 10px; background: #0d1626; color: #e8edf5; padding: 12px; cursor: pointer; text-align: left; }
.datetime-trigger span:last-child { color: #7dd3fc; font-size: 12px; font-weight: 700; }
.date-time-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.button { border: 0; border-radius: 10px; padding: 11px 16px; background: linear-gradient(135deg, #22d3ee, #6366f1); color: #fff; font-weight: 700; cursor: pointer; text-decoration: none; text-align: center; display: inline-block; }
.button:hover:not(:disabled) { filter: brightness(1.1); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.ghost { background: #1b2940; border: 1px solid #3c5171; }
.button.accent { background: linear-gradient(135deg, #f97316, #ec4899); }
.button.full { width: 100%; margin-top: 10px; }
.button.compact { padding: 8px 12px; font-size: 13px; }
.danger-button { background: #7f1d2d; border: 1px solid #fb7185; }
.danger-text { color: #fda4af; }
.text-button { padding: 2px 4px; border: 0; background: transparent; color: #a5f3fc; cursor: pointer; }
.icon-button { width: 38px; height: 38px; border: 1px solid #3c5171; border-radius: 10px; color: #cbd5e1; background: #17243a; font-size: 24px; cursor: pointer; }
.field-help { color: #91a4bf; font-size: 12px; margin: 7px 0 0; }

.admin-workspace { display: grid; grid-template-columns: minmax(270px, 330px) minmax(0, 1fr); gap: 18px; align-items: start; }
.event-sidebar { position: sticky; top: 82px; }
.event-tools { display: grid; grid-template-columns: 1fr 120px; gap: 8px; margin: 16px 0 12px; }
.batch-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -2px 0 10px; font-size: 12px; }
.event-list { max-height: calc(100vh - 260px); min-height: 220px; overflow: auto; padding-right: 3px; }
.list { display: grid; gap: 8px; }
.event-row { display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: stretch; gap: 6px; }
.event-check { display: grid; place-items: center; cursor: pointer; }
.event-check input { width: 17px; height: 17px; margin: 0; }
.event-item { width: 100%; text-align: left; background: #18263b; color: #e8edf5; border: 1px solid #2c4162; border-radius: 12px; padding: 12px; cursor: pointer; display: grid; gap: 7px; }
.event-item > span { display: flex; justify-content: space-between; gap: 8px; }
.event-item small { color: #9fb0c8; }
.event-item.active { border-color: #67e8f9; box-shadow: inset 3px 0 #67e8f9; }
.event-content { min-width: 0; }
.empty-state { min-height: 470px; display: grid; place-items: center; align-content: center; text-align: center; }
.empty-list { color: #91a4bf; border: 1px dashed #334766; border-radius: 12px; padding: 18px; text-align: center; }
.event-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.event-panel-head h2 { font-size: 30px; }
.event-actions select { width: 140px; }
.status-help { display: flex; gap: 10px; align-items: baseline; margin: 10px 0 0; padding: 10px 12px; border-left: 3px solid #38bdf8; border-radius: 6px; background: #0c1627; color: #9fb0c8; font-size: 13px; }
.status-help strong { flex: 0 0 auto; color: #a5f3fc; }

.link-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
.link-grid > div { background: #0c1525; border-radius: 12px; padding: 14px; min-width: 0; }
.link-grid small { display: block; color: #8ea2bd; margin-bottom: 7px; }
.link-grid code { display: block; word-break: break-all; color: #a5f3fc; font-size: 12px; min-height: 42px; }
.link-actions { margin-top: 10px; }
.signup-control { margin: 0 0 14px; }
.signup-control summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; }
.signup-control summary::-webkit-details-marker { display: none; }
.signup-control summary small { display: block; color: #91a4bf; font-weight: 400; margin-top: 2px; }
.signup-control-body { padding-top: 4px; }
.signup-time-grid { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin-top: 14px; }
.signup-quick-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.countdown-control { display: flex; align-items: center; gap: 7px; padding: 6px; border: 1px solid #2f4565; border-radius: 12px; background: #0d1626; color: #9fb0c8; }
.countdown-control input { width: 82px; }
.management-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.manage-block { min-width: 0; border: 1px solid #263a59; border-radius: 14px; padding: 16px; background: #0f192a; }
.inline-form { display: flex; gap: 7px; margin: 12px 0 8px; }
.participant-form input { flex: 1 1 0; }
.participant-form button { flex: 0 0 auto; }
.import-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.prize-upload { display: flex; align-items: center; gap: 12px; border: 1px dashed #5b769d; border-radius: 12px; padding: 13px; background: #111f34; color: #e8edf5; cursor: pointer; transition: border-color .2s, background .2s; }
.prize-upload:hover { border-color: #67e8f9; background: #162a43; }
.prize-upload .upload-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; background: linear-gradient(135deg, #22d3ee, #6366f1); color: #fff; font-size: 24px; }
.prize-upload strong, .prize-upload small { display: block; }
.prize-upload small { margin-top: 2px; color: #91a4bf; }
.prize-image-preview { display: grid; grid-template-columns: 50px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px; border: 1px solid #365072; border-radius: 11px; background: #0d1626; }
.prize-image-preview img { width: 50px; height: 50px; object-fit: cover; border-radius: 8px; }
.prize-image-preview strong, .prize-image-preview small { display: block; }
.prize-image-preview small { color: #91a4bf; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scroll-list { max-height: 310px; overflow: auto; display: grid; gap: 7px; margin-top: 12px; }
.person, .winner, .prize-item { background: #0d1626; border: 1px solid #263a59; border-radius: 10px; padding: 10px; font-size: 13px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.person small, .winner small, .prize-item small { color: #92a6c0; }
.person.removed, .winner.removed { opacity: .58; }
.prize-item img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.prize-main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.prize-list { margin-top: 12px; max-height: 260px; overflow: auto; }
.draw-block .muted { min-height: 44px; }

.modal { width: min(560px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 18px; color: #e8edf5; background: transparent; }
.modal::backdrop { background: #020617cc; backdrop-filter: blur(5px); }
.modal-card { margin: 0; padding: 24px; background: #121c2e; border: 1px solid #3a4e70; border-radius: 18px; box-shadow: 0 28px 80px #0009; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.status-pill { display: inline-block; padding: 7px 12px; border-radius: 999px; font-weight: 700; }
.status-pill.pending { background: #26364d; color: #cbd5e1; }
.status-pill.open { background: #064e3b; color: #a7f3d0; }
.status-pill.closed { background: #4c1d2c; color: #fecdd3; }
.signup-message { margin: 18px 0 0; text-align: center; }

.screen { background: radial-gradient(circle at 50% 20%, #263b68, #090d18 65%); padding: clamp(14px, 2.2vw, 34px); overflow-x: hidden; }
.screen-head { max-width: 1500px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.screen-head h1 { margin-bottom: 0; font-size: clamp(24px, 3vw, 42px); }
.screen-head .eyebrow { margin-bottom: 3px; }
.screen-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.screen main { max-width: 1300px; margin: auto; }
.screen-status { margin: 4px 0 0; text-align: center; color: #a5f3fc; font-size: 14px; }
.screen-host-panel { width: min(1060px, 100%); margin: 10px auto 0; padding: 11px 13px; border: 1px solid #3b5275; border-radius: 14px; background: #0b1526dd; box-shadow: 0 12px 32px #0004; }
.screen-host-panel input, .screen-host-panel select { padding: 8px 10px; }
.screen-host-panel .mini-message { display: inline-block; min-height: 0; margin: 6px 16px 0 0; font-size: 12px; }
.screen-phase { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.screen-phase > span { color: #9fb0c8; }
.screen-phase strong { color: #a5f3fc; }
.screen-draw-controls { display: grid; grid-template-columns: minmax(220px, 1fr) 120px minmax(190px, .55fr); gap: 9px; align-items: end; }
.screen-draw-button { min-height: 50px; font-size: clamp(20px, 2vw, 27px); letter-spacing: .08em; background: linear-gradient(135deg, #f97316, #ec4899); box-shadow: 0 8px 26px #ec489944; }
.screen-draw-button.stop-mode { background: linear-gradient(135deg, #ef4444, #f97316); box-shadow: 0 8px 26px #ef444455; }
.signup-ticker { width: min(760px, 100%); min-height: 58px; margin: 14px auto 0; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; overflow: hidden; padding: 10px 16px; border: 1px solid #345072; border-radius: 999px; background: #07111fbb; box-shadow: 0 12px 34px #0005; }
.ticker-label { padding: 5px 10px; border-radius: 999px; background: #164e63; color: #a5f3fc; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.signup-ticker-item { display: flex; align-items: baseline; justify-content: center; gap: 12px; min-width: 0; color: #dbeafe; }
.signup-ticker-item.ticker-pulse { animation: ticker-in .45s ease both; }
.signup-ticker-item strong { color: #fff; font-size: 18px; }
.signup-ticker-item span { color: #a5f3fc; font-variant-numeric: tabular-nums; }
.signup-ticker-item em { color: #86efac; font-style: normal; font-weight: 700; }
.draw-stage { min-height: clamp(280px, 44vh, 520px); margin-top: 8px; display: grid; place-items: center; position: relative; overflow: hidden; border: 1px solid #273d60; border-radius: 22px; background: radial-gradient(circle at 50% 48%, #233b6b99, #08111f44 65%); box-shadow: inset 0 0 80px #38bdf811; }
.draw-countdown { position: absolute; z-index: 6; display: grid; place-items: center; width: clamp(140px, 18vw, 260px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #f8fafc 0 34%, #38bdf8 35% 52%, #4338ca 53% 100%); color: #07101d; font-size: clamp(72px, 13vw, 180px); font-weight: 1000; box-shadow: 0 0 90px #38bdf8aa; }
.draw-countdown.count-pop { animation: count-pop .75s ease both; }
.roulette { font-size: clamp(48px, 9vw, 126px); font-weight: 900; text-align: center; text-shadow: 0 6px 30px #38bdf855; min-height: 1.2em; }
.winner-cards { position: absolute; bottom: 18px; left: 18px; right: 18px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.winner-card { background: #f8fafc; color: #101827; border-radius: 13px; padding: 10px 17px; box-shadow: 0 8px 28px #0007; text-align: center; }
.winner-card strong { display: block; font-size: clamp(20px, 3vw, 42px); }
.winner-card span { color: #475569; }
.prize-wall { display: flex; flex-wrap: wrap; gap: 12px; }
.prize-wall .prize-item { min-width: 180px; display: block; }
.prize-wall .prize-item strong { display: block; font-size: 18px; }
.screen-prize-section { margin-top: 14px; }
.screen-prize-section h2 { margin-bottom: 8px; font-size: 16px; color: #9fb0c8; }
.qr-modal { width: min(780px, calc(100vw - 28px)); }
.qr-layout { display: grid; grid-template-columns: minmax(220px, 360px) 1fr; gap: 24px; align-items: center; }
.qr-layout img { width: 100%; aspect-ratio: 1; border-radius: 16px; background: #fff; padding: 10px; }
.qr-layout code { display: block; margin: 18px 0 6px; color: #a5f3fc; word-break: break-all; }
.screen-countdown { font-size: clamp(22px, 3vw, 38px); font-weight: 800; margin: 18px 0 0; color: #f8fafc; }
.host-controls { margin-top: 16px; padding-top: 14px; border-top: 1px solid #344967; }
.host-controls > p { margin: 2px 0 8px; font-size: 12px; }
.host-controls .countdown-control { padding: 4px; }
@keyframes ticker-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes count-pop { from { opacity: 0; transform: scale(.45); } 35% { opacity: 1; transform: scale(1.12); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 1100px) {
  .management-grid { grid-template-columns: 1fr 1fr; }
  .draw-block { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .container { padding: 20px 14px 48px; }
  .admin-workspace, .two, .three, .management-grid { grid-template-columns: 1fr; }
  .event-sidebar { position: static; }
  .event-list { max-height: 300px; min-height: 0; }
  .draw-block { grid-column: auto; }
  .page-head, .event-panel-head { align-items: stretch; flex-direction: column; }
  .event-actions { width: 100%; }
  .event-actions > * { flex: 1; }
  .link-grid { grid-template-columns: 1fr; }
  .signup-time-grid { grid-template-columns: 1fr 1fr; }
  .signup-time-grid .button { grid-column: 1 / -1; }
  .datetime-row { grid-template-columns: 1fr; }
  .inline-form { flex-wrap: wrap; }
  .inline-form > * { flex: 1 1 140px; }
  .status-help { align-items: flex-start; flex-direction: column; gap: 3px; }
}
@media (max-width: 560px) {
  .topbar { position: static; padding: 10px 14px; }
  #sessionBar { display: none; }
  .card { padding: 17px; border-radius: 14px; }
  .event-tools { grid-template-columns: 1fr; }
  .event-panel-head h2 { font-size: 25px; }
  .event-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .event-actions select { width: 100%; }
  .event-actions .danger-button { grid-column: 1 / -1; }
  .participant-form { display: grid; grid-template-columns: 1fr; }
  .import-actions { grid-template-columns: 1fr; }
  .modal-card { padding: 18px; }
  .modal-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .screen { padding: 18px; }
  .screen-head { align-items: flex-start; }
  .screen-actions { display: grid; }
  .qr-layout, .signup-time-grid { grid-template-columns: 1fr; }
  .screen-phase { align-items: stretch; flex-direction: column; }
  .screen-draw-controls { grid-template-columns: 1fr; }
  .date-time-picker { grid-template-columns: 1fr; }
  .signup-ticker { border-radius: 16px; grid-template-columns: 1fr; text-align: center; }
  .ticker-label { justify-self: center; }
  .signup-ticker-item { flex-wrap: wrap; gap: 5px 10px; }
  .signup-time-grid .button { grid-column: auto; }
}
