:root {
  --paper: #f3ebdd;
  --paper-2: #faf4e8;
  --ink: #241f19;
  --muted: #6d6154;
  --line: rgba(52, 41, 28, 0.14);
  --accent: #b8532e;
  --teal: #1d626c;
  --shadow: 0 26px 60px -32px rgba(46, 32, 18, 0.55);
  color-scheme: light dark;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(120% 90% at 12% -10%, #fffaf0 0%, transparent 60%),
    radial-gradient(100% 80% at 92% 0%, #f7e6cd 0%, transparent 55%),
    var(--paper);
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", "Source Han Serif SC", "Georgia", "Times New Roman", serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 52px) clamp(14px, 4vw, 44px) clamp(28px, 5vw, 64px);
}

/* ---------- 标题 ---------- */
.masthead {
  max-width: 46ch;
  margin: 0 0 clamp(18px, 3vw, 30px);
}

.eyebrow {
  margin: 0 0 10px;
  font-family: "Helvetica Neue", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(30px, 6.4vw, 56px);
  line-height: 1.1;
  letter-spacing: 0.01em;
  font-weight: 600;
}

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

/* ---------- 舞台 ---------- */
.stage {
  position: relative;
  isolation: isolate;
  aspect-ratio: 1440 / 760;
  border-radius: clamp(16px, 3vw, 26px);
  overflow: hidden;
  background: #bfd8d8;
  box-shadow: var(--shadow);
}

.stage svg#scene {
  display: block;
  width: 100%;
  height: 100%;
}

.dusk-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 900ms ease;
  background:
    linear-gradient(178deg, rgba(58, 40, 84, 0.62) 0%, rgba(158, 70, 92, 0.34) 46%, rgba(226, 120, 52, 0.42) 100%);
  mix-blend-mode: multiply;
}

.stage.dusk .dusk-veil { opacity: 1; }
.stage.dusk .sunhalo { opacity: 0.75; }

/* ---------- 数据浮层 ---------- */
.hud {
  position: absolute;
  left: clamp(10px, 2vw, 22px);
  bottom: clamp(10px, 2vw, 22px);
  margin: 0;
  padding: 10px 14px 11px;
  border-radius: 16px;
  background: rgba(253, 247, 235, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 12px 28px -18px rgba(30, 20, 10, 0.7);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  color: #2a241c;
  max-width: calc(100% - 20px);
}

.hud-speed {
  margin: 0 0 6px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.hud-speed span {
  font-size: clamp(22px, 3.6vw, 32px);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hud-speed em {
  font-style: normal;
  font-family: "Helvetica Neue", system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #7b6a55;
}

.hud-facts {
  display: flex;
  gap: clamp(8px, 2vw, 18px);
  margin: 0;
}

.hud-facts div { display: flex; flex-direction: column; gap: 1px; }

.hud-facts dt {
  font-family: "Helvetica Neue", system-ui, sans-serif;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  color: #8b7a63;
}

.hud-facts dd {
  margin: 0;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: #3d352a;
  white-space: nowrap;
}

/* ---------- 车铃 ---------- */
.bell-button {
  position: absolute;
  right: clamp(10px, 2vw, 22px);
  bottom: clamp(10px, 2vw, 22px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(253, 247, 235, 0.86);
  color: #2f4d4b;
  font: inherit;
  font-size: 14px;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 12px 28px -18px rgba(30, 20, 10, 0.7);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  transition: transform 160ms ease, background 200ms ease;
}

.bell-button:hover { background: #fffdf6; }
.bell-button:active { transform: scale(0.96); }
.bell-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.bell-icon { display: inline-flex; color: #b8532e; }
.bell-button.is-ringing .bell-icon { animation: bellShake 620ms ease; }

@keyframes bellShake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-18deg); }
  40% { transform: rotate(14deg); }
  60% { transform: rotate(-9deg); }
  80% { transform: rotate(5deg); }
}

.stage-caption {
  position: absolute;
  left: 50%;
  bottom: clamp(14px, 2vw, 26px);
  transform: translateX(-50%);
  margin: 0;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(28, 24, 18, 0.34);
  color: #fdf6e6;
  font-family: "Helvetica Neue", "PingFang SC", system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.2em;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
}

/* ---------- 控制台 ---------- */
.console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: clamp(14px, 3vw, 34px);
  margin-top: clamp(14px, 2.4vw, 22px);
  padding: clamp(14px, 2.6vw, 22px) clamp(14px, 2.6vw, 24px);
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 252, 244, 0.82), rgba(255, 250, 240, 0.55));
  box-shadow: 0 18px 40px -34px rgba(48, 33, 18, 0.7);
}

