:root {
  --felt: #0b3d2e;
  --felt-deep: #06261c;
  --charcoal: #12141a;
  --charcoal-2: #1a1e27;
  --panel: rgba(14, 18, 26, 0.92);
  --text: #f7f2e8;
  --muted: #a89f8e;
  --gold: #d4af37;
  --gold-bright: #f0d78c;
  --gold-deep: #9a7b2b;
  --gold-hot: #ffe9a8;
  --roulette-red: #c41e3a;
  --roulette-black: #141414;
  --danger: #f87171;
  --ok: #34d399;
  --border: rgba(212, 175, 55, 0.32);
  --radius: 16px;
  --shadow-gold: 0 0 0 1px rgba(212, 175, 55, 0.38), 0 14px 44px rgba(0, 0, 0, 0.58);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  background:
    radial-gradient(ellipse 980px 560px at 50% -10%, rgba(212, 175, 55, 0.14) 0%, transparent 55%),
    radial-gradient(ellipse 720px 520px at 50% 38%, rgba(11, 61, 46, 0.62) 0%, transparent 70%),
    linear-gradient(180deg, #08141c 0%, var(--felt-deep) 36%, var(--charcoal) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.felt-edge {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 12% 88%, rgba(196, 30, 58, 0.09), transparent 28%),
    radial-gradient(circle at 88% 18%, rgba(212, 175, 55, 0.08), transparent 30%);
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: 22px 16px 40px;
  text-align: center;
}

body.embed .chrome { display: none; }
body.embed .app { padding-top: 10px; padding-bottom: 14px; }
body.controls-hidden #controls,
body.controls-hidden #modeTabs { display: none; }
body.controls-hidden .empty-hint { display: none !important; }

/* —— Header —— */
.chrome {
  margin-bottom: 18px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-bottom: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  color: var(--gold-hot);
  font-size: 1.05rem;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 233, 168, 0.4), transparent 42%),
    radial-gradient(circle at 50% 55%, rgba(154, 123, 43, 0.55), rgba(10, 12, 16, 0.95));
  box-shadow:
    0 0 0 3px rgba(212, 175, 55, 0.12),
    0 0 20px rgba(212, 175, 55, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

h1 {
  margin: 0 0 6px;
  font-family: Cinzel, Georgia, serif;
  font-size: clamp(1.6rem, 5vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff4c8 0%, var(--gold-bright) 38%, var(--gold) 72%, var(--gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.5));
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  font-weight: 500;
}

/* —— Mode chips —— */
.mode-tabs {
  display: inline-flex;
  background: rgba(6, 9, 12, 0.82);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 18px;
  gap: 4px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 24px rgba(0, 0, 0, 0.28);
}

.tab {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 9px 20px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color 0.18s, background 0.18s, box-shadow 0.18s, transform 0.12s;
}

.tab-ico {
  font-size: 0.72rem;
  opacity: 0.65;
}

.tab:hover {
  color: var(--text);
  background: rgba(212, 175, 55, 0.06);
}

.tab.active {
  background: linear-gradient(145deg, var(--gold-hot), var(--gold-bright) 30%, var(--gold) 70%, var(--gold-deep));
  color: #1a1204;
  box-shadow:
    0 2px 14px rgba(212, 175, 55, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.tab.active .tab-ico { opacity: 1; }

/* —— Wheel stage —— */
.wheel-stage {
  margin: 0 auto 18px;
  overflow: visible;
}

.wheel-wrap {
  position: relative;
  display: inline-block;
  width: min(100%, 440px);
  aspect-ratio: 1;
  margin: 18px auto 8px;
  overflow: visible;
  isolation: isolate; /* clean stacking so the ball stays above the canvas */
}

.wheel-shadow {
  position: absolute;
  inset: 6% 4% -6%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 60%, rgba(0, 0, 0, 0.55) 0%, transparent 68%);
  filter: blur(10px);
  z-index: 0;
  pointer-events: none;
}

.wheel-rim {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background:
    conic-gradient(
      from 0deg,
      #8a6820,
      var(--gold-hot),
      var(--gold-bright),
      #c9a227,
      var(--gold),
      #5a4010,
      var(--gold-hot),
      #a8842a,
      var(--gold-bright),
      #6b4e14,
      var(--gold-hot),
      #8a6820
    );
  box-shadow:
    0 0 0 2px #1a1204,
    0 0 0 3px rgba(240, 215, 140, 0.35),
    0 0 0 7px rgba(212, 175, 55, 0.18),
    0 0 42px rgba(212, 175, 55, 0.48),
    0 0 80px rgba(212, 175, 55, 0.18),
    0 22px 52px rgba(0, 0, 0, 0.62),
    inset 0 3px 6px rgba(255, 255, 255, 0.45),
    inset 0 -4px 10px rgba(0, 0, 0, 0.5);
  z-index: 0;
  overflow: hidden;
}

.rim-ticks,
.rim-ticks.major {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

/* Dense minor gold ticks around fixed rim */
.rim-ticks {
  background: repeating-conic-gradient(
    from -0.6deg,
    var(--gold-hot) 0deg 0.9deg,
    transparent 0.9deg 5deg
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 9px) calc(100% - 2px), transparent calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 9px) calc(100% - 2px), transparent calc(100% - 2px));
  opacity: 0.92;
}

/* Longer major ticks every ~30° */
.rim-ticks.major {
  background: repeating-conic-gradient(
    from -1deg,
    #fff4c8 0deg 1.6deg,
    transparent 1.6deg 30deg
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 12px), #000 calc(100% - 12px) calc(100% - 1px), transparent calc(100% - 1px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 12px), #000 calc(100% - 12px) calc(100% - 1px), transparent calc(100% - 1px));
  opacity: 1;
  filter: drop-shadow(0 0 2px rgba(240, 215, 140, 0.55));
}

.rim-shine {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 26% 18%, rgba(255, 255, 255, 0.55), transparent 28%),
    radial-gradient(circle at 70% 30%, rgba(255, 244, 200, 0.28), transparent 34%),
    radial-gradient(circle at 78% 78%, rgba(0, 0, 0, 0.42), transparent 38%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, transparent 40%, transparent 60%, rgba(0, 0, 0, 0.22) 100%);
  pointer-events: none;
  mix-blend-mode: soft-light;
}

