:root {
  color-scheme: dark;
  --bg: #03071c;
  --panel: #071a78;
  --panel-dark: #03105d;
  --panel-light: #1230a6;
  --ink: #e8ffff;
  --muted: #9ee6ee;
  --accent: #fff174;
  --accent-soft: #d4ff7a;
  --hot: #ff6b6b;
  --line: #68f7ff;
  --grid: rgba(104, 247, 255, 0.28);
  --shadow: rgba(0, 0, 0, 0.55);
  --font: "Courier New", "Lucida Console", monospace;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 50%, rgba(0, 0, 0, 0.08) 50%) 0 0 / 100% 4px,
    linear-gradient(90deg, rgba(104, 247, 255, 0.08), transparent 18%, transparent 82%, rgba(104, 247, 255, 0.08)),
    radial-gradient(circle at 50% 0%, #102b5c 0%, var(--bg) 52%, #01030d 100%);
  color: var(--ink);
  font-family: var(--font);
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  position: relative;
}

.commander {
  width: min(980px, 100%);
  max-width: 100%;
  height: min(720px, calc(100vh - 48px));
  min-height: 520px;
  min-width: 0;
  border: 2px solid var(--line);
  background: var(--panel);
  box-shadow:
    0 24px 70px var(--shadow),
    0 0 0 1px #001153,
    0 0 0 5px rgba(104, 247, 255, 0.08),
    inset 0 0 0 1px #000e52,
    inset 0 0 30px rgba(104, 247, 255, 0.14);
  display: grid;
  grid-template-rows: auto 1fr auto;
  position: relative;
}

.commander::before {
  border: 1px solid rgba(104, 247, 255, 0.8);
  content: "";
  inset: -5px;
  pointer-events: none;
  position: absolute;
}

.commander__header,
.commander__footer {
  align-items: center;
  background: var(--panel-dark);
  color: var(--muted);
  display: flex;
  gap: 14px;
  min-height: 38px;
  padding: 8px 14px;
}

.commander__header {
  border-bottom: 2px solid var(--line);
  justify-content: space-between;
  text-transform: uppercase;
}

.commander__drive {
  color: var(--accent);
  font-weight: 700;
}

.commander__clock {
  color: var(--ink);
}

.commander__body {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  min-width: 0;
}

.commander__path {
  background: #020942;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  font-weight: 700;
  min-height: 32px;
  overflow: hidden;
  padding: 8px 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commander__viewport {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035), transparent 16%, transparent 84%, rgba(0, 0, 0, 0.08)),
    var(--panel);
  min-height: 0;
  min-width: 0;
  outline: none;
  overflow: auto;
  padding: 14px;
}

.file-list {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.file-list__header {
  border-bottom: 1px solid var(--grid);
  color: var(--muted);
  display: grid;
  font-size: 13px;
  grid-template-columns: minmax(0, 1fr) 5rem;
  margin-bottom: 6px;
  padding: 0 8px 6px;
}

.file-list__header span:last-child {
  text-align: right;
}

.file-row {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5rem;
  min-height: 34px;
  min-width: 0;
  padding: 5px 8px;
  text-align: left;
  width: 100%;
}

.file-row:hover,
.file-row[aria-current="true"] {
  background: var(--accent);
  color: #03105d;
  text-shadow: none;
}

.file-row[aria-current="true"] .file-row__name::before {
  content: ">";
  display: inline-block;
  margin-right: 8px;
}

.file-row__name {
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
}

.file-row__type {
  color: inherit;
  min-width: 0;
  opacity: 0.82;
  text-align: right;
}

.file-row__description {
  display: none;
}

.viewport__status,
.viewport__hint {
  border-top: 1px solid rgba(104, 247, 255, 0.55);
  color: var(--muted);
  margin-top: 18px;
  padding-top: 14px;
}

.viewport__status {
  color: var(--accent);
  margin-top: 14px;
}

.text-file {
  background: rgba(0, 8, 58, 0.42);
  border: 1px solid var(--grid);
  color: var(--ink);
  line-height: 1.45;
  max-width: 78ch;
  padding: 14px;
}

.text-file h1 {
  color: var(--accent);
  font-size: 20px;
  margin: 0 0 16px;
}

.text-file p {
  margin: 0 0 5px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.text-file p:first-of-type {
  color: var(--accent-soft);
}

.game-holder {
  display: grid;
  min-height: 100%;
  place-items: start center;
}

.game-screen {
  background: rgba(0, 8, 58, 0.48);
  border: 1px solid var(--grid);
  color: var(--ink);
  display: grid;
  gap: 12px;
  max-width: 100%;
  padding: 14px;
}

.game-screen__top {
  align-items: end;
  border-bottom: 1px solid var(--grid);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding-bottom: 10px;
}

.game-screen h1 {
  color: var(--accent);
  font-size: 20px;
  margin: 0;
}

.game-screen__stats {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.game-screen__stats b {
  color: var(--accent-soft);
}

.ascii-board,
.snake-board {
  color: var(--ink);
  font: 18px/1 var(--font);
  letter-spacing: 0;
  margin: 0;
  overflow: visible;
  text-shadow: 0 0 8px rgba(104, 247, 255, 0.28);
}

.game-screen__help {
  border-top: 1px solid var(--grid);
  color: var(--muted);
  padding-top: 10px;
}

.commander__footer {
  border-top: 2px solid var(--line);
  flex-wrap: wrap;
}

.commander__footer span,
.commander__contact {
  white-space: nowrap;
}

.commander__footer b,
.commander__contact b {
  background: var(--line);
  color: #001153;
  display: inline-block;
  margin-right: 4px;
  padding: 1px 4px;
}

.commander__contact {
  color: var(--accent);
  margin-left: 0;
  text-decoration: none;
}

.commander__contact--github {
  margin-left: auto;
}

.commander__contact:hover,
.commander__contact:focus-visible {
  background: var(--accent);
  color: #03105d;
  outline: none;
}

.screensaver {
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  transition: opacity 180ms ease;
  z-index: 10;
}

.screensaver--active {
  opacity: 1;
  pointer-events: auto;
}

#screensaverCanvas {
  display: block;
  height: 100%;
  width: 100%;
}

@media (max-width: 680px) {
  body {
    overflow: auto;
  }

  .shell {
    min-height: 100svh;
    padding: 10px;
  }

  .commander {
    height: calc(100svh - 20px);
    min-height: 420px;
  }

  .commander::before,
  .commander::after {
    inset: -3px;
  }

  .commander__footer {
    font-size: 13px;
    gap: 8px;
  }

  .commander__contact {
    margin-left: 0;
  }

  .game-screen {
    justify-self: stretch;
  }

  .game-screen__top {
    align-items: start;
    flex-direction: column;
  }

  .ascii-board,
  .snake-board {
    font-size: 13px;
  }
}
