:root {
  color-scheme: dark;
  --bg: #090c14;
  --panel: #111824;
  --panel-quiet: #0d131d;
  --ink: #f3f6fa;
  --muted: #aeb9cc;
  --soft: #8492aa;
  --line: #283346;
  --mint: #a4f1da;
  --violet: #c5b6ff;
  --red: #ffc4ab;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 0; }
a { color: inherit; text-underline-offset: .22em; }
button, input { font: inherit; }
button, input[type=checkbox], input[type=range], summary { cursor: pointer; }
button:disabled { opacity: .52; cursor: default; }
:focus-visible { outline: 3px solid var(--mint); outline-offset: 4px; }
p { margin: 0; line-height: 1.58; }
h1, h2, h3 { margin: 0; font-weight: 500; }
h2, .send-wrap h1 { font: 400 clamp(2.8rem, 6.4vw, 5.3rem)/.99 var(--serif); letter-spacing: -.052em; }
h3 { font-size: 1.12rem; font-weight: 650; }
.wrap { width: min(1170px, calc(100% - clamp(2rem, 9vw, 8rem))); margin-inline: auto; }
.masthead { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: .6rem 1.8rem; position: relative; z-index: 1; border-bottom: 1px solid var(--line); }
.brand { text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; gap: .7rem; font-weight: 700; white-space: nowrap; letter-spacing: -.012em; }
.brand-mark { width: 21px; height: 21px; border: 1.5px solid var(--mint); border-radius: 50%; position: relative; transform: rotate(-24deg); box-shadow: 0 0 12px #75f9ca26; }
.brand-mark::after { content: ""; position: absolute; inset: 7px -4px auto; height: 1px; background: linear-gradient(90deg, transparent, var(--violet) 24% 70%, transparent); }
.masthead nav { display: flex; flex-wrap: wrap; gap: 0 clamp(.8rem, 2.6vw, 2rem); font-size: .93rem; }
.masthead nav a { min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; color: var(--muted); }
.masthead nav a:hover, .source-link:hover { color: var(--mint); }
.skip { position: fixed; top: .6rem; left: .6rem; z-index: 5; background: var(--ink); color: var(--bg); padding: .7rem 1rem; transform: translateY(-170%); }
.skip:focus { transform: none; }

.hero { min-height: min(620px, 79svh); position: relative; isolation: isolate; display: grid; align-items: center; padding-block: clamp(4rem, 10vw, 7rem) 3.8rem; }
.hero-art { position: absolute; z-index: -1; top: 0; bottom: 0; right: calc(-1 * clamp(.9rem, 4vw, 3.2rem)); width: min(1150px, 105%); overflow: hidden; }
.hero-art img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 47%; opacity: .94; }
.hero-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--bg) 1%, #090c14e8 12%, #090c1430 46%, transparent 73%, var(--bg) 100%), linear-gradient(0deg, var(--bg), transparent 23%, transparent 90%, var(--bg)); }
.hero-copy { position: relative; max-width: 32rem; }
.eyebrow { font: 600 .77rem/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--mint); margin: 0 0 .75rem; }
.hero h1 { font: 400 clamp(4.6rem, 10vw, 9rem)/.83 var(--serif); letter-spacing: -.074em; }
.hero h1 em { display: block; color: #b7eadd; font-weight: inherit; }
.hero-deck { color: var(--ink); font-weight: 620; font-size: clamp(1.2rem, 2.1vw, 1.65rem); margin-top: 1.55rem; }
.hero-summary { margin-top: .33rem; color: var(--muted); max-width: 29rem; }
.hero .button { margin-top: 1.3rem; }
.button { min-height: 46px; display: inline-flex; justify-content: center; align-items: center; gap: .4rem; max-width: 100%; padding: .68rem .95rem; border: 1px solid transparent; border-radius: .35rem; text-decoration: none; font-weight: 700; line-height: 1.2; }
.primary { color: #0a241e; background: var(--mint); border-color: var(--mint); }
.primary:hover { background: #cbffed; border-color: #cbffed; }
.secondary { color: var(--ink); background: #172031; border-color: #42506a; }
.secondary:hover { background: #26324a; border-color: #7886a0; }
.section { padding-block: clamp(3rem, 8vw, 6.5rem); border-top: 1px solid var(--line); scroll-margin-top: 1rem; }
.section-heading { display: grid; grid-template-columns: 1.15fr .85fr; gap: 1rem 2.5rem; align-items: end; margin-bottom: clamp(1.5rem, 4vw, 2.8rem); }
.section-heading > p { max-width: 32rem; color: var(--muted); padding-bottom: .22rem; }
.lab { display: grid; grid-template-columns: minmax(255px, .77fr) minmax(0, 1.5fr); border: 1px solid var(--line); border-radius: .7rem; overflow: clip; background: var(--panel); }
.controls { display: flex; flex-direction: column; gap: 1.5rem; padding: clamp(1.2rem, 3.6vw, 2.2rem); border-right: 1px solid var(--line); min-width: 0; }
.controls label, .radio-settings label, .sender-link label, .send-wrap label { font-size: .98rem; font-weight: 650; }
.character { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.character p, .phase p, .checkbox small, .sender-link p { color: var(--muted); font-size: .86rem; }
.character input { width: 3.4rem; height: 3.6rem; font: 600 1.7rem var(--mono); text-align: center; flex: 0 0 auto; }
input:not([type=range],[type=checkbox],[type=file]) { min-height: 44px; color: var(--ink); background: #0a101a; border: 1px solid #4c5870; border-radius: .34rem; padding: .55rem .64rem; }
input::placeholder { color: var(--soft); }
.field-line { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.field-line output { font: 700 1.25rem var(--mono); color: var(--mint); min-width: 4ch; text-align: end; }
input[type=range] { width: 100%; height: 38px; margin: 0; accent-color: var(--mint); }
.ticks { margin-top: -.3rem; margin-bottom: .43rem; display: flex; justify-content: space-between; color: var(--soft); font: .76rem var(--mono); }
.checkbox { display: flex; align-items: center; gap: .7rem; min-height: 44px; }
.checkbox span { display: block; }
.checkbox span small { display: block; font-weight: 400; margin-top: .15rem; }
.checkbox input { accent-color: var(--mint); width: 1.18rem; height: 1.18rem; flex: none; margin: 0; }
.controls-actions, .control-row { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem .65rem; }
.controls-actions { margin-top: auto; }
.controls-actions .button { flex: 1 0 auto; }
.error { color: var(--red); }
.interferometer { display: flex; flex-direction: column; min-width: 0; margin: 0; background: radial-gradient(ellipse at 55% 50%, #172a3f66, transparent 69%), var(--panel-quiet); padding: 1.15rem clamp(1rem, 2.6vw, 1.75rem); }
.instrument-label, .record-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .35rem 1rem; }
.instrument-label figcaption { font-weight: 650; }
.instrument-label span, .record-heading p { color: var(--muted); font-size: .87rem; }
#path-diagram { width: 100%; min-height: 180px; height: clamp(190px, 28vw, 275px); display: block; }
.detectors { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; margin-top: auto; }
.detector { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .45rem .75rem; font-size: .9rem; min-width: 0; }
.detector strong { font: 650 .9rem var(--mono); }
.detector span { display: flex; align-items: center; gap: .4rem; }
.key-zero, .key-one { display: inline-block; width: .53rem; height: .53rem; border-radius: 50%; flex: none; background: var(--mint); }
.key-one { background: var(--violet); }
.track { grid-column: 1 / -1; height: .3rem; overflow: hidden; background: #263144; border-radius: .3rem; }
.track i { height: 100%; display: block; width: 0; background: var(--mint); border-radius: inherit; transition: width .18s ease; }
#zero-meter { width: 100%; }
#one-meter { background: var(--violet); }
.byte-record { grid-column: 1 / -1; padding: clamp(1rem, 3.4vw, 2rem); border-top: 1px solid var(--line); }
.byte-traces { display: grid; gap: .6rem; margin-top: 1rem; }
.trace { display: grid; grid-template-columns: 6.3rem minmax(0, 25rem) minmax(6.5rem, 1fr); align-items: center; gap: .6rem; }
.trace > span { color: var(--muted); font-size: .93rem; }
.trace code { font-family: var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.bits { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: clamp(.19rem, .8vw, .47rem); }
.bit { display: grid; place-items: center; min-height: 38px; background: #182235; border: 1px solid #38465e; border-radius: .26rem; font: 650 1.05rem var(--mono); color: var(--violet); }
.bit.zero { color: var(--mint); }
.bit.empty { color: var(--soft); font-weight: 400; }
.bit.error-bit { border-color: var(--red); background: #3f2727; color: var(--red); }
.metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .7rem; border-top: 1px solid var(--line); margin: 1.15rem 0 0; padding-top: .9rem; }
.metrics dt { color: var(--muted); font-size: .82rem; }
.metrics dd { margin: .4rem 0 0; font: 600 clamp(1.05rem, 2vw, 1.55rem) var(--mono); }
details { border-top: 1px solid var(--line); margin-top: 1.2rem; padding-top: .3rem; }
summary { min-height: 44px; padding-block: .65rem; font-weight: 650; color: var(--mint); }
details ol, details p { color: var(--muted); line-height: 1.65; }
details p { margin-block: .6rem; }

.receive-panel { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel); border: 1px solid var(--line); border-radius: .7rem; overflow: clip; }
.receive-actions, .inbox { min-width: 0; padding: clamp(1.1rem,3.4vw,2rem); }
.receive-actions { border-right: 1px solid var(--line); }
.receive-actions > p { color: var(--muted); margin: .6rem 0 .9rem; }
.sender-link { border-top: 1px solid var(--line); margin-top: 1.15rem; padding-top: 1rem; }
.link-field { display: flex; gap: .5rem; margin-top: .42rem; }
.link-field input { min-width: 0; flex: 1; font: .83rem var(--mono); }
.inbox { background: radial-gradient(ellipse at 90% 0%, #20323791, transparent 66%), var(--panel-quiet); }
.inbox output { font: .96rem var(--mono); color: var(--mint); }
.status { color: var(--muted); font-size: .9rem; line-height: 1.5; margin-block: .6rem; }
.records { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.records li { border-top: 1px solid var(--line); padding: .65rem 0 0; display: grid; gap: .32rem .6rem; grid-template-columns: 1fr auto; align-items: baseline; min-width: 0; }
.records code { font-family: var(--mono); font-weight: 620; color: var(--mint); overflow-wrap: anywhere; }
.records time, .records small { color: var(--muted); font-size: .81rem; }
.records small { grid-column: 1 / -1; overflow-wrap: anywhere; font-family: var(--mono); }
.plain-action { min-height: 44px; background: transparent; color: var(--muted); border: 0; text-decoration: underline; text-underline-offset: .18em; padding: 0; }
.plain-action:hover { color: var(--ink); }
.radio-panel { border-block: 1px solid var(--line); padding-block: 1.12rem; }
.radio-settings { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .65rem 1.15rem; align-items: end; }
.frequency-range { display: flex; gap: .7rem; flex-wrap: wrap; }
.frequency-range input { display: block; width: 8rem; margin-top: .35rem; }
.radio-control-box { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1.05rem; }
.radio-results { margin-top: .8rem; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: start; }
th, td { border-top: 1px solid var(--line); padding: .62rem .66rem .62rem 0; text-align: start; white-space: nowrap; }
th { color: var(--muted); font-size: .86rem; }
td { font-family: var(--mono); font-size: .84rem; }
.new-report { color: var(--mint); }
.source-link { color: var(--mint); font-size: .86rem; min-height: 44px; display: inline-flex; align-items: center; }
.file-label { display: grid; width: fit-content; max-width: 100%; gap: .5rem; margin-top: 1rem; }
input[type=file] { max-width: 100%; min-height: 44px; }
input::file-selector-button { color: var(--ink); background: #172031; border: 1px solid #42506a; border-radius: .35rem; padding: .55rem .7rem; margin-inline-end: .65rem; }
#spectrum-diagram { width: 100%; height: 160px; display: block; margin-top: .6rem; background: var(--panel-quiet); }

.site-footer { padding-block: 1rem 2rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .25rem 1.2rem; }
.site-footer p { color: var(--muted); font-size: .86rem; }
.send-page { min-height: 100svh; background: radial-gradient(ellipse at top right,#183c40 0%,transparent 48%), var(--bg); }
.send-wrap { width: min(31rem,calc(100% - 2rem)); margin: clamp(3rem,14vh,8rem) auto; padding: clamp(1.3rem,5vw,2.2rem); background: var(--panel); border: 1px solid var(--line); border-radius: .65rem; }
.send-wrap h1 { font-size: clamp(3.2rem,8vw,5rem); }
.send-wrap > p:not(.eyebrow) { color: var(--muted); margin-top: .65rem; }
.send-wrap form { display: grid; gap: .62rem; margin: 1.2rem 0; }
.send-wrap form input { width: 100%; font-family: var(--mono); }
.send-wrap form .button { justify-self: start; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 820px) {
  .hero { min-height: 495px; }
  .section-heading { grid-template-columns: 1fr; }
  .hero-art { width: 112%; right: -7%; }
}
@media (max-width: 690px) {
  .masthead { gap: .15rem .85rem; flex-wrap: wrap; padding-block: .2rem; }
  .masthead nav { width: 100%; justify-content: space-between; column-gap: .45rem; }
  .hero { min-height: min(525px, 78svh); padding-block: 4rem 2.55rem; }
  .hero-art { width: min(150%, 700px); right: -26%; }
  .hero-art::after { background: linear-gradient(90deg, var(--bg), #090c14ac 32%, transparent 70%), linear-gradient(0deg, var(--bg), transparent 42%, transparent 71%, var(--bg)); }
  .hero-art img { object-position: 46% 52%; opacity: .66; }
  .hero h1 { font-size: clamp(4.1rem,14vw,6.25rem); }
  .lab, .receive-panel { grid-template-columns: minmax(0,1fr); }
  .controls, .receive-actions { border-right: 0; border-bottom: 1px solid var(--line); }
  .controls { gap: 1.05rem; }
  .controls-actions .button { flex: 1 1 9.4rem; }
  .trace { grid-template-columns: 4.4rem minmax(0, 1fr); }
  .trace code { grid-column: 2; font-size: .81rem; }
  .radio-control-box { gap: .4rem .7rem; }
  .detector { gap: .35rem; font-size: .81rem; }
  .detector strong { font-size: .81rem; }
}
@media (max-width: 380px) {
  .masthead nav { font-size: .82rem; }
  .hero-copy { overflow-wrap: anywhere; }
  .hero h1 { font-size: 3.86rem; }
  .bits { gap: .16rem; }
  .bit { min-height: 32px; font-size: .9rem; }
  .detectors { gap: .62rem; }
  .detector span { gap: .28rem; }
  .frequency-range { gap: .55rem; }
  .frequency-range input { width: 7.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.cover-page { overflow-x: clip; }
.cover { min-height: 100vh; min-height: 100svh; padding-block: 2rem; }
.cover .hero-art { width: min(1320px,118%); }
.cover .button { margin-top: clamp(1.85rem, 4.2vw, 2.95rem); min-width: 6.5rem; }
.door-state { display: inline-flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .87rem; }
.door-state::before { content: ""; width: .68rem; height: .68rem; border: 1px solid currentColor; border-radius: 50%; }
.receive-panel[data-open="true"] .door-state { color: var(--mint); }
.receive-panel[data-open="true"] .door-state::before { background: var(--mint); box-shadow: 0 0 .75rem #a4f1da59; }
.code-legend { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; margin: 0 0 .75rem; }
.code-legend div { border-top: 1px solid var(--line); padding-top: .38rem; }
.code-legend dt { color: var(--mint); font: 650 .9rem var(--mono); }
.code-legend dd { margin: .18rem 0 0; color: var(--muted); font-size: .85rem; }
@media (max-width: 690px) { .cover .hero-art { width: min(150%,700px); } }

.receiver-test { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.test-code-panel { margin-top: .75rem; }
#receiver-test-status:empty { display: none; }

.calibration { margin-block: 1.15rem; padding: .85rem; border: 1px solid var(--line); border-radius: .5rem; }
.calibration h2, .calibration h3 { margin: 0 0 .75rem; font-size: 1rem; }
.calibration .calibration-preview { display: flex; align-items: center; gap: .85rem; margin-bottom: .7rem; }
.calibration-ring { width: 2.35rem; height: 2.35rem; flex: 0 0 auto; border: 2px solid #475868; border-radius: 50%; background: #0a111b; }
.calibration[data-flash="true"] .calibration-ring { border-color: var(--mint); background: #67c9b3; box-shadow: 0 0 .9rem #67c9b377; }
.calibration-pattern { display: block; color: var(--mint); font: 650 1rem var(--mono); letter-spacing: .14em; }
.calibration-beat { color: var(--muted); font-size: .82rem; }
.calibration .calibration-results { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem .6rem; margin: .8rem 0 0; font-size: .84rem; }
.calibration .calibration-results[hidden] { display: none; }
.calibration-results dd { margin: 0; color: var(--mint); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) {
  .calibration[data-flash="true"] .calibration-ring { border-color: #475868; background: #0a111b; box-shadow: none; }
}

.bell-panel { padding: clamp(1rem, 3.3vw, 2rem); border: 1px solid var(--line); background: var(--panel); border-radius: .7rem; }
.bell-explainer, .bell-invite p, .bell-context { color: var(--muted); }
.bell-explainer { margin-bottom: 1rem; }
.bell-invite { display: grid; gap: .5rem; max-width: 39rem; margin: .6rem 0 1rem; }
.bell-invite label, .bell-step label { font-weight: 650; }
.bell-invite p, .bell-context { font-size: .94rem; }
.bell-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: .75rem; margin: .9rem 0; }
.bell-step { display: grid; align-content: start; gap: .55rem; min-width: 0; padding: 1rem; background: var(--panel-quiet); border: 1px solid var(--line); border-radius: .5rem; }
.bell-step h4 { font-size: 1rem; margin: 0 0 .2rem; }
.bell-step select { width: 100%; font: inherit; min-height: 44px; border-radius: .35rem; padding: .48rem; border: 1px solid #697a92; color: var(--ink); background: var(--bg); }
.bell-field { display: grid; gap: .45rem; }
.bell-step button { justify-self: start; }
.bell-step:only-child, #bell-measure:not([hidden]):last-of-type { max-width: 32rem; }
.bell-readout { display: grid; grid-template-columns: minmax(6rem, 1fr) minmax(0, 1fr); gap: .35rem .7rem; margin: .5rem 0; }
.bell-readout dt { color: var(--muted); }
.bell-readout dd { margin: 0; color: var(--mint); font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bell-comparison { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.bell-comparison > p { margin-top: .55rem; }
.bell-comparison .bell-readout { max-width: 36rem; margin: .75rem 0; }
.bell-table-wrap { width: 100%; overflow-x: auto; }
.bell-table { width: min(100%, 38rem); border-collapse: collapse; font-variant-numeric: tabular-nums; }
.bell-table caption { text-align: start; color: var(--ink); font-weight: 650; padding: .45rem 0; }
.bell-table th, .bell-table td { padding: .52rem .45rem; border-bottom: 1px solid var(--line); text-align: start; }
.bell-table th { color: var(--muted); font-weight: 550; }
#bell-records { margin-top: .7rem; }
#bell-records ol { color: var(--muted); padding-inline-start: 1.7rem; }
#bell-status { margin-top: .65rem; }
#bell-status:empty { display: none; }
@media (max-width: 610px) { .bell-steps { grid-template-columns: minmax(0, 1fr); } }