.rim-bevel {
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  pointer-events: none;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.4),
    inset 0 -2px 4px rgba(40, 28, 6, 0.55),
    inset 0 0 0 1px rgba(255, 233, 168, 0.2);
}

.rim-glow {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, transparent 62%, rgba(240, 215, 140, 0.22) 78%, transparent 88%);
  opacity: 0.85;
  mix-blend-mode: screen;
}

.wheel-rim::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: #080a0e;
  box-shadow:
    inset 0 0 0 2px rgba(212, 175, 55, 0.55),
    inset 0 0 18px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(90, 64, 16, 0.8);
}

/* Recessed ball track between gold rim and pocket face */
.rim-track {
  position: absolute;
  inset: 0.5%;
  border-radius: 50%;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle,
      transparent 74.5%,
      rgba(8, 6, 2, 0.92) 78%,
      rgba(18, 14, 6, 0.98) 82%,
      rgba(42, 32, 12, 0.95) 86%,
      rgba(70, 52, 18, 0.7) 89%,
      rgba(20, 14, 4, 0.85) 92%,
      rgba(0, 0, 0, 0.55) 95%,
      transparent 98%);
  box-shadow:
    inset 0 0 0 1px rgba(212, 175, 55, 0.42),
    inset 0 0 28px rgba(0, 0, 0, 0.7);
}

.track-rail {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

.track-rail.outer {
  background: radial-gradient(circle,
    transparent 90.5%,
    rgba(240, 215, 140, 0.55) 92%,
    rgba(154, 123, 43, 0.7) 94%,
    transparent 96%);
  filter: drop-shadow(0 0 2px rgba(240, 215, 140, 0.35));
}

.track-rail.inner {
  background: radial-gradient(circle,
    transparent 76%,
    rgba(212, 175, 55, 0.45) 78%,
    rgba(90, 64, 16, 0.65) 80%,
    transparent 82.5%);
}

.track-groove {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle,
    transparent 79%,
    rgba(0, 0, 0, 0.55) 84%,
    rgba(0, 0, 0, 0.35) 88%,
    transparent 91%);
  mix-blend-mode: multiply;
}

