/* ============================================================
   Wheel of Randomish — retro game show / TV-studio
   ============================================================ */

:root {
  --bg-0: #0a0612;
  --plum: #1b0f33;
  --plum-2: #2a1650;
  --spot: #5a2f93;

  --gold: #ffd166;
  --gold-bright: #ffe6a3;
  --gold-deep: #c98a1c;
  --brass: #8a5a12;

  --cream: #fdf3e3;
  --cream-dim: #d8c6b4;
  --ink: #1a1024;

  --panel: rgba(34, 19, 60, 0.55);
  --panel-2: rgba(20, 11, 38, 0.6);
  --hairline: rgba(255, 209, 102, 0.22);
  --hairline-soft: rgba(255, 230, 163, 0.12);

  --shadow-deep: 0 30px 70px -24px rgba(0, 0, 0, 0.8);
  --radius: 22px;

  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: "Fredoka", system-ui, sans-serif;
  color: var(--cream);
  background:
    radial-gradient(120% 85% at 50% -12%, #7a2fa6 0%, transparent 50%),
    radial-gradient(70% 55% at 50% 46%, rgba(255, 186, 73, 0.12) 0%, transparent 62%),
    radial-gradient(115% 80% at 50% 122%, #4d1430 0%, transparent 60%),
    linear-gradient(180deg, var(--plum) 0%, var(--bg-0) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(18px, 3vw, 40px) clamp(16px, 4vw, 48px) 28px;
  overflow-x: hidden;
}

/* Filmkorn + vinjett ovanpå allt */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.05;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99;
  background: radial-gradient(120% 100% at 50% 35%, transparent 55%, rgba(5, 2, 12, 0.7) 100%);
}

/* ---------------- Masthead ---------------- */
.masthead {
  position: relative;
  text-align: center;
  margin-bottom: clamp(14px, 2.4vw, 30px);
  animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.75;
  font-weight: 500;
  padding-left: 0.42em;
}
.logo {
  font-family: "Shrikhand", serif;
  font-weight: 400;
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  line-height: 0.96;
  letter-spacing: 0.5px;
  background: linear-gradient(178deg, #fff6df 6%, var(--gold) 44%, var(--gold-deep) 96%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  position: relative;
  z-index: 2;
  filter:
    drop-shadow(0 4px 0 rgba(120, 70, 10, 0.45))
    drop-shadow(0 0 16px rgba(255, 200, 90, 0.55))
    drop-shadow(0 0 36px rgba(255, 170, 60, 0.4));
  animation: neonFlicker 7s linear infinite;
}
.logo-ish {
  display: inline-block;
  font-size: 0.6em;
  transform: rotate(-7deg);
  background: linear-gradient(178deg, #ffd2e6 0%, #ff6fae 60%, #c83f86 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tagline {
  margin: 12px auto 0;
  max-width: 30ch;
  color: var(--cream-dim);
  font-size: clamp(0.92rem, 1.6vw, 1.08rem);
  font-weight: 400;
}

/* ---------------- Layout ---------------- */
.app {
  width: 100%;
  max-width: 1080px;
  display: grid;
  grid-template-columns: 1fr 372px;
  gap: clamp(22px, 3.4vw, 54px);
  align-items: center;
}
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; gap: 28px; }
}

.stage-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  animation: rise 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.08s both;
}

/* Mallens rubrik – samma Las Vegas-stil som titeln */
.wheel-heading {
  margin: 0;
  text-align: center;
  font-family: "Shrikhand", serif;
  font-weight: 400;
  font-size: clamp(1.5rem, 4.4vw, 3rem);
  line-height: 1.04;
  letter-spacing: 0.5px;
  background: linear-gradient(178deg, #fff6df 6%, var(--gold) 44%, var(--gold-deep) 96%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter:
    drop-shadow(0 3px 0 rgba(120, 70, 10, 0.45))
    drop-shadow(0 0 14px rgba(255, 200, 90, 0.5))
    drop-shadow(0 0 30px rgba(255, 170, 60, 0.4));
  animation: neonFlicker 7s linear infinite;
}

/* ---------------- Scen + hjul ---------------- */
.stage {
  position: relative;
  width: min(62vmin, 540px);
  aspect-ratio: 1;
}
.spotlight {
  position: absolute;
  inset: -16%;
  z-index: 0;
  background: radial-gradient(circle at 50% 42%, rgba(255, 220, 150, 0.22) 0%, transparent 58%);
  filter: blur(6px);
  pointer-events: none;
}
.wheel {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  filter: drop-shadow(0 26px 46px rgba(0, 0, 0, 0.6));
}

/* Marquee-lampor */
.bulbs { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.bulb {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fffbe9 0%, var(--c, #ffd166) 52%, #7a5410 100%);
  box-shadow: 0 0 10px 2px var(--glow, rgba(255, 205, 100, 0.6)), inset 0 0 2px rgba(120, 70, 0, 0.6);
  transform: translate(-50%, -50%) rotate(var(--a)) translateY(calc(-1 * var(--r)));
  animation: marquee 1.4s linear infinite;
  animation-delay: var(--d);
}
/* Löpljus runt ramen (två ljus löper alltid runt) */
@keyframes marquee {
  0%, 22%, 50%, 72%, 100% {
    opacity: 0.32;
    box-shadow: 0 0 5px 1px var(--glow, rgba(255, 205, 100, 0.4)), inset 0 0 2px rgba(120, 70, 0, 0.6);
  }
  10%, 60% {
    opacity: 1;
    box-shadow: 0 0 17px 5px var(--glow, rgba(255, 225, 140, 0.95)), inset 0 0 2px rgba(120, 70, 0, 0.6);
  }
}
.stage.spinning .bulb { animation-duration: 0.7s; }

/* Pekare högst upp */
.pointer {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  filter: drop-shadow(0 6px 7px rgba(0, 0, 0, 0.55));
}
.pointer-knob {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 32%, #fff2cf, var(--gold) 55%, var(--gold-deep) 100%);
  border: 2px solid rgba(120, 72, 12, 0.55);
  margin-bottom: -7px;
  z-index: 2;
}
.pointer-knob::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 9px;
  transform: translate(-50%, -55%) rotate(45deg);
  border-radius: 1px;
  background: linear-gradient(135deg, #ffffff, #ff5d73 55%, #aa1c38);
  box-shadow: 0 0 7px rgba(255, 90, 110, 0.9);
}
.pointer-tip {
  width: 28px;
  height: 34px;
  background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 42%, var(--gold-deep) 100%);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  border-radius: 3px;
}

/* Nav / snurr-knapp i mitten */
.hub {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 23%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 5;
  background: radial-gradient(circle at 38% 30%, #fff3d0 0%, var(--gold) 46%, var(--gold-deep) 100%);
  box-shadow:
    0 0 0 5px rgba(20, 11, 38, 0.92),
    0 0 0 7px rgba(255, 209, 102, 0.5),
    0 14px 26px -8px rgba(0, 0, 0, 0.7),
    inset 0 2px 3px rgba(255, 255, 255, 0.7),
    inset 0 -6px 10px rgba(120, 70, 10, 0.4);
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}
.hub-inner {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}
.hub-word {
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: clamp(0.6rem, 1.7vmin, 0.92rem);
  letter-spacing: 0.06em;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}
.hub:hover { transform: translate(-50%, -50%) scale(1.05); }
.hub:active { transform: translate(-50%, -50%) scale(0.96); }
.hub:disabled { cursor: not-allowed; filter: grayscale(0.35) brightness(0.85); }

.stage-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% + 64px));
  margin: 0;
  font-weight: 500;
  color: var(--cream-dim);
  background: rgba(10, 6, 18, 0.7);
  padding: 7px 14px;
  border-radius: 999px;
  white-space: nowrap;
  z-index: 4;
}

/* ---------------- Stora snurr-knappen ---------------- */
.spin-btn {
  position: relative;
  border: none;
  cursor: pointer;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 1.12rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  padding: 16px 42px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 48%, var(--gold-deep) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 240, 200, 0.6) inset,
    0 12px 0 -2px var(--brass),
    0 22px 32px -12px rgba(0, 0, 0, 0.75),
    0 0 34px rgba(255, 200, 90, 0.35);
  transition: transform 0.1s ease, box-shadow 0.2s ease, filter 0.2s ease;
  animation: glow 2.6s ease-in-out infinite;
}
.spin-btn .spin-btn-label { position: relative; z-index: 1; }
.spin-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.spin-btn:active {
  transform: translateY(8px);
  box-shadow:
    0 0 0 1px rgba(255, 240, 200, 0.6) inset,
    0 4px 0 -2px var(--brass),
    0 10px 18px -10px rgba(0, 0, 0, 0.7);
}
.spin-btn:disabled {
  cursor: not-allowed;
  filter: grayscale(0.4) brightness(0.7);
  animation: none;
}
.spin-btn.small { font-size: 0.95rem; padding: 12px 26px; box-shadow: 0 0 0 1px rgba(255,240,200,.6) inset, 0 8px 0 -2px var(--brass), 0 14px 22px -12px rgba(0,0,0,.7); animation: none; }
.spin-btn.small:active { transform: translateY(6px); }
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,240,200,.6) inset, 0 12px 0 -2px var(--brass), 0 22px 32px -12px rgba(0,0,0,.75), 0 0 26px rgba(255,200,90,.28); }
  50%      { box-shadow: 0 0 0 1px rgba(255,240,200,.6) inset, 0 12px 0 -2px var(--brass), 0 22px 32px -12px rgba(0,0,0,.75), 0 0 46px rgba(255,210,110,.55); }
}

