/* ============================================================================
   YUB — VISION 360 LIQUID METAL & SPATIAL GLASS UI (v3.0 Reference Reconstruction)
   Viewport Reference Coordinate System: 1920 x 1080 (16:9)
   ============================================================================ */

:root {
  /* Responsive 1920x1080 & 1248x800 multi-aspect coordinate units */
  --ux: calc(100vw / 1920);
  --uy: calc(100vh / 1080);
  --u: min(var(--ux), var(--uy));
  --font-sans: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

/* --- DARK THEME TOKENS (Reference: Deep Navy + Volumetric Cyan/Purple/Pink) --- */
body.theme-dark {
  --bg-base: #060D24;
  --logo-stop-1: #00F0FF;
  --logo-stop-2: #3B82F6;
  --logo-stop-3: #FF49C4;
  --logo-stop-4: #8B5CF6;

  --text-primary: #FFFFFF;
  --text-secondary: rgba(226, 238, 255, 0.88);
  --text-muted: rgba(176, 198, 235, 0.72);

  --header-bg: linear-gradient(180deg, rgba(8, 16, 44, 0.72) 0%, rgba(12, 22, 58, 0.38) 100%);
  --header-border: rgba(0, 229, 255, 0.28);

  --panel-bg: linear-gradient(155deg, rgba(14, 30, 74, 0.82) 0%, rgba(8, 18, 48, 0.78) 55%, rgba(16, 28, 70, 0.84) 100%);
  --panel-border: rgba(0, 235, 255, 0.68);
  --panel-glow: 0 26px 60px rgba(2, 6, 23, 0.82), 0 0 36px rgba(0, 210, 255, 0.28);

  --pill-bg: linear-gradient(180deg, rgba(22, 52, 114, 0.82) 0%, rgba(12, 26, 68, 0.88) 100%);
  --pill-border: rgba(56, 228, 255, 0.82);
  --pill-shadow: 0 12px 28px rgba(2, 8, 28, 0.72), 0 0 24px rgba(0, 210, 255, 0.35), inset 0 1.5px 3px rgba(255, 255, 255, 0.48);

  --composer-bg: linear-gradient(90deg, rgba(14, 24, 62, 0.78) 0%, rgba(10, 18, 48, 0.68) 50%, rgba(18, 24, 64, 0.78) 100%);
  --composer-border: rgba(120, 210, 255, 0.55);
  --composer-shadow: 0 22px 54px rgba(2, 6, 24, 0.82), 0 0 34px rgba(0, 210, 255, 0.24), inset 0 1.5px 3px rgba(255, 255, 255, 0.38);

  --send-btn-bg: linear-gradient(135deg, #FF5599 0%, #E036A6 55%, #A838FF 100%);
  --send-btn-shadow: 0 0 26px rgba(255, 72, 165, 0.75), inset 0 1.5px 3px rgba(255, 255, 255, 0.65);

  --drawer-bg: rgba(10, 20, 52, 0.92);
  --drawer-border: rgba(0, 229, 255, 0.36);
}

/* --- LIGHT THEME TOKENS (Reference: Vision 360 Smoky-Teal Crystal Glass + Chrome/Mint) --- */
body.theme-light {
  --bg-base: #4A787B;
  --logo-stop-1: #C4FFF4;
  --logo-stop-2: #5CE6CD;
  --logo-stop-3: #88FFE8;
  --logo-stop-4: #24B8A0;

  --text-primary: #FFFFFF;
  --text-secondary: rgba(240, 255, 252, 0.92);
  --text-muted: rgba(210, 242, 238, 0.82);

  --header-bg: linear-gradient(180deg, rgba(44, 82, 86, 0.72) 0%, rgba(56, 98, 102, 0.54) 100%);
  --header-border: rgba(190, 255, 245, 0.48);

  --panel-bg: linear-gradient(152deg, rgba(36, 74, 78, 0.84) 0%, rgba(24, 54, 58, 0.88) 54%, rgba(32, 68, 72, 0.84) 100%);
  --panel-border: rgba(205, 255, 246, 0.88);
  --panel-glow: 0 30px 64px rgba(12, 36, 38, 0.55), 0 0 38px rgba(130, 255, 235, 0.32);

  --pill-bg: linear-gradient(180deg, rgba(64, 118, 120, 0.66) 0%, rgba(42, 86, 88, 0.74) 100%);
  --pill-border: rgba(185, 255, 242, 0.78);
  --pill-shadow: 0 12px 28px rgba(16, 46, 48, 0.38), 0 0 22px rgba(130, 255, 235, 0.28), inset 0 1.5px 2px rgba(255, 255, 255, 0.65);

  --composer-bg: linear-gradient(90deg, rgba(46, 90, 94, 0.72) 0%, rgba(56, 106, 108, 0.64) 50%, rgba(46, 90, 94, 0.72) 100%);
  --composer-border: rgba(200, 255, 245, 0.82);
  --composer-shadow: 0 24px 52px rgba(12, 38, 40, 0.48), 0 0 32px rgba(140, 255, 235, 0.32), inset 0 2px 3px rgba(255, 255, 255, 0.72);

  --send-btn-bg: linear-gradient(135deg, #76FFE4 0%, #2EE5C4 60%, #14B89A 100%);
  --send-btn-shadow: 0 0 26px rgba(80, 255, 224, 0.75), inset 0 2px 3px rgba(255, 255, 255, 0.85);

  --drawer-bg: rgba(34, 70, 74, 0.92);
  --drawer-border: rgba(180, 255, 242, 0.55);
}

/* --- RESET & BASE --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

button, input, textarea, select {
  font-family: inherit;
  color: inherit;
}

.hidden {
  display: none !important;
}

.sr-file-input {
  position: fixed;
  top: -9999px;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0.01;
  overflow: hidden;
  z-index: -1;
}

/* ============================================================================
   LAYER 1 & 2: 3D LIQUID METAL ENVIRONMENT PLATE + REAL-TIME SHADER CANVAS
   ============================================================================ */
.background-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 0.45s ease, filter 0.45s ease;
}

.env-plate-layer {
  position: absolute;
  inset: -2%;
  width: 104%;
  height: 104%;
  object-fit: fill;
  display: block;
  transform-origin: 50% 60%;
  animation: envLiquidFlow 9s ease-in-out infinite alternate;
}

@keyframes envLiquidFlow {
  0% {
    transform: scale(1.02) translate3d(-0.6%, -0.4%, 0) rotate(-0.25deg);
  }
  50% {
    transform: scale(1.035) translate3d(0.6%, 0.5%, 0) rotate(0.25deg);
  }
  100% {
    transform: scale(1.02) translate3d(-0.3%, 0.6%, 0) rotate(-0.15deg);
  }
}

.liquid-bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  mix-blend-mode: screen;
}

.liquid-bg-canvas.webgl-tex-active {
  mix-blend-mode: normal;
}

body.in-conversation .background-stage {
  opacity: 0.98;
  filter: none;
}

/* ============================================================================
   ZONE A: TOP HORIZONTAL HEADER (50-56px at 1248x800, 76-82px at 1920x1080)
   ============================================================================ */
.yub-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: clamp(50px, calc(76 * var(--uy)), 82px);
  padding: 0 clamp(24px, calc(52 * var(--ux)), 60px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 30;
  background: var(--header-bg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--header-border);
}

body.theme-dark .yub-header {
  background: linear-gradient(180deg, rgba(7, 14, 38, 0.55) 0%, rgba(10, 18, 48, 0.18) 100%);
  border-bottom: 1px solid rgba(0, 229, 255, 0.18);
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: calc(18 * var(--u));
}

.yub-brand-btn {
  display: inline-flex;
  align-items: center;
  gap: calc(12 * var(--u));
  background: none;
  border: none;
  cursor: pointer;
  padding: calc(4 * var(--u)) calc(6 * var(--u));
}

.yub-logo-mark {
  width: calc(44 * var(--u));
  height: calc(44 * var(--u));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 12px rgba(0, 229, 255, 0.55));
}

body.theme-light .yub-logo-mark {
  filter: drop-shadow(0 0 12px rgba(130, 255, 232, 0.65));
}

.yub-logo-mark svg {
  width: 100%;
  height: 100%;
}

.yub-brand-text {
  font-size: calc(34 * var(--u));
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  text-shadow: 0 2px 14px rgba(0, 229, 255, 0.35);
}

body.theme-dark .yub-brand-text {
  text-transform: lowercase;
  font-size: calc(37 * var(--u));
}

.header-divider {
  width: 1px;
  height: calc(28 * var(--u));
  background: rgba(255, 255, 255, 0.22);
  margin: 0 calc(8 * var(--u));
}

.header-nav {
  display: flex;
  align-items: center;
  gap: calc(16 * var(--u));
}

.header-nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: calc(9 * var(--u));
  height: calc(48 * var(--u));
  padding: 0 calc(16 * var(--u));
  background: transparent;
  border: none;
  border-radius: calc(12 * var(--u));
  color: var(--text-secondary);
  font-size: calc(16.5 * var(--u));
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.header-nav-item svg {
  width: calc(21 * var(--u));
  height: calc(21 * var(--u));
  opacity: 0.92;
}

body.theme-dark .header-nav-item svg {
  color: #5CE1FF;
}

body.theme-light .header-nav-item svg {
  color: #A8FFF0;
}

.header-nav-item:hover,
.header-nav-item.active {
  color: #FFFFFF;
}

.header-nav-item.active::after {
  content: "";
  position: absolute;
  left: calc(10 * var(--u));
  right: calc(10 * var(--u));
  bottom: calc(-16 * var(--u));
  height: calc(3.5 * var(--u));
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #00F0FF, #7C3AED, transparent);
  box-shadow: 0 0 16px #00F0FF;
}

body.theme-light .header-nav-item.active::after {
  background: linear-gradient(90deg, transparent, #8CFFF0, #FFFFFF, #8CFFF0, transparent);
  box-shadow: 0 0 16px rgba(155, 255, 240, 0.9);
}

body.in-conversation .header-nav-item.active {
  border-radius: 999px;
  padding: 0 calc(20 * var(--u));
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.04) 100%);
  border: 1.3px solid rgba(195, 255, 246, 0.55);
  box-shadow:
    inset 0 1.5px 2px rgba(255, 255, 255, 0.45),
    0 6px 18px rgba(8, 30, 34, 0.28);
}

body.theme-dark.in-conversation .header-nav-item.active {
  border-color: rgba(88, 225, 255, 0.52);
  box-shadow:
    inset 0 1.5px 2px rgba(255, 255, 255, 0.35),
    0 6px 18px rgba(0, 12, 36, 0.45);
}

body.theme-light .header-nav-item.active::after {
  background: linear-gradient(90deg, transparent, #98FFEE, #FFFFFF, #98FFEE, transparent);
  box-shadow: 0 0 16px rgba(152, 255, 238, 0.95);
}

.header-icon-btn {
  position: relative;
  width: calc(42 * var(--u));
  height: calc(42 * var(--u));
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease;
}

.header-icon-btn svg {
  width: calc(23 * var(--u));
  height: calc(23 * var(--u));
}

.header-icon-btn:hover {
  color: #FFFFFF;
  transform: scale(1.06);
}

.notif-badge-dot {
  position: absolute;
  top: calc(7 * var(--u));
  right: calc(7 * var(--u));
  width: calc(8 * var(--u));
  height: calc(8 * var(--u));
  border-radius: 50%;
  background: #FF3B5C;
  box-shadow: 0 0 8px #FF3B5C;
}

body.theme-light .notif-badge-dot {
  background: #52FFD8;
  box-shadow: 0 0 8px #52FFD8;
}

.header-profile-btn {
  position: relative;
  width: calc(48 * var(--u));
  height: calc(48 * var(--u));
  border-radius: 50%;
  border: 1.8px solid rgba(160, 240, 255, 0.65);
  background: radial-gradient(circle at 30% 30%, rgba(120, 210, 255, 0.35), rgba(20, 40, 90, 0.65));
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.32);
}

body.theme-light .header-profile-btn {
  border-color: rgba(200, 255, 246, 0.85);
  background: radial-gradient(circle at 30% 30%, rgba(150, 255, 238, 0.42), rgba(36, 78, 82, 0.72));
  box-shadow: 0 0 18px rgba(140, 255, 235, 0.38);
}

.header-profile-btn svg {
  width: calc(26 * var(--u));
  height: calc(26 * var(--u));
}

.online-ring-dot {
  position: absolute;
  right: calc(1 * var(--u));
  bottom: calc(1 * var(--u));
  width: calc(10 * var(--u));
  height: calc(10 * var(--u));
  border-radius: 50%;
  background: #2EE59D;
  border: 2px solid rgba(10, 25, 50, 0.9);
  box-shadow: 0 0 8px #2EE59D;
}

/* ============================================================================
   MAIN WORKSPACE & SPATIAL STAGE (1920 x 1080 Coordinate System)
   ============================================================================ */
.yub-workspace {
  position: relative;
  width: 100vw;
  height: 100vh;
  z-index: 10;
  overflow: hidden;
}

.home-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.spatial-stage-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  perspective: calc(1200 * var(--u));
  perspective-origin: 50% 54%;
  transform-style: preserve-3d;
}

/* ============================================================================
   ZONES B & C: VISION 360 3D SPATIAL GLASS SIDEBARS (5-LAYER MATERIAL, AUTO-HEIGHT)
   ============================================================================ */
.vision-panel {
  position: absolute;
  pointer-events: auto;
  height: auto;
  border-radius: calc(28 * var(--u));
  background: var(--panel-bg);
  backdrop-filter: blur(26px) saturate(165%) brightness(1.04);
  -webkit-backdrop-filter: blur(26px) saturate(165%) brightness(1.04);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--panel-glow);
  transform-style: preserve-3d;
  will-change: transform, box-shadow;
  transition:
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.32s ease;
}

/* Variable-Intensity Edge Lighting (Brightest at top-outer corners & inner bevels, NOT uniform neon) */
.vision-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: calc(2.2 * var(--u));
  pointer-events: none;
  z-index: 4;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