/* Roulette ball — orbits opposite the wheel, then drops into pocket.
   Angle/radius come from --ball-angle / --ball-r (set by JS). Never put a
   competing transform or animation on .roulette-ball itself — that made the
   marble look stuck under the pointer while only the sphere specular spun.
   Keep z-index above #wheelcanvas; overflow visible so the marble is never clipped. */
.ball-layer {
  position: absolute;
  inset: 0;
  z-index: 5; /* above canvas (1), rim-track (1), hub (3); below pointer (6) */
  pointer-events: none;
  border-radius: 50%;
  overflow: visible;
}

.roulette-ball {
  --ball-angle: 0deg;
  --ball-r: 196px;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  transform: rotate(var(--ball-angle)) translateY(calc(-1 * var(--ball-r)));
  transform-origin: center center;
  transition: none !important;
  animation: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 1;
}

.roulette-ball.rolling .ball-sphere {
  animation: ball-spin 0.28s linear infinite;
}

.roulette-ball.dropped .ball-sphere {
  animation: none;
}

.ball-shadow {
  position: absolute;
  left: 50%;
  top: 62%;
  width: 140%;
  height: 85%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.28) 45%, transparent 72%);
  filter: blur(2px);
  z-index: 0;
}

.ball-sphere {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  z-index: 1;
  background:
    radial-gradient(circle at 32% 26%, #ffffff 0%, #fffef8 18%, #f0f0f0 36%, #d0d0d0 58%, #9a9a9a 82%, #4a4a4a 100%);
  border: 1.5px solid rgba(8, 8, 8, 0.75);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.55),
    0 0 10px 2px rgba(255, 255, 255, 0.45),
    0 3px 6px rgba(0, 0, 0, 0.65),
    inset 0 -3px 4px rgba(0, 0, 0, 0.35),
    inset 0 2px 3px rgba(255, 255, 255, 0.7);
  overflow: hidden;
}

.ball-spec {
  position: absolute;
  top: 12%;
  left: 16%;
  width: 42%;
  height: 32%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 40% 40%, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.55) 45%, transparent 75%);
  filter: blur(0.3px);
  pointer-events: none;
}

.ball-spec-2 {
  position: absolute;
  bottom: 18%;
  right: 20%;
  width: 22%;
  height: 16%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  filter: blur(0.6px);
  pointer-events: none;
}

@keyframes ball-spin {
  to { transform: rotate(360deg); }
}

@media (max-height: 820px) {
  .roulette-ball {
    width: 17px;
    height: 17px;
    margin: -8.5px 0 0 -8.5px;
  }
}

@media (max-height: 700px) {
  .roulette-ball {
    width: 15px;
    height: 15px;
    margin: -7.5px 0 0 -7.5px;
  }
}



#wheelcanvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  border-radius: 50%;
  background: transparent;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

/* Roulette marker at top */
.pointer {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  transform-origin: 50% 8px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.6));
  will-change: transform;
}

.pointer.tick {
  animation: pointer-tick 0.09s ease-out;
}

.pointer.land {
  animation: pointer-land 0.62s cubic-bezier(0.22, 1.4, 0.36, 1);
}

@keyframes pointer-tick {
  0% { transform: translateX(-50%) rotate(0deg); }
  40% { transform: translateX(-50%) rotate(-11deg); }
  100% { transform: translateX(-50%) rotate(0deg); }
}

@keyframes pointer-land {
  0% { transform: translateX(-50%) rotate(0deg) translateY(0); }
  22% { transform: translateX(-50%) rotate(-14deg) translateY(3px); }
  48% { transform: translateX(-50%) rotate(8deg) translateY(-1px); }
  72% { transform: translateX(-50%) rotate(-4deg) translateY(1px); }
  100% { transform: translateX(-50%) rotate(0deg) translateY(0); }
}