/* ---------------- Senaste dragningar ---------------- */
.recent { width: 100%; max-width: min(62vmin, 540px); }
.recent-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cream-dim);
  margin-bottom: 10px;
}
.recent-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 9px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--hairline-soft);
  font-size: 0.86rem;
  font-weight: 500;
  animation: pop 0.3s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.recent-chip .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.link-btn {
  background: none;
  border: none;
  color: var(--gold);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.8;
}
.link-btn:hover { opacity: 1; text-decoration: underline; }

/* ---------------- Kontrollpanel ---------------- */
.panel {
  background: var(--panel);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 22px 22px 24px;
  box-shadow: var(--shadow-deep), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: rise 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.16s both;
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.panel-head h2 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.counter {
  font-size: 0.8rem;
  color: var(--gold);
  background: rgba(255, 209, 102, 0.1);
  border: 1px solid var(--hairline);
  padding: 3px 10px;
  border-radius: 999px;
}

.add-row { display: flex; gap: 9px; margin-bottom: 12px; }
.add-input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 1rem;
  color: var(--cream);
  background: rgba(10, 6, 18, 0.55);
  border: 1px solid var(--hairline-soft);
  border-radius: 13px;
  padding: 12px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.add-input::placeholder { color: rgba(216, 198, 180, 0.5); }
.add-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.18);
}
.add-btn {
  flex: none;
  width: 46px;
  border: none;
  border-radius: 13px;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold) 60%, var(--gold-deep));
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.6);
  transition: transform 0.1s ease, filter 0.2s ease;
}
.add-btn:hover { filter: brightness(1.06); }
.add-btn:active { transform: scale(0.93); }