/* --- DARK MODE SIDEBAR GEOMETRY & 5-LAYER GLASS (Auto-fitting height, variable rim light) --- */
body.theme-dark .panel-left {
  left: clamp(22px, calc(44 * var(--ux)), 52px);
  top: clamp(66px, calc(108 * var(--uy)), 116px);
  width: clamp(336px, calc(486 * var(--ux)), 496px);
  height: auto;
  transform-origin: left center;
  transform:
    perspective(calc(1160 * var(--u)))
    rotateY(calc(15deg + var(--ry, 0deg)))
    rotateX(calc(2.4deg + var(--rx, 0deg)))
    rotateZ(-0.8deg)
    skewY(2.8deg)
    translate3d(var(--px, 0px), var(--py, 0px), 0);
  background: linear-gradient(155deg, rgba(16, 34, 82, 0.76) 0%, rgba(7, 16, 44, 0.86) 52%, rgba(14, 28, 72, 0.80) 100%);
  box-shadow:
    0 30px 68px rgba(2, 6, 24, 0.86),
    -6px 8px 30px rgba(0, 229, 255, 0.28),
    inset 0 2px 4px rgba(255, 255, 255, 0.52),
    inset 0 -10px 24px rgba(0, 210, 255, 0.14);
}

body.theme-dark .panel-left::before {
  background: linear-gradient(
    138deg,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(0, 242, 255, 0.92) 18%,
    rgba(0, 195, 255, 0.22) 48%,
    rgba(120, 220, 255, 0.16) 72%,
    rgba(0, 240, 255, 0.86) 100%
  );
}

body.theme-dark .panel-right {
  right: clamp(22px, calc(44 * var(--ux)), 52px);
  top: clamp(66px, calc(108 * var(--uy)), 116px);
  width: clamp(336px, calc(486 * var(--ux)), 496px);
  height: auto;
  transform-origin: right center;
  transform:
    perspective(calc(1160 * var(--u)))
    rotateY(calc(-15deg + var(--ry, 0deg)))
    rotateX(calc(2.4deg + var(--rx, 0deg)))
    rotateZ(0.8deg)
    skewY(-2.8deg)
    translate3d(var(--px, 0px), var(--py, 0px), 0);
  background: linear-gradient(205deg, rgba(22, 32, 84, 0.76) 0%, rgba(8, 16, 46, 0.86) 52%, rgba(20, 26, 74, 0.80) 100%);
  box-shadow:
    0 30px 68px rgba(2, 6, 24, 0.86),
    6px 8px 30px rgba(168, 85, 247, 0.28),
    inset 0 2px 4px rgba(255, 255, 255, 0.52),
    inset 0 -10px 24px rgba(168, 85, 247, 0.14);
}

body.theme-dark .panel-right::before {
  background: linear-gradient(
    222deg,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(232, 121, 249, 0.92) 18%,
    rgba(139, 92, 246, 0.22) 48%,
    rgba(56, 189, 248, 0.18) 72%,
    rgba(0, 240, 255, 0.86) 100%
  );
}

/* Layer 3: Extruded 3D Glass Thickness Slab (Thick Bevel + Volumetric Refraction) */
.panel-glass-slab {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
  transition: inset 0.42s cubic-bezier(0.22, 1, 0.36, 1), border-width 0.38s ease, box-shadow 0.38s ease;
}

body.theme-dark .panel-left .panel-glass-slab {
  inset: calc(-2 * var(--u)) calc(4 * var(--u)) calc(-9 * var(--u)) calc(-11 * var(--u));
  border-radius: calc(30 * var(--u));
  background: linear-gradient(160deg, rgba(0, 235, 255, 0.18) 0%, rgba(6, 16, 44, 0.55) 60%);
  border-left: calc(5 * var(--u)) solid rgba(200, 252, 255, 0.92);
  border-bottom: calc(4 * var(--u)) solid rgba(0, 229, 255, 0.78);
  box-shadow: -8px 12px 28px rgba(0, 215, 255, 0.34);
}

body.theme-dark .panel-right .panel-glass-slab {
  inset: calc(-2 * var(--u)) calc(-11 * var(--u)) calc(-9 * var(--u)) calc(4 * var(--u));
  border-radius: calc(30 * var(--u));
  background: linear-gradient(200deg, rgba(217, 70, 239, 0.18) 0%, rgba(10, 16, 48, 0.55) 60%);
  border-right: calc(5 * var(--u)) solid rgba(248, 208, 255, 0.92);
  border-bottom: calc(4 * var(--u)) solid rgba(0, 229, 255, 0.78);
  box-shadow: 8px 12px 28px rgba(192, 100, 255, 0.34);
}

/* --- LIGHT MODE SIDEBAR GEOMETRY & 5-LAYER SPATIAL GLASS (Clear Outer Shell + Dark Translucent Interior) --- */
body.theme-light .panel-left {
  left: clamp(36px, calc(76 * var(--ux)), 86px);
  top: clamp(66px, calc(108 * var(--uy)), 116px);
  width: clamp(296px, calc(456 * var(--ux)), 464px);
  height: auto;
  transform-origin: top left;
  transform:
    perspective(calc(1240 * var(--u)))
    rotateY(calc(14deg + var(--ry, 0deg)))
    rotateX(calc(2deg + var(--rx, 0deg)))
    skewX(6deg)
    skewY(3.6deg)
    translate3d(var(--px, 0px), var(--py, 0px), 0);
  background: linear-gradient(154deg, rgba(28, 64, 68, 0.80) 0%, rgba(18, 44, 48, 0.86) 54%, rgba(26, 60, 64, 0.82) 100%);
  box-shadow:
    0 34px 68px rgba(8, 28, 30, 0.54),
    -10px 14px 34px rgba(130, 255, 235, 0.28),
    inset 0 2.5px 5px rgba(255, 255, 255, 0.85),
    inset 0 -10px 24px rgba(150, 255, 238, 0.22);
}

body.theme-light .panel-left::before {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(195, 255, 245, 0.92) 22%,
    rgba(140, 235, 220, 0.25) 52%,
    rgba(160, 245, 232, 0.30) 76%,
    rgba(225, 255, 250, 0.92) 100%
  );
}

body.theme-light .panel-right {
  right: clamp(36px, calc(76 * var(--ux)), 86px);
  top: clamp(66px, calc(108 * var(--uy)), 116px);
  width: clamp(296px, calc(456 * var(--ux)), 464px);
  height: auto;
  transform-origin: top right;
  transform:
    perspective(calc(1240 * var(--u)))
    rotateY(calc(-14deg + var(--ry, 0deg)))
    rotateX(calc(2deg + var(--rx, 0deg)))
    skewX(-6deg)
    skewY(-3.6deg)
    translate3d(var(--px, 0px), var(--py, 0px), 0);
  background: linear-gradient(206deg, rgba(28, 64, 68, 0.80) 0%, rgba(18, 44, 48, 0.86) 54%, rgba(26, 60, 64, 0.82) 100%);
  box-shadow:
    0 34px 68px rgba(8, 28, 30, 0.54),
    10px 14px 34px rgba(130, 255, 235, 0.28),
    inset 0 2.5px 5px rgba(255, 255, 255, 0.85),
    inset 0 -10px 24px rgba(150, 255, 238, 0.22);
}

body.theme-light .panel-right::before {
  background: linear-gradient(
    225deg,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(195, 255, 245, 0.92) 22%,
    rgba(140, 235, 220, 0.25) 52%,
    rgba(160, 245, 232, 0.30) 76%,
    rgba(225, 255, 250, 0.92) 100%
  );
}

/* Layer 3 in Light Mode: Thick 14px 3D Crystal-Jade Glass Slab Extrusion */
body.theme-light .panel-left .panel-glass-slab {
  inset: calc(2 * var(--u)) calc(6 * var(--u)) calc(-12 * var(--u)) calc(-14 * var(--u));
  border-radius: calc(30 * var(--u));
  background: linear-gradient(160deg, rgba(210, 255, 248, 0.34) 0%, rgba(20, 50, 54, 0.46) 65%);
  border-left: calc(11 * var(--u)) solid rgba(215, 255, 248, 0.86);
  border-bottom: calc(9 * var(--u)) solid rgba(180, 252, 240, 0.80);
  box-shadow:
    -8px 12px 28px rgba(110, 255, 232, 0.38),
    inset 2px -2px 6px rgba(255, 255, 255, 0.95);
}

body.theme-light .panel-right .panel-glass-slab {
  inset: calc(2 * var(--u)) calc(-14 * var(--u)) calc(-12 * var(--u)) calc(6 * var(--u));
  border-radius: calc(30 * var(--u));
  background: linear-gradient(200deg, rgba(210, 255, 248, 0.34) 0%, rgba(20, 50, 54, 0.46) 65%);
  border-right: calc(11 * var(--u)) solid rgba(215, 255, 248, 0.86);
  border-bottom: calc(9 * var(--u)) solid rgba(180, 252, 240, 0.80);
  box-shadow:
    8px 12px 28px rgba(110, 255, 232, 0.38),
    inset -2px -2px 6px rgba(255, 255, 255, 0.95);
}

/* --- HOVER INTERACTION ON SIDEBARS: Flatten to 2D Front-Facing & Lift with Subtle Cursor Parallax --- */
@media (min-width: 1181px) {
  body.theme-dark .panel-left:hover,
  body.theme-dark .panel-left.is-hovered,
  body.theme-dark .panel-right:hover,
  body.theme-dark .panel-right.is-hovered,
  body.theme-light .panel-left:hover,
  body.theme-light .panel-left.is-hovered,
  body.theme-light .panel-right:hover,
  body.theme-light .panel-right.is-hovered {
    z-index: 28;
    transform:
      perspective(calc(1200 * var(--u)))
      rotateY(var(--local-ry, 0deg))
      rotateX(var(--local-rx, 0deg))
      rotateZ(0deg)
      skewX(0deg)
      skewY(0deg)
      translate3d(0, calc(-5 * var(--u)), calc(22 * var(--u)))
      scale(1.018);
  }

  body.theme-dark .vision-panel:hover .panel-glass-inner,
  body.theme-dark .vision-panel.is-hovered .panel-glass-inner,
  body.theme-light .vision-panel:hover .panel-glass-inner,
  body.theme-light .vision-panel.is-hovered .panel-glass-inner {
    transform: translateZ(1px);
  }

  body.theme-dark .vision-panel:hover .panel-glass-slab,
  body.theme-dark .vision-panel.is-hovered .panel-glass-slab,
  body.theme-light .vision-panel:hover .panel-glass-slab,
  body.theme-light .vision-panel.is-hovered .panel-glass-slab {
    inset: calc(-4 * var(--u));
    border-width: calc(3.5 * var(--u));
  }
}

/* Layer 4: Environment Reflections, Specular Rim Highlights & Corner Lens Flares */
.panel-corner-flare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(132deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.05) 28%, transparent 52%),
    radial-gradient(circle at 3% 3%, rgba(255, 255, 255, 0.88) 0%, rgba(130, 250, 255, 0.38) 6%, transparent 16%),
    linear-gradient(0deg, rgba(120, 255, 240, 0.12) 0%, transparent 22%);
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.72),
    inset 2px 0 5px rgba(170, 252, 255, 0.42);
}

body.theme-dark .panel-right .panel-corner-flare,
body.theme-light .panel-right .panel-corner-flare {
  background:
    linear-gradient(228deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.05) 28%, transparent 52%),
    radial-gradient(circle at 97% 3%, rgba(255, 255, 255, 0.88) 0%, rgba(215, 242, 255, 0.38) 6%, transparent 16%),
    linear-gradient(0deg, rgba(140, 245, 255, 0.12) 0%, transparent 22%);
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.72),
    inset -2px 0 5px rgba(195, 238, 255, 0.42);
}