.pointer-cap {
  width: 12px;
  height: 12px;
  margin-bottom: -4px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--gold-hot), var(--gold-deep));
  border: 1.5px solid #5c4310;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  z-index: 1;
}

.pointer-diamond {
  width: 24px;
  height: 24px;
  background:
    linear-gradient(145deg, var(--gold-hot) 0%, var(--gold-bright) 35%, var(--gold) 70%, var(--gold-deep) 100%);
  border: 2px solid #5c4310;
  transform: rotate(45deg);
  border-radius: 4px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.5),
    inset 0 -2px 4px rgba(0, 0, 0, 0.25);
}

.pointer-stem {
  width: 0;
  height: 0;
  margin-top: -7px;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 24px solid var(--gold);
  filter: drop-shadow(0 1px 0 #5c4310);
}

.wheel-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 21%;
  aspect-ratio: 1;
  border-radius: 50%;
  z-index: 3;
  background: transparent;
  border: none;
  box-shadow:
    0 0 0 4px rgba(8, 10, 14, 0.95),
    0 0 0 6px rgba(212, 175, 55, 0.4),
    0 8px 22px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  overflow: hidden;
}

.hub-wood {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg,
      rgba(120, 72, 30, 0.55) 0deg 3deg,
      rgba(70, 40, 14, 0.35) 3deg 6deg),
    radial-gradient(circle at 35% 28%, #a36b38 0%, #7a4a24 32%, #4e2c12 68%, #241408 100%);
  border: 2px solid #2a1808;
  box-shadow:
    inset 0 2px 4px rgba(255, 210, 140, 0.28),
    inset 0 -3px 6px rgba(0, 0, 0, 0.5);
}

.hub-metal {
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  background:
    conic-gradient(from 20deg,
      #c9a227, #f0d78c, #8a6820, #ffe9a8, #d4af37, #5c4310, #f0d78c, #c9a227);
  border: 1.5px solid #3d2e0a;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.45),
    inset 0 -2px 4px rgba(0, 0, 0, 0.4),
    0 0 8px rgba(212, 175, 55, 0.3);
}

.hub-ring {
  position: absolute;
  inset: 26%;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 244, 200, 0.4);
  box-shadow:
    inset 0 0 8px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(90, 64, 16, 0.5);
  background: radial-gradient(circle at 40% 30%, rgba(255, 233, 168, 0.12), transparent 60%);
}

.hub-inner {
  position: absolute;
  inset: 38%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 30%, #4a3a28 0%, #1a1610 50%, #060708 100%);
  border: 1px solid rgba(212, 175, 55, 0.6);
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.65),
    inset 0 -1px 2px rgba(255, 233, 168, 0.15);
}

.hub-gem {
  position: absolute;
  top: 38%;
  left: 38%;
  width: 24%;
  height: 24%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.7) 0%, rgba(255, 244, 200, 0.45) 35%, transparent 70%);
  pointer-events: none;
  filter: drop-shadow(0 0 3px rgba(240, 215, 140, 0.5));
}

.empty-hint {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.empty-hint[hidden] { display: none; }

/* —— Controls / panels —— */
.controls {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: var(--shadow-gold);
  backdrop-filter: blur(10px);
  text-align: left;
}

.add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.add-row input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid rgba(212, 175, 55, 0.26);
  background: rgba(6, 8, 12, 0.9);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.add-row input::placeholder { color: #6e675c; }

.add-row input:focus {
  outline: none;
  border-color: rgba(212, 175, 55, 0.65);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}

.spin-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  position: sticky;
  bottom: 0;
  z-index: 6;
  padding-bottom: 2px;
  background: linear-gradient(180deg, transparent 0%, rgba(8, 20, 28, 0.55) 40%, rgba(8, 20, 28, 0.85) 100%);
}

.spin-row .btn.primary {
  flex: 1;
  min-width: 0;
}

.btn.mute {
  flex: 0 0 52px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #2e3542, #1a1f28);
  color: var(--gold-bright);
  border: 1px solid rgba(212, 175, 55, 0.38);
  border-radius: 11px;
  box-shadow:
    0 3px 0 #12151c,
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font-size: 1.15rem;
  line-height: 1;
}

.btn.mute:hover {
  border-color: var(--gold);
  color: #fff8e7;
}

.btn.mute[aria-pressed="true"] {
  color: var(--muted);
  opacity: 0.85;
}

.btn.mute[aria-pressed="true"] .mute-ico {
  filter: grayscale(1);
  opacity: 0.7;
}

.btn {
  border: none;
  border-radius: 11px;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s, box-shadow 0.18s, filter 0.15s, border-color 0.15s;
}

.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; filter: grayscale(0.35); }

