/* Premium event / AI-like theme — RTL, projector-friendly */

:root {
  /* Sawaeed-inspired brand palette (required) */
  --brand-primary-blue: #0A1A3F;          /* deep navy base */
  --brand-accent-gold: #D4A042;           /* warm gold accent */
  --brand-surface-light: #FFFFFF;         /* white card backgrounds */
  --brand-surface-soft: #F7F7F7;          /* off-white surfaces */
  --brand-text-dark: #111827;             /* dark text */
  --brand-text-light: #FFFFFF;            /* light text */

  /* App theme variables (mapped to brand palette) */
  --draw-primary: var(--brand-primary-blue);
  --draw-gold: var(--brand-accent-gold);
  --draw-text: rgba(255, 255, 255, 0.92);
  --draw-muted: rgba(255, 255, 255, 0.72);
  --draw-bg: #050b17;
  --draw-surface: rgba(255, 255, 255, 0.06);
  --draw-surface-2: rgba(255, 255, 255, 0.10);
  --draw-border: rgba(255, 255, 255, 0.14);
  --draw-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --draw-radius-lg: 26px;
  --draw-radius-md: 18px;
  --draw-focus: rgba(212, 160, 66, 0.75);
  --draw-glow: 0 0 0 1px rgba(212, 160, 66, 0.22), 0 0 50px rgba(212, 160, 66, 0.12);

  --container: 1100px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  direction: rtl;
  color: var(--draw-text);
  background: radial-gradient(1200px 700px at 20% 20%, rgba(10, 26, 63, 0.85), transparent 60%),
    radial-gradient(900px 650px at 85% 25%, rgba(212, 160, 66, 0.20), transparent 55%),
    radial-gradient(900px 700px at 50% 90%, rgba(46, 112, 255, 0.14), transparent 55%),
    linear-gradient(180deg, var(--brand-primary-blue) 0%, #050b17 55%, #02050d 100%);
  overflow-x: hidden;
}

a {
  color: inherit;
}

.container {
  width: min(var(--container), calc(100% - 32px));
  margin-inline: auto;
}

/* Subtle animated background grid */
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(700px 500px at 50% 25%, rgba(0, 0, 0, 0.9), transparent 70%);
  animation: gridDrift 14s linear infinite;
}

@keyframes gridDrift {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(40px);
  }
}

/* Top glow accent */
.bg-orb {
  position: fixed;
  top: -220px;
  left: 50%;
  transform: translateX(-50%);
  width: min(980px, 120vw);
  height: 520px;
  border-radius: 999px;
  background: radial-gradient(circle at 50% 40%, rgba(212, 160, 66, 0.24), transparent 60%),
    radial-gradient(circle at 30% 20%, rgba(46, 112, 255, 0.22), transparent 62%),
    radial-gradient(circle at 70% 25%, rgba(10, 26, 63, 0.60), transparent 60%);
  filter: blur(24px);
  pointer-events: none;
  opacity: 0.95;
}

/* Header */
.header {
  padding: 18px 0;
  position: relative;
  z-index: 2;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
  flex-direction: column;
}

.logo-dot {
  width: 64px;
  height: 64px;
  object-fit: contain;  
  display: grid;
  place-items: center;
  text-align: center;
  overflow: hidden;
}

.logo-text {
  font-size: 9px;
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: 0.2px;
  color: rgba(255, 255, 255, 0.88);
  padding: 0 4px;
  user-select: none;
}

.brand-text {
  display: grid;
  gap: 2px;
  text-align: center;
}

.brand-title {
  font-size: 18px;
  letter-spacing: 0.1px;
  font-weight: 700;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--draw-muted);
  font-weight: 500;
}

/* Hero */
.hero {
  padding: 18px 0 8px;
  position: relative;
  z-index: 1;
}

.hero h1,
.hero h2 {
  margin: 0;
  line-height: 1.18;
}

.hero-title {
  font-size: clamp(28px, 3.6vw, 54px);
  font-weight: 800;
  text-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
}

.hero-sub {
  margin-top: 10px;
  color: var(--draw-muted);
  font-size: clamp(14px, 1.5vw, 18px);
  max-width: 60ch;
}

/* Stage card */
.stage {
  padding: 18px 0 26px;
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.06) 100%);
  border: 1px solid var(--draw-border);
  border-radius: var(--draw-radius-lg);
  box-shadow: var(--draw-shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
  position: relative;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(800px 240px at 25% 15%, rgba(214, 177, 94, 0.14), transparent 55%),
    radial-gradient(700px 260px at 80% 10%, rgba(36, 120, 255, 0.16), transparent 55%);
  pointer-events: none;
}

.card-inner {
  position: relative;
  padding: clamp(18px, 2.8vw, 34px);
}

.section-title {
  font-size: clamp(16px, 1.8vw, 20px);
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.90);
  font-weight: 700;
}

/* Form controls */
.field {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

label {
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
  font-size: 15px;
}

.radio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 520px) {
  .radio-grid {
    grid-template-columns: 1fr;
  }
}

