/* xClean pixel theme, fullscreen café edition.
   Three non-overlapping layers: top HUD bar, the canvas scene, bottom HUD bar.
   Nothing floats over the scene. Hard edges, chunky borders.
   Light = day café room, dark = night café room. */

:root {
  --font-display: "Press Start 2P", monospace;
  --font-body: "Pixelify Sans", "Inter", sans-serif;

  --px-border: 3px;
  --hud-top: 64px;
  --hud-bottom: 84px;
  --spectral: linear-gradient(100deg, #a855f7 0%, #6366f1 34%, #3b82f6 66%, #22d3ee 100%);

  /* day café */
  --color-bg: #f6e7c6;
  --color-surface: #fdf3dc;
  --color-ink: #3a2f24;
  --color-ink-2: #6b5a44;
  --color-line: #3a2f24;
  --color-accent: #6e5bf2;
  --color-accent-dark: #4a37c9;
  --color-accent-soft: #e9e2ff;
}

[data-theme="dark"] {
  /* night café */
  --color-bg: #171b2e;
  --color-surface: #212743;
  --color-ink: #f3f5f9;
  --color-ink-2: #aeb6c8;
  --color-line: #0d101f;
  --color-accent: #8a76f4;
  --color-accent-dark: #6e5bf2;
  --color-accent-soft: #2c2f55;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.45;
  color: var(--color-ink);
  background: var(--color-bg);
}

a:not([class]) { color: var(--color-accent-dark); }
[data-theme="dark"] a:not([class]) { color: var(--color-accent); }
a:not([class]):hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible {
  outline: 3px dashed var(--color-accent);
  outline-offset: 2px;
}

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

/* --------------------------- layer 2: the scene, between the two HUD bars */
#scene {
  position: fixed;
  top: var(--hud-top);
  bottom: var(--hud-bottom);
  left: 0;
  width: 100%;
  height: calc(100% - var(--hud-top) - var(--hud-bottom));
  image-rendering: pixelated;
  cursor: pointer;
  background: var(--color-bg);
  /* same composition on every device: letterbox instead of stretching */
  object-fit: contain;
}

/* ------------------------------------------------- layer 1: the top HUD bar */
header.shell {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--hud-top);
  z-index: 10;
  background: var(--color-surface);
  border-bottom: var(--px-border) solid var(--color-line);
}
.shell .bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  height: 100%;
  padding: 0 16px;
}
.brand {
  display: inline-flex; align-items: center; gap: 12px;
  color: var(--color-ink); text-decoration: none;
  flex-shrink: 0;
}
.brand:hover .wordmark { color: var(--color-accent); }
.mark { width: 26px; height: 26px; image-rendering: pixelated; }
.wordmark { font-family: var(--font-display); font-size: 13px; }

.title { text-align: center; overflow: hidden; }
h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
}
.slogan {
  margin: 2px 0 0;
  font-size: 14px;
  line-height: 1.2;
  color: var(--color-ink-2);
  white-space: nowrap;
}
h1 .spectral {
  background: var(--spectral);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
h1 .dot { color: var(--color-ink-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  min-height: 40px; padding: 8px 16px;
  font-family: var(--font-display); font-size: 11px; line-height: 1.6;
  color: var(--color-ink);
  background: var(--color-surface);
  border: var(--px-border) solid var(--color-line);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--color-line);
  white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: transform 80ms steps(2, end), box-shadow 80ms steps(2, end);
  flex-shrink: 0;
}
.btn:hover { text-decoration: none; transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--color-line); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--color-line); }
.btn-primary { background: var(--color-accent); color: #ffffff; }
.btn-primary:hover { background: var(--color-accent-dark); color: #ffffff; }
.btn-icon { min-width: 40px; padding: 0; }
.controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* live "who's in the café" badge */
.presence {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 40px; padding: 0 12px;
  font-family: var(--font-display); font-size: 11px; line-height: 1;
  color: var(--color-ink);
  background: var(--color-surface);
  border: var(--px-border) solid var(--color-line);
  box-shadow: 3px 3px 0 var(--color-line);
  white-space: nowrap; cursor: default;
}
.presence[hidden] { display: none; }
.presence .dot {
  width: 8px; height: 8px;
  background: var(--color-ink-2);
  box-shadow: 0 0 0 2px var(--color-line);
}
.presence.live .dot {
  background: #22c55e;
  animation: presence-pulse 1.8s steps(2, end) infinite;
}
.presence .pcount { font-size: 13px; }
.presence .plabel { color: var(--color-ink-2); }
@keyframes presence-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.btn-mini {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 9px;
  box-shadow: 2px 2px 0 var(--color-line);
  vertical-align: middle;
}

/* ---------------------------------------------- layer 3: the bottom HUD bar */
footer.hud {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--hud-bottom);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  background: var(--color-surface);
  border-top: var(--px-border) solid var(--color-line);
}
.hint {
  margin: 0;
  font-size: 16px;
  color: var(--color-ink-2);
  flex: 1 1 auto;
  min-width: 0;
}
/* the selected robot's name stands out — bold, same palette */
#hint-bot {
  font-weight: 600;
  color: var(--color-ink);
}
.dock {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.dock-title {
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--color-ink-2);
}
.dock-list { display: flex; gap: 8px; }
.bot {
  display: flex; flex-direction: column; align-items: center;
  padding: 3px 4px 2px;
  font-family: var(--font-display); font-size: 7px;
  color: var(--color-ink);
  background: var(--color-bg);
  border: 2px solid var(--color-line);
  cursor: pointer;
  transition: transform 80ms steps(2, end);
}
.bot:hover { transform: translateY(-2px); }
.bot canvas { image-rendering: pixelated; width: 40px; height: 44px; }
.bot[aria-pressed="true"] {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent);
}
.copy {
  font-size: 13px;
  color: var(--color-ink-2);
  flex-shrink: 0;
}

