.wheel-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr);
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 860px) {
  .wheel-layout { grid-template-columns: 1fr; }
}

.wheel-area { display: flex; flex-direction: column; align-items: center; gap: 0.9rem; }

.wheel-stage {
  position: relative;
  width: min(100%, 620px);
  aspect-ratio: 1 / 1;
  padding-top: 14px;
}
.wheel-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  cursor: pointer;
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.45));
}
.wheel-stage.is-spinning canvas { cursor: progress; }

.pointer {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 2;
  width: 0; height: 0;
  margin-left: -18px;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 40px solid #fff;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5));
  transform-origin: 50% 0;
}
.pointer::after {
  content: "";
  position: absolute;
  left: -10px; top: -36px;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 24px solid var(--accent-2);
}
.pointer.tick { animation: tick 0.12s ease-out; }
@keyframes tick { 0% { transform: rotate(-14deg); } 100% { transform: rotate(0); } }

.round-stats { margin: 0; color: var(--muted); font-weight: 600; text-align: center; }

.wheel-controls { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; }
.btn-spin { font-size: 1.3rem; min-width: 160px; min-height: 56px; letter-spacing: 0.03em; }

.settings-hint {
  margin: 0; padding: 0.5rem 0.9rem; border-radius: 12px;
  background: rgba(255, 207, 63, 0.15); border: 1px solid rgba(255, 207, 63, 0.5);
  text-align: center;
}

.winner-banner {
  width: min(100%, 520px);
  text-align: center;
  padding: 1.25rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 207, 63, 0.25), rgba(255, 122, 89, 0.25));
  border: 2px solid var(--accent);
  box-shadow: 0 0 40px rgba(255, 207, 63, 0.35);
  animation: pop 0.5s cubic-bezier(.2, 1.6, .4, 1);
}
.winner-banner .trophy { font-size: 3rem; line-height: 1; }
.winner-label { margin: 0.25rem 0 0; text-transform: uppercase; letter-spacing: 0.2em; color: var(--accent); font-weight: 800; }
.winner-name { margin: 0.2rem 0 0.9rem; font-size: clamp(1.6rem, 6vw, 2.4rem); font-weight: 900; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.side-panels { display: flex; flex-direction: column; gap: 1.25rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.panel-head h2 { margin: 0; }
.panel-help { color: var(--muted); font-size: 0.9rem; margin: 0.4rem 0 0.8rem; }
.panel-help.small { font-size: 0.8rem; margin: 0.4rem 0 0.6rem; }
.total-pill {
  font-size: 0.8rem; font-weight: 800; padding: 0.2rem 0.6rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.name-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.name-row {
  display: grid;
  grid-template-columns: auto 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.5rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  border-left: 5px solid var(--player, transparent);
}
.name-row.is-off { opacity: 0.55; }

/* Per-player colour picker (native <input type=color>, restyled as a swatch) */
.color-pick {
  -webkit-appearance: none;
  appearance: none;
  width: 34px; height: 34px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 10px;
  background: var(--player, #888);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.color-pick:hover { transform: scale(1.08); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18), 0 2px 8px rgba(0, 0, 0, 0.35); }
.color-pick::-webkit-color-swatch-wrapper { padding: 0; }
.color-pick::-webkit-color-swatch { border: none; border-radius: 7px; }
.color-pick::-moz-color-swatch { border: none; border-radius: 7px; }
.name-row .name-label { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.stepper { display: inline-flex; align-items: center; gap: 0.25rem; }
.stepper input { width: 3.4rem; text-align: center; padding: 0.3rem; min-height: 36px; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.remove-btn { background: transparent; border-color: transparent; color: var(--muted); }
.remove-btn:hover:not(:disabled) { color: var(--danger); }

.add-name { display: flex; gap: 0.5rem; margin-top: 0.8rem; }
.add-name input { flex: 1; min-width: 0; }
.form-error { color: var(--danger); font-size: 0.85rem; margin: 0.3rem 0 0; min-height: 1.2em; }

.nick-controls {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem;
  margin-top: 0.4rem; padding-top: 0.8rem; border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.btn-ghost { background: transparent; color: var(--muted); }

.elim-list { margin: 0; padding-left: 1.6rem; max-height: 360px; overflow-y: auto; }
.elim-list li { padding: 0.18rem 0; }
.elim-list li::marker { color: var(--muted); font-weight: 700; }
.elim-list .chip { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 0.4rem; vertical-align: middle; }
.elim-list li.latest { font-weight: 800; color: var(--accent); }

/* ------------------------------------------------------------------------
   Announcement box above the wheel. Fixed height so nothing below it moves
   when the message changes.
   ------------------------------------------------------------------------ */
.announce-area {
  --who: var(--accent);
  --who-text: #1a1030;
  position: relative;
  width: min(100%, 620px);
  height: 9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  z-index: 3;
  scroll-margin-top: 12px;
}
.announce-card {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  text-align: center;
  overflow: hidden;
}
.announce-card p { margin: 0; }
.announce-card.is-idle,
.announce-card.is-spinning {
  border: 2px dashed rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
}
.announce-idle { color: var(--muted); font-weight: 700; font-size: clamp(1rem, 3.6vw, 1.25rem); }
.announce-card.is-spinning .announce-idle { color: var(--text); animation: drumroll 0.6s ease-in-out infinite alternate; }

.announce-card.is-elim,
.announce-card.is-winner {
  border: 3px solid var(--who);
  background:
    radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--who) 45%, transparent), transparent 70%),
    rgba(20, 11, 46, 0.82);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.25), 0 0 36px color-mix(in srgb, var(--who) 55%, transparent);
}
/* Fallback for browsers without color-mix() */
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .announce-card.is-elim, .announce-card.is-winner { background: rgba(20, 11, 46, 0.82); box-shadow: 0 0 30px rgba(0, 0, 0, 0.4); }
}

.announce-main {
  font-weight: 900;
  line-height: 1.15;
  font-size: clamp(1.25rem, 4.6vw, 2rem);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 0.15rem 0;
}
.announce-name {
  display: inline-block;
  padding: 0.05em 0.4em;
  border-radius: 0.35em;
  background: var(--who);
  color: var(--who-text);
  /* thin light ring keeps very dark picks visible on the dark card */
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35), 0 3px 0 2px rgba(0, 0, 0, 0.3);
}
.announce-verb { color: #fff; letter-spacing: 0.02em; }
.announce-card.is-elim .announce-verb { color: var(--danger); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4); }
.announce-sub { color: var(--muted); font-weight: 700; font-size: clamp(0.85rem, 3vw, 1rem); }

.announce-card.is-winner { border-color: var(--accent); }
.announce-card.is-winner .announce-main { font-size: clamp(1.6rem, 6vw, 2.6rem); }
.announce-card.is-winner .announce-verb { color: var(--accent); text-shadow: 0 0 18px rgba(255, 207, 63, 0.7); }
.announce-kicker {
  text-transform: uppercase; letter-spacing: 0.18em; font-weight: 800; font-size: 0.8rem; color: var(--accent);
}

/* Entrance animations */
.announce-card.is-elim { animation: announce-pop 0.45s cubic-bezier(.2, 1.6, .4, 1), announce-shake 0.5s 0.4s ease-in-out; }
.announce-card.is-elim .announce-emoji { display: inline-block; animation: boom 0.6s ease-out; }
.announce-card.is-winner { animation: announce-pop 0.6s cubic-bezier(.2, 1.6, .4, 1), winner-glow 1.6s 0.6s ease-in-out infinite alternate; }
@keyframes announce-pop { 0% { transform: scale(0.55); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes announce-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px) rotate(-1deg); }
  40% { transform: translateX(7px) rotate(1deg); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}
@keyframes boom { 0% { transform: scale(0.2) rotate(-30deg); } 60% { transform: scale(1.5) rotate(10deg); } 100% { transform: scale(1); } }
@keyframes winner-glow {
  from { box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.25), 0 0 24px rgba(255, 207, 63, 0.35); }
  to { box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.25), 0 0 54px rgba(255, 207, 63, 0.75); }
}
@keyframes drumroll { from { transform: scale(1); } to { transform: scale(1.06); } }