/* Counter-balanced Inner Content Layer for Crisp, Un-warped Readability */
.panel-glass-inner {
  position: relative;
  z-index: 3;
  width: 100%;
  height: auto;
  padding: clamp(16px, calc(22 * var(--uy)), 24px) clamp(18px, calc(26 * var(--ux)), 28px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
  transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

body.theme-dark .panel-left .panel-glass-inner {
  transform: skewY(-1.8deg) translateZ(1px);
}

body.theme-dark .panel-right .panel-glass-inner {
  transform: skewY(1.8deg) translateZ(1px);
}

body.theme-light .panel-left .panel-glass-inner {
  transform: skewX(-4deg) skewY(-2deg) translateZ(1px);
}

body.theme-light .panel-right .panel-glass-inner {
  transform: skewX(4deg) skewY(2deg) translateZ(1px);
}

/* --- LEFT PANEL INTERNAL TYPOGRAPHY & ITEMS (>= 44px touch targets, crisp un-skewed text) --- */
.panel-header-row {
  display: flex;
  align-items: center;
  gap: calc(12 * var(--u));
  padding-bottom: clamp(10px, calc(13 * var(--uy)), 15px);
  margin-bottom: clamp(6px, calc(8 * var(--uy)), 10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
}

.panel-sparkle-icon {
  width: clamp(22px, calc(28 * var(--u)), 29px);
  height: clamp(22px, calc(28 * var(--u)), 29px);
  color: #5CE1FF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.6));
}

body.theme-light .panel-sparkle-icon {
  color: #B6FFF2;
  filter: drop-shadow(0 0 8px rgba(150, 255, 235, 0.8));
}

.panel-title {
  font-size: clamp(18px, calc(24 * var(--u)), 25px);
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.01em;
  flex: 1;
  text-shadow: 0 2px 10px rgba(0, 12, 28, 0.45);
}

.panel-chevron {
  font-size: clamp(18px, calc(24 * var(--u)), 25px);
  color: rgba(255, 255, 255, 0.84);
  font-weight: 500;
}

.adaptive-items-list {
  display: flex;
  flex-direction: column;
  gap: clamp(4px, calc(5 * var(--uy)), 6px);
}

.adaptive-item-btn {
  display: flex;
  align-items: center;
  gap: clamp(10px, calc(14 * var(--u)), 15px);
  width: 100%;
  min-height: clamp(44px, calc(52 * var(--uy)), 56px);
  padding: clamp(7px, calc(9 * var(--uy)), 11px) clamp(8px, calc(10 * var(--ux)), 12px);
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  text-align: left;
  cursor: pointer;
  border-radius: calc(10 * var(--u));
  transition: background 0.18s ease, transform 0.18s ease;
}

.adaptive-item-btn:last-child {
  border-bottom: none;
}

.adaptive-item-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateX(calc(4 * var(--u)));
}

.adaptive-item-icon {
  width: clamp(30px, calc(36 * var(--u)), 37px);
  height: clamp(30px, calc(36 * var(--u)), 37px);
  border-radius: calc(10 * var(--u));
  background: rgba(0, 210, 255, 0.16);
  border: 1px solid rgba(130, 238, 255, 0.45);
  color: #6CEEFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: clamp(13px, calc(15.5 * var(--u)), 16px);
}

.adaptive-item-icon svg {
  width: 58%;
  height: 58%;
}

body.theme-light .adaptive-item-icon {
  background: rgba(170, 255, 242, 0.22);
  border-color: rgba(220, 255, 250, 0.68);
  color: #FFFFFF;
}

.adaptive-item-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(2px, calc(3 * var(--uy)), 4px);
}

.adaptive-item-title {
  font-size: clamp(13.5px, calc(16.5 * var(--u)), 17px);
  font-weight: 600;
  line-height: 1.28;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adaptive-item-sub {
  font-size: clamp(11.5px, calc(13.2 * var(--u)), 13.8px);
  line-height: 1.25;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* In Dark mode, when recent chats block is visible below primary items, keep primary items single-line like Reference */
body.theme-dark .has-recent-block .adaptive-item-sub {
  display: none;
}

body.theme-dark .has-recent-block .adaptive-item-btn {
  min-height: clamp(38px, calc(42 * var(--uy)), 45px);
  padding: clamp(5px, calc(6.5 * var(--uy)), 8px) calc(6 * var(--u));
}

.adaptive-item-arrow {
  font-size: clamp(15px, calc(19 * var(--u)), 20px);
  color: rgba(255, 255, 255, 0.72);
  margin-left: calc(4 * var(--u));
}

/* Recent Conversations Sub-block inside Left Panel */
.adaptive-recent-block {
  margin-top: clamp(8px, calc(10 * var(--uy)), 12px);
  padding-top: clamp(8px, calc(10 * var(--uy)), 12px);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  display: flex;
  flex-direction: column;
  gap: clamp(4px, calc(6 * var(--uy)), 7px);
}

.recent-header-row {
  display: flex;
  align-items: center;
  gap: calc(10 * var(--u));
  margin-bottom: calc(3 * var(--u));
}

.recent-chat-icon {
  width: clamp(18px, calc(22 * var(--u)), 23px);
  height: clamp(18px, calc(22 * var(--u)), 23px);
  color: #5CE1FF;
  display: inline-flex;
  align-items: center;
}

.recent-heading {
  font-size: clamp(14.5px, calc(18 * var(--u)), 18.5px);
  font-weight: 700;
  color: #FFFFFF;
  flex: 1;
}

.recent-see-all {
  background: none;
  border: none;
  color: #7CE8FF;
  font-size: clamp(12px, calc(13.5 * var(--u)), 14px);
  font-weight: 600;
  cursor: pointer;
}

.adaptive-recent-list {
  display: flex;
  flex-direction: column;
  gap: calc(3 * var(--u));
}

.recent-chat-row {
  display: flex;
  align-items: center;
  gap: calc(10 * var(--u));
  width: 100%;
  min-height: clamp(34px, calc(38 * var(--uy)), 40px);
  padding: calc(5 * var(--uy)) calc(6 * var(--ux));
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: clamp(12.5px, calc(14.5 * var(--u)), 15px);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  border-radius: calc(8 * var(--u));
}

.recent-chat-row:last-child {
  border-bottom: none;
}

.recent-chat-row:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

.recent-row-dot {
  width: clamp(18px, calc(22 * var(--u)), 23px);
  height: clamp(18px, calc(22 * var(--u)), 23px);
  border-radius: calc(6 * var(--u));
  background: rgba(0, 210, 255, 0.16);
  color: #68E8FF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: calc(12 * var(--u));
  flex-shrink: 0;
}

.recent-row-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* --- RIGHT PANEL (YUB STATUS & TOKEN QUOTA — Auto-fitting height, no empty bottom gap) --- */
.status-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: clamp(8px, calc(11 * var(--uy)), 13px);
}

.status-title-group {
  display: flex;
  align-items: center;
  gap: calc(10 * var(--u));
}

.status-cube-icon {
  width: clamp(21px, calc(26 * var(--u)), 27px);
  height: clamp(21px, calc(26 * var(--u)), 27px);
  color: #5CE1FF;
  display: inline-flex;
  align-items: center;
}

body.theme-light .status-cube-icon {
  color: #B4FFF0;
}

.status-bars-decor {
  display: flex;
  align-items: flex-end;
  gap: calc(4 * var(--u));
  height: clamp(18px, calc(22 * var(--u)), 23px);
}

.status-bars-decor span {
  width: calc(4 * var(--u));
  border-radius: calc(2 * var(--u));
  background: linear-gradient(180deg, #00F0FF, #38BDF8);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.65);
}

.status-bars-decor span:nth-child(1) { height: 35%; }
.status-bars-decor span:nth-child(2) { height: 52%; }
.status-bars-decor span:nth-child(3) { height: 68%; }
.status-bars-decor span:nth-child(4) { height: 84%; }
.status-bars-decor span:nth-child(5) { height: 100%; }

.status-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: clamp(10px, calc(14 * var(--uy)), 16px);
  margin-bottom: clamp(10px, calc(14 * var(--uy)), 16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.status-ready-pill {
  display: inline-flex;
  align-items: center;
  gap: calc(9 * var(--u));
  padding: clamp(5px, calc(7 * var(--uy)), 8px) clamp(14px, calc(18 * var(--ux)), 20px);
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.24);
  border: 1.5px solid rgba(52, 211, 153, 0.72);
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.30);
  font-size: clamp(13px, calc(15.5 * var(--u)), 16px);
  font-weight: 600;
  color: #FFFFFF;
}

.status-mint-dot {
  width: clamp(8px, calc(10 * var(--u)), 11px);
  height: clamp(8px, calc(10 * var(--u)), 11px);
  border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 10px #34D399;
}

.status-mint-dot.busy {
  background: #FBBF24;
  box-shadow: 0 0 10px #FBBF24;
}

.status-mint-dot.offline {
  background: #F87171;
  box-shadow: 0 0 10px #F87171;
}

.quota-section {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, calc(11 * var(--uy)), 13px);
}

.quota-label-row {
  display: flex;
  align-items: center;
  gap: calc(10 * var(--u));
  font-size: clamp(13.5px, calc(16 * var(--u)), 16.5px);
  font-weight: 600;
  color: var(--text-secondary);
}

.quota-layers-icon {
  width: clamp(18px, calc(22 * var(--u)), 23px);
  height: clamp(18px, calc(22 * var(--u)), 23px);
  color: #5CE1FF;
  display: inline-flex;
}

.quota-headline {
  font-size: clamp(20px, calc(26 * var(--u)), 27px);
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.01em;
}

.quota-bar-wrap {
  display: flex;
  align-items: center;
  gap: calc(12 * var(--u));
}

.quota-track {
  flex: 1;
  height: clamp(10px, calc(13 * var(--uy)), 14px);
  border-radius: 999px;
  background: rgba(8, 18, 42, 0.58);
  border: 1px solid rgba(160, 230, 255, 0.38);
  overflow: hidden;
  padding: calc(1.5 * var(--u));
}

body.theme-light .quota-track {
  background: rgba(18, 44, 48, 0.48);
  border-color: rgba(195, 255, 245, 0.58);
}

.quota-fill {
  height: 100%;
  width: 4%;
  min-width: calc(14 * var(--u));
  border-radius: 999px;
  background: linear-gradient(90deg, #00F5D4, #00E5FF);
  box-shadow: 0 0 12px #00F5D4;
  transition: width 0.35s ease;
}

.quota-percent-label {
  font-size: clamp(12px, calc(13.5 * var(--u)), 14px);
  font-weight: 700;
  color: var(--text-secondary);
}

.quota-details-list {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, calc(9 * var(--uy)), 10px);
  padding-top: clamp(4px, calc(6 * var(--uy)), 8px);
  padding-bottom: clamp(8px, calc(12 * var(--uy)), 14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.quota-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: clamp(13px, calc(15.5 * var(--u)), 16px);
}

.detail-label {
  display: inline-flex;
  align-items: center;
  gap: calc(9 * var(--u));
  color: var(--text-secondary);
}

.dot-indicator {
  width: clamp(7px, calc(9 * var(--u)), 10px);
  height: clamp(7px, calc(9 * var(--u)), 10px);
  border-radius: 50%;
  display: inline-block;
}

.dot-indicator.used {
  background: #34D399;
  box-shadow: 0 0 8px #34D399;
}

.dot-indicator.remaining {
  background: #38BDF8;
  box-shadow: 0 0 8px #38BDF8;
}

.quota-renew-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: clamp(12.5px, calc(15 * var(--u)), 15.5px);
  color: var(--text-secondary);
  padding-top: clamp(2px, calc(4 * var(--uy)), 6px);
}

.renew-label {
  display: inline-flex;
  align-items: center;
  gap: calc(8 * var(--u));
}

.renew-label svg {
  width: clamp(14px, calc(17 * var(--u)), 18px);
  height: clamp(14px, calc(17 * var(--u)), 18px);
}

/* ============================================================================
   ZONE D: CENTRAL 3D CRYSTAL YUB ORB, GREETING & 3 HORIZONTAL SUGGESTION CHIPS
   ============================================================================ */
.center-orb-zone {
  position: absolute;
  left: 50%;
  top: clamp(60px, calc(92 * var(--uy)), 98px);
  transform: translateX(-50%);
  width: clamp(740px, calc(1140 * var(--ux)), 1160px);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  z-index: 15;
}

.yub-orb-wrapper {
  position: relative;
  width: clamp(212px, calc(326 * var(--uy)), 336px);
  height: clamp(220px, calc(338 * var(--uy)), 348px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
}

/* Real-time 60 FPS Outer HUD Rings Canvas (Positioned so outer arcs never clip top header) */
.orb-hud-canvas {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  width: clamp(460px, calc(730 * var(--uy)), 750px);
  height: clamp(256px, calc(412 * var(--uy)), 424px);
  pointer-events: none;
  z-index: 1;
}

.holo-ring {
  display: none;
}

.yub-orb-sphere {
  position: relative;
  width: clamp(208px, calc(320 * var(--uy)), 330px);
  height: clamp(208px, calc(320 * var(--uy)), 330px);
  border-radius: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
}

/* Volumetric Ambient Light Pool beneath the 3D Crystal Orb */
.yub-orb-sphere::after {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: calc(-18 * var(--u));
  height: calc(36 * var(--u));
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 240, 255, 0.52) 0%, rgba(217, 70, 239, 0.24) 52%, transparent 78%);
  filter: blur(12px);
  pointer-events: none;
  z-index: -1;
}

body.theme-light .yub-orb-sphere::after {
  background: radial-gradient(ellipse at center, rgba(160, 255, 242, 0.62) 0%, rgba(72, 210, 192, 0.28) 54%, transparent 78%);
}

@keyframes orbBreath {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.022) translateY(calc(-3 * var(--u))); }
}

.orb-crystal-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 16px 38px rgba(0, 10, 32, 0.65)) drop-shadow(0 0 24px rgba(0, 229, 255, 0.28));
}

body.theme-light .orb-crystal-img {
  filter: drop-shadow(0 18px 40px rgba(10, 44, 46, 0.48)) drop-shadow(0 0 30px rgba(155, 255, 240, 0.42));
}

.orb-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  mix-blend-mode: screen;
  pointer-events: none;
}

/* Curved Glass Outer Shell Specular Rim & Top Dome Reflection */
.orb-glass-specular {
  position: absolute;
  inset: calc(3 * var(--u));
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(120% 85% at 32% 16%, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0.08) 26%, transparent 48%),
    radial-gradient(circle at 78% 82%, rgba(160, 255, 245, 0.22) 0%, transparent 32%);
  box-shadow:
    inset 0 2.5px 8px rgba(255, 255, 255, 0.68),
    inset 0 -3px 10px rgba(120, 245, 255, 0.36);
}

