/* The deep end's shell. Everything outside the canvas: the way home, a loading
   screen from the last millennium, and the page you get when it all fails. */

@font-face {
  font-family: "Geist";
  src: url("/neptune/fonts/geist-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/neptune/fonts/geist-mono-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #03040a;
  --fg: #f4f1ec;
  --fg-muted: #aaa298;
  /* The site's accent, per mode (globals.css). Sativa, the default, is acid;
     boot.js sets data-mode from the reader's own choice before the engine
     loads. */
  --ember: #c6f432;
  --ember-bright: #d9ff5c;
  --ember-ink: #111503;
  --ember-glow: rgba(198, 244, 50, 0.26);
  --ember-line: rgba(198, 244, 50, 0.7);
  --cyan: #00eeff;
  --magenta: #ff2ec7;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  /* The loader is period-accurate on purpose. */
  --w98-face: #c3c3c3;
  --w98-light: #ffffff;
  --w98-shadow: #808080;
  --w98-dark: #0a0a0a;
  --w98-title-a: #000080;
  --w98-title-b: #1084d0;
  --w98-font: Tahoma, "MS Sans Serif", Geneva, Verdana, var(--sans);
}

:root[data-mode="couch"] {
  --ember: #e08a3c;
  --ember-bright: #f0a45c;
  --ember-ink: #1c0f04;
  --ember-glow: rgba(224, 138, 60, 0.28);
  --ember-line: rgba(224, 138, 60, 0.7);
}

* { box-sizing: border-box; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-text-size-adjust: 100%;
}

#canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  outline: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
#canvas:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }

/* ---------------------------------------------------------------- the way home */

.home {
  position: fixed;
  z-index: 30;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 1.05rem 0 0.85rem;
  border-radius: 9px;
  background: var(--ember);
  color: var(--ember-ink);
  font: 600 0.9375rem/1 var(--sans);
  letter-spacing: -0.005em;
  text-decoration: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 8px 28px var(--ember-glow);
  transition: background-color 150ms ease;
}
.home::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-right: 0.1rem;
}
.home:hover { background: var(--ember-bright); }
.home:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

/* ---------------------------------------------------------------- storage used
   Measured live by boot.js from navigator.storage.estimate(). Sits opposite
   the way home, in the telemetry panel's own dress, and never takes a click
   away from the canvas. */

.storage {
  position: fixed;
  z-index: 30;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-height: 44px;
  margin: 0;
  padding: 6px 14px 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(0, 238, 255, 0.42);
  border-left-width: 3px;
  background: rgba(10, 9, 8, 0.86);
  pointer-events: none;
  text-align: left;
}
.storage-key {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--cyan);
  font: 600 10px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
