:root {
  --deep: #0F2A22;
  --deep-2: #173C31;
  --deep-3: #1F4A3C;
  --gold: #E8B34A;
  --gold-bright: #F4CD6E;
  --coral: #E2593F;
  --cream: #F3E9D2;
  --muted: #9FB6AC;
  --line: rgba(243, 233, 210, 0.16);
  --shadow: rgba(5, 15, 11, 0.45);

  /* keep Bootstrap components on the same palette */
  --bs-body-bg: var(--deep);
  --bs-body-color: var(--cream);
  --bs-border-color: var(--line);
}

body {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(232, 179, 74, 0.10), transparent 60%),
    var(--deep);
  color: var(--cream);
  font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  min-height: 100vh;
}

::selection { background: var(--gold); color: var(--deep); }

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
  border-radius: 6px;
}

.page-wrap {
  max-width: 920px;
  padding-top: 48px;
  padding-bottom: 72px;
}

/* ---------- header ---------- */
.eyebrow {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold);
}

h1 {
  font-family: 'Lalezar', 'Tajawal', sans-serif;
  font-weight: 400;
  font-size: clamp(2.6rem, 6vw, 4rem);
  margin: 6px 0 10px;
  color: var(--cream);
  text-wrap: balance;
  letter-spacing: 0.01em;
}

.subtitle {
  color: var(--muted);
  font-size: 16px;
  max-width: 46ch;
  line-height: 1.7;
}

/* ---------- stage (the drum) ---------- */
.stage {
  position: relative;
  background: linear-gradient(180deg, var(--deep-3), var(--deep-2));
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 40px 24px;
  box-shadow: 0 24px 60px -20px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  overflow: hidden;
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, rgba(232, 179, 74, 0.05) 0 2px, transparent 2px 34px);
  opacity: 0.5;
  pointer-events: none;
}

.window {
  position: relative;
  width: 100%;
  max-width: 560px;
  min-height: 150px;
  background: var(--deep);
  border: 2px solid var(--gold);
  border-radius: 18px;
  box-shadow: 0 0 0 6px rgba(232, 179, 74, 0.08), inset 0 2px 18px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 28px;
  text-align: center;
}

.window .status {
  position: absolute;
  top: 12px;
  right: 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.window .result {
  font-family: 'Lalezar', sans-serif;
  font-weight: 400;
  font-size: clamp(1.7rem, 5vw, 2.6rem);
  color: var(--gold-bright);
  text-wrap: balance;
  line-height: 1.3;
  word-break: break-word;
}

.window.is-winner {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 6px rgba(244, 205, 110, 0.16), 0 0 40px rgba(244, 205, 110, 0.25), inset 0 2px 18px rgba(0, 0, 0, 0.5);
}
.window.is-winner .result { color: var(--cream); }

.window.is-empty .result {
  font-family: 'Tajawal', sans-serif;
  font-size: 16px;
  color: var(--muted);
  font-weight: 500;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  background: rgba(243, 233, 210, 0.06);
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.count-pill b { color: var(--gold-bright); font-weight: 700; }

/* ---------- buttons ---------- */
.btn-draw {
  font-family: 'Lalezar', sans-serif;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--deep);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  padding: 12px 46px;
  border: none;
  border-radius: 999px;
  box-shadow: 0 10px 24px -8px rgba(232, 179, 74, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn-draw:hover:not(:disabled) {
  color: var(--deep);
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -8px rgba(232, 179, 74, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn-draw:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.btn-draw:disabled { opacity: 0.4; cursor: not-allowed; filter: grayscale(0.3); }

.btn-ghost {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  padding: 8px 18px;
  border-radius: 999px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.btn-ghost:hover { color: var(--cream); border-color: var(--gold); }

canvas.confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- panels ---------- */
.panel {
  background: var(--deep-2);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel h2 {
  font-family: 'Tajawal', sans-serif;
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--cream);
}

.panel h2 .hint {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.panel textarea.form-control {
  background: var(--deep);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--cream);
  font-family: 'Tajawal', sans-serif;
  font-size: 15px;
  line-height: 1.8;
  padding: 14px 16px;
  resize: vertical;
}
.panel textarea.form-control::placeholder { color: var(--muted); opacity: 0.7; }
.panel textarea.form-control:focus {
  background: var(--deep);
  color: var(--cream);
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(232, 179, 74, 0.18);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 140px;
  overflow-y: auto;
  padding-inline-end: 4px;
  margin-top: 12px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(232, 179, 74, 0.10);
  border: 1px solid rgba(232, 179, 74, 0.28);
  color: var(--cream);
  font-size: 13px;
  padding: 6px 8px 6px 12px;
  border-radius: 999px;
}
.chip .chip-remove {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 50%;
  cursor: pointer;
}
.chip .chip-remove:hover { color: var(--coral); background: rgba(226, 89, 63, 0.15); }
.chip.is-out { opacity: 0.45; text-decoration: line-through; }

.form-check {
  margin-top: 4px;
}
.form-check-input {
  background-color: var(--deep);
  border-color: var(--line);
}
.form-check-input:checked {
  background-color: var(--gold);
  border-color: var(--gold);
}
.form-check-label {
  color: var(--muted);
  font-size: 14px;
}

.history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}
.history-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 18px 0;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--deep);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
}
.history-item span:last-child { flex: 1; word-break: break-word; }
.badge-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--deep);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

footer {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.8;
}

.alert {
  border-radius: 14px;
  border: 1px solid rgba(232, 179, 74, 0.35);
  background: rgba(232, 179, 74, 0.12);
  color: var(--cream);
}

@media (prefers-reduced-motion: reduce) {
  .btn-draw { transition: none; }
}
