:root {
  --bg: #000000;
  --bg-subtle: #1c1c1e;
  --bg-muted: #2c2c2e;
  --bg-card: rgba(28, 28, 30, 0.75);
  --border: rgba(255, 255, 255, 0.10);
  --border-soft: rgba(255, 255, 255, 0.06);
  --text-1: #f2f2f7;
  --text-2: rgba(235, 235, 245, 0.75);
  --text-3: rgba(235, 235, 245, 0.50);
  --text-4: rgba(235, 235, 245, 0.25);
  --brand: #a78bfa;
  --brand-hover: #c4b5fd;
  --brand-soft: rgba(167, 139, 250, 0.15);
  --glass-bg: rgba(28, 28, 30, 0.72);
  --glass-border: rgba(255, 255, 255, 0.10);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 40px rgba(167, 139, 250, 0.20);
  --ring: rgba(167, 139, 250, 0.38);
}

/* ─── Base ─── */
html {
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--text-1);
  transition: background-color 0.2s ease, color 0.2s ease;
  line-height: 1.7;
  margin: 0;
  min-height: 100vh;
}

/* gradient mesh background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 55% at 15% 0%, rgba(167, 139, 250, 0.30) 0%, transparent 55%),
    radial-gradient(ellipse 55% 45% at 85% 90%, rgba(99, 102, 241, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse 45% 35% at 55% 45%, rgba(124, 58, 237, 0.10) 0%, transparent 60%);
}

body>* {
  position: relative;
  z-index: 1;
}

/* ─── Layout ─── */
.layout-wrapper {
  min-height: 100vh;
  display: flex;
  flex-col: column;
}

header {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-link {
  position: relative;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  transition: color 0.15s;
  padding-bottom: 2px;
  text-decoration: none;
}

.nav-link:hover {
  color: var(--text-1);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--brand);
  transition: width 0.25s ease;
  border-radius: 2px;
}

.nav-link:hover::after {
  width: 100%;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.nav-dropdown-btn::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 16px;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(28, 28, 30, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.4rem;
  min-width: 140px;
  box-shadow: var(--shadow-card);
}

.nav-dropdown:hover .nav-dropdown-menu {
  display: flex;
  flex-direction: column;
}

.nav-dropdown-menu a {
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-dropdown-menu a:hover {
  background: var(--brand-soft);
  color: var(--brand);
}

@media (max-width: 768px) {
  .nav-dropdown-menu {
    display: none !important;
  }
}

/* ─── Components ─── */
.glass-panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--shadow-card);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background-color: var(--brand);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 9999px;
  transition: all 0.2s;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.35);
}

.btn-primary:hover {
  background-color: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(124, 58, 237, 0.50);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background-color: transparent;
  color: var(--text-1);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 9999px;
  border: 1px solid var(--border);
  transition: all 0.2s;
  text-decoration: none;
  cursor: pointer;
}

.btn-secondary:hover {
  border-color: var(--brand);
  background-color: var(--brand-soft);
  color: var(--brand);
}

/* ─── Wheel Specific Overrides ─── */
.wheel-item-input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-1);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  outline: none;
  transition: all 0.2s;
}

.wheel-item-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

#itemsContainer input {
  width: 100%;
  border: 1px solid var(--border) !important;
  background: var(--bg-subtle) !important;
  color: var(--text-1) !important;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  outline: none;
}

#itemsContainer input:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 4px var(--brand-soft) !important;
}

select {
  background: var(--bg-subtle) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-1) !important;
}

textarea {
  background: var(--bg-subtle) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-1) !important;
}

:where(.ui-wheel-of-fortune) {
  --_items: 12;
  all: unset;
  aspect-ratio: 1 / 1;
  container-type: inline-size;
  direction: ltr;
  display: grid;
  position: relative;
  width: 100%;
  user-select: none;
  touch-action: none;
  cursor: grab;
}

:where(.ui-wheel-of-fortune).is-dragging {
  cursor: grabbing;
}

:where(.ui-wheel-of-fortune)>* {
  position: absolute;
}

:where(.ui-wheel-of-fortune)::after {
  aspect-ratio: 1 / cos(30deg);
  background-color: var(--brand);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  content: "";
  height: clamp(14px, 2.7vmin, 26px);
  height: 4cqi;
  position: absolute;
  place-self: center start;
  scale: 1.4;
  z-index: 5;
  transform: translateY(0%);
  margin-left: -0.8em;
}

:where(.ui-wheel-of-fortune)>button {
  aspect-ratio: 1 / 1;
  background: var(--bg-subtle);
  border: 0;
  border-radius: 50%;
  color: var(--text-1);
  cursor: pointer;
  font-size: 2.8cqi;
  font-weight: 500;
  place-self: center;
  width: 8cqi;
  line-height: 1;
  letter-spacing: 0.01em;
  z-index: 6;
  box-shadow: 0 0 0 1px var(--border) inset, var(--shadow-card);
  backdrop-filter: blur(4px);
}

:where(.ui-wheel-of-fortune)>button:disabled {
  opacity: 0.8;
  cursor: not-allowed;
}

#fortuneWheel>#spinBtn {
  display: grid;
  place-items: center;
  background-color: rgba(28, 28, 30, 0.85);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  border-radius: 9999px;
  box-shadow: 0 0 0 1px var(--border) inset, 0 0 20px var(--brand-soft);
}

:where(.ui-wheel-of-fortune)>ul {
  all: unset;
  clip-path: inset(0 0 0 0 round 50%);
  display: grid;
  inset: 0;
  place-content: center start;
  border: 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--border), var(--shadow-card);
}

:where(.ui-wheel-of-fortune)>ul>li {
  align-content: center;
  aspect-ratio: 1 / calc(2 * tan(180deg / var(--_items)));
  background: linear-gradient(120deg,
      hsl(calc(360deg / var(--_items) * var(--_idx) - 18deg), 78%, 82%) 0%,
      hsl(calc(360deg / var(--_items) * var(--_idx)), 73%, 72%) 52%,
      hsl(calc(360deg / var(--_items) * var(--_idx) + 22deg), 67%, 60%) 100%);
  clip-path: polygon(0% 0%, 100% 50%, 0% 100%);
  display: grid;
  font-size: 2.8cqi;
  font-weight: 501;
  grid-area: 1 / -1;
  padding-left: 3ch;
  rotate: calc(360deg / var(--_items) * (var(--_idx) - 1));
  transform-origin: center right;
  width: 50cqi;
  color: #101820;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.22);
}

/* ─── Utilities ─── */
.font-display {
  font-family: 'Lora', Georgia, serif;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}