:root {
  color-scheme: light;
  --tomato: #ff3d2e;
  --cheese: #ffd23f;
  --cream: #fff7df;
  --cola: #171515;
  --mint: #18c7a3;
  --pink: #ff4fa3;
  --blue: #1f7aff;
  --ink: #181310;
  --muted: #715d4e;
  --card: rgba(255, 247, 223, 0.94);
  --line: rgba(23, 21, 21, 0.14);
  --shadow: rgba(23, 21, 21, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 14%, rgba(255, 210, 63, 0.9), transparent 15rem),
    radial-gradient(circle at 94% 6%, rgba(24, 199, 163, 0.72), transparent 16rem),
    radial-gradient(circle at 75% 86%, rgba(255, 79, 163, 0.5), transparent 17rem),
    linear-gradient(135deg, #fff1b8 0%, #fff7df 46%, #ffd1c5 100%);
}

button {
  border: 0;
  font: inherit;
}

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


.food-pop {
  position: fixed;
  left: 50%;
  top: 48%;
  z-index: 24;
  display: grid;
  place-items: center;
  width: 82px;
  aspect-ratio: 1;
  border: 4px solid var(--cola);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 5px 7px 0 var(--cola);
  font-size: 46px;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.72);
}

.food-pop.is-active {
  animation: foodPop 820ms cubic-bezier(0.18, 1.3, 0.32, 1) forwards;
}

.app-shell {
  width: min(1180px, calc(100% - 18px));
  margin: 0 auto;
  padding: 10px 0 36px;
}

.screen {
  display: none;
  min-height: calc(100vh - 20px);
  border: 3px solid var(--cola);
  border-radius: 24px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.34) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.32) 1px, transparent 1px),
    rgba(255, 247, 223, 0.78);
  background-size: 30px 30px;
  box-shadow: 6px 7px 0 var(--cola), 0 24px 70px var(--shadow);
}

.screen.is-active {
  display: block;
}

.identity-screen {
  padding: 18px;
}

.hero-copy,
.wheel-copy {
  display: grid;
  justify-items: center;
  text-align: center;
}

.kicker,
.mini-label,
.result-eyebrow {
  margin: 0;
  font-weight: 900;
  letter-spacing: 0;
}

.kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 11px;
  border: 2px solid var(--cola);
  border-radius: 999px;
  background: var(--mint);
  color: var(--cola);
  box-shadow: 2px 3px 0 rgba(23, 21, 21, 0.88);
  font-size: 12px;
}

h1 {
  margin: 12px 0 8px;
  font-size: clamp(44px, 13vw, 108px);
  line-height: 0.96;
  letter-spacing: 0;
  text-shadow: 3px 4px 0 var(--cheese);
}

.subtitle {
  margin: 0;
  max-width: 680px;
  color: #4f4037;
  font-size: clamp(16px, 4.2vw, 24px);
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
}

