.wheel-spinner-app {
  --wheel-bg: #071c14;
  --wheel-panel: #0d291e;
  --wheel-panel-2: #123426;
  --wheel-ink: #f7f1e4;
  --wheel-muted: #9fb4a7;
  --wheel-line: rgba(174, 207, 187, .18);
  --wheel-gold: #f4bd55;
  --wheel-mint: #78d6aa;
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: clamp(24px, 4vw, 58px);
  color: var(--wheel-ink);
  background:
    radial-gradient(760px 440px at 90% 3%, rgba(58, 151, 109, .18), transparent 66%),
    radial-gradient(rgba(244, 189, 85, .055) 1px, transparent 1.4px),
    var(--wheel-bg);
  background-size: auto, 20px 20px, auto;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.wheel-spinner-app *, .wheel-spinner-app *::before, .wheel-spinner-app *::after { box-sizing: border-box; }
.wheel-spinner-app button, .wheel-spinner-app input, .wheel-spinner-app textarea { font: inherit; }

.wheel-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  gap: clamp(24px, 5vw, 72px);
  align-items: end;
  max-width: 1420px;
  margin: 0 auto clamp(28px, 4vw, 48px);
}

.wheel-eyebrow {
  margin: 0 0 14px;
  color: var(--wheel-gold);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.wheel-intro h1 {
  max-width: 760px;
  margin: 0;
  color: var(--wheel-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.65rem, 5.7vw, 6rem);
  font-weight: 600;
  line-height: .96;
  letter-spacing: -.05em;
}

.wheel-lede {
  margin: 0;
  color: #c0cec5;
  font-size: clamp(.98rem, 1.45vw, 1.18rem);
  line-height: 1.7;
}

.wheel-facts {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-block: 1px solid var(--wheel-line);
}

.wheel-facts li { display: grid; gap: 4px; padding: 18px clamp(12px, 2.4vw, 32px); border-right: 1px solid var(--wheel-line); }
.wheel-facts li:first-child { padding-left: 0; }
.wheel-facts li:last-child { border-right: 0; }
.wheel-facts strong { color: var(--wheel-ink); font-size: .84rem; }
.wheel-facts span { color: var(--wheel-muted); font-size: .73rem; }

.wheel-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, .72fr);
  gap: clamp(18px, 2.5vw, 32px);
  align-items: stretch;
  max-width: 1420px;
  margin: 0 auto;
}

.wheel-stage-card, .control-panel {
  min-width: 0;
  padding: clamp(18px, 2.6vw, 34px);
  background: linear-gradient(150deg, rgba(17, 51, 37, .96), rgba(8, 31, 22, .98));
  border: 1px solid var(--wheel-line);
  border-radius: clamp(18px, 2vw, 28px);
  box-shadow: 0 28px 60px -45px #000;
}

.wheel-section-heading { display: flex; gap: 13px; align-items: flex-start; margin-bottom: clamp(20px, 3vw, 32px); }
.wheel-section-heading > span {
  display: grid;
  place-items: center;
  flex: 0 0 37px;
  width: 37px;
  height: 37px;
  color: #3a2b08;
  background: linear-gradient(145deg, #ffd67d, var(--wheel-gold));
  border-radius: 50%;
  font-size: .7rem;
  font-weight: 900;
}
.wheel-section-heading h2 { margin: 0; color: var(--wheel-ink); font: 600 clamp(1.3rem, 2vw, 1.75rem)/1.12 Georgia, serif; letter-spacing: -.02em; }
.wheel-section-heading p { margin: 5px 0 0; color: var(--wheel-muted); font-size: .78rem; line-height: 1.45; }

.wheel-container { display: grid; justify-items: center; gap: 20px; min-width: 0; }
.wheel-frame { position: relative; width: min(100%, 660px); aspect-ratio: 1; }
#wheelCanvas {
  display: block;
  width: 100%;
  height: 100%;
  border: clamp(7px, 1.2vw, 13px) solid #f4ede0;
  border-radius: 50%;
  background: #f4ede0;
  box-shadow: 0 24px 65px rgba(0, 0, 0, .34), 0 0 0 1px rgba(244, 189, 85, .5);
  cursor: pointer;
  touch-action: manipulation;
}

#spinText {
  position: absolute;
  top: 50%; left: 50%;
  display: grid;
  place-items: center;
  width: clamp(76px, 18%, 118px);
  aspect-ratio: 1;
  padding: 8px;
  color: #14281f;
  background: linear-gradient(145deg, #fff7e5, #f4bd55);
  border: 5px solid rgba(255, 255, 255, .72);
  border-radius: 50%;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
  transform: translate(-50%, -50%);
  pointer-events: none;
  user-select: none;
}
#spinText small { align-self: end; font-size: clamp(.52rem, 1.2vw, .68rem); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
#spinText strong { align-self: start; font-size: clamp(1rem, 2.7vw, 1.55rem); line-height: 1; }

#stopBtn, .button-row button {
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
#stopBtn { display: inline-flex; align-items: center; gap: 9px; padding: 11px 18px; color: #f8e9e7; background: rgba(125, 45, 38, .35); }
#stopBtn span { width: 10px; height: 10px; background: #ed786b; border-radius: 2px; box-shadow: 0 0 0 5px rgba(237, 120, 107, .1); }
#stopBtn:hover { border-color: rgba(237, 120, 107, .6); background: rgba(125, 45, 38, .55); transform: translateY(-2px); }

