/* ============================================================
   aichat.css — MoAI Chat Room Full Page Interface
   Empire Visual Studio | ai-chat.php
============================================================ */

@font-face {
  font-family: 'EVSFont';
  src: url('../font/evsfont.woff2') format('woff2'),
       url('../font/evsfont.woff') format('woff'),
       url('../font/evsfont.ttf') format('truetype');
  font-weight: normal; font-style: normal;
}

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

body {
  background: #000;
  color: #fff;
  font-family: 'Montserrat', 'EVSFont', Orbitron, sans-serif;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  user-select: none;
  -webkit-user-select: none;
}
a { text-decoration: none; color: inherit; }

/* ============================================================
   PRELOADER
============================================================ */
#ai-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 1s ease, visibility 1s ease;
}
#ai-loader.hide { opacity: 0; visibility: hidden; }

.ai-loader-text {
  font-family: 'EVSFont', Orbitron, sans-serif;
  font-size: 22px;
  letter-spacing: 8px;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 6px;
  background: linear-gradient(90deg, #888, #fff, #888);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: loaderShine 2s linear infinite;
}
@keyframes loaderShine {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}
.ai-loader-sub {
  font-size: 9px;
  letter-spacing: 5px;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 25px;
}
.ai-loader-bar-wrap {
  width: 160px;
  height: 2px;
  background: rgba(255,255,255,.06);
  border-radius: 2px;
  overflow: hidden;
}
.ai-loader-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(30,144,255,0), #1e90ff 30%, #00bfff 50%, #1e90ff 70%, rgba(30,144,255,0));
  box-shadow: 0 0 8px rgba(30,144,255,.8);
  transition: width .1s linear;
}

/* ============================================================
   HEADER / NAV
============================================================ */
#ai-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 54px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.ai-nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}
.ai-nav-logo-main {
  font-family: 'EVSFont', Orbitron, sans-serif;
  font-size: 16px;
  letter-spacing: 4px;
  font-weight: 700;
  background: linear-gradient(90deg, #aaa 0%, #fff 30%, #aaa 60%, #fff 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: loaderShine 3s linear infinite;
}
.ai-nav-logo-sep {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,.2);
}
.ai-nav-logo-sub {
  font-family: 'EVSFont', Orbitron, sans-serif;
  font-size: 9px;
  letter-spacing: 2px;
  color: #bbb;
  text-transform: uppercase;
}

/* Nav right group */
.ai-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ai-nav-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,.15);
}

/* Model Toggle — Llama / Gemini */
.ai-model-toggle {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 2px;
  gap: 2px;
}
.model-btn {
  background: transparent;
  border: none;
  color: #888;
  font-family: 'Montserrat', sans-serif;
  font-size: 8px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 16px;
  cursor: pointer;
  transition: background .25s, color .25s, box-shadow .25s;
  white-space: nowrap;
}
.model-btn:hover {
  color: #ccc;
}
.model-btn.active {
  background: rgba(30,144,255,.2);
  color: #1e90ff;
  box-shadow: 0 0 8px rgba(30,144,255,.3);
}

/* TTS Settings */
#tts-settings {
  position: relative;
  display: flex;
  align-items: center;
}
#tts-settings-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  color: #ccc;
  font-size: 11px;
  letter-spacing: 1px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
