:root {
  --bg0: #f6f8ff;
  --bg1: #f7e9ed;
  --panel: #ffffff;
  --line: rgba(0, 0, 0, 0.12);
  --line2: rgba(0, 0, 0, 0.08);
  --text: #0f172a;
  --muted: rgba(15, 23, 42, 0.65);
  --blue: #2f6fed;
  --blue2: #2563eb;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  --shadow2: 0 4px 14px rgba(0, 0, 0, 0.12);
  --focus: 0 0 0 3px rgba(47, 111, 237, 0.28);
  --sliceBlue: #3e72ea;
  --sliceGreen: #0d9e30;
  --sliceYellow: #EEB211;
  --sliceRed: #d91b2f;
}

@font-face {
  font-family: "QuicksandLocal";
  src: url("../images/6xK-dSZaM9iE8KbpRA_LJ3z8mH9BOJvgkP8o58a-wg.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "QuicksandLocal";
  src: url("../images/6xK-dSZaM9iE8KbpRA_LJ3z8mH9BOJvgkP8o58i-wi40.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: QuicksandLocal, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 620px at 0% 0%, rgba(51, 105, 232, 0.26), transparent 55%),
    radial-gradient(900px 680px at 100% 0%, rgba(213, 15, 37, 0.22), transparent 56%),
    radial-gradient(900px 700px at 45% 78%, rgba(255, 255, 255, 0.55), transparent 62%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.06), transparent 140px),
    linear-gradient(90deg, var(--bg0), var(--bg1));
}

code, kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
kbd {
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.14);
  padding: 1px 6px;
  border-radius: 8px;
}
.small { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.srOnly {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Top bar */
.appbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 14px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brandLink { text-decoration: none; color: inherit; }
.logoImg { width: 38px; height: 38px; border-radius: 999px; border: 1px solid rgba(0, 0, 0, 0.12); }
.brandTitle { font-size: 1em; line-height: normal; margin: 0; font-weight: 400; }
.brandText .title { font-weight: 900; letter-spacing: 0.2px; text-transform: lowercase; }
.brandText .subtitle { font-size: 12px; color: var(--muted); margin-top: -1px; }

.appbarNav { display: flex; gap: 10px; flex-wrap: nowrap; justify-content: flex-end; align-items: center; }
.toolBtn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 7px 8px;
  cursor: default;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.toolBtn:hover { background: rgba(0, 0, 0, 0.05); }
.toolBtn:focus-visible { outline: none; box-shadow: var(--focus); }
.toolBtn:disabled { opacity: 1; }
.toolIcon { width: 16px; height: 16px; fill: #0b0b0b; opacity: 0.92; }
.toolCaret { font-size: 12px; margin-left: -4px; opacity: 0.9; }

/* Layout */
.page {
  display: grid;
  grid-template-columns: 280px minmax(520px, 1fr) 380px;
  gap: 16px;
  padding: 14px 14px 18px;
  align-items: start;
}
@media (max-width: 1200px) {
  .page { grid-template-columns: 240px 1fr 360px; }
}
@media (max-width: 1020px) {
  .page { grid-template-columns: 1fr; }
  .leftRail { display: none; }
}

/* Left rail */
.leftRail { display: flex; flex-direction: column; gap: 10px; position: relative; }
.railNoteRow { padding: 6px 2px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.railAction {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  padding: 4px 6px;
  border-radius: 10px;
  cursor: default;
  color: rgba(15, 23, 42, 0.60);
  font-weight: 700;
}
.railActionIcon { width: 16px; height: 16px; opacity: 0.72; }

.fabEdit {
  position: absolute;
  top: 10px;
  left: 0px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: none;
  background: #2f6fed;
  color: #ffffff;
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.18);
  cursor: default;
}
.fabEdit:disabled { opacity: 1; }

.adCard {
  margin-top: 64px;
  background: linear-gradient(180deg, #1f2937, #0b1220);
  border: 1px solid rgba(0, 0, 0, 0.20);
  border-radius: 14px;
  box-shadow: var(--shadow2);
  padding: 18px 16px;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  min-height: 220px;
}
.adCard::before {
  content: "";
  position: absolute;
  inset: -40px;
  background: radial-gradient(260px 180px at 20% 20%, rgba(255, 255, 255, 0.10), transparent 70%);
  transform: rotate(-6deg);
}
.adTitle { position: relative; font-size: 34px; font-weight: 900; line-height: 1.05; letter-spacing: 0.2px; }
.adBody { position: relative; margin-top: 14px; color: rgba(255, 255, 255, 0.78); max-width: 240px; }
.adFooter { position: relative; margin-top: 14px; display: flex; justify-content: flex-end; }
.adBtn {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.92);
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 800;
  cursor: pointer;
}
.adBtn:hover { background: rgba(255, 255, 255, 0.14); }
.adBtn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255,255,255,0.18); }
.adCta {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 900;
}
.railCard {
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: 14px;
  box-shadow: var(--shadow2);
  padding: 12px;
}
.railCardTitle { font-weight: 800; margin-bottom: 6px; }
.railCardFooter { margin-top: 10px; display: flex; justify-content: flex-end; }
.miniBtn {
  border: 1px solid rgba(0, 0, 0, 0.10);
  background: rgba(47, 111, 237, 0.10);
  color: var(--blue2);
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
}
.miniBtn:hover { background: rgba(47, 111, 237, 0.14); }
.miniBtn:focus-visible { outline: none; box-shadow: var(--focus); }

/* Center stage */
.centerStage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.backdrop {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background:
    radial-gradient(900px 600px at 20% 15%, rgba(68, 117, 255, 0.20), transparent 60%),
    radial-gradient(900px 700px at 85% 20%, rgba(255, 108, 121, 0.20), transparent 62%),
    radial-gradient(700px 650px at 40% 75%, rgba(255, 255, 255, 0.55), transparent 60%);
  filter: blur(0px);
  pointer-events: none;
}
.wheelShell {
  position: relative;
  width: min(84vmin, 980px);
  aspect-ratio: 1 / 1;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  display: grid;
  place-items: center;
  margin-top: 6px;
}
@media (max-width: 1020px) {
  .wheelShell { width: min(92vw, 980px); }
}
.wheel {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: transparent;
  box-shadow:
    0 40px 70px rgba(0, 0, 0, 0.18),
    inset 0 0 0 10px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.16);
}
.centerCap {
  position: absolute;
  width: 17%;
  height: 17%;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.65) 40%, rgba(0, 0, 0, 0.06) 80%);
  border: 1px solid rgba(0, 0, 0, 0.10);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}