.orb-brand-name {
  position: relative;
  z-index: 4;
  margin-top: clamp(-38px, calc(-52 * var(--uy)), -56px);
  font-size: clamp(36px, calc(54 * var(--u)), 56px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  text-shadow:
    0 4px 18px rgba(0, 6, 24, 0.88),
    0 0 26px rgba(0, 229, 255, 0.45);
}

body.theme-dark .orb-brand-name {
  text-transform: lowercase;
}

body.theme-light .orb-brand-name {
  margin-top: clamp(-10px, calc(-12 * var(--uy)), -14px);
  text-shadow:
    0 4px 16px rgba(10, 42, 44, 0.62),
    0 0 22px rgba(180, 255, 244, 0.52);
}

/* --- GREETING & SUBTITLE --- */
.hero-copy {
  margin-top: clamp(4px, calc(6 * var(--uy)), 8px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(4px, calc(7 * var(--uy)), 9px);
  z-index: 4;
}

.hero-greeting {
  font-size: clamp(24px, calc(37 * var(--u)), 39px);
  font-weight: 800;
  letter-spacing: -0.015em;
  color: #FFFFFF;
  text-shadow: 0 4px 22px rgba(0, 10, 28, 0.78);
}

body.theme-dark .yub-gradient-word {
  background: linear-gradient(90deg, #00F0FF 0%, #60A5FA 45%, #FF55C8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(0, 229, 255, 0.38));
}

body.theme-light .yub-gradient-word {
  color: #FFFFFF;
}

.hero-subtitle {
  font-size: clamp(13px, calc(18.5 * var(--u)), 19px);
  font-weight: 500;
  color: var(--text-secondary);
  text-shadow: 0 2px 14px rgba(0, 10, 24, 0.68);
}

/* --- 3 HORIZONTAL SUGGESTION CHIPS (Never stack vertically on desktop) --- */
.hero-quick-pills {
  pointer-events: auto;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: center;
  z-index: 5;
}

body.theme-dark .hero-quick-pills {
  margin-top: clamp(12px, calc(20 * var(--uy)), 24px);
  gap: clamp(12px, calc(20 * var(--ux)), 22px);
  width: clamp(540px, calc(808 * var(--ux)), 824px);
}

body.theme-light .hero-quick-pills {
  margin-top: clamp(14px, calc(24 * var(--uy)), 28px);
  gap: clamp(16px, calc(28 * var(--ux)), 32px);
  width: clamp(720px, calc(1108 * var(--ux)), 1128px);
}

.quick-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(12 * var(--u));
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1.6px solid var(--pill-border);
  box-shadow: var(--pill-shadow);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  color: #FFFFFF;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

body.theme-dark .quick-pill {
  width: clamp(172px, calc(256 * var(--ux)), 262px);
  min-height: clamp(50px, calc(68 * var(--uy)), 72px);
  padding: clamp(7px, calc(10 * var(--uy)), 12px) clamp(12px, calc(18 * var(--ux)), 20px);
  font-size: clamp(12px, calc(15 * var(--u)), 15.5px);
  line-height: 1.28;
  text-align: left;
}

body.theme-light .quick-pill {
  height: clamp(44px, calc(54 * var(--uy)), 56px);
  padding: 0 clamp(16px, calc(25 * var(--ux)), 28px);
  font-size: clamp(12.5px, calc(16 * var(--u)), 16.5px);
  white-space: nowrap;
}

.quick-pill:hover {
  transform: translateY(calc(-2 * var(--u)));
  border-color: #FFFFFF;
}

.pill-icon {
  width: clamp(18px, calc(25 * var(--u)), 26px);
  height: clamp(18px, calc(25 * var(--u)), 26px);
  color: #5CE1FF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.theme-light .pill-icon {
  color: #B4FFF2;
}

.pill-icon svg {
  width: 100%;
  height: 100%;
}

/* ============================================================================
   ZONE E: FIVE FEATURE CARDS (Translucent 3D Glassmorphism + Top Specular Bar)
   ============================================================================ */
.feature-cards-zone {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  pointer-events: auto;
  z-index: 16;
}

body.theme-dark .feature-cards-zone {
  bottom: clamp(106px, calc(168 * var(--uy)), 176px);
  width: clamp(920px, calc(1462 * var(--ux)), 1480px);
  height: clamp(114px, calc(158 * var(--uy)), 164px);
  gap: clamp(12px, calc(20 * var(--ux)), 22px);
}

body.theme-light .feature-cards-zone {
  bottom: clamp(106px, calc(170 * var(--uy)), 178px);
  width: clamp(910px, calc(1440 * var(--ux)), 1460px);
  height: clamp(114px, calc(156 * var(--uy)), 162px);
  gap: clamp(12px, calc(19 * var(--ux)), 21px);
}

.feature-card {
  position: relative;
  border-radius: calc(24 * var(--u));
  padding: clamp(12px, calc(18 * var(--uy)), 20px) clamp(10px, calc(15 * var(--ux)), 16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(5px, calc(8 * var(--uy)), 9px);
  text-align: center;
  color: #FFFFFF;
  cursor: pointer;
  backdrop-filter: blur(24px) saturate(165%);
  -webkit-backdrop-filter: blur(24px) saturate(165%);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  overflow: hidden;
}

/* Crisp Top-Edge Specular Reflection Bar on all 5 Feature Cards */
.feature-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16%;
  right: 16%;
  height: calc(2.5 * var(--u));
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.96), transparent);
  pointer-events: none;
}

/* --- DARK MODE FEATURE CARDS: Translucent Deep-Navy Glassmorphism + Thin Reflective Rim --- */
body.theme-dark .feature-card {
  background: linear-gradient(180deg, rgba(16, 34, 82, 0.56) 0%, rgba(8, 16, 44, 0.68) 100%);
  border: 1.4px solid rgba(0, 229, 255, 0.52);
  box-shadow:
    0 20px 44px rgba(2, 6, 24, 0.78),
    inset 0 1.5px 3px rgba(255, 255, 255, 0.42),
    inset 0 -4px 12px rgba(0, 210, 255, 0.16);
}

body.theme-dark .feature-card:nth-child(1) {
  background: linear-gradient(180deg, rgba(0, 195, 255, 0.22) 0%, rgba(10, 22, 58, 0.66) 62%, rgba(8, 16, 44, 0.72) 100%);
  border-color: rgba(0, 238, 255, 0.72);
  box-shadow: 0 20px 42px rgba(2, 6, 24, 0.78), 0 -4px 20px rgba(0, 229, 255, 0.28), inset 0 1.5px 3px rgba(190, 252, 255, 0.62);
}

body.theme-dark .feature-card:nth-child(2) {
  background: linear-gradient(180deg, rgba(0, 235, 215, 0.20) 0%, rgba(10, 24, 58, 0.66) 62%, rgba(8, 16, 44, 0.72) 100%);
  border-color: rgba(45, 245, 220, 0.70);
  box-shadow: 0 20px 42px rgba(2, 6, 24, 0.78), 0 -4px 20px rgba(0, 245, 212, 0.26), inset 0 1.5px 3px rgba(190, 255, 245, 0.62);
}

body.theme-dark .feature-card:nth-child(3) {
  background: linear-gradient(180deg, rgba(217, 70, 239, 0.24) 0%, rgba(18, 18, 58, 0.66) 62%, rgba(10, 14, 44, 0.72) 100%);
  border-color: rgba(232, 121, 249, 0.72);
  box-shadow: 0 20px 42px rgba(2, 6, 24, 0.78), 0 -4px 20px rgba(217, 70, 239, 0.28), inset 0 1.5px 3px rgba(250, 205, 255, 0.62);
}

body.theme-dark .feature-card:nth-child(4) {
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.22) 0%, rgba(16, 18, 58, 0.66) 62%, rgba(10, 14, 44, 0.72) 100%);
  border-color: rgba(192, 132, 252, 0.70);
  box-shadow: 0 20px 42px rgba(2, 6, 24, 0.78), 0 -4px 20px rgba(168, 85, 247, 0.26), inset 0 1.5px 3px rgba(235, 205, 255, 0.60);
}

body.theme-dark .feature-card:nth-child(5) {
  background: linear-gradient(180deg, rgba(244, 114, 182, 0.24) 0%, rgba(22, 18, 58, 0.66) 62%, rgba(12, 14, 44, 0.72) 100%);
  border-color: rgba(251, 146, 200, 0.72);
  box-shadow: 0 20px 42px rgba(2, 6, 24, 0.78), 0 -4px 20px rgba(244, 114, 182, 0.28), inset 0 1.5px 3px rgba(255, 215, 238, 0.65);
}

/* --- LIGHT MODE FEATURE CARDS: 3D Translucent Crystal Glass with Top Highlight & Bottom Mint Reflection --- */
body.theme-light .feature-card {
  background: linear-gradient(
    165deg,
    rgba(110, 178, 176, 0.48) 0%,
    rgba(32, 72, 76, 0.66) 68%,
    rgba(96, 176, 166, 0.62) 100%
  );
  border: calc(1.8 * var(--u)) solid rgba(220, 255, 248, 0.86);
  box-shadow:
    0 22px 46px rgba(8, 30, 32, 0.46),
    0 4px 22px rgba(135, 255, 235, 0.24),
    inset 0 2.5px 4px rgba(255, 255, 255, 0.90),
    inset 0 -6px 14px rgba(165, 255, 242, 0.52);
}

.feature-card:hover {
  transform: translateY(calc(-4 * var(--u)));
}

.fc-icon {
  width: clamp(26px, calc(36 * var(--u)), 37px);
  height: clamp(26px, calc(36 * var(--u)), 37px);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 8px rgba(0, 229, 255, 0.35));
}

.fc-icon svg {
  width: 100%;
  height: 100%;
}

.fc-title {
  font-size: clamp(15px, calc(21 * var(--u)), 21.5px);
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.01em;
}

.fc-desc {
  font-size: clamp(11.5px, calc(14 * var(--u)), 14.5px);
  color: var(--text-secondary);
}

.feature-card-more .fc-desc {
  display: none;
}

.feature-card-more .fc-title {
  margin-top: calc(4 * var(--u));
  display: inline-flex;
  align-items: center;
  gap: calc(10 * var(--u));
}

.fc-arrow {
  font-size: clamp(18px, calc(24 * var(--u)), 25px);
  font-weight: 500;
}

/* ============================================================================
   ZONE F: BOTTOM COMPOSER BAR (Anchored near bottom on BOTH 1248x800 & 1920x1080)
   ============================================================================ */
.composer-zone {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 65;
  pointer-events: auto;
}

body.theme-dark .composer-zone {
  bottom: clamp(18px, calc(46 * var(--uy)), 50px);
  width: clamp(960px, calc(1532 * var(--ux)), 1548px);
}

body.theme-light .composer-zone {
  bottom: clamp(18px, calc(48 * var(--uy)), 52px);
  width: clamp(950px, calc(1504 * var(--ux)), 1520px);
}

body.in-conversation .composer-zone {
  top: auto;
  bottom: clamp(16px, calc(30 * var(--uy)), 36px);
  width: min(calc(1324 * var(--ux)), 88vw);
}

body.in-conversation .yub-composer {
  height: clamp(66px, calc(86 * var(--uy)), 90px);
  box-shadow:
    0 0 0 calc(5 * var(--u)) rgba(185, 255, 245, 0.14),
    0 0 0 calc(6.5 * var(--u)) rgba(220, 255, 250, 0.36),
    var(--composer-shadow);
}

body.theme-dark.in-conversation .yub-composer {
  box-shadow:
    0 0 0 calc(5 * var(--u)) rgba(56, 220, 255, 0.10),
    0 0 0 calc(6.5 * var(--u)) rgba(110, 230, 255, 0.32),
    var(--composer-shadow);
}

.yub-composer {
  position: relative;
  width: 100%;
  height: clamp(68px, calc(96 * var(--uy)), 98px);
  border-radius: 999px;
  padding: 0 clamp(14px, calc(20 * var(--ux)), 22px);
  display: flex;
  align-items: center;
  gap: clamp(12px, calc(18 * var(--ux)), 20px);
  background: var(--composer-bg);
  border: calc(2 * var(--u)) solid var(--composer-border);
  box-shadow: var(--composer-shadow);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  overflow: hidden;
}

.siri-wave-canvas {
  position: absolute;
  left: 24%;
  top: 0;
  width: 58%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: screen;
}

.composer-plus-btn {
  position: relative;
  z-index: 2;
  width: calc(58 * var(--u));
  height: calc(58 * var(--u));
  border-radius: 50%;
  border: 1.6px solid rgba(150, 235, 255, 0.68);
  background: radial-gradient(circle at 30% 30%, rgba(0, 210, 255, 0.26), rgba(14, 28, 68, 0.72));
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 0 18px rgba(0, 210, 255, 0.32), inset 0 1px 2px rgba(255, 255, 255, 0.45);
  transition: transform 0.2s ease;
}

body.theme-light .composer-plus-btn {
  border-color: rgba(210, 255, 248, 0.85);
  background: radial-gradient(circle at 30% 30%, rgba(160, 255, 240, 0.35), rgba(38, 82, 86, 0.68));
  box-shadow: 0 0 18px rgba(140, 255, 235, 0.35), inset 0 1.5px 2px rgba(255, 255, 255, 0.65);
}

.composer-plus-btn:hover {
  transform: scale(1.05);
}

.composer-plus-btn svg {
  width: calc(25 * var(--u));
  height: calc(25 * var(--u));
  pointer-events: none;
}

#prompt {
  position: relative;
  z-index: 2;
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: #FFFFFF;
  font-size: calc(20 * var(--u));
  font-weight: 500;
  line-height: 1.4;
  max-height: calc(72 * var(--u));
  overflow-y: hidden;
  scrollbar-width: none;
  user-select: text;
}

#prompt::-webkit-scrollbar {
  display: none;
}

#prompt::placeholder {
  color: rgba(235, 245, 255, 0.84);
}

.composer-right-tools {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: calc(14 * var(--u));
}

.composer-icon-btn {
  width: calc(44 * var(--u));
  height: calc(44 * var(--u));
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(235, 246, 255, 0.88);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  transition: color 0.2s ease, transform 0.2s ease;
}

.composer-icon-btn svg {
  width: calc(25 * var(--u));
  height: calc(25 * var(--u));
  pointer-events: none;
}

.composer-icon-btn:hover {
  color: #FFFFFF;
  transform: scale(1.08);
}

