/* First-contact wizard — its own immersive skin, deliberately unlike the parchment voyages:
   near-black, neon, monospace. Self-contained: system fonts only (no web fonts), no external
   assets. The deck's bilingual convention is kept — every line carries lang="en"/lang="de"
   spans and the active one is shown by the root data-doc-lang attribute.

   Layout: the assistant speaks from ONE fixed slot (.hw-voice), always in the same place and the
   same big neon font — each line replaces the last, it is not a scrolling log. The current
   interaction (choices, input, the generated prompt) lives just below in .hw-controls. */

:root {
  /* The wizard's palette IS the Neon theme's tokens (--cvt-color-*, set by the neon-glass theme
     stylesheet the page loads). The literals here are only fallbacks for a bare file:// open with no
     theme stylesheet — they mirror the neon-glass values, so served and offline look the same. The
     assistant speaks in the glow, the user answers in the strong accent. */
  --hw-bg: var(--cvt-color-surface-deep, #060814);
  --hw-fg: var(--cvt-color-text, #f2f5ff);
  --hw-dim: var(--cvt-color-text-muted, #94a3c8);
  --hw-cyan: var(--cvt-color-candle-glow, #22d3ee);
  --hw-magenta: var(--cvt-color-accent-strong, #8b5cf6);
  --hw-line: var(--cvt-color-border, rgba(255, 255, 255, 0.14));
  --hw-card: rgba(255, 255, 255, 0.035);
  --hw-mono: var(--cvt-font-mono, ui-monospace, "Cascadia Code", "Cascadia Mono", "Consolas", "SFMono-Regular", "Menlo", monospace);
  --hw-sans: var(--cvt-font-family, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--hw-bg);
  /* a slow neon aurora, well behind the text */
  background-image:
    radial-gradient(60% 50% at 22% 12%, color-mix(in srgb, var(--hw-cyan) 12%, transparent), transparent 70%),
    radial-gradient(55% 45% at 82% 88%, color-mix(in srgb, var(--hw-magenta) 11%, transparent), transparent 70%);
  color: var(--hw-fg);
  font-family: var(--hw-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* language toggle — bilingual show/hide is driven off the root attribute */
:root[data-doc-lang="en"] [lang="de"] { display: none; }
:root[data-doc-lang="de"] [lang="en"] { display: none; }

.hw-langtoggle {
  position: fixed;
  top: 14px;
  right: 16px;
  display: flex;
  gap: 4px;
  z-index: 5;
}
.hw-langtoggle button {
  font: 600 12px/1 var(--hw-mono);
  letter-spacing: 0.05em;
  color: var(--hw-dim);
  background: transparent;
  border: 1px solid var(--hw-line);
  border-radius: 6px;
  padding: 6px 9px;
  cursor: pointer;
}
.hw-langtoggle button[aria-pressed="true"] {
  color: var(--hw-bg);
  background: var(--hw-cyan);
  border-color: var(--hw-cyan);
}

/* the stage pins the current line at one height (history above it, controls below), so the
   line your eye lands on never moves — only the older lines drift up and shrink. */
.hw-stage {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10vh 20px 8vh;
}

/* ── history: a fixed-height band ABOVE the current line. Newest sits at the bottom (nearest the
   current line); each older line is a step smaller and dimmer; the oldest drift off the top. ── */
.hw-history {
  width: 100%;
  max-width: 760px;
  height: 22vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  overflow: hidden;
}
.hw-history .hw-line {
  flex: 0 0 auto;
  color: var(--hw-dim);
  transition: font-size 0.3s ease, opacity 0.3s ease;
}
/* the older, the smaller (newest history line = nth-last-child(1)) */
.hw-history .hw-line:nth-last-child(1) { font-size: 18px; color: var(--hw-fg); opacity: 0.9; }
.hw-history .hw-line:nth-last-child(2) { font-size: 15px; opacity: 0.7; }
.hw-history .hw-line:nth-last-child(3) { font-size: 13px; opacity: 0.55; }
.hw-history .hw-line:nth-last-child(4) { font-size: 12px; opacity: 0.42; }
.hw-history .hw-line:nth-last-child(n+5) { font-size: 11px; opacity: 0.3; }

/* ── the current line: big, neon, pinned in place ── */
.hw-current {
  width: 100%;
  max-width: 760px;
  min-height: 2.4em;
  margin-top: 10px;
}
.hw-line {
  width: 100%;
  text-align: center;
  font-family: var(--hw-mono);
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0.01em;
}
.hw-line.current {
  font-weight: 700;
  font-size: clamp(26px, 5vw, 44px);
  color: #fff;
  text-shadow: 0 0 14px color-mix(in srgb, var(--hw-cyan) 70%, transparent), 0 0 40px color-mix(in srgb, var(--hw-cyan) 32%, transparent);
}
.hw-line.appearing { animation: hw-linein 0.35s ease both; }
@keyframes hw-linein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.hw-line strong { color: var(--hw-cyan); }
.hw-line.current strong { color: var(--hw-cyan); }
/* the user's answer, appended to the same line in the other neon (magenta) so the exchange reads back */
.hw-line .hw-answer { color: var(--hw-magenta); font-weight: 700; }
.hw-line .hw-answer.dim { color: var(--hw-dim); font-weight: 500; font-style: italic; }
.hw-line .cursor {
  color: var(--hw-cyan);
  font-weight: 400;
  animation: hw-blink 1s steps(1) infinite;
}
@keyframes hw-blink { 50% { opacity: 0; } }

/* ── the interaction, just below the voice ── */
.hw-controls {
  width: 100%;
  max-width: 640px;
  margin-top: 7vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.hw-controls > * {
  width: 100%;
  animation: hw-rise 0.4s ease both;
}
@keyframes hw-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hw-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.hw-btn {
  font: 500 16px/1.2 var(--hw-sans);
  color: var(--hw-fg);
  background: var(--hw-card);
  border: 1px solid var(--hw-line);
  border-radius: 10px;
  padding: 11px 18px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, color 0.15s, transform 0.05s;
}
.hw-btn:hover,
.hw-btn:focus-visible {
  color: #fff;
  border-color: var(--hw-cyan);
  box-shadow: 0 0 0 1px var(--hw-cyan), 0 0 18px color-mix(in srgb, var(--hw-cyan) 30%, transparent);
  outline: none;
}
.hw-btn:active { transform: translateY(1px); }
.hw-btn.ghost { color: var(--hw-dim); border-color: transparent; }
.hw-btn.ghost:hover { color: var(--hw-fg); border-color: var(--hw-line); box-shadow: none; }
a.hw-btn { text-decoration: none; display: inline-block; text-align: center; }

/* free-text input */
.hw-ask { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hw-input {
  width: 100%;
  font: 400 17px/1.5 var(--hw-sans);
  color: var(--hw-fg);
  background: var(--hw-card);
  border: 1px solid var(--hw-line);
  border-radius: 10px;
  padding: 12px 14px;
  resize: vertical;
  min-height: 52px;
}
.hw-input:focus-visible {
  border-color: var(--hw-cyan);
  box-shadow: 0 0 0 1px var(--hw-cyan);
  outline: none;
}

/* the generated prompt */
.hw-prompt {
  border: 1px solid var(--hw-line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  text-align: left;
}
.hw-prompt pre {
  margin: 0;
  padding: 16px 18px;
  font: 400 14px/1.6 var(--hw-mono);
  color: var(--hw-fg);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 42vh;
  overflow: auto;
}
.hw-prompt-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px 9px 16px;
  border-top: 1px solid var(--hw-line);
  background: color-mix(in srgb, var(--hw-cyan) 6%, transparent);
}
.hw-prompt-bar .label {
  font: 600 12px/1 var(--hw-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hw-dim);
}
.hw-copy {
  font: 600 13px/1 var(--hw-mono);
  color: var(--hw-bg);
  background: var(--hw-cyan);
  border: 0;
  border-radius: 7px;
  padding: 9px 14px;
  cursor: pointer;
}
.hw-copy.done { background: var(--hw-magenta); }

/* the closing instruction + links */
.hw-instruction { color: var(--hw-dim); font-size: 15px; text-align: center; }
.hw-outro-links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.hw-outro-links a { color: var(--hw-cyan); }

.hw-noscript {
  max-width: 620px;
  margin: 14vh auto;
  padding: 0 20px;
}
.hw-noscript a { color: var(--hw-cyan); }

/* the mobile reality — single column, generous tap targets, voice sits a little higher */
@media (max-width: 520px) {
  .hw-stage { padding: 7vh 16px 8vh; }
  .hw-history { height: 20vh; }
  .hw-btn { flex: 1 1 100%; }
}

/* accessibility: no motion for those who ask for none */
@media (prefers-reduced-motion: reduce) {
  .hw-line { transition: none; }
  .hw-line.appearing { animation: none; }
  .hw-controls > * { animation: none; }
  .hw-line .cursor { animation: none; }
}
