/* ============================================================
   Ziviqa Live Room — Single-screen: Room + Chat
   ============================================================ */

:root {
  --z-pink: #ff2d8a;
  --z-pink-soft: #ff6eb4;
  --z-purple: #b44dff;
  --z-cyan: #00e5ff;
  --z-yellow: #ffe135;
  --z-black: #0a0a0f;
  --z-dark: #12101e;
  --z-card: rgba(22, 18, 38, 0.88);
  --z-glass: rgba(255, 255, 255, 0.04);
  --z-line: rgba(180, 77, 255, 0.18);
  --z-line-hi: rgba(180, 77, 255, 0.35);
  --z-text: #f0eef5;
  --z-muted: #9d98b3;
  --z-font: "Zen Maru Gothic", system-ui, sans-serif;
  --z-font-pixel: "DotGothic16", monospace;
  --z-font-accent: "Inter", system-ui, sans-serif;
  --radius: 20px;
  --radius-pill: 999px;
}

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

body.room-mode {
  font-family: var(--z-font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--z-text);
  background: var(--z-black);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

/* --- Ambient --- */
.grain {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 1;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg width='4' height='4' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='1' height='1' fill='%23fff' fill-opacity='0.12'/%3E%3C/svg%3E");
  background-size: 4px 4px;
}

.neon-orb {
  position: fixed; border-radius: 50%;
  filter: blur(120px); pointer-events: none; z-index: 0;
  animation: orbFloat 20s ease-in-out infinite alternate;
}
.neon-orb--pink {
  width: 380px; height: 380px;
  top: -10%; left: -5%;
  background: radial-gradient(circle, rgba(255,45,138,0.18), transparent 70%);
}
.neon-orb--purple {
  width: 440px; height: 440px;
  bottom: -10%; right: -8%;
  background: radial-gradient(circle, rgba(180,77,255,0.14), transparent 70%);
  animation-delay: -8s;
}

@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(20px, -15px) scale(1.06); }
}

/* --- Floating pixel particles --- */
.pixel-particle {
  position: fixed;
  pointer-events: none;
  z-index: 1;
  background: var(--z-pink);
  animation: pixelFloat linear infinite;
}
.pixel-particle--1 { width: 2px; height: 2px; top: 20%; left: 15%; background: var(--z-pink); animation-duration: 12s; animation-delay: 0s; }
.pixel-particle--2 { width: 3px; height: 3px; top: 60%; left: 80%; background: var(--z-cyan); animation-duration: 15s; animation-delay: -3s; }
.pixel-particle--3 { width: 2px; height: 2px; top: 40%; left: 45%; background: var(--z-purple); animation-duration: 18s; animation-delay: -6s; }
.pixel-particle--4 { width: 2px; height: 2px; top: 75%; left: 25%; background: var(--z-yellow); animation-duration: 14s; animation-delay: -2s; }
.pixel-particle--5 { width: 3px; height: 3px; top: 10%; left: 65%; background: var(--z-pink-soft); animation-duration: 16s; animation-delay: -8s; }
.pixel-particle--6 { width: 2px; height: 2px; top: 85%; left: 55%; background: var(--z-cyan); animation-duration: 13s; animation-delay: -4s; }

@keyframes pixelFloat {
  0% { opacity: 0; transform: translateY(0) translateX(0); }
  10% { opacity: 0.8; }
  50% { transform: translateY(-40vh) translateX(20px); }
  90% { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-80vh) translateX(-10px); }
}

/* --- Shell: fills viewport --- */
.shell {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  max-width: 1600px;
  margin: 0 auto;
  padding: 10px 14px;
  gap: 10px;
}

