:root {
  --ink: #142131;
  --ink-soft: #415064;
  --paper: #edf3f7;
  --paper-deep: #d9e5ec;
  --line: #b8c9d4;
  --night: #142131;
  --night-soft: #25384a;
  --mint: #5de0c1;
  --coral: #f06d62;
  --violet: #7969e8;
  --yellow: #f2c95c;
  --white: #f8fbfd;
  --shadow: 0 20px 50px rgba(20, 33, 49, 0.12);
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 0;
  background:
    linear-gradient(rgba(20, 33, 49, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 33, 49, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  line-height: 1.6;
}

a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--coral); outline-offset: 4px; }

.site-header {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  padding: 22px 0 18px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 28px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.brand { text-decoration: none; font-weight: 800; letter-spacing: -0.02em; }
.brand span { display: block; color: var(--ink-soft); font-size: 0.68rem; letter-spacing: 0.13em; text-transform: uppercase; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 19px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.site-header nav a, .language-switch a { text-decoration: none; }
.site-header nav a:hover, .language-switch a:hover, .source-list a:hover, .source-cue a:hover { color: var(--coral); }
.language-switch { display: flex; gap: 3px; border: 1px solid var(--line); padding: 3px; border-radius: 999px; font-size: 0.75rem; font-weight: 800; }
.language-switch a { padding: 6px 9px; border-radius: 999px; }
.language-switch .active { color: var(--white); background: var(--ink); }

main { width: min(1320px, calc(100% - 48px)); margin: 0 auto; }
.hero { display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr); gap: clamp(32px, 5vw, 86px); align-items: center; padding: clamp(52px, 8vw, 112px) 0 72px; border-bottom: 1px solid var(--line); }
.hero-copy { min-width: 0; }
.eyebrow, .section-kicker, .lab-label { margin: 0; color: var(--violet); font-size: 0.72rem; font-weight: 850; letter-spacing: 0.15em; line-height: 1.35; text-transform: uppercase; }
.hero h1 { max-width: 780px; margin: 22px 0 10px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3.55rem, 6.8vw, 7.7rem); font-weight: 500; letter-spacing: -0.075em; line-height: 0.91; text-wrap: balance; }
.hero-question { margin: 20px 0 14px; color: var(--coral); font-size: clamp(1.25rem, 2.2vw, 2rem); font-weight: 780; letter-spacing: -0.035em; }
.lede { max-width: 680px; margin: 0; color: var(--ink-soft); font-size: clamp(1.04rem, 1.35vw, 1.28rem); line-height: 1.55; }
.source-cue { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 28px 0 0; color: var(--ink-soft); font-size: 0.78rem; font-weight: 650; }
.source-cue a { text-underline-offset: 3px; }
.source-mark { display: grid; width: 28px; height: 28px; place-items: center; color: var(--white); background: var(--coral); border-radius: 50%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.7rem; }

