body[data-theme="emperor"] {
  background:
    radial-gradient(900px 700px at 80% 0%, rgba(91, 25, 61, 0.35), transparent 60%),
    radial-gradient(700px 500px at 0% 30%, rgba(16, 155, 150, 0.18), transparent 60%),
    var(--bg);
}

/* Give the court (hero) the lion's share of width; keep a tidy control rail.
   Scoped to desktop so it never out-specifies the shell's mobile 1-col rule. */
@media (min-width: 921px) {
  body[data-theme="emperor"] .scene-grid {
    grid-template-columns: minmax(0, 1fr) clamp(280px, 26%, 340px);
  }
}

/* ── How to play: a confident, full-width strip (not the shared grid) ── */
.play-hints {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.play-hint {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(244, 195, 91, 0.05), transparent 60%), var(--bg-soft);
  box-shadow: var(--shadow-1);
}

.hint-num {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}

.hint-body { display: grid; gap: 3px; }
.hint-title { font-size: 0.96rem; font-weight: 600; color: var(--text); }
.hint-text { font-size: 0.88rem; line-height: 1.45; color: var(--muted); }

@media (max-width: 760px) {
  .play-hints { grid-template-columns: 1fr; }
}

.emperor-court {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    radial-gradient(700px 500px at 50% 0%, rgba(244, 195, 91, 0.06), transparent 70%),
    var(--bg-soft);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  touch-action: manipulation;
}

/* Hero: emperor on a raised dais with the two jars grounded in front. */
.court-stage {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 8px 8px 26px;
  border-radius: var(--radius);
}

.court-stage::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: min(620px, 96%);
  height: 120px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(60% 100% at 50% 100%, rgba(244, 195, 91, 0.14), transparent 72%);
  pointer-events: none;
}

.emperor-figure {
  position: relative;
  display: grid;
  justify-content: center;
  z-index: 1;
}

.emperor-figure svg {
  width: 188px;
  height: 208px;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.55));
}

.emperor-figure::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 150px;
  height: 22px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(50% 100% at 50% 50%, rgba(0, 0, 0, 0.45), transparent 70%);
}

.emperor-figure.commanding {
  animation: emperor-bow 700ms var(--ease);
}

@keyframes emperor-bow {
  0%, 100% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-6px) scale(1.04); }
}

.verdict {
  min-height: 64px;
  display: grid;
  place-items: center;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 70%), var(--surface);
  border: 1px solid var(--border-strong);
  text-align: center;
  font-size: 1.16rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text);
  line-height: 1.4;
}

.verdict.win { background: rgba(74, 222, 128, 0.1); border-color: rgba(74, 222, 128, 0.32); color: #d1fae5; }
.verdict.lose { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.32); color: #fecaca; }

/* ── Jars ── */
.jars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: end;
}

.jar-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.jar-card.chosen {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 18px 60px rgba(244, 195, 91, 0.18);
  animation: jar-shake 560ms var(--ease);
}

@keyframes jar-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

.jar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.jar-label { display: grid; gap: 2px; }

.jar-letter {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.jar-count { font-size: 1.02rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.jar-odds {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.jar-glass {
  position: relative;
  height: 288px;
  border: 3px solid rgba(255, 255, 255, 0.34);
  border-top-width: 6px;
  border-radius: 32px 32px 56px 56px / 24px 24px 60px 60px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02) 26%, rgba(255, 255, 255, 0.08) 70%, rgba(255, 255, 255, 0.02)),
    linear-gradient(180deg, rgba(16, 155, 150, 0.06), rgba(244, 195, 91, 0.03));
  box-shadow:
    inset 0 0 30px rgba(255, 255, 255, 0.06),
    inset 0 -30px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease), background 160ms var(--ease);
}

.jar-mouth {
  position: absolute;
  inset: 6px 18px auto;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.32);
  filter: blur(1px);
  pointer-events: none;
}

.jar-hint {
  position: absolute;
  left: 0;
  right: 0;
  top: 48%;
  text-align: center;
  font-size: 0.74rem;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--dim);
  pointer-events: none;
  transition: opacity 200ms var(--ease);
}

/* Drop / pour feedback — both jars are live targets */
.jar-glass.drop-active,
.tray-basin.drop-active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(244, 195, 91, 0.5), 0 0 28px rgba(244, 195, 91, 0.25);
  background:
    linear-gradient(180deg, rgba(244, 195, 91, 0.12), rgba(244, 195, 91, 0.03));
}

.jar-glass.pouring {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(244, 195, 91, 0.45), 0 0 22px rgba(244, 195, 91, 0.2);
}