/* --- Topbar --- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: 6px 0;
}

.back-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--z-pink), var(--z-purple));
  color: #fff;
  font-family: var(--z-font-accent);
  font-size: 13px; font-weight: 700;
  text-decoration: none;
  box-shadow: 0 3px 14px rgba(255,45,138,0.25);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.back-pill::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.15) 50%, transparent 60%);
  background-size: 200% 200%;
  animation: shineSlide 3s ease-in-out infinite;
}
@keyframes shineSlide {
  0%, 100% { background-position: 200% 0; }
  50% { background-position: -200% 0; }
}
.back-pill:hover { transform: translateY(-1px); box-shadow: 0 5px 20px rgba(255,45,138,0.4); }

.topbar__center {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title {
  font-family: var(--z-font);
  font-size: 1.85rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--z-pink-soft) 0%, var(--z-pink) 25%, var(--z-purple) 50%, var(--z-cyan) 75%, var(--z-pink-soft) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: gradientShift 6s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(255,45,138,0.35)) drop-shadow(0 0 20px rgba(180,77,255,0.15));
}
.page-title:hover {
  animation: glitch 0.4s ease-in-out, gradientShift 6s ease-in-out infinite;
  filter: drop-shadow(0 0 14px rgba(255,45,138,0.5)) drop-shadow(0 0 30px rgba(180,77,255,0.25));
}

.topbar__live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--z-pink);
  box-shadow: 0 0 8px var(--z-pink), 0 0 16px rgba(255,45,138,0.3);
  animation: livePulse 1.5s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.mood-indicator {
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--z-line);
  background: rgba(255,45,138,0.06);
  color: var(--z-pink-soft);
  font-family: var(--z-font-pixel);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  transition: color 0.4s, border-color 0.4s, background 0.4s;
  position: relative;
}

/* --- Layout: room left, chat right, both fill height --- */
.layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 10px;
  flex: 1;
  min-height: 0; /* critical for flex child to shrink */
}

/* --- Stage (canvas) --- */
.stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.stage__frame {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--z-line);
  background: #0e0b1a;
}

/* CRT scanline overlay */
.stage__frame::before {
  content: "";
  position: absolute; inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
  mix-blend-mode: multiply;
}

/* Vignette overlay */
.stage__frame::after {
  content: "";
  position: absolute; inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(10,10,15,0.5) 100%);
}

#ziviqa-stage {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.stage__overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  justify-content: space-between;
  padding: 10px;
  pointer-events: none;
  z-index: 3;
}

/* HUD corner brackets */
.stage__hud-corner {
  position: absolute;
  width: 24px; height: 24px;
  z-index: 3;
  pointer-events: none;
}
.stage__hud-corner::before,
.stage__hud-corner::after {
  content: "";
  position: absolute;
  background: var(--z-cyan);
  opacity: 0.5;
  box-shadow: 0 0 6px var(--z-cyan);
}
.stage__hud-corner--tl { top: 8px; left: 8px; }
.stage__hud-corner--tl::before { width: 16px; height: 2px; top: 0; left: 0; }
.stage__hud-corner--tl::after { width: 2px; height: 16px; top: 0; left: 0; }
.stage__hud-corner--tr { top: 8px; right: 8px; }
.stage__hud-corner--tr::before { width: 16px; height: 2px; top: 0; right: 0; }
.stage__hud-corner--tr::after { width: 2px; height: 16px; top: 0; right: 0; }
.stage__hud-corner--bl { bottom: 8px; left: 8px; }
.stage__hud-corner--bl::before { width: 16px; height: 2px; bottom: 0; left: 0; }
.stage__hud-corner--bl::after { width: 2px; height: 16px; bottom: 0; left: 0; }
.stage__hud-corner--br { bottom: 8px; right: 8px; }
.stage__hud-corner--br::before { width: 16px; height: 2px; bottom: 0; right: 0; }
.stage__hud-corner--br::after { width: 2px; height: 16px; bottom: 0; right: 0; }

.pill {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(10,10,15,0.82);
  border: 1px solid var(--z-line-hi);
  color: var(--z-pink-soft);
  font-family: var(--z-font-pixel);
  font-size: 0.72rem;
  backdrop-filter: blur(6px);
  width: fit-content;
  text-shadow: 0 0 6px rgba(255,45,138,0.4);
}

.stage__caption {
  margin: 0; max-width: 400px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(10,10,15,0.82);
  border: 1px solid rgba(180,77,255,0.15);
  color: var(--z-muted);
  font-size: 0.78rem;
  line-height: 1.4;
  backdrop-filter: blur(6px);
  text-shadow: 0 0 4px rgba(180,77,255,0.15);
}

/* --- Chat panel --- */
.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: var(--radius);
  border: 1px solid var(--z-line);
  background: var(--z-card);
  backdrop-filter: blur(14px);
  overflow: hidden;
  position: relative;
}