.speed-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.speed-head label {
  font-size: 13px;
  letter-spacing: 0.16em;
  color: var(--muted);
  font-family: "Helvetica Neue", "PingFang SC", system-ui, sans-serif;
}

.speed-head output {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

input[type="range"] {
  display: block;
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 0;
  background: transparent;
  accent-color: var(--accent);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #cfc0a6, #b8532e);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #cfc0a6, #b8532e);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -9px;
  border-radius: 50%;
  background: #fffaf0;
  border: 2px solid #b8532e;
  box-shadow: 0 4px 10px -4px rgba(40, 20, 10, 0.65);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fffaf0;
  border: 2px solid #b8532e;
}

input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 8px; }

.hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 46ch;
}

.buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.buttons button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.9);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 150ms ease, background 200ms ease, color 200ms ease;
}

.buttons button:hover { background: #fff; }
.buttons button:active { transform: scale(0.97); }
.buttons button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.buttons button[aria-pressed="true"] {
  background: #2f4d4b;
  border-color: #2f4d4b;
  color: #f7f0df;
}

/* ---------- 说明 ---------- */
.notes {
  margin-top: clamp(30px, 5vw, 54px);
  padding-top: clamp(20px, 3vw, 30px);
  border-top: 1px solid var(--line);
}

.notes h2 {
  margin: 0 0 clamp(16px, 2.6vw, 24px);
  font-size: clamp(19px, 3.2vw, 25px);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.note-list {
  list-style: none;
  counter-reset: note;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: clamp(16px, 3vw, 30px);
  margin: 0;
  padding: 0;
}

.note-list li { counter-increment: note; }

.note-list li::before {
  content: counter(note, decimal-leading-zero);
  display: block;
  margin-bottom: 6px;
  font-family: "Helvetica Neue", system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.note-list h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
}

.note-list p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--muted);
}

.colophon {
  margin: clamp(22px, 4vw, 34px) 0 0;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .console { grid-template-columns: minmax(0, 1fr); }
  .buttons { justify-content: stretch; }
  .buttons button { flex: 1 1 auto; }
  .stage {
    aspect-ratio: 1 / 1;
    border-radius: 18px;
  }
  .stage-caption { display: none; }
  .hud { padding: 8px 11px 9px; }
  .bell-button { padding: 0 13px; font-size: 12.5px; }
}

@media (max-width: 380px) {
  .hud-speed span { font-size: 20px; }
  .hud-facts { gap: 8px; }
  .hud-facts dd { font-size: 11.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .dusk-veil,
  .buttons button,
  .bell-button { transition-duration: 1ms; }
  .bell-button.is-ringing .bell-icon { animation: none; }
}

/* ---------- 深色外观 ---------- */
@media (prefers-color-scheme: dark) {
  body {
    background:
      radial-gradient(120% 90% at 10% -10%, #322a22 0%, transparent 60%),
      radial-gradient(100% 80% at 92% 0%, #262b2a 0%, transparent 55%),
      #17140f;
    color: #f1e8d8;
  }
  :root {
    --paper: #17140f;
    --paper-2: #201b15;
    --ink: #f1e8d8;
    --muted: #b6a894;
    --line: rgba(240, 228, 208, 0.16);
    --accent: #e08a5c;
    --shadow: 0 26px 60px -34px rgba(0, 0, 0, 0.9);
  }
  .console {
    background: linear-gradient(180deg, rgba(255, 248, 236, 0.07), rgba(255, 248, 236, 0.03));
  }
  .buttons button {
    background: rgba(255, 248, 236, 0.08);
    color: #f1e8d8;
    border-color: rgba(240, 228, 208, 0.2);
  }
  .buttons button:hover { background: rgba(255, 248, 236, 0.14); }
  .buttons button[aria-pressed="true"] {
    background: #e8dcc4;
    border-color: #e8dcc4;
    color: #241f19;
  }
  input[type="range"]::-webkit-slider-runnable-track {
    background: linear-gradient(90deg, #4a4034, #e08a5c);
  }
  input[type="range"]::-moz-range-track {
    background: linear-gradient(90deg, #4a4034, #e08a5c);
  }
  input[type="range"]::-webkit-slider-thumb { background: #241f19; border-color: #e08a5c; }
  input[type="range"]::-moz-range-thumb { background: #241f19; border-color: #e08a5c; }
  .note-list p { color: #b6a894; }
}