#tts-settings-btn:hover { background: rgba(30,144,255,.15); color: #fff; }
.tts-settings-label { font-family: 'Montserrat', sans-serif; text-transform: uppercase; font-size: 8px; letter-spacing: 2px; }
#tts-settings-panel {
  display: none;
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  background: rgba(4,6,14,.96);
  border: 1px solid rgba(30,144,255,.25);
  border-radius: 10px;
  padding: 12px 14px;
  min-width: 180px;
  z-index: 2000;
  backdrop-filter: blur(20px);
  box-shadow: 0 -4px 24px rgba(0,0,0,.6);
}
#tts-settings-panel.open { display: block; }
.tts-panel-title {
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #1e90ff;
  margin-bottom: 10px;
  font-family: 'EVSFont', Orbitron, sans-serif;
}
.tts-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .2s;
}
.tts-option:hover { background: rgba(255,255,255,.06); }
.tts-option input[type="radio"] { accent-color: #1e90ff; cursor: pointer; }
.tts-option-icon { color: #1e90ff; font-size: 11px; width: 14px; text-align: center; }
.tts-option-text { font-size: 11px; color: #ddd; font-family: 'Montserrat', sans-serif; }

/* Background selector */
.ai-bg-select {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-bg-select-label {
  font-size: 8px;
  letter-spacing: 2px;
  color: #ccc;
  text-transform: uppercase;
  margin-right: 6px;
}
.bg-thumb {
  width: 50px;
  height: 32px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,.15);
  transition: border-color .3s, transform .3s;
  position: relative;
}
.bg-thumb img,
.bg-thumb video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.bg-thumb.active {
  border-color: #fff;
  box-shadow: 0 0 8px rgba(255,255,255,.3);
}
.bg-thumb:hover:not(.active) {
  border-color: rgba(255,255,255,.5);
  transform: scale(1.08);
}

/* ============================================================
   LAYER SYSTEM
============================================================ */

/* Layer 0: Background */
#ai-bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  transition: opacity .5s ease;
}
#ai-bg-img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.04);
  transform-origin: center;
  will-change: transform;
}
#ai-bg-video {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  display: none;
}

/* Layer 1: Scanlines */
#ai-scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 4px,
    rgba(0,0,0,.18) 4px,
    rgba(0,0,0,.18) 5px
  );
  pointer-events: none;
}

/* Layer 2: MoAI Avatar */
#ai-avatar-layer {
  position: fixed;
  bottom: 0;
  right: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}
#moai-avatar {
  height: 112vh;
  max-height: 924px;
  width: auto;
  object-fit: contain;
  object-position: bottom;
  filter: drop-shadow(0 0 30px rgba(30,144,255,.15));
  transition: opacity .3s ease;
  display: block;
  background: transparent;
}

/* Dark gradient overlay at bottom */
#ai-bottom-fade {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 40vh;
  z-index: 3;
  background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,.7) 100%);
  pointer-events: none;
}

/* ============================================================
   LEFT SIDEBAR — slide-in panel, triggered by left 20% hover
============================================================ */
#ai-sidebar {
  position: fixed;
  top: 54px;
  left: -390px;          /* hidden off-screen by default */
  bottom: 0;
  width: 390px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: rgba(4,6,14,.92);
  border-right: 1px solid rgba(30,144,255,.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: left .4s cubic-bezier(.25,.46,.45,.94);
  box-shadow: 4px 0 30px rgba(0,0,0,.5);
  /* overflow:visible on the outer shell lets the tab peek out */
}
#ai-sidebar.open {
  left: 0;
}

/* Inner scroll container */
#sidebar-inner {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
#sidebar-inner::-webkit-scrollbar { width: 2px; }
#sidebar-inner::-webkit-scrollbar-track { background: transparent; }
#sidebar-inner::-webkit-scrollbar-thumb { background: rgba(30,144,255,.25); border-radius: 2px; }

/* === SIDEBAR TAB — peeks out from right edge when sidebar is closed === */
#ai-sidebar-tab {
  position: absolute;
  right: -46px;          /* sticks out 46px beyond the sidebar's right edge */
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  background: linear-gradient(180deg, #1565c0 0%, #1e90ff 100%);
  border-radius: 0 12px 12px 0;
  padding: 22px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 4px 0 18px rgba(30,144,255,.45);
  transition: opacity .35s ease, box-shadow .3s;
  z-index: 101;
}
#ai-sidebar.open #ai-sidebar-tab {
  opacity: 0;
  pointer-events: none;
}
#ai-sidebar-tab:hover {
  box-shadow: 4px 0 24px rgba(30,144,255,.8);
}

.tab-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: 'EVSFont', Orbitron, sans-serif;
  font-size: 8px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
  opacity: .9;
}
.tab-arrow {
  color: #fff;
  font-size: 16px;
  line-height: 1;
  display: block;
  animation: tabArrowPulse 1.5s ease-in-out infinite;
}
@keyframes tabArrowPulse {
  0%,100% { transform: translateX(0);   opacity: .5; }
  50%      { transform: translateX(5px); opacity: 1; }
}