/* ------------------------------------------------------------- about page */
body.doc {
  overflow: auto; overflow-x: hidden;
  /* long-form prose reads in a normal font; pixel fonts stay on headings/chips */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
}
body.doc main {
  margin-top: var(--hud-top);
  padding: 48px 20px 72px;
}
.doc-wrap { max-width: 720px; margin: 0 auto; }
.doc-wrap .eyebrow { margin-bottom: 14px; }
.doc-wrap h1 {
  white-space: normal;
  font-size: clamp(18px, 4vw, 28px);
  line-height: 1.65;
  margin-bottom: 18px;
}
.doc-wrap h2 {
  font-family: var(--font-display);
  font-size: clamp(13px, 2.6vw, 16px);
  line-height: 1.6;
  margin: 44px 0 14px;
}
.doc-wrap h2::before { content: "▚ "; color: var(--color-accent); }
.doc-wrap p { margin: 0 0 14px; }
.hook { font-size: 19px; }
.hook p { margin: 0 0 6px; font-size: inherit; }
.meta-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 18px 0 8px;
}
.meta-chip {
  font-family: var(--font-display); font-size: 9px; line-height: 1;
  color: var(--color-accent-dark);
  background: var(--color-accent-soft);
  border: 2px solid var(--color-line);
  padding: 6px 9px;
}
[data-theme="dark"] .meta-chip { color: var(--color-accent); }
.doc-wrap ul, .doc-wrap ol { margin: 0 0 14px; padding-left: 26px; }
.doc-wrap li { margin-bottom: 9px; }
.doc-wrap li::marker { color: var(--color-accent); font-weight: 600; }
.pull {
  margin: 36px 0;
  padding: 18px 22px;
  font-family: var(--font-display); font-size: 13px; line-height: 2;
  background: var(--color-surface);
  border: var(--px-border) solid var(--color-line);
  box-shadow: 6px 6px 0 var(--color-line);
}
.pull::before { content: "❝ "; color: var(--color-accent); }
.art { display: flex; justify-content: center; margin: 34px 0; }
.art svg { width: min(200px, 46vw); height: auto; }
.faq details {
  background: var(--color-surface);
  border: var(--px-border) solid var(--color-line);
  box-shadow: 3px 3px 0 var(--color-line);
  margin-bottom: 12px;
  padding: 0 16px;
}
.faq summary {
  cursor: pointer;
  padding: 14px 0;
  font-family: var(--font-display); font-size: 11px; line-height: 1.8;
  list-style: none;
}
.faq summary::before { content: "▸ "; color: var(--color-accent); }
.faq details[open] summary::before { content: "▾ "; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { color: var(--color-accent-dark); }
[data-theme="dark"] .faq summary:hover { color: var(--color-accent); }
.faq details p { padding-bottom: 14px; margin: 0; }
.doc-cta { text-align: center; margin-top: 44px; }
.doc-cta p { margin-top: 22px; }
footer.doc-foot {
  border-top: var(--px-border) solid var(--color-line);
  background: var(--color-surface);
  text-align: center;
  padding: 18px 16px;
  font-size: 14px;
  color: var(--color-ink-2);
}

/* ------------------------------------------------------- 404 (no scene) */
.title-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  text-align: center;
  background: var(--color-surface);
  border: var(--px-border) solid var(--color-line);
  box-shadow: 6px 6px 0 var(--color-line);
  padding: 22px 26px;
  max-width: min(92vw, 520px);
}
.title-panel h1 { white-space: normal; font-size: clamp(14px, 3vw, 20px); line-height: 1.7; }
.tagline { margin: 10px 0 0; font-size: 16px; color: var(--color-ink-2); }
.eyebrow {
  display: inline-block;
  font-family: var(--font-display); font-size: 9px;
  color: var(--color-accent-dark);
  background: var(--color-accent-soft);
  border: 2px solid var(--color-line);
  padding: 6px 10px;
  margin-bottom: 10px;
}
[data-theme="dark"] .eyebrow { color: var(--color-accent); }
.cta-row { display: flex; gap: 16px; justify-content: center; margin-top: 16px; }

/* ------------------------------------------------------------------ mobile */
@media (max-width: 760px) {
  header.shell .title { display: none; }
  .presence .plabel { display: none; }
  .presence { padding: 0 9px; }
  footer.hud { flex-wrap: wrap; height: auto; min-height: var(--hud-bottom); padding: 8px 12px; row-gap: 4px; }
  .hint { font-size: 13px; flex-basis: 100%; text-align: center; order: 2; margin-bottom: 2px; }
  .dock { order: 1; margin: 0 auto; }
  .copy { display: none; }
  #scene { bottom: 136px; height: calc(100% - var(--hud-top) - 136px); }
  footer.hud { max-height: 136px; overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
