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

:root {
  --saffron: #e67e22;
  --gold: #d4a017;
  --cream: rgba(255,255,255,0.85);
  --white: #ffffff;
}

html, body { height: 100%; }

body {
  font-family: "Inter", sans-serif;
  color: var(--cream);
  overflow: hidden;
}

/* ─── Full-page background ─── */
.scene {
  position: fixed; inset: 0; z-index: 0;
  background: url("latest_bkg.png") center center / cover no-repeat;
}

/* Dark vignette overlay for text readability across the whole image */
.scene::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 30%, transparent 30%, rgba(0,0,0,0.15) 70%, rgba(0,0,0,0.35) 100%);
  pointer-events: none;
}

/* ─── Layout ─── */
#app {
  position: relative; z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ─── Header ─── */
header {
  padding: 0.5em 1em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.back-link {
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  font-size: 0.78em;
  padding: 0.3em 0.6em;
  border-radius: 6px;
  transition: all 0.2s;
}

.back-link:hover { color: var(--saffron); background: rgba(255,255,255,0.08); }

.header-center {
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.om-small {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.2em;
  color: var(--saffron);
  text-shadow: 0 0 12px rgba(230,126,34,0.4);
}

.header-center h1 {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.1em;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 0 8px rgba(0,0,0,0.5);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.6em;
}

.om-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255,255,255,0.4);
  transition: all 0.2s;
}

.om-toggle:hover {
  border-color: var(--saffron);
  color: var(--saffron);
  background: rgba(230,126,34,0.1);
}

.om-toggle.muted {
  color: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.08);
}

.om-icon.muted { display: none; }
.om-toggle.muted .om-icon.muted { display: block; }
.om-toggle.muted .om-icon:not(.muted) { display: none; }

.status {
  display: flex;
  align-items: center;
  gap: 0.3em;
  font-size: 0.65em;
  color: rgba(255,255,255,0.35);
}

.status-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #27ae60;
  box-shadow: 0 0 6px rgba(39,174,96,0.5);
}

/* ─── Main content ─── */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 1em 1.5em;
}

/* ─── Response text ─── */
.response-area {
  width: 100%;
  max-width: 520px;
  margin-bottom: auto;
  margin-top: 25vh;
  flex-shrink: 0;
  padding: 0.8em 1.2em;
  border-radius: 16px;
  background: rgba(0,0,0,0.15);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.04);
}

.response-text {
  text-align: center;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.1em;
  line-height: 1.7;
  color: rgba(255,255,255,0.92);
  min-height: 1.7em;
  transition: opacity 0.3s;
  text-shadow: 0 1px 8px rgba(0,0,0,0.5);
}

.response-text .greeting {
  font-style: italic;
  color: rgba(255,255,255,0.4);
  font-size: 0.9em;
}

.response-text p { margin: 0.3em 0; }
.response-text em { color: rgba(255,255,255,0.8); font-style: italic; }
.response-text strong { color: #fff; font-weight: 700; }
.response-text ul, .response-text ol { text-align: left; margin: 0.4em 0; padding-left: 1.5em; }
.response-text li { margin: 0.15em 0; line-height: 1.5; }
.response-text a { color: #f5b041; text-decoration: underline; text-underline-offset: 2px; }
.response-text blockquote {
  border-left: 2px solid rgba(255,255,255,0.2);
  padding-left: 1em;
  margin: 0.5em 0;
  color: rgba(255,255,255,0.55);
  font-style: italic;
}
.response-text code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85em;
  background: rgba(0,0,0,0.2);
  padding: 0.1em 0.4em;
  border-radius: 4px;
}

/* ─── Controls ─── */
.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5em;
  width: 100%;
  max-width: 360px;
  flex-shrink: 0;
  margin-top: 1.2em;
  padding: 0.8em 1em;
  border-radius: 20px;
  background: rgba(0,0,0,0.12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.04);
}

.mic-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.25);
  color: var(--cream);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s;
}

.mic-btn:hover { border-color: rgba(230,126,34,0.5); background: rgba(230,126,34,0.15); }

.mic-btn.listening {
  border-color: var(--saffron);
  background: rgba(230,126,34,0.2);
  animation: micPulse 1.5s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(230,126,34,0.3); }
  50% { box-shadow: 0 0 0 14px rgba(230,126,34,0); }
}

