/* Wheel of Fortune page — canvas stage + live loupe + stream controls */

.wheel-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 356px;
  gap: 18px;
  align-items: start;
  margin-top: 22px;
}
.wheel-side {
  display: grid;
  gap: 14px;
}

/* --------------------------------------------------------------- stage */
.wheel-stage {
  position: relative;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.14), transparent 55%),
    linear-gradient(180deg, rgba(212, 175, 55, 0.07), rgba(0, 0, 0, 0.2));
  border: 1px solid var(--bd);
  border-radius: 26px;
  box-shadow: var(--shadow);
  transition: max-width 0.3s;
}
.stage-brand {
  display: none;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--mu);
  border-bottom: 1px solid var(--bd-soft);
  padding-bottom: 8px;
}
.stage-brand b {
  color: var(--a);
  letter-spacing: 2px;
  font-size: 13px;
  direction: ltr;
}
.stage-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.stage-title h1 {
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -0.2px;
}
.stage-title p {
  font-size: 11.5px;
  color: var(--mu);
  margin-top: 1px;
}
.live-pill {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--bd-soft);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 11px;
  font-weight: 700;
  color: var(--mu);
  white-space: nowrap;
}
.live-pill b {
  color: var(--tx);
}

/* --------------------------------------------------------------- loupe */
.loupe {
  position: relative;
  z-index: 3;
  width: min(100%, 560px);
  margin: 2px auto 0;
  border-radius: 14px;
  padding: 7px 14px;
  background: linear-gradient(180deg, rgba(22, 20, 16, 0.96), rgba(13, 13, 13, 0.9));
  border: 1px solid var(--bd);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 10px 30px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(212, 175, 55, 0.18);
  text-align: center;
  overflow: hidden;
}
.loupe::before {
  content: "";
  position: absolute;
  inset: -60% -10% auto;
  height: 120%;
  background: radial-gradient(ellipse at 50% 0%, rgba(245, 158, 11, 0.22), transparent 60%);
  pointer-events: none;
}
.loupe-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--mu);
  text-transform: uppercase;
  line-height: 1.6;
}
.loupe-value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 900;
  font-size: clamp(15px, 2.1vw, 20px);
  line-height: 1.7;
  min-height: 30px;
  direction: ltr;
  white-space: normal;
}
.loupe-value #loupe-num {
  color: var(--a);
  font-variant-numeric: tabular-nums;
}
.loupe-value .loupe-dash {
  color: rgba(212, 175, 55, 0.45);
  font-weight: 400;
}
.loupe-value #loupe-user {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--tx);
  font-weight: 700;
  font-size: 0.85em;
}
.loupe.spinning {
  border-color: var(--b);
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.35), 0 10px 30px rgba(0, 0, 0, 0.45);
}
.loupe.is-winner {
  border-color: var(--a);
  animation: loupePulse 0.8s ease 3;
}

/* ------------------------------------------------------------- canvas */
.wheel-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 600px;
  aspect-ratio: 1;
  margin: 0 auto;
  display: grid;
  place-items: center;
}
#wheel-canvas {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.5));
}
.wheel-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--mu);
  font-size: 13px;
  background: radial-gradient(circle, rgba(22, 20, 16, 0.9), rgba(13, 13, 13, 0.85));
  border-radius: 50%;
}
.wheel-empty b {
  display: block;
  color: var(--a);
  font-size: 15px;
  margin-bottom: 4px;
}
.stage-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--mu);
  border-top: 1px solid var(--bd-soft);
  padding-top: 9px;
  flex-wrap: wrap;
}
#stage-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
#stage-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--a);
}
#stage-status.busy::before {
  background: var(--b);
  animation: livePulse 1.4s infinite;
}

/* -------------------------------------------------------------- controls */
.controls {
  display: grid;
  gap: 14px;
}
.spin-btn {
  padding: 15px 18px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.2px;
  border-radius: 15px;
}
.spin-btn.loading svg {
  animation: spin 0.9s linear infinite;
}
.spin-btn.is-locked {
  background: rgba(255, 255, 255, 0.06);
  color: var(--mu);
  border-color: var(--bd-soft);
  box-shadow: none;
}
.wheel-wait-note {
  margin: -8px 2px 0;
  text-align: center;
}
.control-block {
  display: grid;
  gap: 6px;
}
.control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--mu);
}
.control-label b {
  color: var(--a);
  font-size: 12px;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--a), var(--b)) no-repeat rgba(255, 255, 255, 0.09);
  background-size: var(--fill, 40%) 100%;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--grad);
  border: 2px solid #1a1405;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.6);
}
input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--a);
  border: 2px solid #1a1405;
}
.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid var(--bd-soft);
}
.mode-btn {
  border: 0;
  border-radius: 9px;
  padding: 7px 8px;
  background: transparent;
  color: var(--mu);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: 0.18s;
}
.mode-btn.active {
  background: var(--grad);
  color: #1a1405;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.25);
}
.toggle-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.toggle {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--bd-soft);
  background: rgba(255, 255, 255, 0.04);
  color: var(--mu);
  border-radius: 10px;
  padding: 7px 9px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  transition: 0.18s;
  white-space: nowrap;
}
.toggle:hover {
  color: var(--tx);
  border-color: var(--bd);
}
.toggle.active {
  color: var(--a);
  border-color: var(--bd);
  background: rgba(212, 175, 55, 0.12);
}
.rank-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rank-row .input {
  width: 74px;
  text-align: center;
  padding: 6px;
}

