:root {
  --ink: #111827;
  --text: #4b5563;
  --muted: #6b7280;
  --line: #e5e7eb;
  --background: #f8fafc;
  --accent: #0d9488;
  --accent-light: #f0fdfa;
  --los: #2563eb;
  --nlos: #d97706;
  --edge: #dc2626;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--background); font: 16px/1.7 Inter, sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.site-header { position: sticky; top: 0; z-index: 10; height: 64px; background: #fff; box-shadow: 0 1px 3px #11182712; }
.header-inner { max-width: 1440px; margin: auto; height: 100%; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.site-name { font-size: 20px; font-weight: 700; white-space: nowrap; }
.site-header nav { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.site-header nav a { padding: 8px 12px; white-space: nowrap; border-radius: 4px; }
.site-header nav a:hover, .site-header nav a.active { color: var(--accent); background: var(--accent-light); }

.site-main { max-width: 1250px; margin: 48px auto 72px; padding: 0 31px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 44px 48px; margin-bottom: 32px; box-shadow: 0 1px 2px #11182708; }
h1, h2, h3, p, figure { margin-top: 0; }
h1, h2, h3 { line-height: 1.3; }
h1 { font-size: 32px; margin-bottom: 20px; }
h2 { font-size: 29px; text-align: center; margin-bottom: 18px; }
h3 { font-size: 20px; margin-bottom: 12px; }
p { color: var(--text); margin-bottom: 0; }
.intro p { font-size: 17px; line-height: 1.8; }
.section-description { max-width: 980px; margin: 0 auto 32px; font-size: 16px; line-height: 1.8; }
.section-description strong { color: var(--ink); }

.intro-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 30px; }
.intro-facts div { padding: 16px 18px; border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; }
.intro-facts strong { font-size: 21px; line-height: 1.3; }
.intro-facts span { color: var(--muted); font-size: 13px; margin-top: 4px; }

.figure-card { border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; box-shadow: 0 1px 3px #1118270a; }
.scene-figure { max-width: 1090px; margin: auto; padding: 18px; }
.scene-figure img { display: block; width: 100%; }
.scene-figure figcaption { color: var(--muted); font-size: 13px; text-align: center; margin-top: 12px; }
.replay-card { max-width: 1090px; margin: auto; }
.figure-title { padding: 14px 20px; font-size: 16px; font-weight: 600; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.figure-title span { color: var(--accent); }
.replay-card > img { display: block; width: 100%; aspect-ratio: 3/2; object-fit: contain; background: #f3f4f6; }
.replay-controls { display: flex; align-items: center; gap: 16px; padding: 16px 24px 0; }
.replay-controls button { width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 4px; background: var(--accent-light); color: var(--accent); cursor: pointer; }
.replay-controls label { white-space: nowrap; font-size: 14px; color: var(--text); }
.replay-controls input { flex: 1; accent-color: var(--accent); }
.replay-controls strong { min-width: 50px; text-align: right; font-size: 14px; }
.ticks { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; padding: 0 24px 16px 196px; }
.note { color: var(--muted); font-size: 13px; margin-top: 18px; }

.chart-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, .85fr); gap: 20px; }
.chart-card, .visibility-card { padding: 22px 24px; }
.chart-heading { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
.chart-heading h3 { font-size: 18px; margin-bottom: 3px; }
.chart-heading p { color: var(--muted); font-size: 13px; }
.chart-heading label { color: var(--text); font-size: 13px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.chart-heading select { color: var(--text); background: #fff; border: 1px solid #d1d5db; border-radius: 5px; padding: 6px 9px; font-size: 13px; }
.chart { height: 330px; margin-top: 20px; }
.chart svg, .mini-chart svg { width: 100%; height: 100%; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 20px; margin-left: 30px; color: var(--text); font-size: 13px; }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend i { width: 17px; height: 3px; display: inline-block; }
.legend .los { background: var(--los); }
.legend .nlos { background: var(--nlos); }
.legend .edge { background: var(--edge); }
.visibility-card h3 { text-align: center; font-size: 18px; }
.visibility-card p { font-size: 13px; }
.mini-chart { height: 115px; margin-top: 18px; }
.visibility-card .small { color: var(--muted); font-size: 12px; }
.stat { border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; padding-top: 18px; margin-top: 18px; }
.stat strong { color: var(--accent); font-size: 30px; line-height: 1; }
.stat span { font-size: 12px; line-height: 1.4; }

.data-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.data-grid article { border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.data-grid h3 { font-size: 16px; margin-bottom: 8px; }
.data-grid p { color: var(--muted); font-size: 13px; }
.source { color: var(--muted); font-size: 12px; margin-top: 24px; overflow-wrap: anywhere; }
.source code { color: var(--text); }
.site-footer { padding: 25px; text-align: center; color: var(--muted); font-size: 13px; }

@media (max-width: 900px) {
  .chart-grid { grid-template-columns: 1fr; }
  .intro-facts, .data-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .site-header { height: auto; }
  .header-inner { padding: 12px 16px; flex-wrap: wrap; gap: 4px; }
  .site-name { font-size: 17px; }
  .site-header nav { width: 100%; overflow-x: auto; font-size: 12px; }
  .site-header nav a { padding: 5px 7px; }
  .site-main { margin: 20px auto 40px; padding: 0 15px; }
  .panel { padding: 24px 18px; margin-bottom: 18px; }
  h1 { font-size: 25px; }
  h2 { font-size: 23px; }
  .intro p, .section-description { font-size: 14px; }
  .intro-facts, .data-grid { gap: 8px; }
  .intro-facts div, .data-grid article { padding: 12px; }
  .replay-controls { gap: 8px; padding: 12px 10px 0; }
  .replay-controls label { display: none; }
  .ticks { padding: 0 10px 12px 52px; }
  .chart-card, .visibility-card { padding: 15px; }
  .chart-heading { display: block; }
  .chart-heading label { margin-top: 10px; }
  .chart { height: 280px; }
  .legend { margin-left: 0; gap: 10px; font-size: 11px; }
}
