/* ===== NEW UI STYLES ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px; /* Default expanded */
  height: 100vh;
  background: var(--sidebar-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--footer-border);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 0;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-x: hidden;
  white-space: nowrap;
}

.sidebar.collapsed {
  width: 60px;
}

@media (max-width: 768px) {
  .sidebar { width: 0; border-right: none; overflow: hidden; padding: 0; }
  .sidebar * { visibility: hidden; }
  .sidebar.expanded { width: 280px; overflow: visible; padding: 10px 0; border-right: 1px solid var(--footer-border); }
  .sidebar.expanded * { visibility: visible; }
  .header { left: 0 !important; padding-left: 10px !important; }
  .main-content { margin-left: 0 !important; padding-left: 0 !important; }
  .footer { left: 0 !important; }
}

.sidebar-top, .sidebar-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.sidebar-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  margin: 10px auto 20px 10px;
  align-self: flex-start;
}

.sidebar-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.new-chat-btn {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 10px 15px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  width: calc(100% - 20px);
  margin-bottom: 20px;
  gap: 12px;
}

.new-chat-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.sidebar.collapsed .new-chat-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  padding: 0;
  justify-content: center;
}

.sidebar.collapsed .sidebar-text {
  display: none;
}

.sidebar-original-icons {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 10px;
}

.sidebar.expanded .sidebar-original-icons {
  align-items: flex-start;
  padding-left: 10px;
}

.sidebar.expanded .sidebar-original-icons .sidebar-icon {
  width: calc(100% - 20px);
  margin: 0 10px;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px 15px;
}

#chat-history-list {
  width: 100%;
  padding: 0 10px 150px 10px !important;
  box-sizing: border-box;
  overflow-y: auto;
  max-height: calc(100vh - 160px);
  transition: opacity 0.2s, visibility 0.2s;
}

.sidebar.collapsed #chat-history-list {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Chat History Item */
.chat-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 2px;
  transition: background 0.2s;
  position: relative;
}

.chat-history-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.chat-history-item.active {
  background: rgba(51, 119, 255, 0.15);
  font-weight: 600;
  color: var(--text-main);
}

.chat-history-item .chat-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-options-trigger {
  opacity: 0;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
}

.chat-history-item:hover .chat-options-trigger {
  opacity: 1;
}

.chat-options-trigger:hover {
  background: rgba(255,255,255,0.1);
}

.chat-options-menu {
  position: absolute;
  background: #2a2a35;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  z-index: 10000;
  display: none;
  flex-direction: column;
  min-width: 180px;
  padding: 8px 0;
}

.chat-options-menu.active {
  display: flex;
}

.chat-options-menu button {
  background: none;
  border: none;
  color: #fff;
  text-align: left;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-options-menu button:hover {
  background: rgba(255,255,255,0.1);
}

.sidebar-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.sidebar-icon:hover {
  color: var(--text-main);
  background: rgba(0, 212, 255, 0.1);
}

.sidebar-icon.brand-icon {
  color: var(--accent-primary);
}

.sidebar-icon.active {
  background: rgba(51, 119, 255, 0.15);
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #3377ff;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
}

/* Header Updates */
.header {
  border-bottom: 1px solid var(--footer-border);
  background: var(--sidebar-bg); /* Use same variable as sidebar for consistency */
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

@media (min-width: 769px) {
  .header {
    left: 0;
    padding-left: calc(60px + var(--space-xl));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.expanded ~ .header {
    left: 0;
    padding-left: calc(280px + var(--space-xl));
  }
}

.header::after { display: none; }

.header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.mode-selector-new {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--glass-bg);
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--footer-border);
  position: relative;
}

.mode-label-new {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.mode-btn-new {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: bold;
  color: var(--text-main);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.mode-btn-new:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Mode color theming on the button */
.mode-selector-new[data-active-mode="basic"] .mode-btn-new {
  color: #4ade80;
}
.mode-selector-new[data-active-mode="basic"] {
  border-color: rgba(74, 222, 128, 0.3);
}
.mode-selector-new[data-active-mode="pro"] .mode-btn-new {
  color: #00d4ff;
}
.mode-selector-new[data-active-mode="pro"] {
  border-color: rgba(0, 212, 255, 0.3);
}
.mode-selector-new[data-active-mode="expert"] .mode-btn-new {
  color: #ff3366;
}
.mode-selector-new[data-active-mode="expert"] {
  border-color: rgba(255, 51, 102, 0.3);
}

/* Dropdown */
.mode-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 280px;
  background: rgba(10, 14, 23, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 8px;
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  animation: modeDropdownIn 0.2s ease-out;
}

@keyframes modeDropdownIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.mode-dropdown.active {
  display: block;
}

/* Option */
.mode-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.mode-option:hover:not(.locked) {
  background: rgba(255, 255, 255, 0.06);
}

.mode-option.active {
  background: rgba(255, 255, 255, 0.08);
}

.mode-option.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 2px;
}

.mode-option.active[data-mode="basic"]::before {
  background: #4ade80;
}
.mode-option.active[data-mode="pro"]::before {
  background: #00d4ff;
}
.mode-option.active[data-mode="expert"]::before {
  background: #ff3366;
}

.mode-opt-icon {
  font-size: 20px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.mode-opt-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.mode-opt-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}

.mode-opt-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 400;
}

/* Locked state */
.mode-option.locked {
  opacity: 0.5;
  cursor: pointer;
}

.mode-option.locked:hover {
  opacity: 0.7;
  background: rgba(255, 255, 255, 0.03);
}

.mode-option.locked .mode-opt-name {
  color: rgba(255, 255, 255, 0.6);
}

.mode-lock {
  font-size: 14px;
  flex-shrink: 0;
  margin-left: auto;
}

.settings-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: var(--glass-bg);
  border: 1px solid var(--footer-border);
  transition: all 0.3s ease;
  cursor: pointer;
}

.settings-btn:hover {
  color: var(--text-main);
  background: rgba(0, 212, 255, 0.1);
}

/* Footer Updates */
.footer {
  left: 60px;
  background: var(--footer-bg);
  border-top: 1px solid var(--footer-border);
}
.footer::before { display: none; }

.footer-left, .footer-center, .footer-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-badge-new {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  padding: 6px 16px;
  border-radius: 20px;
  background: var(--glass-bg);
  border: 1px solid var(--footer-border);
  box-shadow: none;
}

body.theme-light .footer-badge-new {
  background: var(--glass-bg);
  color: var(--text-main);
}

.lock-badge {
  background: var(--glass-bg);
}

body.theme-light .lock-badge {
  background: var(--glass-bg);
}

.footer-star {
  color: #3377ff;
  margin-left: 16px;
}

/* Input Updates */
.input-area-new {
  position: relative;
  z-index: 20;
  width: 100%;
  max-width: 660px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.input-row {
  display: flex;
  align-items: flex-end;
  position: relative;
  width: 100%;
}

/* Upload Button */
.upload-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(51, 119, 255, 0.3);
  color: var(--text-secondary, #888);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-right: 8px;
  margin-bottom: 9px;
}
.upload-btn:hover {
  background: rgba(51, 119, 255, 0.1);
  border-color: #3377ff;
  color: #3377ff;
  transform: scale(1.08);
}

/* Image Preview Strip */
.image-preview-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 4px;
  margin-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(51,119,255,0.3) transparent;
}
.image-preview-strip::-webkit-scrollbar { height: 4px; }
.image-preview-strip::-webkit-scrollbar-thumb { background: rgba(51,119,255,0.3); border-radius: 4px; }

.image-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid rgba(51, 119, 255, 0.3);
  transition: border-color 0.2s;
}
.image-thumb:hover { border-color: #3377ff; }
.image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  font-size: 13px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity 0.2s;
}
.image-thumb:hover .image-thumb-remove { opacity: 1; }

/* Drag-over state */
.input-area-new.drag-over {
  outline: 2px dashed #3377ff;
  outline-offset: 4px;
  border-radius: 16px;
}

/* VLM Select */
.vlm-select {
  margin-right: 8px;
}

.input-field-new {
  width: 100%;
  padding: 16px 60px 16px 24px;
  border-radius: 30px;
  font-size: 16px;
  color: #ffffff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.8); /* Nét mảnh trắng Dark mode */
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.05), 0 0 15px rgba(255, 255, 255, 0.1);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  outline: none;
  resize: none;
  overflow-y: hidden;
  line-height: 24px;
  min-height: 58px;
  max-height: 200px;
  box-sizing: border-box;
}

