:root {
  color-scheme: light;
  --ink: #182724;
  --muted: #66736f;
  --line: #d9ddd7;
  --grid: #e8e9e4;
  --blue: #0072b2;
  --blue-dark: #005a8c;
  --orange: #d55e00;
  --focus: #0072b2;
}

* { box-sizing: border-box; }
html, body { margin: 0; color: var(--ink); background: #fff; }
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }

.site-header { height: 62px; padding: 0 clamp(20px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid rgba(24, 39, 36, 0.1); }
.course-title { display: flex; flex-direction: column; color: var(--ink); font-size: 1.05rem; font-weight: 750; line-height: 1.05; text-decoration: none; }
.course-title small { margin-top: 4px; color: var(--muted); font-size: 0.68rem; font-weight: 500; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-link { padding: 8px 12px; color: var(--ink); background: #e5e7eb; border-radius: 7px; font-size: 0.8rem; font-weight: 700; line-height: 1; text-decoration: none; }
.top-link:hover { background: #d1d5db; }

main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 18px 0 14px; }
.title-row { display: flex; align-items: center; gap: 22px; }
h1 { margin: 0; font: 500 clamp(2.2rem, 4vw, 3.7rem)/0.98 Georgia, "Times New Roman", serif; letter-spacing: -0.045em; }
.demo-qr { flex: 0 0 auto; line-height: 0; }
.demo-qr img { width: 112px; height: 112px; display: block; }
.book-reference { margin-top: 7px; display: inline-block; color: var(--muted); font-size: 0.78rem; text-underline-offset: 3px; }

.equation { margin-top: 10px; min-height: 54px; padding: 5px 18px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }

.transport { margin-top: 9px; padding: 10px 14px; display: grid; grid-template-columns: auto auto minmax(150px, 1fr) minmax(180px, 0.9fr) minmax(180px, 0.9fr) minmax(155px, auto); gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 8px; }
.play-button { width: 42px; height: 42px; padding: 0; display: grid; place-items: center; color: #fff; background: var(--blue); border: 0; border-radius: 50%; cursor: pointer; }
.play-button:hover { background: var(--blue-dark); }
.play-button svg { width: 21px; height: 21px; fill: currentColor; }
.play-button .pause-icon { display: none; }
.play-button[aria-pressed="true"] .play-icon { display: none; }
.play-button[aria-pressed="true"] .pause-icon { display: block; }
.time-readout { min-width: 84px; display: flex; flex-direction: column; gap: 2px; }
.time-readout span { color: var(--muted); font-size: 0.68rem; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; }
.time-readout output { font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.time-control { min-width: 0; }
input[type="range"] { width: 100%; margin: 0; accent-color: var(--blue); cursor: pointer; }
.range-ends { margin-top: 2px; display: flex; justify-content: space-between; color: var(--muted); font-size: 0.66rem; }
.parameter-control { min-width: 0; }
.parameter-control label { margin-bottom: 4px; display: flex; justify-content: space-between; gap: 8px; font-size: 0.72rem; font-weight: 750; }
.parameter-control output { color: var(--blue-dark); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dispersion-control { display: flex; flex-direction: column; gap: 4px; font-size: 0.69rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.dispersion-control span { display: flex; gap: 5px; align-items: center; }
.dispersion-control input { width: 16px; height: 16px; accent-color: var(--blue); }
.dispersion-control output { color: var(--blue-dark); font-size: 0.67rem; }
.dispersion-control output.is-invalid { color: var(--orange); }
.play-button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.visual-grid { height: clamp(270px, calc(100vh - 390px), 430px); margin-top: 9px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.plot-card { min-width: 0; min-height: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.plot-heading { min-height: 30px; display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.plot-heading h2 { margin: 0; font: 500 1.35rem Georgia, "Times New Roman", serif; }
.plot-heading span, .plot-heading output { color: var(--muted); font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.canvas-wrap { position: relative; width: 100%; height: calc(100% - 65px); min-height: 190px; margin-top: 2px; }
canvas { width: 100%; height: 100%; display: block; border: 1px solid var(--line); }
.field-axes { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.field-axes line { stroke: var(--ink); stroke-width: 0.35; }
.field-axes marker path { fill: var(--ink); }
.axis-label { position: absolute; z-index: 2; color: var(--ink); font: italic 0.72rem Georgia, "Times New Roman", serif; pointer-events: none; }
.field-y, .slice-y { left: 3px; top: 50%; transform: rotate(-90deg) translateX(-50%); transform-origin: 0 0; }
.field-x, .slice-x { right: 8px; bottom: 5px; }
.current-time-line { position: absolute; z-index: 3; top: 4%; bottom: 7%; width: 3px; background: var(--ink); pointer-events: none; transform: translateX(-50%); }
.current-time-label { position: absolute; z-index: 4; top: 7px; padding: 3px 5px; color: #fff; background: var(--ink); border-radius: 3px; font-size: 0.64rem; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; transform: translateX(-50%); }
.color-scale { height: 24px; margin-top: 5px; display: grid; grid-template-columns: auto 1fr auto 1fr auto; gap: 6px; align-items: center; color: var(--muted); font-size: 0.66rem; }
.color-scale i { height: 5px; background: linear-gradient(90deg, var(--blue), #fff); border: 1px solid var(--line); }
.color-scale b { height: 5px; background: linear-gradient(90deg, #fff, var(--orange)); border: 1px solid var(--line); }
.slice-legend { height: 24px; margin-top: 5px; display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 0.7rem; }
.slice-legend > i { width: 22px; height: 3px; background: var(--blue); }
.slice-legend output { margin-left: auto; font-size: 0.66rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.site-footer { padding: 0 20px 10px; color: var(--muted); font-size: 0.72rem; text-align: center; }

@media (max-width: 720px) {
  .demo-qr { display: none; }
  .site-header { height: auto; padding-top: 10px; padding-bottom: 10px; align-items: flex-start; flex-direction: column; gap: 8px; }
  .top-actions { width: 100%; }
  .top-link { flex: 1; text-align: center; }
  main { width: calc(100% - 14px); padding: 10px 0 8px; }
  h1 { font-size: 2rem; }
  .book-reference { margin-top: 4px; font-size: 0.68rem; }
  .equation { min-height: 38px; margin-top: 6px; padding: 2px 7px; font-size: 0.7rem; }
  .transport { margin-top: 6px; padding: 7px; grid-template-columns: auto auto 1fr 1fr; gap: 7px; }
  .time-control { grid-column: 3; }
  .omega-control { grid-column: 1 / 3; }
  .k-control { grid-column: 3 / 5; }
  .dispersion-control { grid-column: 1 / 5; flex-direction: row; justify-content: space-between; }
  .parameter-control label { font-size: 0.64rem; }
  .visual-grid { height: 235px; margin-top: 6px; grid-template-columns: 1fr 1fr; gap: 5px; }
  .plot-card { padding: 6px; }
  .plot-heading { min-height: 24px; }
  .plot-heading h2 { font-size: 0.92rem; }
  .plot-heading span, .plot-heading output { display: none; }
  .canvas-wrap { height: 175px; min-height: 0; }
  .axis-label { font-size: 0.54rem; }
  .color-scale, .slice-legend { height: 20px; margin-top: 2px; font-size: 0.54rem; }
  .slice-legend output { display: none; }
}
