/* 交错拍 Crossbeat — 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). */
: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;
  --wood: #a97c50;
  --wood-dark: #8a5f3a;
  --beam: #7c5233;
  --bead: #5d3a1e;
  --bead-hi: #8a5f3a;
  --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;
  --wood: #8a6a44;
  --wood-dark: #6e5232;
  --beam: #6b4a2c;
  --bead: #c89b6d;
  --bead-hi: #e0b98a;
}
* { 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; }
.fineprint { font-size: 13px; color: var(--muted); }
.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); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--recessed); border: 1px solid var(--control-line); border-radius: 10px; padding: 4px; }
.seg button { background: transparent; color: var(--ink); border: 0; min-height: 36px; border-radius: 7px; }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, .18); }
#status:empty, #msg:empty { display: none; }
.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; } }


/* ---- Double-Slit ---- */
.ds-schema { width: 100%; height: auto; color: var(--muted); }
.ds-schema text { fill: var(--muted); font-size: 15px; font-family: inherit; }
.ds-src { fill: var(--accent); }
.ds-bar { fill: var(--ink); opacity: .85; }
.ds-screen-wrap { position: relative; width: 100%; }
.ds-screen-wrap canvas { display: block; width: 100%; height: auto; border-radius: 16px; }
#photon-canvas { position: absolute; inset: 0; pointer-events: none; }
.ds-ruler { position: absolute; inset: 0; pointer-events: none; }
.ds-ruler-line { position: absolute; top: 0; bottom: 0; border-top: 2px solid #fff; border-bottom: 2px solid #fff; background: rgba(255,255,255,.08); }
.ds-handle { position: absolute; top: 0; bottom: 0; width: 4px; margin-left: -2px; background: #fff; border-radius: 2px; pointer-events: none; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
#curve-canvas { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 16px; }
.ds-sub-h { font-size: 1rem; margin: 8px 0 0; }
.ds-slider-row { display: flex; align-items: center; gap: 12px; }
.ds-slider-row label { font-weight: 600; white-space: nowrap; min-width: 92px; }
.ds-slider-row input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent); min-height: 44px; }
.ds-slider-row span:last-child { font-variant-numeric: tabular-nums; min-width: 84px; text-align: right; color: var(--muted); }
.panel { grid-template-columns: minmax(0, 1fr); }
.seg { max-width: 100%; }
.ds-color-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: -1px; margin-left: 4px; border: 1px solid var(--control-line); }
.ds-readouts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ds-readouts > div { background: var(--recessed); border-radius: 14px; padding: 12px 14px; display: grid; gap: 2px; }
.ds-readouts span { font-size: 13px; color: var(--muted); }
.ds-readouts strong { font-size: 1.125rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.ds-warn { font-size: 14px; color: var(--bad); }
.ds-warn:empty { display: none; }
#measure-result { font-size: 1.125rem; color: var(--ink); font-weight: 600; }
#measure-result:empty { display: none; }
#photon-count:empty { display: none; }
#export-msg:empty { display: none; }
@media (max-width: 640px) {
  .ds-readouts { grid-template-columns: 1fr; }
  .ds-slider-row label { min-width: 68px; }
  .ds-slider-row span:last-child { min-width: 62px; }
  .ds-slider-row { gap: 8px; }
}