.sidebar-section {
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.sidebar-label {
  font-family: 'EVSFont', Orbitron, sans-serif;
  font-size: 10px;
  letter-spacing: 3px;
  color: #1e90ff;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(30,144,255,.2);
}

/* Agent cards */
.agent-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.05);
  margin-bottom: 8px;
  transition: background .3s, border-color .3s;
  cursor: pointer;
}
.agent-card:last-child { margin-bottom: 0; }
.agent-card:hover {
  background: rgba(30,144,255,.08);
  border-color: rgba(30,144,255,.25);
}
.agent-photo {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid rgba(30,144,255,.3);
}
.agent-info {
  flex: 1;
  min-width: 0;
}
.agent-name {
  font-size: 13px;
  font-weight: 600;
  color: #eee;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.agent-role {
  font-size: 10px;
  color: #999;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.agent-wa {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #25d366;
  letter-spacing: .5px;
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(37,211,102,.08);
  border: 1px solid rgba(37,211,102,.2);
  transition: background .2s, border-color .2s;
}
.agent-wa:hover {
  background: rgba(37,211,102,.15);
  border-color: rgba(37,211,102,.4);
}
.status-wrapper {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.agent-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #555;
}
.agent-status.online {
  background: #25d366;
  box-shadow: 0 0 6px rgba(37,211,102,.6);
  animation: statusPulse 2.5s ease infinite;
}
.agent-status.offline {
  background: #ff3b3b;
  box-shadow: 0 0 6px rgba(255,59,59,.4);
}
.status-text {
  font-size: 9px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  opacity: 0.8;
}
.agent-status.online ~ .status-text {
  color: #25d366;
}
.agent-status.offline ~ .status-text {
  color: #ff3b3b;
}
@keyframes statusPulse {
  0%,100% { box-shadow: 0 0 4px rgba(37,211,102,.5); }
  50%      { box-shadow: 0 0 10px rgba(37,211,102,.9); }
}

/* YouTube embed */
#sidebar-yt {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255,255,255,.07);
  position: relative;
}
#sidebar-yt iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: none;
}
/* Transparent overlay blocks mouse events from reaching the YouTube player controls */
#sidebar-yt .yt-blocker {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: default;
}

/* EVS description */
.sidebar-evs-desc {
  font-size: 11px;
  line-height: 1.7;
  color: #aaa;
  letter-spacing: .3px;
}
.sidebar-evs-tagline {
  font-family: 'EVSFont', Orbitron, sans-serif;
  font-size: 9px;
  letter-spacing: 3px;
  color: #555;
  text-transform: uppercase;
  margin-top: 10px;
}

/* ============================================================
   CHAT CLOUD (AI Reply)
============================================================ */
#chat-cloud {
  position: fixed;
  bottom: 90px;
  left: 22%;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 58%;
  opacity: 0;
  transform: translateY(10px);
  transition: bottom .4s cubic-bezier(.25,.46,.45,.94), opacity .4s ease, transform .4s ease;
  pointer-events: none;
}
#chat-cloud.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#chat-cloud .cloud-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center center;
  border: 2px solid rgba(30,144,255,.5);
  flex-shrink: 0;
  display: block;
  margin-bottom: 4px;
}
#cloud-bubble {
  background: rgba(10,15,25,.92);
  border: 1px solid rgba(30,144,255,.3);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  padding: 14px 20px;
  font-size: 15px;
  line-height: 1.65;
  color: #e8e8e8;
  font-family: 'Montserrat', sans-serif;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 20px rgba(0,0,0,.5), 0 0 15px rgba(30,144,255,.1);
  max-width: 560px;
  word-wrap: break-word;
  overflow: visible;
  white-space: normal;
}
#cloud-name {
  font-size: 12px;
  color: #1e90ff;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 6px;
  font-family: 'EVSFont', Orbitron, sans-serif;
}

/* Typing dots */
.cloud-typing { display: inline-flex; gap: 4px; align-items: center; padding: 2px 0; }
.cloud-typing span {
  width: 6px; height: 6px;
  background: #1e90ff;
  border-radius: 50%;
  animation: cloudBounce 1.2s ease-in-out infinite;
}
.cloud-typing span:nth-child(2) { animation-delay: .2s; }
.cloud-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes cloudBounce {
  0%,80%,100% { transform: scale(.6); opacity: .4; }
  40%         { transform: scale(1); opacity: 1; }
}

