/* ==========================================================================
   filejaunt — paper edition, 1956
   A pulp-SF technical manual: aged paper, navy ink, two press accents
   (ignition red, beam amber), screen-print patterns of the era — halftone
   dots, an atomic starburst, graph-paper grids, a starfield for the night
   panel. Hard rules, square corners, no shadows except printed offsets.
   Fonts: Jost (SIL OFL 1.1, variable) and Courier Prime (SIL OFL 1.1),
   self-hosted in /fonts; licenses alongside.
   ========================================================================== */

@font-face {
  font-family: 'Jost';
  src: url('fonts/jost-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Courier Prime';
  src: url('fonts/courier-prime-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Courier Prime';
  src: url('fonts/courier-prime-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* the press: paper field, navy ink, red + amber accents */
  --paper: #f2e8cf;
  --paper-lift: #f8f0dc;
  --paper-input: #fbf4e0;
  --paper-dim: #e3d5b3;
  --ink: #1a1530;
  --ink-lift: #252047;
  --ink-2: #57506e;
  --flash: #d63b1d; /* shapes and fills only */
  --flash-2: #b72e12; /* red that may carry text on paper (5.05:1) */
  --beam: #e9a83d; /* amber shapes on paper */
  --beam-2: #f4b942; /* amber text on ink (9.9:1) */
  --teal: #206e6a; /* instrument text on paper (4.9:1) */
  --teal-2: #6fd1c9; /* instrument text on ink (9.7:1) */
  --line: rgba(26, 21, 48, 0.28);
  --line-soft: rgba(26, 21, 48, 0.16);
  --line-paper: rgba(242, 232, 207, 0.24);

  --display: 'Jost', 'Futura', 'Century Gothic', system-ui, sans-serif;
  --mono: 'Courier Prime', 'Courier New', ui-monospace, monospace;

  --pad-x: clamp(20px, 6vw, 88px);
  --gap: clamp(20px, 4vw, 40px);
  --step-2: clamp(1.6rem, 1.15rem + 1.6vw, 2.3rem);
  --step-3: clamp(2.1rem, 1.4rem + 2.6vw, 3.4rem);
  --display-size: clamp(2.7rem, 7vw, 5.6rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--display);
  font-size: 1.0625rem;
  line-height: 1.6;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--flash-2);
  color: var(--paper);
}

img,
svg {
  max-width: 100%;
  display: block;
}

.hide {
  display: none !important;
}

/* ---- iconography -------------------------------------------------------- */

.glyph {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

/* ---- shared controls ---------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 22px;
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: 600 1rem/1 var(--display);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.btn:hover {
  background: var(--ink);
  color: var(--paper);
}

.btn--primary {
  background: var(--flash-2);
  border-color: var(--ink);
  color: var(--paper);
  box-shadow: 6px 6px 0 var(--ink);
}

.btn--primary:hover {
  background: var(--flash-2);
  color: var(--paper);
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--ink);
}

.btn--primary:active {
  transform: translate(2px, 2px);
  box-shadow: 3px 3px 0 var(--ink);
}

.btn--ink {
  border-color: var(--flash-2);
  background: var(--flash-2);
  color: var(--paper);
}

.btn--ink:hover {
  background: var(--paper);
  border-color: var(--paper);
  color: var(--flash-2);
}

.btn--small {
  padding: 8px 12px;
  font-size: 0.85rem;
}

.btn .glyph {
  width: 18px;
  height: 18px;
}

.glyph--fill {
  fill: currentColor;
  stroke: none;
}

.rail-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.rail-link .glyph {
  width: 15px;
  height: 15px;
}

:focus-visible {
  outline: 3px solid var(--flash-2);
  outline-offset: 3px;
}

/* ==========================================================================
   Landing
   ========================================================================== */

.rail {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px var(--pad-x);
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--ink);
}

.rail nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
  flex-wrap: wrap;
}

.rail nav a {
  display: inline-flex;
  align-items: center;
}

.rail nav a {
  font-size: 0.9rem;
  color: var(--ink-2);
  text-decoration: none;
}

.rail nav a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.rail .rail-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 2px solid var(--ink);
  padding: 7px 14px;
  background: var(--flash-2);
  color: var(--paper);
}

.rail .rail-cta:hover {
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}

.rail .rail-cta .glyph {
  width: 15px;
  height: 15px;
}

.lamp {
  font: 400 0.72rem/1 var(--mono);
  padding: 6px 9px;
  border: 1px solid var(--line);
  color: var(--ink-2);
}

.lamp--direct {
  border-color: var(--teal);
  color: var(--teal);
}

.lamp--relay {
  border-color: var(--flash-2);
  color: var(--flash-2);
}

.lamp--unknown {
  border-color: var(--line);
  color: var(--ink-2);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 4.5vw, 52px) var(--pad-x) clamp(32px, 5vw, 56px);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}

/* halftone plate, bottom-left, like a screened photo on the cover */
.hero::after {
  content: '';
  position: absolute;
  left: var(--pad-x);
  bottom: 0;
  width: min(430px, 42%);
  height: 200px;
  background-image: radial-gradient(circle, rgba(26, 21, 48, 0.18) 1.2px, transparent 1.9px);
  background-size: 8px 8px;
  background-position: 0 0;
  -webkit-mask-image: linear-gradient(#000 62%, transparent);
  mask-image: linear-gradient(#000 62%, transparent);
  pointer-events: none;
}

.hero > * {
  position: relative;
  z-index: 1;
}

/* atomic starburst, off-register behind the wordmark */
.starburst {
  position: absolute;
  top: clamp(-14px, -0.5vw, -4px);
  right: max(-70px, 2vw);
  width: clamp(190px, 22vw, 330px);
  height: clamp(190px, 22vw, 330px);
  z-index: 0;
  color: var(--flash);
  opacity: 0.5;
  pointer-events: none;
}

.display {
  margin: 0;
  font-size: var(--display-size);
  font-weight: 800;
  line-height: 0.8;
  letter-spacing: -0.045em;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 5px 5px 0 rgba(214, 59, 29, 0.32);
}

.lede {
  margin: clamp(16px, 2.5vw, 24px) 0 0;
  max-width: 34ch;
  font-size: clamp(1.35rem, 1rem + 1.3vw, 2.1rem);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.hero-note {
  margin: 18px 0 0;
  max-width: 52ch;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 36px;
}

/* security manifest: the promises, stamped like a customs label */
.guarantees {
  list-style: none;
  display: grid;
  gap: 12px;
  margin: 28px 0 0;
  padding: 0;
  max-width: 58ch;
}

.guarantees li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink);
}

.guarantees .glyph {
  color: var(--flash-2);
  margin-top: 1px;
}

/* the one loud object: the jump, drawn as a printed figure */
.beam-plate {
  position: relative;
  --plate-gap: clamp(12px, 2vw, 24px);
  margin: clamp(36px, 5vw, 60px) 0 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 0.9fr) minmax(0, 1fr);
  align-items: center;
  gap: var(--plate-gap);
  padding: clamp(16px, 2.4vw, 28px);
  border: 2px solid var(--ink);
  background: var(--paper-lift);
}

/* registration crop marks, two corners as on a print sheet */
.beam-plate::before,
.beam-plate::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.beam-plate::before {
  top: -16px;
  left: -16px;
  border-top: 2px solid var(--ink);
  border-left: 2px solid var(--ink);
}

.beam-plate::after {
  bottom: -16px;
  right: -16px;
  border-bottom: 2px solid var(--ink);
  border-right: 2px solid var(--ink);
}

.machine {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 96px;
  padding: 14px 16px;
  border: 2px solid var(--ink);
  background: var(--paper);
}

.machine-id {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-2);
}

.machine-role {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.machine-role .glyph {
  width: 18px;
  height: 18px;
  color: var(--flash-2);
}

.machine-file {
  margin-top: auto;
  align-self: flex-start;
  padding: 1px 5px;
  background: var(--paper);
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--teal);
}

/* the destination you picture before you jaunt: target rings */
.machine--target::before {
  content: '';
  position: absolute;
  inset: 6px;
  background: repeating-radial-gradient(circle at 50% 42%, rgba(214, 59, 29, 0.2) 0 1.5px, transparent 1.5px 13px);
  pointer-events: none;
}

.beam {
  position: relative;
  align-self: stretch;
}

.beam-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 14px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  /* reach under both machine plates so the beam reads A -> B, not floating */
  margin-inline: calc(-1 * var(--plate-gap));
}

/* the sender carries diagonal motion hatch, mirroring B's target rings */
.machine:not(.machine--target)::before {
  content: '';
  position: absolute;
  inset: 6px;
  background: repeating-linear-gradient(45deg, rgba(214, 59, 29, 0.18) 0 1.5px, transparent 1.5px 10px);
  pointer-events: none;
}

/* wire ports: a terminal on machine A's edge... */
.machine:not(.machine--target)::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  width: 8px;
  height: 8px;
  background: var(--ink);
  transform: translateY(-50%);
}

/* ...and an arrowhead entering machine B */
.machine--target::after {
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  border-left: 12px solid var(--flash-2);
  border-block: 6px solid transparent;
  z-index: 2;
}

.beam-track::before {
  content: '';
  width: 100%;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--flash-2) 0 8px, transparent 8px 16px);
  animation: beam-in 1.1s 0.15s ease-out both;
}

.beam-packet {
  position: absolute;
  top: 50%;
  left: 0;
  width: 13px;
  height: 13px;
  background: var(--flash);
  border: 2px solid var(--ink);
  transform: translateY(-50%) rotate(45deg);
  animation: packet 2.4s 0.9s ease-in-out both;
}

.beam-pass {
  position: absolute;
  top: calc(50% + 16px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 100%;
  margin: 0;
  display: grid;
  gap: 3px;
  font-family: var(--mono);
  text-align: center;
  line-height: 1.4;
}

.beam-pass-label {
  font-size: 0.66rem;
  color: var(--ink-2);
}

.beam-pass strong {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--flash-2);
}

.fig-cap {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.fig-cap strong {
  color: var(--flash-2);
  font-weight: 700;
}

@keyframes beam-in {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes packet {
  0% {
    left: 0;
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  88% {
    opacity: 1;
  }
  100% {
    left: calc(100% - 17px);
    opacity: 0;
  }
}

/* ---- steps (night panel with a starfield) -------------------------------- */

.steps {
  background: var(--paper);
  color: var(--ink);
  padding: clamp(48px, 7vw, 88px) var(--pad-x);
}

.steps h2 {
  margin: 0 0 clamp(28px, 4vw, 44px);
  max-width: 22ch;
  font-size: var(--step-3);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.025em;
}

.step-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 2px solid var(--ink);
}

.step {
  padding: 20px 28px 0 0;
  border-left: 2px solid var(--line);
  padding-left: 28px;
}

.step:first-child {
  border-left: 0;
  padding-left: 0;
}

.step-num {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--flash-2);
}

.step h3 {
  margin: 6px 0 8px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.step p {
  margin: 0;
  max-width: 34ch;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink-2);
}

/* ---- spec sheet on graph paper ------------------------------------------- */

.spec {
  padding: clamp(48px, 7vw, 88px) var(--pad-x);
  background-image:
    linear-gradient(rgba(26, 21, 48, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 21, 48, 0.055) 1px, transparent 1px);
  background-size: 26px 26px;
}

.spec h2 {
  margin: 0 0 clamp(24px, 4vw, 40px);
  max-width: 20ch;
  font-size: var(--step-2);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.spec dl {
  display: grid;
  grid-template-columns: minmax(120px, 200px) minmax(0, 1fr);
  margin: 0;
  border-top: 2px solid var(--ink);
  background: var(--paper-lift);
}

.spec dt {
  padding: 16px 24px 16px 16px;
  border-bottom: 2px solid var(--line);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--flash-2);
}

.spec dd {
  margin: 0;
  padding: 16px;
  border-bottom: 2px solid var(--line);
  border-left: 2px solid var(--line);
  max-width: 62ch;
  font-size: 1rem;
  color: var(--ink);
}

.spec dd a {
  color: var(--flash-2);
}

/* ---- closing band with print rays ---------------------------------------- */

.cta {
  padding: clamp(48px, 7vw, 88px) var(--pad-x);
  background-color: var(--flash-2);
  background-image: repeating-linear-gradient(115deg, rgba(26, 21, 48, 0.12) 0 2px, transparent 2px 28px);
  color: var(--paper);
}

.cta h2 {
  margin: 0;
  max-width: 24ch;
  text-wrap: balance;
  font-size: var(--step-3);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.cta p {
  margin: 14px 0 28px;
  max-width: 46ch;
  font-size: 1.05rem;
  color: var(--paper);
}

.cta .btn {
  background: var(--paper);
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
}

.cta .btn:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--flash);
}

/* ---- footer -------------------------------------------------------------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 32px;
  align-items: baseline;
  padding: 28px var(--pad-x) 40px;
  background: var(--ink);
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.footer a {
  color: var(--paper-dim);
  text-decoration: none;
}

.footer a:hover {
  color: var(--paper);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.footer .footer-end {
  margin-left: auto;
}

/* ==========================================================================
   Jaunt pad (app)
   ========================================================================== */

/* the functional section: a night panel with paper instrument cards */
.pad-section {
  background: var(--ink);
  color: var(--paper);
  padding: clamp(44px, 6vw, 76px) var(--pad-x) clamp(48px, 6vw, 76px);
  background-image:
    radial-gradient(circle, rgba(242, 232, 207, 0.12) 1px, transparent 1.5px),
    radial-gradient(circle, rgba(242, 232, 207, 0.07) 1px, transparent 1.5px);
  background-size: 280px 230px, 190px 160px;
  background-position: 40px 60px, 150px 20px;
}

.pad-wrap {
  max-width: 1180px;
  margin: 0 auto;
}

.pad-head h2 {
  margin: 0;
  font-size: clamp(1.9rem, 3vw, 2.7rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.03em;
  color: var(--paper);
}

.pad-head p {
  margin: 12px 0 0;
  max-width: 62ch;
  color: var(--paper-dim);
}

.pad-section :focus-visible {
  outline-color: var(--beam-2);
}

.mode-switch {
  display: grid;
  /* mirror the pane grid so Send aligns with Pairing and Receive with Outbound */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  gap: 16px;
  margin-top: 26px;
}

.mode-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 2px solid var(--ink);
  background: var(--paper-lift);
  color: var(--ink);
  font: 700 1.35rem/1 var(--display);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

/* fine print hatch, like a screened panel */
.mode-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, rgba(26, 21, 48, 0.05) 0 2px, transparent 2px 11px);
  pointer-events: none;
}

.mode-btn .glyph {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  padding: 6px;
  background: var(--flash);
  border: 2px solid var(--ink);
  color: var(--paper);
}

#btn-recv .glyph {
  background: var(--teal);
}

.mode-label {
  position: relative;
  z-index: 1;
}

.mode-btn small {
  position: relative;
  z-index: 1;
}

body.role-sender #btn-send::after,
body.role-receiver #btn-recv::after {
  content: none;
}

body.role-sender #btn-send .glyph,
body.role-receiver #btn-recv .glyph {
  background: var(--paper);
  color: var(--flash-2);
}