.mic-btn.processing { border-color: var(--gold); }

.mic-icon { width: 26px; height: 26px; }

.pulse-ring {
  position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--saffron); opacity: 0;
  pointer-events: none;
}

.mic-btn.listening .pulse-ring { animation: ringPulse 2s infinite; }

@keyframes ringPulse {
  0% { transform: scale(1); opacity: 0.3; }
  100% { transform: scale(1.3); opacity: 0; }
}

.mic-hint {
  font-size: 0.72em;
  color: rgba(255,255,255,0.35);
  font-style: italic;
  text-align: center;
}

.alt-input {
  display: flex;
  gap: 0.4em;
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 50px;
  padding: 0.15em;
}

.alt-input input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0.45em 1em;
  font-family: inherit;
  font-size: 0.82em;
  background: transparent;
  color: var(--cream);
}

.alt-input input::placeholder { color: rgba(255,255,255,0.25); }

.alt-input button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--saffron);
  color: var(--white);
  cursor: pointer;
  font-size: 0.9em;
  transition: background 0.2s;
}

.alt-input button:hover { background: #c96d12; }

/* ─── Voice Meter ─── */
.voice-meter {
  width: 160px;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s;
}

.voice-meter.active { opacity: 1; }

.meter-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--saffron), var(--gold));
  border-radius: 2px;
  transition: width 0.08s;
}

/* ─── Spinner ─── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--saffron);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Listening bars ─── */
.listening-indicator {
  display: flex;
  gap: 3px;
  align-items: center;
  justify-content: center;
  height: 24px;
}

.listening-indicator span {
  width: 3px;
  background: var(--saffron);
  border-radius: 2px;
  animation: barWave 0.5s ease-in-out infinite;
}

.listening-indicator span:nth-child(1) { height: 40%; animation-delay: 0s; }
.listening-indicator span:nth-child(2) { height: 70%; animation-delay: 0.1s; }
.listening-indicator span:nth-child(3) { height: 90%; animation-delay: 0.2s; }
.listening-indicator span:nth-child(4) { height: 60%; animation-delay: 0.3s; }
.listening-indicator span:nth-child(5) { height: 30%; animation-delay: 0.4s; }

@keyframes barWave {
  0%, 100% { transform: scaleY(0.6); }
  50% { transform: scaleY(1); }
}

/* ─── Side imagery panels ─── */
.side-panel {
  position: fixed;
  top: 0; bottom: 0;
  width: 20%;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2em;
  opacity: 0;
  transition: opacity 1s ease;
  pointer-events: none;
  z-index: 3;
  padding: 5em 0.5em;
}

#leftPanel { left: 0.5%; }
#rightPanel { right: 0.5%; }

.side-panel.visible { opacity: 1; }

.panel-item {
  position: relative;
  width: 100%;
  max-width: 220px;
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  animation: panelImgIn 0.8s ease forwards;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 32px rgba(0,0,0,0.35);
}

.panel-item:nth-child(2) { animation-delay: 0.2s; }

@keyframes panelImgIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.panel-img-wrap {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(0,0,0,0.2);
}

.panel-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.85) contrast(1.1) brightness(0.9);
  mix-blend-mode: screen;
  opacity: 0.7;
  transition: all 0.5s ease;
}

.panel-item:hover .panel-img-wrap img {
  filter: saturate(1) contrast(1) brightness(1);
  opacity: 1;
  transform: scale(1.05);
}

/* Ethereal glow ring behind each image */
.panel-item::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 16px;
  border: 1px solid rgba(230, 126, 34, 0.08);
  pointer-events: none;
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .side-panel { width: 16%; max-width: 160px; padding: 4em 0.3em; }
  .panel-item { max-width: 140px; }
}

@media (max-width: 600px) {
  .side-panel { display: none; }
  main { padding: 0 0.8em 1em; }
  .response-area { max-width: 100%; margin-top: 25vh; padding: 0.6em 1em; }
  .response-text { font-size: 0.95em; }
  .controls { padding: 0.6em 0.8em; }
}

@media (min-width: 1400px) {
  .side-panel { width: 22%; max-width: 320px; }
  .panel-item { max-width: 260px; }
  .response-area { max-width: 600px; }
}