.composer-send-btn {
  width: calc(60 * var(--u));
  height: calc(60 * var(--u));
  border-radius: 50%;
  border: 1.6px solid rgba(255, 255, 255, 0.72);
  background: var(--send-btn-bg);
  box-shadow: var(--send-btn-shadow);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.composer-send-btn:hover {
  transform: scale(1.06);
  filter: brightness(1.08);
}

.composer-send-btn svg {
  width: calc(26 * var(--u));
  height: calc(26 * var(--u));
}

.composer-stop-btn {
  padding: calc(8 * var(--u)) calc(16 * var(--u));
  border-radius: 999px;
  border: 1px solid rgba(248, 113, 113, 0.7);
  background: rgba(239, 68, 68, 0.25);
  color: #FFFFFF;
  font-size: calc(14 * var(--u));
  font-weight: 600;
  cursor: pointer;
}

/* Quote Composer Banner above Input Bar */
.quote-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 clamp(14px, calc(22 * var(--ux)), 26px) 8px;
  padding: 8px 14px;
  border-radius: 16px;
  background: linear-gradient(155deg, rgba(28, 74, 78, 0.88), rgba(18, 48, 52, 0.92));
  border: 1.4px solid rgba(175, 255, 244, 0.65);
  border-left: 4px solid #5CE6CD;
  box-shadow: 0 12px 28px rgba(4, 18, 24, 0.45), inset 0 1px 2px rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

body.theme-dark .quote-banner {
  background: linear-gradient(155deg, rgba(16, 34, 78, 0.90), rgba(10, 20, 52, 0.94));
  border-color: rgba(86, 225, 255, 0.58);
  border-left-color: #00F0FF;
}

.quote-banner-icon {
  width: 24px;
  height: 24px;
  color: #74FFEB;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.theme-dark .quote-banner-icon {
  color: #5CE1FF;
}

.quote-banner-icon svg {
  width: 18px;
  height: 18px;
}

.quote-banner-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quote-banner-label {
  font-size: 12px;
  font-weight: 700;
  color: #8CFFF0;
  letter-spacing: 0.01em;
}

body.theme-dark .quote-banner-label {
  color: #6CEEFF;
}

.quote-banner-text {
  font-size: 13.5px;
  color: rgba(240, 255, 253, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quote-banner-close {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.16s ease, transform 0.16s ease;
}

.quote-banner-close:hover {
  background: rgba(255, 107, 139, 0.32);
  transform: scale(1.06);
}

/* Floating Text Selection Quote/Copy Popover */
.selection-quote-popover {
  position: fixed;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(12, 34, 42, 0.94);
  border: 1.4px solid rgba(175, 255, 244, 0.72);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55), 0 0 18px rgba(92, 230, 205, 0.28);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

body.theme-dark .selection-quote-popover {
  background: rgba(10, 22, 56, 0.95);
  border-color: rgba(88, 228, 255, 0.68);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65), 0 0 18px rgba(0, 229, 255, 0.28);
}

.sel-pop-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.sel-pop-btn svg {
  width: 15px;
  height: 15px;
}

.sel-pop-btn.primary {
  background: linear-gradient(135deg, #74FFEB, #24D2B5);
  color: #053330;
}

.sel-pop-btn:hover {
  filter: brightness(1.08);
}

.attachment-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 0 clamp(14px, calc(20 * var(--u)), 24px);
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 14px;
  background: var(--pill-bg);
  border: 1.2px solid var(--pill-border);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-size: clamp(12px, calc(13.5 * var(--u)), 14px);
  font-weight: 500;
  color: #FFFFFF;
  max-width: 260px;
}

.attachment-chip.is-image-chip {
  padding: 5px 10px 5px 6px;
}

.att-chip-thumb {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.45);
  cursor: zoom-in;
  flex-shrink: 0;
}

.att-chip-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.att-chip-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.att-chip-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.att-chip-size {
  font-size: 11px;
  color: var(--text-secondary);
}

.history-nav-chip {
  border-radius: 999px;
  max-width: none;
  opacity: 0.94;
}

.attachment-chip button,
.att-chip-remove {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
  border: none;
  color: #FF8FA3;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.att-chip-remove:hover {
  background: rgba(255, 107, 139, 0.28);
  color: #FFFFFF;
}

/* Message Bubble Attachments (Images & Files) */
.msg-attachments-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

.msg-bubble > .msg-attachments-wrap:has(+ .msg-content.hidden) {
  margin-bottom: 0;
}

.msg-images-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.msg-img-thumb-btn {
  padding: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.48);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  cursor: zoom-in;
  max-width: min(340px, 100%);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.msg-img-thumb-btn:hover {
  transform: scale(1.015);
  border-color: #FFFFFF;
}

.msg-img-thumb-btn img {
  display: block;
  max-width: 100%;
  max-height: 250px;
  width: auto;
  height: auto;
  object-fit: cover;
}

.msg-files-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.msg-file-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(6, 18, 42, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.32);
  max-width: 100%;
}

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

.msg-file-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.msg-file-meta strong {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-file-meta small {
  font-size: 11.5px;
  color: rgba(230, 246, 255, 0.82);
}

/* Drag & Drop Overlay */
.drop-zone-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(6, 20, 32, 0.68);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.drop-zone-card {
  padding: 36px 48px;
  border-radius: 28px;
  border: 2px dashed rgba(130, 255, 238, 0.88);
  background: rgba(18, 56, 62, 0.78);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(110, 255, 232, 0.28);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  color: #FFFFFF;
}

body.theme-dark .drop-zone-card {
  border-color: rgba(88, 228, 255, 0.85);
  background: rgba(12, 28, 70, 0.82);
}

.drop-zone-card svg {
  width: 48px;
  height: 48px;
  color: #74FFEB;
}

/* Fullscreen Image Lightbox */
.image-lightbox {
  z-index: 95;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
}

.lightbox-img {
  max-width: min(92vw, 1440px);
  max-height: 82vh;
  border-radius: 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.38);
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.75);
  object-fit: contain;
}

.lightbox-close-btn {
  position: fixed;
  top: 22px;
  right: 26px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.4px solid rgba(255, 255, 255, 0.45);
  background: rgba(10, 24, 42, 0.78);
  color: #FFFFFF;
  font-size: 18px;
  cursor: pointer;
}

.lightbox-caption {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ============================================================================
   CONVERSATION STAGE (VISION 360 3D CRYSTAL GLASS WINDOW — REFERENCE MATCH)
   ============================================================================ */
.conversation-stage {
  position: absolute;
  top: clamp(64px, calc(92 * var(--uy)), 98px);
  bottom: clamp(96px, calc(134 * var(--uy)), 142px);
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(1324 * var(--ux)), 88vw);
  padding: clamp(8px, calc(11 * var(--u)), 13px);
  border-radius: clamp(24px, calc(32 * var(--u)), 34px);
  display: flex;
  flex-direction: column;
  gap: clamp(8px, calc(10 * var(--uy)), 12px);
  z-index: 20;
  backdrop-filter: blur(26px) saturate(155%);
  -webkit-backdrop-filter: blur(26px) saturate(155%);
}

body.theme-light .conversation-stage {
  background: linear-gradient(
    180deg,
    rgba(130, 212, 206, 0.28) 0%,
    rgba(30, 74, 78, 0.62) 14%,
    rgba(22, 58, 62, 0.72) 86%,
    rgba(120, 208, 200, 0.26) 100%
  );
  border: 2px solid rgba(215, 255, 248, 0.82);
  box-shadow:
    0 32px 72px rgba(6, 26, 28, 0.52),
    0 0 42px rgba(135, 255, 236, 0.24),
    inset 0 2px 5px rgba(255, 255, 255, 0.85),
    inset 0 -2px 6px rgba(165, 255, 242, 0.45);
}

body.theme-dark .conversation-stage {
  background: linear-gradient(
    180deg,
    rgba(56, 195, 255, 0.18) 0%,
    rgba(10, 22, 56, 0.76) 14%,
    rgba(8, 18, 46, 0.84) 86%,
    rgba(124, 77, 255, 0.18) 100%
  );
  border: 2px solid rgba(105, 232, 255, 0.68);
  box-shadow:
    0 34px 76px rgba(2, 6, 24, 0.78),
    0 0 44px rgba(0, 215, 255, 0.22),
    inset 0 2px 5px rgba(255, 255, 255, 0.62),
    inset 0 -2px 6px rgba(80, 225, 255, 0.36);
}

/* Outer Clear-Crystal Double Bezel */
.conv-outer-bezel {
  position: absolute;
  inset: calc(-6 * var(--u));
  border-radius: clamp(28px, calc(37 * var(--u)), 40px);
  border: 1.5px solid rgba(225, 255, 250, 0.42);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.02));
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.45);
  pointer-events: none;
  z-index: -1;
}

body.theme-dark .conv-outer-bezel {
  border-color: rgba(95, 225, 255, 0.32);
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.08), rgba(139, 92, 246, 0.04));
}

/* Specular Edge Light Flares (Top, Bottom, Left, Right) */
.conv-flare {
  position: absolute;
  pointer-events: none;
  z-index: 3;
}

.conv-flare-top {
  top: -2px;
  left: 20%;
  right: 20%;
  height: 3.5px;
  border-radius: 999px;
  background: radial-gradient(ellipse at center, #FFFFFF 0%, rgba(185, 255, 245, 0.92) 36%, transparent 76%);
  box-shadow: 0 0 20px rgba(190, 255, 246, 0.95);
}

.conv-flare-bottom {
  bottom: -2.5px;
  left: 26%;
  right: 26%;
  height: 3.5px;
  border-radius: 999px;
  background: radial-gradient(ellipse at center, #FFFFFF 0%, rgba(175, 255, 242, 0.88) 38%, transparent 76%);
  box-shadow: 0 0 22px rgba(165, 255, 242, 0.92);
}

.conv-flare-left {
  left: -2px;
  top: 16%;
  bottom: 16%;
  width: 3px;
  border-radius: 999px;
  background: radial-gradient(ellipse at center, #FFFFFF 0%, rgba(185, 255, 245, 0.78) 40%, transparent 78%);
  box-shadow: 0 0 16px rgba(175, 255, 242, 0.75);
}

.conv-flare-right {
  right: -2px;
  top: 16%;
  bottom: 16%;
  width: 3px;
  border-radius: 999px;
  background: radial-gradient(ellipse at center, #FFFFFF 0%, rgba(185, 255, 245, 0.78) 40%, transparent 78%);
  box-shadow: 0 0 16px rgba(175, 255, 242, 0.75);
}

body.theme-dark .conv-flare-top,
body.theme-dark .conv-flare-bottom,
body.theme-dark .conv-flare-left,
body.theme-dark .conv-flare-right {
  background: radial-gradient(ellipse at center, #FFFFFF 0%, rgba(88, 232, 255, 0.88) 38%, transparent 76%);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.85);
}

/* Topbar Inside Outer Crystal Frame */
.conversation-topbar {
  display: grid;
  grid-template-columns: 1fr minmax(0, 2fr) 1fr;
  align-items: center;
  gap: clamp(8px, calc(14 * var(--ux)), 16px);
  padding: clamp(4px, calc(6 * var(--uy)), 8px) clamp(8px, calc(12 * var(--ux)), 14px) clamp(2px, calc(4 * var(--uy)), 6px);
  position: relative;
  z-index: 2;
}

.conv-topbar-left {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.conv-title {
  font-size: clamp(15px, calc(19 * var(--u)), 20px);
  font-weight: 700;
  color: #FFFFFF;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 12px rgba(0, 16, 24, 0.55);
}

.conv-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(6px, calc(10 * var(--ux)), 12px);
}

.conv-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, calc(8 * var(--u)), 9px);
  height: clamp(34px, calc(40 * var(--uy)), 42px);
  padding: 0 clamp(13px, calc(18 * var(--ux)), 20px);
  border-radius: 999px;
  border: 1.4px solid rgba(200, 255, 246, 0.62);
  background: linear-gradient(180deg, rgba(78, 134, 138, 0.54) 0%, rgba(36, 78, 82, 0.72) 100%);
  box-shadow:
    0 6px 16px rgba(6, 24, 28, 0.32),
    inset 0 1.5px 2px rgba(255, 255, 255, 0.48);
  color: #FFFFFF;
  font-size: clamp(13px, calc(15 * var(--u)), 15.5px);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

body.theme-dark .conv-action-btn {
  border-color: rgba(96, 225, 255, 0.52);
  background: linear-gradient(180deg, rgba(28, 56, 114, 0.62) 0%, rgba(14, 30, 72, 0.78) 100%);
}

.conv-action-btn svg {
  width: clamp(15px, calc(17 * var(--u)), 18px);
  height: clamp(15px, calc(17 * var(--u)), 18px);
  flex-shrink: 0;
}

.conv-action-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.conv-action-btn.is-saved {
  border-color: #FFE082;
  box-shadow: 0 0 16px rgba(255, 213, 79, 0.42), inset 0 1.5px 2px rgba(255, 255, 255, 0.55);
}

.conv-action-btn.is-saved svg {
  color: #FFD54F;
}

.conv-action-btn.is-shared {
  border-color: rgba(116, 255, 235, 0.92);
  box-shadow: 0 0 18px rgba(52, 245, 212, 0.38), inset 0 1.5px 2px rgba(255, 255, 255, 0.55);
}

.conv-action-btn.is-shared svg {
  color: #74FFEB;
}

.conv-shared-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: clamp(32px, calc(38 * var(--uy)), 40px);
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.22);
  border: 1.4px solid rgba(110, 255, 215, 0.72);
  color: #E6FFFA;
  font-size: clamp(12.5px, calc(14 * var(--u)), 14.5px);
  font-weight: 600;
  white-space: nowrap;
}

.conv-shared-badge svg {
  width: 16px;
  height: 16px;
  color: #74FFEB;
}

/* Glowing Mint-Aqua "+ Chat mới" Pill Button */
.conv-action-btn.primary,
body.theme-dark .conv-action-btn.primary {
  background: linear-gradient(180deg, #76FFEB 0%, #32ECCB 52%, #19C9AA 100%);
  border: 1.5px solid rgba(232, 255, 252, 0.95);
  color: #053330;
  font-weight: 700;
  box-shadow:
    0 0 22px rgba(50, 236, 203, 0.52),
    0 6px 16px rgba(6, 28, 30, 0.35),
    inset 0 1.5px 2.5px rgba(255, 255, 255, 0.88);
}

/* Inner Glass Reading Chamber */
.conv-inner-chamber {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: clamp(18px, calc(24 * var(--u)), 26px);
  overflow: hidden;
  position: relative;
  z-index: 2;
}

body.theme-light .conv-inner-chamber {
  background: linear-gradient(180deg, rgba(16, 46, 50, 0.78) 0%, rgba(20, 56, 60, 0.72) 55%, rgba(16, 48, 52, 0.80) 100%);
  border: 1.5px solid rgba(185, 255, 244, 0.46);
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.24),
    inset 0 12px 32px rgba(6, 22, 26, 0.36);
}

body.theme-dark .conv-inner-chamber {
  background: linear-gradient(180deg, rgba(6, 14, 38, 0.80) 0%, rgba(9, 20, 52, 0.74) 55%, rgba(6, 14, 38, 0.84) 100%);
  border: 1.5px solid rgba(86, 222, 255, 0.38);
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.18),
    inset 0 12px 32px rgba(2, 6, 22, 0.48);
}

.messages-viewport {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-anchor: none;
  overscroll-behavior: contain;
  padding: clamp(18px, calc(26 * var(--uy)), 30px) clamp(20px, calc(34 * var(--ux)), 38px);
  display: flex;
  flex-direction: column;
  gap: clamp(16px, calc(22 * var(--uy)), 24px);
  user-select: text;
  scrollbar-width: thin;
  scrollbar-color: rgba(170, 255, 242, 0.38) transparent;
}

.messages-viewport::-webkit-scrollbar {
  width: 6px;
}

.messages-viewport::-webkit-scrollbar-thumb {
  background: rgba(170, 255, 242, 0.36);
  border-radius: 999px;
}

/* Floating Scroll-to-End Button inside .conv-inner-chamber */
.scroll-to-end-btn {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 12;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1.5px solid rgba(205, 255, 248, 0.78);
  background: linear-gradient(180deg, rgba(44, 102, 106, 0.88) 0%, rgba(20, 56, 60, 0.94) 100%);
  box-shadow:
    0 12px 28px rgba(4, 18, 24, 0.55),
    0 0 22px rgba(110, 255, 232, 0.28),
    inset 0 1.5px 2.5px rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

body.theme-dark .scroll-to-end-btn {
  border-color: rgba(96, 228, 255, 0.72);
  background: linear-gradient(180deg, rgba(24, 52, 110, 0.90) 0%, rgba(10, 24, 62, 0.95) 100%);
  box-shadow:
    0 12px 28px rgba(2, 8, 28, 0.65),
    0 0 22px rgba(0, 229, 255, 0.28),
    inset 0 1.5px 2.5px rgba(255, 255, 255, 0.45);
}

.scroll-to-end-btn:hover {
  transform: translateX(-50%) translateY(-2px);
  filter: brightness(1.08);
}

.scroll-to-end-btn svg {
  width: 16px;
  height: 16px;
  color: #76FFEB;
}

body.theme-dark .scroll-to-end-btn svg {
  color: #5CE1FF;
}

.scroll-end-live-dot {
  display: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 10px #34D399;
}

.scroll-to-end-btn.is-streaming .scroll-end-live-dot {
  display: inline-block;
  animation: scrollLivePulse 1.2s ease-in-out infinite;
}

@keyframes scrollLivePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.82); }
}

