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

:root {
  --accent: #D4AF37;
  --gold: #D4AF37;
  --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(--accent); 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(--accent);
  text-shadow: 0 0 12px rgba(212,175,55,0.4);
}

.beta-badge {
  display: inline-block;
  font-size: 0.55em;
  font-weight: 600;
  padding: 0.15em 0.5em;
  border-radius: 50px;
  background: rgba(212, 175, 55, 0.2);
  color: #D4AF37;
  border: 1px solid rgba(212, 175, 55, 0.25);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.4;
  vertical-align: middle;
  margin-left: 0.25em;
}

.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;
}

/* ─── User chip (auth) ─── */
.user-chip {
  display: none; align-items: center; gap: 0.3rem;
  padding: 0.2em 0.6em; border-radius: 50px; font-size: 0.68rem;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(212,175,55,0.1);
  color: #D4AF37;
}
.user-chip.visible { display: inline-flex; }
.user-chip .logout-link {
  color: rgba(255,255,255,0.3); cursor: pointer; text-decoration: none; font-size: 0.7rem;
  margin-left: 0.2rem;
}
.user-chip .logout-link:hover { color: #E74C3C; }
.user-chip .chip-link {
  color: rgba(255,255,255,0.2); cursor: pointer; text-decoration: none; font-size: 0.65rem;
  margin-left: 0.15rem; line-height: 1;
}
.user-chip .chip-link:hover { color: #3498db; }

.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(--accent);
  color: var(--accent);
  background: rgba(212,175,55,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: #D4AF37; 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;
}

/* ─── Transfer card ─── */
.transfer-card {
  display: none;
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(142,68,173,0.08);
  border: 1px solid rgba(142,68,173,0.15);
  text-align: center;
}

.transfer-text {
  font-family: "Cormorant Garamond", serif;
  font-size: 0.9em;
  color: rgba(255,255,255,0.65);
  margin-bottom: 0.6rem;
  line-height: 1.5;
}

.transfer-btn {
  display: inline-block;
  padding: 0.5em 1.5em;
  border-radius: 50px;
  background: linear-gradient(135deg, #D4AF37, #D4AF37);
  color: #FFFFFF;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.82rem;
  transition: all 0.3s;
}

.transfer-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(212,175,55,0.3);
}

/* ─── 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(212,175,55,0.5); background: rgba(212,175,55,0.15); }

.mic-btn.listening {
  border-color: var(--accent);
  background: rgba(212,175,55,0.2);
  animation: micPulse 1.5s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212,175,55,0.3); }
  50% { box-shadow: 0 0 0 14px rgba(212,175,55,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(--accent); 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(--accent);
  color: var(--white);
  cursor: pointer;
  font-size: 0.9em;
  transition: background 0.2s;
}

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

/* ─── 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(--accent), 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(--accent);
  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(--accent);
  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(212, 175, 55, 0.08);
  pointer-events: none;
}

/* ─── Access Gate Overlay ─── */
.access-gate {
  position: fixed; inset: 0; z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 1.5rem;
}
.access-gate.visible { display: flex; }

.access-gate-inner {
  text-align: center;
  max-width: 400px;
  padding: 2rem;
  background: rgba(20,18,16,0.85);
  border: 1px solid rgba(212,175,55,0.12);
  border-radius: 24px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}

.gate-symbol {
  display: block;
  font-size: 3rem;
  font-family: "Cormorant Garamond", serif;
  color: var(--accent);
  margin-bottom: 0.75rem;
  text-shadow: 0 0 20px rgba(212,175,55,0.3);
}

.gate-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--cream);
  margin-bottom: 0.5rem;
}

.gate-desc {
  font-size: 0.82rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.5);
  margin-bottom: 1.2rem;
}

.gate-btn {
  display: inline-block;
  padding: 0.6em 1.8em;
  border-radius: 50px;
  border: none;
  background: linear-gradient(135deg, #D4AF37, #D4AF37);
  color: #FFFFFF;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: all 0.3s;
}
.gate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(212,175,55,0.3);
}

/* ─── Auth Modal ─── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,0.6); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: rgba(20,18,16,0.85); border: 1px solid rgba(212,175,55,0.12); border-radius: 20px;
  max-width: 400px; width: 100%; padding: 1.5rem; position: relative;
}
.modal-close { position: absolute; top: 0.75rem; right: 0.75rem; background: none; border: none; color: rgba(255,255,255,0.3); font-size: 1.4rem; cursor: pointer; font-family: inherit; }
.modal-tabs { display: flex; gap: 0; margin-bottom: 1rem; border-bottom: 1px solid rgba(212,175,55,0.12); }
.auth-tab {
  flex: 1; padding: 0.6em; text-align: center; border: none; background: none;
  color: rgba(255,255,255,0.5); font-size: 0.85rem; cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent;
}
.auth-tab.active { color: #D4AF37; border-bottom-color: #D4AF37; }
.modal-body { margin-bottom: 1rem; }
.form-group { margin-bottom: 0.75rem; }
.form-group label { display: block; font-size: 0.75rem; color: rgba(255,255,255,0.3); margin-bottom: 0.25rem; }
.form-group input {
  width: 100%; padding: 0.6em 0.8em; border-radius: 10px; border: 1px solid rgba(212,175,55,0.12);
  background: rgba(255,255,255,0.03); color: rgba(255,255,255,0.9); font-size: 0.85rem; font-family: inherit; outline: none;
}
.form-group input:focus { border-color: rgba(212,175,55,0.3); }
.form-error { color: #E74C3C; font-size: 0.75rem; margin-top: 0.3rem; min-height: 1em; }
.modal-submit {
  width: 100%; padding: 0.7em; border-radius: 12px; border: none; font-size: 0.85rem; font-weight: 600;
  background: linear-gradient(135deg, #D4AF37, #C9A330); color: #FFFFFF; cursor: pointer; font-family: inherit;
}
.modal-submit:disabled { opacity: 0.5; cursor: default; }
.form-footer { text-align: center; margin-top: 0.75rem; font-size: 0.75rem; color: rgba(255,255,255,0.3); }

/* ─── 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; }
  .gate-symbol { font-size: 2.5rem; }
  .access-gate-inner { padding: 1.5rem; }
}

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