/* ---------------------------------------------------------------- lists */
.entry-list {
  position: relative;
  display: grid;
  gap: 3px;
  max-height: 232px;
  overflow-y: auto;
  margin-top: 8px;
  padding-inline-end: 2px;
}
.entry-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  padding: 4px 7px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.2);
  direction: ltr;
  transition: 0.2s;
}
.entry-row .n {
  color: var(--a);
  font-weight: 800;
  min-width: 44px;
  font-variant-numeric: tabular-nums;
}
.entry-row .u {
  color: var(--tx);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.85;
}
.entry-row.is-out {
  opacity: 0.4;
  text-decoration: line-through;
}
.entry-row.highlight {
  background: rgba(212, 175, 55, 0.2);
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.35);
}
.side-winners {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}
.side-winner {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(52, 211, 153, 0.07);
  border: 1px solid rgba(52, 211, 153, 0.18);
}
.side-winner .rank {
  color: var(--success);
  font-weight: 900;
}
.side-winner .n {
  color: var(--a);
  font-weight: 800;
}
.side-winner .u {
  color: var(--tx);
  direction: ltr;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- admin */
.admin-block .card-head {
  margin-bottom: 8px;
}
.admin-locked {
  font-size: 11.5px;
  color: var(--mu);
  line-height: 1.9;
}
.admin-tools {
  display: grid;
  gap: 8px;
}
.admin-tools textarea {
  min-height: 82px;
  font-size: 12px;
}
.checkline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--mu);
  cursor: pointer;
}
.checkline input {
  accent-color: var(--a);
}
.admin-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.admin-actions .btn {
  flex: 1;
}

/* -------------------------------------------------------- story (9:16) */
.wheel-stage.story {
  aspect-ratio: 9 / 16;
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  padding: 14px;
  gap: 8px;
  border-radius: 22px;
  justify-content: flex-start;
}
.wheel-stage.story .stage-brand {
  display: flex;
}
.wheel-stage.story .stage-top {
  display: none;
}
.wheel-stage.story .loupe {
  width: 100%;
  padding: 5px 10px;
}
.wheel-stage.story .loupe-value {
  font-size: 15px;
  min-height: 24px;
}
.wheel-stage.story .loupe-label {
  font-size: 8px;
  letter-spacing: 1px;
}
.wheel-stage.story .wheel-canvas-wrap {
  flex: 1;
  max-width: 100%;
  min-height: 0;
  aspect-ratio: auto;
}
.wheel-stage.story #wheel-canvas {
  width: auto;
  height: 100%;
  max-width: 100%;
  margin: 0 auto;
}
.wheel-stage.story .stage-foot {
  font-size: 9.5px;
  padding-top: 6px;
}
.wheel-stage.story .wheel-empty {
  font-size: 11px;
}

/* ----------------------------------------------------------- confetti */
.confetti-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}
.confetti {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 12px;
  border-radius: 1px;
  opacity: 0.95;
  animation: confettiFall linear forwards;
}

/* ------------------------------------------------------ winner modal */
.winner-modal {
  position: relative;
  z-index: 2;
  text-align: center;
  border-color: var(--a);
  box-shadow: 0 0 70px rgba(212, 175, 55, 0.28), 0 30px 80px rgba(0, 0, 0, 0.6);
}
.winner-modal .trophy {
  width: 68px;
  height: 68px;
  margin: 0 auto 8px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: var(--grad);
  color: #1a1405;
  box-shadow: 0 10px 34px rgba(245, 158, 11, 0.45);
  animation: trophyPop 0.6s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.winner-eyebrow {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--mu);
}
.winner-number {
  font-size: clamp(52px, 15vw, 76px);
  font-weight: 900;
  line-height: 1.2;
  background: linear-gradient(135deg, #f6eed7, var(--a) 40%, var(--b));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 2px 0;
  direction: ltr;
  font-variant-numeric: tabular-nums;
}
.winner-user {
  font-size: 19px;
  font-weight: 800;
  direction: ltr;
  color: var(--tx);
  word-break: break-all;
}
.winner-name {
  font-size: 12px;
  color: var(--mu);
  margin-top: 2px;
}
.winner-prize {
  font-size: 12px;
  color: var(--mu);
  margin-top: 8px;
}
.winner-rank {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid var(--bd);
  color: var(--a);
  font-size: 12px;
  font-weight: 800;
}
.winner-actions {
  display: grid;
  gap: 7px;
  margin-top: 16px;
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 1000px) {
  .wheel-layout {
    grid-template-columns: 1fr;
  }
  .wheel-side {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    align-items: start;
  }
  .wheel-stage {
    max-width: 660px;
    margin-inline: auto;
    width: 100%;
  }
}
@media (max-width: 620px) {
  .wheel-stage {
    padding: 12px;
  }
  .wheel-stage.story {
    max-width: 340px;
  }
  .stage-title h1 {
    font-size: 17px;
  }
  .live-pill {
    font-size: 10px;
    padding: 3px 8px;
  }
  .wheel-canvas-wrap {
    max-width: 100%;
  }
  .wheel-side {
    grid-template-columns: 1fr;
  }
}

@keyframes trophyPop {
  0% {
    transform: scale(0.4) rotate(-14deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}
@keyframes confettiFall {
  0% {
    transform: translate3d(0, -20px, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--dx, 0px), 92vh, 0) rotate(var(--r, 540deg));
    opacity: 0.85;
  }
}
@keyframes loupePulse {
  0%,
  100% {
    box-shadow: 0 0 18px rgba(212, 175, 55, 0.35), 0 10px 30px rgba(0, 0, 0, 0.45);
  }
  50% {
    box-shadow: 0 0 44px rgba(245, 158, 11, 0.7), 0 10px 30px rgba(0, 0, 0, 0.45);
    transform: scale(1.015);
  }
}
