:root {
  --bg: #07090c;
  --bg-2: #0c1114;
  --panel: #0e1518;
  --line: #1a2c2c;
  --text: #d8efe8;
  --muted: #7f9b94;
  --cyan: #2de2e6;
  --green: #5dffb0;
  --amber: #ffbf5a;
  --red: #ff5a6a;
  --violet: #c084fc;
  --font: ui-monospace, "Cascadia Code", "Cascadia Mono", "IBM Plex Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --display: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --radius: 18px;
  color-scheme: dark;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 520px at 12% -8%, rgb(45 226 230 / 11%), transparent 50%),
    radial-gradient(900px 480px at 100% 108%, rgb(251 113 133 / 9%), transparent 46%),
    var(--bg);
  line-height: 1.45;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgb(125 154 148 / 5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(125 154 148 / 5%) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgb(0 0 0 / 70%), transparent 90%);
  z-index: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 20;
  padding: 8px 12px;
  background: var(--cyan);
  color: #041112;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tape {
  position: relative;
  z-index: 1;
  margin: 0;
  overflow: hidden;
  border-bottom: 1px solid rgb(255 191 90 / 35%);
  background: #120e08;
  color: var(--amber);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.tape-track {
  display: flex;
  gap: 2rem;
  width: max-content;
  padding: 7px 0;
  animation: marquee 46s linear infinite;
}

.tape-track span + span::before {
  content: "//";
  margin-right: 2rem;
  color: rgb(255 191 90 / 45%);
}

.topbar,
main,
footer {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  justify-content: space-between;
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 20px 8px;
}

.logo {
  display: flex;
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.logo small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.logo-mark {
  width: 28px;
  height: 28px;
  border: 1px solid var(--cyan);
  border-radius: 7px;
  background:
    linear-gradient(var(--cyan), var(--cyan)) 9px 4px / 10px 10px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 4px 14px / 10px 10px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 14px 14px / 10px 10px no-repeat;
}

.clock {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pills li {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pills b {
  color: var(--green);
  font-weight: 600;
}

.pills .warn b {
  color: var(--amber);
}

.icon-btn,
.boot-btn,
.pad button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgb(45 226 230 / 28%);
}

.icon-btn {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
}

.icon-btn[aria-pressed="true"] {
  color: var(--amber);
  border-color: rgb(255 191 90 / 45%);
}

.icon-btn:focus-visible,
.boot-btn:focus-visible,
.pad button:focus-visible,
.logo:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

main {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto minmax(210px, 0.86fr);
  grid-template-areas: "brief rig hud";
  gap: 24px;
  align-items: start;
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 20px 32px;
}

.brief { grid-area: brief; }
.rig { grid-area: rig; }
.hud { grid-area: hud; }

.eyebrow {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow span {
  width: 18px;
  height: 1px;
  background: var(--cyan);
}

h1 {
  margin: 0 0 14px;
  font-family: var(--display);
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.lead {
  margin: 0 0 18px;
  color: var(--muted);
  max-width: 42ch;
}

.reject {
  margin: 0 0 22px;
  padding: 12px;
  border: 1px solid rgb(255 90 106 / 28%);
  border-radius: 12px;
  background: #14090c;
}

.reject-label {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.reject-line {
  margin: 0;
  min-height: 2.6em;
  color: #ffd0d4;
  font-size: 12px;
}

.reject-line .caret {
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-left: 2px;
  background: var(--red);
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}

.legend {
  display: grid;
  gap: 6px;
  margin: 0 0 22px;
}

.legend > div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px;
  align-items: baseline;
}

.legend dt,
.legend dd {
  margin: 0;
  font-size: 12px;
}

.legend dt {
  color: var(--cyan);
}

.legend dd {
  color: var(--muted);
}

.compiler {
  margin-bottom: 22px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(14 21 24 / 70%);
}

.compiler p {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.compiler p span {
  color: var(--amber);
}

.bar {
  height: 6px;
  margin: 8px 0;
  overflow: hidden;
  border-radius: 99px;
  background: #182226;
}

.bar i {
  display: block;
  width: 73%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  transform-origin: left;
  animation: compile 7s ease-in-out infinite;
}

.compiler .compiler-note {
  letter-spacing: 0.04em;
  text-transform: none;
}

.keys {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 12px;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  margin-right: 4px;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #12181b;
  color: var(--text);
  font: inherit;
  font-size: 11px;
  text-align: center;
}

.sandbox {
  width: max-content;
  max-width: 100%;
  padding: 10px;
  border: 1px solid #1e3d3c;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgb(18 42 42 / 55%), rgb(8 12 14 / 88%));
  box-shadow:
    0 0 0 1px rgb(45 226 230 / 8%),
    0 24px 80px rgb(0 0 0 / 35%),
    inset 0 0 40px rgb(45 226 230 / 5%);
}

.sandbox-chrome,
.sandbox-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 4px 8px 10px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sandbox-chrome b,
.sandbox-chrome #sandbox-state {
  color: var(--green);
}

body.online .sandbox {
  box-shadow:
    0 0 0 1px rgb(45 226 230 / 14%),
    0 24px 80px rgb(0 0 0 / 35%),
    inset 0 0 40px rgb(45 226 230 / 8%);
}

body.breach .sandbox {
  border-color: rgb(255 90 106 / 55%);
  box-shadow:
    0 0 0 1px rgb(255 90 106 / 24%),
    0 24px 80px rgb(255 90 106 / 12%);
}

body.breach .tape {
  background: #2a0d12;
  color: var(--red);
}

.viewport {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #05080a;
}

body.online .viewport {
  touch-action: none;
}

.viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 2px,
    rgb(0 0 0 / 14%) 2px 3px
  );
  opacity: 0.28;
}

#grid {
  display: block;
  width: 100%;
  height: auto;
  margin-inline: auto;
  background: #05080a;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 24px;
  text-align: center;
  background: rgb(5 8 10 / 78%);
  backdrop-filter: blur(4px);
  touch-action: manipulation;
}

.overlay[hidden] {
  display: none;
}

.overlay-kicker {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.overlay h2 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 22px;
}

.overlay p {
  margin: 0 0 18px;
  max-width: 28ch;
  color: var(--muted);
  font-size: 13px;
}

.boot-btn {
  padding: 12px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--cyan);
  color: #041112;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.boot-btn:hover {
  filter: brightness(1.08);
}

.pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
  user-select: none;
  -webkit-user-select: none;
}

.pad-hint {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-align: center;
}

.pad [data-act="pause"] {
  grid-column: 1 / -1;
}

.pad button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #10171a;
  color: var(--text);
}

.hud {
  display: grid;
  gap: 14px;
}

.hud h2 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hud section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(14 21 24 / 72%);
}

.previews,
.log {
  margin: 0;
  padding: 0;
  list-style: none;
}

.previews {
  display: grid;
  gap: 8px;
}

.previews li,
.hold {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: 12px;
}

.swatch {
  display: grid;
  grid-template-columns: repeat(4, 8px);
  grid-template-rows: repeat(4, 8px);
  gap: 1px;
  width: 39px;
  height: 39px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #070b0d;
}

.swatch b {
  display: block;
  border-radius: 1px;
}

.meters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.meters div {
  display: grid;
  gap: 2px;
}

.meters span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.meters strong {
  font-size: 20px;
  font-weight: 500;
  color: var(--text);
}

.log {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.log li {
  color: var(--muted);
  font-size: 11px;
}

.log li b {
  color: var(--green);
  font-weight: 500;
}

.log li.alert b {
  color: var(--red);
}

.vault pre {
  margin: 0;
  overflow: auto;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.crab {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.crab-stage {
  position: relative;
  width: 96px;
  height: 58px;
}

.crab-stage .body {
  position: absolute;
  left: 26px;
  top: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 28px;
  border-radius: 50% 50% 42% 42%;
  background: #ff5a6a;
  box-shadow: 0 0 16px rgb(255 90 106 / 40%);
}

.crab-stage .eye {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #14090c;
  box-shadow: 0 -10px 0 -2px #ff5a6a, 0 -12px 0 -3px #ff8a94;
}

.crab-stage .claw {
  position: absolute;
  top: 6px;
  width: 18px;
  height: 14px;
  border: 2px solid #ff5a6a;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
}

.crab-stage .claw.left {
  left: 8px;
  transform: rotate(-28deg);
}

.crab-stage .claw.right {
  right: 8px;
  transform: rotate(28deg);
}

.crab-stage .legs {
  position: absolute;
  left: 22px;
  bottom: 4px;
  width: 52px;
  height: 8px;
  background:
    radial-gradient(circle at 6px 2px, #ff5a6a 2px, transparent 3px),
    radial-gradient(circle at 18px 4px, #ff5a6a 2px, transparent 3px),
    radial-gradient(circle at 34px 4px, #ff5a6a 2px, transparent 3px),
    radial-gradient(circle at 46px 2px, #ff5a6a 2px, transparent 3px);
}

.crab-say {
  margin: 0;
  color: var(--amber);
  font-size: 12px;
  text-align: center;
}

body.breach .crab-stage {
  animation: crabdance 0.38s steps(2) infinite;
}

body.online .crab-stage .claw.left {
  animation: pinch-left 1.6s ease-in-out infinite;
}

body.online .crab-stage .claw.right {
  animation: pinch-right 1.6s ease-in-out infinite 0.2s;
}

footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px 28px;
  color: var(--muted);
  font-size: 12px;
}

footer p {
  margin: 0 0 4px;
}

.noscript {
  margin: 20px;
  padding: 12px;
  border: 1px solid var(--amber);
  color: var(--amber);
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@keyframes compile {
  0%, 100% { width: 61%; }
  40% { width: 84%; }
  70% { width: 69%; }
}

@keyframes blink {
  50% { opacity: 0; }
}

@keyframes crabdance {
  0% { transform: translateX(-11px) rotate(-10deg); }
  100% { transform: translateX(11px) rotate(10deg); }
}

@keyframes pinch-left {
  50% { transform: rotate(-48deg); }
}

@keyframes pinch-right {
  50% { transform: rotate(48deg); }
}

@media (max-width: 980px) {
  main {
    grid-template-columns: 1fr;
    grid-template-areas: "rig" "brief" "hud";
  }

  .sandbox {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
  }

  .viewport {
    width: 100%;
  }

  .brief .keys {
    display: none;
  }

  .rig {
    padding-bottom: calc(188px + env(safe-area-inset-bottom, 0px));
  }

  .pad {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 8;
    margin: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line);
    background: rgb(7 9 12 / 94%);
  }

  .pad button {
    min-height: 52px;
    font-size: 16px;
  }

  .boot-btn {
    min-height: 48px;
    min-width: min(100%, 240px);
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tape-track,
  .bar i,
  .reject-line .caret,
  body.breach .crab-stage,
  body.online .crab-stage .claw.left,
  body.online .crab-stage .claw.right {
    animation: none;
  }

  .viewport::after {
    display: none;
  }
}
