@import url("tokens.css");
:root {
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #091923;
  color: #dce8e9;
  font-family: var(--sans);
  background-image:
    radial-gradient(ellipse at 15% 40%, #16343c 0, transparent 50%),
    radial-gradient(circle at 85% 90%, #212a44, transparent 45%);
  min-height: 100dvh;
}
button,
select {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid #f7cc8b;
  outline-offset: 3px;
}
button {
  border: 1px solid #3c535d;
  background: #17303b;
  border-radius: 8px;
  padding: 11px 15px;
}
button:hover {
  background: #24444e;
}
button:disabled {
  opacity: 0.35;
  cursor: default;
}
a {
  color: inherit;
  text-decoration: none;
}
header {
  max-width: 1280px;
  margin: auto;
  padding: 25px 5%;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #91adb7;
}
header > span,
.kicker {
  font: 10px var(--mono);
  letter-spacing: 0.15em;
  color: #81b5b9;
}
main {
  max-width: 1140px;
  margin: 30px auto 60px;
  padding: 0 30px;
  display: grid;
  grid-template-columns: 1fr 490px;
  gap: 85px;
}
.mission h1 {
  font-size: clamp(40px, 5vw, 65px);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.04em;
  margin: 25px 0;
}
.mission h1 span {
  color: #bce5d7;
}
.intro {
  font-size: 14px;
  line-height: 1.9;
  color: #91adb7;
}
.station {
  height: 242px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding: 22px 35px;
  margin: 20px 0;
  background: radial-gradient(ellipse, #29546366, transparent 70%);
}
.station:before {
  content: "";
  position: absolute;
  inset: 48px 64px;
  border: 1px solid #48636c;
  transform: rotate(45deg);
  border-radius: 50%;
}
.module {
  position: relative;
  z-index: 1;
  border: 1px solid #52707b;
  background: #102832;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 0 0 4px #091923;
  font-size: 9px;
  color: #7d98a1;
  transition: all 0.8s;
}
.module b {
  font: 17px var(--mono);
  color: #43636f;
}
.module:after {
  content: "";
  width: 22px;
  height: 2px;
  background: #365260;
}
.module.online {
  background: #23594e;
  border-color: #b4efd3;
  color: #e4f5e8;
  box-shadow:
    0 0 24px #78d6ae38,
    0 0 0 4px #091923;
}
.module.online b {
  color: #b4efd3;
}
.module.online:after {
  background: #b4efd3;
  box-shadow: 0 0 9px #b4efd3;
}
.mission-status {
  font-size: 11px;
  color: #91adb7;
}
.mission-status > span {
  display: flex;
  justify-content: space-between;
}
.meter {
  height: 3px;
  background: #2b434b;
  margin-top: 12px;
}
.meter i {
  display: block;
  background: #a7e6cd;
  height: 100%;
  width: 0;
  transition: width 0.7s;
}
.transmission {
  border-left: 2px solid #9cc9ba;
  margin: 28px 0;
  padding-left: 18px;
}
.transmission > span {
  font: 10px var(--mono);
  color: #a6d9c7;
}
.transmission p {
  font-size: 13px;
  line-height: 1.9;
  color: #9bb7be;
  min-height: 50px;
}
details {
  font-size: 12px;
  line-height: 1.9;
  color: #839eaa;
}
summary {
  cursor: pointer;
}
.console-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.console-top h2 {
  font-size: 24px;
  font-weight: 500;
  margin: 8px 0 0;
}
.readouts {
  display: flex;
  align-items: center;
  gap: 14px;
  font: 12px var(--mono);
  color: #92b2bd;
}
.readouts strong {
  font-weight: 400;
  color: #e2e9e8;
}
.readouts button {
  padding: 9px 12px;
}
.board-wrap {
  position: relative;
}
#sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  border: 2px solid #77949e;
  border-radius: 6px;
  overflow: hidden;
  background: #77949e;
  gap: 1px;
  aspect-ratio: 1;
}
.cell {
  padding: 0;
  position: relative;
  aspect-ratio: 1;
  border: 0;
  border-radius: 0;
  background: #10242e;
  font: clamp(19px, 3vw, 25px) var(--mono);
  color: #e4c08c;
  display: grid;
  place-items: center;
  min-width: 0;
  touch-action: manipulation;
}
.cell:nth-child(3n):not(:nth-child(9n)) {
  border-right: 2px solid #77949e;
}
.cell:nth-child(n + 19):nth-child(-n + 27),
.cell:nth-child(n + 46):nth-child(-n + 54) {
  border-bottom: 2px solid #77949e;
}
.cell.fixed {
  color: #dce9ec;
  background: #132a34;
  font-weight: 500;
}
.cell.related {
  background: #1c3943;
}
.cell.same {
  background: #2e5059;
  color: #c4f7e3;
}
.cell.selected {
  background: #3b615c;
  box-shadow: inset 0 0 0 2px #b6e3cd;
  z-index: 1;
  color: #fff;
}
.cell.conflict {
  color: #ff9f93;
  background: #5a3136;
}
.cell.solved-sector {
  background: #1b3c37;
}
.cell.solved-sector.selected {
  background: #3b615c;
}
.notes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 90%;
  height: 90%;
  align-items: center;
  font: 10px var(--mono);
  color: #a9c0c5;
}
.cell small {
  font-size: inherit;
}
.board-caption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: #8faab4;
  margin: 14px 0;
}
#number-pad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 5px;
}
#number-pad button {
  padding: 9px 0 5px;
  font: 22px var(--mono);
  background: #1d3741;
  border-color: #38525d;
}
#number-pad small {
  display: block;
  font: 9px var(--mono);
  margin-top: 5px;
  color: #8dafb6;
}
.tools {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin: 13px 0;
}
.tools button {
  padding: 12px 4px;
  font-size: 12px;
}
.tools [aria-pressed="true"] {
  background: #43685c;
  border-color: #b0dec6;
}
#hint-panel {
  background: #173d41;
  border: 1px solid #537970;
  border-radius: 8px;
  padding: 15px;
  margin: 12px 0;
  font-size: 13px;
  line-height: 1.8;
}
#hint-panel p {
  margin: 0 0 12px;
}
#hint-panel button {
  padding: 8px 10px;
  font-size: 12px;
}
.bottom-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid #2e4650;
  padding-top: 17px;
}
.bottom-bar select,
.bottom-bar button {
  font-size: 11px;
  background: transparent;
  border: 1px solid #39505b;
  border-radius: 6px;
  padding: 9px 10px;
}
#pause-panel {
  position: absolute;
  inset: 0;
  background: #102731;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 4;
  border: 1px solid #587880;
  border-radius: 6px;
}
#pause-panel p {
  font-size: 13px;
  color: #99b6bc;
}
[hidden] {
  display: none !important;
}
dialog {
  background: #13303b;
  color: #e1efed;
  border: 1px solid #719289;
  border-radius: 14px;
  padding: 30px;
  max-width: min(460px, 90vw);
}
dialog::backdrop {
  background: #020c16cf;
  backdrop-filter: blur(8px);
}
dialog h2 {
  font-weight: 400;
  font-size: 25px;
}
dialog p {
  font-size: 14px;
  line-height: 1.8;
  color: #adc6c9;
}
dialog button {
  margin: 10px 8px 0 0;
}
@media (max-width: 850px) {
  header {
    padding: 18px 5%;
  }
  header > span {
    display: none;
  }
  main {
    display: flex;
    flex-direction: column;
    max-width: 540px;
    padding: 0 16px;
    margin-top: 12px;
    gap: 25px;
  }
  .mission h1 {
    font-size: 30px;
    margin: 12px 0;
  }
  .mission h1 br {
    display: none;
  }
  .mission .intro {
    font-size: 12px;
    margin: 0;
  }
  .station {
    height: 102px;
    padding: 10px 0;
    gap: 6px;
    grid-template-columns: repeat(9, 1fr);
    margin: 14px 0 2px;
  }
  .station:before {
    inset: 50% 0;
    transform: none;
    border-radius: 0;
  }
  .module {
    border-radius: 6px;
    gap: 4px;
    font-size: 8px;
    box-shadow: none;
  }
  .module b {
    font-size: 13px;
  }
  .module:after {
    width: 12px;
  }
  .module.online {
    box-shadow: 0 0 12px #78d6ae38;
  }
  .mission-status {
    font-size: 10px;
  }
  .transmission {
    margin: 15px 0 0;
    padding-left: 12px;
  }
  .transmission > span {
    font-size: 8px;
  }
  .transmission p {
    min-height: 0;
    font-size: 11px;
    margin: 6px 0;
  }
  .mission details {
    margin-top: 8px;
    font-size: 10px;
  }
  .console-top {
    margin-bottom: 12px;
  }
  .console-top h2 {
    font-size: 20px;
  }
  .cell {
    font-size: 23px;
  }
  .notes-grid {
    font-size: 8px;
  }
  .tools button {
    font-size: 11px;
  }
  #number-pad button {
    font-size: 21px;
  }
  .board-caption {
    font-size: 10px;
  }
  .bottom-bar {
    gap: 6px;
  }
  .bottom-bar button,
  .bottom-bar select {
    padding: 9px 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
@media (max-width: 850px) {
  main {
    margin-top: 4px;
    gap: 16px;
  }
  .mission > .kicker,
  .mission > .intro {
    display: none;
  }
  .mission h1 {
    font-size: 23px;
    margin: 4px 0 0;
  }
  .station {
    height: 56px;
    margin: 8px 0 0;
    padding: 4px 0;
  }
  .module {
    gap: 2px;
  }
  .module b {
    font-size: 11px;
  }
  .module span {
    font-size: 7px;
  }
  .module:after {
    height: 1px;
  }
  .mission-status {
    margin-top: 7px;
  }
  .meter {
    margin-top: 6px;
  }
  .transmission {
    margin-top: 9px;
  }
  .transmission > span {
    display: none;
  }
  .transmission p {
    font-size: 10px;
    line-height: 1.5;
    margin: 3px 0;
  }
  .mission details {
    margin-top: 5px;
  }
  .console-top .kicker {
    display: none;
  }
}

/* Live circuit diagram: each module selects its corresponding sector. */
.station {
  border: 1px solid #42616a55;
  border-radius: 24px;
  background:
    radial-gradient(ellipse, #36727a30, transparent 72%),
    repeating-linear-gradient(90deg, transparent 0 24px, #8adbc506 25px 26px);
}
.module {
  padding: 8px 3px;
  background: linear-gradient(135deg, #1b3b46, #10232e);
  border-radius: 8px;
  box-shadow:
    0 0 0 4px #091923,
    inset 0 2px #d2f9f015;
  min-height: 54px;
}
.module:before {
  content: "";
  position: absolute;
  inset: 10px -7px;
  background: repeating-linear-gradient(#7bacbd 0 1px, #254e62 1px 7px);
  z-index: -1;
  border: 1px solid #536e83;
  border-radius: 1px;
}
.module:after {
  width: 72%;
  height: 3px;
  background: linear-gradient(
    90deg,
    #8ccab9 var(--repair),
    #2a4b5b var(--repair)
  );
  box-shadow: 0 0 9px #89d6be20;
}
.module.active-sector {
  outline: 2px solid #ecc792;
  outline-offset: 3px;
}
.module b {
  font-size: 14px;
  color: #93b8ba;
}
.module.online {
  background: linear-gradient(145deg, #306959, #173f39);
}
@media (max-width: 850px) {
  .station {
    grid-template-columns: repeat(9, minmax(0, 1fr));
    padding: 8px 1px;
    height: 64px;
    border-radius: 8px;
    gap: 5px;
  }
  .module {
    min-width: 0;
    min-height: 44px;
    padding: 3px 0;
    box-shadow: none;
    border-radius: 4px;
    gap: 4px;
  }
  .module:before {
    display: none;
  }
  .module b {
    font-size: 9px;
    letter-spacing: -0.07em;
  }
  .module span {
    font-size: 7px;
    white-space: nowrap;
  }
  .module:after {
    height: 2px;
    width: 70%;
  }
  .module.active-sector {
    outline-width: 1px;
    outline-offset: 1px;
  }
}