body.theme-light .input-field-new {
  color: #1a1a1a;
  /* Vàng ngôi sao Việt Nam 🇻🇳 */
  background: #FFCD00;
  border: 1px solid rgba(255, 205, 0, 0.7);
  box-shadow: 0 4px 20px rgba(255, 205, 0, 0.2);
}

.input-field-new:focus {
  border-color: #ffffff;
  box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.1), 0 0 24px rgba(255, 255, 255, 0.2);
}

body.theme-light .input-field-new:focus {
  border-color: rgba(255, 205, 0, 0.9);
  box-shadow: 0 4px 28px rgba(255, 205, 0, 0.35);
}

.submit-btn {
  position: absolute;
  right: 12px;
  bottom: 9px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #3377ff;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  padding: 0 !important;
  margin: 0 !important;
}

.submit-btn:hover {
  background: #3377ff;
  filter: brightness(0.85);
  transform: none !important;
}

.input-hint-new {
  text-align: center;
  font-size: 12px;
  color: var(--hint-color);
  margin-top: 12px;
}

.input-hint__key {
  display: inline-block;
  background: #3377ff;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(51, 119, 255, 0.35);
  vertical-align: middle;
  margin: 0 2px;
}

.portal-star-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 40px;
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.8));
}

body.theme-light .portal-star-container {
  color: #3377ff;
  filter: drop-shadow(0 0 20px rgba(51, 119, 255, 0.4));
}

body:not(.theme-light) .portal-star-container {
  color: white;
}

.main-stage {
  padding-left: 60px;
}

/* Theme Toggle Switch */
/* ═══════════════════════════════════════════════════════════
   ARTISTIC CELESTIAL THEME TOGGLE — Moon ↔ Sun
   ═══════════════════════════════════════════════════════════ */
.theme-toggle-art {
  display: flex;
  align-items: center;
  margin-right: 16px;
}

.theme-toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-toggle-label {
  cursor: pointer;
  display: block;
}

/* --- Track: Night sky → Day sky --- */
.theme-toggle-track {
  position: relative;
  width: 62px;
  height: 30px;
  border-radius: 30px;
  background-color: #0a0a12; /* Match dark mode bg */
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 0 12px rgba(0, 0, 0, 0.5),
    inset 0 1px 6px rgba(0, 0, 0, 0.4);
  transition: background-color 0.6s ease, border-color 0.6s ease, box-shadow 0.6s ease;
  overflow: hidden;
}

/* --- Stars: visible in dark mode --- */
.toggle-star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  opacity: 1;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.star-1 {
  width: 3px; height: 3px;
  top: 7px; left: 38px;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
  animation: twinkle 2s ease-in-out infinite;
}

.star-2 {
  width: 2px; height: 2px;
  top: 17px; left: 44px;
  box-shadow: 0 0 3px rgba(255, 255, 255, 0.6);
  animation: twinkle 2.5s ease-in-out infinite 0.5s;
}

.star-3 {
  width: 2.5px; height: 2.5px;
  top: 10px; left: 50px;
  box-shadow: 0 0 3px rgba(255, 255, 255, 0.7);
  animation: twinkle 3s ease-in-out infinite 1s;
}

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

