:root {
  --bg: #04071a; --fg: #9fb3ff; --dim: #3a4a8a; --label: #6b7bc4;
  --C: #5ff6ff; --V: #9a2cff; --Y: #ffe600; --G: #5cff5c; --M: #ff2bd6;
  color-scheme: dark;
}
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--fg);
  font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace; }
body::after { content: ""; position: fixed; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(#0000 0 3px, #0003 3px 4px); }

.grid { min-height: 100vh; min-height: 100dvh; box-sizing: border-box; display: grid; gap: 2vw; padding: 3vw;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr) minmax(0, 1.3fr); align-items: center; }

/* hex dump */
.hex { align-self: stretch; overflow: hidden; max-height: calc(100vh - 6vw);
  font-size: 11px; line-height: 1.5; color: var(--dim); white-space: pre; }
.hex b { color: var(--Y); font-weight: 400; }

/* terminal */
.term { font-size: clamp(13px, 1.25vw, 15px); line-height: 1.7; }
.term p, .term h1, .term nav { margin: 0; }
.t { white-space: pre; }
.ok { color: var(--G); }
.tag { color: var(--M); padding-left: 2ch; }
.big { display: block; width: min(100%, 36em); height: auto; margin: .5em 0;
  filter: drop-shadow(0 0 6px #5ff6ff99); }
.big pattern rect { fill: var(--C); }
nav { padding-left: 2ch; }
nav a { color: var(--Y); text-decoration: none; }
nav a::before { content: "> "; }
nav a:hover, nav a:focus-visible { background: var(--Y); color: var(--bg); outline: 2px solid var(--Y); outline-offset: 2px; }
.cur { display: inline-block; width: .6em; height: 1.1em; background: var(--Y); vertical-align: -.2em;
  animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.out { min-height: 3.4em; white-space: pre-wrap; }
.out .err { color: var(--M); }
.out .ok { color: var(--G); }

/* boot sequence: JS adds .boot, then .on line by line */
.boot .ln { visibility: hidden; }
.boot .ln.on { visibility: visible; }
.boot .ln .ok { visibility: hidden; }
.boot .ln.done .ok { visibility: visible; }
.boot h1.on g rect { animation: pop .12s both; }
@keyframes pop { from { opacity: 0; } }
[data-flash] .big { animation: flash .9s; }
@keyframes flash { 0%, 100% { filter: drop-shadow(0 0 6px #5ff6ff99); } 20% { filter: drop-shadow(0 0 22px var(--C)) brightness(1.6); } }

/* traceroute */
.lbl { font-size: 11px; letter-spacing: .2em; color: var(--label); margin-bottom: 12px; }
.route { position: relative; }
.route ol { position: relative; list-style: none; margin: 0; padding: 0 0 0 6px; }
.route ol::before { content: ""; position: absolute; left: 12px; top: 8px; bottom: 8px; border-left: 2px solid var(--V); }
.route li { position: relative; display: flex; align-items: center; height: 42px; font-size: 12px; color: var(--label); }
.route li::after { content: ""; position: absolute; left: 20px; width: 14px; border-top: 2px solid #5ff6ff55; }
.route i { position: relative; z-index: 1; flex: none; width: 10px; height: 10px; border: 2px solid var(--V);
  background: var(--bg); animation: lit 4.8s infinite; }
.route span { margin-left: 28px; white-space: nowrap; }
.route li:last-child i { width: 14px; height: 14px; margin-left: -2px; border-color: var(--Y); }
.route li:last-child span { color: var(--Y); font-size: 14px; }
.route li:nth-child(2) i { animation-delay: .6s; }
.route li:nth-child(3) i { animation-delay: 1.2s; }
.route li:nth-child(4) i { animation-delay: 1.8s; }
.route li:nth-child(5) i { animation-delay: 2.4s; }
.route li:nth-child(6) i { animation-delay: 3s; }
.route li:nth-child(7) i { animation-delay: 3.6s; }
.route li:nth-child(8) i { animation-delay: 4.2s; }
@keyframes lit { 0%, 3%, 14%, 100% { background: var(--bg); } 4%, 11% { background: var(--G); } }
/* packet glides to each node (42px apart), rests, then fades out at y1bit.dev */
.pkt { position: absolute; left: 8px; top: 8px; z-index: 2; width: 10px; height: 10px; background: var(--G);
  box-shadow: 0 0 12px var(--G); will-change: transform; animation: hop 4.8s infinite; }
@keyframes hop {
  0%, 9% { transform: translateY(0); opacity: 1; }
  12.5%, 21.5% { transform: translateY(42px); }
  25%, 34% { transform: translateY(84px); }
  37.5%, 46.5% { transform: translateY(126px); }
  50%, 59% { transform: translateY(168px); }
  62.5%, 71.5% { transform: translateY(210px); }
  75%, 84% { transform: translateY(252px); }
  87.5%, 96% { transform: translateY(294px); opacity: 1; }
  99% { transform: translateY(294px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; align-items: start; align-content: start; padding: 28px 20px; gap: 36px; }
  .hex { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .pkt { display: none; }
  .route li:last-child i { background: var(--G); }
}