/* A live light: it is re-measured every three seconds. */
.storage-key::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3dff9a;
  box-shadow: 0 0 8px #3dff9a;
  animation: live 3s ease-in-out infinite;
}
.storage-value {
  color: var(--fg);
  font: 700 17px/1 var(--mono);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.storage[data-storage="zero"] .storage-value { color: #3dff9a; }
.storage[data-storage="nonzero"] { border-color: var(--ember-line); }
.storage[data-storage="nonzero"] .storage-key { color: var(--ember-bright); }
.storage[data-storage="nonzero"] .storage-value { color: var(--ember-bright); }
.storage[data-storage="nonzero"] .storage-key::before,
.storage[data-storage="unknown"] .storage-key::before,
.storage[data-storage="measuring"] .storage-key::before { background: var(--fg-muted); box-shadow: none; }
.storage[data-storage="measuring"] .storage-value,
.storage[data-storage="unknown"] .storage-value { color: var(--fg-muted); }
body[data-state="failed"] .storage { display: none; }

@keyframes live { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------------------------------------------------------------- 1999 */

.loader {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 88px 16px 24px;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(16, 132, 208, 0.25), transparent 60%),
    radial-gradient(circle at 20% 20%, rgba(255, 46, 199, 0.08), transparent 40%),
    var(--bg);
  transition: opacity 600ms ease;
}
body[data-state="running"] .loader { opacity: 0; pointer-events: none; }
body[data-state="failed"] .loader { display: none; }

.win {
  width: min(460px, 100%);
  background: var(--w98-face);
  color: #000;
  font-family: var(--w98-font);
  font-size: 13px;
  padding: 3px;
  box-shadow:
    inset -1px -1px var(--w98-dark),
    inset 1px 1px #dfdfdf,
    inset -2px -2px var(--w98-shadow),
    inset 2px 2px var(--w98-light),
    0 24px 60px rgba(0, 0, 0, 0.6);
}
.titlebar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 3px 3px 5px;
  background: linear-gradient(90deg, var(--w98-title-a), var(--w98-title-b));
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
}
.titlebar > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.titlebar-icon {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #9fd4ff, #1c4fd8 60%, #07185a);
}
.titlebar-buttons { display: flex; gap: 2px; flex: none; }
.titlebar-buttons i {
  display: grid;
  place-items: center;
  width: 16px;
  height: 14px;
  background: var(--w98-face);
  color: #000;
  font: 700 10px/1 var(--w98-font);
  font-style: normal;
  box-shadow: inset -1px -1px var(--w98-dark), inset 1px 1px var(--w98-light), inset -2px -2px var(--w98-shadow);
}
.win-body { padding: 14px 14px 12px; }

/* The disc prompt: nothing heavy is fetched until someone presses a button. */
.gate-row { display: flex; gap: 14px; align-items: flex-start; }
.disc {
  flex: none;
  width: 40px;
  height: 40px;
  margin-top: 2px;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--w98-face) 0 4px, #6d6d6d 4px 5px, transparent 5px 9px, rgba(0, 0, 0, 0.18) 9px 10px, transparent 10px),
    conic-gradient(from 20deg, #e8f4ff, #b9c7ff, #ffd6f5, #fff3b8, #c9ffe6, #b9e3ff, #e8f4ff);
  box-shadow: inset 0 0 0 1px #6d6d6d;
}
.gate-copy { min-width: 0; }
.gate-title { margin: 0 0 6px; font: 700 13px/1.3 var(--w98-font); }
.gate-text { margin: 0; line-height: 1.45; }
.gate-warn {
  margin: 10px 0 0;
  padding: 6px 8px;
  background: #ffffe1;
  border: 1px solid #000;
  line-height: 1.4;
}
.gate-warn[hidden] { display: none; }
.gate-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.w98-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 0;
  background: var(--w98-face);
  color: #000;
  font: 13px/1 var(--w98-font);
  text-decoration: none;
  cursor: pointer;
  box-shadow: inset -1px -1px var(--w98-dark), inset 1px 1px var(--w98-light), inset -2px -2px var(--w98-shadow), inset 2px 2px #dfdfdf;
}
.w98-btn:active {
  box-shadow: inset -1px -1px var(--w98-light), inset 1px 1px var(--w98-dark), inset -2px -2px #dfdfdf, inset 2px 2px var(--w98-shadow);
}
.w98-btn:focus { outline: none; }
.w98-btn:focus-visible { outline: 1px dotted #000; outline-offset: -6px; }
/* The default button: the one Enter presses, drawn the way 1998 drew it, and
   filled with the site's accent so there is exactly one thing to press. On a
   metered connection the default moves to the way home. */
.w98-btn-default,
.loader[data-metered] #gate-home {
  font-weight: 700;
  background: var(--ember);
  color: var(--ember-ink);
  box-shadow: 0 0 0 1px #000, inset -1px -1px var(--w98-dark), inset 1px 1px var(--w98-light), inset -2px -2px rgba(0, 0, 0, 0.35), inset 2px 2px rgba(255, 255, 255, 0.5);
}
.w98-btn-default:hover,
.loader[data-metered] #gate-home:hover { background: var(--ember-bright); }
.loader[data-metered] .w98-btn-default {
  font-weight: 400;
  background: var(--w98-face);
  color: #000;
  box-shadow: inset -1px -1px var(--w98-dark), inset 1px 1px var(--w98-light), inset -2px -2px var(--w98-shadow), inset 2px 2px #dfdfdf;
}
.loader[data-metered] .w98-btn-default:hover { background: var(--w98-face); }
.uplink[hidden], .gate[hidden] { display: none; }
.win-lede { margin: 0 0 10px; font-weight: 700; }
.win-msg {
  margin: 0 0 12px;
  min-height: 2.6em;
  font-family: "Courier New", var(--mono);
  font-size: 13px;
}
.win-msg::after { content: "_"; animation: blink 1s steps(1) infinite; }
.bar {
  height: 24px;
  padding: 3px;
  background: #fff;
  box-shadow: inset -1px -1px var(--w98-light), inset 1px 1px var(--w98-shadow), inset -2px -2px #dfdfdf, inset 2px 2px var(--w98-dark);
}
.bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  /* Blocks, not a gradient. It is 1999. */
  background: repeating-linear-gradient(90deg, var(--w98-title-a) 0 12px, transparent 12px 15px);
  transition: width 200ms linear;
}
.win-stats {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 0;
  font-size: 12px;
}

.badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.badge {
  width: 118px;
  padding: 5px 6px;
  font: 10px/1.25 Verdana, var(--w98-font);
  text-align: center;
  border: 2px outset #d0d0d0;
}
.badge b { font-size: 11px; }
.badge-netscape { background: #000; color: #fff; border-color: #6a6a6a; }
.badge-netscape b { color: #5bd1ff; }
.badge-res { background: #007f7f; color: #fff; border-color: #36b0b0; }
.badge-construction {
  background: repeating-linear-gradient(-45deg, #ffd400 0 8px, #111 8px 16px);
  color: #111;
}
.badge-construction span {
  display: inline-block;
  max-width: 100%;
  padding: 1px 3px;
  background: #ffd400;
  color: #111;
}

.loader-fine b { color: var(--fg); font-weight: 700; }
.loader-fine {
  margin: 0;
  max-width: 34rem;
  color: var(--fg-muted);
  font: 12px/1.5 var(--mono);
  text-align: center;
}

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

/* ---------------------------------------------------------------- failure */

.fail {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 88px 16px 24px;
  overflow-y: auto;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 0%, rgba(255, 46, 199, 0.16), transparent 60%),
    var(--bg);
}
.fail[hidden] { display: none; }
.fail-card {
  width: min(36rem, 100%);
  padding: 28px;
  border-radius: 16px;
  background: #15130f;
  border: 1px solid rgba(244, 241, 236, 0.16);
  box-shadow: 0 0 0 1px rgba(255, 46, 199, 0.18), 0 30px 80px rgba(0, 0, 0, 0.6);
}
.fail-eyebrow {
  margin: 0 0 12px;
  color: var(--magenta);
  font: 600 12px/1.4 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.fail-title {
  margin: 0 0 12px;
  font: 600 clamp(1.7rem, 6vw, 2.4rem)/1.08 var(--sans);
  letter-spacing: -0.025em;
}
.fail-body { margin: 0 0 12px; color: #cfc8bf; font-size: 1rem; line-height: 1.55; }
.fail-detail {
  margin: 0 0 20px;
  color: var(--fg-muted);
  font: 13px/1.5 var(--mono);
  overflow-wrap: anywhere;
}
.fail-detail:empty { display: none; }
.fail-home {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1.2rem;
  border-radius: 9px;
  background: var(--ember);
  color: var(--ember-ink);
  font: 600 1rem/1 var(--sans);
  text-decoration: none;
}
.fail-home:hover { background: var(--ember-bright); }
.fail-home:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
body[data-state="failed"] .home { display: none; }

@media (max-width: 480px) {
  .win-body { padding: 12px 10px 10px; }
  .badge { width: 104px; }
  .badge b { font-size: 10px; }
  .badge-construction b { letter-spacing: -0.02em; }
  .win-stats { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .win-msg::after, .storage-key::before { animation: none; }
  .bar-fill, .loader, .home { transition: none; }
}