.radio-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px;
  border-radius: var(--draw-radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.radio-card:hover {
  transform: translateY(-1px);
  border-color: rgba(212, 160, 66, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.radio-card input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--draw-gold);
}

.input {
  width: 100%;
  padding: 14px 14px;
  border-radius: var(--draw-radius-md);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--draw-text);
  outline: none;
  font-size: 16px;
}

.input::placeholder {
  color: rgba(255, 255, 255, 0.50);
}

.input:focus {
  border-color: rgba(212, 160, 66, 0.45);
  box-shadow: 0 0 0 4px rgba(212, 160, 66, 0.16);
}

/* Buttons */
.btn-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: var(--draw-text);
  border-radius: 999px;
  padding: 14px 18px;
  font-weight: 800;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease, border-color 160ms ease, background 160ms ease;
  min-height: 48px;
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(212, 160, 66, 0.18);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(212, 160, 66, 0.18);
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(212, 160, 66, 0.32);
  background: rgba(255, 255, 255, 0.10);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, rgba(12, 54, 134, 0.90), rgba(36, 120, 255, 0.70));
  border-color: rgba(36, 120, 255, 0.35);
  box-shadow: var(--draw-glow);
  font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, Segoe UI, Arial, sans-serif;
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-gold {
  background: linear-gradient(135deg, rgba(212, 160, 66, 0.95), rgba(212, 160, 66, 0.55));
  border-color: rgba(212, 160, 66, 0.45);
  color: rgba(5, 11, 23, 0.92);
    font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, Segoe UI, Arial, sans-serif;

}

.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Controls grid for winner page */
.controls {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

@media (max-width: 720px) {
  .controls {
    grid-template-columns: 1fr;
  }
}

.control-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--draw-radius-lg);
  padding: 16px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.25);
  text-align: center;
}

.control-title {
  font-weight: 900;
  font-size: clamp(16px, 1.8vw, 20px);
  margin: 0 0 8px;
}

.control-meta {
  color: var(--draw-muted);
  font-weight: 600;
  margin: 0 0 12px;
}

/* Status / winner card */
.status {
  margin: 0 0 16px;
  color: var(--draw-muted);
  font-weight: 700;
  font-size: clamp(14px, 1.6vw, 18px);
}

.ticker {
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: var(--draw-radius-lg);
  border: 1px solid rgba(212, 160, 66, 0.28);
  background: rgba(255, 255, 255, 0.05);
  padding: 20px;
  margin-top: 12px;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.35);
}

.ticker.is-active {
  display: flex;
}

.ticker-name {
  font-size: clamp(22px, 4.6vw, 56px);
  font-weight: 900;
  letter-spacing: 0.2px;
  text-align: center;
  text-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

.winner {
  display: none;
  margin-top: 16px;
}

.winner.is-visible {
  display: block;
}

.winner-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 8px 14px;
  border: 1px solid rgba(212, 160, 66, 0.42);
  background: rgba(212, 160, 66, 0.12);
  color: rgba(255, 255, 255, 0.92);
  font-weight: 900;
}

.winner-name {
  margin: 14px 0 10px;
  font-size: clamp(28px, 5.2vw, 68px);
  font-weight: 900;
  line-height: 1.1;
}

.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  padding: 12px;
  border-radius: var(--draw-radius-md);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 520px) {
  .kv {
    grid-template-columns: 1fr;
  }
}

.kv .k {
  color: var(--draw-muted);
  font-weight: 800;
}

.kv .v {
  font-weight: 800;
}

/* Footer */
.footer {
  padding: 18px 0 26px;
  color: rgba(255, 255, 255, 0.60);
  font-size: 13px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  z-index: 100;
}

.modal-overlay.is-open {
  display: flex;
}

.modal {
  width: min(520px, 100%);
  border-radius: var(--draw-radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.08) 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 30px 110px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
  transform: translateY(10px) scale(0.98);
  opacity: 0;
  animation: modalIn 220ms ease forwards;
}

@keyframes modalIn {
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-inner {
  padding: 20px;
}

.modal-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 900;
}

.modal-body {
  margin: 0;
  color: var(--draw-muted);
  font-weight: 650;
  line-height: 1.7;
}

.modal-actions {
  padding: 16px 20px 20px;
  display: flex;
  justify-content: flex-end;
}

/* Animations */
.fade-up {
  opacity: 0;
  transform: translateY(10px);
  animation: fadeUp 420ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.fade-up.delay-1 {
  animation-delay: 80ms;
}

.fade-up.delay-2 {
  animation-delay: 160ms;
}

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Confetti */
.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 90;
}

.fireworks-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 95;
}

.confetti {
  position: absolute;
  top: -10px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  opacity: 0.95;
  animation: confettiFall var(--dur) linear forwards;
  transform: translate3d(var(--x), -20px, 0) rotate(var(--rot));
}

@keyframes confettiFall {
  0% {
    transform: translate3d(var(--x), -20px, 0) rotate(var(--rot));
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translate3d(calc(var(--x) + var(--drift)), 110vh, 0) rotate(calc(var(--rot) + 520deg));
    opacity: 0;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .bg-grid,
  .fade-up,
  .modal,
  .confetti {
    animation: none !important;
    transition: none !important;
  }
}