.msg-row {
  display: flex;
  flex-direction: column;
}

.msg-row.user {
  align-self: flex-end;
  max-width: min(74%, 760px);
}

.msg-row.assistant {
  align-self: flex-start;
  width: min(86%, 940px);
}

.msg-row.operator {
  align-self: flex-start;
  width: min(86%, 940px);
}
.msg-operator-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #b8f3d3;
  font-size: 13px;
}
.msg-row.operator .msg-bubble {
  padding: clamp(12px, calc(15 * var(--uy)), 18px) clamp(16px, calc(22 * var(--ux)), 24px);
  border-radius: 14px;
  background: rgba(18, 105, 78, .28);
  border: 1px solid rgba(86, 214, 156, .5);
  box-shadow: 0 8px 24px rgba(5, 30, 24, .2);
}
.support-mode-banner {
  margin: 10px 16px;
  padding: 10px 14px;
  border: 1px solid rgba(86, 214, 156, .45);
  border-radius: 10px;
  background: rgba(18, 105, 78, .18);
  color: #b8f3d3;
  font-size: 13px;
  line-height: 1.45;
}

.msg-bubble {
  color: #FFFFFF;
  overflow-wrap: anywhere;
  position: relative;
}

/* User Bubble: Vibrant Cyan-Blue -> Violet-Purple 3D Pill */
.msg-row.user .msg-bubble {
  padding: clamp(11px, calc(14 * var(--uy)), 16px) clamp(18px, calc(26 * var(--ux)), 28px);
  border-radius: clamp(16px, calc(20 * var(--u)), 22px);
  background: linear-gradient(92deg, #159BE8 0%, #377BF2 48%, #7346EC 100%);
  border: 1.5px solid rgba(150, 225, 255, 0.72);
  box-shadow:
    0 12px 28px rgba(6, 22, 42, 0.42),
    0 0 22px rgba(42, 140, 255, 0.24),
    inset 0 1.5px 2.5px rgba(255, 255, 255, 0.52);
  font-size: clamp(15.5px, calc(17.5 * var(--u)), 18px);
  font-weight: 500;
  line-height: 1.48;
}

.msg-row.user .msg-content > :last-child {
  margin-bottom: 0;
}

.msg-row.user .msg-blockquote {
  margin: 0 0 8px 0;
  padding: 7px 12px;
  border-left: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 6px 12px 12px 6px;
  background: rgba(6, 16, 44, 0.28);
  font-size: 0.91em;
  color: rgba(242, 250, 255, 0.94);
}

.msg-user-tools {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
  padding-right: 4px;
  opacity: 0.92;
  transition: opacity 0.18s ease;
}

.msg-row.user:hover .msg-user-tools,
.msg-user-tools:focus-within {
  opacity: 1;
}

.msg-timestamp {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: clamp(11.5px, calc(12.8 * var(--u)), 13px);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  user-select: none;
}

.msg-ts-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  opacity: 0.88;
}

.msg-ts-icon svg {
  width: 100%;
  height: 100%;
}

.user-timestamp {
  padding: 3px 10px;
  margin-right: 2px;
  border-radius: 999px;
  background: rgba(8, 22, 48, 0.36);
  border: 1px solid rgba(165, 235, 255, 0.34);
  color: rgba(226, 248, 255, 0.94);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.18);
}

body.theme-light .user-timestamp {
  background: rgba(16, 52, 56, 0.36);
  border-color: rgba(195, 255, 246, 0.45);
  color: rgba(235, 255, 252, 0.96);
}

.assistant-timestamp {
  color: rgba(205, 246, 242, 0.76);
  font-size: clamp(11px, calc(12.2 * var(--u)), 12.5px);
  padding-left: 2px;
}

body.theme-dark .assistant-timestamp {
  color: rgba(176, 232, 255, 0.74);
}

.drawer-chat-time {
  font-size: 11.5px;
  color: rgba(190, 242, 255, 0.72);
  font-weight: 500;
}

.drawer-date-group-header {
  margin: 10px 4px 4px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(175, 255, 244, 0.88);
  border-left: 2.5px solid rgba(116, 255, 235, 0.72);
  background: rgba(14, 42, 54, 0.36);
  border-radius: 0 8px 8px 0;
}

.chat-date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 6px 0 2px;
  position: relative;
}

.chat-date-divider::before,
.chat-date-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(165, 245, 255, 0.32), transparent);
}

.chat-date-divider-pill {
  padding: 4px 14px;
  margin: 0 12px;
  border-radius: 999px;
  font-size: clamp(11.5px, calc(12.6 * var(--u)), 13px);
  font-weight: 600;
  color: rgba(232, 252, 255, 0.94);
  background: rgba(12, 34, 64, 0.62);
  border: 1px solid rgba(135, 235, 255, 0.42);
  box-shadow: 0 4px 12px rgba(2, 10, 26, 0.32), inset 0 1px 2px rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  white-space: nowrap;
}

body.theme-light .chat-date-divider-pill {
  background: rgba(22, 68, 72, 0.58);
  border-color: rgba(195, 255, 246, 0.55);
  color: #F2FFFD;
}

/* Red Exclamation Mark (!) Error Indicator & Retry Controls */
.msg-user-error-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 5px;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.24);
  border: 1px solid rgba(255, 92, 92, 0.78);
  color: #FFE4E6;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.42), inset 0 1px 2px rgba(255, 255, 255, 0.28);
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.msg-user-error-trigger:hover {
  background: rgba(239, 68, 68, 0.38);
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 0 18px rgba(248, 113, 113, 0.65);
}

.msg-excl-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(145deg, #FF3B30, #DC2626);
  color: #FFFFFF;
  font-weight: 900;
  font-size: 13px;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.65), inset 0 1px 1px rgba(255, 255, 255, 0.45);
  flex-shrink: 0;
}

.msg-row.assistant .msg-bubble.is-error-state {
  border-color: rgba(255, 96, 96, 0.68) !important;
  box-shadow: 0 10px 28px rgba(185, 28, 28, 0.22), inset 0 1px 2px rgba(255, 180, 180, 0.25) !important;
}

.msg-rust-error-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(127, 29, 29, 0.28);
  border: 1px solid rgba(252, 129, 129, 0.48);
}

body.theme-light .msg-rust-error-card {
  background: rgba(153, 27, 27, 0.22);
  border-color: rgba(254, 178, 178, 0.62);
}

.msg-rust-error-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.msg-rust-error-head .msg-excl-circle {
  width: 24px;
  height: 24px;
  font-size: 15px;
  margin-top: 1px;
}

.msg-rust-error-text {
  flex: 1;
  color: #FFE4E6;
  font-size: clamp(14px, calc(15.2 * var(--u)), 15.8px);
  line-height: 1.5;
}

.msg-rust-error-text strong {
  color: #FECDD3;
  display: block;
  margin-bottom: 2px;
}

.msg-rust-error-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 34px;
}

.msg-retry-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.88), rgba(185, 28, 28, 0.92));
  border: 1px solid rgba(254, 202, 202, 0.65);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.42);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.msg-retry-action-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.62);
}

/* Yub Assistant Card: Thick Frosted Glass Card with Orb Header & Action Icons */
.msg-row.assistant .msg-bubble {
  padding: clamp(14px, calc(18 * var(--uy)), 20px) clamp(18px, calc(24 * var(--ux)), 26px) clamp(16px, calc(20 * var(--uy)), 22px) clamp(16px, calc(20 * var(--ux)), 22px);
  border-radius: clamp(18px, calc(22 * var(--u)), 24px);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  font-size: clamp(15.5px, calc(17.2 * var(--u)), 17.8px);
  line-height: 1.62;
}

body.theme-light .msg-row.assistant .msg-bubble {
  background: linear-gradient(
    155deg,
    rgba(62, 118, 122, 0.62) 0%,
    rgba(32, 74, 78, 0.76) 54%,
    rgba(42, 92, 96, 0.68) 100%
  );
  border: 1.5px solid rgba(195, 255, 246, 0.58);
  box-shadow:
    0 18px 40px rgba(6, 26, 28, 0.42),
    0 0 24px rgba(130, 255, 236, 0.12),
    inset 0 1.5px 3px rgba(255, 255, 255, 0.48),
    inset 0 -1.5px 4px rgba(160, 255, 240, 0.24);
}

body.theme-dark .msg-row.assistant .msg-bubble {
  background: linear-gradient(
    155deg,
    rgba(26, 54, 112, 0.64) 0%,
    rgba(12, 26, 64, 0.80) 54%,
    rgba(18, 40, 90, 0.72) 100%
  );
  border: 1.5px solid rgba(92, 226, 255, 0.48);
  box-shadow:
    0 18px 42px rgba(2, 8, 28, 0.56),
    0 0 24px rgba(0, 215, 255, 0.12),
    inset 0 1.5px 3px rgba(255, 255, 255, 0.36),
    inset 0 -1.5px 4px rgba(0, 229, 255, 0.18);
}

/* Assistant Card Header: 3D Crystal 'y' Badge + 'Yub' + Copy/Like/Dislike */
.msg-assistant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: clamp(4px, calc(6 * var(--uy)), 8px);
}

.msg-assistant-brand {
  display: inline-flex;
  align-items: center;
  gap: clamp(10px, calc(12 * var(--u)), 13px);
}

.msg-yub-orb {
  width: clamp(30px, calc(35 * var(--u)), 36px);
  height: clamp(30px, calc(35 * var(--u)), 36px);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #B4FFF2;
  background: radial-gradient(
    circle at 32% 24%,
    rgba(255, 255, 255, 0.82) 0%,
    rgba(130, 255, 238, 0.42) 26%,
    rgba(18, 72, 76, 0.92) 70%,
    rgba(52, 215, 196, 0.72) 100%
  );
  border: 1.4px solid rgba(215, 255, 248, 0.88);
  box-shadow:
    0 4px 14px rgba(6, 28, 30, 0.45),
    0 0 calc(14px + var(--vib-energy, 0) * 14px) rgba(110, 255, 235, 0.52),
    inset 0 1.5px 3px rgba(255, 255, 255, 0.75);
  animation: yubBadgeResonance calc(2.6s - min(1.4s, var(--vib-energy, 0) * 0.9s)) ease-in-out infinite;
}

@keyframes yubBadgeResonance {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  25% {
    transform: translate3d(calc(var(--vib-energy, 0) * 1.1px), calc(var(--vib-energy, 0) * -1.4px), 0) scale(calc(1 + var(--vib-energy, 0) * 0.035));
  }
  50% {
    transform: translate3d(calc(var(--vib-energy, 0) * -1.1px), calc(var(--vib-energy, 0) * 1.1px), 0) scale(calc(1 + var(--vib-energy, 0) * 0.05));
  }
  75% {
    transform: translate3d(calc(var(--vib-energy, 0) * 0.9px), calc(var(--vib-energy, 0) * 1.2px), 0) scale(calc(1 + var(--vib-energy, 0) * 0.025));
  }
}

