:root {
  --ink: #f3e6cf;
  --ink-dim: rgba(243, 230, 207, 0.62);
  --gold: #d8b36a;
  --gold-soft: rgba(216, 179, 106, 0.35);
  --glow: #b58cff;
  --bg: #07030a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Cormorant Garamond', Georgia, serif;
  overflow: hidden;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 75% 70% at 50% 42%, transparent 55%, rgba(0, 0, 0, 0.75) 100%);
}

.title {
  position: fixed;
  top: clamp(12px, 3vh, 36px);
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  padding: 0 16px;
}
.title h1 {
  margin: 0;
  font-family: 'Cinzel Decorative', serif;
  font-weight: 900;
  font-size: clamp(28px, 5vw, 56px);
  letter-spacing: 0.08em;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(216, 179, 106, 0.45), 0 2px 0 rgba(0, 0, 0, 0.6);
}
.title p {
  margin: 4px 0 0;
  font-size: clamp(15px, 1.6vw, 19px);
  font-style: italic;
  color: var(--ink-dim);
}

.panel {
  position: fixed;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(620px, calc(100% - 32px));
  text-align: center;
}

.field { position: relative; }

#question {
  width: 100%;
  padding: 16px 22px;
  font: 600 clamp(17px, 2vw, 21px) 'Cormorant Garamond', Georgia, serif;
  color: var(--ink);
  background: rgba(20, 8, 28, 0.62);
  border: 1px solid var(--gold-soft);
  border-radius: 999px;
  outline: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-align: center;
  transition: border-color 0.3s, box-shadow 0.3s;
  box-shadow: inset 0 0 24px rgba(181, 140, 255, 0.08), 0 8px 30px rgba(0, 0, 0, 0.5);
}
#question::placeholder { color: rgba(243, 230, 207, 0.35); font-style: italic; font-weight: 400; }
#question:focus {
  border-color: var(--gold);
  box-shadow: inset 0 0 24px rgba(181, 140, 255, 0.14), 0 0 0 4px rgba(216, 179, 106, 0.12), 0 8px 30px rgba(0, 0, 0, 0.5);
}

.field-glow {
  position: absolute;
  inset: -2px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 0 28px 2px var(--glow);
  transition: opacity 0.5s;
}
body.thinking .field-glow { opacity: 0.55; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.15; } }

.status {
  min-height: 1.4em;
  margin: 12px 0 8px;
  font-size: 17px;
  font-style: italic;
  color: var(--ink-dim);
  transition: color 0.4s;
}
body.answered-yes .status { color: #9ff0c0; }
body.answered-no .status { color: #ff9aa6; }
body.error .status { color: #ffb86b; }

.examples { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.examples button {
  font: italic 15px 'Cormorant Garamond', Georgia, serif;
  color: var(--ink-dim);
  background: rgba(20, 8, 28, 0.45);
  border: 1px solid rgba(216, 179, 106, 0.2);
  border-radius: 999px;
  padding: 5px 14px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.examples button:hover, .examples button:focus-visible {
  color: var(--ink);
  border-color: var(--gold);
  background: rgba(40, 16, 52, 0.6);
  outline: none;
}

.credit {
  position: fixed;
  right: 16px;
  bottom: 10px;
  font-size: 13px;
  color: rgba(243, 230, 207, 0.35);
  letter-spacing: 0.04em;
}
.credit strong { color: rgba(216, 179, 106, 0.7); }

.loader {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: var(--bg);
  color: var(--ink-dim);
  font-style: italic;
  font-size: 18px;
  z-index: 10;
  transition: opacity 1.2s ease;
}
.loader.hidden { opacity: 0; pointer-events: none; }
.loader-orb {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 4%, #b58cff 25%, #3a1060 70%, transparent 72%);
  box-shadow: 0 0 40px rgba(181, 140, 255, 0.6);
  animation: pulse 1.6s ease-in-out infinite;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 600px) {
  .credit { left: 0; right: 0; text-align: center; bottom: 4px; font-size: 12px; }
  .panel { bottom: 26px; }
  .examples button { font-size: 14px; padding: 4px 11px; }
}

@media (prefers-reduced-motion: reduce) {
  body.thinking .field-glow, .loader-orb { animation: none; }
}

/* Language switcher */
.lang-switch {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  color: var(--ink-dim);
  background: rgba(20, 8, 28, 0.55);
  border: 1px solid rgba(216, 179, 106, 0.25);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 0.2s, color 0.2s;
}
.lang-switch:hover, .lang-switch:focus-within { border-color: var(--gold); color: var(--ink); }
.lang-switch select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  font: 600 14px 'Cormorant Garamond', Georgia, serif;
  padding: 2px 16px 2px 0;
  cursor: pointer;
  outline: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 7px) 55%, calc(100% - 3px) 55%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}
.lang-switch select option { color: #f3e6cf; background: #1a0b22; }

/* Daily quota counter */
.quota {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  letter-spacing: 0.03em;
  color: rgba(243, 230, 207, 0.5);
}
.quota[hidden] { display: none; }
.quota-bar {
  width: 64px;
  height: 3px;
  border-radius: 3px;
  background: rgba(216, 179, 106, 0.18);
  overflow: hidden;
}
.quota-bar span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #b58cff, var(--gold));
  transition: width 0.6s ease;
}
.quota.low { color: #ffb86b; }
.quota.empty { color: #ff9aa6; }

@media (max-width: 600px) {
  .lang-switch { top: 8px; right: 8px; }
  .title { padding-top: 30px; }
  .quota { margin-top: 6px; }
}

/* Fallback without JavaScript */
.noscript {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -40%);
  width: min(560px, calc(100% - 32px));
  padding: 24px 28px;
  text-align: center;
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  background: rgba(20, 8, 28, 0.7);
  border: 1px solid var(--gold-soft);
  border-radius: 18px;
}
.noscript h2 { margin: 0 0 8px; font-family: 'Cinzel Decorative', serif; color: var(--gold); font-size: 24px; }
.noscript p { margin: 8px 0; }
.noscript-note { color: #ffb86b; font-style: italic; }

/* ?capture: scene only (OG image / screenshots) */
body.capture .title, body.capture .panel, body.capture .credit, body.capture .lang-switch, body.capture .loader { display: none !important; }

/* Footer author links */
.credit { display: flex; align-items: center; gap: 12px; }
.author-links { display: inline-flex; gap: 10px; align-items: center; }
.author-links a {
  display: inline-flex;
  color: rgba(243, 230, 207, 0.4);
  transition: color 0.2s, transform 0.2s;
}
.author-links a:hover, .author-links a:focus-visible { color: var(--gold); transform: translateY(-1px); outline: none; }
@media (max-width: 600px) {
  .credit { justify-content: center; gap: 10px; }
  .author-links a svg { width: 14px; height: 14px; }
}
