:root {
  --page: #020b1a;
  --window: rgba(10, 14, 20, 0.86);
  --bg: #0c1014;
  --bar: #161b21;
  --grid: #151b21;
  --fg: #d6dde4;
  --muted: #7a8794;
  --accent: #5af78e;
  --accent-dim: #2fbf63;
  --blue: #57c7ff;
  --yellow: #f3f99d;
  --red: #ff5c57;
  --magenta: #ff6ac1;
  --border: #232b34;
  --font: ui-monospace, "SFMono-Regular", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--page);
  color: var(--fg);
  font: 14px/1.5 var(--font);
  display: flex;
  justify-content: center;
  padding: 24px;
  height: 100dvh;
}

/* animated blue gradient background */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(125deg, #020b1a 0%, #062a55 25%, #0b4a8f 45%, #05305f 65%, #020b1a 100%);
  background-size: 300% 300%;
  animation: bg-shift 22s ease-in-out infinite alternate;
}
.bg i {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .55;
  will-change: transform;
}
.bg i:nth-child(1) { background: radial-gradient(circle, #1e6fd9 0%, transparent 65%); top: -20vmax; left: -15vmax; animation: drift-a 26s ease-in-out infinite alternate; }
.bg i:nth-child(2) { background: radial-gradient(circle, #0aa2d8 0%, transparent 65%); bottom: -25vmax; right: -15vmax; animation: drift-b 31s ease-in-out infinite alternate; }
.bg i:nth-child(3) { background: radial-gradient(circle, #2b3fd1 0%, transparent 65%); top: 30%; left: 35%; width: 45vmax; height: 45vmax; opacity: .4; animation: drift-c 37s ease-in-out infinite alternate; }
@keyframes bg-shift { 0% { background-position: 0% 30%; } 100% { background-position: 100% 70%; } }
@keyframes drift-a { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(35vw, 25vh) scale(1.25); } }
@keyframes drift-b { 0% { transform: translate(0, 0) scale(1.1); } 100% { transform: translate(-40vw, -30vh) scale(.9); } }
@keyframes drift-c { 0% { transform: translate(-20vw, 10vh) scale(.9); } 100% { transform: translate(15vw, -20vh) scale(1.2); } }
@media (prefers-reduced-motion: reduce) {
  .bg, .bg i { animation: none; }
}

.window {
  width: 100%;
  max-width: 1100px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--window);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(87, 199, 255, .18);
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
  overflow: hidden;
}

.titlebar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  flex: none;
  background: rgba(22, 27, 33, .9);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}
.dots { position: absolute; left: 14px; display: flex; gap: 8px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f56; }
.dots i:nth-child(2) { background: #ffbd2e; }
.dots i:nth-child(3) { background: #27c93f; }

.term-area { position: relative; flex: 1; min-height: 0; }
.term-body {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 18px 18px;
  scrollbar-color: #2a333d transparent;
}
.term-body.playing { overflow: hidden; }

.line { white-space: pre-wrap; word-break: break-word; min-height: 1.5em; }
.line p, .line ul { margin: 0; }
.para { max-width: 90ch; white-space: normal; }

.echo { color: var(--fg); }
.p-user { color: var(--accent); font-weight: 600; }
.p-path { color: var(--blue); font-weight: 600; }

.input-line { display: flex; align-items: center; gap: .6ch; }
.input-line[hidden] { display: none; }
#prompt { white-space: nowrap; flex: none; }
.input-wrap { position: relative; flex: 1; min-width: 0; }
.ghost {
  position: absolute;
  inset: 0;
  white-space: pre;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}
.ghost-typed { visibility: hidden; }
.ghost-rest { color: var(--muted); opacity: .75; pointer-events: auto; cursor: pointer; }
#cmd {
  position: relative;
  display: block;
  width: 100%;
  line-height: inherit;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--fg);
  caret-color: var(--accent);
  font: inherit;
  padding: 0;
}

.muted { color: var(--muted); }
.accent { color: var(--accent); }
.err { color: var(--red); }
.warn { color: var(--yellow); }
.ok { color: var(--accent); }
.h { color: var(--magenta); font-weight: 700; }
.name { color: var(--fg); font-weight: 700; font-size: 1.15em; }
.title { color: var(--yellow); font-weight: 700; }
.sub { color: var(--blue); font-weight: 700; }

a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--accent); }
.cmd {
  color: var(--accent);
  cursor: pointer;
  border-bottom: 1px dashed rgba(90, 247, 142, .4);
}
.cmd:hover, .cmd:focus-visible { background: rgba(90, 247, 142, .12); outline: none; }
.cmd-ish { color: var(--accent); }

.help-grid { display: grid; grid-template-columns: max-content 1fr; gap: 2px 3ch; white-space: normal; }

.bullets { list-style: none; padding: 0; white-space: normal; }
.bullets li { position: relative; padding-left: 2.5ch; max-width: 100ch; }
.bullets li::before { content: "›"; position: absolute; left: .5ch; color: var(--accent); }

.kv { display: grid; grid-template-columns: 24ch 1fr; gap: 2ch; white-space: normal; }
.key { color: var(--blue); font-weight: 600; }

.table-wrap { overflow-x: auto; white-space: normal; }
table { border-collapse: collapse; font: inherit; }
th, td { text-align: left; padding: 2px 3ch 2px 0; vertical-align: top; }
th { color: var(--blue); border-bottom: 1px dashed var(--border); font-weight: 600; }
td:first-child { color: var(--accent); }

.courses { white-space: normal; margin: 2px 0 6px; }
.course { display: grid; grid-template-columns: 10ch 1fr; gap: 1ch; padding: 2px 0 2px 2ch; }
.code { color: var(--yellow); }
.ctitle { color: var(--fg); }

.man { white-space: normal; max-width: 100ch; }
.man-head { display: flex; justify-content: space-between; gap: 2ch; margin-bottom: 6px; }
.man-sec { font-weight: 700; margin-top: 8px; }
.man-body { padding-left: 7ch; }
.man-body p { margin: 0 0 4px; }
.man-opt { margin-top: 4px; }
.man-optd { padding-left: 7ch; }

.neofetch { display: flex; gap: 3ch; align-items: flex-start; white-space: normal; }
.nf-ascii { margin: 0; color: var(--accent); font: inherit; line-height: 1.5; flex: none; }
.nf-info { min-width: 0; }
.nf-title { font-weight: 700; }
.nf-row { word-break: break-word; }
.nf-colors { display: flex; margin-top: 8px; }
.nf-colors span { width: 3ch; height: 1.1em; }

.snake {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  outline: none;
  z-index: 5;
  border-radius: 0 0 10px 10px;
  padding: 10px 14px 14px;
}
.snake-bar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 2ch; padding-bottom: 8px; color: var(--muted); }
.snake-bar b { color: var(--accent); }
.snake-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; touch-action: none; }
.snake-stage canvas { display: block; }

.noscript { position: fixed; inset: auto 0 0 0; text-align: center; color: var(--yellow); }

@media (max-width: 640px) {
  body { padding: 0; font-size: 13px; }
  .window { border-radius: 0; border: 0; }
  .term-body { padding: 10px 12px 14px; }
  .input-wrap { font-size: 16px; } /* prevents iOS zoom on focus */
  .neofetch { flex-direction: column; gap: 6px; }
  .nf-ascii { font-size: 11px; }
  .kv { grid-template-columns: 1fr; gap: 0; margin-bottom: 4px; }
  .help-grid { grid-template-columns: max-content 1fr; gap: 2px 2ch; }
  .course { grid-template-columns: 1fr; gap: 0; padding-left: 1ch; margin-bottom: 4px; }
  .man-body, .man-optd { padding-left: 3ch; }
  .snake-help { display: none; }
  /* stack table rows */
  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tr { padding: 4px 0; border-bottom: 1px dashed var(--border); }
  td { padding: 0; }
  td::before { content: attr(data-label) ": "; color: var(--muted); }
}