/* --- Sun Rays: hidden in dark, visible in light --- */
.toggle-ray {
  position: absolute;
  background: #ef4444;
  border-radius: 2px;
  opacity: 0;
  transform: scale(0);
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ray-1 {
  width: 8px; height: 2px;
  top: 14px; right: 4px;
}

.ray-2 {
  width: 2px; height: 8px;
  top: 3px; right: 12px;
}

.ray-3 {
  width: 6px; height: 2px;
  top: 8px; right: 3px;
  transform-origin: center;
}

.ray-4 {
  width: 2px; height: 6px;
  top: 18px; right: 8px;
}

/* --- Celestial Body: Moon (default) --- */
.toggle-celestial {
  position: absolute;
  width: 22px;
  height: 22px;
  top: 3px;
  left: 4px;
  border-radius: 50%;
  background-color: #ef4444; /* Solid color for smooth transition */
  box-shadow: none;
  transition: all 0.6s cubic-bezier(0.68, -0.15, 0.27, 1.15);
  z-index: 2;
}

/* --- Moon Craters --- */
.crater {
  position: absolute;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.crater-1 {
  width: 6px; height: 6px;
  top: 4px; left: 3px;
}

.crater-2 {
  width: 4px; height: 4px;
  top: 12px; left: 10px;
}

/* ═══ CHECKED STATE: Light Mode (Sun) ═══ */

/* Track becomes sky */
.theme-toggle-input:checked + .theme-toggle-label .theme-toggle-track {
  background-color: #ffffff; /* Solid color */
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow:
    0 0 16px rgba(0, 0, 0, 0.05),
    inset 0 1px 5px rgba(0, 0, 0, 0.05);
}

/* Celestial moves right and becomes sun */
.theme-toggle-input:checked + .theme-toggle-label .toggle-celestial {
  left: 34px;
  background-color: #ef4444; /* Solid color */
  box-shadow: none;
  transform: rotate(180deg);
}

/* Craters fade out (sun has no craters) */
.theme-toggle-input:checked + .theme-toggle-label .crater {
  opacity: 0;
  transform: scale(0);
}

/* Stars fade out */
.theme-toggle-input:checked + .theme-toggle-label .toggle-star {
  opacity: 0;
  transform: scale(0);
}

/* Sun rays appear */
.theme-toggle-input:checked + .theme-toggle-label .toggle-ray {
  opacity: 0;
  transform: scale(0);
}

.theme-toggle-input:checked + .theme-toggle-label .ray-1 {
  animation: ray-pulse 2s ease-in-out infinite;
}

.theme-toggle-input:checked + .theme-toggle-label .ray-2 {
  animation: ray-pulse 2s ease-in-out infinite 0.3s;
}

.theme-toggle-input:checked + .theme-toggle-label .ray-3 {
  animation: ray-pulse 2s ease-in-out infinite 0.6s;
}

.theme-toggle-input:checked + .theme-toggle-label .ray-4 {
  animation: ray-pulse 2s ease-in-out infinite 0.9s;
}

@keyframes ray-pulse {
  0%, 100% { opacity: 0.6; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* --- Hover effect --- */
.theme-toggle-label:hover .theme-toggle-track {
  box-shadow:
    0 0 20px rgba(99, 102, 241, 0.25),
    inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.theme-toggle-input:checked + .theme-toggle-label:hover .theme-toggle-track {
  box-shadow:
    0 0 20px rgba(56, 189, 248, 0.3),
    inset 0 1px 3px rgba(255, 255, 255, 0.3);
}

.theme-toggle-label:hover .toggle-celestial {
  transform: scale(1.08);
}

.theme-toggle-input:checked + .theme-toggle-label:hover .toggle-celestial {
  transform: rotate(180deg) scale(1.08);
}

/* ═══════════════════════════════════════════════════════════
   Orbital Atom Design
   ═══════════════════════════════════════════════════════════ */
.portal-flare {
  position: relative;
  width: 340px;
  height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -30px;
  margin-bottom: 40px;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.neural-canvas, .grid-overlay {
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

body.theme-light .portal-flare,
body.theme-light .neural-canvas,
body.theme-light .grid-overlay {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* Central bright core */
.flare-core {
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow:
    0 0 10px 5px rgba(255, 255, 255, 1),
    0 0 30px 14px rgba(51, 119, 255, 1),
    0 0 60px 30px rgba(51, 119, 255, 0.5);
  z-index: 5;
  animation: core-pulse 3s ease-in-out infinite;
}

@keyframes core-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 10px 5px rgba(255,255,255,1), 0 0 30px 14px rgba(51,119,255,1), 0 0 60px 30px rgba(51,119,255,0.5); }
  50%      { transform: scale(1.2); box-shadow: 0 0 14px 7px rgba(255,255,255,1), 0 0 40px 18px rgba(51,119,255,1), 0 0 80px 40px rgba(51,119,255,0.6); }
}

/* Elliptical orbit rings */
.orbit {
  position: absolute;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  top: 50%;
  left: 50%;
}

.orbit-1 {
  width: 310px;
  height: 115px;
  margin-left: -155px;
  margin-top: -57px;
  transform: rotate(-25deg);
  border-color: rgba(200, 220, 255, 0.5);
  box-shadow:
    0 0 10px rgba(51, 119, 255, 0.5),
    0 0 25px rgba(51, 119, 255, 0.25),
    inset 0 0 10px rgba(51, 119, 255, 0.2);
}

.orbit-2 {
  width: 290px;
  height: 125px;
  margin-left: -145px;
  margin-top: -62px;
  transform: rotate(25deg);
  border-color: rgba(200, 220, 255, 0.5);
  box-shadow:
    0 0 10px rgba(51, 119, 255, 0.5),
    0 0 25px rgba(51, 119, 255, 0.25),
    inset 0 0 10px rgba(51, 119, 255, 0.2);
}
/* Starfield — dense galaxy dust */
.starfield {
  position: absolute;
  inset: -80px -100px;
  z-index: 0;
  background-image:
    /* Milky Way glow band — diagonal nebula */
    radial-gradient(ellipse 180px 50px at 50% 50%, rgba(51,119,255,0.06) 0%, transparent 100%),
    /* Stardust layer 1 */
    radial-gradient(1px 1px at 6% 18%, #fff 50%, transparent 100%),
    radial-gradient(1.2px 1.2px at 12% 42%, rgba(200,220,255,0.9) 50%, transparent 100%),
    radial-gradient(0.8px 0.8px at 18% 72%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 24% 28%, rgba(180,200,255,0.7) 50%, transparent 100%),
    radial-gradient(1.3px 1.3px at 30% 58%, #fff 50%, transparent 100%),
    radial-gradient(0.8px 0.8px at 36% 85%, rgba(200,220,255,0.6) 50%, transparent 100%),
    radial-gradient(1px 1px at 42% 12%, #fff 50%, transparent 100%),
    radial-gradient(1.2px 1.2px at 48% 38%, rgba(180,210,255,0.8) 50%, transparent 100%),
    radial-gradient(0.8px 0.8px at 54% 68%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 60% 22%, rgba(200,220,255,0.7) 50%, transparent 100%),
    radial-gradient(1.3px 1.3px at 66% 52%, #fff 50%, transparent 100%),
    radial-gradient(0.8px 0.8px at 72% 78%, rgba(180,200,255,0.6) 50%, transparent 100%),
    radial-gradient(1px 1px at 78% 32%, #fff 50%, transparent 100%),
    radial-gradient(1.2px 1.2px at 84% 62%, rgba(200,220,255,0.8) 50%, transparent 100%),
    radial-gradient(0.8px 0.8px at 90% 15%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 96% 48%, rgba(180,210,255,0.7) 50%, transparent 100%),
    /* Extra dust */
    radial-gradient(0.6px 0.6px at 9% 55%, rgba(255,255,255,0.4) 50%, transparent 100%),
    radial-gradient(0.6px 0.6px at 21% 35%, rgba(255,255,255,0.35) 50%, transparent 100%),
    radial-gradient(0.6px 0.6px at 33% 48%, rgba(255,255,255,0.4) 50%, transparent 100%),
    radial-gradient(0.6px 0.6px at 45% 82%, rgba(255,255,255,0.3) 50%, transparent 100%),
    radial-gradient(0.6px 0.6px at 57% 25%, rgba(255,255,255,0.35) 50%, transparent 100%),
    radial-gradient(0.6px 0.6px at 69% 65%, rgba(255,255,255,0.4) 50%, transparent 100%),
    radial-gradient(0.6px 0.6px at 81% 45%, rgba(255,255,255,0.3) 50%, transparent 100%),
    radial-gradient(0.6px 0.6px at 93% 75%, rgba(255,255,255,0.35) 50%, transparent 100%);
  animation: starfield-twinkle 5s ease-in-out infinite alternate;
}

@keyframes starfield-twinkle {
  0%   { opacity: 0.55; }
  100% { opacity: 1; }
}

/* Light rays from central core */
.core-ray {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80px;
  height: 1.5px;
  background: linear-gradient(90deg, rgba(255,255,255,0.8), rgba(51,119,255,0.3), transparent);
  transform-origin: 0 50%;
  z-index: 4;
  opacity: 0.6;
}

.ray-1 { transform: rotate(0deg); }
.ray-2 { transform: rotate(60deg); }
.ray-3 { transform: rotate(120deg); }
.ray-4 { transform: rotate(180deg); }
.ray-5 { transform: rotate(240deg); }
.ray-6 { transform: rotate(300deg); }

/* Galaxy band stars — positioned along elliptical orbits */
/* Galaxy band stars — positioned exactly on the ellipse border */
.galaxy-star {
  position: absolute;
  background: #ffffff;
  border-radius: 50%;
  z-index: 4;
  /* Use JS to add animation or define here with combined transform */
  animation: star-glow-ellipse 3s ease-in-out infinite alternate;
}

/* 10 points evenly around the ellipse (36 degrees apart) */
/* Formula: left = 50 + 50*cos(t), top = 50 + 50*sin(t) */

/* ── Background Scattered Stars (Outer Space) ── */
/* Placed far outside the main portal bounds */
.bg-1  { left: -25%; top: -15%;  width: 5px; height: 5px; box-shadow: 0 0 7px 3px rgba(255,255,255,0.9); animation-delay: 0s; }
.bg-2  { left: -35%; top: 35%;   width: 4px; height: 4px; box-shadow: 0 0 5px 2px rgba(200,220,255,0.7); animation-delay: 1.2s; }
.bg-3  { left: -20%; top: 95%;   width: 6px; height: 6px; box-shadow: 0 0 8px 3px rgba(255,255,255,1), 0 0 14px 5px rgba(100,160,255,0.4); animation-delay: 0.5s; }
.bg-4  { left: 15%;  top: 125%;  width: 3px; height: 3px; box-shadow: 0 0 4px 1px rgba(180,210,255,0.6); animation-delay: 1.8s; }
.bg-5  { left: 50%;  top: -25%;  width: 5px; height: 5px; box-shadow: 0 0 7px 3px rgba(255,255,255,0.9); animation-delay: 0.8s; }
.bg-6  { right: -20%; top: -10%; width: 4px; height: 4px; box-shadow: 0 0 5px 2px rgba(200,220,255,0.8); animation-delay: 0.3s; }
.bg-7  { right: -35%; top: 40%;  width: 6px; height: 6px; box-shadow: 0 0 8px 3px rgba(255,255,255,1), 0 0 14px 5px rgba(100,160,255,0.4); animation-delay: 1.5s; }
.bg-8  { right: -25%; top: 85%;  width: 5px; height: 5px; box-shadow: 0 0 7px 3px rgba(255,255,255,0.9); animation-delay: 0.9s; }
.bg-9  { right: 10%;  top: 130%; width: 4px; height: 4px; box-shadow: 0 0 5px 2px rgba(180,210,255,0.7); animation-delay: 0.1s; }
.bg-10 { right: 40%;  top: -30%; width: 3px; height: 3px; box-shadow: 0 0 4px 1px rgba(200,220,255,0.6); animation-delay: 1.6s; }

/* ── Orbit-1 stars (5 stars evenly around ellipse) ── */
.gs-1  { left: 100%;   top: 50%;     width: 5px; height: 5px; box-shadow: 0 0 7px 3px rgba(255,255,255,0.9); animation-delay: 0s; }
.gs-2  { left: 65.45%; top: 97.55%;  width: 4px; height: 4px; box-shadow: 0 0 5px 2px rgba(200,220,255,0.7); animation-delay: 1.0s; }
.gs-3  { left: 9.55%;  top: 79.39%;  width: 6px; height: 6px; box-shadow: 0 0 8px 3px rgba(255,255,255,1), 0 0 14px 5px rgba(100,160,255,0.4); animation-delay: 0.4s; }
.gs-4  { left: 9.55%;  top: 20.61%;  width: 5px; height: 5px; box-shadow: 0 0 7px 3px rgba(255,255,255,0.9); animation-delay: 1.4s; }
.gs-5  { left: 65.45%; top: 2.45%;   width: 4px; height: 4px; box-shadow: 0 0 5px 2px rgba(255,255,255,0.8); animation-delay: 0.8s; }

/* ── Orbit-2 stars (5 stars evenly around ellipse) ── */
.gs-11 { left: 0%;     top: 50%;     width: 5px; height: 5px; box-shadow: 0 0 7px 3px rgba(255,255,255,0.9); animation-delay: 0.2s; }
.gs-12 { left: 34.55%; top: 97.55%;  width: 6px; height: 6px; box-shadow: 0 0 8px 3px rgba(255,255,255,1), 0 0 14px 5px rgba(100,160,255,0.4); animation-delay: 1.2s; }
.gs-13 { left: 90.45%; top: 79.39%;  width: 4px; height: 4px; box-shadow: 0 0 5px 2px rgba(200,220,255,0.7); animation-delay: 0.6s; }
.gs-14 { left: 90.45%; top: 20.61%;  width: 5px; height: 5px; box-shadow: 0 0 7px 3px rgba(255,255,255,0.9); animation-delay: 1.6s; }
.gs-15 { left: 34.55%; top: 2.45%;   width: 4px; height: 4px; box-shadow: 0 0 5px 2px rgba(180,210,255,0.6); animation-delay: 0.9s; }

@keyframes star-glow-ellipse {
  0%   { opacity: 0.4; transform: translate(-50%, -50%) scale(0.8); }
  100% { opacity: 1;   transform: translate(-50%, -50%) scale(1.2); }
}

body.theme-light .orbit,
body.theme-light .galaxy-star,
body.theme-light .core-ray,
body.theme-light .starfield {
  display: none;
}

body.theme-light .flare-core {
  box-shadow:
    0 0 6px 3px rgba(255, 255, 255, 1),
    0 0 20px 8px rgba(50, 150, 255, 0.7),
    0 0 40px 20px rgba(50, 100, 255, 0.4);
}

/* Model Select Dropdown */
.model-select-dropdown {
  background: var(--glass-bg);
  border: 1px solid var(--footer-border);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  margin-right: 16px;
  backdrop-filter: blur(10px);
}
.model-select-dropdown option {
  background: var(--bg-primary);
  color: var(--text-main);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Header Shrinking in Chat Mode (opacity removed to keep buttons clear) */
body.chat-active .header {
  padding-top: 4px;
  padding-bottom: 4px;
  transform: translateY(-5px);
}
body.chat-active .header:hover {
  padding-top: 20px;
  transform: none;
}


/* Hide Enter hint during chat */
body.chat-active .input-hint-new {
  opacity: 0;
  pointer-events: none;
  height: 0;
  margin: 0;
  overflow: hidden;
}
.input-hint-new {
  transition: opacity 0.3s ease, height 0.3s ease, margin 0.3s ease;
}


body.chat-active .footer {
  display: none !important;
}


/* Lock full page scroll and fix layout for chat mode */
body.chat-active {
  overflow: hidden !important;
  height: 100vh !important;
}

body.chat-active .main-stage {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  height: 100vh !important;
}

body.chat-active .content-wrapper.has-results {
  max-height: 100vh !important;
  min-height: 100vh !important;
  height: 100vh !important;
  position: relative !important;
}

/* Make truth-portal fixed at all times so we can smoothly animate its transform from center to bottom of viewport */
.truth-portal {
  position: fixed !important;
  bottom: 0 !important;
  left: 60px !important;
  right: 0 !important;
  padding-bottom: 24px !important;
  transform: translateY(calc(-50vh + 50%));
  transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1), background-color 0.8s !important;
  margin: 0 !important;
  z-index: 100;
}

body.chat-active .truth-portal {
  transform: translateY(0) !important;
  background: transparent !important;
  z-index: 100 !important; /* Ensure it stays above results-container */
  pointer-events: none !important; /* Let clicks pass through to results */
}

body.chat-active .truth-portal .input-area-new {
  position: relative !important;
  z-index: 50 !important; /* Input stays on top */
  pointer-events: auto !important; /* Re-enable clicks */
}

body.chat-active .truth-portal .portal-flare {
  z-index: 0 !important; /* Star stays behind results (z-index 10) */
  opacity: 0.35;
  transform: scale(0.5) translateY(20px);
  transition: opacity 1.2s ease-out, transform 1s ease-out;
  pointer-events: none;
}

/* Fully hide stars only when response is complete */
body.chat-responded .truth-portal .portal-flare {
  opacity: 0 !important;
  transform: scale(0.2) translateY(40px) !important;
  transition: opacity 0.8s ease-out, transform 0.6s ease-out !important;
}

body.chat-active .results-container {
  --chat-input-safe-area: 154px;
  height: calc(100vh - var(--chat-input-safe-area)) !important;
  flex: none !important;
  padding-top: 60px !important;
  padding-bottom: 65vh !important;
  scroll-padding-bottom: 20px !important;
}

body.chat-active .header {
  padding-top: 4px !important;
  padding-bottom: 4px !important;
  padding-right: 12px !important;
  min-height: 40px !important;
  height: 40px !important;
}

/* Delete Modal Styling */
#delete-modal {
  display: none;
  align-items: center;
  justify-content: center;
}

#delete-modal.active {
  display: flex;
}

.delete-modal-content {
  background: #202124;
  border-radius: 20px;
  padding: 24px;
  width: 400px;
  max-width: 90%;
  color: #e8eaed;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  font-family: 'Inter', sans-serif;
}

.delete-modal-content h3 {
  font-size: 18px;
  font-weight: 500;
  margin-top: 0;
  margin-bottom: 16px;
  color: #e8eaed;
}

.delete-modal-content p {
  font-size: 14px;
  line-height: 1.5;
  color: #9aa0a6;
  margin-bottom: 24px;
}

.delete-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.delete-btn-cancel, .delete-btn-confirm {
  background: none;
  border: none;
  color: #8ab4f8;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.delete-btn-cancel:hover, .delete-btn-confirm:hover {
  background: rgba(138, 180, 248, 0.1);
}

/* Better Contrast for Header Buttons in Light Theme */
body.theme-light .header .mode-btn,
body.theme-light .header .mode-selector__option,
body.theme-light .header .mode-btn-new,
body.theme-light .header .settings-btn {
  color: #1A1A2E;
  font-weight: 600;
}
body.theme-light .header .mode-btn:hover,
body.theme-light .header .mode-selector__option:hover,
body.theme-light .header .mode-btn-new:hover,
body.theme-light .header .settings-btn:hover {
  color: #000000;
}

/* ─── Image Lightbox Overlay ──────────────────────────────── */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  cursor: zoom-out;
}
.lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-image {
  max-width: 90vw;
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
  transform: scale(0.85);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: default;
}
.lightbox-overlay.active .lightbox-image {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 26px;
  line-height: 44px;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  z-index: 10001;
  padding: 0;
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
}

/* ─── Header Brand Name ──────────────────────────────────── */
.header-brand-name {
  font-size: 18px;
  font-weight: 900;
  color: #FF0000;
  letter-spacing: 0.04em;
  margin-left: 10px;
  user-select: none;
  text-transform: uppercase;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0;
}

/* ─── User Profile Dropdown ──────────────────────────────── */
.user-profile-wrapper {
  position: relative;
}

.btn-register.logged-in {
  cursor: pointer;
  border-radius: 24px !important;
  padding: 4px 12px !important;
  transition: all 0.25s ease;
}
.btn-register.logged-in:hover {
  background: rgba(51, 119, 255, 0.08) !important;
}

.header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3377ff 0%, #6c5ce7 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0;
}

.header-username {
  font-size: 14px;
  white-space: nowrap;
}

.user-profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 260px;
  background: rgba(20, 20, 35, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(51, 119, 255, 0.18);
  border-radius: 16px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  padding: 0;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.97);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
  pointer-events: none;
}

.user-profile-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 20px 16px;
}

.profile-avatar {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3377ff 0%, #6c5ce7 50%, #a855f7 100%);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(51, 119, 255, 0.3);
}

.profile-info {
  overflow: hidden;
}

.profile-name {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.profile-email {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  line-height: 1.3;
}

.profile-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(51, 119, 255, 0.2) 50%, transparent 100%);
  margin: 0 16px;
}

.profile-logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 24px);
  margin: 12px 12px 14px;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-logout-btn:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  transform: translateX(2px);
}

.profile-logout-btn svg {
  flex-shrink: 0;
}

/* ─── Light Mode overrides for User Profile ──────────────── */
body.theme-light .user-profile-dropdown {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(0, 0, 0, 0.04) inset;
}

body.theme-light .profile-name {
  color: #1a1a2e;
}

body.theme-light .profile-email {
  color: rgba(0, 0, 0, 0.45);
}

body.theme-light .profile-divider {
  background: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.1) 50%, transparent 100%);
}