.weight-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--cream-dim);
  margin-bottom: 14px;
  line-height: 1.3;
}
.weight-hint-dot {
  flex: none;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(255, 209, 102, 0.8);
}

.item-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 2px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 209, 102, 0.4) transparent;
}
.item-list::-webkit-scrollbar { width: 8px; }
.item-list::-webkit-scrollbar-thumb { background: rgba(255, 209, 102, 0.35); border-radius: 8px; }

.item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 9px 8px 12px;
  border-radius: 14px;
  background: rgba(10, 6, 18, 0.5);
  border: 1px solid var(--hairline-soft);
  animation: pop 0.28s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.item-dot {
  flex: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.25);
}
.item-label {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--cream);
  background: none;
  border: none;
  padding: 2px 0;
}
.item-label:focus { outline: none; }
.item-label:focus-visible {
  outline: none;
  box-shadow: 0 2px 0 var(--gold);
}

.stepper {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(0, 0, 0, 0.32);
  border-radius: 999px;
  padding: 3px;
}
.step {
  width: 26px; height: 26px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--gold);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s ease, transform 0.1s ease;
}
.step:hover { background: rgba(255, 209, 102, 0.16); }
.step:active { transform: scale(0.88); }
.weight-val {
  min-width: 26px;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--cream);
  font-variant-numeric: tabular-nums;
}
.remove {
  flex: none;
  width: 28px; height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--cream-dim);
  font-size: 1.05rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.remove:hover { background: rgba(255, 90, 110, 0.2); color: #ff8ea0; }
.remove:active { transform: scale(0.88); }

.empty-note {
  text-align: center;
  color: var(--cream-dim);
  font-size: 0.92rem;
  padding: 18px 8px;
  border: 1px dashed var(--hairline-soft);
  border-radius: 14px;
}

/* Presets */
.presets { margin-bottom: 18px; }
.presets-label {
  display: block;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cream-dim);
  margin-bottom: 9px;
}
.preset-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.preset {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.1s ease, color 0.18s ease;
}
.preset:hover { background: rgba(255, 209, 102, 0.14); color: #fff; }
.preset:active { transform: scale(0.95); }

/* Mallar (snurrmallar) */
.templates { margin-bottom: 18px; }
.templates-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}
.templates-head .presets-label { margin-bottom: 0; }