#resultContainer {
  position: absolute;
  top: 50%; left: 50%;
  z-index: 8;
  display: none;
  width: min(86%, 390px);
  padding: clamp(24px, 4vw, 36px) 20px 20px;
  color: #173024;
  text-align: center;
  background: rgba(255, 249, 236, .97);
  border: 1px solid #fff;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  transform: translate(-50%, -50%);
  backdrop-filter: blur(10px);
}
#resultContainer h2 { margin: 0 0 14px; color: #173024; font: 700 clamp(1.35rem, 3vw, 2rem)/1.18 Georgia, serif; }
#resultContainer button { width: 100%; margin-top: 8px; padding: 10px 13px; color: #fff9eb; background: #184d37; border: 0; border-radius: 10px; cursor: pointer; font-size: .77rem; font-weight: 800; }
#resultContainer button:hover { background: #226f4f; }
.close-btn { position: absolute; top: 8px; right: 12px; color: #65746c; cursor: pointer; font-size: 1.65rem; line-height: 1; }
.close-btn:hover { color: #8a3124; }

.control-panel { align-self: stretch; }
.choice-field { margin-bottom: 16px; }
.choice-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.choice-label label, .wheel-settings legend, .sound-settings legend { color: var(--wheel-ink); font-size: .75rem; font-weight: 800; letter-spacing: .04em; }
.choice-label span { color: var(--wheel-gold); font-size: .68rem; font-weight: 800; }
#namesInput {
  display: block;
  width: 100%;
  min-height: 220px;
  resize: vertical;
  padding: 15px 16px;
  color: #e9f3ec;
  background: rgba(4, 20, 13, .68);
  border: 1px solid rgba(174, 207, 187, .22);
  border-radius: 14px;
  outline: 0;
  font-size: .86rem;
  line-height: 1.7;
}
#namesInput:focus { border-color: var(--wheel-mint); box-shadow: 0 0 0 3px rgba(120, 214, 170, .12); }

.toggle-row, .sound-settings label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--wheel-ink);
}
.toggle-row { padding: 14px 0; border-block: 1px solid var(--wheel-line); }
.toggle-row span, .sound-settings label span { display: grid; gap: 3px; }
.toggle-row strong, .sound-settings strong { font-size: .76rem; }
.toggle-row small, .sound-settings small { color: var(--wheel-muted); font-size: .67rem; }
.wheel-spinner-app input[type="checkbox"] { width: 42px; height: 23px; margin: 0; accent-color: #52b98a; cursor: pointer; }

.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 22px; }
.button-row button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; padding: 11px 12px; color: #10271d; background: var(--wheel-mint); font-size: .77rem; font-weight: 850; }
.button-row button:last-child { color: var(--wheel-ink); background: transparent; }
.button-row button:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, .36); }
.button-row button.disabled { opacity: .45; cursor: wait; transform: none; }

.wheel-settings, .sound-settings { min-width: 0; margin: 0; padding: 0; border: 0; }
.wheel-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.wheel-settings legend, .sound-settings legend { width: 100%; margin-bottom: 11px; }
.wheel-settings label { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; min-width: 0; padding: 12px; background: rgba(5, 23, 16, .48); border: 1px solid var(--wheel-line); border-radius: 12px; }
.wheel-settings label span { color: var(--wheel-ink); font-size: .72rem; font-weight: 800; }
.wheel-settings label small { color: var(--wheel-muted); font-size: .62rem; }
.wheel-settings input { grid-column: 1 / -1; width: 100%; min-width: 0; margin-top: 6px; padding: 9px 10px; color: var(--wheel-ink); background: #071d14; border: 1px solid var(--wheel-line); border-radius: 8px; outline: 0; }
.wheel-settings input:focus { border-color: var(--wheel-mint); }

.sound-settings { margin-top: 22px; }
.sound-settings label { padding: 11px 0; border-top: 1px solid var(--wheel-line); }
.sound-settings label:last-child { border-bottom: 1px solid var(--wheel-line); }

#confettiCanvas { position: fixed; inset: 0; z-index: 999; width: 100%; height: 100%; background: transparent; pointer-events: none; }

@media (max-width: 960px) {
  .wheel-intro { grid-template-columns: 1fr; gap: 18px; }
  .wheel-workspace { grid-template-columns: 1fr; }
  .wheel-stage-card { order: 1; }
  .control-panel { order: 2; }
  #namesInput { min-height: 180px; }
}

@media (max-width: 600px) {
  .wheel-spinner-app { padding: 22px 13px 28px; }
  .wheel-intro { margin-bottom: 22px; }
  .wheel-intro h1 { font-size: clamp(2.45rem, 14vw, 4rem); }
  .wheel-facts li { padding: 13px 9px; }
  .wheel-facts li:first-child { padding-left: 0; }
  .wheel-facts strong { font-size: .7rem; }
  .wheel-facts span { font-size: .6rem; }
  .wheel-stage-card, .control-panel { padding: 16px 13px 18px; border-radius: 18px; }
  .wheel-section-heading { margin-bottom: 18px; }
  .wheel-section-heading > span { flex-basis: 33px; width: 33px; height: 33px; }
  .wheel-section-heading h2 { font-size: 1.22rem; }
  #namesInput { min-height: 160px; }
  .wheel-settings { grid-template-columns: 1fr 1fr; gap: 8px; }
  #resultContainer { width: 91%; padding-inline: 14px; }
}

@media (max-width: 380px) {
  .wheel-facts { grid-template-columns: 1fr; }
  .wheel-facts li, .wheel-facts li:first-child { padding: 10px 0; border-right: 0; border-bottom: 1px solid var(--wheel-line); }
  .wheel-facts li:last-child { border-bottom: 0; }
  .button-row, .wheel-settings { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .wheel-spinner-app *, .wheel-spinner-app *::before, .wheel-spinner-app *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