body.theme-light .profile-logout-btn {
  background: #3377ff !important;
  color: #ffffff !important;
}

body.theme-light .profile-logout-btn:hover {
  background: #2563eb !important;
  color: #ffffff !important;
}

body.theme-light .btn-register.logged-in:hover {
  background: rgba(0, 0, 0, 0.05) !important;
}

/* ═══════════════════════════════════════════════════════════════
   LIGHT MODE — Blue Badge Style (viền xanh, chữ trắng, nền xanh đậm)
   Matching Enter key badge: #3377ff bg, #fff text
   Only applies to body.theme-light — dark mode unchanged
   ═══════════════════════════════════════════════════════════════ */

/* --- Account Button (tên tài khoản / ĐĂNG NHẬP) --- */
body.theme-light .btn-register,
body.theme-light .btn-register.logged-in {
  background: transparent !important;
  color: #000000 !important;
  border: 1px solid rgba(0, 0, 0, 0.2) !important;
  box-shadow: none !important;
  font-weight: 800 !important;
}
body.theme-light .btn-register:hover,
body.theme-light .btn-register.logged-in:hover {
  background: rgba(26, 86, 219, 0.08) !important;
  color: #1e40af !important;
}
body.theme-light .header-avatar {
  background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%);
  color: #000000;
}

