:root {
  --ink: #111111;
  --muted: #6b6b6b;
  --line: #bdbdbd;
  --line-strong: #8a8a8a;
  --bg: #ffffff;
  --night: #0a0a0a;
  --night-ink: #f5f5f5;
  --night-muted: #bdbdbd;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

button, a { font: inherit; color: inherit; }
a { text-decoration: none; }

::selection { background: var(--ink); color: var(--bg); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

#app {
  height: 100svh;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* ---------- 舞台 ---------- */
.stage-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 20px 0;
}

.stage {
  position: relative;
  flex: 0 1 auto;
  width: clamp(150px, 42vw, 300px);
  height: clamp(150px, 42vw, 300px);
  display: grid;
  place-items: center;
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0) 55%, #ffffff 92%);
}

.stage-shadow {
  position: absolute;
  left: 50%;
  bottom: 4%;
  width: 50%;
  height: 8%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.16), transparent 70%);
  filter: blur(5px);
  z-index: 0;
  pointer-events: none;
}

.ring-image {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 66%, transparent 90%);
  mask-image: radial-gradient(circle at 50% 50%, #000 66%, transparent 90%);
  transition: opacity 0.2s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.ring-image.is-fading { opacity: 0.3; }

.light-ring {
  display: none;
  position: relative;
  z-index: 3;
  width: clamp(130px, 22vh, 190px);
  height: clamp(130px, 22vh, 190px);
  border-radius: 50%;
  border: 1.5px solid #ffffff;
  box-shadow:
    0 0 2px #ffffff,
    0 0 18px rgba(255, 255, 255, 0.85),
    0 0 54px rgba(255, 255, 255, 0.38),
    inset 0 0 14px rgba(255, 255, 255, 0.55);
  animation: pulse 5.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.72; transform: scale(0.985); }
  50% { opacity: 1; transform: scale(1.015); }
}

/* ---------- 文字 ---------- */
.caption {
  flex: 0 0 auto;
  text-align: center;
  max-width: 92vw;
  margin-top: 2px;
}

.price {
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  transition: opacity 0.18s ease;
}

.name {
  margin-top: 2px;
  font-size: 11.5px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.note {
  margin: 3px auto 0;
  max-width: 420px;
  font-size: 10px;
  line-height: 1.6;
  color: var(--muted);
  text-wrap: pretty;
}

.caption.is-changing .price,
.caption.is-changing .name,
.caption.is-changing .note {
  animation: rise 0.24s ease;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 滑杆 ---------- */
.rail-wrap {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.rail {
  position: relative;
  width: min(52vw, 380px);
  height: 46px;
  touch-action: none;
  cursor: ew-resize;
  outline: none;
}

.rail:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 5px;
  border-radius: 2px;
}

.rail-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background-image: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 4px);
  pointer-events: none;
}

.rail-tick {
  position: absolute;
  top: 50%;
  width: 1px;
  height: 5px;
  background: var(--line);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.rail-tick.major { height: 8px; background: var(--line-strong); }

.rail-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 2;
}

.rail-thumb::before {
  content: "";
  width: 1px;
  height: 15px;
  background: var(--ink);
}

.rail-thumb::after {
  content: "";
  position: absolute;
  top: 6px;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 5px solid var(--ink);
}

.rail-label {
  position: absolute;
  top: calc(50% + 9px);
  font-size: 8.5px;
  line-height: 1;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
  letter-spacing: 0.01em;
}

.rail-label.left { left: 0; }
.rail-label.right { right: 0; }

/* ---------- 页脚 ---------- */
.footer {
  margin-top: 2px;
  text-align: center;
}

.wordmark {
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: 0.26em;
  color: var(--muted);
}

.tagline {
  margin-top: 1px;
  font-size: 8px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.links {
  margin-top: -10px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2px;
  font-size: 8.5px;
  color: var(--muted);
}

.links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 4px;
  color: inherit;
}

.links a:hover { color: var(--ink); text-decoration: underline; }

.disclaimer {
  margin: -4px 0 0;
  font-size: 8px;
  line-height: 1.5;
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* ---------- 终章 ---------- */
body.is-finale {
  background: var(--night);
  color: var(--night-ink);
}

body.is-finale .ring-image { display: none; }
body.is-finale .stage::after { display: none; }
body.is-finale .stage-shadow { display: none; }
body.is-finale .light-ring { display: block; }

body.is-finale .price { display: none; }

body.is-finale .name {
  margin-top: 6px;
  font-size: 14px;
  color: var(--night-ink);
}

body.is-finale .note {
  max-width: 360px;
  color: var(--night-muted);
  font-size: 10px;
}

body.is-finale .rail-line {
  background-image: repeating-linear-gradient(90deg, #555 0 1px, transparent 1px 4px);
}

body.is-finale .rail-tick { background: #555; }
body.is-finale .rail-tick.major { background: #888; }
body.is-finale .rail-thumb::before { background: var(--night-ink); }
body.is-finale .rail-thumb::after { border-top-color: var(--night-ink); }
body.is-finale .rail-label { color: var(--night-muted); }
body.is-finale .wordmark { color: var(--night-muted); }
body.is-finale .tagline { color: var(--night-muted); }
body.is-finale .links { color: var(--night-muted); }
body.is-finale .disclaimer { color: #8a8a8a; }
body.is-finale .rail:focus-visible { outline-color: var(--night-ink); }

/* ---------- 小屏 ---------- */
@media (max-width: 700px) {
  .stage-wrap { padding: 8px 16px 0; }
  .stage { width: clamp(150px, 42vw, 300px); height: clamp(150px, 42vw, 300px); }
  .price { font-size: 14px; }
  .name { font-size: 11px; }
  .note { font-size: 9.5px; max-width: 86vw; }
  .rail { width: min(52vw, 380px); height: 44px; }
  .rail-label { top: calc(50% + 8px); font-size: 8px; }
  .wordmark { font-size: 9.5px; }
  .tagline { font-size: 7.5px; }
  .links { font-size: 8px; }
  .disclaimer { font-size: 7.5px; }
}

@media (max-height: 680px) {
  .stage { width: clamp(140px, 38vw, 220px); height: clamp(140px, 38vw, 220px); }
  .stage-wrap { padding-top: 2px; }
  .note { font-size: 9px; }
  .rail { height: 44px; }
  .rail-label { top: calc(50% + 7px); }
  .links { margin-top: -12px; }
}

@media (min-width: 701px) {
  .stage { width: clamp(280px, 26vw, 400px); height: clamp(280px, 26vw, 400px); }
  .rail { width: min(30vw, 420px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