/* Animated border glow on chat panel */
.chat-panel::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  padding: 1px;
  background: conic-gradient(from var(--chat-border-angle, 0deg), var(--z-pink), var(--z-purple), var(--z-cyan), var(--z-purple), var(--z-pink));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.3;
  z-index: 0;
  animation: rotateBorder 8s linear infinite;
  pointer-events: none;
}
@property --chat-border-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}
@keyframes rotateBorder {
  to { --chat-border-angle: 360deg; }
}

/* Portrait hero — large illustration at top of chat panel */
.portrait-hero {
  position: relative;
  flex-shrink: 0;
  height: 42%;
  min-height: 180px;
  overflow: hidden;
  border-bottom: 1px solid var(--z-line);
  background:
    radial-gradient(ellipse at center bottom, rgba(255,45,138,0.15), transparent 70%),
    radial-gradient(ellipse at top right, rgba(180,77,255,0.08), transparent 60%),
    rgba(22,18,38,0.5);
}

.portrait-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: opacity 0.4s, transform 0.4s;
}
.portrait-hero:hover img {
  transform: scale(1.02);
}

.portrait-hero__overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 14px 14px 10px;
  background: linear-gradient(to top, rgba(10,10,15,0.9) 0%, rgba(10,10,15,0.4) 60%, transparent 100%);
  display: flex; align-items: flex-end; gap: 8px;
}

.portrait-hero__name {
  font-family: var(--z-font);
  font-weight: 900;
  font-size: 1.2rem;
  background: linear-gradient(135deg, var(--z-pink-soft), var(--z-text));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 1px 6px rgba(0,0,0,0.6));
}

.portrait-hero__badge {
  font-family: var(--z-font-pixel);
  font-size: 0.7rem;
  color: var(--z-cyan);
  letter-spacing: 0.08em;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: rgba(0,229,255,0.1);
  border: 1px solid rgba(0,229,255,0.2);
  text-shadow: 0 0 4px rgba(0,229,255,0.4);
}

/* Portrait decorations */
.portrait-hero__scanlines {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.06) 3px,
    rgba(0,0,0,0.06) 4px
  );
}

.portrait-hero__neon-border {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border: 3px solid transparent;
  border-image: linear-gradient(135deg, var(--z-pink), var(--z-purple), var(--z-cyan), var(--z-pink)) 1;
  opacity: 0.5;
  animation: portraitBorderPulse 3s ease-in-out infinite;
}
@keyframes portraitBorderPulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.7; }
}

/* Chat log — compact, scrollable */
.chat-log {
  flex: 1;
  min-height: 0;
  max-height: 35vh;
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(180,77,255,0.2) transparent;
}

.chat-bubble {
  padding: 8px 12px;
  border-radius: 16px;
  border: 1px solid var(--z-line);
  background: var(--z-glass);
  animation: bubbleIn 0.25s ease-out;
  max-width: 92%;
  position: relative;
}

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-bubble--user {
  background: linear-gradient(135deg, rgba(0,229,255,0.08), rgba(0,229,255,0.03));
  border-color: rgba(0,229,255,0.15);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-bubble--assistant {
  background: linear-gradient(135deg, rgba(255,45,138,0.07), rgba(180,77,255,0.03));
  border-color: rgba(255,45,138,0.15);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-bubble--assistant::before {
  content: "◈";
  position: absolute;
  left: -16px; top: 6px;
  font-size: 10px;
  color: var(--z-pink);
  opacity: 0.5;
  text-shadow: 0 0 4px var(--z-pink);
}

.chat-bubble--typing {
  opacity: 0.5;
  animation: bubbleIn 0.25s ease-out, typingPulse 1.2s ease-in-out infinite;
}
@keyframes typingPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.7; }
}

.chat-speaker {
  margin: 0 0 3px;
  font-family: var(--z-font-pixel);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  color: var(--z-cyan);
  text-shadow: 0 0 4px rgba(0,229,255,0.3);
}
.chat-bubble--assistant .chat-speaker {
  color: var(--z-pink);
  text-shadow: 0 0 4px rgba(255,45,138,0.3);
}

.chat-text {
  margin: 0;
  line-height: 1.6;
  white-space: pre-wrap;
  font-size: 0.88rem;
}

/* ══════════════════════════════════════════
   Music Player — Cyberpop Neon Edition
   ══════════════════════════════════════════ */
