/* ─────────────────────────────────────────────────────────
   Base / Layout
   ───────────────────────────────────────────────────────── */

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

:root {
  --bg:        #0d0d12;
  --surface:   #16161f;
  --border:    #2a2a38;
  --text:      #c9c9d9;
  --text-dim:  #44445a;
  --accent:    #7c6ee6;
  --accent-glow: rgba(124, 110, 230, 0.22);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  cursor: text;
}

/* ─────────────────────────────────────────────────────────
   Scene
   ───────────────────────────────────────────────────────── */

.scene {
  position: relative;
  height: 100vh;
}

/* radial bg glow — shifts color with emotion */
.scene::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 40%, var(--accent-glow), transparent 70%);
  pointer-events: none;
  transition: background 1.4s ease;
  z-index: 0;
}

/* ─────────────────────────────────────────────────────────
   Hidden input — captures keyboard, invisible to the eye
   ───────────────────────────────────────────────────────── */

#input {
  position: fixed;
  top: -200px;
  left: -200px;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: none;
  outline: none;
  background: transparent;
  color: transparent;
  resize: none;
  pointer-events: none;
  font-size: 16px; /* prevents iOS zoom */
}

/* ─────────────────────────────────────────────────────────
   Wordmark
   ───────────────────────────────────────────────────────── */

.wordmark {
  position: fixed;
  top: 28px;
  left: 36px;
  z-index: 10;
  font-family: 'Caveat', cursive;
  font-size: 26px;
  font-weight: 600;
  color: rgba(210, 200, 255, 0.5);
  pointer-events: all;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.wordmark:hover {
  color: rgba(210, 200, 255, 0.85);
}

/* ─────────────────────────────────────────────────────────
   GitHub link — bottom-left corner
   ───────────────────────────────────────────────────────── */

.github-link {
  position: fixed;
  bottom: 28px;
  left: 36px;
  z-index: 10;
  color: rgba(210, 200, 255, 0.35);
  pointer-events: all;
  text-decoration: none;
  transition: color 0.2s ease;
  line-height: 0;
}

.github-link:hover {
  color: rgba(210, 200, 255, 0.8);
}

/* ─────────────────────────────────────────────────────────
   Wall canvas — full-screen layer where text fragments live
   ───────────────────────────────────────────────────────── */

.wall-canvas {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none; /* clicks pass through to document */
  overflow: hidden;
}

/* ── Individual text fragment (one per click) ─────────── */
.text-fragment {
  position: absolute;
  font-family: 'Caveat', cursive;
  font-size: 30px;
  font-weight: 400;
  color: rgba(210, 200, 255, 0.92);
  line-height: 1.4;
  letter-spacing: 0.02em;
  pointer-events: none;
  user-select: none;
  max-width: 520px;
  word-break: break-word;
  white-space: pre-wrap;
  opacity: 1;
  transition: opacity 0.12s ease;
}

/* blinking cursor while actively typing this fragment */
.text-fragment.typing::after {
  content: '|';
  display: inline;
  margin-left: 2px;
  color: rgba(180, 160, 255, 0.65);
  animation: blink 1s step-end infinite;
}

/* fading out */
.text-fragment.fading {
  opacity: 0;
  transition: opacity 1.5s ease;
}

@keyframes blink {
  0%, 100% { opacity: 0.65; }
  50%       { opacity: 0; }
}

/* ─────────────────────────────────────────────────────────
   Hint — centered, very dim, only shows on empty canvas
   ───────────────────────────────────────────────────────── */

.wall-hint {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-family: 'Caveat', cursive;
  font-size: 17px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.7s ease;
}

.wall-hint.hidden {
  opacity: 0;
}

/* ─────────────────────────────────────────────────────────
   Emotion badge
   ───────────────────────────────────────────────────────── */

.emotion-badge {
  position: fixed;
  bottom: 268px;
  right: 60px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 1;
  transition: opacity 0.4s ease;
  z-index: 10;
}

.emotion-badge.hidden {
  opacity: 0;
  pointer-events: none;
}

#badge-emotion {
  font-weight: 600;
  color: #dfe6e9;
  transition: color 0.5s ease;
}

#badge-confidence {
  color: var(--text-dim);
  font-size: 11px;
}

/* ─────────────────────────────────────────────────────────
   Sprite wrapper
   ───────────────────────────────────────────────────────── */

.sprite-wrap {
  position: fixed;
  z-index: 4;
  bottom: 48px;
  right: 60px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 210px;
}

/* ─────────────────────────────────────────────────────────
   Emotion background glow (body class set by sprite.js)
   ───────────────────────────────────────────────────────── */

body.emotion-happy         { --accent-glow: rgba(246, 216, 96,  0.18); }
body.emotion-excited       { --accent-glow: rgba(255, 159, 67,  0.22); }
body.emotion-sad           { --accent-glow: rgba(116, 185, 255, 0.20); }
body.emotion-distressed    { --accent-glow: rgba(162, 155, 254, 0.22); }
body.emotion-angry         { --accent-glow: rgba(255, 107, 129, 0.22); }
body.emotion-anxious       { --accent-glow: rgba(85,  239, 196, 0.18); }
body.emotion-surprised     { --accent-glow: rgba(253, 203, 110, 0.20); }
body.emotion-contemplative { --accent-glow: rgba(178, 190, 195, 0.15); }
body.emotion-neutral       { --accent-glow: rgba(124, 110, 230, 0.15); }
body.emotion-listening     { --accent-glow: rgba(160, 140, 255, 0.18); }