/* ============================================================
   FIXED CHATBOX
============================================================ */
#ai-chatbox {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 50%;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(8,10,18,.9);
  border: 1px solid rgba(30,144,255,.25);
  border-radius: 40px;
  padding: 8px 16px 8px 12px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 4px 30px rgba(0,0,0,.6), 0 0 20px rgba(30,144,255,.08);
  transition: bottom .4s cubic-bezier(.25,.46,.45,.94), border-color .3s, box-shadow .3s;
}
#ai-chatbox:focus-within {
  border-color: rgba(30,144,255,.5);
  box-shadow: 0 4px 30px rgba(0,0,0,.6), 0 0 20px rgba(30,144,255,.2);
}

/* Voice toggle */
#voice-toggle {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  color: #888;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .3s, color .3s, border-color .3s;
}
#voice-toggle.voice-on {
  background: rgba(30,144,255,.15);
  border-color: rgba(30,144,255,.5);
  color: #1e90ff;
}
#voice-toggle:hover { border-color: rgba(255,255,255,.3); color: #ccc; }

/* Text input */
#ai-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: 13px;
  font-family: 'Montserrat', sans-serif;
  letter-spacing: .3px;
  padding: 6px 4px;
  caret-color: #1e90ff;
}
#ai-input::placeholder { color: rgba(255,255,255,.3); }
#ai-input:focus::placeholder { color: rgba(255,255,255,.15); }

/* Right controls */
.ai-chat-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
#mic-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  color: #888;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .3s, color .3s, border-color .3s, box-shadow .3s;
}
#mic-btn.listening {
  background: rgba(255,50,50,.15);
  border-color: rgba(255,80,80,.5);
  color: #ff5050;
  box-shadow: 0 0 12px rgba(255,50,50,.3);
  animation: micPulse 1s ease infinite;
}
@keyframes micPulse {
  0%,100% { box-shadow: 0 0 8px rgba(255,50,50,.3); }
  50%      { box-shadow: 0 0 18px rgba(255,50,50,.6); }
}
#mic-btn:hover:not(.listening) { border-color: rgba(255,255,255,.3); color: #ccc; }

/* TTS settings button inside chatbox (replaces use-voice-label) */
#tts-settings {
  position: relative;
  display: flex;
  align-items: center;
}
#tts-settings-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  color: #888;
  font-size: 9px;
  letter-spacing: 1px;
  padding: 4px 8px;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
  white-space: nowrap;
  text-transform: uppercase;
}
#tts-settings-btn:hover { background: rgba(30,144,255,.12); color: #fff; border-color: rgba(30,144,255,.3); }
.tts-settings-label { font-family: 'Montserrat', sans-serif; font-size: 9px; letter-spacing: 1px; }

.chatbox-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,.08);
  flex-shrink: 0;
}

/* Compact model toggle when inside the chatbox */
#ai-chatbox .ai-model-toggle {
  padding: 1px 2px;
}
#ai-chatbox .model-btn {
  padding: 3px 7px;
  font-size: 7.5px;
  letter-spacing: 1px;
}

/* Send button */
#ai-send {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #1e90ff;
  border: none;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .3s, transform .2s, box-shadow .3s;
}
#ai-send:hover { background: #0070e0; box-shadow: 0 0 12px rgba(30,144,255,.5); }
#ai-send:active { transform: scale(.93); }

/* Chat log icon */
#chat-log-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  color: #888;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .3s, color .3s, border-color .3s;
}
#chat-log-btn.log-open {
  background: rgba(30,144,255,.12);
  border-color: rgba(30,144,255,.4);
  color: #1e90ff;
}
#chat-log-btn:hover { border-color: rgba(255,255,255,.3); color: #ccc; }

/* Log open — chatbox and cloud shift up */
#ai-chatbox.log-showing { bottom: 250px; }
#chat-cloud.log-showing { bottom: 330px; }

/* ============================================================
   CONVERSATION LOG PANEL (bottom drawer)
============================================================ */
#conv-log {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 50%;
  height: 0;
  max-height: 240px;
  overflow: hidden;
  z-index: 19;
  background: rgba(6,8,16,.97);
  border: 1px solid rgba(30,144,255,.18);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  transition: height .4s cubic-bezier(.25,.46,.45,.94);
  box-shadow: 0 -4px 30px rgba(0,0,0,.6), 0 -2px 15px rgba(30,144,255,.08);
}
#conv-log.open { height: 240px; }

