:root {
  --background: #060a08;
  --panel: #0b110e;
  --panel-raised: #111914;
  --border: #26332c;
  --border-soft: #18231d;
  --text: #edf7f1;
  --muted: #8e9d95;
  --green: #66f2a7;
  --green-soft: #b8ffd7;
  --green-dark: #123d29;
  --amber: #f0b35a;
  --red: #ed6a67;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--background);
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 12% 4%, rgb(32 78 55 / 36%), transparent 30rem),
    radial-gradient(circle at 92% 94%, rgb(22 53 39 / 28%), transparent 28rem),
    var(--background);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

button,
select {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(36px, 6vw, 76px) 0 30px;
}

.masthead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 30px;
}

.identity {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font: 700 0.72rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.16em;
}

h1 {
  margin: 0;
  font-size: clamp(3.25rem, 8vw, 6.8rem);
  font-weight: 760;
  line-height: 0.78;
  letter-spacing: -0.07em;
}

h1 span {
  color: transparent;
  -webkit-text-stroke: 1px #7d9287;
}

.lede {
  max-width: 690px;
  margin: 25px 0 0;
  color: var(--muted);
  font-size: clamp(0.96rem, 2vw, 1.08rem);
  line-height: 1.7;
}

.header-links {
  display: grid;
  flex: none;
  justify-items: end;
  gap: 17px;
  padding-bottom: 4px;
}

.header-links a,
footer a {
  color: var(--text);
  text-underline-offset: 4px;
}

.header-links a:hover,
footer a:hover {
  color: var(--green);
}

.local-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid #2b6549;
  border-radius: 999px;
  background: rgb(21 66 43 / 45%);
  color: var(--green-soft);
  font: 650 0.76rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}

.local-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
}

.runtime-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  background: rgb(11 17 14 / 74%);
}

.runtime-summary div {
  display: grid;
  gap: 5px;
  padding: 13px 16px;
  border-right: 1px solid var(--border-soft);
}

.runtime-summary div:last-child {
  border-right: 0;
}

.summary-label {
  color: var(--muted);
  font: 600 0.66rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.runtime-summary strong {
  font-size: 0.88rem;
  font-weight: 650;
}

.console-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--panel);
  box-shadow: 0 36px 100px rgb(0 0 0 / 52%);
}

.toolbar {
  min-height: 62px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 10px 13px 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-raised);
}

.window-lights {
  display: flex;
  gap: 7px;
}

.window-lights span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #46544c;
}

.window-lights span:first-child {
  background: var(--red);
}

.window-lights span:nth-child(2) {
  background: var(--amber);
}

.window-lights span:last-child {
  background: var(--green);
}

.status-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--muted);
  font: 650 0.76rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #66716d;
}

.status-dot.waiting {
  background: var(--amber);
  box-shadow: 0 0 10px rgb(240 179 90 / 50%);
}

.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 13px var(--green);
}

.status-dot.error {
  background: var(--red);
  box-shadow: 0 0 10px rgb(237 106 103 / 55%);
}

.controls {
  display: flex;
  align-items: stretch;
  justify-content: end;
  gap: 7px;
}

.cpu-control {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  font: 650 0.72rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}

.cpu-control select {
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  outline: 0;
}

.cpu-control option {
  background: var(--panel-raised);
}

button {
  min-width: 67px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #1d2621;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 680;
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: #496054;
  background: #27332c;
}

button.primary {
  border-color: #32885d;
  background: var(--green-dark);
  color: #d0ffe4;
}

button:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.boot-steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--border-soft);
  background: #0d1410;
  list-style: none;
}

.boot-steps li {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  padding: 9px 5px;
  border-right: 1px solid var(--border-soft);
  color: #65736b;
  font: 600 0.67rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  transition: color 160ms ease, background 160ms ease;
}

.boot-steps li:last-child {
  border-right: 0;
}

.boot-steps span {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid #3a463f;
  border-radius: 50%;
  font-size: 0.58rem;
}

.boot-steps li.active {
  background: rgb(240 179 90 / 5%);
  color: var(--amber);
}

.boot-steps li.done {
  color: var(--green);
}

.boot-steps li.done span {
  border-color: #327a56;
  background: var(--green-dark);
}

.terminal {
  height: min(60vh, 650px);
  min-height: 430px;
  padding: 15px;
  background: #050806;
}

.xterm {
  height: 100%;
}

.xterm .xterm-viewport {
  scrollbar-color: #35443b #080c09;
  scrollbar-width: thin;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  padding: 17px 4px 0;
  color: var(--muted);
  font: 0.72rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
}

footer p {
  margin: 0;
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 24px, 1180px);
  }

  .masthead {
    display: block;
  }

  .header-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
  }

  .runtime-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .runtime-summary div:nth-child(2) {
    border-right: 0;
  }

  .runtime-summary div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border-soft);
  }

  .toolbar {
    grid-template-columns: auto 1fr;
  }

  .status-line {
    justify-self: end;
  }

  .controls {
    grid-column: 1 / -1;
  }

  .cpu-control,
  .controls button {
    flex: 1;
    justify-content: center;
  }

  footer {
    display: block;
  }

  footer p + p {
    margin-top: 7px;
  }
}

@media (max-width: 520px) {
  .page-shell {
    width: calc(100% - 16px);
    padding-top: 26px;
  }

  .eyebrow {
    font-size: 0.61rem;
    letter-spacing: 0.11em;
  }

  h1 {
    font-size: clamp(3.45rem, 19vw, 5rem);
  }

  .lede {
    margin-top: 20px;
    line-height: 1.55;
  }

  .header-links {
    align-items: start;
    flex-direction: column;
    gap: 12px;
  }

  .runtime-summary div {
    padding: 11px;
  }

  .console-card {
    border-radius: 11px;
  }

  .toolbar {
    gap: 10px;
    padding: 10px;
  }

  .window-lights span {
    width: 9px;
    height: 9px;
  }

  .status-line {
    font-size: 0.65rem;
  }

  .controls {
    display: grid;
    grid-template-columns: 1.15fr repeat(3, 1fr);
    width: 100%;
  }

  .cpu-control {
    padding: 0 5px;
  }

  button {
    min-width: 0;
    padding: 9px 6px;
    font-size: 0.76rem;
  }

  .boot-steps li {
    gap: 0;
    font-size: 0;
  }

  .boot-steps li::after {
    font-size: 0.6rem;
  }

  .boot-steps li[data-stage="download"]::after {
    content: "Load";
  }

  .boot-steps li[data-stage="verify"]::after {
    content: "Check";
  }

  .boot-steps li[data-stage="firmware"]::after {
    content: "SBI";
  }

  .boot-steps li[data-stage="kernel"]::after {
    content: "Kernel";
  }

  .boot-steps li[data-stage="shell"]::after {
    content: "Shell";
  }

  .boot-steps span {
    display: none;
  }

  .terminal {
    height: 57vh;
    min-height: 355px;
    padding: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