/* --- Mode Selector — CHẾ ĐỘ: EXPERT (nền xanh, chữ trắng) --- */
body.theme-light .mode-selector-new {
  background: #1a56db !important;
  border: 1px solid rgba(26, 86, 219, 0.7) !important;
  box-shadow: 0 2px 8px rgba(26, 86, 219, 0.25) !important;
}
body.theme-light .mode-btn-new,
body.theme-light .header .mode-btn-new {
  color: #ffffff !important;
  font-weight: 800 !important;
}
body.theme-light .mode-btn-new svg {
  stroke: #ffffff !important;
}
body.theme-light .mode-label-new {
  color: rgba(255, 255, 255, 0.85) !important;
  font-weight: 700 !important;
}

/* --- Footer Badges (NEO: PRECISION, DEEP + INTERNET, ENCRYPTED) --- */
body.theme-light .footer-badge-new {
  background: transparent !important;
  color: #000000 !important;
  border: 1px solid rgba(0, 0, 0, 0.3) !important;
  box-shadow: none !important;
  border-radius: 20px;
  padding: 4px 14px;
  font-weight: 800 !important;
}
body.theme-light .lock-badge {
  background: transparent !important;
  color: #000000 !important;
  font-weight: 800 !important;
}

/* ═══════════════════════════════════════════════════════════════
   LIGHT MODE — COMPREHENSIVE OVERRIDES (UI Audit Fix)
   ═══════════════════════════════════════════════════════════════ */

/* ─── #1 Sidebar ─── */
body.theme-light .sidebar {
  background: #FFFFFF;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.04);
}

body.theme-light .sidebar-original-icons {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.theme-light .sidebar-icon {
  color: #555;
}

body.theme-light .sidebar-icon:hover {
  color: #1a56db;
  background: rgba(26, 86, 219, 0.08);
}

body.theme-light .sidebar-icon.active {
  background: rgba(26, 86, 219, 0.12);
  color: #1a56db;
}

body.theme-light .new-chat-btn {
  color: #333;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

body.theme-light .new-chat-btn:hover {
  background: rgba(26, 86, 219, 0.08);
  color: #1a56db;
  border-color: rgba(26, 86, 219, 0.3);
}

/* ─── #1 Chat History Items ─── */
body.theme-light .chat-history-item {
  color: #444;
}

body.theme-light .chat-history-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

body.theme-light .chat-history-item.active {
  background: rgba(26, 86, 219, 0.1);
  color: #1a56db;
}

body.theme-light .chat-options-trigger {
  color: #666;
}

body.theme-light .chat-options-trigger:hover {
  background: rgba(0, 0, 0, 0.08);
}

/* ─── #2 Chat Options Menu (Pin/Delete/Rename) ─── */
body.theme-light .chat-options-menu {
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

body.theme-light .chat-options-menu button {
  color: #333;
}

body.theme-light .chat-options-menu button:hover {
  background: rgba(26, 86, 219, 0.08);
  color: #1a56db;
}

body.theme-light .chat-options-menu button.delete-btn,
body.theme-light .chat-options-menu button[style*="red"],
body.theme-light .chat-options-menu button:last-child {
  color: #dc2626;
}

body.theme-light .chat-options-menu button:last-child:hover {
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
}

/* ─── #3 Mode Dropdown ─── */
body.theme-light .mode-dropdown {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

body.theme-light .mode-option {
  color: #333;
}

body.theme-light .mode-option:hover:not(.locked) {
  background: rgba(26, 86, 219, 0.06);
}

body.theme-light .mode-option.active {
  background: rgba(26, 86, 219, 0.08);
}

body.theme-light .mode-opt-name {
  color: #1a1a2e;
}

body.theme-light .mode-opt-desc {
  color: rgba(0, 0, 0, 0.5);
}

body.theme-light .mode-option.locked .mode-opt-name {
  color: rgba(0, 0, 0, 0.4);
}

/* ─── #6 Profile Upgrade Button ─── */
body.theme-light .profile-upgrade-btn {
  color: #1a56db;
  background: rgba(26, 86, 219, 0.06);
}

body.theme-light .profile-upgrade-btn:hover {
  background: rgba(26, 86, 219, 0.12);
  color: #1e40af;
}

body.theme-light .profile-tier {
  font-weight: 700;
}

/* ─── #9 Footer ─── */
body.theme-light .footer {
  background: #FFFFFF !important;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
}

body.theme-light .footer::before {
  background: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.06) 50%, transparent 100%);
}

body.theme-light .footer .slogan {
  color: #888;
}

body.theme-light .footer .badge {
  color: #555;
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
}

/* ─── #10 Model Select Dropdowns ─── */
body.theme-light .model-select-dropdown {
  background: #FFFFFF;
  color: #333;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
}

body.theme-light .model-select-dropdown option {
  background: #FFFFFF;
  color: #333;
}

body.theme-light .model-select-dropdown option:disabled {
  color: #bbb;
}

/* ─── #11 Mode Selector — Fix gradient override ─── */
body.theme-light .mode-selector-new {
  background: rgba(255, 255, 255, 0.9) !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
}

body.theme-light .mode-label-new {
  color: #ffffff !important;
  font-weight: 600 !important;
}

body.theme-light .mode-btn-new {
  font-weight: 700 !important;
  color: #ffffff !important;
}

/* Preserve mode-specific colors in light mode */
body.theme-light .mode-selector-new[data-active-mode="basic"] .mode-btn-new {
  color: #ffffff !important;
}
body.theme-light .mode-selector-new[data-active-mode="basic"] {
  border-color: rgba(255, 255, 255, 0.3) !important;
}
body.theme-light .mode-selector-new[data-active-mode="pro"] .mode-btn-new {
  color: #ffffff !important;
}
body.theme-light .mode-selector-new[data-active-mode="pro"] {
  border-color: rgba(255, 255, 255, 0.3) !important;
}
body.theme-light .mode-selector-new[data-active-mode="expert"] .mode-btn-new {
  color: #ffffff !important;
}
body.theme-light .mode-selector-new[data-active-mode="expert"] {
  border-color: rgba(255, 255, 255, 0.3) !important;
}
body.theme-light .mode-btn-new svg {
  stroke: currentColor !important;
}

/* ─── #12 Singularity Container ─── */
body.theme-light .singularity-container {
  background-color: var(--bg-primary);
}

/* ─── #14 Free Tier Badge — Stronger color ─── */
body.theme-light .profile-tier[style*="color: rgb(170, 170, 170)"],
body.theme-light .profile-tier[style*="#aaa"] {
  color: #666 !important;
}

/* ─── #16 Demo Hints ─── */
body.theme-light .demo-hint {
  background: rgba(26, 86, 219, 0.06);
  border: 1px solid rgba(26, 86, 219, 0.15);
  color: #555;
}

body.theme-light .demo-hint:hover {
  background: rgba(26, 86, 219, 0.1);
  border-color: rgba(26, 86, 219, 0.3);
  color: #1a56db;
}



/* ═══════════════════════════════════════════════════════════════
   LIGHT MODE — GLOSSY SHINE EFFECT + CRISP FONTS
   Nền trắng bóng sang, chữ rõ nét chuyên nghiệp
   ═══════════════════════════════════════════════════════════════ */

/* --- Glossy white background with subtle shine --- */
body.theme-light {
  background: 
    linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(248,250,252,1) 50%, rgba(241,245,249,1) 100%);
  background-attachment: fixed;
}

body.theme-light .singularity-container {
  background: 
    linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(248,250,255,0.9) 100%);
}