body.theme-dark .msg-yub-orb {
  color: #7CEEFF;
  background: radial-gradient(
    circle at 32% 24%,
    rgba(255, 255, 255, 0.82) 0%,
    rgba(56, 228, 255, 0.42) 28%,
    rgba(14, 32, 82, 0.92) 68%,
    rgba(168, 85, 247, 0.72) 100%
  );
  border-color: rgba(130, 238, 255, 0.85);
  box-shadow:
    0 4px 14px rgba(2, 8, 28, 0.55),
    0 0 14px rgba(0, 229, 255, 0.42),
    inset 0 1.5px 3px rgba(255, 255, 255, 0.72);
}

.msg-yub-orb svg {
  width: 66%;
  height: 66%;
  filter: drop-shadow(0 0 5px rgba(175, 255, 245, 0.85));
}

.msg-yub-name {
  font-size: clamp(16px, calc(18 * var(--u)), 19px);
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.01em;
}

.msg-assistant-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.msg-tool-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(235, 255, 252, 0.82);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.msg-tool-btn svg {
  width: 18px;
  height: 18px;
}

.msg-tool-btn:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.msg-tool-btn.active,
.msg-tool-btn.copied {
  color: #74FFEB;
  background: rgba(116, 255, 235, 0.16);
}

.msg-row.assistant .msg-content {
  padding-left: clamp(38px, calc(47 * var(--u)), 49px);
  padding-right: 4px;
  color: rgba(246, 255, 254, 0.96);
}

.msg-row.assistant .msg-content > :last-child {
  margin-bottom: 0;
}

/* Message Expand / Collapse State */
.msg-bubble.is-collapsed .msg-content {
  max-height: 92px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000000 45%, rgba(0, 0, 0, 0.25) 82%, transparent 100%);
  mask-image: linear-gradient(180deg, #000000 45%, rgba(0, 0, 0, 0.25) 82%, transparent 100%);
}

.msg-row.user .msg-bubble.is-collapsed .msg-content {
  max-height: 108px;
}

.msg-collapse-footer-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid rgba(185, 255, 245, 0.45);
  background: rgba(255, 255, 255, 0.10);
  color: #C8FFF4;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
}

.msg-row.assistant .msg-collapse-footer-btn {
  margin-left: clamp(38px, calc(47 * var(--u)), 49px);
}

@media (max-width: 768px) {
  .msg-row.assistant .msg-collapse-footer-btn {
    margin-left: 4px;
  }
}

body.theme-dark .msg-collapse-footer-btn {
  border-color: rgba(88, 228, 255, 0.45);
  color: #9CEEFF;
}

.msg-collapse-footer-btn svg {
  width: 15px;
  height: 15px;
}

.msg-collapse-footer-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(210, 255, 248, 0.82);
  transform: translateY(-1px);
}

.msg-bubble h1,
.msg-bubble h2,
.msg-bubble h3,
.msg-bubble h4,
.msg-bubble h5,
.msg-bubble h6 {
  margin: 14px 0 8px;
  line-height: 1.35;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.01em;
}

.msg-bubble .msg-content > h1:first-child,
.msg-bubble .msg-content > h2:first-child,
.msg-bubble .msg-content > h3:first-child,
.msg-bubble .msg-content > h4:first-child,
.msg-bubble .msg-content > h5:first-child,
.msg-bubble .msg-content > h6:first-child {
  margin-top: 2px;
}

.msg-bubble h1 { font-size: 1.38em; }
.msg-bubble h2 { font-size: 1.24em; }
.msg-bubble h3 { font-size: 1.12em; }
.msg-bubble h4 { font-size: 1.03em; color: #C8FFF4; }
.msg-bubble h5 { font-size: 0.96em; color: #B2F5EA; }
.msg-bubble h6 { font-size: 0.90em; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }

body.theme-dark .msg-bubble h4 { color: #9CEEFF; }
body.theme-dark .msg-bubble h5 { color: #BAE6FD; }

.msg-hr {
  border: none;
  height: 1px;
  margin: 16px 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(175, 255, 244, 0.58) 25%,
    rgba(255, 255, 255, 0.72) 50%,
    rgba(175, 255, 244, 0.58) 75%,
    transparent 100%
  );
}

body.theme-dark .msg-hr {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(56, 228, 255, 0.52) 25%,
    rgba(168, 85, 247, 0.62) 50%,
    rgba(56, 228, 255, 0.52) 75%,
    transparent 100%
  );
}

.msg-blockquote {
  margin: 10px 0;
  padding: 8px 14px;
  border-left: 3px solid rgba(116, 255, 235, 0.85);
  border-radius: 0 10px 10px 0;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(235, 255, 252, 0.92);
}

body.theme-dark .msg-blockquote {
  border-left-color: #38E4FF;
  background: rgba(0, 229, 255, 0.07);
}

.msg-blockquote p:last-child {
  margin-bottom: 0;
}

.msg-link {
  color: #76FFEB;
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.theme-dark .msg-link {
  color: #5CE1FF;
}

.msg-task-item {
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-left: -18px;
}

.msg-task-item input[type="checkbox"] {
  accent-color: #32ECCB;
}

.msg-bubble p, .msg-bubble ul, .msg-bubble ol {
  margin-bottom: 10px;
}

.msg-bubble ul, .msg-bubble ol {
  padding-left: 22px;
}

.msg-bubble code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 229, 255, 0.16);
}

.code-block-wrap {
  margin: 12px 0;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(6, 18, 28, 0.82);
  border: 1px solid rgba(165, 255, 242, 0.32);
}

.code-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.copy-code-btn {
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.10);
  color: #FFFFFF;
  font-size: 12px;
  cursor: pointer;
}

.code-block-wrap pre {
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 14.5px;
  line-height: 1.55;
}

.code-block-wrap pre code {
  background: none;
  padding: 0;
}

.table-scroll-wrap {
  margin: 12px 0;
  overflow-x: auto;
}

.msg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.msg-table th, .msg-table td {
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  text-align: left;
}

.msg-table th {
  background: rgba(0, 210, 255, 0.16);
  font-weight: 700;
}

/* ============================================================================
   DRAWERS & MODALS
   ============================================================================ */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 20, 0.55);
  backdrop-filter: blur(6px);
  z-index: 40;
}

.yub-drawer {
  position: fixed;
  top: calc(94 * var(--u));
  left: calc(54 * var(--u));
  width: min(420px, 90vw);
  max-height: calc(100vh - 130px);
  border-radius: 22px;
  padding: 20px;
  background: var(--drawer-bg);
  border: 1.5px solid var(--drawer-border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(24px);
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.yub-drawer.right-aligned {
  left: auto;
  right: calc(54 * var(--u));
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-head h3 {
  font-size: 19px;
  font-weight: 700;
}

.drawer-head-actions {
  display: flex;
  gap: 8px;
}

.drawer-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  cursor: pointer;
}

.drawer-search-box input,
.yub-select,
.yub-login-card input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.28);
  color: #FFFFFF;
  font-size: 14.5px;
  outline: none;
}

.drawer-scroll-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 55vh;
}

.drawer-chat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.drawer-chat-select {
  flex: 1;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-chat-actions {
  display: flex;
  gap: 6px;
}

.drawer-mini-btn {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  cursor: pointer;
  font-size: 12px;
}

.drawer-content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.drawer-action-card {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-body-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 14px;
}

.setting-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13.5px;
}

.user-card-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.user-avatar-badge {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00E5FF, #8B5CF6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.login-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 20, 0.72);
  backdrop-filter: blur(10px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
}

.yub-login-card {
  width: min(420px, 92vw);
  padding: 24px;
  border-radius: 22px;
  background: var(--drawer-bg);
  border: 1.5px solid var(--drawer-border);
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.55), inset 0 1.5px 3px rgba(255, 255, 255, 0.32);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.yub-share-card {
  width: min(500px, 94vw);
  gap: 14px;
}

.share-url-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.share-url-row input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 13.5px;
  user-select: all;
}

.share-copy-btn {
  height: 42px;
  padding: 0 18px;
  flex-shrink: 0;
}

.share-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.share-modal-actions button {
  flex: 1 1 180px;
}

.yub-btn-danger {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(251, 113, 133, 0.58);
  background: rgba(225, 29, 72, 0.24);
  color: #FFE4E6;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.18s ease, transform 0.18s ease;
}

.yub-btn-danger:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.share-status-msg {
  min-height: 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: #74FFEB;
}

.password-input-wrap {
  display: flex;
  gap: 8px;
}

.password-toggle-btn,
.yub-btn-primary,
.yub-btn-secondary {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  font-weight: 600;
  cursor: pointer;
}

.yub-btn-primary {
  background: linear-gradient(135deg, #00C6FF, #7C3AED);
  border: none;
}

.login-error {
  color: #FF6B8B;
  font-size: 13.5px;
}

/* ============================================================================
   MULTI-DEVICE RESPONSIVE BREAKPOINTS (Desktop, Laptop, Tablet & Mobile)
   ============================================================================ */

/* 1. Compact-Height Desktop & 16:9 Laptop (e.g., 1366x768, 1280x720) */
@media (min-width: 1181px) and (max-height: 760px) {
  .center-orb-zone {
    top: clamp(54px, 7.5vh, 72px);
  }
  .yub-orb-wrapper {
    width: clamp(172px, 24.5vh, 232px);
    height: clamp(180px, 25.5vh, 242px);
  }
  .yub-orb-sphere {
    width: clamp(168px, 24vh, 226px);
    height: clamp(168px, 24vh, 226px);
  }
  .orb-hud-canvas {
    width: clamp(360px, 54vh, 520px);
    height: clamp(200px, 31vh, 300px);
  }
  .hero-copy {
    margin-top: 2px;
    gap: 3px;
  }
  .hero-greeting {
    font-size: clamp(20px, 3.2vh, 28px);
  }
  .hero-subtitle {
    font-size: clamp(12px, 1.9vh, 15px);
  }
  body.theme-dark .hero-quick-pills,
  body.theme-light .hero-quick-pills {
    margin-top: 10px;
  }
  body.theme-dark .quick-pill,
  body.theme-light .quick-pill {
    min-height: 42px;
    height: 44px;
    padding: 4px 14px;
    font-size: 12.5px;
  }
  body.theme-dark .feature-cards-zone,
  body.theme-light .feature-cards-zone {
    bottom: clamp(86px, 13.5vh, 118px);
    height: clamp(96px, 13.8vh, 122px);
  }
  body.theme-dark .composer-zone,
  body.theme-light .composer-zone {
    bottom: 14px;
  }
  .yub-composer {
    height: 62px;
  }
}

/* 2. Medium Laptop (1181px - 1420px width): Prevent horizontal crowding between sidebars & center pills */
@media (min-width: 1181px) and (max-width: 1420px) {
  body.theme-dark .panel-left,
  body.theme-light .panel-left {
    left: 20px;
    width: clamp(280px, 24.2vw, 340px);
  }
  body.theme-dark .panel-right,
  body.theme-light .panel-right {
    right: 20px;
    width: clamp(280px, 24.2vw, 340px);
  }
  body.theme-light .hero-quick-pills,
  body.theme-dark .hero-quick-pills {
    width: min(56vw, 760px);
    gap: 12px;
  }
  body.theme-light .quick-pill,
  body.theme-dark .quick-pill {
    padding: 6px 14px;
    font-size: 13px;
    white-space: normal;
    text-align: left;
  }
}

/* 3. Tablet & Small Laptop (<= 1180px): Scrollable Spatial Layout + 2-Column Sidebars */
@media (max-width: 1180px) {
  html, body {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    min-height: 100%;
  }

  .yub-workspace {
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: visible;
    padding-bottom: 110px;
  }

  .home-stage {
    position: relative;
    inset: auto;
    height: auto;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 76px 20px 24px;
    gap: 22px;
  }

  .spatial-stage-grid {
    position: relative;
    inset: auto;
    width: min(100%, 980px);
    height: auto;
    perspective: none;
    transform-style: flat;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
  }

  .center-orb-zone {
    grid-column: 1 / -1;
    order: -1;
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    padding-top: 6px;
  }

  .yub-orb-wrapper {
    width: 220px;
    height: 228px;
  }

  .yub-orb-sphere {
    width: 214px;
    height: 214px;
  }

  .orb-hud-canvas {
    width: 460px;
    height: 260px;
  }

  .orb-brand-name {
    font-size: 40px;
    margin-top: -36px;
  }

  body.theme-light .orb-brand-name {
    margin-top: -10px;
  }

  .hero-greeting {
    font-size: clamp(24px, 3.4vw, 32px);
    padding: 0 10px;
  }

  .hero-subtitle {
    font-size: 15px;
    padding: 0 12px;
  }

  body.theme-dark .hero-quick-pills,
  body.theme-light .hero-quick-pills {
    width: 100%;
    max-width: 860px;
    margin-top: 16px;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
  }

  body.theme-dark .quick-pill,
  body.theme-light .quick-pill {
    width: auto;
    flex: 1 1 220px;
    max-width: 300px;
    min-height: 48px;
    height: auto;
    padding: 10px 16px;
    font-size: 14px;
    white-space: normal;
    text-align: left;
    justify-content: flex-start;
  }

  .vision-panel,
  body.theme-dark .panel-left,
  body.theme-dark .panel-right,
  body.theme-light .panel-left,
  body.theme-light .panel-right {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    width: 100%;
    height: auto;
    border-radius: 22px;
    transform: none !important;
  }

  body.theme-dark .panel-left .panel-glass-inner,
  body.theme-dark .panel-right .panel-glass-inner,
  body.theme-light .panel-left .panel-glass-inner,
  body.theme-light .panel-right .panel-glass-inner {
    transform: none !important;
    padding: 18px 20px;
  }

  .panel-glass-slab {
    inset: -2px !important;
    border-width: 2px !important;
    border-radius: 24px !important;
  }

  .panel-title {
    font-size: 19px;
  }

  .adaptive-item-title {
    font-size: 14.5px;
  }

  .adaptive-item-sub {
    font-size: 12.5px;
  }

  .quota-headline {
    font-size: 21px;
  }

  .quota-detail-row,
  .quota-renew-row {
    font-size: 13.5px;
  }

  body.theme-dark .feature-cards-zone,
  body.theme-light .feature-cards-zone {
    position: relative;
    bottom: auto;
    top: auto;
    left: auto;
    transform: none;
    width: min(100%, 980px);
    height: auto;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin: 0 auto;
  }

  .feature-card {
    border-radius: 18px;
    padding: 16px 10px;
    min-height: 112px;
  }

  .fc-icon {
    width: 28px;
    height: 28px;
  }

  .fc-title {
    font-size: 15.5px;
  }

  .fc-desc {
    font-size: 12px;
  }

  body.theme-dark .composer-zone,
  body.theme-light .composer-zone {
    top: auto;
    bottom: max(14px, env(safe-area-inset-bottom));
    width: min(94vw, 940px);
  }

  .yub-composer {
    height: 64px;
    padding: 0 14px;
    gap: 12px;
  }

  .composer-plus-btn {
    width: 42px;
    height: 42px;
  }

  .composer-send-btn {
    width: 44px;
    height: 44px;
  }

  #prompt {
    font-size: 16px;
  }

  .conversation-stage {
    position: fixed;
    top: 70px;
    bottom: 92px;
    width: 94vw;
  }
}