.tpl-chip {
  display: inline-flex;
  align-items: stretch;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 0.18s ease;
}
.tpl-chip:hover { border-color: rgba(255, 209, 102, 0.5); }
.tpl-load {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--cream);
  background: none;
  border: none;
  padding: 8px 15px;
  cursor: pointer;
  transition: color 0.18s ease;
}
.tpl-load:hover { color: #fff; }
.tpl-del {
  border: none;
  border-left: 1px solid var(--hairline-soft);
  background: rgba(255, 90, 110, 0.12);
  color: #ff8ea0;
  width: 30px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}
.tpl-del:hover { background: rgba(255, 90, 110, 0.3); }
.tpl-empty { font-size: 0.88rem; color: var(--cream-dim); }

.ghost-btn.full { margin-left: 0; width: 100%; margin-top: 11px; }
.link-btn.is-admin { color: #7be0a6; }

/* Modaler (admin + spara mall) */
.modal {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 3, 14, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fade 0.25s ease both;
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(92vw, 384px);
  padding: 28px 28px 24px;
  border-radius: 22px;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(90, 47, 147, 0.5), transparent 70%),
    var(--panel-2);
  border: 1.5px solid var(--gold);
  box-shadow: 0 0 0 6px rgba(255, 209, 102, 0.1), var(--shadow-deep);
  animation: bounceIn 0.4s cubic-bezier(0.2, 1.3, 0.35, 1) both;
}
.modal-card h3 { margin: 0 0 6px; font-size: 1.32rem; font-weight: 600; }
.modal-sub { margin: 0 0 18px; color: var(--cream-dim); font-size: 0.92rem; line-height: 1.35; }
.modal input {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  color: var(--cream);
  background: rgba(10, 6, 18, 0.55);
  border: 1px solid var(--hairline-soft);
  border-radius: 13px;
  padding: 12px 14px;
}
.modal input::placeholder { color: rgba(216, 198, 180, 0.5); }
.modal input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.18); }
.modal-error { color: #ff8ea0; font-size: 0.86rem; margin: 10px 0 0; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .spin-btn.small { flex: 1; }
.modal-actions .ghost-btn { margin-left: 0; }

/* Inställningar */
.settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline-soft);
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 500;
  user-select: none;
}
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--hairline-soft);
  position: relative;
  transition: background 0.2s ease;
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cream-dim);
  transition: transform 0.2s cubic-bezier(0.3, 1.4, 0.5, 1), background 0.2s ease;
}
.toggle input:checked + .toggle-track {
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
}
.toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
  background: var(--ink);
}
.toggle input:focus-visible + .toggle-track {
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.3);
}