/* --- Glossy header with shine strip --- */
body.theme-light .header {
  background: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
  box-shadow: 
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.02),
    inset 0 -1px 0 rgba(255, 255, 255, 1) !important;
}

/* --- Glossy sidebar with shine --- */
body.theme-light .sidebar {
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFBFC 100%) !important;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.04) !important;
}

/* --- Glossy input box with bright shine --- */
body.theme-light .input-field-new {
  background: #FFFFFF !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.04),
    inset 0 1px 2px rgba(255, 255, 255, 1) !important;
  color: #0f172a !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  font-weight: 500 !important;
}

body.theme-light .input-field-new::placeholder {
  color: #94a3b8 !important;
  font-weight: 400 !important;
}

body.theme-light .input-field-new:focus {
  border-color: rgba(26, 86, 219, 0.4) !important;
  box-shadow: 
    0 0 0 3px rgba(26, 86, 219, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

/* --- Crisp font rendering for all text in light mode --- */
body.theme-light * {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.theme-light .header,
body.theme-light .footer,
body.theme-light .sidebar,
body.theme-light .mode-selector-new,
body.theme-light .mode-dropdown,
body.theme-light .pricing-modal,
body.theme-light .auth-modal {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* --- Sharper text for headings --- */
body.theme-light .pricing-title,
body.theme-light .pricing-card h3,
body.theme-light .profile-name,
body.theme-light .mode-opt-name {
  font-weight: 700 !important;
  letter-spacing: -0.01em;
}

/* --- Glossy pricing cards --- */
body.theme-light .pricing-card {
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFBFD 100%) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06) !important;
}

body.theme-light .pricing-card.featured {
  background: linear-gradient(180deg, #FFFFFF 0%, #F0F4FF 100%) !important;
  box-shadow: 
    0 4px 20px rgba(26, 86, 219, 0.08),
    0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

/* --- Glossy footer --- */
body.theme-light .footer {
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,1) 100%) !important;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.03) !important;
}

/* --- Bóng trắng tinh cho response box trong light mode --- */
body.theme-light .result-tier,
body.theme-light .proof-chain {
  background: #FFFFFF !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
}

/* --- Bóng trắng tinh cho query bubble trong light mode --- */
body.theme-light .user-query-block {
  background: #FFFFFF !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
}

/* --- Glossy auth modal --- */
body.theme-light .auth-modal {
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFBFD 100%) !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12) !important;
}

/* --- Glossy profile dropdown --- */
body.theme-light .user-profile-dropdown {
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFBFC 100%) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
}

/* ═══════════════════════════════════════════════════════════════
   PREMIUM UI REDESIGN — Prompt Starters + Footer + Brand
   ═══════════════════════════════════════════════════════════════ */

/* --- PROMPT STARTERS --- */
.prompt-starters {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 600px;
  width: 100%;
  margin: 0 auto 24px;
  padding: 0 16px;
}

.prompt-starter-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--chat-border);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.prompt-starter-card:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(var(--accent-primary-rgb), 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(var(--accent-primary-rgb), 0.08);
}

.prompt-starter-card:active {
  transform: translateY(0);
}

.ps-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.ps-text {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.3;
}

.prompt-starter-card:hover .ps-text {
  color: var(--text-primary);
}

/* Light mode prompt starters */
body.theme-light .prompt-starter-card {
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.theme-light .prompt-starter-card:hover {
  background: #F8F9FB;
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.08);
}

body.theme-light .ps-text {
  color: #475569;
}

body.theme-light .prompt-starter-card:hover .ps-text {
  color: #0f172a;
}

@media (max-width: 600px) {
  .prompt-starters {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 0 12px;
  }
}

/* --- PREMIUM FOOTER --- */
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  min-height: 36px;
}

.footer-text {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.footer-link {
  color: var(--text-muted);
  transition: color 0.2s;
}

.footer-link:hover {
  color: var(--text-secondary);
}

body.theme-light .footer-text {
  color: #94a3b8;
}

body.theme-light .footer-link {
  color: #94a3b8;
}

body.theme-light .footer-link:hover {
  color: #475569;
}

/* --- HEADER BRAND GRADIENT --- */
.header-brand-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 18px;
  /* Pure red — both dark & light */
  color: #e8192c;
  -webkit-text-fill-color: #e8192c;
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
  letter-spacing: -0.02em;
}

body.theme-light .header-brand-name {
  color: #e8192c;
  -webkit-text-fill-color: #e8192c;
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
}

/* --- PREMIUM INPUT BOX --- */
.input-field-new {
  font-family: var(--font-body) !important;
  font-size: 15px !important;
  font-weight: 400;
  border-radius: 16px !important;
}

.input-area-new {
  border-radius: 20px !important;
}

.input-row {
  border-radius: 20px !important;
}

/* --- MICRO-ANIMATIONS --- */
.pricing-card {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.pricing-card:hover {
  transform: translateY(-4px);
}

.auth-btn,
.pricing-btn {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-btn:hover,
.pricing-btn:hover {
  transform: scale(1.02);
  filter: brightness(1.1);
}

.sidebar-icon {
  transition: all 0.2s ease;
}

.sidebar-icon:hover {
  transform: scale(1.05);
}

/* --- HEADER SLIM --- */
.header {
  height: 52px !important;
  min-height: 52px !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

/* --- MODE SELECTOR PREMIUM --- */
.mode-btn-new {
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 10px;
}

.mode-dropdown {
  border-radius: 14px !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* --- PORTAL TITLE PREMIUM --- */
.truth-portal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Hide portal animation when prompt starters exist */
.truth-portal .portal-flare {
  max-height: 180px;
  margin-bottom: 8px;
  pointer-events: none; /* Don't block clicks on prompt starters below */
}

/* Ensure prompt starters are clickable above portal */
.prompt-starters {
  position: relative;
  z-index: 10;
}

/* Hide prompt starters when chat is active */
.content-wrapper.has-results .prompt-starters {
  display: none !important;
}

/* Shrink portal when chat active */
.content-wrapper.has-results .portal-flare {
  max-height: 0;
  overflow: hidden;
  margin: 0;
  opacity: 0;
  transition: all 0.3s ease;
}

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR SEARCH PANEL — Premium Search Experience
   ═══════════════════════════════════════════════════════════════ */

.sidebar-search-panel {
  width: 100%;
  padding: 0 12px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease,
              padding 0.35s ease;
}

.sidebar-search-panel.active {
  max-height: 80px;
  opacity: 1;
  padding: 8px 12px 4px;
}

/* --- Search Input Wrapper --- */
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--chat-border);
  border-radius: 12px;
  padding: 0 10px;
  transition: all 0.25s ease;
}

.search-input-wrapper:focus-within {
  border-color: rgba(var(--accent-primary-rgb), 0.5);
  box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.08),
              0 2px 8px rgba(0, 0, 0, 0.15);
  background: var(--bg-surface-elevated);
}

/* --- Search Icon --- */
.search-input-icon {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color 0.2s ease;
  display: block;
}

.search-input-wrapper:focus-within .search-input-icon {
  color: rgb(var(--accent-primary-rgb));
}

/* --- Search Input --- */
.search-input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  padding: 9px 8px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-primary);
  min-width: 0;
}

.search-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

/* --- Clear Button --- */
.search-clear-btn {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  border: none;
  padding: 0;
}

.search-clear-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

/* --- Results Count --- */
.search-results-count {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 4px 0;
  min-height: 0;
  transition: all 0.2s ease;
}

.search-results-count:empty {
  display: none;
}

/* --- Highlight matched text in history items --- */
.chat-title mark {
  background: rgba(var(--accent-primary-rgb), 0.25);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* --- History items filtered out --- */
.chat-history-item.search-hidden {
  display: none !important;
}

/* --- Search active state for sidebar icon --- */
#sidebar-search-btn.search-active {
  color: rgb(var(--accent-primary-rgb));
}

#sidebar-search-btn.search-active svg {
  stroke: rgb(var(--accent-primary-rgb));
}

/* --- Section headers hidden when searching --- */
.sidebar-search-active .chat-history-list > div:not(.chat-history-item) {
  display: none;
}