.mplayer {
  position: relative;
  margin-top: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--z-line);
  background: rgba(8, 4, 16, 0.92);
  backdrop-filter: blur(14px);
  overflow: hidden;
  transition: border-color 0.6s;
}
.mplayer.is-playing {
  border-color: rgba(255, 45, 138, 0.35);
}

/* Visualizer canvas — lives behind content */
.mplayer__viz {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

/* Reactive glow that follows the beat */
.mplayer__glow {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(255,45,138,0.12), transparent 70%),
              radial-gradient(ellipse at 70% 50%, rgba(102,202,255,0.1), transparent 70%);
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.15s;
}
.mplayer.is-playing .mplayer__glow { opacity: 1; }

/* Content layer */
.mplayer__content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}

/* ── Spinning disc ── */
.mplayer__disc-wrap { flex-shrink: 0; }
.mplayer__disc {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--z-pink), var(--z-purple), var(--z-cyan), var(--z-purple), var(--z-pink));
  display: grid; place-items: center;
  transition: box-shadow 0.4s;
}
.mplayer.is-playing .mplayer__disc {
  animation: discSpin 3s linear infinite;
  box-shadow: 0 0 14px rgba(255,45,138,0.3), 0 0 28px rgba(180,77,255,0.15);
}
.mplayer__disc-inner {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(8,4,16,0.95);
  color: var(--z-pink);
  font-family: 'DotGothic16', monospace;
  font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
  letter-spacing: -0.5px;
}
@keyframes discSpin {
  to { transform: rotate(360deg); }
}

/* ── Center: title + seek ── */
.mplayer__center {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mplayer__track-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.mplayer__title {
  font-family: 'DotGothic16', monospace;
  font-size: 0.82rem;
  color: var(--z-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.03em;
  transition: color 0.4s, text-shadow 0.4s;
}
.mplayer.is-playing .mplayer__title {
  color: #fff;
  text-shadow: 0 0 10px rgba(255,45,138,0.35);
}
.mplayer__time {
  font-family: 'DotGothic16', monospace;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.3);
  flex-shrink: 0;
  letter-spacing: 0.04em;
}

/* ── Seek bar ── */
.mplayer__seek {
  position: relative;
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  cursor: pointer;
  overflow: visible;
}
.mplayer__seek:hover { background: rgba(255,255,255,0.1); }
.mplayer__seek-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--z-pink), var(--z-purple) 60%, var(--z-cyan));
  border-radius: 3px;
  pointer-events: none;
  box-shadow: 0 0 6px rgba(255,45,138,0.2);
}
.mplayer__seek-head {
  position: absolute;
  top: 50%; left: 0%;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--z-pink);
  border: 2px solid rgba(255,255,255,0.8);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px rgba(255,45,138,0.5);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 2;
}
.mplayer__seek:hover .mplayer__seek-head,
.mplayer.is-seeking .mplayer__seek-head { opacity: 1; }

/* ── Transport buttons ── */
.mplayer__controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.mplayer__btn {
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.2s;
  padding: 0;
}
.mplayer__btn:hover {
  color: #fff;
  transform: scale(1.15);
}
.mplayer__btn--play {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid var(--z-pink) !important;
  background: rgba(255,45,138,0.06);
  color: var(--z-pink);
  font-size: 15px;
}
.mplayer__btn--play:hover {
  background: rgba(255,45,138,0.18);
  box-shadow: 0 0 16px rgba(255,45,138,0.3);
  color: var(--z-pink);
}
.mplayer.is-playing .mplayer__btn--play {
  border-color: var(--z-cyan) !important;
  color: var(--z-cyan);
  background: rgba(102,202,255,0.08);
  animation: playPulse 2.5s ease-in-out infinite;
}
@keyframes playPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(102,202,255,0.12); }
  50% { box-shadow: 0 0 20px rgba(102,202,255,0.35); }
}
.mplayer__btn--skip {
  font-size: 16px;
  width: 28px; height: 28px;
}
.mplayer__btn--skip:hover { color: var(--z-cyan); }

