/* Say XYZZY — the cave, without the ceiling.
   Same design language as the Sky Ceiling kiosk: near-black rock, lantern
   amber, serif narration, monospace player lines. No framework, no build. */

:root {
  --rock:       #0b0805;
  --ink:        #e8ddc8;   /* cave narration              */
  --ink-dim:    #7a6a55;
  --flame:      #ffb454;   /* lantern light / player text */
  --data-font:  ui-monospace, "SF Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
  --serif:      Georgia, "Times New Roman", "DejaVu Serif", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--rock);
  color: var(--ink);
  font-family: var(--serif);
  overflow: hidden;
  display: flex; flex-direction: column;
}

/* ------------------------------------------------- scene painting ---- */
#stage { position: fixed; inset: 0; z-index: 0; }
#stage img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 1.6s ease;
}
#stage img.show { opacity: 1; }
#scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(11,8,5,0.72) 0%, rgba(11,8,5,0.25) 30%,
                    rgba(11,8,5,0.35) 62%, rgba(11,8,5,0.9) 100%);
}

/* ------------------------------------------------- chrome ------------ */
#masthead {
  position: relative; z-index: 2;
  display: flex; align-items: baseline; gap: 1.2em;
  padding: 18px 26px 10px;
  text-shadow: 0 2px 18px rgba(0,0,0,0.9);
}
#masthead h1 {
  font-family: var(--data-font);
  font-size: clamp(18px, 2.2vw, 26px);
  letter-spacing: 0.34em;
  color: var(--flame);
}
#tagline {
  font-family: var(--data-font);
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-dim);
}
#toggles { margin-left: auto; display: flex; gap: 10px; }
#toggles button {
  font-family: var(--data-font); font-size: 12px; letter-spacing: 0.1em;
  background: rgba(255,180,84,0.07);
  color: var(--ink-dim);
  border: 1px solid rgba(255,180,84,0.25);
  border-radius: 4px;
  padding: 6px 12px; cursor: pointer;
}
#toggles button[aria-pressed="true"] {
  color: var(--flame); border-color: var(--flame);
  background: rgba(255,180,84,0.14);
  box-shadow: 0 0 14px rgba(255,180,84,0.25);
}
#toggles button.unsupported { display: none; }

/* ------------------------------------------------- transcript -------- */
#playfield {
  position: relative; z-index: 2;
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0 max(26px, 6vw) 8px;
}
#log {
  display: flex; flex-direction: column; justify-content: flex-end;
  gap: 1.1em;
  overflow: hidden;
  font-size: clamp(17px, 2.05vw, 30px);
  line-height: 1.42;
  text-shadow: 0 2px 20px rgba(0,0,0,0.95), 0 0 8px rgba(0,0,0,0.85);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 12%);
  mask-image: linear-gradient(180deg, transparent 0, #000 12%);
}
.block { white-space: pre-wrap; opacity: 0.55; }
.block:last-child { opacity: 1; }
.block.you {
  font-family: var(--data-font);
  font-size: 0.74em; letter-spacing: 0.08em;
  color: var(--flame);
}
.block.you::before { content: "\203A  "; }
.block.sys {
  font-family: var(--data-font);
  font-size: 0.62em; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-dim);
}

/* ------------------------------------------------- the prompt -------- */
#promptline {
  display: flex; align-items: center; gap: 0.55em;
  margin-top: 1.1em;
  font-family: var(--data-font);
  font-size: clamp(17px, 1.9vw, 27px);
  color: var(--flame);
}
#promptline .chev { opacity: 0.9; }
#cmd {
  flex: 1;
  background: transparent; border: none; outline: none;
  color: var(--flame);
  font: inherit; letter-spacing: 0.06em;
  caret-color: var(--flame);
  text-shadow: 0 2px 18px rgba(0,0,0,0.9);
}
#cmd::placeholder { color: rgba(255,180,84,0.35); letter-spacing: 0.1em; }
#caret { display: none; }
#caret.think { display: inline-flex; gap: 0.3em; align-items: center; }
#caret.think s {
  width: 0.34em; height: 0.34em; border-radius: 50%;
  background: var(--ink-dim); text-decoration: none;
  animation: think 1.25s ease-in-out infinite;
}
#caret.think s:nth-child(2) { animation-delay: 0.16s; }
#caret.think s:nth-child(3) { animation-delay: 0.32s; }
@keyframes think {
  0%, 100% { opacity: 0.2; transform: translateY(0); }
  40%      { opacity: 0.85; transform: translateY(-0.2em); }
}
#promptline.listening .chev { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 0.45; } 50% { opacity: 1; } }

/* ------------------------------------------------- mouse input ------- */
#quick {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  padding: 12px 0 6px;
}
.qgroup { display: flex; gap: 6px; }
#quick button {
  font-family: var(--data-font); font-size: 12px; letter-spacing: 0.1em;
  background: rgba(11,8,5,0.55);
  color: var(--ink-dim);
  border: 1px solid rgba(122,106,85,0.45);
  border-radius: 4px;
  padding: 7px 12px; cursor: pointer;
  transition: color 120ms, border-color 120ms;
}
#quick button:hover { color: var(--flame); border-color: var(--flame); }
#quick button:disabled { opacity: 0.35; cursor: default; }

#colophon {
  position: relative; z-index: 2;
  padding: 8px 26px 14px;
  font-family: var(--data-font);
  font-size: 11px; letter-spacing: 0.08em;
  color: var(--ink-dim);
  text-shadow: 0 1px 10px rgba(0,0,0,0.9);
}
#colophon a { color: var(--ink-dim); }
#colophon b { color: var(--flame); font-weight: normal; }

/* ------------------------------------------------- boot splash ------- */
#boot {
  position: fixed; inset: 0; z-index: 10;
  background: var(--rock);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 26px;
  font-family: var(--data-font);
  font-size: 13px; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--ink-dim);
  transition: opacity 600ms ease;
}
#boot.gone { opacity: 0; pointer-events: none; }
.lantern {
  width: 18px; height: 26px; border-radius: 40% 40% 30% 30%;
  background: var(--flame);
  box-shadow: 0 0 34px 10px rgba(255,180,84,0.45);
  animation: flicker 2.6s ease-in-out infinite;
}
@keyframes flicker {
  0%,100% { opacity: 0.75; } 30% { opacity: 1; } 55% { opacity: 0.85; }
  70% { opacity: 0.95; }
}

@media (max-width: 700px) {
  #masthead { flex-wrap: wrap; gap: 0.6em; }
  #quick { gap: 6px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  #caret.think s, #promptline.listening .chev, .lantern { animation: none; }
  #stage img { transition: none; }
}