/* Little burst of bits behind the announcement */
.announce-burst { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; z-index: -1; }
.announce-burst .bit {
  position: absolute;
  left: -5px; top: -4px;
  width: 10px; height: 8px;
  border-radius: 2px;
  background: var(--c);
  opacity: 0;
  animation: bit-fly 1.1s cubic-bezier(.15, .7, .3, 1) forwards;
}
.announce-burst .bit:nth-child(3n) { border-radius: 50%; width: 8px; }
@keyframes bit-fly {
  0% { transform: translate(0, 0) rotate(0) scale(0.6); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(1); opacity: 0; }
}

@media (max-width: 520px) {
  .announce-area { height: 8.5rem; }
  .announce-card { padding: 0.5rem 0.7rem; }
  .name-row { grid-template-columns: auto 30px minmax(0, 1fr) auto auto; gap: 0.4rem; padding: 0.35rem 0.4rem; }
  .color-pick { width: 30px; height: 30px; border-radius: 9px; }
  /* Tighter steppers so names still fit next to the colour picker */
  .name-row .btn-icon { width: 32px; min-height: 32px; }
  .name-row .remove-btn { width: 26px; }
  .stepper { gap: 0.2rem; }
  .stepper input { width: 2.6rem; min-height: 32px; padding: 0.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .announce-card.is-elim, .announce-card.is-winner,
  .announce-card.is-spinning .announce-idle,
  .announce-card .announce-emoji { animation: none !important; }
  .announce-burst { display: none; }
}

.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }
