:root {
  color-scheme: dark;
  --bg: #0b0a0c;
  --panel: #141215;
  --edge: #3a3035;
  --muted: #b9aeb4;
  --text: #f6eff3;
  --red: #ff495c;
  --status-ok: #b2e8ca;
  --mono: "Cascadia Mono", Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 64% -12%, #400f1a 0%, transparent 54%), var(--bg);
  color: var(--text);
  font: 1rem/1.55 Inter, system-ui, sans-serif;
}
button, input { font: inherit; }
a { color: inherit; text-underline-offset: .22em; }
:focus-visible { outline: 2px solid #ff9ca5; outline-offset: 4px; }
.frame { width: min(100% - 48px, 1230px); margin-inline: auto; }
.visually-hidden, .skip:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip:focus { position: absolute; z-index: 1; padding: .6rem 1rem; background: var(--panel); }
.site-header { border-bottom: 1px solid var(--edge); }
.site-header-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand { font: 1.35rem Anton, sans-serif; letter-spacing: .125em; text-decoration: none; }
.brand span, .intro h1 span { color: var(--red); }
.back-link { color: var(--muted); font-size: .875rem; }
.back-link:hover { color: var(--text); }
.intro { padding: clamp(2.4rem, 6vw, 4.5rem) 0 2rem; }
.scope { color: var(--red); font: 600 .82rem/1.5 var(--mono); letter-spacing: .14em; margin: 0 0 .6rem; }
.intro h1 {
  margin: 0;
  font: 400 clamp(2.8rem, 7vw, 5.4rem)/1.08 Anton, sans-serif;
  letter-spacing: .024em;
}
.intro > :last-child { margin: .75rem 0 0; color: var(--muted); }
.station { display: grid; grid-template-columns: minmax(300px, .88fr) minmax(0, 1.12fr); gap: 1.3rem; }
.setup, .terminal, .help, .notice { border: 1px solid var(--edge); background: var(--panel); border-radius: .56rem; }
.setup, .terminal { display: flex; flex-direction: column; }
.step { width: 100%; margin: 0; padding: 1.23rem; border: 0; min-width: 0; }
.step + .step { border-top: 1px solid var(--edge); }
.step p { margin: .65rem 0; color: var(--muted); font-size: .9rem; }
.step p.detail { font: .77rem/1.5 var(--mono); margin-bottom: 0; }
.step-label {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0;
  padding: 0;
  font: 600 1.18rem/1.25 Oswald, sans-serif;
  letter-spacing: .05em;
  text-transform: uppercase;
}
fieldset.step { border: 0; margin: 0; }
fieldset.step legend { float: left; width: 100%; margin: 0 0 .75rem; }
.step-label > span { font: 600 .79rem var(--mono); color: var(--red); }
.file-choice {
  border: 1px dashed #70606a;
  border-radius: .35rem;
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem .7rem;
  cursor: pointer;
}
.file-choice:has(+ input:disabled) { cursor: default; opacity: .58; }
.file-choice:has(+ input:focus-visible) { outline: 2px solid #ff9ca5; outline-offset: 3px; }
.file-action { flex: none; color: var(--text); font-weight: 600; font-size: .85rem; }
#filename { color: var(--muted); overflow-wrap: anywhere; font: .78rem/1.4 var(--mono); }
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; clear: both; }
.role {
  display: flex;
  gap: .55rem;
  align-items: center;
  min-width: 0;
  padding: .65rem;
  border: 1px solid var(--edge);
  border-radius: .36rem;
  background: #1a171b;
  cursor: pointer;
}
.role:has(input:checked) { border-color: var(--red); background: #30151d; }
.role:has(input:disabled) { cursor: default; opacity: .68; }
.role:has(input:focus-visible) { outline: 2px solid #ff9ca5; outline-offset: 3px; }
.role input, .confirmation input { margin: 0; accent-color: var(--red); }
.role strong { display: block; font: 600 1rem Oswald, sans-serif; letter-spacing: .06em; }
.connect-step { display: flex; flex: 1; flex-direction: column; }
.flash-controls { margin-top: auto; padding-top: .25rem; }
.actions { display: flex; gap: .65rem; flex-wrap: wrap; }
button {
  border: 1px solid transparent;
  background: #ba1d37;
  color: white;
  border-radius: .34rem;
  padding: .52rem .8rem;
  font-weight: 600;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #d02846; }
button:disabled { cursor: default; opacity: .56; }
button.secondary { background: transparent; border-color: #6a515d; color: var(--text); }
button.secondary:hover:not(:disabled) { background: #30212b; }
.confirmation {
  margin-top: .9rem;
  padding: .75rem;
  border: 1px solid #76404c;
  border-radius: .35rem;
  background: #21151c;
}
.confirmation p { margin: 0 0 .55rem; font: .77rem/1.55 var(--mono); overflow-wrap: anywhere; }
.confirmation label { display: flex; align-items: flex-start; gap: .55rem; font-size: .87rem; }
.confirmation input { margin-top: .25rem; }
.confirmation button { margin-top: .7rem; }
.terminal {
  --terminal-edge: #3b2027;
  --terminal-red: #ff304a;
  overflow: hidden;
  border-color: var(--terminal-edge);
  border-top-color: var(--terminal-red);
  background: #080808;
}
.terminal-head {
  min-height: 52px;
  padding: .65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  border-bottom: 1px solid var(--terminal-edge);
}
.terminal-head h2 { margin: 0; font: 600 .98rem Oswald, sans-serif; letter-spacing: .1em; }
#terminal-state {
  padding: .13rem .4rem;
  border: 1px solid currentColor;
  border-radius: .28rem;
  color: var(--muted);
  font: .74rem/1.5 var(--mono);
  letter-spacing: .05em;
}
#terminal-state[data-tone="active"] { color: #f4cc92; }
#terminal-state[data-tone="good"] { color: var(--status-ok); }
#terminal-state[data-tone="error"] { color: #ff9baa; }
.terminal-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1.05rem 1rem .9rem;
}
.wordmark {
  min-height: 76px;
  margin: 0 0 1rem;
  padding: .32rem 0 .8rem;
  border-bottom: 1px solid var(--terminal-edge);
  overflow-x: auto;
  color: var(--terminal-red);
  font: 600 clamp(.59rem, 1.18vw, .86rem)/1.28 var(--mono);
}
#terminal-log {
  display: block;
  flex: 1 1 auto;
  height: 220px;
  contain: size;
  overflow: auto;
  margin: 0;
  color: #e8d6df;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: .84rem/1.6 var(--mono);
}
.terminal-foot {
  display: flex;
  align-items: center;
  gap: .7rem;
  flex-wrap: wrap;
  padding: .7rem 1rem;
  border-top: 1px solid var(--terminal-edge);
}
#status { flex: 1 1 210px; font-size: .83rem; margin: 0; color: var(--muted); }
.terminal-foot button { font-size: .8rem; }
.progress-region { flex-basis: 100%; }
.progress-region label { display: block; font: .79rem var(--mono); color: var(--muted); }
progress { width: 100%; height: .62rem; accent-color: var(--red); }
.help { margin: 1.25rem 0 3rem; padding: .75rem 1rem; }
.help summary { cursor: pointer; font-weight: 600; }
.help ul { margin: .58rem 0 .3rem; padding-left: 1.25rem; color: var(--muted); font-size: .9rem; }
.help li + li { margin-top: .38rem; }
.notice { padding: .7rem 1rem; color: var(--muted); }
@media (max-width: 810px) {
  .station { grid-template-columns: minmax(0, 1fr); }
  .wordmark { font-size: clamp(.59rem, 2.35vw, .88rem); }
  #terminal-log { height: 250px; }
}
@media (max-width: 390px) {
  .frame { width: calc(100% - 24px); }
  .step { padding: .9rem; }
  .file-choice { flex-wrap: wrap; }
  .brand { font-size: 1.15rem; }
  .back-link { font-size: .75rem; }
}