.mode-btn small {
  margin-left: auto;
  font: 400 0.76rem/1.3 var(--mono);
  color: var(--ink-2);
}

.mode-btn:hover {
  background: var(--paper);
  color: var(--ink);
}

.pad-section .mode-btn:hover small {
  color: var(--ink-2);
}

body.role-sender #btn-send,
body.role-receiver #btn-recv {
  background: var(--flash-2);
  border-color: var(--ink);
  color: var(--paper);
}

body.role-sender #btn-send small,
body.role-receiver #btn-recv small {
  color: var(--paper);
}

.panes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  gap: 20px;
  margin-top: 30px;
  align-items: start;
}

.pane {
  padding: clamp(16px, 2.4vw, 28px);
  border: 2px solid var(--ink);
  background: var(--paper-lift);
}

.pane h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.step-text {
  margin: 6px 0 16px;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--flash-2);
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.field label {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--ink-2);
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.pad-section input[type='text'],
.pad-section input[type='password'],
.pad-section input[type='number'],
.pad-section textarea,
.pad-section select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--line);
  background: var(--paper-input);
  color: var(--ink);
  font: 400 0.92rem/1.45 var(--mono);
}

.pad-section input:focus,
.pad-section textarea:focus,
.pad-section select:focus {
  border-color: var(--ink);
}

.pad-section textarea {
  resize: vertical;
}

/* blobs grow to fit where supported; elsewhere rows=6 scrolls */
#blob-in,
#blob-out {
  field-sizing: content;
  font-size: 0.78rem;
}

.pad-section select {
  width: auto;
}

/* passphrase: the one ink plate, amber like an instrument readout */
.pass-block {
  margin-top: 16px;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.pass-block > .pass-label {
  margin: 0;
  font: 700 0.74rem/1 var(--mono);
  color: var(--beam-2);
}

.pass-value {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
  margin-top: 8px;
}

#passphrase-out {
  font: 700 1.02rem/1.4 var(--mono);
  color: var(--beam-2);
  word-break: break-word;
}

.pass-hint {
  margin: 8px 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--paper-dim);
}

.pass-block :focus-visible {
  outline-color: var(--beam-2);
}

/* amber instrument button inside the ink plate */
.pass-block .btn--ink {
  background: var(--beam-2);
  border-color: var(--beam-2);
  color: var(--ink);
}

.pass-block .btn--ink:hover {
  background: var(--paper);
  border-color: var(--paper);
  color: var(--ink);
}

.pair-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 16px;
  align-items: center;
}

.pair-opts label {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--ink);
}

.pad-section input[type='number'] {
  width: 4.5rem;
  display: inline-block;
}

.pad-section input[type='checkbox'] {
  accent-color: var(--flash-2);
  width: 1rem;
  height: 1rem;
  vertical-align: -2px;
}

.manifest {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.manifest li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--paper-input);
}

.manifest .empty {
  display: block;
  border-style: dashed;
  color: var(--ink-2);
  font-size: 0.85rem;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 400 0.92rem/1.4 var(--mono);
}

.file-meta {
  font: 400 0.72rem/1.4 var(--mono);
  color: var(--ink-2);
  text-align: right;
}

.file-meta.verified {
  color: var(--teal);
}

.bar {
  grid-column: 1 / -1;
  height: 8px;
  background: rgba(26, 21, 48, 0.14);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--flash);
}

.row-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.row-actions button {
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  font: 400 0.72rem/1.4 var(--mono);
  cursor: pointer;
}

.row-actions button:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.download {
  grid-column: 1 / -1;
  justify-self: start;
  padding: 4px 10px;
  border: 1px solid var(--teal);
  color: var(--teal);
  font: 400 0.72rem/1.4 var(--mono);
  text-decoration: none;
}

.download:hover {
  background: var(--teal);
  color: var(--paper);
}

.drop {
  margin-top: 14px;
  padding: 14px;
  border: 2px dashed var(--line);
  display: grid;
  gap: 10px;
  background: var(--paper-input);
}