.ghost-btn {
  margin-left: auto;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--cream-dim);
  background: none;
  border: 1px solid var(--hairline-soft);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.ghost-btn:hover { color: #ff8ea0; border-color: rgba(255, 90, 110, 0.4); background: rgba(255, 90, 110, 0.08); }

/* ---------------- Vinnar-overlay ---------------- */
.result {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(6, 3, 14, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fade 0.3s ease both;
}
.result[hidden] { display: none; }
.result-card {
  position: relative;
  text-align: center;
  padding: clamp(28px, 5vw, 48px) clamp(30px, 6vw, 64px);
  border-radius: 26px;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(90, 47, 147, 0.6), transparent 70%),
    var(--panel-2);
  border: 1.5px solid var(--gold);
  box-shadow: 0 0 0 6px rgba(255, 209, 102, 0.12), var(--shadow-deep), 0 0 60px rgba(255, 200, 90, 0.25);
  animation: bounceIn 0.5s cubic-bezier(0.2, 1.3, 0.35, 1) both;
  max-width: min(90vw, 560px);
}
.result-kicker {
  margin: 0 0 8px;
  font-size: 0.86rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold);
}
.result-name {
  margin: 0 0 26px;
  font-family: "Shrikhand", serif;
  font-weight: 400;
  font-size: clamp(2rem, 6.5vw, 3.6rem);
  line-height: 1.05;
  word-break: break-word;
  background: linear-gradient(178deg, #fff6df, var(--gold) 55%, var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(120, 70, 10, 0.4));
  animation: nameGlow 1.7s ease-in-out infinite;
}
.result-names { margin-bottom: 22px; }
.result-name-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.result-name-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: "Shrikhand", serif;
  font-size: clamp(1.3rem, 4.2vw, 2.2rem);
  line-height: 1.1;
  color: var(--gold-bright);
  text-shadow: 0 2px 0 rgba(120, 70, 10, 0.4), 0 0 16px rgba(255, 200, 90, 0.5);
  animation: pop 0.35s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.result-name-item .rn-num {
  font-family: "Fredoka", sans-serif;
  font-size: 0.75em;
  font-weight: 700;
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep));
  width: 1.7em;
  height: 1.7em;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  text-shadow: none;
}
.result-message {
  margin: 0 0 24px;
  color: var(--cream);
  font-size: 1.06rem;
  line-height: 1.45;
  white-space: pre-line;
  max-width: 38ch;
  margin-left: auto;
  margin-right: auto;
}
.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Dragnings-banner (flera vinnare) */
.draw-status {
  width: 100%;
  max-width: min(62vmin, 540px);
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 13px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  animation: pop 0.3s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}
.draw-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.draw-badge {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep));
  padding: 5px 13px;
  border-radius: 999px;
}
.draw-spin-again { color: var(--gold); font-size: 0.9rem; font-weight: 500; }
.draw-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.draw-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--hairline-soft);
  font-size: 0.85rem;
  font-weight: 500;
}
.draw-chip .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* Antal vinnare-kontroll */
.draw-count {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.draw-count-label { font-size: 0.94rem; font-weight: 500; }

/* Admin: vinnar-text */
.winner-text-block { margin-bottom: 18px; }
.winner-text-input {
  width: 100%;
  min-height: 60px;
  resize: vertical;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--cream);
  background: rgba(10, 6, 18, 0.5);
  border: 1px solid var(--hairline-soft);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 8px;
}
.winner-text-input::placeholder { color: rgba(216, 198, 180, 0.5); }
.winner-text-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.18);
}