.identity-grid {
  width: min(980px, 100%);
  margin: 24px auto 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.identity-card {
  min-height: 116px;
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 3px solid var(--cola);
  border-radius: 22px;
  background: var(--scene-color, var(--cream));
  color: var(--cola);
  cursor: pointer;
  text-align: left;
  box-shadow: 6px 7px 0 var(--cola);
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}

.identity-card:hover {
  transform: translate(-2px, -4px) rotate(-0.4deg);
  box-shadow: 9px 11px 0 var(--cola);
  filter: saturate(1.08);
}

.identity-icon {
  width: 62px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 3px solid var(--cola);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 34px;
  box-shadow: 3px 4px 0 var(--cola);
}

.identity-card strong {
  display: block;
  font-size: 23px;
  line-height: 1.15;
}

.identity-card span:last-child {
  display: block;
  margin-top: 6px;
  color: rgba(23, 21, 21, 0.76);
  font-weight: 800;
  line-height: 1.45;
}

.wheel-screen {
  position: relative;
  padding: 16px;
}

.back-action {
  min-height: 38px;
  padding: 0 13px;
  border: 3px solid var(--cola);
  border-radius: 999px;
  background: #fff;
  color: var(--cola);
  cursor: pointer;
  font-weight: 900;
  box-shadow: 3px 4px 0 var(--cola);
}

.wheel-copy {
  margin-top: 8px;
}

.wheel-copy h1 {
  margin: 8px 0 5px;
  font-size: clamp(32px, 9vw, 64px);
  text-shadow: 2px 3px 0 var(--cheese);
}

.wheel-copy .subtitle {
  font-size: clamp(15px, 4vw, 20px);
}

.playground {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: center;
  margin-top: 18px;
}

.wheel-zone {
  position: relative;
  display: grid;
  justify-items: center;
}

.pointer {
  position: absolute;
  top: -1px;
  z-index: 4;
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 42px solid var(--tomato);
  filter: drop-shadow(3px 5px 0 var(--cola));
}

.wheel-wrap {
  position: relative;
  width: min(520px, 92vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

#wheelCanvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 7px solid var(--cola);
  background: var(--cream);
  box-shadow: 7px 8px 0 var(--cola), 0 20px 42px rgba(0, 0, 0, 0.2);
  will-change: transform;
}

.wheel-center {
  position: absolute;
  width: min(126px, 27%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  border: 4px solid var(--cola);
  border-radius: 50%;
  background: var(--cheese);
  color: var(--cola);
  cursor: pointer;
  box-shadow: 4px 6px 0 var(--cola), 0 0 0 0 rgba(255, 210, 63, 0.45), inset 0 -8px 0 rgba(23, 21, 21, 0.08);
  animation: centerBreath 1800ms ease-in-out infinite;
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
  z-index: 3;
}

.wheel-center strong {
  font-size: clamp(17px, 5vw, 28px);
  line-height: 1;
}

.wheel-center span {
  max-width: 92px;
  font-size: 11px;
  font-weight: 900;
}

.wheel-center:hover:not(:disabled) {
  transform: scale(1.06);
  box-shadow: 6px 9px 0 var(--cola), 0 0 0 6px rgba(255, 210, 63, 0.34), inset 0 -8px 0 rgba(23, 21, 21, 0.08);
  filter: saturate(1.08);
}

.wheel-center:active:not(:disabled) {
  transform: translateY(4px) scale(0.98);
  box-shadow: 2px 3px 0 var(--cola), inset 0 5px 0 rgba(23, 21, 21, 0.1);
}

.wheel-center:focus-visible {
  outline: 4px solid var(--tomato);
  outline-offset: 4px;
}

.wheel-center:disabled {
  cursor: wait;
  opacity: 0.94;
}

.wheel-center.is-spinning {
  animation: centerPulse 650ms ease-in-out infinite;
}

.wheel-center.has-result {
  background: linear-gradient(180deg, var(--cheese), #ffb703);
}

.side-panel {
  display: grid;
  gap: 12px;
}

.snack-board,
.preview-list {
  border: 3px solid var(--cola);
  border-radius: 20px;
  background: var(--card);
  box-shadow: 5px 6px 0 var(--cola);
}

.snack-board {
  padding: 14px;
}

.snack-board div {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.55;
}

.mini-label {
  color: var(--tomato);
  font-size: 12px;
}

.preview-list {
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preview-item {
  min-height: 48px;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 8px;
  align-items: center;
  padding: 7px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
}

.preview-item span {
  font-size: 23px;
}

.preview-item strong {
  display: block;
  font-size: 13px;
  line-height: 1.25;
}

.preview-item small {
  color: var(--muted);
  font-size: 11px;
}

.result-dialog {
  width: min(640px, calc(100% - 18px));
  max-height: min(94vh, 860px);
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
}

.result-dialog::backdrop {
  background: rgba(23, 21, 21, 0.62);
  backdrop-filter: blur(5px);
}

.result-card {
  position: relative;
  overflow: auto;
  max-height: min(94vh, 860px);
  padding: 22px;
  border: 4px solid var(--cola);
  border-radius: 26px;
  background:
    radial-gradient(circle at 18% 8%, var(--result-color, rgba(255, 210, 63, 0.86)), transparent 9rem),
    var(--cream);
  box-shadow: 7px 8px 0 var(--cola);
  animation: resultSlideBoom 520ms cubic-bezier(0.18, 1.34, 0.32, 1);
}

.icon-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  aspect-ratio: 1;
  border: 3px solid var(--cola);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.result-eyebrow,
.scene-chip {
  display: inline-flex;
  margin: 0 8px 0 0;
  padding: 7px 12px;
  border: 3px solid var(--cola);
  border-radius: 999px;
  background: var(--mint);
  font-weight: 900;
}

.scene-chip {
  background: #fff;
}

.result-burst {
  margin: 14px 0 8px;
  font-size: clamp(70px, 22vw, 112px);
  line-height: 1;
  filter: drop-shadow(5px 6px 0 rgba(23, 21, 21, 0.28));
}

.result-card h2 {
  margin: 0;
  font-size: clamp(28px, 8vw, 48px);
  line-height: 1.1;
}

.result-note {
  margin: 12px 0 0;
  display: inline-flex;
  padding: 9px 12px;
  border: 3px solid var(--cola);
  border-radius: 14px;
  background: #fff;
  box-shadow: 3px 4px 0 var(--cola);
  font-weight: 900;
}

.reason-box,
.action-tip,
.result-lists section {
  margin-top: 14px;
  padding: 13px;
  border: 3px solid var(--cola);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.reason-box p:last-child,
.action-tip p:last-child {
  margin: 6px 0 0;
  line-height: 1.6;
}

.result-lists {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.result-lists ul {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-lists li {
  padding: 7px 9px;
  border: 2px solid var(--cola);
  border-radius: 999px;
  background: var(--cheese);
  font-weight: 900;
  font-size: 13px;
}

.result-lists section:last-child li {
  background: #fff;
}

.result-actions {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.secondary-action {
  min-height: 52px;
  padding: 0 12px;
  border: 3px solid var(--cola);
  border-radius: 16px;
  color: var(--cola);
  background: #fff;
  cursor: pointer;
  font-weight: 900;
  box-shadow: 4px 5px 0 var(--cola);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.secondary-action:hover {
  transform: translate(-2px, -3px);
  box-shadow: 7px 8px 0 var(--cola);
}

.secondary-action.obey {
  background: var(--mint);
}

.secondary-action.reroll {
  background: var(--tomato);
  color: #fff;
}

.secondary-action.copy {
  background: var(--cheese);
}

.secondary-action.choose {
  background: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 30;
  max-width: min(460px, calc(100% - 24px));
  padding: 12px 16px;
  border: 3px solid var(--cola);
  border-radius: 999px;
  color: var(--cola);
  background: var(--cheese);
  box-shadow: 5px 6px 0 var(--cola);
  font-weight: 900;
  transform: translate(-50%, 90px);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

@keyframes resultBoom {
  0% {
    opacity: 0;
    transform: scale(0.78) rotate(-4deg);
  }
  70% {
    opacity: 1;
    transform: scale(1.04) rotate(1deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes centerPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

@media (min-width: 700px) {
  .app-shell {
    width: min(1180px, calc(100% - 32px));
    padding-top: 18px;
  }

  .screen {
    min-height: calc(100vh - 36px);
    border-width: 4px;
    box-shadow: 10px 12px 0 var(--cola), 0 28px 80px var(--shadow);
  }

  .identity-screen,
  .wheel-screen {
    padding: clamp(24px, 4vw, 38px);
  }

  .identity-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .identity-card {
    min-height: 150px;
    grid-template-columns: 84px 1fr;
    padding: 20px;
  }

  .identity-icon {
    width: 76px;
    font-size: 42px;
  }

  .identity-card strong {
    font-size: 28px;
  }

  .playground {
    grid-template-columns: minmax(360px, 1.1fr) minmax(280px, 0.9fr);
    gap: clamp(22px, 4vw, 44px);
    margin-top: 28px;
  }

  .side-panel {
    order: initial;
  }

  .preview-list {
    grid-template-columns: 1fr;
  }

  .result-card {
    padding: 30px;
    border-width: 5px;
    box-shadow: 10px 12px 0 var(--cola);
  }

  .result-lists {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .result-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1020px) {
  .identity-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* center-button-motion */
.wheel-center:hover:not(:disabled),
.wheel-center:active:not(:disabled) {
  animation-play-state: paused;
}

/* center-result-motion */
.wheel-center.has-result {
  animation: centerBreath 1800ms ease-in-out infinite;
}

@keyframes resultSlideBoom {
  0% { opacity: 0; transform: translateY(56px) scale(0.88) rotate(-2deg); }
  68% { opacity: 1; transform: translateY(-8px) scale(1.03) rotate(0.6deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}

@keyframes foodPop {
  0% { opacity: 0; transform: translate(-50%, -38%) scale(0.62); }
  36% { opacity: 1; transform: translate(-50%, -128%) scale(1.18) rotate(-6deg); }
  72% { opacity: 1; transform: translate(-50%, -156%) scale(1) rotate(3deg); }
  100% { opacity: 0; transform: translate(-50%, -178%) scale(0.9) rotate(0deg); }
}

@keyframes centerBreath {
  0%, 100% { box-shadow: 4px 6px 0 var(--cola), 0 0 0 0 rgba(255, 210, 63, 0.34), inset 0 -8px 0 rgba(23, 21, 21, 0.08); }
  50% { box-shadow: 5px 7px 0 var(--cola), 0 0 0 8px rgba(255, 210, 63, 0.22), inset 0 -8px 0 rgba(23, 21, 21, 0.08); }
}
