@font-face {
  font-family: Inter;
  src: url("/fonts/Inter-variable-latin.woff2");
  font-weight: 400 600;
}
@font-face {
  font-family: Poppins;
  src: url("/fonts/Poppins-600-normal-latin.woff2");
  font-weight: 600;
}
:root {
  color-scheme: dark;
  --bg: #080e19;
  --panel: #111b2b;
  --line: #2b3b4f;
  --text: #eef6ff;
  --muted: #a9bace;
  --accent: #a9efd0;
  --danger: #ff927d;
  --blue: #76dfff;
  --violet: #b99bff;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.45 Inter,
    system-ui,
    sans-serif;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  min-height: 44px;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #172538;
  padding: 9px 13px;
  cursor: pointer;
  touch-action: manipulation;
}
button:hover {
  background: #23364a;
  border-color: #65849a;
}
button:active {
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
button[aria-pressed="true"],
button.selected {
  border-color: var(--accent);
  background: #1b3d38;
}
.primary {
  background: var(--accent);
  color: #09231e;
  font-weight: 600;
  border-color: transparent;
}
.primary:hover {
  background: #d0ffe8;
}
.quiet {
  background: transparent;
}
a {
  color: var(--muted);
  text-decoration: none;
}
a:hover {
  color: white;
}
.game {
  max-width: 1700px;
  margin: auto;
  padding: 0 20px 18px;
}
.masthead {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.masthead h1 {
  font-family: Poppins, system-ui;
  font-weight: 600;
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.6px;
}
.masthead h1 span {
  font-family: Inter;
  letter-spacing: 2px;
  font-size: 11px;
  color: var(--muted);
  margin-left: 12px;
}
.back {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 18px;
}
.utilities {
  display: flex;
  gap: 6px;
}
.utilities button {
  padding: 8px 12px;
  min-height: 40px;
  font-size: 12px;
}
.telemetry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  gap: 12px;
}
.stats {
  display: flex;
  gap: 26px;
}
.stat {
  display: grid;
  gap: 2px;
}
.stat small,
.eyebrow {
  font-size: 11px;
  letter-spacing: 1.4px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}
.stat strong {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat strong.accent {
  color: var(--accent);
}
.phase-chip {
  font-size: 12px;
  border: 1px solid var(--line);
  padding: 7px 11px;
  border-radius: 100px;
  color: var(--accent);
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}
.board-shell {
  position: relative;
  border: 1px solid #314256;
  background: #0c1523;
  border-radius: 14px;
  overflow: hidden;
  isolation: isolate;
}
.board-shell canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1000/640;
}
.board-label {
  position: absolute;
  top: 14px;
  left: 18px;
  font-size: 11px;
  letter-spacing: 2px;
  color: #adc4d6;
  pointer-events: none;
}
.board-label strong {
  display: block;
  color: #eaf4fe;
  font-size: 12px;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.board-foot {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.legend b {
  color: var(--accent);
  font-size: 15px;
  margin-right: 5px;
}
.legend b.hazard {
  color: var(--danger);
}
.stage-column {
  min-width: 0;
}
.context {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #121e2d;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 16px;
  min-height: 76px;
}
.context strong {
  font-size: 14px;
}
.context p {
  color: var(--muted);
  margin: 4px 0 0;
  font-size: 13px;
}
.sidebar {
  display: grid;
  gap: 12px;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 16px;
}
.panel h2 {
  font-size: 16px;
  margin: 0 0 8px;
  font-weight: 600;
}
.panel p {
  color: var(--muted);
  font-size: 13px;
  margin: 7px 0;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.panel-heading h2 {
  margin: 0;
}
.panel-heading small {
  font-size: 12px;
  color: var(--muted);
}
.choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.choice-row button {
  text-align: left;
  font-size: 13px;
}
.choice-row small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}
.station-list {
  display: grid;
  gap: 7px;
}
.station {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 9px;
  text-align: left;
  background: #152234;
  padding: 9px 10px;
  min-height: 66px;
}
.station .icon {
  font-size: 24px;
  color: var(--accent);
}
.station small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  margin-top: 3px;
}
.station strong {
  font-size: 14px;
}
.station .price {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.launch-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.launch-row .primary {
  flex: 1;
}
.full {
  width: 100%;
}
.progress {
  height: 5px;
  background: #283d4c;
  border-radius: 6px;
  overflow: hidden;
  margin: 10px 0;
}
.progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.15s;
}
.forecast {
  display: flex;
  gap: 5px;
  align-items: center;
  overflow: hidden;
  height: 27px;
}
.forecast span {
  font-size: 20px;
  line-height: 1;
}
.muted {
  color: var(--muted);
}
.tiny {
  font-size: 12px;
}
.message {
  color: var(--accent);
  min-height: 20px;
  font-size: 13px;
  margin: 10px 0 0;
}
.hotkeys {
  font-size: 12px;
  color: var(--muted);
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.hotkeys kbd {
  font: inherit;
  border-bottom: 1px solid #67819a;
  padding: 0 3px;
}
.socket-layer {
  position: absolute;
  inset: 0 0 auto;
  height: calc(100% - 40px);
  pointer-events: none;
}
.socket {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  width: 49px;
  height: 49px;
  min-height: 44px;
  padding: 0;
  background: #101e2b99;
  border: 1px dashed #58748b;
  color: #b2cde0;
  font-weight: 600;
  pointer-events: auto;
  box-shadow: 0 0 0 5px #0b111c44;
}
.socket:active {
  transform: translate(-50%, -50%);
}
.socket.built {
  border: 1px solid transparent;
  background: transparent;
  color: transparent;
  box-shadow: none;
}
.socket:hover,
.socket:focus-visible {
  border: 2px solid var(--accent);
  color: white;
  background: #153245aa;
}
.socket.selected {
  border: 2px solid #f0ffe7;
  box-shadow: 0 0 0 4px #b4f3d722;
}
.socket-label {
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #aac0d1;
  white-space: nowrap;
}
.socket.built .socket-label {
  color: #cae0eb;
}
dialog {
  color: var(--text);
  background: #101e2c;
  border: 1px solid #465b6a;
  border-radius: 18px;
  padding: 28px;
  width: min(510px, calc(100% - 28px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  box-shadow: 0 24px 130px #000b;
}
dialog::backdrop {
  background: #030914c9;
  backdrop-filter: blur(7px);
}
dialog h2 {
  font:
    600 29px/1.15 Poppins,
    system-ui;
  margin: 8px 0 16px;
  letter-spacing: -1px;
}
dialog p {
  color: #bed0df;
  line-height: 1.6;
}
dialog ul {
  padding-left: 20px;
  color: #bed0df;
}
dialog li {
  margin: 10px 0;
}
dialog .dialog-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}
.dialog-actions button {
  flex: 1;
}
dialog .result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
}
dialog .result-stats div {
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 10px;
}
dialog .result-stats strong {
  display: block;
  font-size: 24px;
  color: var(--accent);
}
dialog select {
  width: 100%;
  min-height: 46px;
  padding: 10px;
  background: #1b2d40;
  color: var(--text);
  border: 1px solid #5a7489;
  border-radius: 7px;
  margin-top: 7px;
}
/* Touch-only devices (including landscape phones and tablets) have no keyboard to hint at. */
@media (hover: none) and (pointer: coarse) {
  .keyboard-hint {
    display: none;
  }
}
/* Landscape phones: results and pauses fit without scrolling past their heading. */
@media (max-height: 500px) {
  dialog {
    padding: 18px 24px;
    width: min(620px, calc(100% - 28px));
  }
  dialog h2 {
    font-size: 23px;
    margin: 4px 0 8px;
  }
  dialog p {
    margin: 6px 0;
    line-height: 1.45;
  }
  dialog .result-stats {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 10px 0;
  }
  dialog .result-stats div {
    padding: 8px;
  }
  dialog .result-stats strong {
    font-size: 19px;
  }
  dialog .dialog-actions {
    margin-top: 12px;
  }
}
#load-error {
  padding: 20px;
  background: #6d2929;
  color: white;
}
.science-note {
  color: #95abbc;
  font-size: 12px;
  line-height: 1.6;
}
.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.setting input {
  min-width: 23px;
  min-height: 23px;
}
.hidden,
[hidden] {
  display: none !important;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
@media (min-width: 1450px) {
  .game {
    padding: 0 36px 20px;
  }
  .workspace {
    grid-template-columns: minmax(0, 1fr) 330px;
  }
  .panel {
    padding: 20px;
  }
}
@media (max-width: 1000px) {
  .game {
    padding: 0 12px 14px;
  }
  .workspace {
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 12px;
  }
  .panel {
    padding: 12px;
  }
  .masthead h1 span {
    display: none;
  }
  .stats {
    gap: 17px;
  }
  .stat strong {
    font-size: 22px;
  }
  .board-foot {
    padding: 8px;
    font-size: 11px;
  }
  .socket {
    width: 44px;
    height: 44px;
  }
  .socket-layer {
    height: calc(100% - 34px);
  }
}
@media (max-width: 760px) {
  .game {
    padding: 0 10px 16px;
  }
  .masthead {
    height: 56px;
    gap: 8px;
  }
  .brand {
    gap: 10px;
  }
  .masthead h1 {
    font-size: 19px;
  }
  .back {
    font-size: 11px;
  }
  .utilities {
    gap: 4px;
  }
  .utilities button {
    font-size: 11px;
    padding: 6px 8px;
    min-height: 38px;
  }
  .telemetry {
    padding: 12px 0;
  }
  .stats {
    gap: 20px;
  }
  .stat small {
    font-size: 10px;
    letter-spacing: 1px;
  }
  .stat strong {
    font-size: 22px;
  }
  .phase-chip {
    font-size: 10px;
    padding: 5px 8px;
  }
  .workspace {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .stage-column,
  .sidebar {
    width: 100%;
  }
  .board-shell {
    border-radius: 10px;
  }
  .board-label {
    top: 9px;
    left: 10px;
    font-size: 8px;
    letter-spacing: 1px;
  }
  .board-label strong {
    font-size: 9px;
  }
  .board-foot {
    font-size: 10px;
    padding: 8px 10px;
    min-height: 32px;
  }
  .legend {
    gap: 9px;
  }
  .legend b {
    font-size: 12px;
    margin-right: 3px;
  }
  .socket-layer {
    height: calc(100% - 33px);
  }
  .socket {
    width: 44px;
    height: 44px;
    min-height: 44px;
    font-size: 11px;
    box-shadow: none;
  }
  .socket-label {
    display: none;
  }
  .context {
    padding: 11px 12px;
    min-height: 70px;
    margin-top: 8px;
  }
  .context p {
    font-size: 12px;
  }
  .context strong {
    font-size: 13px;
  }
  .sidebar {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .panel {
    padding: 12px;
    border-radius: 10px;
  }
  .station-panel {
    grid-column: 1/-1;
  }
  .station-list {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
  }
  .station {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 9px 8px;
    min-height: 86px;
    align-content: start;
  }
  .station .icon {
    font-size: 20px;
  }
  .station strong {
    font-size: 12px;
  }
  .station .price {
    font-size: 11px;
    margin-left: auto;
  }
  .station .station-copy {
    display: contents;
  }
  .station small {
    order: 4;
    flex-basis: 100%;
    font-size: 10px;
    margin: 0;
  }
  .panel h2 {
    font-size: 14px;
  }
  .panel p {
    font-size: 12px;
  }
  .choice-row {
    gap: 6px;
  }
  .choice-row button {
    font-size: 12px;
    padding: 7px;
  }
  .choice-row small {
    font-size: 10px;
  }
  .hotkeys {
    font-size: 10px;
    padding-top: 10px;
  }
  .keyboard-hint {
    display: none;
  }
  .result-stats strong {
    font-size: 21px;
  }
}
@media (max-width: 359px) {
  .stats {
    gap: 12px;
  }
  .utilities button {
    padding: 6px;
  }
  .brand {
    gap: 7px;
  }
  .masthead h1 {
    font-size: 16px;
  }
  .sidebar {
    gap: 7px;
  }
  .panel {
    padding: 9px;
  }
  .phase-chip {
    max-width: 70px;
  }
  .socket {
    width: 44px;
    height: 44px;
  }
  .board-foot .detail {
    display: none;
  }
}
@media (max-height: 580px) and (min-width: 761px) {
  .masthead {
    height: 46px;
  }
  .telemetry {
    padding: 8px 0;
  }
  .board-shell {
    max-width: 720px;
  }
  .panel {
    padding: 9px;
  }
  .station {
    min-height: 48px;
  }
  .station small {
    font-size: 10px;
  }
  .sidebar {
    gap: 7px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
/* Keep the playfield and launch controls visible on ordinary laptop displays. */
@media (min-width: 761px) and (max-height: 1000px) {
  .masthead {
    height: 49px;
  }
  .telemetry {
    padding: 9px 0;
  }
  .board-shell {
    max-width: max(460px, calc((100dvh - 235px) * 1.5625));
    margin: auto;
  }
  .panel {
    padding: 11px 13px;
  }
  .sidebar {
    gap: 8px;
  }
  .station {
    min-height: 52px;
    padding: 7px 8px;
  }
  .station small {
    font-size: 10px;
  }
  .station strong {
    font-size: 13px;
  }
  .panel-heading {
    margin-bottom: 7px;
  }
  .panel p {
    font-size: 12px;
    margin: 6px 0;
  }
  .message {
    font-size: 12px;
    margin-top: 7px;
    min-height: 17px;
  }
  .choice-row button {
    padding: 7px 8px;
  }
  .context {
    min-height: 66px;
    padding: 10px 13px;
  }
  .board-label {
    top: 11px;
    left: 12px;
  }
  .board-label strong {
    font-size: 10px;
  }
  .board-label {
    font-size: 9px;
  }
  .board-foot {
    font-size: 10px;
    min-height: 32px;
    padding: 8px 10px;
  }
  .socket-layer {
    height: calc(100% - 33px);
  }
  .station-list.selection-open {
    display: none;
  }
  .selection-back {
    width: 100%;
    margin-bottom: 8px;
    min-height: 36px;
    padding: 6px;
    font-size: 12px;
  }
}

.station-list.selection-open {
  display: none;
}
.selection-back {
  width: 100%;
  margin-bottom: 8px;
  min-height: 40px;
  padding: 7px;
  font-size: 12px;
}
@media (max-width: 760px) {
  .utilities button {
    min-height: 44px;
    min-width: 44px;
  }
  .back {
    display: flex;
    align-items: center;
    min-height: 44px;
    min-width: 44px;
  }
  .range-row button {
    min-width: 44px;
    width: 44px;
  }
  .lane-button {
    min-height: 44px;
  }
}
@media (max-width: 359px) {
  #sound {
    font-size: 0;
    width: 44px;
    padding: 0;
  }
  #sound::before {
    content: "♫";
    font-size: 18px;
  }
  .utilities {
    gap: 3px;
  }
  .brand {
    gap: 5px;
  }
  .masthead {
    gap: 5px;
  }
}
.context > div {
  min-width: 0;
  flex: 1;
}
.context > span {
  flex: 0 0 auto;
  text-align: right;
}
.sidebar,
.panel,
.forecast {
  min-width: 0;
  max-width: 100%;
}
.forecast {
  overflow-x: auto;
  scrollbar-width: thin;
}
.forecast span {
  flex: 0 0 auto;
}
@media (pointer: coarse), (max-width: 1050px) {
  .utilities button,
  .selection-back {
    min-height: 44px;
    min-width: 44px;
  }
  .back {
    display: flex;
    align-items: center;
    min-height: 44px;
  }
}
@media (max-width: 359px) {
  .game:not(.threadline) .board-shell canvas {
    aspect-ratio: 1000/740;
  }
}
@media (max-width: 760px) {
  .telemetry .phase-chip {
    display: none;
  }
  .stats {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
  .stat small,
  .stat strong {
    white-space: nowrap;
  }
  .socket {
    background: transparent;
    border: 0;
    box-shadow: none;
    isolation: isolate;
  }
  .socket::before {
    content: "";
    position: absolute;
    inset: 9px;
    z-index: -1;
    border: 1px dashed #7895a9;
    border-radius: 50%;
    background: #101f30cc;
  }
  .socket.built::before {
    display: none;
  }
  .socket:hover,
  .socket:focus-visible,
  .socket.selected {
    background: transparent;
    box-shadow: none;
    border: 0;
  }
  .socket.selected::before {
    border: 2px solid #d4ffe9;
  }
  .socket.built:focus-visible {
    outline: 2px solid #c6fad9;
    outline-offset: -5px;
  }
  .back {
    white-space: nowrap;
  }
}
@media (max-width: 359px) {
  .stat small {
    font-size: 9px;
  }
  .back {
    font-size: 10px;
    min-width: 43px;
  }
  .game:not(.threadline) .board-shell canvas {
    aspect-ratio: 1000/740;
  }
}