.btn.primary {
  width: 100%;
  padding: 16px 18px;
  font-family: Cinzel, Georgia, serif;
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: #1a1204;
  background: linear-gradient(180deg, var(--gold-hot) 0%, var(--gold-bright) 28%, var(--gold) 62%, var(--gold-deep) 100%);
  border: 1px solid #7a5f1a;
  box-shadow:
    0 5px 0 #5c4310,
    0 10px 28px rgba(212, 175, 55, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.btn.primary:not(:disabled):hover {
  filter: brightness(1.08);
  box-shadow:
    0 5px 0 #5c4310,
    0 12px 34px rgba(240, 215, 140, 0.55),
    0 0 24px rgba(212, 175, 55, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.btn.primary:not(:disabled):active {
  filter: brightness(0.98);
  box-shadow:
    0 1px 0 #5c4310,
    0 4px 14px rgba(212, 175, 55, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(3px);
}

.spin-label { display: inline-block; }

.btn.secondary {
  background: linear-gradient(180deg, #2e3542, #1a1f28);
  color: var(--gold-bright);
  border: 1px solid rgba(212, 175, 55, 0.38);
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.btn.secondary:hover {
  border-color: var(--gold);
  color: #fff8e7;
  background: linear-gradient(180deg, #353c4a, #1e2430);
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 148px;
  overflow-y: auto;
  border: 1px solid rgba(212, 175, 55, 0.16);
  border-radius: 12px;
  background: rgba(6, 8, 12, 0.62);
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 55, 0.35) transparent;
}

.item-list:empty { display: none; }

.item-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
  font-size: 0.95rem;
  transition: background 0.12s;
}

.item-list li:hover {
  background: rgba(212, 175, 55, 0.05);
}

.item-list li:last-child { border-bottom: none; }

.item-list li::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--seg-dot, var(--gold));
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.4),
    0 0 6px color-mix(in srgb, var(--seg-dot, var(--gold)) 50%, transparent);
}

.item-list li > span {
  flex: 1;
  text-align: left;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-list .remove {
  background: transparent;
  border: 1px solid rgba(248, 113, 113, 0.38);
  color: var(--danger);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}

.item-list .remove:hover {
  background: rgba(248, 113, 113, 0.14);
  border-color: rgba(248, 113, 113, 0.6);
}

.list-empty {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.list-empty[hidden] { display: none; }

/* —— Winner overlay —— */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 5, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
  backdrop-filter: blur(8px);
  animation: overlay-in 0.28s ease-out;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.overlay.hidden { display: none; }

.overlay-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(240, 215, 140, 0.28), transparent 50%),
    radial-gradient(ellipse at 50% 120%, rgba(196, 30, 58, 0.12), transparent 45%),
    linear-gradient(180deg, #222836 0%, #12161e 100%);
  border: 1.5px solid var(--gold-bright);
  border-radius: 22px;
  padding: 36px 28px 28px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 0 0 5px rgba(212, 175, 55, 0.14),
    0 0 48px rgba(212, 175, 55, 0.22),
    0 28px 72px rgba(0, 0, 0, 0.65);
  animation: card-pop 0.45s cubic-bezier(0.22, 1.2, 0.36, 1);
}

@keyframes card-pop {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.overlay-glow {
  position: absolute;
  top: -45%;
  left: 50%;
  transform: translateX(-50%);
  width: 200%;
  height: 90%;
  background: radial-gradient(ellipse, rgba(240, 215, 140, 0.28), transparent 58%);
  pointer-events: none;
  animation: glow-pulse 2.4s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.overlay-rays {
  position: absolute;
  inset: -20%;
  background: repeating-conic-gradient(
    from 0deg at 50% 40%,
    rgba(240, 215, 140, 0.07) 0deg 8deg,
    transparent 8deg 22deg
  );
  pointer-events: none;
  opacity: 0.7;
  animation: rays-spin 28s linear infinite;
}

@keyframes rays-spin {
  to { transform: rotate(360deg); }
}

.overlay-crown {
  position: relative;
  font-size: 1.6rem;
  color: var(--gold-bright);
  text-shadow: 0 0 18px rgba(212, 175, 55, 0.55);
  margin-bottom: 4px;
  line-height: 1;
}

.overlay-kicker {
  position: relative;
  margin: 0;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.72rem;
  font-weight: 700;
}

.overlay-card h2 {
  position: relative;
  margin: 12px 0 20px;
  font-family: Cinzel, Georgia, serif;
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 800;
  background: linear-gradient(180deg, #fff8dc, var(--gold-bright) 50%, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  word-break: break-word;
  filter: drop-shadow(0 2px 14px rgba(212, 175, 55, 0.4));
}

.verified {
  position: relative;
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 0.85rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(52, 211, 153, 0.14);
  color: var(--ok);
  border: 1px solid rgba(52, 211, 153, 0.45);
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  box-shadow: 0 0 16px rgba(52, 211, 153, 0.15);
}

.badge-check {
  flex-shrink: 0;
}

#sigPreview {
  display: block;
  margin-top: 12px;
  padding: 8px 10px;
  font-size: 0.7rem;
  color: var(--muted);
  word-break: break-all;
  opacity: 0.9;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.overlay-card .btn.secondary {
  position: relative;
  min-width: 128px;
}

/* —— Responsive / iframe —— */
@media (max-width: 420px) {
  .app { padding-left: 12px; padding-right: 12px; }
  .wheel-wrap { margin-top: 14px; }
  .pointer { top: -20px; }
  .pointer-diamond { width: 20px; height: 20px; }
  .pointer-stem {
    border-left-width: 10px;
    border-right-width: 10px;
    border-top-width: 20px;
  }
  .btn.primary {
    letter-spacing: 0.14em;
    font-size: 1.1rem;
    padding: 14px;
  }
  .item-list { max-height: 140px; }
}

/* Keep the wheel and primary controls in view on short desktop windows (e.g. 1280×800). */
@media (max-height: 820px) {
  .app { padding-top: 12px; padding-bottom: 20px; }
  .chrome { margin-bottom: 10px; }
  .brand-mark {
    width: 30px;
    height: 30px;
    margin-bottom: 4px;
    font-size: 0.85rem;
  }
  h1 {
    margin-bottom: 2px;
    font-size: 1.5rem;
  }
  .subtitle { font-size: 0.75rem; }
  .mode-tabs {
    padding: 3px;
    margin-bottom: 10px;
    gap: 2px;
  }
  .tab {
    padding: 7px 14px;
    font-size: 0.82rem;
    gap: 4px;
  }
  .wheel-stage { margin-bottom: 10px; }
  .wheel-wrap {
    width: min(100%, 360px);
    margin-top: 8px;
    margin-bottom: 4px;
  }
  .wheel-rim { inset: -9px; }
  .pointer { top: -20px; }
  .pointer-cap { width: 10px; height: 10px; }
  .pointer-diamond { width: 18px; height: 18px; }
  .pointer-stem {
    border-left-width: 9px;
    border-right-width: 9px;
    border-top-width: 18px;
  }
  .controls {
    margin-top: 0;
    gap: 8px;
  }
  .spin-row { gap: 6px; }
  .btn.mute { flex-basis: 44px; font-size: 1rem; }
  .btn.primary {
    padding: 10px 14px;
    font-size: 1rem;
    box-shadow:
      0 3px 0 #5c4310,
      0 8px 20px rgba(212, 175, 55, 0.35),
      inset 0 1px 0 rgba(255, 255, 255, 0.45);
  }
  .btn.primary:not(:disabled):active {
    transform: translateY(2px);
  }
  .panel { padding: 10px; }
  .add-row {
    gap: 6px;
    margin-bottom: 8px;
  }
  .add-row input {
    padding: 9px 11px;
    font-size: 0.9rem;
  }
  .btn {
    padding: 9px 14px;
    font-size: 0.9rem;
  }
  .item-list { max-height: 96px; }
  .item-list li {
    padding: 7px 10px;
    font-size: 0.88rem;
  }
  .item-list .remove {
    padding: 3px 8px;
    font-size: 0.72rem;
  }
  .list-empty {
    margin-top: 7px;
    font-size: 0.74rem;
  }
}

@media (max-height: 700px) {
  .app { padding-top: 8px; padding-bottom: 14px; }
  .wheel-wrap { width: min(100%, 300px); }
  .item-list { max-height: 64px; }
  h1 { font-size: 1.35rem; }
  .spin-row {
    position: sticky;
    bottom: env(safe-area-inset-bottom, 0);
  }
  .chrome { margin-bottom: 6px; }
  .mode-tabs { margin-bottom: 8px; }
}

body.embed .wheel-wrap {
  width: min(100%, 380px);
}

@media (max-height: 820px) {
  body.embed .wheel-wrap {
    width: min(100%, 340px);
  }
}


/* ── Site gates (shop code / GOML wallet) ─────────────────────────────────── */
.site-gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(6, 10, 18, 0.82);
  backdrop-filter: blur(6px);
}
.site-gate[hidden] { display: none !important; }
.site-gate-card {
  width: min(420px, 100%);
  background: linear-gradient(160deg, #1a2236, #101827);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 14px;
  padding: 1.35rem 1.25rem 1.2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  text-align: center;
}
.site-gate-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #d4af37;
}
.site-gate-card h2 {
  margin: 0.35rem 0 0.5rem;
  font-family: Cinzel, serif;
  font-size: 1.35rem;
}
.site-gate-copy, .site-gate-status {
  color: #9aa8bd;
  font-size: 0.9rem;
  margin: 0 0 0.85rem;
}
.gate-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.5rem;
}
/* Author display:flex beats UA [hidden]; keep gated forms actually hidden */
.gate-form[hidden],
.xaman-pending[hidden],
.site-gate-error[hidden] {
  display: none !important;
}
.gate-form input {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border-radius: 8px;
  border: 1px solid #243049;
  background: #0b1220;
  color: #e8eef8;
  font: inherit;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}
.site-gate-error {
  color: #f07178;
  font-size: 0.85rem;
  margin: 0.65rem 0 0;
}
.xaman-pending img {
  margin: 0.4rem auto;
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}
/* Site-locked (shop/goml): hide editable item list so odds cannot be
   client-tampered, but keep Names/Prizes mode tabs visible for display/demo.
   Fair spins still force server prize list in /api/spin. */
body.site-locked .controls .input-panel {
  display: none !important;
}
body.spin-locked #spinBtn {
  opacity: 0.45;
}
.ticket-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.35rem 0 0.75rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(212,175,55,0.35);
  color: #f0d78c;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}


/* ── Public watch / live embed ───────────────────────────────────────────── */
.watch-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin: 0 auto 0.75rem;
  padding: 0.45rem 0.9rem;
  max-width: 520px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.45);
  background: linear-gradient(180deg, rgba(40, 18, 18, 0.92), rgba(12, 10, 8, 0.95));
  color: #f0d78c;
  font-family: Cinzel, Georgia, serif;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.watch-banner .watch-sub {
  font-family: Inter, system-ui, sans-serif;
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: rgba(245, 240, 230, 0.65);
  text-transform: none;
}
.watch-banner .watch-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #e11d48;
  box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.7);
  animation: watch-pulse 1.4s ease-out infinite;
}
@keyframes watch-pulse {
  0% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(225, 29, 72, 0); }
  100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0); }
}
body.watch-mode .watch-banner[hidden] { display: none; }
body.watch-mode #controls,
body.watch-mode #modeTabs { display: none !important; }
body.watch-mode .chrome { display: none; }
body.watch-mode.embed .app { padding-top: 8px; }
