/* ===== 4公里晚餐转盘 ===== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  color-scheme: dark light;
  --bg: #120e0c;
  --bg-2: #221713;
  --surface: rgba(255, 240, 226, 0.055);
  --surface-solid: #241a15;
  --line: rgba(255, 226, 204, 0.13);
  --line-strong: rgba(255, 226, 204, 0.24);
  --ink: #f7ece1;
  --muted: #bda597;
  --accent: #f2734f;
  --accent-dark: #c9482a;
  --accent-ink: #1d120d;
  --gold: #f0bd6e;
  --hub-bg: #241511;
  --hub-ink: #fbeadb;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --radius: 20px;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbf2e7;
    --bg-2: #fff9f1;
    --surface: rgba(255, 255, 255, 0.72);
    --surface-solid: #fffaf3;
    --line: rgba(96, 58, 36, 0.14);
    --line-strong: rgba(96, 58, 36, 0.26);
    --ink: #2b1a12;
    --muted: #7d6455;
    --accent: #d94f30;
    --accent-dark: #b23a20;
    --accent-ink: #fff8f0;
    --gold: #b9762a;
    --shadow: 0 20px 44px rgba(120, 80, 50, 0.15);
  }
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  padding: clamp(18px, 4vw, 34px) clamp(14px, 4vw, 28px) 44px;
  background:
    radial-gradient(120% 70% at 50% -8%, var(--bg-2), transparent 72%),
    radial-gradient(90% 60% at 85% 100%, rgba(242, 115, 79, 0.08), transparent 70%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 1060px;
  margin: 0 auto;
  display: grid;
  gap: clamp(14px, 2.4vw, 20px);
}

/* ---------- 头部 ---------- */

.top {
  display: grid;
  gap: 10px;
  padding-bottom: 4px;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}

h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(30px, 7.4vw, 46px);
  line-height: 1.14;
  letter-spacing: -0.01em;
}

h1 em {
  font-style: normal;
  color: var(--accent);
}

h1 .num {
  font-variant-numeric: tabular-nums;
}

.lede {
  margin: 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: clamp(14px, 3.4vw, 15.5px);
}

.top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.top-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

.layout {
  display: grid;
  gap: clamp(14px, 2.4vw, 20px);
  align-items: start;
}

.stage-col,
.side-col {
  display: grid;
  gap: clamp(14px, 2.4vw, 20px);
  min-width: 0;
}

/* ---------- 卡片 ---------- */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(15px, 3.6vw, 20px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  min-width: 0;
}

.card > h2 {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

/* ---------- 按钮与控件 ---------- */

.btn {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 11px 20px;
  min-height: 46px;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.2s ease, color 0.2s ease,
    border-color 0.2s ease, opacity 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 24px rgba(242, 115, 79, 0.28);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.pill-btn {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 32px;
  cursor: pointer;
}

.pill-btn[aria-pressed="true"] {
  color: var(--ink);
  border-color: var(--line-strong);
}

.pill-btn:focus-visible,
.btn:focus-visible,
.chip:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 场地设置 ---------- */

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  min-width: 0;
}

.field:last-child {
  margin-bottom: 0;
}

.field > label,
.field > .label {
  font-size: 12.5px;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}

input[type="text"],
input[type="number"],
select {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: rgba(127, 96, 74, 0.14);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
  min-width: 0;
}

input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 40px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.chip:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.hint {
  margin: 10px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}

.hint strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- 转盘 ---------- */

.wheel-card {
  padding: clamp(12px, 3vw, 18px);
  display: grid;
  gap: 14px;
  justify-items: center;
}

.wheel-wrap {
  position: relative;
  width: 100%;
  max-width: 430px;
  aspect-ratio: 1 / 1;
  margin-top: 4px;
}

.wheel-wrap::before {
  content: "";
  position: absolute;
  inset: 2%;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--line), 0 22px 50px rgba(0, 0, 0, 0.32);
  pointer-events: none;
}

#wheel {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

#wheelRot {
  transform-origin: 200px 200px;
  transition: none;
  will-change: transform;
}

#wheelRot.spinning {
  transition: transform 4.3s cubic-bezier(0.14, 0.72, 0.04, 1);
}

.wheel-seg {
  stroke: rgba(24, 14, 10, 0.22);
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.wheel-label {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  fill: #2a1a12;
  letter-spacing: 0.01em;
}

.wheel-emoji {
  font-size: 17px;
}

.pointer {
  position: absolute;
  top: 0.6%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 25px solid var(--accent);
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.4));
  z-index: 3;
  pointer-events: none;
}

.pointer::after {
  content: "";
  position: absolute;
  left: -9px;
  top: -30px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
}

.hub {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 27%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 2px solid rgba(255, 236, 220, 0.22);
  background: radial-gradient(circle at 35% 28%, #4a2a1f, var(--hub-bg) 62%);
  color: var(--hub-ink);
  font-family: var(--font-serif);
  font-size: clamp(13px, 3.2vw, 16px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  cursor: pointer;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 0 6px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4), inset 0 0 0 6px rgba(255, 255, 255, 0.03);
  transition: transform 0.18s ease, background 0.2s ease;
}

.hub:hover:not(:disabled) {
  background: radial-gradient(circle at 35% 28%, #5c3225, #2d1a14 62%);
}

.hub:active:not(:disabled) {
  transform: translate(-50%, -50%) scale(0.96);
}

.hub:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.hub .hub-sub {
  display: block;
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  opacity: 0.62;
  margin-top: 2px;
}

.wheel-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

.wheel-meta b {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- 结果 ---------- */

.result {
  display: grid;
  gap: 12px;
  min-height: 150px;
  align-content: start;
}

.result-kicker {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}

.result-idle {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  max-width: 34ch;
}

.result-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.result-emoji {
  font-size: 30px;
  line-height: 1;
}

.result-name {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(26px, 7vw, 34px);
  line-height: 1.15;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.result-meta {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.result-meta b {
  color: var(--ink);
  font-weight: 600;
}

.result-note {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: rgba(127, 96, 74, 0.16);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 2px;
}

.result-actions .btn {
  flex: 1 1 auto;
}

.confirmed {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px dashed var(--line-strong);
  background: rgba(242, 115, 79, 0.09);
}

.confirmed-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
}

.confirmed-sub {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 页脚 ---------- */

.foot {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 70ch;
}

.foot strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- 响应式 ---------- */

@media (min-width: 940px) {
  .layout {
    grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  }

  .stage-col {
    position: sticky;
    top: 20px;
  }
}

@media (max-width: 420px) {
  .result-actions .btn {
    flex: 1 1 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  #wheelRot.spinning {
    transition-duration: 0.9s;
  }

  .btn,
  .hub {
    transition: none;
  }
}