/* ── Tray (marbles in hand) ── */
.tray-card {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.tray-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.tray-title {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.tray-caption {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Two colour piles in the hand — each is its own pourable bucket. */
.tray-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  border-radius: 14px;
  transition: box-shadow 160ms var(--ease);
}

.tray-row.drop-active {
  box-shadow: 0 0 0 2px rgba(244, 195, 91, 0.5), 0 0 28px rgba(244, 195, 91, 0.22);
}

.tray-pile {
  display: grid;
  gap: 8px;
  transition: opacity 180ms var(--ease);
}

.tray-pile.dim { opacity: 0.42; }
.tray-pile.depleted { opacity: 0.32; }

.pile-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 160ms var(--ease), background 160ms var(--ease), color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.pile-chip:hover:not(:disabled) { border-color: var(--border-strong); }
.pile-chip:disabled { cursor: not-allowed; }

.pile-chip.armed {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(244, 195, 91, 0.4), 0 6px 18px rgba(244, 195, 91, 0.12);
}

.chip-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}
.chip-dot.white { background: radial-gradient(circle at 32% 26%, #fff, #fff5d6 38%, #d4c9b0 78%); border: 1px solid rgba(80, 65, 40, 0.5); }
.chip-dot.black { background: radial-gradient(circle at 32% 24%, #6b6470, #1a1820 38%, #050507 80%); border: 1px solid rgba(255, 255, 255, 0.16); }

.chip-label { letter-spacing: 0; }
.chip-count {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
}

.pile-basin {
  position: relative;
  height: 116px;
  border-radius: 14px;
  border: 1px dashed var(--border-strong);
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(255, 255, 255, 0.05), transparent 70%),
    rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 -14px 24px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  touch-action: none;
}

.tray-pile.white .pile-basin { box-shadow: inset 0 -14px 24px rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(244, 195, 91, 0.05); }

/* ── Marbles ── */
.marbles {
  position: absolute;
  inset: 14px 10px 10px;
}

.pile-basin .marbles { inset: 8px 10px 6px; }

.marble {
  position: absolute;
  left: 0;
  top: 0;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.32);
  cursor: grab;
  touch-action: none;
  will-change: transform;
  z-index: 1;
}

.marble:active { cursor: grabbing; }

.marble.dragging {
  z-index: 50;
  cursor: grabbing;
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.5), 0 0 22px rgba(244, 195, 91, 0.35);
}

.marble.white {
  background: radial-gradient(circle at 32% 26%, #fff, #fff5d6 38%, #d4c9b0 78%);
  border: 1px solid rgba(80, 65, 40, 0.5);
}
.marble.black {
  background: radial-gradient(circle at 32% 24%, #6b6470, #1a1820 38%, #050507 80%);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.flying-marble {
  position: fixed;
  z-index: 4;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.4), 0 0 22px rgba(244, 195, 91, 0.3);
}
.flying-marble.white { background: radial-gradient(circle at 32% 26%, #fff, #fff5d6 38%, #d4c9b0 78%); }
.flying-marble.black { background: radial-gradient(circle at 32% 24%, #6b6470, #1a1820 38%, #050507 80%); }

/* ── Odds readout ── */
.odds-readout {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(244, 195, 91, 0.08), transparent 50%), var(--surface);
  border: 1px solid var(--border);
}

.odds-value {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.odds-meter {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.odds-meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #4ade80);
  width: var(--chance, 0%);
  transition: width 400ms var(--ease);
}

.odds-marker {
  position: absolute;
  top: -2px;
  width: 2px;
  height: 12px;
}

.odds-marker.fifty { left: 50%; background: var(--dim); }
.odds-marker.cap { left: 74.747%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* ── History ── */
.history {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.history li {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--muted);
  list-style: none;
}

.history li.win { border-color: rgba(74, 222, 128, 0.32); color: #d1fae5; }
.history li.lose { border-color: rgba(248, 113, 113, 0.3); color: #fecaca; }

.mini-marble {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.32);
}

.mini-marble.white { background: radial-gradient(circle at 32% 24%, #fff, #fff3c8 42%, #d8c9a6 78%); }
.mini-marble.black { background: radial-gradient(circle at 32% 24%, #76707c, #15151d 45%, #020204 82%); }

@media (max-width: 520px) {
  .jar-glass { height: 200px; }
  .pile-basin { height: 104px; }
  .pile-chip { padding: 7px 10px; font-size: 0.82rem; }
}

@media (prefers-reduced-motion: reduce) {
  .marble, .odds-meter span { transition: none; }
  .emperor-figure.commanding, .jar-card.chosen { animation: none; }
}