.heading-input {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--cream);
  background: rgba(10, 6, 18, 0.5);
  border: 1px solid var(--hairline-soft);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 8px;
}
.heading-input::placeholder { color: rgba(216, 198, 180, 0.5); }
.heading-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.18);
}
.heading-input:disabled { opacity: 0.5; cursor: not-allowed; }
.heading-hint { font-size: 0.82rem; color: var(--cream-dim); margin: 8px 0 0; }

#tplHeading { margin-top: 10px; }
#winnerText { margin-top: 8px; }

.update-btn {
  width: 100%;
  margin-top: 11px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold) 60%, var(--gold-deep));
  border: none;
  border-radius: 999px;
  padding: 11px 16px;
  cursor: pointer;
  transition: filter 0.18s ease, transform 0.1s ease;
}
.update-btn:hover { filter: brightness(1.06); }
.update-btn:active { transform: scale(0.97); }
.update-btn:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.3); }

.data-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ---------------- Helskärm / presentationsläge ---------------- */
.fs-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  font-family: "Fredoka", sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--cream);
  background: rgba(20, 11, 38, 0.6);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.1s ease;
}
.fs-toggle:hover { background: rgba(255, 209, 102, 0.16); border-color: var(--gold); color: #fff; }
.fs-toggle:active { transform: scale(0.95); }

/* Fokusläge – fäller bort inställningspanelen mjukt och låter hjulet växa */
.app { transition: grid-template-columns 0.45s cubic-bezier(0.4, 0, 0.2, 1), gap 0.45s ease; }
.stage { transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1); }
.wheel-heading { transition: font-size 0.45s ease; }
.panel {
  min-width: 0;
  overflow: hidden;
  max-height: 1600px;
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), margin 0.45s ease, padding 0.45s ease;
}

body.present .app { grid-template-columns: 1fr 0px; gap: 0; }
body.present .stage { width: min(82vmin, 72vh, 760px); }
body.present .wheel-heading { font-size: clamp(1.8rem, 5.5vmin, 4rem); }
body.present .panel {
  opacity: 0;
  transform: scale(0.96);
  max-height: 0;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

@media (max-width: 880px) {
  body.present .stage { width: min(88vmin, 62vh, 560px); }
}

/* ---------------- Konfetti ---------------- */
.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 90;
}

/* ---------------- Footer ---------------- */
.footer {
  margin-top: 30px;
  font-size: 0.78rem;
  color: rgba(216, 198, 180, 0.45);
  letter-spacing: 0.04em;
}

/* ---------------- Vegas-effekter ---------------- */
/* Roterande ljusstrålar bakom hjulet */
.rays {
  position: absolute;
  inset: -24%;
  z-index: 0;
  border-radius: 50%;
  pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255, 212, 120, 0.14) 0deg 5deg, transparent 5deg 22deg);
  filter: blur(7px);
  opacity: 0.8;
  -webkit-mask: radial-gradient(circle, #000 24%, rgba(0, 0, 0, 0.45) 44%, transparent 68%);
  mask: radial-gradient(circle, #000 24%, rgba(0, 0, 0, 0.45) 44%, transparent 68%);
  animation: spinRays 26s linear infinite;
}
@keyframes spinRays { to { transform: rotate(360deg); } }

/* Glansigt svep över hjulet */
.wheel-gloss {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
  mix-blend-mode: screen;
  background: radial-gradient(120% 85% at 33% 20%, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.05) 24%, transparent 46%);
}
.wheel-gloss::after {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  width: 38%;
  left: -55%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  transform: skewX(-18deg);
  mix-blend-mode: screen;
  animation: shineSweep 5.5s ease-in-out infinite;
}
@keyframes shineSweep {
  0%, 8% { left: -55%; }
  42%, 100% { left: 135%; }
}