.drop input[type='file'] {
  font: 400 0.82rem/1.4 var(--mono);
  color: var(--ink-2);
}

.drop input[type='file']::file-selector-button {
  margin-right: 12px;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: 600 0.85rem/1 var(--display);
  cursor: pointer;
}

.drop input[type='file']::file-selector-button:hover {
  background: var(--ink);
  color: var(--paper);
}

.drop .hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-2);
}

.opts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 2px solid var(--line-soft);
}

.opts--top {
  margin-top: 14px;
  padding-top: 0;
  border-top: 0;
}

.opts label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--ink-2);
}

.opts .hint,
.hint {
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.storage-hint {
  max-width: 56ch;
  margin: 10px 0 0;
}

#video {
  width: 100%;
  max-width: 480px;
  margin-top: 14px;
  border: 2px solid var(--ink);
  background: var(--ink);
}

.text-log {
  margin: 14px 0 0;
  padding: 8px 10px;
  border-left: 3px solid var(--teal);
  background: var(--paper-input);
  font: 400 0.8rem/1.5 var(--mono);
  color: var(--ink);
  white-space: pre-wrap;
  min-height: 1.5em;
}

.text-log:empty {
  display: none;
}

/* the log stays a night instrument even on the paper page */
.log {
  margin: 24px 0 0;
  padding: 12px;
  max-height: 220px;
  overflow: auto;
  border: 2px solid var(--line-paper);
  background: var(--ink-lift);
  font: 400 0.74rem/1.5 var(--mono);
  color: var(--paper-dim);
  white-space: pre-wrap;
}

.advanced {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 2px solid var(--line-paper);
}

.advanced summary {
  color: var(--paper);
}

.advanced summary {
  cursor: pointer;
  font: 600 1rem/1.4 var(--display);
}

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.advanced-grid .field {
  align-content: start; /* fields in one row stretch; keep each row natural */
}

.advanced-grid .field label {
  display: block;
  min-height: 3em;
}

.doctor-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.pad-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 24px;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 2px solid var(--line-paper);
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--paper-dim);
}

.pad-foot a {
  color: var(--paper);
  text-decoration: none;
}

.pad-foot a:hover {
  color: var(--beam-2);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

body.role-receiver .sender-only {
  display: none;
}

/* ---- responsive --------------------------------------------------------- */

@media (max-width: 1080px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .panes {
    grid-template-columns: minmax(0, 1fr);
  }
  .step-list {
    grid-template-columns: minmax(0, 1fr);
  }
  .step {
    padding: 20px 0 0;
    border-left: 0;
    border-top: 2px solid var(--line);
  }
  .step:first-child {
    border-top: 0;
    padding-top: 0;
  }
  .spec dl {
    grid-template-columns: minmax(0, 1fr);
  }
  .spec dt {
    padding-bottom: 2px;
    border-bottom: 0;
  }
  .spec dd {
    padding-top: 4px;
    border-left: 0;
  }
}

@media (max-width: 640px) {
  .rail nav {
    gap: 14px;
  }
  .rail .rail-cta {
    padding: 6px 10px;
  }
  .beam-plate {
    grid-template-columns: minmax(0, 1fr);
  }
  .machine {
    min-height: 0;
  }
  .beam {
    grid-row: 2;
    align-self: auto;
    min-height: 118px;
  }
  .beam-track {
    top: 42%;
  }
  .beam-pass {
    top: auto;
    bottom: 6px;
  }
  .beam-plate .machine:last-of-type {
    grid-row: 3;
  }
  .fig-cap {
    grid-row: 4;
  }
  .mode-switch {
    grid-template-columns: minmax(0, 1fr);
  }
  .footer .footer-end {
    margin-left: 0;
  }
  .display {
    text-shadow: 3px 3px 0 rgba(214, 59, 29, 0.32);
  }
}

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