:root {
  --black: #000000;
  --white: #ffffff;
  --light: #c8c8c8;
  --dark: #474747;
  --border: #252525;
  --font-pixel: "Press Start 2P", monospace;
  --font-mono: "JetBrains Mono", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  background: var(--black);
  color: var(--white);
  font-family: var(--font-mono);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 1.5px solid var(--white);
  outline-offset: 2px;
}

/* ---------- Full-Viewport ASCII Canvas ---------- */
#ascii-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 1;
  cursor: crosshair;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.18;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(255, 255, 255, 0.03) 3px
  );
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, 0.72) 100%);
}

/* ---------- Boot Sequence ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  background: #000;
  transition: opacity 0.55s ease;
  pointer-events: none;
}

.boot.gone {
  opacity: 0;
}

.boot-line,
.boot-bar {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #9e9e9e;
  text-transform: lowercase;
}

.boot-bar {
  color: #dfdfdf;
}

/* ---------- Side Telemetry Logs ---------- */
.side-logs {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  padding: 76px 20px 24px;
  pointer-events: none;
}

.logs-col {
  width: 240px;
  font-size: 9px;
  line-height: 1.5;
  color: var(--dark);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

#logs-right {
  text-align: right;
  align-items: flex-end;
  padding-top: 8vh;
}

#logs-left {
  padding-top: 22vh;
}

.log-line {
  white-space: pre-wrap;
  word-break: break-word;
}

.log-line.is-bright {
  color: var(--light);
}

.log-cursor {
  display: inline-block;
  margin-left: 3px;
  animation: blinkCursor 0.9s step-end infinite;
}

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

/* ---------- Minimal Top HUD ---------- */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.85) 30%, transparent);
  pointer-events: none;
}

.hud-brand {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--dark);
  letter-spacing: 0.1em;
  pointer-events: auto;
}

.hud-brand::first-letter {
  color: var(--light);
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(8, 8, 8, 0.84);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--light);
  pointer-events: auto;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.hud-btn:hover,
.hud-btn[aria-pressed="true"] {
  border-color: var(--light);
  background: #ffffff14;
  color: var(--white);
}

/* ---------- Main Viewport ---------- */
.viewport {
  position: relative;
  z-index: 10;
  height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto auto;
  align-items: center;
  justify-items: center;
  padding: 58px 18px clamp(20px, 3.8vh, 36px);
  pointer-events: none;
}

.stage-spacer {
  width: 100%;
  height: 100%;
  min-height: 180px;
}

.hero-block {
  text-align: center;
  margin-bottom: clamp(10px, 1.8vh, 16px);
  z-index: 12;
  pointer-events: auto;
}

.pixel-title {
  font-family: var(--font-pixel);
  font-size: clamp(22px, 3.6vw, 36px);
  letter-spacing: 0.14em;
  color: var(--white);
  text-shadow: 0 0 20px rgba(0, 0, 0, 0.95), 0 0 18px rgba(255, 255, 255, 0.2);
  cursor: pointer;
  user-select: none;
}

/* ---------- Minimalist Single-Row Dock ---------- */
.dock {
  width: auto;
  max-width: min(760px, 100%);
  z-index: 14;
  pointer-events: auto;
}

.dock-grid {
  list-style: none;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: center;
  gap: 7px;
}

.dock-grid > li {
  display: flex;
}

.dock-card {
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  height: 32px;
  min-height: 32px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: rgba(6, 6, 6, 0.82);
  color: var(--white);
  font-family: var(--font-pixel);
  font-size: 8.5px;
  line-height: 1;
  letter-spacing: 0.04em;
  white-space: nowrap;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 0 12px rgba(210, 210, 210, 0.04), inset 0 0 10px rgba(255, 255, 255, 0.02);
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease, transform 0.18s ease;
}

.dock-card:hover,
.dock-card:focus-visible {
  background: var(--white);
  color: var(--black);
  border-color: var(--white);
  transform: translateY(-2px);
}

.dock-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.dock-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.dock-name {
  display: block;
  line-height: 1;
}

.tick {
  position: absolute;
  width: 4px;
  height: 4px;
  pointer-events: none;
  border-color: rgba(255, 255, 255, 0.28);
  transition: border-color 0.12s ease;
}

.dock-card:hover .tick,
.dock-card:focus-visible .tick {
  border-color: #000;
}

.tick--tl { top: 3px; left: 3px; border-top: 1px solid; border-left: 1px solid; }
.tick--tr { top: 3px; right: 3px; border-top: 1px solid; border-right: 1px solid; }
.tick--bl { bottom: 3px; left: 3px; border-bottom: 1px solid; border-left: 1px solid; }
.tick--br { bottom: 3px; right: 3px; border-bottom: 1px solid; border-right: 1px solid; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 40;
  transform: translate(-50%, 14px);
  padding: 10px 14px;
  border: 1px solid var(--light);
  background: #000;
  color: var(--white);
  font-size: 10px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .side-logs { display: none; }
}

@media (max-width: 720px) {
  .hud { padding: 14px 16px; }
  .dock {
    width: min(460px, 100%);
  }
  .dock-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }
  .dock-card {
    width: 100%;
  }
  .toast {
    max-width: calc(100vw - 24px);
    white-space: normal;
    text-align: center;
  }
}

@media (max-width: 440px) {
  .dock-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .log-cursor { animation: none; }
}