/* Roterande metallglans på guldramen */
.rim-sheen {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 50%;
  pointer-events: none;
  mix-blend-mode: screen;
  background: conic-gradient(from 0deg,
    transparent 0deg,
    rgba(255, 255, 255, 0.5) 38deg,
    transparent 78deg,
    transparent 198deg,
    rgba(255, 250, 220, 0.33) 236deg,
    transparent 286deg);
  -webkit-mask: radial-gradient(circle, transparent 0 88%, #000 90% 99%, transparent 100%);
  mask: radial-gradient(circle, transparent 0 88%, #000 90% 99%, transparent 100%);
  animation: spinSheen 7s linear infinite;
}
@keyframes spinSheen { to { transform: rotate(360deg); } }

/* Gnistror */
.stage-sparkles { position: absolute; inset: 0; pointer-events: none; z-index: 7; }
.sparkle {
  position: absolute;
  color: #fff;
  line-height: 1;
  opacity: 0;
  transform: scale(0.3) rotate(0deg);
  text-shadow: 0 0 8px rgba(255, 225, 150, 0.9), 0 0 16px rgba(255, 200, 90, 0.6);
  animation: sparkle 3.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(0.3) rotate(0deg); }
  50%      { opacity: 1; transform: scale(1) rotate(90deg); }
}
.stage-sparkles .s1 { top: 5%; left: 1%; font-size: 20px; animation-delay: 0s; }
.stage-sparkles .s2 { top: 12%; right: 3%; font-size: 15px; color: #ffe7a3; animation-delay: 1.1s; }
.stage-sparkles .s3 { bottom: 9%; left: 7%; font-size: 17px; color: #ffd166; animation-delay: 2s; }
.stage-sparkles .s4 { bottom: 14%; right: 5%; font-size: 22px; animation-delay: 0.6s; }
.title-spark { z-index: 1; }
.masthead .ts1 { left: 7%; top: 10px; font-size: 22px; animation-delay: 0.3s; }
.masthead .ts2 { right: 7%; top: 20px; font-size: 18px; color: #ffd166; animation-delay: 1.4s; }

/* Pulserande nav-glöd */
.hub::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  box-shadow: 0 0 24px 7px rgba(255, 205, 100, 0.55);
  opacity: 0.55;
  z-index: -1;
  pointer-events: none;
  animation: hubGlow 2.1s ease-in-out infinite;
}
@keyframes hubGlow {
  0%, 100% { opacity: 0.4; transform: scale(0.97); }
  50%      { opacity: 0.95; transform: scale(1.06); }
}

/* Neonflimmer på titeln */
@keyframes neonFlicker {
  0%, 18%, 22%, 40%, 42%, 100% {
    filter:
      drop-shadow(0 4px 0 rgba(120, 70, 10, 0.45))
      drop-shadow(0 0 16px rgba(255, 200, 90, 0.6))
      drop-shadow(0 0 36px rgba(255, 170, 60, 0.45));
  }
  20%, 41% {
    filter:
      drop-shadow(0 4px 0 rgba(120, 70, 10, 0.45))
      drop-shadow(0 0 7px rgba(255, 200, 90, 0.3))
      drop-shadow(0 0 16px rgba(255, 170, 60, 0.2));
  }
}

/* Jackpot-glöd på vinnarnamnet */
@keyframes nameGlow {
  0%, 100% { filter: drop-shadow(0 3px 0 rgba(120, 70, 10, 0.4)) drop-shadow(0 0 12px rgba(255, 200, 90, 0.4)); }
  50%      { filter: drop-shadow(0 3px 0 rgba(120, 70, 10, 0.4)) drop-shadow(0 0 26px rgba(255, 215, 120, 0.75)); }
}

/* ---------------- Animationer ---------------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pop {
  from { opacity: 0; transform: scale(0.82); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bounceIn {
  0%   { opacity: 0; transform: scale(0.7) translateY(20px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