/* ─── Light Mode Search ─── */
body.theme-light .search-input-wrapper {
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

body.theme-light .search-input-wrapper:focus-within {
  border-color: rgba(79, 70, 229, 0.4);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.06),
              0 2px 8px rgba(0, 0, 0, 0.06);
  background: #FFFFFF;
}

body.theme-light .search-input {
  color: #0f172a;
}

body.theme-light .search-input::placeholder {
  color: #94a3b8;
}

body.theme-light .search-input-icon {
  color: #94a3b8;
}

body.theme-light .search-input-wrapper:focus-within .search-input-icon {
  color: #4f46e5;
}

body.theme-light .search-clear-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

body.theme-light .search-results-count {
  color: #94a3b8;
}

body.theme-light .chat-title mark {
  background: rgba(79, 70, 229, 0.15);
}

/* ─── Collapsed sidebar: hide search --- */
.sidebar.collapsed .sidebar-search-panel {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════
   CUSTOM MODEL PICKER — Artistic LLM/VLM Selector
   ═══════════════════════════════════════════════════════════════ */

.custom-model-picker {
  position: relative;
}

/* --- Trigger Button --- */
.picker-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--chat-border);
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.picker-trigger:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(var(--accent-primary-rgb), 0.3);
}

.picker-icon {
  font-size: 13px;
  line-height: 1;
}

.picker-label {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.picker-arrow {
  flex-shrink: 0;
  opacity: 0.5;
  transition: transform 0.3s ease, opacity 0.2s;
  display: block;
}

.custom-model-picker.open .picker-arrow {
  transform: rotate(180deg);
  opacity: 0.8;
}

/* --- Dropdown Panel --- */
.picker-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 240px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--chat-border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35),
              0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 9999;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease;
  transform-origin: top right;
}

.custom-model-picker.open .picker-dropdown {
  max-height: 420px;
  overflow-y: auto;
  opacity: 1;
  padding: 6px;
}

/* --- Group Label --- */
.picker-group {
  margin-bottom: 2px;
}

