/* Turkiverse — base styles. Palette and type from CLAUDE.md. */

:root {
  --void-top: #0B0A1F;
  --void-bottom: #1A1230;
  --nebula: #2A1B4A;
  --cream: #F3EAD8;
  --lavender: #9A93B8;
  --gold: #E8C16A;

  --serif: "Playfair Display", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--void-top);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ---------- Layers ---------- */

#atmosphere {
  position: fixed; inset: 0; z-index: 0;
  transition: opacity 1.2s ease;
}
.nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
}

#particles     { position: fixed; inset: 0; z-index: 1; }
#constellation { position: fixed; inset: 0; z-index: 2; }

#stage {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: 6vh 7vw;
  cursor: pointer;
}

#counter, #hint { z-index: 20; }

/* ---------- The beat ---------- */

#beat {
  max-width: 40em;
  text-align: center;
  opacity: 1;
  transition: opacity 0.35s ease;
}
#beat.out { opacity: 0; }

.headline {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 6.5vw, 3.8rem);
  font-weight: 500;
  color: var(--gold);
  line-height: 1.25;
  margin-bottom: 0.5em;
  min-height: 1em;
}

.narration {
  font-family: var(--serif);
  font-size: clamp(1.1rem, 3vw, 1.45rem);
  color: var(--cream);
  line-height: 1.65;
  margin: 0.4em 0;
}

.gloss {
  font-family: var(--sans);
  font-style: italic;
  font-size: clamp(0.85rem, 2.2vw, 1rem);
  color: var(--lavender);
  margin-top: 1.1em;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.gloss.show { opacity: 1; }

.label {
  font-family: var(--sans);
  font-size: clamp(0.85rem, 2.2vw, 1rem);
  color: var(--lavender);
  text-transform: uppercase;
  letter-spacing: 0.35em;
  margin-top: 1.2em;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.label.show { opacity: 1; }

/* Typewriter cursor: blinks while typing, removed when the line finishes. */
.cursor {
  display: inline-block;
  width: 0.08em;
  height: 1em;
  margin-left: 0.06em;
  background: currentColor;
  vertical-align: baseline;
  animation: blink 0.85s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Choices ---------- */

.choices {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8em;
  margin-top: 1.8em;
}
.choices.horizontal { flex-direction: row; flex-wrap: wrap; justify-content: center; }

.pill {
  font-family: var(--serif);
  font-size: clamp(0.95rem, 2.6vw, 1.15rem);
  color: var(--cream);
  background: none;
  border: 1px solid rgba(243, 234, 216, 0.35);
  border-radius: 999px;
  padding: 0.7em 1.6em;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  animation: pill-in 0.5s ease forwards;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.pill:hover, .pill:focus-visible {
  border-color: var(--gold);
  background: rgba(232, 193, 106, 0.08);
  outline: none;
}
.pill .pill-gloss {
  display: block;
  font-family: var(--sans);
  font-style: italic;
  font-size: 0.78em;
  color: var(--lavender);
  margin-top: 0.25em;
}
@keyframes pill-in { to { opacity: 1; transform: translateY(0); } }

/* ---------- Name input ---------- */

.input-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1em;
  margin-top: 1.8em;
}
.name-input {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  color: var(--gold);
  background: none;
  border: none;
  border-bottom: 1px solid rgba(243, 234, 216, 0.4);
  padding: 0.2em 0.1em;
  width: min(9em, 50vw);
  text-align: center;
  outline: none;
  caret-color: var(--gold);
  user-select: text;
}
.name-input::placeholder { color: var(--lavender); opacity: 0.55; font-style: italic; }
.name-input:focus { border-bottom-color: var(--gold); }
.name-input.shake { animation: shake 0.35s ease; }
@keyframes shake {
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.submit-btn {
  font-family: var(--sans);
  font-size: clamp(0.85rem, 2.2vw, 1rem);
  color: var(--lavender);
  background: none;
  border: 1px solid rgba(154, 147, 184, 0.4);
  border-radius: 999px;
  padding: 0.5em 1.2em;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease;
}
.submit-btn:hover, .submit-btn:focus-visible {
  color: var(--gold);
  border-color: var(--gold);
  outline: none;
}

/* ---------- Hint ---------- */

#hint {
  position: fixed;
  bottom: max(4vh, env(safe-area-inset-bottom, 0px) + 20px);
  left: 0; right: 0;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  color: var(--lavender);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}
#hint.show { opacity: 0.75; animation: hint-pulse 2.6s ease-in-out infinite; }
@keyframes hint-pulse { 50% { opacity: 0.35; } }

/* ---------- Word counter ---------- */

#counter {
  position: fixed;
  top: max(3vh, env(safe-area-inset-top, 0px) + 14px);
  right: 4vw;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--gold);
  opacity: 0;
  transition: opacity 1s ease;
  pointer-events: none;
}
#counter.show { opacity: 0.85; }
.counter-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 6px 1px rgba(232, 193, 106, 0.7);
  margin-right: 0.5em;
  vertical-align: middle;
}

/* ---------- Error overlay (author aid) ---------- */

#error-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(11, 10, 31, 0.96);
  color: var(--cream);
  font-family: monospace;
  font-size: 0.9rem;
  padding: 8vh 8vw;
  white-space: pre-wrap;
  user-select: text;
}
#error-overlay h2 { color: var(--gold); font-family: var(--sans); margin-bottom: 1em; }