#conv-log-header {
  padding: 14px 20px;
  font-family: 'EVSFont', Orbitron, sans-serif;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #ddd;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
#conv-log-clear {
  font-size: 9px;
  color: #666;
  cursor: pointer;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: color .2s;
}
#conv-log-clear:hover { color: #ff5050; }

#conv-log-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#conv-log-messages::-webkit-scrollbar { width: 3px; }
#conv-log-messages::-webkit-scrollbar-track { background: transparent; }
#conv-log-messages::-webkit-scrollbar-thumb { background: rgba(30,144,255,.3); border-radius: 3px; }

.log-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  animation: logFadeIn .3s ease;
}
@keyframes logFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.log-msg.log-user { flex-direction: row-reverse; }

.log-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 2px;
}
.log-bubble {
  max-width: 75%;
  padding: 7px 11px;
  border-radius: 12px;
  font-size: 11px;
  line-height: 1.55;
  font-family: 'Montserrat', sans-serif;
  word-wrap: break-word;
}
.log-msg.log-bot .log-bubble {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.07);
  color: #ccc;
  border-bottom-left-radius: 3px;
}
.log-msg.log-user .log-bubble {
  background: linear-gradient(135deg, #1e90ff, #0066cc);
  color: #fff;
  border-bottom-right-radius: 3px;
}

/* === Visit Empire Visual AI button (under YouTube) === */
.sidebar-visit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 10px;
  padding: 9px 14px;
  background: rgba(30,144,255,.1);
  border: 1px solid rgba(30,144,255,.3);
  border-radius: 8px;
  font-size: 11px;
  color: #7fc4ff;
  text-decoration: none;
  letter-spacing: .5px;
  transition: background .2s, border-color .2s, color .2s;
}
.sidebar-visit-btn:hover {
  background: rgba(30,144,255,.2);
  border-color: rgba(30,144,255,.6);
  color: #fff;
}

/* ============================================================
   RETURN LINK — fixed at the bottom of the sidebar panel
============================================================ */
#sidebar-return {
  flex-shrink: 0;
  padding: 14px 16px 20px 20px;
  border-top: 1px solid rgba(255,255,255,.06);
  background: rgba(4,6,14,.97);
}
#ai-return-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .5px;
  color: #4da6ff;
  text-decoration: none;
  transition: color .2s, gap .2s;
}
#ai-return-link:hover { color: #90c8ff; gap: 10px; }
#ai-return-link i { font-size: 11px; }

/* ============================================================
   FULLSCREEN BUTTON
============================================================ */
#ai-fullscreen-btn {
  position: fixed;
  top: 68px;
  right: -60px;
  z-index: 1005;
  width: 25px; height: 25px;
  border-radius: 50%;
  background: #000;
  border: 1px solid #555;
  color: #888;
  font-size: 9px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  filter: blur(1px);
  transition: right .8s cubic-bezier(0.175,.885,.32,1.275), filter .3s, transform .3s, box-shadow .3s, color .3s;
}
#ai-fullscreen-btn.slide-in { right: 20px; filter: blur(0); }
#ai-fullscreen-btn:hover {
  box-shadow: 0 0 15px rgba(255,255,255,.4);
  color: #fff;
  transform: scale(1.2);
  filter: blur(0);
}

/* ============================================================
   MUSIC PLAYER OVERRIDE (from music.php)
   Force it to be always visible and above all layers
============================================================ */
#musicBox {
  z-index: 1001 !important;
  bottom: 0 !important;
  display: block !important;
}
#musicBox .musicbutton { display: flex !important; }
#musicBox .prevbutton,
#musicBox .nextbutton  { opacity: 1 !important; bottom: 0 !important; }

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 768px) {
  #ai-sidebar { display: none; }
  #ai-chatbox { width: calc(100% - 24px); left: 12px; transform: none; }
  #chat-cloud { left: 12px; max-width: calc(100% - 24px); }
  #conv-log { width: 100%; }
  #moai-avatar { height: 79vh; max-height: 528px; }
  #ai-avatar-layer { right: 0; }
  .tts-settings-label { display: none; }
}
