:root {
  color-scheme: dark;
  --ink: #091117;
  --panel: rgba(15, 28, 36, .82);
  --line: rgba(202, 221, 224, .13);
  --text: #edf2ef;
  --muted: #9aadb2;
  --gold: #e7b85b;
  --cinnabar: #dd6655;
  --blue: #58aee8;
}
* { box-sizing: border-box; }
html { background: var(--ink); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  background:
    radial-gradient(circle at 52% 32%, rgba(36, 93, 97, .24), transparent 34rem),
    linear-gradient(145deg, #071015 0%, #0b161d 48%, #101b20 100%);
}
button, input { font: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.app-shell { width: min(1500px, 100%); margin: 0 auto; padding: 28px clamp(18px, 3vw, 48px) 44px; }
.topbar, .section-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.topbar { margin-bottom: 22px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-family: "Songti SC", STSong, serif; font-size: clamp(1.65rem, 3vw, 2.6rem); letter-spacing: .08em; font-weight: 500; }
h2 { margin-bottom: 0; font-family: "Songti SC", STSong, serif; font-weight: 500; }
h3 { margin-bottom: 0; font-size: 1rem; font-weight: 600; }
.eyebrow { color: var(--gold); font-size: .76rem; letter-spacing: .14em; margin-bottom: 7px; text-transform: uppercase; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: .84rem; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.ordinary { background: #8ea2a6; }.dot.waxing { background: var(--cinnabar); }.dot.waning { background: var(--blue); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: stretch; }
.stage-card, .detail-card, .cycle-strip { border: 1px solid var(--line); background: var(--panel); box-shadow: 0 24px 70px rgba(0,0,0,.22); backdrop-filter: blur(18px); }
.stage-card { min-width: 0; border-radius: 20px; overflow: hidden; }
.stage-toolbar { min-height: 56px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 9px; padding: 10px 14px; flex-wrap: wrap; }
.control { border: 1px solid rgba(255,255,255,.12); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.04); padding: 7px 13px; cursor: pointer; }
.control:hover, .control.active { color: var(--text); border-color: rgba(231,184,91,.42); background: rgba(231,184,91,.08); }
.switch-row { color: var(--muted); font-size: .83rem; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; margin-left: 4px; }
.switch-row input { accent-color: var(--gold); width: 16px; height: 16px; }
.stage-wrap { position: relative; height: clamp(540px, 67vh, 780px); overflow: hidden; cursor: grab; touch-action: none; }
.stage-wrap.dragging { cursor: grabbing; }
#scene { width: 100%; height: 100%; display: block; user-select: none; }
.gesture-tip { position: absolute; left: 18px; bottom: 12px; margin: 0; color: rgba(210,225,225,.52); font-size: .76rem; pointer-events: none; }
.axis-note { position: absolute; right: 16px; top: 18px; display: grid; justify-items: center; color: rgba(229,238,235,.64); font-family: "Songti SC", STSong, serif; font-size: .75rem; pointer-events: none; }
.axis-note b { width: 1px; height: 62px; margin: 6px 0; background: linear-gradient(var(--gold), rgba(231,184,91,.15)); }
.detail-card { border-radius: 20px; padding: 22px; }
.detail-head { display: flex; gap: 14px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.hex-symbol { font-size: 4rem; line-height: 1; color: var(--gold); font-family: "Noto Sans Symbols 2", "Segoe UI Symbol", sans-serif; }
.detail-head h2 { font-size: 1.55rem; }
.line-diagram { display: flex; flex-direction: column; gap: 6px; width: 112px; margin: 20px auto; }
.yao { height: 7px; display: flex; gap: 12px; }
.yao i { display: block; height: 100%; flex: 1; border-radius: 2px; background: #d9e1dd; }
.yao.yang i:last-child { display: none; }
.facts { margin: 0; border-top: 1px solid var(--line); }
.facts div { display: grid; grid-template-columns: 88px 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: .84rem; }.facts dd { margin: 0; font-size: .88rem; }
.insight { margin: 16px 0 22px; padding: 14px 15px; border-left: 2px solid var(--gold); background: rgba(231,184,91,.055); }
.insight p:last-child { margin: 0; color: #cbd5d2; line-height: 1.72; font-size: .88rem; }
.neighbors .section-title { align-items: center; margin-bottom: 10px; }
.neighbors .section-title span { color: var(--muted); font-size: .75rem; }
.neighbor-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.neighbor-list button { border: 1px solid var(--line); border-radius: 8px; padding: 8px 4px; background: rgba(255,255,255,.025); color: #cdd8d5; cursor: pointer; font-size: .76rem; }
.neighbor-list button:hover { border-color: rgba(231,184,91,.5); color: var(--gold); }
.cycle-strip { margin-top: 18px; border-radius: 20px; padding: 22px; }
.cycle-strip .section-title { align-items: end; }
.cycle-strip .section-title > p { max-width: 530px; color: var(--muted); line-height: 1.65; margin-bottom: 0; font-size: .88rem; }
.cycle-list { list-style: none; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(12, minmax(72px, 1fr)); gap: 6px; }
.cycle-list button { width: 100%; min-height: 78px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.025); color: var(--text); cursor: pointer; padding: 9px 5px; }
.cycle-list button:hover, .cycle-list button.current { transform: translateY(-2px); border-color: rgba(231,184,91,.7); background: rgba(231,184,91,.08); }
.cycle-list b, .cycle-list span, .cycle-list small { display: block; }.cycle-list b { color: var(--gold); font-size: .72rem; }.cycle-list span { font-family: "Songti SC", STSong, serif; font-size: 1.1rem; margin: 3px 0; }.cycle-list small { color: var(--muted); font-size: .68rem; }
footer { display: flex; justify-content: space-between; gap: 28px; color: rgba(194,209,208,.55); font-size: .75rem; margin-top: 15px; padding: 0 4px; }
footer p { margin: 0; }
.edge { stroke: rgba(155,181,185,.15); stroke-width: 1; vector-effect: non-scaling-stroke; transition: opacity .2s; }
.edge.focus { stroke: rgba(232,197,117,.65); stroke-width: 1.8; }
.cycle-path { fill: none; stroke: url(#pathGrad); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; filter: url(#glow); opacity: .96; }
.guide { fill: none; stroke: rgba(196,218,218,.11); stroke-width: 1; stroke-dasharray: 3 7; }
.node { cursor: pointer; transition: opacity .18s; }
.node circle { stroke: rgba(237,243,239,.68); stroke-width: 1; }
.node.ordinary circle { fill: #789096; }.node.message.waxing circle { fill: var(--cinnabar); }.node.message.waning circle { fill: var(--blue); }
.node.message circle { stroke: #fff4d2; stroke-width: 1.8; filter: url(#glow); }
.node.selected circle { fill: var(--gold); stroke: white; stroke-width: 2.4; }
.node text { fill: #081013; font-size: 10px; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.scene-label { fill: rgba(232,239,235,.76); font-size: 11px; text-anchor: middle; pointer-events: none; paint-order: stroke; stroke: #091117; stroke-width: 3px; }
.scene-label.message { fill: #fff1c9; font-size: 12px; font-weight: 650; }
@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .detail-card { display: grid; grid-template-columns: auto 1fr; gap: 0 22px; }
  .detail-head, .line-diagram { grid-column: 1; }.facts, .insight, .neighbors { grid-column: 2; }.line-diagram { align-self: start; }
  .cycle-list { grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 680px) {
  .app-shell { padding: 20px 12px 32px; }.topbar { align-items: flex-start; flex-direction: column; gap: 12px; }
  .stage-wrap { height: 530px; }.stage-toolbar { gap: 7px; }.switch-row { width: calc(50% - 8px); margin: 2px 0 0; }
  .detail-card { display: block; }.line-diagram { margin: 20px auto; }
  .cycle-strip .section-title { display: block; }.cycle-strip .section-title > p { margin-top: 10px; }
  .cycle-list { grid-template-columns: repeat(3, 1fr); }
  footer { display: block; } footer p + p { margin-top: 7px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
