/* 星雨 Meteor Shower — Apple-minimal, self-contained (shares the site's
   token values from app-style.css; tools with their own style.css do
   not get the shared sheet, so the tokens are duplicated here).
   Layout classes are shared with the deep-time / cloud-atlas tools
   (dt-*) so the study tools stay visually consistent. */
:root {
  color-scheme: light;
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
  --canvas: #f5f5f7;
  --surface: #fff;
  --recessed: #f5f5f7;
  --ink: #1d1d1f;
  --muted: #65656b;
  --line: rgb(0 0 0 / .06);
  --control-line: rgb(0 0 0 / .14);
  --selected: rgb(0 0 0 / .075);
  --accent: #0071e3;
  --accent-hover: #0065cc;
  --accent-ink: #fff;
  --good: #1eaa50;
  --bad: #e02028;
  --motion: .2s cubic-bezier(.16, 1, .3, 1);
  color: var(--ink);
  background: var(--canvas);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #161618;
  --surface: #1e1e20;
  --recessed: #242426;
  --ink: #f5f5f7;
  --muted: #ababaf;
  --line: rgb(255 255 255 / .08);
  --control-line: rgb(255 255 255 / .19);
  --selected: rgb(255 255 255 / .10);
  --accent: #5aaaf9;
  --accent-hover: #7bbaff;
  --accent-ink: #101820;
  --good: #4ade80;
  --bad: #f87171;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; transition: background-color var(--motion), color var(--motion); }
main { width: min(896px, calc(100% - 32px)); margin: clamp(32px, 7vw, 80px) auto; }
h1 { font-size: clamp(2.25rem, 5vw, 4rem); font-weight: 600; line-height: 1.12; letter-spacing: -.045em; margin: 16px 0 8px; }
h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -.01em; margin: 0; }
p { color: var(--muted); margin: 0; }
a { color: var(--ink); text-underline-offset: .2em; }
.subtitle { font-size: 1.125rem; color: var(--ink); }
.lede { margin-top: 8px; }
.badges { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.panel { display: grid; gap: 24px; margin-block-start: 32px; border: 1px solid var(--line); border-radius: 24px; padding: clamp(16px, 4vw, 32px); background: var(--surface); }
.of-url-note { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; }
button { display: inline-flex; justify-content: center; align-items: center; background: var(--accent); color: var(--accent-ink); border: 1px solid transparent; border-radius: 8px; min-height: 44px; font: inherit; font-size: 14px; font-weight: 500; padding: 8px 16px; cursor: pointer; transition: background-color var(--motion), transform var(--motion); }
button:not(:disabled):hover { background: var(--accent-hover); }
button:not(:disabled):active { transform: scale(.98); }
button:disabled { opacity: .5; cursor: default; }
.secondary { color: var(--ink); background: var(--recessed); }
.secondary:not(:disabled):hover { background: var(--selected); }
.brand-line { text-align: center; color: var(--muted); font-size: 12.5px; letter-spacing: .14em; padding: 20px 0 28px; margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---- Solar Terms ---- */
.dt-label { font-weight: 600; color: var(--ink); }
.dt-date-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.dt-date-row input[type="date"] { font: inherit; color: var(--ink); background: var(--recessed); border: 1px solid var(--control-line); border-radius: 12px; padding: 10px 12px; min-height: 48px; }
.dt-date-row select { font: inherit; color: var(--ink); background: var(--recessed); border: 1px solid var(--control-line); border-radius: 12px; padding: 10px 12px; min-height: 48px; }
.dt-term-card { display: grid; gap: 6px; background: var(--recessed); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.dt-term-name { font-size: 1.75rem; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.dt-term-name span { font-size: 1rem; font-weight: 400; color: var(--muted); }
.dt-read-line { font-size: 1rem; color: var(--muted); }
.dt-read-line strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.dt-phen { font-size: 1rem; color: var(--muted); }
.dt-phen span:first-child { font-weight: 600; color: var(--ink); }
.dt-table { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dt-row { background: var(--recessed); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; display: grid; gap: 4px; }
.dt-row-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; align-items: baseline; }
.dt-row-head strong { color: var(--ink); font-size: 1.0625rem; }
.dt-row-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.dt-row-sub { font-size: 0.9375rem; color: var(--muted); }
.dt-sub-h { font-size: 1rem; margin: 8px 0 0; }
.dt-quiz-meta { color: var(--muted); }
.dt-quiz-meta strong { color: var(--ink); }
.dt-quiz-clue { font-size: 1.25rem; font-weight: 600; color: var(--ink); margin-top: 8px; }
.dt-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 16px; }
.dt-options button { min-height: 56px; font-size: 1.0625rem; overflow-wrap: anywhere; }
.dt-options button.dt-picked-correct { background: var(--good); color: #fff; }
.dt-options button.dt-picked-wrong { background: var(--bad); color: #fff; }
.dt-feedback { font-size: 1rem; color: var(--ink); min-height: 1.5em; }
.dt-feedback:empty { display: none; }
.dt-feedback.dt-good { color: var(--good); font-weight: 600; }
.dt-feedback.dt-bad { color: var(--bad); font-weight: 600; }
.dt-explain { font-size: 0.875rem; color: var(--muted); min-height: 1.4em; }
.dt-explain:empty { display: none; }
.dt-result-line { font-size: 1.125rem; color: var(--ink); }
.dt-result-line strong { font-variant-numeric: tabular-nums; }
.dt-review { display: grid; gap: 8px; }
.dt-review:empty { display: none; }
.dt-review-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; background: var(--recessed); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.dt-review-row .dt-review-phase { font-weight: 600; color: var(--ink); }
.dt-review-row .dt-review-wrong { color: var(--bad); }
#quiz-best:empty { display: none; }
@media (max-width: 640px) {
  .dt-options { grid-template-columns: 1fr; }
}

/* ---- Deep Time ---- */
.dt-timeline { display: flex; gap: 8px; }
.dt-segment { display: grid; gap: 8px; min-width: 0; }
.dt-segment-label { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.dt-bar { display: flex; gap: 4px; min-height: 64px; }
.dt-bar-block { flex: 1 1 0; min-width: 0; border-radius: 12px; border: 1px solid var(--line); background: var(--recessed); color: var(--ink); font-size: 13px; font-weight: 600; padding: 8px 4px; cursor: pointer; overflow-wrap: anywhere; }
.dt-bar-block.dt-selected { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.dt-unit-list { display: flex; flex-wrap: wrap; gap: 8px; }
.dt-unit-btn { min-height: 48px; background: var(--recessed); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 15px; cursor: pointer; }
.dt-unit-btn.dt-selected { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.dt-unit-card { display: grid; gap: 6px; background: var(--recessed); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.dt-unit-name { font-size: 1.75rem; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.dt-unit-name span { font-size: 1rem; font-weight: 400; color: var(--muted); }
.dt-read-line { font-size: 1rem; color: var(--muted); }
.dt-read-line strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.dt-phen { font-size: 1rem; color: var(--muted); }
.dt-phen span:first-child { font-weight: 600; color: var(--ink); }
.dt-table { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dt-row { background: var(--recessed); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; display: grid; gap: 4px; }
.dt-row-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; align-items: baseline; }
.dt-row-head strong { color: var(--ink); font-size: 1.0625rem; }
.dt-row-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.dt-row-sub { font-size: 0.9375rem; color: var(--muted); }
.dt-sub-h { font-size: 1rem; margin: 8px 0 0; }
.dt-clock-wrap { display: flex; justify-content: center; }
.dt-clock-wrap svg { max-width: 100%; height: auto; }
.dt-clock-face { fill: var(--recessed); stroke: var(--control-line); stroke-width: 1; }
.dt-clock-tick { stroke: var(--control-line); stroke-width: 1; }
.dt-clock-dot { fill: var(--accent); }
.dt-clock-label { fill: var(--muted); font-size: 13px; text-anchor: middle; }
.dt-year-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.dt-month { background: var(--recessed); border: 1px solid var(--line); border-radius: 10px; min-height: 48px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.dt-month-hit { background: var(--accent); color: var(--accent-ink); font-weight: 600; border-color: transparent; }
.dt-date-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.dt-date-row input[type="number"] { font: inherit; color: var(--ink); background: var(--recessed); border: 1px solid var(--control-line); border-radius: 12px; padding: 10px 12px; min-height: 48px; width: 160px; }
.dt-label { font-weight: 600; color: var(--ink); }
.dt-quiz-meta { color: var(--muted); }
.dt-quiz-meta strong { color: var(--ink); }
.dt-quiz-clue { font-size: 1.25rem; font-weight: 600; color: var(--ink); margin-top: 8px; }
.dt-quiz-clue:empty { display: none; }
.dt-options { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 16px; }
.dt-options button { min-height: 56px; font-size: 1.0625rem; overflow-wrap: anywhere; text-align: left; justify-content: flex-start; }
.dt-options button.dt-picked-correct { background: var(--good); color: #fff; }
.dt-options button.dt-picked-wrong { background: var(--bad); color: #fff; }
.dt-feedback { font-size: 1rem; color: var(--ink); min-height: 1.5em; }
.dt-feedback:empty { display: none; }
.dt-feedback.dt-good { color: var(--good); font-weight: 600; }
.dt-feedback.dt-bad { color: var(--bad); font-weight: 600; }
.dt-explain { font-size: 0.875rem; color: var(--muted); min-height: 1.4em; }
.dt-explain:empty { display: none; }
.dt-result-line { font-size: 1.125rem; color: var(--ink); }
.dt-result-line strong { font-variant-numeric: tabular-nums; }
.dt-review { display: grid; gap: 8px; }
.dt-review:empty { display: none; }
.dt-review-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; background: var(--recessed); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.dt-review-row .dt-review-phase { font-weight: 600; color: var(--ink); }
.dt-review-row .dt-review-wrong { color: var(--bad); }
#quiz-best:empty { display: none; }
@media (max-width: 640px) {
  .dt-timeline { flex-direction: column; }
  .dt-segment-label { font-size: 13px; }
  .dt-year-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---- Aurora ---- */
#oval-canvas, #curtain-canvas, #spectrum-canvas { display: block; width: 100%; max-width: 600px; height: auto; border-radius: 16px; border: 1px solid var(--line); margin: 0 auto; background: var(--recessed); }


.ms-canvas-wrap { display: flex; justify-content: center; }
.ms-readout { display: grid; gap: 6px; background: var(--recessed); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.ms-readout .dt-unit-name { font-size: 1.5rem; }
.ms-readout .dt-unit-name span { font-size: 1rem; font-weight: 400; color: var(--muted); }
.ms-date-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ms-date-row input[type="date"] { font: inherit; color: var(--ink); background: var(--recessed); border: 1px solid var(--control-line); border-radius: 12px; padding: 8px 10px; min-height: 44px; }
.ms-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ms-table th, .ms-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); color: var(--ink); }
.ms-table th { color: var(--muted); font-size: 13px; font-weight: 600; }
.ms-table tbody tr:hover { background: var(--recessed); }
.ms-table-scroll { overflow-x: auto; }
.ms-table-scroll .ms-table { min-width: 760px; }
#ms-chart { display: block; width: 100%; max-width: 600px; height: auto; border-radius: 12px; border: 1px solid var(--line); margin: 0 auto; background: #0b1026; }
.ms-radiant-list { margin: 0; padding-left: 20px; color: var(--ink); display: grid; gap: 4px; }
.ms-radiant-list li.ms-active { font-weight: 600; }
.ms-radiant-list li.ms-active::marker { content: "★ "; color: var(--accent); }
@media (max-width: 640px) {
  .ms-table th, .ms-table td { padding: 8px; font-size: 14px; }
  .ms-date-row { align-items: stretch; }
  .ms-date-row input[type="date"] { flex: 1; min-width: 0; }
  .ms-date-row .buttons { width: 100%; }
  .ms-date-row .buttons button { flex: 1; }
}