/* ── Volume ── */
.mplayer__vol {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.mplayer__vol-btn {
  background: none; border: none;
  font-size: 15px;
  cursor: pointer;
  padding: 0;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.mplayer__vol-btn:hover { opacity: 0.9; }
.mplayer__vol-slider {
  width: 56px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.mplayer__vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--z-purple);
  border: 2px solid rgba(255,255,255,0.6);
  box-shadow: 0 0 6px rgba(180,77,255,0.4);
  cursor: pointer;
  transition: transform 0.15s;
}
.mplayer__vol-slider::-webkit-slider-thumb:hover { transform: scale(1.3); }
.mplayer__vol-slider::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--z-purple);
  border: 2px solid rgba(255,255,255,0.6);
  box-shadow: 0 0 6px rgba(180,77,255,0.4);
  cursor: pointer;
}

/* Quick replies */
.quick-replies {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 6px 12px;
  flex-shrink: 0;
}

.quick-reply {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--z-line);
  background: rgba(255,255,255,0.02);
  color: var(--z-muted);
  font-family: var(--z-font);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.quick-reply::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,45,138,0.12), rgba(180,77,255,0.08));
  opacity: 0;
  transition: opacity 0.2s;
}
.quick-reply:hover::before, .quick-reply:focus-visible::before { opacity: 1; }
.quick-reply:hover, .quick-reply:focus-visible {
  border-color: var(--z-pink);
  color: var(--z-pink-soft);
  box-shadow: 0 0 12px rgba(255,45,138,0.15), inset 0 0 12px rgba(255,45,138,0.05);
  transform: translateY(-1px);
  text-shadow: 0 0 6px rgba(255,45,138,0.3);
}

/* Chat input */
.chat-form {
  padding: 8px 10px;
  border-top: 1px solid var(--z-line);
  flex-shrink: 0;
}

.chat-input-row {
  display: flex; gap: 6px; align-items: flex-end;
}

#chat-input {
  flex: 1;
  min-height: 36px;
  max-height: 80px;
  resize: none;
  border-radius: 14px;
  border: 1px solid var(--z-line);
  background: rgba(10,10,15,0.5);
  color: var(--z-text);
  padding: 8px 12px;
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.5;
  transition: border-color 0.2s;
}
#chat-input::placeholder { color: var(--z-muted); opacity: 0.6; }
#chat-input:focus {
  outline: none;
  border-color: var(--z-pink);
  box-shadow: 0 0 0 2px rgba(255,45,138,0.1), 0 0 16px rgba(255,45,138,0.06);
  background: rgba(10,10,15,0.7);
}

.btn-send {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 14px;
  background: linear-gradient(135deg, var(--z-pink), var(--z-purple));
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255,45,138,0.25);
  transition: transform 0.16s, box-shadow 0.16s;
}
.btn-send:hover, .btn-send:focus-visible {
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 6px 22px rgba(255,45,138,0.35);
}

/* ========== ZIVIQA EFFECTS (from ziviqa.html) ========== */

/* --- Glitch animation --- */
@keyframes glitch {
  0%, 100% { text-shadow: none; transform: translate(0); }
  10% { text-shadow: -3px 0 var(--z-cyan), 3px 0 var(--z-pink); transform: translate(-2px, 1px); }
  20% { text-shadow: 3px 0 var(--z-cyan), -3px 0 var(--z-pink); transform: translate(2px, -1px); }
  30% { text-shadow: -2px 0 var(--z-pink), 2px 0 var(--z-cyan); transform: translate(-1px, 2px); }
  40% { text-shadow: 2px 0 var(--z-pink), -2px 0 var(--z-purple); transform: translate(1px, -1px); }
  50% { text-shadow: none; transform: translate(0); }
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.page-title--auto-glitch {
  animation: glitch 0.3s ease-in-out, gradientShift 6s ease-in-out infinite;
}

/* --- Sparkles --- */
.sparkle {
  position: fixed;
  pointer-events: none;
  z-index: 1;
  border-radius: 50%;
}
.sparkle--1 {
  top: 12%; right: 8%;
  width: 4px; height: 4px;
  background: var(--z-pink);
  box-shadow: 0 0 12px var(--z-pink);
  animation: twinkle 3s ease-in-out infinite;
}
.sparkle--2 {
  top: 55%; left: 5%;
  width: 3px; height: 3px;
  background: var(--z-cyan);
  box-shadow: 0 0 10px var(--z-cyan);
  animation: twinkle 4s ease-in-out infinite 1s;
}
.sparkle--3 {
  bottom: 20%; right: 12%;
  width: 3px; height: 3px;
  background: var(--z-purple);
  box-shadow: 0 0 10px var(--z-purple);
  animation: twinkle 3.5s ease-in-out infinite 0.5s;
}
.sparkle--4 {
  top: 30%; left: 50%;
  width: 2px; height: 2px;
  background: var(--z-yellow);
  box-shadow: 0 0 8px var(--z-yellow);
  animation: twinkle 5s ease-in-out infinite 2s;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.5); }
}

