:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #040611;
  --bg2: #0a1230;
  --panel: rgba(10, 15, 32, 0.92);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #f8fbff;
  --muted: #91a0bc;
  --blue: #0e5bd7;
  --blue-dark: #0a3f93;
  --danger: #ff5f7e;
  --gold: #e0b341;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 0%, rgba(31, 70, 167, 0.35), transparent 32%),
    linear-gradient(180deg, #070b18 0%, #040611 45%, #081126 100%);
}

button, input { font: inherit; }

.app-shell {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 18px max(36px, env(safe-area-inset-bottom));
}

.hero { text-align: center; margin-bottom: 8px; }

.eyebrow {
  margin: 0 0 10px;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(28px, 8vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.hero-copy { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.wheel-stage {
  position: relative;
  width: min(92vw, 430px);
  aspect-ratio: 1;
  margin: 24px auto 18px;
}

.wheel {
  width: 100%;
  height: 100%;
  overflow: visible;
  transform-origin: 50% 50%;
  transition: transform 5.4s cubic-bezier(0.12, 0.78, 0.08, 1);
  will-change: transform;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.48));
}

.wheel.is-spinning { pointer-events: none; }

.sector-overlay {
  fill: rgba(0, 0, 0, 0.12);
}

.sector-overlay-gta {
  fill: rgba(224, 179, 65, 0.10);
}

.sector-border {
  fill: none;
  stroke: rgba(255, 255, 255, 0.36);
  stroke-width: 3;
}

.sector-border-gta {
  fill: none;
  stroke: rgba(224, 179, 65, 0.95);
  stroke-width: 4;
  filter: drop-shadow(0 0 10px rgba(224, 179, 65, 0.95))
          drop-shadow(0 0 24px rgba(224, 179, 65, 0.55));
}

.hub-ring {
  fill: #09101f;
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 4;
}

.hub {
  fill: #ffffff;
  stroke: rgba(255, 255, 255, 0.65);
  stroke-width: 3;
}

.pointer {
  position: absolute;
  top: -1px;
  left: 50%;
  z-index: 5;
  width: 50px;
  height: 62px;
  transform: translateX(-50%);
  clip-path: polygon(50% 100%, 7% 18%, 20% 0, 80% 0, 93% 18%);
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.pointer-core {
  position: absolute;
  top: 11px;
  left: 50%;
  width: 16px;
  height: 16px;
  background: #0f172a;
  border-radius: 50%;
  transform: translateX(-50%);
}

.spin-button,
.secondary-button,
.table-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  border: 1px solid transparent;
  border-radius: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.spin-button {
  width: min(100%, 420px);
  margin: 0 auto;
  color: #ffffff;
  background: linear-gradient(180deg, var(--blue), var(--blue-dark));
}

.secondary-button {
  width: min(100%, 420px);
  color: white;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.10);
}

.spin-button:active:not(:disabled),
.secondary-button:active,
.table-action-button:active { transform: scale(0.98); }

.spin-button:disabled { cursor: default; opacity: 0.55; }

.status {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.status.error { color: var(--danger); }

.prizes-card {
  margin-top: 25px;
  padding: 18px;
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h2 { margin: 0; font-size: 19px; }
.prize-list { display: grid; gap: 8px; }

.prize-row {
  display: grid;
  grid-template-columns: 43px 1fr;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
}

.prize-mini-icon {
  width: 54px;
  height: 54px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  flex-shrink: 0;
}

.prize-mini-icon.is-gta,
.result-icon.is-gta {
  color: #111827;
  background: linear-gradient(180deg, #f0c65a, #c79418);
  border-color: rgba(240, 198, 90, 0.45);
  box-shadow: 0 0 18px rgba(240, 198, 90, 0.25);
}
.prize-mini-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.prize-name { font-size: 13px; font-weight: 750; line-height: 1.25; }
.rules-note { margin: 14px 8px 0; color: #7183a3; font-size: 11px; line-height: 1.45; text-align: center; }

.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(1, 3, 11, 0.82); backdrop-filter: blur(8px); }

.result-card {
  position: relative;
  width: min(100%, 410px);
  overflow: hidden;
  padding: 30px 24px 22px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 28px;
  background: #0c1228;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
  text-align: center;
  animation: modalIn 0.35s ease both;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(15px) scale(0.95); }
}

.result-icon {
  width: 110px;
  height: 110px;
  margin: 18px auto;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 22px;
  background: rgba(255,255,255,0.04);
}
.result-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.result-card h2 { margin: 0 0 8px; font-size: 27px; }
.result-prize { margin: 0; color: #ffffff; font-size: 18px; font-weight: 850; line-height: 1.3; }
.result-help { margin: 15px auto 22px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.admin-shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.admin-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.header-actions { display: flex; gap: 10px; }
.toolbar { margin-bottom: 18px; }

input[type="search"],
input[type="text"],
input[type="password"],
input:not([type]) {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  outline: none;
  color: white;
  background: rgba(255,255,255,0.04);
}

input:focus { border-color: rgba(255,255,255,0.20); }

.table-card {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  background: rgba(10, 15, 32, 0.92);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 980px; border-collapse: collapse; }

th, td {
  padding: 15px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #9eb3d4;
  background: rgba(255,255,255,0.02);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td { font-size: 13px; }
tbody tr:hover { background: rgba(255,255,255,0.03); }

.person-name { font-weight: 800; }
.person-username { margin-top: 3px; color: var(--muted); font-size: 11px; }
.profile-link { color: #7dc1ff; text-decoration: none; font-weight: 750; }

.prize-pill {
  display: inline-flex;
  padding: 6px 9px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  font-weight: 700;
}

.empty-state { padding: 35px; color: var(--muted); text-align: center; }
.error { color: var(--danger); }
.flash { margin: 16px 0 0; color: #22c55e; font-size: 13px; font-weight: 700; }
.flash.error { color: var(--danger); }

.table-action-button {
  min-height: 38px;
  padding: 0 14px;
  color: #ffffff;
  background: #b91c1c;
  border: none;
  border-radius: 12px;
}

.table-action-button:disabled { opacity: 0.6; cursor: default; }

.login-page { display: grid; place-items: center; padding: 20px; }
.login-card {
  width: min(430px, 100%);
  padding: 30px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  background: rgba(10, 15, 32, 0.94);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.26);
}

.login-card h1 { margin-bottom: 8px; }
.login-note { margin: 0 0 24px; color: var(--muted); }
.login-form { display: grid; gap: 16px; }
.login-form label { display: grid; gap: 7px; color: #d7deea; font-size: 13px; font-weight: 750; }
.login-form button { width: 100%; }
.login-form .error { min-height: 20px; margin: 0; }

@media (max-width: 650px) {
  .app-shell { padding-top: 14px; }
  .wheel-stage { width: min(75vh, 88vw, 370px); margin-top: 14px; }
  .hero-copy { display: none; }
  .admin-header { align-items: stretch; flex-direction: column; }
  .header-actions { width: 100%; }
  .header-actions button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .wheel { transition-duration: 1.2s; }
}
.sector-bg {
  fill: rgba(8, 12, 24, 0.92);
}

.sector-bg-gta {
  fill: rgba(20, 16, 8, 0.92);
}

.sector-overlay {
  fill: rgba(0, 0, 0, 0.14);
}

.sector-overlay-gta {
  fill: rgba(224, 179, 65, 0.08);
}

.sector-border {
  fill: none;
  stroke: rgba(255, 255, 255, 0.30);
  stroke-width: 3;
}

.sector-border-gta {
  fill: none;
  stroke: rgba(224, 179, 65, 0.95);
  stroke-width: 4;
  filter:
    drop-shadow(0 0 10px rgba(224, 179, 65, 0.95))
    drop-shadow(0 0 22px rgba(224, 179, 65, 0.55));
}