@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700;800&family=DM+Sans:wght@400;500;600;700&display=swap");
:root {
  color-scheme: dark;
  --bg: #0c1222;
  --panel: #141e31;
  --line: #2b364d;
  --mint: #a8f083;
  --muted: #94a3bc;
  --text: #edf2ff;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 14px;
}
.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(#52617b 1px, transparent 1px);
  background-size: 79px 83px;
  opacity: 0.22;
}
button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  cursor: pointer;
  color: inherit;
  border: 1px solid var(--line);
  background: #202c42;
  border-radius: 10px;
  padding: 11px 15px;
  transition:
    background 0.15s,
    transform 0.15s;
}
button:hover:not(:disabled) {
  background: #34435c;
  transform: translateY(-2px);
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: 4px;
}
button:disabled {
  cursor: default;
  opacity: 0.4;
}
header,
main {
  position: relative;
  max-width: 1280px;
  margin: auto;
  padding: 0 40px;
}
header {
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #263047;
}
.brand {
  text-decoration: none;
  letter-spacing: 2px;
  font-weight: 700;
  font-size: 20px;
  color: white;
}
.brand b {
  color: var(--mint);
}
.brand-icon {
  color: var(--mint);
  font-size: 30px;
  margin-right: 12px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.local,
.eyebrow,
.panel-heading,
.map-caption,
footer,
.bridge-label,
.you-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.7px;
}
.local {
  color: var(--muted);
  margin-right: 10px;
}
.icon-btn {
  background: transparent;
  padding: 9px 12px;
  font-size: 12px;
}
.intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 36px 0 30px;
}
.eyebrow {
  color: var(--mint);
  margin: 0 0 12px;
}
h1 {
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-size: 66px;
  line-height: 0.98;
  letter-spacing: -0.5px;
  text-transform: uppercase;
  margin: 0 0 16px;
}
h1 span {
  color: var(--mint);
}
.subtitle {
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}
.mission-badge {
  display: flex;
  gap: 20px;
  align-items: center;
  padding-right: 24px;
}
.mission-badge small {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 1.4px;
}
.mission-badge strong,
.mission-badge span:not(.orbit) {
  display: block;
  margin-top: 8px;
}
.mission-badge span:not(.orbit) {
  color: var(--mint);
  font-size: 12px;
}
.orbit {
  font-size: 72px;
  color: var(--mint);
  font-weight: 400;
}
.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 22px;
}
.ship-panel {
  border: 1px solid var(--line);
  background: #101a2b;
  border-radius: 18px;
  overflow: hidden;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  padding: 19px 22px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 9px;
  letter-spacing: 1px;
}
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
  margin-right: 7px;
}
.ship-space {
  height: 390px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 60%, #21364c66, transparent 65%),
    radial-gradient(#78879f66 1px, transparent 1px);
  background-size:
    auto,
    47px 53px;
}
.planet {
  position: absolute;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  right: -75px;
  top: -75px;
  background: #25374a;
  box-shadow: inset 25px -20px 0 #1b2a3e;
}
.ship {
  position: absolute;
  inset: 28px 30px 42px;
}
.corridor {
  position: absolute;
  background: #3a485d;
  border: 7px solid #202c40;
  box-shadow: 0 0 0 2px #57627a;
  border-radius: 14px;
}
.horizontal {
  left: 4%;
  right: 4%;
  top: 42%;
  height: 22%;
}
.vertical {
  top: 4%;
  bottom: 4%;
  width: 20%;
  left: 40%;
}
.ship-nose {
  position: absolute;
  right: -3%;
  top: 37%;
  width: 13%;
  height: 32%;
  background: #536079;
  border-radius: 0 70% 70% 0;
  border: 7px solid #29374b;
}
.engine-flame {
  position: absolute;
  left: -4%;
  top: 46%;
  width: 13%;
  height: 14%;
  background: linear-gradient(90deg, transparent, #78e5ea);
  border-radius: 90% 0 0 90%;
  animation: thrust 1s infinite alternate;
}
.room {
  position: absolute;
  width: 37%;
  height: 38%;
  border: 5px solid #46556d;
  border-radius: 15px;
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, #ffffff04 23px 24px),
    #253449;
  box-shadow:
    0 8px 0 #080f1a88,
    inset 0 0 0 2px #141f32;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px;
}
.room:hover:not(:disabled) {
  background-color: #314661;
  transform: translateY(-3px);
}
.room:disabled {
  opacity: 1;
}
.room-0 {
  left: 7%;
  top: 2%;
  --accent: #ffd277;
}
.room-1 {
  right: 7%;
  top: 2%;
  --accent: #b19bff;
}
.room-2 {
  left: 7%;
  bottom: 0;
  --accent: #64d8e7;
}
.room-3 {
  right: 7%;
  bottom: 0;
  --accent: #ff93b6;
}
.room svg {
  width: 44px;
  height: 32px;
  color: var(--accent);
}
.room strong {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.room small {
  font-size: 10px;
  color: var(--accent);
}
.room.done {
  border-color: #64976d;
}
.room.done small {
  color: var(--mint);
}
.task-dot {
  position: absolute;
  right: 9px;
  top: 8px;
  background: var(--accent);
  color: #172033;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: bold;
  font-size: 11px;
}
.bridge {
  position: absolute;
  left: 42%;
  top: 34%;
  width: 16%;
  height: 34%;
  display: flex;
  align-items: center;
  flex-direction: column;
  pointer-events: none;
}
.bridge-label {
  font-size: 7px;
  color: #9cabc4;
}
#player {
  width: 54px;
  height: 66px;
  filter: drop-shadow(0 6px 3px #0005);
}
.you-tag {
  font-size: 8px;
  color: var(--mint);
  background: #172633;
  border-radius: 4px;
  padding: 2px 6px;
}
.map-caption {
  position: absolute;
  bottom: 14px;
  left: 22px;
  right: 22px;
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  color: #899cb6;
  letter-spacing: 1px;
}
.ship-footer {
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  border-top: 1px solid var(--line);
}
.ship-footer .eyebrow {
  font-size: 8px;
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
}
.ship-footer strong {
  font-size: 11px;
}
.progress-track {
  height: 8px;
  border-radius: 8px;
  background: #293448;
  flex: 1;
  overflow: hidden;
}
#progress {
  height: 100%;
  background: var(--mint);
  width: 0;
  transition: width 0.4s;
}
#percent {
  font-size: 12px;
  color: var(--mint);
}
aside {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  padding: 25px;
  display: flex;
  flex-direction: column;
}
h2 {
  font-size: 25px;
  margin: 0 0 10px;
  letter-spacing: -0.6px;
}
p {
  line-height: 1.6;
}
.muted {
  color: var(--muted);
}
aside p {
  font-size: 12px;
  margin: 0 0 19px;
}
.table-options {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin: 10px 0 12px;
}
.table-options button {
  padding: 9px 0;
  border-radius: 7px;
  font-size: 12px;
}
.table-options button.selected {
  background: var(--mint);
  color: #172629;
  border-color: var(--mint);
  font-weight: 700;
}
.preset-row {
  display: flex;
  gap: 7px;
}
.preset-row button {
  font-size: 10px;
  padding: 6px 9px;
  border-radius: 6px;
}
.primary {
  background: var(--mint);
  border-color: var(--mint);
  color: #172629;
  font-weight: 700;
  min-height: 48px;
}
.primary:hover:not(:disabled) {
  background: #bdfb9e;
}
aside .primary {
  width: 100%;
  margin-top: auto;
}
label.label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted);
}
.mission-meta {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 10px;
  margin: 18px 0;
}
.bottom-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
  padding: 27px 0;
  border-bottom: 1px solid var(--line);
}
.bottom-strip > div {
  display: flex;
  gap: 14px;
  align-items: center;
}
.bottom-strip > div > span {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 28px;
  color: #56677e;
}
.bottom-strip p {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}
.bottom-strip strong {
  display: block;
  color: #dce6f6;
  font-size: 12px;
  margin-bottom: 2px;
}
footer {
  display: flex;
  justify-content: space-between;
  padding: 20px 0 28px;
  color: #71829b;
  font-size: 8px;
  letter-spacing: 1px;
}
.crew-row {
  display: flex;
  justify-content: space-between;
  margin: 5px 0 20px;
}
.crew-mini {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
}
.crew-mini svg {
  width: 42px;
  height: 52px;
  display: block;
  margin: auto;
}
.clue {
  font-size: 12px;
  line-height: 1.6;
  padding: 12px;
  border: 1px dashed #4f645f;
  background: #a8f08308;
  border-radius: 9px;
  margin: 0 0 10px;
  color: #d7edc9;
}
.clue.locked {
  border-color: var(--line);
  color: var(--muted);
  background: transparent;
}
.tiny-btn {
  background: transparent;
  font-size: 10px;
  padding: 7px;
  margin-top: 12px;
}
.sabotage .ship-space {
  background-color: #100f20;
}
.sabotage .room {
  filter: brightness(0.5);
}
.alert {
  color: #ffd277 !important;
}
.suit-row {
  display: flex;
  gap: 7px;
  margin: 10px 0 15px;
}
.suit-btn {
  width: 29px;
  height: 29px;
  padding: 0;
  border-radius: 50%;
  border: 3px solid transparent;
}
.suit-btn.active {
  border-color: white;
}
.suit-btn:disabled {
  opacity: 0.22;
}
dialog {
  background: #172237;
  color: var(--text);
  border: 1px solid #48556e;
  border-radius: 22px;
  padding: 0;
  width: min(560px, calc(100% - 28px));
  max-height: 90dvh;
  box-shadow: 0 35px 100px #0009;
}
dialog::backdrop {
  background: #060b17d9;
  backdrop-filter: blur(6px);
}
#modal-content {
  padding: 30px;
}
.modal-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 15px;
}
.close {
  padding: 6px 11px;
  background: transparent;
  font-size: 20px;
}
.task-meter {
  display: flex;
  gap: 7px;
  margin: 22px 0;
}
.task-meter span {
  height: 5px;
  background: #344159;
  flex: 1;
  border-radius: 5px;
}
.task-meter .filled {
  background: var(--mint);
}
.equation {
  text-align: center;
  font-size: 52px;
  font-weight: 700;
  letter-spacing: 2px;
  margin: 22px 0 15px;
}
.answer-box {
  display: block;
  width: 160px;
  margin: 0 auto;
  text-align: center;
  font:
    700 35px "DM Sans",
    sans-serif;
  color: var(--mint);
  border: 2px solid #758da4;
  border-radius: 12px;
  background: #0d1728;
  padding: 10px;
  outline-offset: 4px;
}
.answer-box:focus {
  outline: 2px solid var(--mint);
}
.feedback {
  min-height: 46px;
  text-align: center;
  font-size: 13px;
  margin: 13px 0 6px;
  color: var(--muted);
}
.feedback.good {
  color: var(--mint);
}
.feedback.retry {
  color: #ffd277;
}
.keypad {
  max-width: 300px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.keypad button {
  font-size: 20px;
  min-height: 45px;
  padding: 8px;
}
.keypad .submit {
  grid-column: span 3;
  background: var(--mint);
  color: #172629;
  font-size: 14px;
  font-weight: bold;
}
.hint-btn {
  display: block;
  margin: 15px auto 0;
  background: transparent;
  font-size: 12px;
  border: 0;
  color: #b2c8ec;
}
.hint {
  padding: 15px;
  background: #0d1728;
  border-radius: 12px;
  margin: 14px 0;
  text-align: center;
}
.array {
  display: grid;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  margin: 10px auto;
}
.array i {
  width: 15px;
  height: 15px;
  background: #a8f083;
  border-radius: 3px;
}
.array i:nth-child(even) {
  opacity: 0.65;
}
.hint p {
  font-size: 12px;
  margin: 7px 0;
}
.suspects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}
.suspect {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 15px;
}
.suspect svg {
  width: 55px;
  height: 70px;
}
.suspect strong {
  display: block;
  font-size: 16px;
}
.suspect small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.8;
}
.victory {
  text-align: center;
}
.victory svg {
  width: 100px;
  height: 120px;
}
.victory h2 {
  font-family: "Barlow Condensed", Impact, sans-serif;
  text-transform: uppercase;
  font-size: 46px;
  color: var(--mint);
}
.stats {
  display: flex;
  justify-content: space-around;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
  margin: 23px 0;
}
.stats strong {
  font-size: 28px;
  display: block;
}
.stats span {
  font-size: 10px;
  color: var(--muted);
}
.full {
  width: 100%;
}
.fact-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 3px;
  margin: 20px 0;
}
.fact-cell {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  font-size: 9px;
  border-radius: 3px;
  background: #233149;
  min-width: 0;
}
.fact-cell.practiced {
  background: #776339;
  color: #fff;
}
.fact-cell.confident {
  background: var(--mint);
  color: #12201d;
}
.fact-cell.heading {
  background: transparent;
  color: var(--muted);
}
.legend {
  font-size: 11px;
  color: var(--muted);
}
.notice {
  background: #ffd27715;
  border: 1px solid #ffd27766;
  padding: 14px;
  border-radius: 10px;
}
.reward {
  padding: 14px;
  background: #a8f08312;
  color: var(--mint);
  border-radius: 12px;
  margin-bottom: 20px;
}
.float {
  animation: bob 3s ease-in-out infinite;
}
@keyframes bob {
  50% {
    transform: translateY(-5px);
  }
}
@keyframes thrust {
  to {
    opacity: 0.5;
    transform: scaleX(0.85);
  }
}
@media (min-width: 1400px) {
  .intro {
    padding: 45px 0 35px;
  }
  .ship-space {
    height: 425px;
  }
}
@media (max-width: 950px) {
  header,
  main {
    padding-left: 22px;
    padding-right: 22px;
  }
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: 14px;
  }
  aside {
    padding: 20px;
  }
  .mission-badge {
    display: none;
  }
  .ship {
    inset: 35px 15px 45px;
  }
  .room strong {
    font-size: 9px;
  }
  .ship-footer {
    gap: 10px;
    padding: 16px;
  }
  .panel-heading {
    padding: 17px 14px;
  }
  .panel-heading > span:last-child {
    display: none;
  }
}
@media (max-width: 700px) {
  header {
    height: 72px;
  }
  .brand {
    font-size: 14px;
    letter-spacing: 1px;
  }
  .brand-icon {
    margin-right: 5px;
  }
  .local {
    display: none;
  }
  .header-actions {
    gap: 6px;
  }
  .icon-btn {
    padding: 7px;
    font-size: 10px;
  }
  .intro {
    padding: 28px 0 23px;
  }
  h1 {
    font-size: 54px;
  }
  .subtitle {
    font-size: 12px;
  }
  .game-layout {
    grid-template-columns: 1fr;
  }
  aside {
    min-height: 0;
  }
  .ship-space {
    height: 330px;
  }
  .ship {
    inset: 25px 20px 40px;
  }
  .room strong {
    font-size: 10px;
  }
  .bottom-strip {
    gap: 12px;
  }
  .bottom-strip > div {
    display: block;
  }
  .bottom-strip > div > span {
    font-size: 20px;
  }
  .bottom-strip p {
    font-size: 10px;
  }
  .bottom-strip strong {
    font-size: 11px;
  }
  footer {
    display: block;
    line-height: 2;
  }
  footer span {
    display: block;
  }
  #modal-content {
    padding: 23px;
  }
  .equation {
    font-size: 43px;
  }
  .mission-meta {
    margin: 14px 0;
  }
  .map-caption {
    font-size: 7px;
  }
  .array i {
    width: 12px;
    height: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
/* Touch-first controls, including iPad portrait and split view. */
button {
  touch-action: manipulation;
}
.table-options button {
  min-height: 44px;
}
.suit-btn {
  width: 44px;
  height: 44px;
}
.preset-row button,
.icon-btn,
.tiny-btn,
.hint-btn,
.close {
  min-height: 44px;
}
.close {
  min-width: 44px;
}
@media (min-width: 701px) and (max-width: 850px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
  .ship-space {
    height: 390px;
  }
  aside {
    display: block;
  }
  .table-options {
    grid-template-columns: repeat(12, 1fr);
  }
  .table-options button {
    min-width: 44px;
  }
  .mission-meta {
    margin: 15px 0;
  }
  .intro {
    padding: 24px 0;
  }
  h1 {
    font-size: 52px;
  }
  aside .primary {
    margin-top: 12px;
  }
  .crew-row {
    max-width: 340px;
  }
  .suit-row {
    margin-bottom: 18px;
  }
}
@media (max-height: 800px) {
  #modal-content {
    padding: 22px;
  }
  .task-meter {
    margin: 14px 0;
  }
  .equation {
    margin: 12px 0;
    font-size: 42px;
  }
  .feedback {
    min-height: 34px;
    margin: 10px 0 4px;
  }
  .keypad button {
    min-height: 44px;
  }
  .hint-btn {
    margin-top: 7px;
  }
}
@media (orientation: landscape) and (min-width: 850px) and (max-height: 900px) {
  dialog:has(.task-problem) {
    width: min(740px, calc(100% - 32px));
  }
  #modal-content:has(.task-problem) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 24px;
  }
  #modal-content:has(.task-problem) .modal-top,
  #modal-content:has(.task-problem) .task-meter,
  #modal-content:has(.task-problem) .hint-btn,
  #hint-area {
    grid-column: 1/-1;
  }
  .task-problem {
    align-self: center;
  }
  .keypad {
    width: 100%;
    align-self: center;
  }
  .task-problem .equation {
    font-size: 38px;
  }
  .task-problem .feedback {
    margin-top: 18px;
  }
}
/* Signal Chase campaign */
:root {
  --world: #63847b;
}
.planet {
  background: var(--world);
  box-shadow:
    inset 25px -20px 0 #0004,
    0 0 90px color-mix(in srgb, var(--world), transparent 60%);
}
.mission-badge .orbit {
  animation: bob 5s ease-in-out infinite;
}
.intro {
  padding: 27px 0 23px;
}
h1 {
  font-size: 58px;
}
#campaign {
  margin-bottom: 22px;
  padding: 22px 25px;
  background: linear-gradient(115deg, #1b2b3f, #121c2f);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.campaign-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.campaign-head h2 {
  font-size: 22px;
}
.campaign-head > span {
  color: var(--mint);
  font-size: 12px;
  white-space: nowrap;
}
.campaign-head .eyebrow {
  margin-bottom: 6px;
}
.sector-route {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-top: 16px;
  position: relative;
}
.sector-route:before {
  content: "";
  position: absolute;
  top: 25px;
  left: 7%;
  right: 7%;
  height: 2px;
  background: #39485e;
}
.sector {
  position: relative;
  background: transparent;
  border-color: transparent;
  padding: 5px;
  border-radius: 12px;
  min-width: 0;
}
.sector.current {
  background: #ffffff07;
  border-color: var(--mint);
}
.sector:disabled {
  opacity: 0.45;
}
.sector.current:disabled {
  opacity: 1;
}
.sector-orb {
  width: 43px;
  height: 43px;
  margin: 0 auto 9px;
  border-radius: 50%;
  background: var(--orb);
  box-shadow:
    inset -10px -5px #0003,
    0 0 0 5px #192538;
  display: grid;
  place-items: center;
  color: white;
  font-weight: bold;
}
.sector strong {
  font-size: 10px;
  display: block;
  line-height: 1.4;
}
.sector small {
  display: block;
  letter-spacing: 4px;
  color: var(--mint);
  font-size: 11px;
  margin-top: 4px;
}
.mode-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.mode-options button {
  padding: 10px 5px;
  font-weight: 700;
  font-size: 12px;
}
.mode-options small {
  display: block;
  font-size: 8px;
  font-weight: 400;
  margin-top: 6px;
}
.mode-options .selected {
  background: #a8f08315;
  border-color: var(--mint);
  color: var(--mint);
}
aside p.mode-note {
  font-size: 11px;
  line-height: 1.6;
  margin-bottom: 16px;
}
.rank-line {
  font-size: 12px !important;
  color: var(--mint);
  margin: 15px 0 !important;
  line-height: 1.8 !important;
}
.rank-line span {
  color: var(--muted);
  font-size: 10px;
}
#mission-hud {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 15px 22px;
  background: #1d2b40;
  border-bottom: 1px solid #3f5068;
}
#mission-hud[hidden] {
  display: none;
}
#mission-hud > div {
  flex: 1;
}
#mission-hud .eyebrow {
  font-size: 8px;
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
}
#mission-hud strong {
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-size: 27px;
  letter-spacing: 1px;
}
.on-mission .intro {
  display: none;
}
.on-mission #campaign {
  margin-top: 23px;
  padding: 15px 22px;
}
.on-mission .sector-route {
  display: none;
}
.on-mission .campaign-head h2 {
  margin-bottom: 0;
}
.on-mission .game-layout {
  align-items: start;
}
.on-mission .bottom-strip {
  display: none;
}
.on-mission .ship-space {
  height: 430px;
}
.room-bonus {
  position: absolute;
  bottom: 8px;
  right: 7px;
  font-size: 7px;
  letter-spacing: 1px;
  color: #fff9;
}
.room {
  padding-bottom: 20px;
}
.room small {
  font-size: 9px;
}
.clock-danger {
  color: #ff8496 !important;
  animation: danger 1s ease-in-out infinite;
}
.mini-clock {
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-size: 24px;
  color: var(--mint);
  white-space: nowrap;
}
.task-top-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.brief-goals {
  display: grid;
  gap: 12px;
  margin: 23px 0;
}
.brief-goals > div {
  display: flex;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #111b2c;
}
.brief-goals b {
  min-width: 83px;
  color: var(--mint);
}
.brief-goals span {
  font-size: 12px;
  color: #b6c5d9;
  line-height: 1.5;
}
.interactive-task {
  width: 100%;
  margin: 6px 0;
}
.wire-game {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  align-items: center;
  padding: 15px 0;
  position: relative;
}
.wire-game:before {
  content: "";
  position: absolute;
  top: 50%;
  left: 35%;
  right: 15%;
  border-top: 5px dashed #556883;
}
.wire-source {
  position: relative;
  z-index: 1;
  background: #24374b;
  border: 2px solid #e4b766;
  color: #ffe099;
  font-size: 25px;
  font-weight: 700;
  min-height: 115px;
  box-shadow: 0 8px 0 #0f1828;
}
.wire-source small {
  font-size: 10px;
  display: block;
  margin-top: 15px;
  line-height: 1.5;
}
.wire-source.armed {
  box-shadow: 0 0 22px #ffd27744;
  border-color: #fff0b4;
}
.wire-ports {
  display: grid;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.wire-port {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 22px;
  background: #0e1a2b;
  border: 2px solid #546b87;
  min-height: 54px;
}
.wire-port span {
  color: #778eac;
}
.wire-port.connected {
  opacity: 1;
  background: #a8f08333;
  border-color: var(--mint);
  color: var(--mint);
}
.wire-port.connected span {
  color: var(--mint);
}
.shield-builder {
  text-align: center;
}
.shield-builder p {
  font-size: 13px;
  color: #bfcee0;
}
.shield-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 14px auto;
  max-width: 320px;
}
.shield-row {
  display: flex;
  gap: 5px;
  justify-content: center;
  min-height: 13px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.shield-row i {
  width: 18px;
  height: 12px;
  border-radius: 3px;
  background: #28394e;
  border: 1px solid #4e6384;
}
.shield-row.lit i {
  background: #a8f083;
  box-shadow: 0 0 8px #a8f08333;
  border-color: #d0febb;
}
.product-options {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 16px 0;
}
.product-options button {
  min-width: 60px;
  min-height: 50px;
  font-weight: 700;
  font-size: 21px;
}
.asteroid-field {
  height: 255px;
  position: relative;
  background:
    radial-gradient(#9badc177 1px, transparent 1px),
    linear-gradient(#0c1426, #182b43);
  background-size:
    33px 37px,
    auto;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #435572;
}
.target-label {
  position: absolute;
  left: 0;
  right: 0;
  top: 14px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--mint);
}
.asteroid {
  position: absolute;
  width: 78px;
  height: 73px;
  border-radius: 40% 55% 38% 47%;
  background:
    radial-gradient(circle at 20% 35%, #ffffff0b 0 10%, transparent 11%),
    #516079;
  border: 3px solid #7a8aa1;
  box-shadow: inset -8px -8px #0002;
  font-size: 25px;
  font-weight: 700;
  animation: asteroid-drift 4s ease-in-out infinite;
}
.asteroid-0 {
  left: 10%;
  top: 63px;
}
.asteroid-1 {
  right: 12%;
  top: 58px;
  animation-delay: -1s;
}
.asteroid-2 {
  left: 32%;
  bottom: 28px;
  animation-delay: -2s;
}
.asteroid-3 {
  right: 5%;
  bottom: 24px;
  animation-delay: -3s;
}
.asteroid.blasted {
  opacity: 1;
  transform: scale(0.85);
  background: #a8f08333;
  border-color: var(--mint);
  color: var(--mint);
  box-shadow: 0 0 35px #a8f08366;
  animation: none;
}
.laser {
  position: absolute;
  width: 3px;
  height: 0;
  background: var(--mint);
  left: 50%;
  bottom: 0;
  box-shadow: 0 0 10px var(--mint);
  pointer-events: none;
}
.laser.fired {
  animation: laser 0.6s ease-out;
}
.cargo-tank {
  width: 65px;
  height: 85px;
  margin: 10px auto;
  position: relative;
  overflow: hidden;
  border: 3px solid #738da1;
  border-radius: 11px;
  background: #0d1728;
}
.cargo-tank > span {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #6fd7eb77;
  transition: height 0.5s;
}
.cargo-tank b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
}
.suspects {
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.suspect-card {
  border: 1px solid #3a4d66;
  border-radius: 13px;
  background: #101c30;
  overflow: hidden;
}
.suspect-card.crossed {
  opacity: 0.42;
}
.suspect {
  width: 100%;
  border: 0;
  background: transparent;
  gap: 9px;
  padding: 10px;
  min-height: 95px;
  border-radius: 0;
}
.suspect:disabled {
  opacity: 1;
}
.suspect svg {
  width: 47px;
  height: 60px;
  flex-shrink: 0;
}
.suspect strong {
  font-size: 14px;
}
.badge-number {
  display: inline-block;
  font-size: 19px;
  color: var(--mint);
  letter-spacing: 2px;
  background: #27384b;
  padding: 2px 10px;
  margin-top: 4px;
  border-radius: 5px;
}
.cross-btn {
  border: 0;
  border-top: 1px solid #2b3c52;
  border-radius: 0;
  min-height: 44px;
  width: 100%;
  background: #1b2940;
  font-size: 10px;
  color: #afc1d9;
}
.vote-portrait {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 20px 0;
}
.vote-portrait svg {
  width: 70px;
  height: 85px;
}
.vote-portrait strong {
  font-size: 17px;
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}
.shop-item {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 8px;
  padding: 15px 7px;
  background: #101d30;
}
.shop-item svg {
  width: 65px;
  height: 80px;
}
.shop-item strong {
  font-size: 12px;
}
.shop-item span {
  font-size: 11px;
  color: var(--mint);
}
.shop-item.equipped {
  border-color: var(--mint);
}
.escaped h2 {
  color: #ffb48b;
}
.ending-crew {
  display: inline-block;
  animation: bob 3s ease-in-out infinite;
}
.escaped .ending-crew {
  animation: escape 3s ease-in-out infinite;
}
.notice {
  font-size: 12px;
  line-height: 1.7;
}
.victory .muted {
  font-size: 13px;
}
.on-mission .crew-mini svg {
  width: 33px;
  height: 43px;
}
.on-mission .crew-mini {
  font-size: 9px;
}
.on-mission .clue {
  font-size: 11px;
}
.task-top-actions .close {
  padding: 5px 9px;
}
.modal-top .muted {
  font-size: 12px;
}
.hint .primary {
  font-size: 12px;
}
.brief-goals span {
  display: block;
}
dialog:has(.interactive-task) {
  width: min(590px, calc(100% - 28px));
}
@keyframes asteroid-drift {
  50% {
    translate: 0 -5px;
    rotate: 3deg;
  }
}
@keyframes laser {
  30% {
    height: 180px;
    opacity: 1;
  }
  100% {
    height: 210px;
    opacity: 0;
  }
}
@keyframes danger {
  50% {
    opacity: 0.65;
  }
}
@keyframes escape {
  50% {
    transform: translateX(15px) rotate(12deg);
  }
}
@media (max-width: 950px) {
  h1 {
    font-size: 50px;
  }
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
  .table-options {
    grid-template-columns: repeat(4, 1fr);
  }
  .on-mission .ship-space {
    height: 440px;
  }
  .room small {
    font-size: 8px;
  }
  .room-bonus {
    font-size: 6px;
  }
  .room strong {
    font-size: 9px;
  }
  .campaign-head h2 {
    font-size: 20px;
  }
  .sector strong {
    font-size: 9px;
  }
}
@media (max-width: 850px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
  .on-mission .ship-space {
    height: 370px;
  }
  .table-options {
    grid-template-columns: repeat(6, 1fr);
  }
  .on-mission #sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 20px;
  }
  .on-mission #sidebar > .eyebrow,
  .on-mission #sidebar > h2,
  .on-mission #sidebar > p,
  .on-mission #sidebar > .crew-row,
  .on-mission #sidebar > .clue {
    grid-column: 1/-1;
  }
  .on-mission #sidebar .crew-row {
    max-width: 100%;
    justify-content: space-around;
  }
  .on-mission #sidebar .primary {
    margin-top: 8px;
  }
  .on-mission #sidebar .tiny-btn {
    margin-top: 8px;
  }
  .room small {
    font-size: 10px;
  }
  .room strong {
    font-size: 11px;
  }
  .intro h1 {
    font-size: 48px;
  }
  .campaign-head > span {
    font-size: 10px;
  }
  .sector-route {
    gap: 4px;
  }
  .sector strong {
    font-size: 8px;
  }
  .sector-orb {
    width: 34px;
    height: 34px;
  }
  .sector-route:before {
    top: 22px;
  }
  #campaign {
    padding: 17px;
  }
  .on-mission .ship-panel {
    position: relative;
  }
  .on-mission #mission-hud {
    position: sticky;
    top: 0;
    z-index: 2;
  }
}
@media (max-width: 540px) {
  header,
  main {
    padding-left: 14px;
    padding-right: 14px;
  }
  .campaign-head {
    align-items: start;
  }
  .campaign-head h2 {
    font-size: 18px;
  }
  .campaign-head > span {
    max-width: 95px;
    white-space: normal;
    line-height: 1.7;
  }
  .sector-route {
    grid-template-columns: repeat(3, 1fr);
    row-gap: 12px;
  }
  .sector-route:before {
    display: none;
  }
  .sector strong {
    font-size: 9px;
  }
  .on-mission .ship-space {
    height: 310px;
  }
  .room small {
    font-size: 8px;
  }
  .room strong {
    font-size: 9px;
  }
  .room-bonus {
    font-size: 6px;
  }
  .room svg {
    width: 34px;
    height: 27px;
  }
  .room {
    gap: 4px;
    padding-bottom: 19px;
  }
  .on-mission .ship {
    inset: 22px 10px 40px;
  }
  .on-mission #campaign {
    margin-top: 14px;
  }
  .on-mission #sidebar {
    padding: 18px;
  }
  #mission-hud {
    gap: 12px;
    padding: 12px 16px;
  }
  #mission-hud strong {
    font-size: 23px;
  }
  .task-top-actions {
    gap: 0;
  }
  .task-top-actions .close {
    min-width: 44px;
    padding: 5px;
  }
  .mini-clock {
    font-size: 20px;
  }
  .modal-top h2 {
    font-size: 23px;
  }
  .wire-game {
    gap: 27px;
  }
  .wire-source {
    font-size: 22px;
  }
  .shop-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .product-options {
    gap: 7px;
  }
  .product-options button {
    min-width: 51px;
  }
  .suspect {
    padding: 8px;
    gap: 7px;
  }
  .suspect svg {
    width: 38px;
    height: 53px;
  }
  .suspect strong {
    font-size: 13px;
  }
  .suspect small {
    font-size: 9px;
  }
  .asteroid {
    width: 65px;
    height: 65px;
  }
  .brief-goals > div {
    display: block;
  }
  .brief-goals span {
    margin-top: 5px;
  }
  .table-options {
    grid-template-columns: repeat(6, 1fr);
  }
  .on-mission #sidebar .clue {
    font-size: 12px;
  }
  .victory h2 {
    font-size: 39px;
  }
}
@media (orientation: landscape) and (min-width: 850px) and (max-height: 900px) {
  dialog:has(.interactive-task) {
    width: min(690px, calc(100% - 28px));
  }
  .interactive-task .wire-game {
    padding: 0;
  }
  .wire-ports {
    grid-template-columns: 1fr 1fr;
  }
  .interactive-task .asteroid-field {
    height: 245px;
  }
  .shield-rows {
    gap: 3px;
  }
  .shield-row i {
    height: 9px;
  }
  .shield-builder p {
    margin: 8px 0;
  }
  .product-options {
    margin: 10px 0;
  }
  .task-problem .cargo-tank {
    height: 65px;
    width: 55px;
  }
  .task-problem .equation {
    font-size: 32px;
  }
  .task-problem p {
    font-size: 12px;
  }
  .task-top-actions .close {
    padding: 5px 9px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
.scan-btn {
  margin-top: 10px;
  background: #213b42;
  border-color: #59857b;
  color: var(--mint);
  font-size: 12px;
  min-height: 48px;
}
.decision-clock {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}
.shield-row.lit {
  animation: shield-charge 0.3s ease-out;
}
.shield-row:nth-child(2n) {
  animation-delay: 0.06s;
}
.shield-row:nth-child(3n) {
  animation-delay: 0.12s;
}
@keyframes shield-charge {
  from {
    opacity: 0.25;
    transform: scaleX(0.7);
  }
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

/* Leave room for Safari's toolbars and keep dialog scrolling on the task. */
body:has(dialog[open]) {
  overflow: hidden;
}
dialog {
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal-top > div:first-child {
  min-width: 0;
}
.task-top-actions {
  flex-shrink: 0;
}
@media (orientation: landscape) and (min-width: 850px) and (max-height: 700px) {
  .shield-builder {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 20px;
    align-items: center;
  }
  .shield-builder > p:first-child {
    grid-column: 1 / -1;
  }
  .shield-builder .shield-rows {
    grid-column: 1;
    grid-row: 2 / 5;
  }
  .shield-builder > button,
  .shield-builder > .product-options,
  .shield-builder > p:last-child {
    grid-column: 2;
  }
}