/* --- Mouse glow --- */
.z-mouse-glow {
  position: fixed;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,45,138,0.07) 0%, rgba(180,77,255,0.03) 40%, transparent 70%);
  pointer-events: none;
  z-index: 1;
  transform: translate(-50%, -50%);
  transition: left 0.15s ease-out, top 0.15s ease-out;
}

/* --- Neon divider (between stage and topbar) --- */
.neon-divider {
  height: 2px;
  background: linear-gradient(90deg, transparent 5%, var(--z-pink), var(--z-purple), var(--z-cyan), var(--z-pink), transparent 95%);
  background-size: 200% 100%;
  animation: dividerScroll 4s linear infinite;
  opacity: 0.5;
  position: relative;
  flex-shrink: 0;
}
@keyframes dividerScroll {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}
.neon-divider::after {
  content: "";
  position: absolute;
  inset: -5px 0;
  background: linear-gradient(90deg, transparent 5%, rgba(255,45,138,0.3), rgba(180,77,255,0.3), rgba(0,229,255,0.3), rgba(255,45,138,0.3), transparent 95%);
  background-size: 200% 100%;
  animation: dividerScroll 4s linear infinite;
  filter: blur(10px);
}

/* --- Portrait hero breathing glow --- */
.portrait-hero img {
  animation: avatarBreathe 3s ease-in-out infinite;
}
@keyframes avatarBreathe {
  0%, 100% { box-shadow: inset 0 -40px 60px rgba(255,45,138,0.1); filter: brightness(1); }
  50% { box-shadow: inset 0 -40px 80px rgba(255,45,138,0.2); filter: brightness(1.05); }
}

/* --- Stage frame neon border pulse --- */
.stage__frame {
  animation: framePulse 4s ease-in-out infinite;
}
@keyframes framePulse {
  0%, 100% { border-color: rgba(180,77,255,0.18); box-shadow: 0 0 10px rgba(180,77,255,0.05); }
  50% { border-color: rgba(180,77,255,0.35); box-shadow: 0 0 20px rgba(180,77,255,0.1); }
}

/* --- Chat panel glow border --- */
.chat-panel {
  animation: chatPanelGlow 5s ease-in-out infinite;
}
@keyframes chatPanelGlow {
  0%, 100% { border-color: rgba(180,77,255,0.18); box-shadow: 0 0 8px rgba(255,45,138,0.03); }
  50% { border-color: rgba(255,45,138,0.25); box-shadow: 0 0 16px rgba(255,45,138,0.06); }
}

/* --- Back pill hover glow upgrade --- */
.back-pill {
  animation: pillGlow 3s ease-in-out infinite;
}
@keyframes pillGlow {
  0%, 100% { box-shadow: 0 3px 14px rgba(255,45,138,0.25); }
  50% { box-shadow: 0 4px 20px rgba(255,45,138,0.4), 0 0 30px rgba(180,77,255,0.15); }
}

/* --- Mood indicator pulse --- */
.mood-indicator {
  animation: moodPulse 4s ease-in-out infinite;
}
@keyframes moodPulse {
  0%, 100% { border-color: rgba(180,77,255,0.18); }
  50% { border-color: rgba(255,45,138,0.35); box-shadow: 0 0 8px rgba(255,45,138,0.1); }
}

/* --- Send button glow --- */
.btn-send {
  animation: sendGlow 2s ease-in-out infinite;
}
@keyframes sendGlow {
  0%, 100% { box-shadow: 0 4px 16px rgba(255,45,138,0.25); }
  50% { box-shadow: 0 4px 24px rgba(255,45,138,0.4), 0 0 12px rgba(180,77,255,0.2); }
}

/* --- Utility --- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
  .shell { padding: 8px; }
}

@media (max-width: 600px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .stage__frame {
    max-height: 40vh;
  }
  .portrait-hero {
    height: 35%;
    min-height: 140px;
  }
  .chat-log {
    max-height: 25vh;
  }
  .topbar { flex-wrap: wrap; }
}
