:root {
  --ink: #fff4e8;
  --muted: #c9b09a;
  --gold: #ffd36a;
  --gold-deep: #c9892a;
  --crimson: #e11d48;
  --jade: #14b8a6;
  --panel: rgba(28, 12, 20, 0.78);
  --font-d: "ZCOOL KuaiLe", "Noto Sans SC", sans-serif;
  --font-b: "Noto Sans SC", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-b);
  color: var(--ink);
  background: #12080e;
  font-size: 17px;
  line-height: 1.45;
  overflow-x: hidden;
}

.scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(255, 211, 106, 0.16), transparent 55%),
    radial-gradient(ellipse 50% 40% at 8% 80%, rgba(225, 29, 72, 0.2), transparent 50%),
    radial-gradient(ellipse 45% 35% at 92% 70%, rgba(20, 184, 166, 0.16), transparent 50%),
    linear-gradient(180deg, #1c0c14 0%, #12080e 55%, #0a0610 100%);
}

.spot {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
}

.spot-a {
  width: 42vw;
  height: 42vw;
  top: -12%;
  left: 28%;
  background: rgba(255, 211, 106, 0.18);
}

.spot-b {
  width: 28vw;
  height: 28vw;
  bottom: 8%;
  left: -6%;
  background: rgba(225, 29, 72, 0.18);
}

.spot-c {
  width: 30vw;
  height: 30vw;
  right: -8%;
  top: 30%;
  background: rgba(20, 184, 166, 0.14);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem 0.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.back {
  color: var(--gold);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}

.back:hover {
  color: #fff;
}

.brand {
  flex: 1;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-d);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1;
}

.brand p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.topbar-tools {
  display: flex;
  gap: 0.5rem;
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem 2.5rem;
  align-items: start;
}

.wheel-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.rig {
  position: relative;
  width: min(72vw, 560px);
  aspect-ratio: 1;
}

.pointer {
  position: absolute;
  top: -18px;
  left: 50%;
  z-index: 3;
  transform: translateX(-50%) rotate(0deg);
  transform-origin: 50% 22%;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.45));
  pointer-events: none;
}

.pointer.is-tick {
  animation: tick 90ms ease-out;
}

@keyframes tick {
  0% { transform: translateX(-50%) rotate(0deg); }
  35% { transform: translateX(-50%) rotate(-18deg); }
  100% { transform: translateX(-50%) rotate(0deg); }
}

.wheel-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow:
    0 0 0 10px #7a4a12,
    0 0 0 14px #ffd36a,
    0 0 0 18px #5a3410,
    0 28px 60px rgba(0, 0, 0, 0.55),
    0 0 80px rgba(255, 211, 106, 0.18);
}

.wheel-wrap.is-settle {
  animation: settle 0.55s ease-out;
}

@keyframes settle {
  0% { filter: brightness(1); }
  30% { filter: brightness(1.18); }
  100% { filter: brightness(1); }
}

#wheel {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  transform: rotate(0deg);
  will-change: transform;
}

.hub-btn {
  position: absolute;
  inset: 50%;
  width: 86px;
  height: 86px;
  margin: -43px 0 0 -43px;
  border: 4px solid #7a4a12;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff6d8, #ffd36a 42%, #c9892a);
  color: #4a2a0c;
  font-family: var(--font-d);
  font-size: 2rem;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 8px 0 #6a3a10, 0 14px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.hub-btn:hover:not(:disabled) {
  filter: brightness(1.06);
}

.hub-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 4px 0 #6a3a10, 0 8px 16px rgba(0, 0, 0, 0.35);
}

.hub-btn:disabled {
  cursor: wait;
  filter: saturate(0.7);
}

.hint {
  margin: 1.1rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.hint strong {
  color: var(--gold);
  font-weight: 800;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 211, 106, 0.18);
  border-radius: 20px;
  padding: 1.1rem 1.15rem 1.2rem;
  backdrop-filter: blur(12px);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.panel-head h2 {
  margin: 0;
  font-family: var(--font-d);
  font-size: 1.45rem;
}

.count {
  color: var(--gold);
  font-weight: 700;
  font-size: 0.9rem;
}

.add-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.add-row input {
  flex: 1;
  min-width: 0;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 211, 106, 0.28);
  background: rgba(8, 4, 8, 0.55);
  color: var(--ink);
  font: inherit;
}

.add-row input:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.btn {
  font: inherit;
  font-weight: 700;
  border-radius: 12px;
  padding: 0.62rem 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn.solid {
  background: var(--gold);
  color: #4a2a0c;
  border-color: #c9892a;
}

.btn.solid:hover {
  filter: brightness(1.05);
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: rgba(255, 244, 232, 0.22);
}

.btn.ghost:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  max-height: min(48vh, 420px);
  overflow: auto;
}

.chips li {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.28rem 0.3rem 0.28rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 244, 232, 0.08);
  border: 1px solid rgba(255, 211, 106, 0.16);
  font-size: 0.92rem;
}

.chips button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
}

.chips button:hover {
  color: #fff;
  background: rgba(225, 29, 72, 0.7);
}

.panel-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255, 211, 106, 0.12);
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.92rem;
}

.toggle input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--gold);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(8, 4, 8, 0.62);
  backdrop-filter: blur(6px);
  padding: 1.5rem;
}

.overlay[hidden] {
  display: none;
}

.result-card {
  text-align: center;
  padding: 2rem 2.2rem 1.6rem;
  border-radius: 28px;
  background-color: #2a121c;
  background-image: linear-gradient(180deg, #3a1824, #160a10);
  border: 2px solid var(--gold);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 60px rgba(255, 211, 106, 0.2);
  min-width: min(90vw, 360px);
  animation: pop 0.55s cubic-bezier(0.16, 1.2, 0.32, 1);
}

@keyframes pop {
  0% { transform: scale(0.72) rotate(-4deg); opacity: 0; }
  60% { transform: scale(1.06) rotate(1deg); }
  100% { transform: scale(1) rotate(0); }
}

.result-kicker {
  margin: 0;
  letter-spacing: 0.28em;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--gold);
}

.result-name {
  margin: 0.55rem 0 1.3rem;
  font-family: var(--font-d);
  font-size: clamp(2.4rem, 8vw, 4.2rem);
  line-height: 1.05;
  color: #fff8eb;
  text-shadow: 0 6px 0 #7a1a32, 0 0 28px rgba(255, 211, 106, 0.45);
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
}

.fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 18;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .pointer.is-tick,
  .result-card {
    animation: none;
  }
}

@media (max-width: 880px) {
  .stage {
    grid-template-columns: 1fr;
  }

  .rig {
    width: min(88vw, 440px);
  }

  .chips {
    max-height: 32vh;
  }
}