.pointerSvg {
  position: absolute;
  width: 54px;
  height: 36px;
  pointer-events: none;
  filter: drop-shadow(0 12px 14px rgba(0, 0, 0, 0.22));
  z-index: 5;
}
.pointerRight { right: -12px; top: 50%; transform: translateY(-50%); }
.pointerTop { top: -12px; left: 50%; transform: translateX(-50%) rotate(-90deg); }
.ptrFill { fill: var(--pointerColor, #2563eb); }
.ptrShade { fill: url(#ptrGrad); opacity: 0.55; }
.ptrStroke { fill: none; stroke: rgba(0, 0, 0, 0.18); stroke-width: 2; }

.wheelOverlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}
.wheelOverlayText {
  font-weight: 900;
  font-size: 58px;
  letter-spacing: 2px;
  text-transform: lowercase;
  fill: rgba(255, 255, 255, 0.95);
}
body[data-has-items="1"] .wheelOverlay { opacity: 0; }
body[data-has-items="1"] .wheelOverlayText { display: none; }

.spinOverlay {
  position: absolute;
  inset: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0;
  z-index: 6;
}
.spinOverlay:focus-visible { outline: none; box-shadow: var(--focus); }

/* (Removed) current-at-pointer card */

/* Right panel */
.rightPanel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 56px - 36px);
}
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
}
.tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 11px 10px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(15, 23, 42, 0.78);
}
.tabActive {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--blue2);
  background: #ffffff;
}
.tab:focus-visible { outline: none; box-shadow: var(--focus); }
.pill {
  display: inline-block;
  min-width: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  color: rgba(15, 23, 42, 0.78);
  background: rgba(47, 111, 237, 0.10);
  border: 1px solid rgba(47, 111, 237, 0.18);
}

.panelBody {
  padding: 12px;
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toolbarRow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 0; }

.btn {
  appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.10);
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
}
.btn:hover { background: rgba(0, 0, 0, 0.06); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btnBlue {
  background: rgba(47, 111, 237, 0.12);
  border-color: rgba(47, 111, 237, 0.22);
  color: #0b2a86;
}
.btnBlue:hover { background: rgba(47, 111, 237, 0.16); }
.btnBlueWide {
  background: rgba(47, 111, 237, 0.14);
  border-color: rgba(47, 111, 237, 0.24);
  color: #0b2a86;
  padding: 10px 12px;
  border-radius: 12px;
  min-width: 140px;
}
.btnGhost { background: rgba(0, 0, 0, 0.04); }

.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13px; color: rgba(15, 23, 42, 0.78); }
.check input { width: 16px; height: 16px; }

.namesInput {
  width: 100%;
  min-height: 320px;
  flex: 1;
  resize: vertical;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #ffffff;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.03);
  font-size: 13px;
  line-height: 1.3;
}
.namesInput:focus { box-shadow: var(--focus); border-color: rgba(47, 111, 237, 0.45); }

.advancedArea { margin-top: 10px; border-top: 1px solid rgba(0, 0, 0, 0.08); padding-top: 10px; }
.settingsGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.03);
}
.fieldLabel { color: var(--muted); font-size: 12.5px; font-weight: 700; }
.field input[type="number"], .field select {
  width: 120px;
  border-radius: 9px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #ffffff;
  color: var(--text);
  padding: 6px 8px;
}
.field input[type="checkbox"] { width: 16px; height: 16px; }

.bottomRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.winnerCard, .resultsCard {
  border: 1px solid rgba(0, 0, 0, 0.10);
  background: rgba(0, 0, 0, 0.02);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}
.winnerTitle, .resultsTitle { font-weight: 900; margin-bottom: 6px; }
.winnerText { font-size: 22px; font-weight: 1000; letter-spacing: 0.2px; min-height: 30px; }
.resultsList { margin: 8px 0 0; padding-left: 18px; }
.resultsList li { padding: 4px 0; font-weight: 700; color: rgba(15, 23, 42, 0.85); }

/* Error overlay from JS */
#appErrorOverlay { border-radius: 14px; }

/* Winner modal */
.modalBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1000;
}
.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1002;
}
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(620px, calc(100% - 24px));
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
  z-index: 1003;
  overflow: hidden;
}
.modalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f0b000;
  color: #111827;
  padding: 10px 12px;
}
.modalTitle { font-weight: 900; }
.modalX {
  border: none;
  background: rgba(255, 255, 255, 0.35);
  color: #111827;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 20px;
  line-height: 30px;
  font-weight: 900;
}
.modalX:hover { background: rgba(255, 255, 255, 0.45); }
.modalX:focus-visible { outline: none; box-shadow: var(--focus); }
.modalBody { padding: 26px 14px; display: grid; place-items: center; }
.modalName {
  font-size: clamp(26px, 4.8vw, 44px);
  font-weight: 400;
  color: #111827;
  letter-spacing: 0.2px;
}
.modalFooter {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.10);
  background: #ffffff;
}