/* 4. Mobile & Tablet Portrait (<= 768px): Dedicated Mobile Experience */
@media (max-width: 768px) {
  .yub-header {
    height: 56px;
    padding: 0 12px;
    gap: 8px;
  }

  .header-left {
    flex: 1;
    min-width: 0;
    gap: 8px;
    overflow: hidden;
  }

  .yub-logo-mark {
    width: 30px;
    height: 30px;
  }

  .yub-brand-text,
  body.theme-dark .yub-brand-text {
    font-size: 22px;
  }

  .header-divider {
    display: none;
  }

  .header-nav {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 4px;
    padding-right: 4px;
  }

  .header-nav::-webkit-scrollbar {
    display: none;
  }

  .header-nav-item {
    height: 34px;
    padding: 0 9px;
    font-size: 12.5px;
    gap: 5px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .header-nav-item svg {
    width: 15px;
    height: 15px;
  }

  .header-nav-item.active::after {
    bottom: -8px;
    height: 2.5px;
  }

  .header-right {
    gap: 4px;
    flex-shrink: 0;
  }

  .header-icon-btn {
    width: 34px;
    height: 34px;
  }

  .header-icon-btn svg {
    width: 18px;
    height: 18px;
  }

  .header-profile-btn {
    width: 36px;
    height: 36px;
  }

  .header-profile-btn svg {
    width: 19px;
    height: 19px;
  }

  .home-stage {
    padding: 66px 14px 20px;
    gap: 16px;
  }

  .spatial-stage-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    width: 100%;
    max-width: 100%;
  }

  .spatial-stage-grid > * {
    min-width: 0;
    max-width: 100%;
  }

  .yub-orb-wrapper {
    width: 168px;
    height: 176px;
  }

  .yub-orb-sphere {
    width: 162px;
    height: 162px;
  }

  .orb-hud-canvas {
    width: min(330px, 92vw);
    height: 190px;
  }

  .orb-brand-name {
    font-size: 32px;
    margin-top: -28px;
  }

  .hero-greeting {
    font-size: 22px;
    line-height: 1.25;
  }

  .hero-subtitle {
    font-size: 13.5px;
    line-height: 1.4;
  }

  body.theme-dark .hero-quick-pills,
  body.theme-light .hero-quick-pills {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-top: 12px;
  }

  body.theme-dark .quick-pill,
  body.theme-light .quick-pill {
    max-width: 100%;
    flex: none;
    width: 100%;
    min-height: 44px;
    padding: 9px 14px;
    font-size: 13.5px;
  }

  .pill-icon {
    width: 20px;
    height: 20px;
  }

  body.theme-dark .feature-cards-zone,
  body.theme-light .feature-cards-zone {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .feature-card-more {
    grid-column: 1 / -1;
    min-height: 64px;
    flex-direction: row;
    padding: 12px 18px;
  }

  .feature-card-more .fc-title {
    margin-top: 0;
  }

  body.theme-dark .composer-zone,
  body.theme-light .composer-zone {
    bottom: max(10px, env(safe-area-inset-bottom));
    width: calc(100vw - 20px);
  }

  .yub-composer {
    height: 56px;
    padding: 0 10px;
    gap: 8px;
  }

  .composer-plus-btn {
    width: 36px;
    height: 36px;
  }

  .composer-plus-btn svg {
    width: 18px;
    height: 18px;
  }

  #prompt {
    font-size: 16px;
  }

  .composer-right-tools {
    gap: 4px;
  }

  .composer-icon-btn {
    width: 32px;
    height: 32px;
  }

  .composer-icon-btn svg {
    width: 18px;
    height: 18px;
  }

  .composer-send-btn {
    width: 38px;
    height: 38px;
  }

  .composer-send-btn svg {
    width: 18px;
    height: 18px;
  }

  .yub-drawer,
  .yub-drawer.right-aligned {
    top: 64px;
    left: 10px;
    right: 10px;
    width: auto;
    max-height: calc(100vh - 80px);
    padding: 16px;
    border-radius: 18px;
  }

  .conversation-stage {
    top: 62px;
    bottom: 76px;
    width: calc(100vw - 16px);
    padding: 8px;
    gap: 8px;
  }

  .conversation-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 4px 6px;
    gap: 6px;
  }

  .conv-title {
    font-size: 14px;
  }

  .conv-action-btn {
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
    gap: 5px;
  }

  .messages-viewport {
    padding: 14px;
  }

  .msg-row.user,
  .msg-row.assistant {
    max-width: 96%;
    width: auto;
  }

  .msg-row.assistant {
    width: 100%;
  }

  .msg-row.assistant .msg-content {
    padding-left: 4px;
  }
}

/* 5. Compact Mobile & Narrow Window (<= 600px): Icon-focused header nav & composer tools */
@media (max-width: 600px) {
  .header-nav-item span,
  .conv-back-btn span,
  #shareChatBtn span,
  #saveChatBtn span,
  #exportChatBtn span {
    display: none;
  }
  .header-nav-item {
    padding: 0 8px;
  }
  #attachBtn {
    display: inline-flex;
  }
}

/* ==========================================================================
   YUB VISUAL IMAGE & SVG CARD RENDERER (PNG / JPG / SVG EXPORT)
   ========================================================================== */
.msg-generated-image-card {
  margin: 12px 0;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(10, 15, 30, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 12px 32px rgba(2, 6, 23, 0.42);
  backdrop-filter: blur(14px);
}

body.theme-light .msg-generated-image-card {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(100, 116, 139, 0.26);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.msg-gen-img-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.65);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

body.theme-light .msg-gen-img-head {
  background: rgba(241, 245, 249, 0.9);
  border-bottom-color: rgba(148, 163, 184, 0.25);
}

.msg-gen-img-title {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  max-width: 340px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.theme-light .msg-gen-img-title {
  color: #1e293b;
}

.msg-gen-img-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.msg-gen-img-btn {
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(30, 41, 59, 0.78);
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

body.theme-light .msg-gen-img-btn {
  background: #ffffff;
  color: #334155;
  border-color: rgba(100, 116, 139, 0.3);
}

.msg-gen-img-btn.primary {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.85), rgba(99, 102, 241, 0.9));
  border-color: rgba(125, 211, 252, 0.55);
  color: #ffffff;
}

.msg-gen-img-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.msg-gen-img-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: radial-gradient(circle at 50% 35%, rgba(30, 41, 59, 0.55), rgba(2, 6, 23, 0.85));
}

body.theme-light .msg-gen-img-preview {
  background: radial-gradient(circle at 50% 35%, rgba(248, 250, 252, 0.95), rgba(226, 232, 240, 0.85));
}

.msg-gen-img-el {
  display: block;
  max-width: 100%;
  max-height: 520px;
  width: auto;
  height: auto;
  border-radius: 10px;
  cursor: zoom-in;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.32);
}

.msg-gen-svg-code {
  margin: 0;
  padding: 12px 14px;
  max-height: 260px;
  overflow: auto;
  background: rgba(2, 6, 23, 0.92);
  color: #cbd5e1;
  font-size: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

/* ==========================================================================
   SEND BUTTON LONG-PRESS 2-MODE POPOVER (⚡ FAST vs 🧠 THINK) & RETRY LONGER
   ========================================================================== */
.send-btn-container {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.composer-send-btn {
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}

.composer-send-btn.mode-think {
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.65), inset 0 1px 1px rgba(255, 255, 255, 0.45);
}

.send-mode-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(125, 211, 252, 0.55);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.send-mode-badge.is-think {
  border-color: rgba(192, 132, 252, 0.78);
  background: rgba(46, 16, 101, 0.95);
}

.send-mode-popover {
  position: absolute;
  right: 8px;
  bottom: calc(100% + 10px);
  min-width: 248px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(24, 32, 46, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.62), 0 2px 10px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transform-origin: bottom right;
  animation: telegramMenuPop 0.14s cubic-bezier(0.2, 0.9, 0.3, 1);
}

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

body.theme-light .send-mode-popover {
  background: rgba(28, 36, 50, 0.96);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.35);
}

.send-mode-option {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #f8fafc;
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s ease, color 0.14s ease;
}

.send-mode-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.send-mode-option.active {
  background: rgba(56, 189, 248, 0.15);
  color: #ffffff;
}

.send-mode-opt-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(248, 250, 252, 0.92);
  flex-shrink: 0;
}

.send-mode-opt-icon svg {
  width: 20px;
  height: 20px;
}

.send-mode-opt-label {
  flex: 1;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.send-mode-opt-check {
  opacity: 0;
  font-size: 13px;
  font-weight: 800;
  color: #38bdf8;
  margin-left: 6px;
}

.send-mode-option.active .send-mode-opt-check {
  opacity: 1;
}

/* Assistant "Retry with longer" action button & footer pill */
.msg-tool-btn.msg-retry-longer-tool {
  width: auto !important;
  padding: 0 9px;
  font-size: 11.5px;
  font-weight: 600;
  gap: 4px;
  white-space: nowrap;
  color: #bae6fd;
  border-color: rgba(56, 189, 248, 0.32);
}

body.theme-light .msg-tool-btn.msg-retry-longer-tool {
  color: #0369a1;
  border-color: rgba(2, 132, 199, 0.3);
}

.msg-assistant-footer-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.msg-retry-longer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(125, 211, 252, 0.34);
  background: rgba(15, 23, 42, 0.55);
  color: #e0f2fe;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}

body.theme-light .msg-retry-longer-pill {
  background: rgba(241, 245, 249, 0.92);
  border-color: rgba(2, 132, 199, 0.28);
  color: #0f172a;
}

.msg-retry-longer-pill:hover {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.68);
  background: rgba(30, 58, 138, 0.45);
}

body.theme-light .msg-retry-longer-pill:hover {
  background: rgba(224, 242, 254, 0.95);
}

/* Progressive Image Preview (Low-Res -> HD) & % Progress Indicator */
.msg-img-progress-wrap {
  padding: 7px 14px 8px;
  background: rgba(15, 23, 42, 0.72);
  border-bottom: 1px solid rgba(56, 189, 248, 0.22);
  transition: opacity 0.35s ease, max-height 0.35s ease, padding 0.35s ease;
  max-height: 60px;
  overflow: hidden;
}

body.theme-light .msg-img-progress-wrap {
  background: rgba(241, 245, 249, 0.92);
  border-bottom-color: rgba(14, 165, 233, 0.22);
}

.msg-img-progress-wrap.fade-out {
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-bottom-width: 0;
  pointer-events: none;
}

.msg-img-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 11.8px;
}

.msg-img-progress-label {
  color: #bae6fd;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.theme-light .msg-img-progress-label {
  color: #0369a1;
}

.msg-img-progress-pct {
  color: #38bdf8;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

body.theme-light .msg-img-progress-pct {
  color: #0284c7;
}

.msg-img-progress-wrap.is-done .msg-img-progress-label,
.msg-img-progress-wrap.is-done .msg-img-progress-pct {
  color: #34d399;
}

body.theme-light .msg-img-progress-wrap.is-done .msg-img-progress-label,
body.theme-light .msg-img-progress-wrap.is-done .msg-img-progress-pct {
  color: #059669;
}

.msg-img-progress-bar {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.24);
  overflow: hidden;
}

.msg-img-progress-fill {
  height: 100%;
  width: 15%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #818cf8, #c084fc);
  transition: width 0.22s ease;
}

.msg-img-progress-wrap.is-done .msg-img-progress-fill {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.msg-gen-img-el.is-lowres-preview {
  filter: blur(1.5px) saturate(1.06);
  transform: scale(0.992);
  transition: filter 0.32s ease, transform 0.32s ease;
}

.msg-gen-img-el {
  transition: filter 0.32s ease, transform 0.32s ease;
}

/* Yub Processing Time Badge on Assistant Messages */
.msg-assistant-brand {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.msg-processing-time-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.4px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #7dd3fc;
  background: rgba(14, 116, 144, 0.24);
  border: 1px solid rgba(56, 189, 248, 0.36);
  white-space: nowrap;
}

.msg-processing-time-badge.is-live {
  color: #fde047;
  background: rgba(161, 98, 7, 0.26);
  border-color: rgba(250, 204, 21, 0.45);
}

body.theme-light .msg-processing-time-badge {
  color: #0369a1;
  background: rgba(224, 242, 254, 0.9);
  border-color: rgba(2, 132, 199, 0.32);
}

body.theme-light .msg-processing-time-badge.is-live {
  color: #b45309;
  background: rgba(254, 243, 199, 0.95);
  border-color: rgba(217, 119, 6, 0.4);
}





/* ---- Dislike reason chips ---- */
.msg-feedback-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  width: 100%;
}
.msg-feedback-reasons.hidden { display: none; }
.msg-feedback-chip {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.35);
  color: inherit;
  font-size: 12px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.msg-feedback-chip:hover { border-color: rgba(96, 165, 250, 0.8); }
body.theme-light .msg-feedback-chip { background: rgba(255, 255, 255, 0.7); }
