/* MOTO DODGE — the whole page is a terminal. */
:root {
  --bg: #050805;
  --panel: #0a0f0a;
  --ink: #b8c9b8;
  --green: #46f08a;
  --green-dim: #2f8a55;
  --magenta: #b06cff;
  --yellow: #ffd23e;
  --cyan: #37e0e0;
  --white: #ffffff;
  --dim: #5c6b5c;
  --bar: #0c241a;          /* tmux status bar */
  --bar-ink: #8fe7b3;
  font-family: "DejaVu Sans Mono", "SFMono-Regular", "Menlo", "Consolas", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; background: #000; }

body {
  color: var(--ink);
  height: 100svh;
  overflow: hidden;
  /* phosphor glow + vignette behind the whole terminal */
  background:
    radial-gradient(130% 100% at 50% 0%, #0a120c 0%, var(--bg) 55%, #020402 100%);
}

/* the terminal "window" = the whole viewport */
.crt {
  position: relative;
  height: 100svh;
  display: flex;
  flex-direction: column;
  text-shadow: 0 0 6px rgba(70, 240, 138, 0.18);   /* faint phosphor bloom */
}
/* scanlines + a slow flicker over everything */
.crt::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px, rgba(0,0,0,0.13) 3px, rgba(0,0,0,0) 4px);
  box-shadow: inset 0 0 140px rgba(0, 0, 0, 0.7);
  animation: flicker 6s infinite steps(60);
}
@keyframes flicker { 0%,97%,100% { opacity: 1; } 98% { opacity: 0.94; } 99% { opacity: 0.97; } }
@media (prefers-reduced-motion: reduce) { .crt::after { animation: none; } .cur { animation: none; } }

/* ── title bar ───────────────────────────────────────────── */
.titlebar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.3rem 0.7rem;
  background: linear-gradient(#10181200, #0c1410), #0c1410;
  border-bottom: 1px solid #16271c;
  font-size: 0.78rem;
}
.dots { display: inline-flex; gap: 0.4rem; }
.dots i { width: 0.72rem; height: 0.72rem; border-radius: 50%; display: inline-block; }
.dots .r { background: #ff5f56; } .dots .y { background: #ffbd2e; } .dots .g { background: #27c93f; }
.ttl { color: var(--green-dim); flex: 1 1 auto; text-align: center; letter-spacing: 0.04em; }
.dims { color: var(--dim); }
@media (max-width: 560px) { .ttl { font-size: 0.7rem; } .dims { display: none; } }

/* ── shell prompt line ───────────────────────────────────── */
.promptline {
  flex: 0 0 auto;
  padding: 0.35rem 0.8rem 0.15rem;
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
}
.ps1 { color: var(--green); }
.ps1 .u { color: var(--cyan); }
.ps1 .h { color: var(--green); }
.ps1 .cwd { color: var(--yellow); }
.cmd { color: var(--ink); }
.cur {
  color: var(--green);
  margin-left: 1px;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 0%,50% { opacity: 1; } 50.01%,100% { opacity: 0; } }

/* ── the game (full-bleed terminal output) ───────────────── */
.term {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}
#screen { display: block; width: 100%; height: 100%; background: var(--bg); }

/* ── touch controls ──────────────────────────────────────── */
.pad {
  flex: 0 0 auto;
  display: none;
  gap: 0.45rem;
  padding: 0.4rem 0.5rem 0.1rem;
  user-select: none; -webkit-user-select: none;
}
.pad-mid { flex: 1 1 auto; display: flex; gap: 0.45rem; }
.btn {
  font-family: inherit; color: var(--green); background: #0d160e;
  border: 1px solid #244; border-color: #21402d; border-radius: 8px; font-size: 1.25rem;
  padding: 0.7rem 0; min-width: 3.6rem; cursor: pointer;
  text-shadow: 0 0 6px rgba(70, 240, 138, 0.4);
}
.btn:active { background: #16241a; transform: translateY(1px); }
.btn.small { font-size: 0.82rem; min-width: 3.4rem; }
.btn.wide { flex: 1 1 auto; font-size: 0.92rem; letter-spacing: 0.08em; }
@media (hover: none) and (pointer: coarse) { .pad { display: flex; } }

/* ── tmux-style status bar (nav lives here) ──────────────── */
.statusbar {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  gap: 1px;
  background: var(--bar);
  border-top: 1px solid #1a3a29;
  font-size: 0.8rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.statusbar::-webkit-scrollbar { display: none; }
.seg {
  display: flex; align-items: center;
  padding: 0.3rem 0.7rem;
  color: var(--bar-ink);
  text-decoration: none;
  background: none; border: none; font-family: inherit; font-size: inherit;
  white-space: nowrap; cursor: pointer;
}
a.seg:hover, .seg.linkish:hover { background: #123a28; color: var(--white); }
.seg.dim { color: var(--green-dim); cursor: default; }
.seg.grow { flex: 1 1 auto; cursor: default; padding: 0; }
.seg.mode {
  background: var(--green); color: #062012; font-weight: bold;
  letter-spacing: 0.08em; cursor: default;
}
.seg.coffee {
  background: var(--yellow); color: #2a2000; font-weight: bold;
  text-shadow: none;
}
.seg.coffee:hover { background: #ffe072; color: #2a2000; }

/* ── how-to overlay (man page) ───────────────────────────── */
.howto-panel {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: rgba(2, 5, 3, 0.86); backdrop-filter: blur(2px);
}
.howto-panel[hidden] { display: none; }
.howto-card {
  width: min(680px, 96vw);
  border: 1px solid #1f3a2a; border-radius: 8px;
  background: var(--panel); padding: 0.9rem 1.1rem;
  box-shadow: 0 24px 70px rgba(0,0,0,0.7), 0 0 40px rgba(70,240,138,0.06);
}
.howto-head { color: var(--ink); font-size: 0.82rem; margin-bottom: 0.9rem; border-bottom: 1px solid #173024; padding-bottom: 0.5rem; }
.howto-head .ps1 { color: var(--green); }
.howto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.howto-card h2 { color: var(--yellow); font-size: 0.78rem; letter-spacing: 0.18em; margin: 0 0 0.5rem; }
.howto-card ul { margin: 0; padding-left: 1.1rem; font-size: 0.85rem; line-height: 1.7; }
kbd {
  background: #16221a; border: 1px solid #2a3f30; border-bottom-width: 2px;
  border-radius: 4px; padding: 0 0.35rem; font-size: 0.8em; color: var(--green);
}
.muted { color: var(--dim); font-size: 0.8rem; }
.linkish { background: none; border: none; font-family: inherit; cursor: pointer; color: var(--cyan); }
.c-green { color: var(--green); } .c-white { color: var(--white); }
.c-cyan { color: var(--cyan); } .c-yellow { color: var(--yellow); }
.howto-close { margin-top: 0.9rem; text-align: center; }
@media (max-width: 560px) { .howto-grid { grid-template-columns: 1fr; gap: 0.8rem; } }
/* keep the coffee visible on phones by dropping optional segments */
@media (max-width: 560px) { .seg.opt, .seg.grow { display: none; } .seg { padding: 0.3rem 0.5rem; } .seg.coffee { margin-left: auto; } }