.hero-lab { min-width: 0; padding: clamp(22px, 3.2vw, 42px); color: var(--white); background: var(--night); box-shadow: var(--shadow); border-radius: 2px; position: relative; overflow: hidden; }
.hero-lab::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.19; background: repeating-linear-gradient(0deg, transparent 0 31px, rgba(93, 224, 193, 0.5) 32px), repeating-linear-gradient(90deg, transparent 0 63px, rgba(93, 224, 193, 0.4) 64px); }
.hero-lab > * { position: relative; }
.lab-heading { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid rgba(248, 251, 253, 0.23); }
.hero-lab .lab-label { color: var(--mint); }
.lab-heading strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.55rem; font-weight: 700; letter-spacing: -0.08em; }
.timing-canvas-wrap { margin: 22px 0 0; background: rgba(248, 251, 253, 0.06); border: 1px solid rgba(248, 251, 253, 0.15); }
#timingCanvas { display: block; width: 100%; height: auto; }
.canvas-fallback { display: none; }
.track-scale { display: flex; justify-content: space-between; gap: 10px; padding: 10px 2px 18px; color: #a9bdc9; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.64rem; letter-spacing: 0.04em; text-transform: uppercase; }
.range-label { display: block; margin-bottom: 8px; font-size: 0.82rem; font-weight: 700; }
input[type="range"] { display: block; width: 100%; height: 34px; margin: 0; accent-color: var(--mint); cursor: pointer; }
.lab-readings { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.lab-readings div { padding: 12px 13px; background: rgba(248, 251, 253, 0.08); border-left: 3px solid var(--mint); }
.lab-readings div:last-child { border-left-color: var(--coral); }
.lab-readings span { display: block; color: #a9bdc9; font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; }
.lab-readings strong { display: block; margin-top: 1px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.4rem; }
.lab-sentence { min-height: 52px; margin: 16px 0 6px; color: #d8e5eb; font-size: 0.92rem; line-height: 1.45; }

.text-button, .primary-button, .secondary-button { border: 0; font: inherit; font-size: 0.8rem; font-weight: 800; cursor: pointer; }
.text-button { padding: 8px 0; color: inherit; background: transparent; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.hero-lab .text-button { color: var(--mint); }
.primary-button, .secondary-button { min-height: 46px; padding: 11px 16px; border-radius: 999px; }
.primary-button { color: var(--night); background: var(--mint); }
.secondary-button { color: var(--white); background: transparent; border: 1px solid rgba(248, 251, 253, 0.4); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

section:not(.hero) { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: clamp(28px, 5vw, 92px); padding: 78px 0; border-bottom: 1px solid var(--line); }
.section-kicker { padding-top: 7px; color: var(--ink-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.65rem; }
.reading-column { width: min(760px, 100%); }
.reading-column h2 { margin: 0 0 22px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.25rem, 4vw, 4.45rem); font-weight: 500; letter-spacing: -0.065em; line-height: 0.98; text-wrap: balance; }
.reading-column p { margin: 0 0 18px; color: var(--ink-soft); font-size: 1.06rem; line-height: 1.72; }
.reading-column em { color: var(--ink); }
.signal-figure { width: min(720px, 100%); margin: 32px 0 0; padding: 24px 22px 18px; background: rgba(255, 255, 255, 0.42); border-top: 3px solid var(--violet); }
.signal-row { display: grid; grid-template-columns: 88px minmax(0, 1fr) 70px; gap: 12px; align-items: center; margin: 14px 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem; text-transform: uppercase; }
.signal-row b { color: var(--ink-soft); font-size: 0.62rem; font-weight: 650; text-align: right; }
.signal-line { position: relative; display: block; height: 18px; background: repeating-linear-gradient(90deg, var(--paper-deep) 0 1px, transparent 1px 24px); border-bottom: 1px solid var(--line); }
.signal-pulse { position: absolute; top: 2px; left: 12%; display: block; width: 14px; height: 14px; border-radius: 50%; }
.pulse-command { background: var(--coral); }
.pulse-prediction { left: 17%; background: var(--violet); }
.pulse-contact { left: 76%; background: var(--mint); }
.signal-figure figcaption { margin-top: 20px; color: var(--ink-soft); font-size: 0.8rem; line-height: 1.5; }

.study-section { background: rgba(217, 229, 236, 0.36); }
.table-wrap { margin: 26px 0 22px; overflow-x: auto; border-top: 1px solid var(--ink); }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
caption { padding: 0 0 10px; text-align: left; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; }
th, td { padding: 13px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { width: 31%; font-weight: 800; }
td { color: var(--ink-soft); }
.method-note, .reader-method { padding-left: 17px; border-left: 3px solid var(--yellow); font-size: 0.9rem !important; }

.experiment-section { background: var(--night); color: var(--white); }
.experiment-section .section-kicker { color: var(--mint); }
.experiment-section .reading-column p { color: #c6d5dd; }
.game-shell { margin-top: 30px; padding: 22px; background: var(--night-soft); border: 1px solid rgba(248, 251, 253, 0.2); }
.game-meta { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 19px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; }
.game-track { position: relative; height: 84px; margin: 0 0 20px; background: repeating-linear-gradient(90deg, rgba(248, 251, 253, 0.15) 0 1px, transparent 1px 26px); border-top: 1px solid rgba(248, 251, 253, 0.28); border-bottom: 1px solid rgba(248, 251, 253, 0.28); overflow: hidden; }
.game-target { position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; transform: translateX(-50%); background: var(--coral); }
.game-target::after { content: ""; position: absolute; top: 7px; left: 8px; width: 90px; color: #ffc2b9; font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.game-dot { position: absolute; top: 30px; left: 0%; width: 22px; height: 22px; transform: translateX(-50%); border: 4px solid var(--night); border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 2px var(--mint); }
.game-actions { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.game-shell .text-button { color: #c6d5dd; }
.game-status { min-height: 28px; margin: 19px 0 0 !important; color: #c6d5dd !important; font-size: 0.85rem !important; }
.game-score { display: block; margin-top: 12px; color: var(--yellow); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; font-weight: 750; }

.body-section { background: rgba(240, 109, 98, 0.06); }
.body-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 0.52fr); gap: 42px; align-items: start; }
.body-grid h2 { max-width: 540px; }
.body-steps { display: grid; gap: 0; padding: 0; margin: 32px 0 0; list-style: none; border-top: 1px solid var(--line); }
.body-steps li { display: grid; grid-template-columns: 48px 1fr; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); color: var(--ink-soft); font-size: 0.96rem; }
.body-steps span { color: var(--coral); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem; font-weight: 800; }
.limit-note { padding: 20px; background: var(--yellow); color: var(--ink); }
.limit-note strong { display: block; margin-bottom: 8px; font-size: 0.83rem; letter-spacing: 0.08em; text-transform: uppercase; }
.limit-note p { margin: 0; color: var(--ink) !important; font-size: 0.91rem !important; line-height: 1.5 !important; }

.nuance-section { background: rgba(121, 105, 232, 0.06); }
.sources-section { padding-bottom: 100px !important; }
.source-list { display: grid; gap: 0; padding: 0; margin: 28px 0 26px; list-style: none; border-top: 1px solid var(--line); }
.source-list li { display: grid; grid-template-columns: minmax(220px, 0.8fr) 1fr; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.source-list a { font-weight: 800; text-underline-offset: 4px; }
.source-list span { color: var(--ink-soft); font-size: 0.9rem; }
.site-footer { width: min(1320px, calc(100% - 48px)); margin: 0 auto; padding: 24px 0 38px; display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; color: var(--ink-soft); font-size: 0.78rem; }
.site-footer a:first-child { color: var(--ink); font-weight: 800; text-decoration: none; }
.site-footer a:last-child { text-underline-offset: 4px; }

@media (max-width: 920px) {
  .site-header { grid-template-columns: 1fr auto; }
  .site-header nav { grid-column: 1 / -1; grid-row: 2; order: 3; justify-content: space-between; }
  .hero { grid-template-columns: 1fr; gap: 38px; }
  .hero h1 { max-width: 760px; font-size: clamp(3.35rem, 11vw, 6rem); }
  .hero-lab { width: min(720px, 100%); }
  section:not(.hero) { grid-template-columns: 1fr; gap: 16px; }
  .section-kicker { padding-top: 0; }
}

@media (max-width: 620px) {
  .site-header, main, .site-footer { width: min(100% - 32px, 1320px); }
  .site-header { padding: 16px 0 14px; gap: 16px; }
  .site-header nav { gap: 11px; font-size: 0.63rem; }
  .brand { font-size: 0.9rem; }
  .brand span { font-size: 0.58rem; }
  .language-switch { font-size: 0.65rem; }
  .language-switch a { padding: 5px 7px; }
  .hero { padding: 44px 0 52px; }
  .hero h1 { margin-top: 17px; font-size: clamp(3.2rem, 16vw, 5.2rem); line-height: 0.94; }
  .hero-question { margin-top: 17px; font-size: 1.25rem; }
  .lede { font-size: 1rem; }
  .source-cue { margin-top: 22px; font-size: 0.7rem; }
  .hero-lab { padding: 18px 16px 20px; }
  .lab-heading strong { font-size: 1.3rem; }
  .track-scale { font-size: 0.52rem; }
  .lab-readings { gap: 8px; }
  .lab-readings div { padding: 10px; }
  .lab-readings strong { font-size: 1.17rem; }
  section:not(.hero) { padding: 56px 0; }
  .reading-column h2 { font-size: clamp(2.45rem, 12vw, 4rem); }
  .reading-column p { font-size: 1rem; }
  .signal-figure { padding: 17px 12px 14px; }
  .signal-row { grid-template-columns: 67px minmax(0, 1fr) 53px; gap: 7px; font-size: 0.6rem; }
  .signal-row b { font-size: 0.52rem; }
  th, td { padding: 11px 6px; font-size: 0.83rem; }
  th { width: 34%; }
  .game-shell { padding: 16px 13px; }
  .game-actions { align-items: stretch; }
  .primary-button, .secondary-button { width: 100%; }
  .game-actions .text-button { margin: 0 auto; }
  .body-grid { grid-template-columns: 1fr; gap: 24px; }
  .body-steps li { grid-template-columns: 41px 1fr; font-size: 0.92rem; }
  .source-list li { grid-template-columns: 1fr; gap: 7px; }
  .site-footer { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.001ms !important; }
}