.picker-group-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 4px;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Tier indicator dots */
.tier-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.tier-dot.tier-free {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.tier-dot.tier-pro {
  background: #6366f1;
  box-shadow: 0 0 6px rgba(99, 102, 241, 0.4);
}

.tier-dot.tier-expert {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

/* --- Picker Item --- */
.picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  gap: 8px;
}

.picker-item:hover {
  background: var(--bg-surface-hover);
}

.picker-item.active {
  background: rgba(var(--accent-primary-rgb), 0.1);
}

.picker-item.active::before {
  content: '✓';
  font-size: 11px;
  font-weight: 700;
  color: rgb(var(--accent-primary-rgb));
  margin-right: 4px;
}

.picker-item-name {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
}

/* --- Item Tags --- */
.picker-item-tag {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tag-fast {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
}

.tag-new {
  background: rgba(6, 182, 212, 0.12);
  color: #06b6d4;
}

.tag-balanced {
  background: rgba(139, 143, 168, 0.12);
  color: var(--text-secondary);
}

.tag-power {
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
}

.tag-smart {
  background: rgba(168, 85, 247, 0.12);
  color: #a855f7;
}

.tag-elite {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

/* --- Scrollbar --- */
.picker-dropdown::-webkit-scrollbar {
  width: 4px;
}

.picker-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.picker-dropdown::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

/* ─── Light Mode Picker ─── */
body.theme-light .picker-trigger {
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #0f172a;
}

body.theme-light .picker-trigger:hover {
  background: #f8f9fb;
  border-color: rgba(79, 70, 229, 0.3);
}

body.theme-light .picker-dropdown {
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12),
              0 0 1px rgba(0, 0, 0, 0.05);
}

body.theme-light .picker-item:hover {
  background: #f1f5f9;
}

body.theme-light .picker-item.active {
  background: rgba(79, 70, 229, 0.06);
}

body.theme-light .picker-item-name {
  color: #0f172a;
}

body.theme-light .picker-group-label {
  color: #94a3b8;
}
/* ═══════════════════════════════════════════════════════════
   LOCKED PICKER ITEMS — Dimmed + Lock Icon
   ═══════════════════════════════════════════════════════════ */

.picker-item.picker-locked {
  opacity: 0.4;
  cursor: not-allowed;
  position: relative;
}

.picker-item.picker-locked:hover {
  background: transparent;
}

.picker-item.picker-locked .picker-item-tag {
  display: none;
}

.picker-item.picker-locked::after {
  content: '🔒';
  font-size: 11px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   LIGHT MODE & GLOBAL TRANSITIONS
   ═══════════════════════════════════════════════════════════ */

body, .singularity-container, .header, .sidebar, .input-row, .footer, .input-field-new {
  transition: background 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
              background-color 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
              border-color 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

body.theme-light {
  background: linear-gradient(160deg, #f0f4ff 0%, #faf5ff 30%, #fdf2f8 60%, #f0f9ff 100%) !important;
}

body.theme-light .main-content {
  background: transparent !important;
}

body.theme-light .grid-overlay,
body.theme-light .neural-canvas {
  opacity: 0 !important;
  visibility: hidden !important;
}

/* --- Robot Graphic in Light Mode --- */
.portal-robot {
  display: none;
  width: 350px;
  height: 270px;
  margin-top: -180px;
  margin-bottom: -20px;
  margin-left: auto;
  margin-right: auto;
  pointer-events: none;
  animation: float 6s ease-in-out infinite;
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-mask-image: linear-gradient(to bottom, black 75%, transparent 92%);
  mask-image: linear-gradient(to bottom, black 75%, transparent 92%);
  z-index: 10;
}

.portal-robot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

body.theme-light .portal-robot {
  display: block;
}

body.chat-active .portal-robot,
body.chat-responded .portal-robot {
  opacity: 0 !important;
  transform: scale(0.6) translateY(-40px);
  pointer-events: none;
  visibility: hidden;
}

body.theme-light .portal-flare {
  display: none !important;
}

@keyframes float {
  0% { transform: translateY(-5%); }
  50% { transform: translateY(-12%); }
  100% { transform: translateY(-5%); }
}

/* Subtle dot pattern */
body.theme-light .main-content::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(0,0,0,0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
}

body.theme-light .header {
  background: rgba(255,255,255,0.95) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border-bottom: 1px solid rgba(0,0,0,0.05) !important;
  box-shadow: 0 1px 8px rgba(0,0,0,0.02) !important;
}

body.theme-light .sidebar {
  background: #ffffff !important;
  border-right-color: rgba(0,0,0,0.05) !important;
}

body.theme-light .sidebar-icon {
  color: #64748b !important;
}

body.theme-light .sidebar-icon:hover,
body.theme-light .sidebar-icon.active {
  color: #3377ff !important;
  background: rgba(51,119,255,0.08) !important;
}

body.theme-light .input-row {
  background: #ffffff !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
  box-shadow: 0 4px 30px rgba(0,0,0,0.04) !important;
  border-radius: 30px !important;
  padding: 4px 6px !important;
}

body.theme-light .input-field-new {
  background: transparent !important;
  border: none !important;
  color: #1e293b !important;
  box-shadow: none !important;
}

body.theme-light .input-field-new::placeholder {
  color: #94a3b8 !important;
}

body.theme-light .input-field-new:focus {
  border: none !important;
  box-shadow: none !important;
}

body.theme-light .upload-btn {
  border: none !important;
  background: transparent !important;
  color: #64748b !important;
  box-shadow: none !important;
}

body.theme-light .submit-btn {
  background: #3377ff !important;
  color: #ffffff !important;
  border-radius: 50% !important;
  box-shadow: 0 4px 12px rgba(51,119,255,0.3) !important;
}

body.theme-light .mode-selector-new {
  background: #3377ff !important;
  border-color: rgba(51, 119, 255, 0.4) !important;
  box-shadow: 0 4px 12px rgba(51,119,255,0.3) !important;
}

body.theme-light .custom-model-picker .picker-trigger {
  background: rgba(255,255,255,0.8) !important;
  border-color: rgba(99,102,241,0.12) !important;
  color: #1e293b !important;
}

body.theme-light .picker-dropdown,
body.theme-light .mode-dropdown {
  background: rgba(255,255,255,0.95) !important;
  border-color: rgba(99,102,241,0.1) !important;
  box-shadow: 0 8px 32px rgba(99,102,241,0.12) !important;
}

body.theme-light .picker-item:hover,
body.theme-light .mode-option:hover {
  background: rgba(99,102,241,0.06) !important;
}

body.theme-light .picker-item.active {
  background: rgba(99,102,241,0.1) !important;
}

body.theme-light .picker-item-name,
body.theme-light .mode-opt-name {
  color: #1e293b !important;
}

body.theme-light .picker-group-label {
  color: #64748b !important;
}

body.theme-light .new-chat-btn {
  background: rgba(99,102,241,0.06) !important;
  color: #475569 !important;
}

body.theme-light .chat-history-item {
  color: #475569 !important;
}

body.theme-light .chat-history-item.active {
  background: rgba(99,102,241,0.1) !important;
  color: #1e293b !important;
}

body.theme-light .footer {
  background: rgba(255,255,255,0.6) !important;
  border-top-color: rgba(99,102,241,0.06) !important;
}

body.theme-light .content-wrapper {
  position: relative;
  z-index: 1;
}

body.theme-light .truth-portal {
  position: relative;
  z-index: 1;
}

/* Light mode welcome text */
body.theme-light .input-hint-new {
  color: #000 !important;
}

body.theme-light .header-brand-name {
  color: #e8192c !important;
  -webkit-text-fill-color: #e8192c !important;
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE RESPONSIVE — Complete phone optimization
   Breakpoints: 768px (tablet), 480px (phone)
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* --- HEADER mobile: single compact row --- */
  .header {
    padding: 6px 10px !important;
    gap: 6px;
    height: auto !important;
    min-height: auto !important;
    flex-wrap: wrap !important;
  }

  .header-left {
    gap: 4px;
    min-width: 0;
    order: 1;
    flex-shrink: 1;
  }

  /* Hide brand text on mobile — logo button is enough */
  .header-brand-name {
    display: none !important;
  }

  /* Compact user profile button */
  #btn-auth-action {
    font-size: 11px !important;
    padding: 4px 10px !important;
    letter-spacing: 0.05em !important;
  }

  .user-profile-btn {
    padding: 3px 8px !important;
    font-size: 11px !important;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Mode selector — compact */
  .header-center {
    position: relative;
    left: auto;
    transform: none;
    order: 2;
    margin-left: auto;
  }

  .mode-selector-new {
    padding: 3px 8px;
    gap: 4px;
  }

  .mode-label-new {
    display: none;
  }

  .mode-btn-new {
    font-size: 11px;
    padding: 3px 6px;
    gap: 3px;
  }

  .mode-btn-new svg {
    width: 10px;
    height: 10px;
  }

  .mode-dropdown {
    right: 0;
    left: auto;
    min-width: 240px;
    z-index: 9999;
  }

  /* Model pickers — row 2, centered */
  .header-right {
    order: 3;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px !important;
    padding: 3px 0 1px;
    border-top: 1px solid rgba(255,255,255,0.05);
    min-width: 0;
  }

  body.theme-light .header-right {
    border-top-color: rgba(99,102,241,0.08);
  }

  .custom-model-picker {
    flex: 1;
    max-width: 42%;
  }

  .custom-model-picker .picker-trigger {
    padding: 4px 8px !important;
    font-size: 11px;
    width: 100%;
    justify-content: center;
    border-radius: 10px !important;
  }

  .picker-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80px;
  }

  .picker-dropdown {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 60vh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0 !important;
    z-index: 99999;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.4) !important;
  }

  /* Theme toggle */
  .theme-toggle-label {
    width: 40px !important;
    height: 20px !important;
  }

  .toggle-celestial {
    font-size: 13px !important;
  }

  /* --- SIDEBAR mobile: overlay + backdrop --- */
  .sidebar.expanded {
    width: 280px !important;
    box-shadow: 4px 0 30px rgba(0,0,0,0.5);
    z-index: 9999;
  }

  /* Sidebar toggle always visible on mobile */
  .sidebar-toggle-btn {
    position: fixed;
    top: 6px;
    left: 6px;
    z-index: 1001;
    visibility: visible !important;
    background: var(--glass-bg);
    border-radius: 10px;
    width: 36px;
    height: 36px;
  }

  /* --- MAIN CONTENT --- */
  .main-content {
    padding-top: 80px !important; /* room for 2-row header */
  }

  .content-wrapper {
    padding: 10px 14px !important;
  }

  /* --- PORTAL / FLARE — smaller on mobile --- */
  .portal-flare {
    width: 200px !important;
    height: 120px !important;
    margin-top: -10px !important;
    margin-bottom: 16px !important;
  }

  .flare-core {
    width: 10px !important;
    height: 10px !important;
  }

  .orbit-1 {
    width: 180px !important;
    height: 70px !important;
    margin-left: -90px !important;
    margin-top: -35px !important;
  }

  .orbit-2 {
    width: 150px !important;
    height: 80px !important;
    margin-left: -75px !important;
    margin-top: -40px !important;
  }

  /* --- INPUT AREA: true full width --- */
  .input-area-new {
    max-width: 100% !important;
    padding: 0 6px;
  }

  .input-field-new {
    font-size: 15px !important;
    padding: 13px 50px 13px 18px !important;
    border-radius: 24px !important;
  }

  .upload-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    margin-bottom: 6px;
  }

  .submit-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    right: 6px !important;
    bottom: 6px !important;
  }

  .input-hint-new {
    font-size: 11px !important;
    padding: 0 8px;
  }

  /* --- PROMPT STARTERS --- */
  .prompt-starters {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    padding: 0 8px !important;
  }

  .prompt-card {
    padding: 10px 14px !important;
    font-size: 13px !important;
  }

  /* --- FOOTER --- */
  .footer {
    left: 0 !important;
    padding: 8px 12px !important;
  }

  .footer-text {
    font-size: 10px !important;
  }

  /* --- RESULTS CONTAINER --- */
  .results-container {
    padding: 0 8px !important;
  }

  .result-card,
  .truth-answer {
    padding: 14px 12px !important;
    border-radius: 12px !important;
    font-size: 14px !important;
  }

  /* --- AUTH MODAL --- */
  .auth-modal {
    width: 95vw !important;
    max-width: 400px !important;
    padding: 20px 16px !important;
    border-radius: 16px !important;
  }

  /* --- PRICING MODAL --- */
  .pricing-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .pricing-card {
    padding: 16px !important;
  }

  /* --- USER PROFILE DROPDOWN --- */
  .user-profile-dropdown {
    right: -10px !important;
    min-width: 220px !important;
  }
}

/* ═══ EXTRA SMALL PHONES (≤480px) ═══ */
@media (max-width: 480px) {
  .header-brand-name {
    display: none;
  }

  .mode-selector-new {
    padding: 3px 8px;
    border-radius: 14px;
  }

  .mode-btn-new {
    font-size: 11px;
    gap: 3px;
  }

  .custom-model-picker .picker-trigger {
    padding: 4px 8px !important;
    border-radius: 10px !important;
    font-size: 11px;
  }

  .input-field-new {
    font-size: 14px !important;
    padding: 11px 44px 11px 14px !important;
  }

  .upload-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }

  .submit-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
  }

  .portal-flare {
    width: 160px !important;
    height: 95px !important;
    margin-bottom: 10px !important;
  }

  .auth-modal {
    width: 98vw !important;
    padding: 16px 12px !important;
  }

  .auth-tabs {
    gap: 0 !important;
  }

  .auth-tab {
    font-size: 13px !important;
    padding: 10px !important;
  }
}

/* ═══ TOUCH IMPROVEMENTS ═══ */
@media (hover: none) and (pointer: coarse) {
  .sidebar-toggle-btn,
  .sidebar-icon,
  .settings-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .chat-history-item {
    padding: 12px 14px;
    min-height: 44px;
  }

  .chat-options-trigger {
    opacity: 1;
    padding: 6px;
  }

  .picker-item {
    padding: 10px 12px !important;
    min-height: 40px;
  }

  .mode-option {
    padding: 12px !important;
    min-height: 44px;
  }

  .sidebar-icon:hover,
  .settings-btn:hover,
  .upload-btn:hover {
    transform: none;
  }
}

/* ═══ LANDSCAPE PHONE ═══ */
@media (max-height: 500px) and (orientation: landscape) {
  .portal-flare {
    display: none !important;
  }

  .truth-portal {
    gap: 8px !important;
  }

  .main-content {
    padding-top: 50px !important;
  }
}

