* {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      -webkit-tap-highlight-color: transparent;
    }

    html,
    body {
      height: 100%;
      height: 100dvh;
      min-height: 100dvh;
      width: 100%;
      max-width: 100vw;
      overflow: hidden;
      -webkit-text-size-adjust: 100%;
    }

    :root {
      --bg: #07080f;
      --p1: #0e0f1a;
      --p2: #141525;
      --p3: #1c1e30;
      --b1: #2a2c45;
      --b2: #363858;
      --acc: #6c63ff;
      --acc-dim: rgba(108, 99, 255, 0.18);
      --acc-glow: rgba(108, 99, 255, 0.35);
      --teal: #00d4b4;
      --orange: #ff7b54;
      --green: #4dffb4;
      --red: #ff5e7a;
      --t1: #eeeeff;
      --t2: #9898c0;
      --t3: #555575;
      --sidebar: 260px;
    }

    /* ═══════════════════════════════════════════════════════════════
       THEME SYSTEM: 5 CURATED THEMES + HIGH-CONTRAST LIGHT MODE
       ═══════════════════════════════════════════════════════════════ */

    /* 1. CYBER OBSIDIAN (DEFAULT DARK) */
    body, body.theme-cyber-dark {
      --bg: #07080f;
      --p1: #0e0f1a;
      --p2: #141525;
      --p3: #1c1e30;
      --b1: #2a2c45;
      --b2: #363858;
      --acc: #06b6d4;
      --acc-dim: rgba(6, 182, 212, 0.15);
      --acc-glow: rgba(6, 182, 212, 0.35);
      --teal: #00d4b4;
      --orange: #ff7b54;
      --green: #10b981;
      --red: #ff5e7a;
      --t1: #f1f5f9;
      --t2: #94a3b8;
      --t3: #64748b;
      --sidebar: 260px;
    }

    /* 2. PURE VELVET LIGHT MODE (OVERHAULED HIGH-CONTRAST & CRISP) */
    body.light, body.theme-pure-light {
      --bg: #f8fafc;
      --p1: #ffffff;
      --p2: #f1f5f9;
      --p3: #e2e8f0;
      --b1: #cbd5e1;
      --b2: #94a3b8;
      --acc: #4f46e5;
      --acc-dim: rgba(79, 70, 229, 0.12);
      --acc-glow: rgba(79, 70, 229, 0.28);
      --teal: #0d9488;
      --orange: #ea580c;
      --green: #059669;
      --red: #e11d48;
      --t1: #0f172a;
      --t2: #334155;
      --t3: #64748b;
    }

    body.light .topbar, body.theme-pure-light .topbar {
      background: rgba(255, 255, 255, 0.94);
      border-bottom: 1px solid #e2e8f0;
      box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    }
    body.light .izone, body.theme-pure-light .izone {
      background: rgba(248, 250, 252, 0.96);
      border-top: 1px solid #e2e8f0;
    }
    body.light .ibox, body.theme-pure-light .ibox {
      background: #ffffff;
      border: 1.5px solid #cbd5e1;
      box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    }
    body.light .ibox:focus-within, body.theme-pure-light .ibox:focus-within {
      border-color: #4f46e5;
      box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
    }
    body.light .iinput, body.theme-pure-light .iinput {
      color: #0f172a !important;
    }
    body.light .iinput::placeholder, body.theme-pure-light .iinput::placeholder {
      color: #94a3b8 !important;
    }
    body.light .wcard, body.theme-pure-light .wcard {
      background: #ffffff;
      border: 1px solid #e2e8f0;
      box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    }
    body.light .wcard:hover, body.theme-pure-light .wcard:hover {
      border-color: #4f46e5;
      background: #f8fafc;
      transform: translateY(-2px);
    }
    body.light .wcard-txt, body.theme-pure-light .wcard-txt {
      color: #1e293b;
      font-weight: 600;
    }
    body.light .wtitle, body.theme-pure-light .wtitle {
      color: #0f172a;
    }
    body.light .w-cheer, body.theme-pure-light .w-cheer {
      color: #475569;
    }
    body.light .wsub, body.theme-pure-light .wsub {
      color: #64748b;
    }
    body.light .mcontent, body.theme-pure-light .mcontent {
      color: #0f172a;
    }
    body.light .mmsg.user .mcontent, body.theme-pure-light .mmsg.user .mcontent {
      background: #4f46e5;
      color: #ffffff;
    }
    body.light .mmsg.asst .mcontent, body.theme-pure-light .mmsg.asst .mcontent {
      background: #ffffff;
      border: 1px solid #e2e8f0;
      box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    }
    body.light .ccode, body.theme-pure-light .ccode {
      background: #0f172a;
      color: #e2e8f0;
      border: 1px solid #334155;
    }
    body.light .mcontent code.ic, body.theme-pure-light .mcontent code.ic {
      background: rgba(79, 70, 229, 0.08);
      color: #4338ca;
      border: 1px solid rgba(79, 70, 229, 0.2);
    }
    body.light .sidebar, body.theme-pure-light .sidebar {
      background: #ffffff;
      border-right: 1px solid #e2e8f0;
    }
    body.light .history-item, body.theme-pure-light .history-item {
      color: #334155;
    }
    body.light .history-item:hover, body.theme-pure-light .history-item:hover {
      background: #f1f5f9;
      color: #0f172a;
    }
    body.light .itbtn, body.theme-pure-light .itbtn {
      background: #f1f5f9;
      border: 1px solid #cbd5e1;
      color: #334155;
    }
    body.light .itbtn:hover, body.theme-pure-light .itbtn:hover {
      background: #e2e8f0;
      color: #0f172a;
      border-color: #4f46e5;
    }

    /* 3. MIDNIGHT NEON (VIOLET & OLED BLACK) */
    body.theme-neon-midnight {
      --bg: #030712;
      --p1: #0b0f19;
      --p2: #111827;
      --p3: #1f2937;
      --b1: #374151;
      --b2: #4b5563;
      --acc: #8b5cf6;
      --acc-dim: rgba(139, 92, 246, 0.16);
      --acc-glow: rgba(139, 92, 246, 0.40);
      --teal: #06b6d4;
      --orange: #f97316;
      --green: #10b981;
      --red: #f43f5e;
      --t1: #f9fafb;
      --t2: #d1d5db;
      --t3: #9ca3af;
    }

    /* 4. EMERALD CYBERPUNK (MATRIX GREEN) */
    body.theme-emerald-matrix {
      --bg: #021a12;
      --p1: #052e1f;
      --p2: #093c2a;
      --p3: #0f513a;
      --b1: #14532d;
      --b2: #166534;
      --acc: #10b981;
      --acc-dim: rgba(16, 185, 129, 0.16);
      --acc-glow: rgba(16, 185, 129, 0.40);
      --teal: #14b8a6;
      --orange: #f59e0b;
      --green: #22c55e;
      --red: #f87171;
      --t1: #ecfdf5;
      --t2: #a7f3d0;
      --t3: #6ee7b7;
    }

    /* 5. SOLAR SUNSET AMBER */
    body.theme-solar-amber {
      --bg: #140b05;
      --p1: #221208;
      --p2: #301a0c;
      --p3: #432411;
      --b1: #5c3319;
      --b2: #7c4422;
      --acc: #f97316;
      --acc-dim: rgba(249, 115, 22, 0.16);
      --acc-glow: rgba(249, 115, 22, 0.40);
      --teal: #06b6d4;
      --orange: #fb923c;
      --green: #10b981;
      --red: #ef4444;
      --t1: #fff7ed;
      --t2: #fed7aa;
      --t3: #fdba74;
    }

    /* ── THEME BUTTON & DROPDOWN ── */
    .theme-btn {
      background: var(--p2);
      border: 1px solid var(--b1);
      color: var(--t2);
      padding: 6px 10px;
      border-radius: 7px;
      font-size: 14px;
      cursor: pointer;
      transition: all .15s;
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .theme-btn:hover {
      background: var(--p3);
      border-color: var(--acc);
      color: var(--t1);
    }
    .theme-dropdown-content {
      display: none;
      position: absolute;
      top: calc(100% + 6px);
      right: 0;
      background: var(--p1);
      border: 1px solid var(--b2);
      border-radius: 10px;
      padding: 6px;
      min-width: 190px;
      box-shadow: 0 10px 30px rgba(0,0,0,0.5);
      z-index: 500;
      animation: slideUp 0.15s ease;
    }
    .theme-dropdown-content.show {
      display: flex;
      flex-direction: column;
      gap: 3px;
    }
    .theme-opt {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 7px 10px;
      border-radius: 6px;
      color: var(--t1);
      font-size: 12px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.12s;
    }
    .theme-opt:hover {
      background: var(--p2);
      color: var(--acc);
    }

    /* ── VOICE BTN & VISUALIZER ── */
    .itbtn.voice-btn {
      position: relative
    }

    .itbtn.voice-btn.listening,
    .in-box-voice-btn.listening {
      background: rgba(255, 94, 122, 0.15) !important;
      border-color: var(--red) !important;
      color: var(--red) !important;
      animation: voice-pulse 1s ease-in-out infinite
    }

    @keyframes voice-pulse {
      0%, 100% { box-shadow: 0 0 0 0 rgba(255, 94, 122, 0.4) }
      50% { box-shadow: 0 0 0 6px rgba(255, 94, 122, 0) }
    }

    .in-box-voice-btn {
      background: var(--p2);
      border: 1px solid var(--b1);
      color: var(--t2);
      width: 38px;
      height: 38px;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 6px;
      flex-shrink: 0;
      transition: all 0.15s ease;
    }
    .in-box-voice-btn:hover {
      background: var(--p3);
      border-color: var(--acc);
      color: var(--t1);
    }

    /* ── VOICE VISUALIZER CONTAINER ── */
    .voice-visualizer-container {
      display: none;
      align-items: center;
      gap: 12px;
      background: var(--p2);
      border: 1px solid var(--b2);
      border-radius: 10px;
      padding: 6px 14px;
      margin: 6px;
      width: 100%;
    }
    .voice-visualizer-container.listening,
    .voice-visualizer-container.processing {
      display: flex;
    }
    .vv-wave-bars {
      display: flex;
      align-items: center;
      gap: 4px;
      height: 22px;
    }
    .vv-bar {
      width: 4px;
      height: 18px;
      background: var(--red);
      border-radius: 2px;
      transition: transform 0.08s ease;
      transform: scaleY(0.3);
    }
    .vv-status-text {
      font-size: 12px;
      font-family: 'JetBrains Mono', monospace;
      color: var(--t1);
      font-weight: 500;
    }

    /* ── MEMORY MANAGMENT MODAL ── */
    .memory-modal {
      position: fixed;
      inset: 0;
      background: rgba(7, 8, 15, 0.85);
      backdrop-filter: blur(8px);
      z-index: 1000;
      display: none;
      align-items: center;
      justify-content: center;
    }
    .memory-modal.open {
      display: flex;
    }
    .memory-box {
      background: var(--p1);
      border: 1px solid var(--b2);
      border-radius: 16px;
      width: 520px;
      max-width: 90vw;
      padding: 24px;
      box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    }
    .memory-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 16px;
      border-bottom: 1px solid var(--b1);
      padding-bottom: 12px;
    }
    .memory-header h3 {
      font-size: 18px;
      color: var(--t1);
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .memory-close-btn {
      background: none;
      border: none;
      color: var(--t2);
      font-size: 20px;
      cursor: pointer;
    }
    .memory-list {
      display: flex;
      flex-direction: column;
      gap: 12px;
      max-height: 360px;
      overflow-y: auto;
    }
    .memory-item-card {
      background: var(--p2);
      border: 1px solid var(--b1);
      border-radius: 10px;
      padding: 12px 14px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .memory-item-info strong {
      display: block;
      font-size: 12px;
      color: var(--acc);
      text-transform: uppercase;
      margin-bottom: 2px;
    }
    .memory-item-info span {
      font-size: 14px;
      color: var(--t1);
    }
    .memory-del-btn {
      background: rgba(255, 94, 122, 0.1);
      border: 1px solid var(--red);
      color: var(--red);
      padding: 4px 10px;
      border-radius: 6px;
      font-size: 11px;
      cursor: pointer;
    }
    .memory-del-btn:hover {
      background: var(--red);
      color: #fff;
    }


    /* ── SPEAK BTN ── */
    .speak-btn {
      background: none;
      border: 1px solid var(--b1);
      color: var(--t3);
      padding: 3px 8px;
      border-radius: 5px;
      cursor: pointer;
      font-size: 10px;
      font-family: 'JetBrains Mono', monospace;
      transition: all .14s;
      display: flex;
      align-items: center;
      gap: 4px;
    }

    .speak-btn:hover {
      background: var(--p3);
      color: var(--teal);
      border-color: var(--teal)
    }

    .speak-btn.speaking {
      color: var(--teal);
      border-color: var(--teal);
      background: rgba(0, 212, 180, 0.08)
    }

    /* ── SYSTEM MAINTENANCE OVERLAY CSS ── */
    #maintenanceOverlay {
      display: none;
      position: fixed;
      inset: 0;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      width: 100vw;
      height: 100vh;
      z-index: 9999999 !important;
      background: radial-gradient(circle at 50% 30%, rgba(15, 23, 42, 0.98), #030712);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      align-items: center;
      justify-content: center;
      padding: 24px;
      overflow-y: auto;
    }

    #stopbtn {
      display: none;
      align-items: center;
      justify-content: center;
      gap: 6px;
      background: rgba(244, 63, 94, 0.15);
      border: 1.5px solid rgba(244, 63, 94, 0.5);
      color: #fb7185;
      padding: 8px 14px;
      border-radius: 10px;
      font-size: 13px;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    #stopbtn:hover {
      background: rgba(244, 63, 94, 0.25);
      border-color: #fb7185;
      color: #fff;
    }

    /* ── AI SPEAK ASSISTANT PANEL ── */
    .speak-panel {
      position: fixed;
      bottom: 90px;
      right: 22px;
      z-index: 150;
      background: var(--p1);
      border: 1px solid var(--b2);
      border-radius: 14px;
      padding: 16px 18px;
      width: 280px;
      box-shadow: 0 12px 48px rgba(0, 0, 0, .6);
      display: none;
      flex-direction: column;
      gap: 10px;
    }

    .speak-panel.on {
      display: flex
    }

    .sp-title {
      font-size: 12px;
      font-weight: 700;
      color: var(--t1);
      display: flex;
      align-items: center;
      gap: 7px;
    }

    .sp-wave {
      display: flex;
      align-items: center;
      gap: 3px;
      height: 24px;
      margin: 4px 0
    }

    .sp-bar {
      width: 4px;
      border-radius: 3px;
      background: var(--acc);
      animation: spbar 1s ease-in-out infinite
    }

    .sp-bar:nth-child(1) {
      height: 8px;
      animation-delay: 0s
    }

    .sp-bar:nth-child(2) {
      height: 16px;
      animation-delay: .1s
    }

    .sp-bar:nth-child(3) {
      height: 24px;
      animation-delay: .2s
    }

    .sp-bar:nth-child(4) {
      height: 16px;
      animation-delay: .3s
    }

    .sp-bar:nth-child(5) {
      height: 8px;
      animation-delay: .4s
    }

    .sp-bar.idle {
      animation: none;
      height: 4px !important;
      background: var(--b2)
    }

    @keyframes spbar {

      0%,
      100% {
        transform: scaleY(.5)
      }

      50% {
        transform: scaleY(1)
      }
    }

    .sp-status {
      font-size: 11px;
      color: var(--t2);
      font-family: 'JetBrains Mono', monospace
    }

    .sp-controls {
      display: flex;
      gap: 6px
    }

    .sp-btn {
      flex: 1;
      padding: 7px;
      border-radius: 7px;
      border: 1px solid var(--b2);
      background: var(--p2);
      color: var(--t2);
      font-size: 11px;
      font-family: 'Outfit', sans-serif;
      font-weight: 600;
      cursor: pointer;
      transition: all .15s
    }

    .sp-btn:hover {
      background: var(--p3);
      color: var(--t1)
    }

    .sp-btn.primary {
      background: var(--acc);
      border-color: var(--acc);
      color: #fff
    }

    .sp-btn.primary:hover {
      background: #5a52e0
    }

    .sp-btn.danger {
      border-color: var(--red);
      color: var(--red)
    }

    .sp-btn.danger:hover {
      background: rgba(255, 94, 122, .1)
    }

    .sp-fab {
      position: fixed;
      bottom: 22px;
      right: 22px;
      z-index: 151;
      width: 44px;
      height: 44px;
      border-radius: 50%;
      border: none;
      background: linear-gradient(135deg, var(--acc), #a78bfa);
      color: #fff;
      font-size: 18px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 4px 20px var(--acc-glow);
      transition: all .2s;
    }

    .sp-fab:hover {
      transform: scale(1.1);
      box-shadow: 0 6px 28px var(--acc-glow)
    }

    .sp-fab.speaking {
      background: linear-gradient(135deg, var(--teal), #00a896);
      animation: fab-pulse 1.2s ease-in-out infinite
    }

    @keyframes fab-pulse {

      0%,
      100% {
        box-shadow: 0 4px 20px rgba(0, 212, 180, .4)
      }

      50% {
        box-shadow: 0 4px 28px rgba(0, 212, 180, .8)
      }
    }

    /* ── IMAGE PREVIEW in chat ── */
    .img-preview {
      max-width: 280px;
      max-height: 200px;
      border-radius: 9px;
      border: 1px solid var(--b2);
      margin-bottom: 8px;
      display: block;
      object-fit: cover
    }

    body {
      background: var(--bg);
      color: var(--t1);
      font-family: 'Outfit', sans-serif;
      display: flex;
      height: 100vh;
      overflow: hidden;
      position: relative;
    }

    /* ═══════════════════════════════════════════════════════════════
       AMBIENT DYNAMIC MOVING BACKGROUND ORBS & NEBULA
       ═══════════════════════════════════════════════════════════════ */
    .ambient-bg-layer {
      position: fixed;
      inset: 0;
      pointer-events: none;
      z-index: 0;
      overflow: hidden;
      opacity: 0.65;
    }

    .ambient-orb {
      position: absolute;
      border-radius: 50%;
      filter: blur(85px);
      opacity: 0.38;
      will-change: transform;
    }

    .ambient-orb-1 {
      width: 580px;
      height: 580px;
      top: -12%;
      left: 10%;
      background: radial-gradient(circle, rgba(56, 189, 248, 0.45) 0%, rgba(59, 130, 246, 0.15) 50%, transparent 70%);
      animation: orbDrift1 22s ease-in-out infinite alternate;
    }

    .ambient-orb-2 {
      width: 620px;
      height: 620px;
      bottom: -15%;
      right: 5%;
      background: radial-gradient(circle, rgba(139, 92, 246, 0.42) 0%, rgba(217, 70, 239, 0.15) 50%, transparent 70%);
      animation: orbDrift2 26s ease-in-out infinite alternate;
    }

    .ambient-orb-3 {
      width: 480px;
      height: 480px;
      top: 35%;
      left: 50%;
      background: radial-gradient(circle, rgba(16, 185, 129, 0.28) 0%, rgba(6, 182, 212, 0.12) 50%, transparent 70%);
      animation: orbDrift3 18s ease-in-out infinite alternate;
    }

    @keyframes orbDrift1 {
      0% { transform: translate3d(0, 0, 0) scale(1); }
      50% { transform: translate3d(90px, 110px, 0) scale(1.15); }
      100% { transform: translate3d(-70px, 50px, 0) scale(0.95); }
    }

    @keyframes orbDrift2 {
      0% { transform: translate3d(0, 0, 0) scale(1); }
      50% { transform: translate3d(-110px, -80px, 0) scale(1.18); }
      100% { transform: translate3d(60px, -50px, 0) scale(0.92); }
    }

    @keyframes orbDrift3 {
      0% { transform: translate3d(0, 0, 0) scale(0.95); }
      50% { transform: translate3d(-60px, 90px, 0) scale(1.1); }
      100% { transform: translate3d(80px, -70px, 0) scale(1.05); }
    }

    ::-webkit-scrollbar {
      width: 3px;
      height: 3px
    }

    ::-webkit-scrollbar-track {
      background: transparent
    }

    ::-webkit-scrollbar-thumb {
      background: var(--b1);
      border-radius: 3px
    }

    /* ─ SIDEBAR (SLIDE-LEFT COLLAPSIBLE & USER PREFERENCE) ─ */
    .sidebar {
      width: var(--sidebar);
      flex-shrink: 0;
      background: var(--p1);
      border-right: 1px solid var(--b1);
      display: flex;
      flex-direction: column;
      transition: margin-left 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, visibility 0.28s ease;
      z-index: 100;
      overflow: hidden;
      white-space: nowrap;
      position: relative;
    }

    body.sb-collapsed .sidebar {
      margin-left: calc(-1 * var(--sidebar)) !important;
      opacity: 0;
      pointer-events: none;
      visibility: hidden;
    }

    .sb-collapse-btn {
      background: transparent;
      border: 1px solid transparent;
      color: var(--t3);
      border-radius: 6px;
      padding: 5px 7px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .sb-collapse-btn:hover {
      background: var(--p2);
      border-color: var(--b2);
      color: var(--t1);
      transform: scale(1.05);
    }

    .sb-top {
      padding: 18px 16px 14px;
      border-bottom: 1px solid var(--b1)
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 11px;
      margin-bottom: 16px;
      cursor: pointer;
      border-radius: 9px;
      padding: 4px;
      transition: background .15s
    }

    .brand:hover {
      background: var(--p3)
    }

    .brand-ico {
      width: 38px;
      height: 38px;
      border-radius: 11px;
      flex-shrink: 0;
      background: radial-gradient(circle at 35% 30%, #1c2230 0%, #0c0e14 100%);
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1px solid rgba(56, 189, 248, 0.22);
      border-top: 1px solid rgba(255, 255, 255, 0.25);
      box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6), 0 0 14px rgba(56, 189, 248, 0.15);
      overflow: hidden;
      padding: 3px;
      transition: all 0.25s ease;
    }

    .brand:hover .brand-ico {
      border-color: rgba(56, 189, 248, 0.45);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75), 0 0 20px rgba(56, 189, 248, 0.3);
      transform: translateY(-1px);
    }

    .brand-name strong {
      display: block;
      font-size: 16px;
      font-weight: 700;
      letter-spacing: -.3px
    }

    .brand-name small {
      font-size: 10px;
      color: var(--t3);
      font-family: 'JetBrains Mono', monospace;
      letter-spacing: .4px
    }

    .new-btn {
      width: 100%;
      padding: 10px;
      border-radius: 9px;
      border: none;
      background: var(--acc);
      color: #fff;
      font-family: 'Outfit', sans-serif;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      transition: all .18s
    }

    .new-btn:hover {
      background: #5a52e0;
      box-shadow: 0 4px 20px var(--acc-glow);
      transform: translateY(-1px)
    }

    .sb-label {
      font-size: 10px;
      font-family: 'JetBrains Mono', monospace;
      color: var(--t3);
      letter-spacing: 1px;
      padding: 14px 16px 6px;
      text-transform: uppercase
    }

    .hlist {
      flex: 1;
      overflow-y: auto;
      padding: 4px 8px
    }

    .hitem {
      padding: 8px 10px;
      border-radius: 8px;
      cursor: pointer;
      font-size: 12.5px;
      color: var(--t2);
      display: flex;
      align-items: center;
      gap: 8px;
      transition: all .18s cubic-bezier(0.4, 0, 0.2, 1);
      margin-bottom: 3px;
      border: 1px solid transparent;
      background: transparent;
    }

    .hitem:hover {
      background: var(--p3);
      color: var(--t1);
      border-color: var(--b1);
      transform: translateX(2px);
    }

    .hitem.active {
      background: rgba(108, 99, 255, 0.14);
      color: var(--t1);
      border-color: rgba(108, 99, 255, 0.35);
      border-left: 3px solid var(--acc);
    }

    .hitem-content {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .hitem-title-row {
      display: flex;
      align-items: center;
      gap: 6px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .hitem-title-text {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-weight: 500;
      font-size: 12.5px;
    }

    .hitem-time-stamp {
      font-size: 10px;
      font-family: 'JetBrains Mono', monospace;
      color: var(--t3);
      padding-left: 18px;
      transition: color 0.15s;
    }

    .hitem:hover .hitem-time-stamp {
      color: var(--t2);
    }

    .hitem.active .hitem-time-stamp {
      color: #93c5fd;
    }

    .sb-foot {
      padding: 12px;
      border-top: 1px solid var(--b1)
    }

    .dev-card {
      background: var(--p2);
      border-radius: 9px;
      padding: 11px 13px;
      display: flex;
      align-items: center;
      gap: 10px
    }

    .dev-av {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      flex-shrink: 0;
      background: linear-gradient(135deg, var(--orange), #ffb347);
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 13px;
      color: #fff
    }

    .dev-info strong {
      display: block;
      font-size: 12px;
      font-weight: 600
    }

    .dev-info small {
      font-size: 10px;
      color: var(--t3);
      font-family: 'JetBrains Mono', monospace
    }

    /* ─ MAIN ─ */
    .main {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-width: 0;
      overflow: hidden
    }

    .topbar {
      height: 56px;
      flex-shrink: 0;
      background: rgba(7, 8, 15, .95);
      backdrop-filter: blur(16px);
      border-bottom: 1px solid var(--b1);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 20px;
      z-index: 10
    }

    .tb-left {
      display: flex;
      align-items: center;
      gap: 10px
    }

    .menu-btn {
      background: var(--p2);
      border: 1px solid var(--b1);
      color: var(--t2);
      border-radius: 8px;
      cursor: pointer;
      padding: 5px 8px;
      display: flex !important;
      align-items: center;
      justify-content: center;
      transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .menu-btn:hover {
      background: var(--p3);
      border-color: var(--b2);
      color: var(--t1);
    }
    body.sb-collapsed .menu-btn {
      background: rgba(56, 189, 248, 0.12);
      border-color: rgba(56, 189, 248, 0.35);
      color: #38bdf8;
    }

    .chat-name {
      font-size: 14px;
      font-weight: 600;
      color: var(--t2);
      max-width: 200px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap
    }

    .ver-tag {
      font-size: 10px;
      font-family: 'JetBrains Mono', monospace;
      background: var(--p3);
      border: 1px solid var(--b1);
      color: var(--acc);
      padding: 3px 9px;
      border-radius: 20px;
      white-space: nowrap
    }

    .tb-right {
      display: flex;
      align-items: center;
      gap: 7px;
    }

    .tbtn {
      background: rgba(15, 23, 42, 0.7);
      border: 1px solid rgba(255, 255, 255, 0.09);
      color: #cbd5e1;
      padding: 6px 11px;
      border-radius: 9px;
      font-size: 11.5px;
      font-weight: 600;
      font-family: 'Outfit', sans-serif;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 5px;
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
      white-space: nowrap;
      position: relative;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    }

    .tbtn:hover {
      background: rgba(30, 41, 59, 0.9);
      border-color: rgba(255, 255, 255, 0.22);
      color: #ffffff;
      transform: translateY(-1.5px);
      box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    }

    .tbtn:active {
      transform: translateY(0);
    }

    /* Sign In Button */
    #loginBtnTop {
      background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%) !important;
      color: #ffffff !important;
      border: 1px solid rgba(255, 255, 255, 0.3) !important;
      border-radius: 9px !important;
      padding: 6px 14px !important;
      font-weight: 700 !important;
      font-size: 11.5px !important;
      box-shadow: 0 0 16px rgba(6, 182, 212, 0.35) !important;
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }
    #loginBtnTop:hover {
      box-shadow: 0 0 22px rgba(6, 182, 212, 0.6) !important;
      transform: translateY(-1.5px) !important;
    }

    /* Compact Theme Button */
    .theme-btn {
      background: rgba(15, 23, 42, 0.7);
      border: 1px solid rgba(255, 255, 255, 0.1);
      color: #cbd5e1;
      padding: 6px 10px;
      border-radius: 9px;
      font-size: 12px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 5px;
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    }
    .theme-btn:hover {
      background: rgba(30, 41, 59, 0.9);
      border-color: rgba(255, 255, 255, 0.25);
      color: #ffffff;
      transform: translateY(-1.5px);
    }
    .theme-btn #themeIco {
      font-size: 13px;
      transition: transform 0.3s ease;
    }
    /* Settings Gear Button in Sidebar Footer */
    .sb-settings-btn {
      width: 36px;
      height: 36px;
      border-radius: 10px;
      background: rgba(15, 23, 42, 0.75);
      border: 1px solid rgba(255, 255, 255, 0.1);
      color: var(--t2);
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
      flex-shrink: 0;
    }
    .sb-settings-btn:hover {
      background: rgba(56, 189, 248, 0.15);
      border-color: rgba(56, 189, 248, 0.45);
      color: #38bdf8;
      transform: rotate(45deg) scale(1.08);
      box-shadow: 0 0 16px rgba(56, 189, 248, 0.3);
    }
    .sb-settings-btn:active {
      transform: rotate(90deg) scale(0.95);
    }

    /* Share button in topbar */
    .btn-share-top {
      background: rgba(99, 102, 241, 0.12) !important;
      border-color: rgba(129, 140, 248, 0.35) !important;
      color: #a5b4fc !important;
    }
    .btn-share-top:hover {
      background: rgba(99, 102, 241, 0.22) !important;
      border-color: rgba(129, 140, 248, 0.6) !important;
      color: #ffffff !important;
      box-shadow: 0 0 14px rgba(99, 102, 241, 0.3) !important;
    }

    /* Memory topbar button */
    #memoryBtn:hover {
      border-color: rgba(168, 85, 247, 0.4);
      color: #c084fc;
      box-shadow: 0 0 12px rgba(168, 85, 247, 0.2);
    }

    /* ─ CHAT ─ */
    #chat {
      flex: 1;
      overflow-y: auto;
      padding: 28px 0 16px
    }

    #welcome {
      max-width: 680px;
      margin: 18px auto 0;
      padding: 0 20px;
      text-align: center;
      animation: fadeInWelcome 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    }
    @keyframes fadeInWelcome {
      from { opacity: 0; transform: translateY(14px) scale(0.98); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }

    .whero-brand {
      display: flex;
      justify-content: center;
      align-items: center;
      margin: 0 auto 16px auto;
      position: relative;
    }

    .whero-icon-container {
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 100px;
      height: 100px;
      margin: 0 auto;
    }

    .whero-glow-ring {
      position: absolute;
      inset: -14px;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(56, 189, 248, 0.45) 0%, rgba(139, 92, 246, 0.28) 45%, transparent 70%);
      filter: blur(18px);
      animation: auraPulse 4s infinite ease-in-out;
      pointer-events: none;
    }

    .whero-orbital-ring {
      position: absolute;
      inset: -8px;
      border-radius: 30px;
      border: 1.5px dashed rgba(56, 189, 248, 0.5);
      animation: spinOrbital 18s linear infinite;
      pointer-events: none;
    }
    @keyframes spinOrbital {
      from { transform: rotate(0deg); }
      to { transform: rotate(360deg); }
    }

    .whero-orbital-ring-2 {
      position: absolute;
      inset: -16px;
      border-radius: 36px;
      border: 1px solid rgba(139, 92, 246, 0.3);
      animation: spinOrbitalRev 24s linear infinite;
      pointer-events: none;
    }
    @keyframes spinOrbitalRev {
      from { transform: rotate(360deg); }
      to { transform: rotate(0deg); }
    }

    .whero-icon {
      position: relative;
      width: 86px;
      height: 86px;
      border-radius: 22px;
      background: #080d1a;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1.5px solid rgba(56, 189, 248, 0.45);
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 24px rgba(56, 189, 248, 0.28);
      animation: floatLogo 5s ease-in-out infinite;
      transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
      z-index: 2;
    }
    .whero-icon:hover {
      transform: translateY(-4px) scale(1.05);
      border-color: rgba(56, 189, 248, 0.85);
      box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 35px rgba(56, 189, 248, 0.5);
    }

    .w-greeting-badge {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      background: rgba(56, 189, 248, 0.08);
      border: 1px solid rgba(56, 189, 248, 0.25);
      color: #38bdf8;
      padding: 4px 12px;
      border-radius: 20px;
      font-size: 10.5px;
      font-weight: 700;
      font-family: 'JetBrains Mono', monospace;
      letter-spacing: 0.6px;
      text-transform: uppercase;
      margin-bottom: 10px;
    }

    .w-badge-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: #10b981;
      box-shadow: 0 0 4px #10b981;
    }

    .wtitle {
      font-size: 32px;
      font-weight: 800;
      letter-spacing: -1px;
      margin-bottom: 6px;
      line-height: 1.18;
      transition: all 0.4s ease;
    }

    .wtitle span, .w-user-highlight {
      background: linear-gradient(90deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-size: 200% auto;
      animation: gradientShift 6s ease infinite;
    }
    @keyframes gradientShift {
      0% { background-position: 0% 50%; }
      50% { background-position: 100% 50%; }
      100% { background-position: 0% 50%; }
    }

    .w-cheer {
      font-size: 13.5px;
      font-weight: 500;
      color: #94a3b8;
      font-style: italic;
      max-width: 540px;
      margin: 0 auto 10px;
      line-height: 1.5;
      transition: all 0.3s ease;
    }

    .wsub {
      font-family: 'JetBrains Mono', monospace;
      font-size: 10.5px;
      color: var(--t3);
      letter-spacing: .7px;
      line-height: 1.8;
      margin-bottom: 28px;
    }

    .wgrid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px
    }

    .wcard {
      background: var(--p1);
      border: 1px solid var(--b1);
      border-radius: 10px;
      padding: 14px 15px;
      text-align: left;
      cursor: pointer;
      transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .wcard:hover {
      border-color: rgba(56, 189, 248, 0.35);
      transform: translateY(-1px);
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
      background: var(--p2);
    }

    .wcard-ico {
      font-size: 20px;
      margin-bottom: 7px;
      display: block
    }

    /* ── CHAT CREATION BURST & EMERGENCE ANIMATIONS ── */
    @keyframes chatCreationBurst {
      0% {
        opacity: 0;
        transform: scale(0.88) translateY(24px);
        filter: blur(12px) brightness(1.5);
      }
      45% {
        opacity: 0.98;
        transform: scale(1.02) translateY(-4px);
        filter: blur(0px) brightness(1.15);
      }
      100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0px) brightness(1);
      }
    }

    @keyframes haloPulseExplode {
      0% {
        transform: translate(-50%, -50%) scale(0.1);
        opacity: 0.95;
        box-shadow: 0 0 60px 20px var(--acc);
      }
      100% {
        transform: translate(-50%, -50%) scale(2.8);
        opacity: 0;
        box-shadow: 0 0 140px 50px var(--acc);
      }
    }

    @keyframes cardPopIn {
      0% {
        opacity: 0;
        transform: translateY(16px) scale(0.92);
      }
      100% {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }

    .welcome.chat-create-burst {
      animation: chatCreationBurst 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
      position: relative;
    }

    .welcome.chat-create-burst .wcard {
      animation: cardPopIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
    }
    .welcome.chat-create-burst .wcard:nth-child(1) { animation-delay: 0.04s; }
    .welcome.chat-create-burst .wcard:nth-child(2) { animation-delay: 0.08s; }
    .welcome.chat-create-burst .wcard:nth-child(3) { animation-delay: 0.12s; }
    .welcome.chat-create-burst .wcard:nth-child(4) { animation-delay: 0.16s; }
    .welcome.chat-create-burst .wcard:nth-child(5) { animation-delay: 0.20s; }
    .welcome.chat-create-burst .wcard:nth-child(6) { animation-delay: 0.24s; }

    .chat-creation-halo {
      position: absolute;
      top: 40%;
      left: 50%;
      width: 240px;
      height: 240px;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(56, 189, 248, 0.45) 0%, rgba(139, 92, 246, 0.3) 50%, transparent 70%);
      pointer-events: none;
      z-index: 5;
      animation: haloPulseExplode 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    .wcard-txt {
      font-size: 12.5px;
      color: var(--t2);
      line-height: 1.5
    }

    .wcard:hover .wcard-txt {
      color: var(--t1)
    }

    /* messages */
    .mwrap {
      max-width: 900px;
      margin: 0 auto;
      padding: 0 24px 4px;
      animation: fadeUp .22s ease forwards;
      opacity: 0;
      transform: translateY(6px)
    }

    @keyframes fadeUp {
      to {
        opacity: 1;
        transform: none
      }
    }

    /* ── USER MESSAGE: right side ── */
    .msg {
      display: flex;
      gap: 12px;
      margin-bottom: 18px;
      align-items: flex-start
    }
    .msg.msg-user {
      flex-direction: row-reverse;
      }
    .msg.msg-user .mbody {
      align-items: flex-end;
    }
    .msg.msg-user .mmeta {
      flex-direction: row-reverse;
    }
    .msg.msg-user .mbtns {
      margin-left: 0;
      margin-right: auto;
    }
    /* User bubble */
    .msg.msg-user .msgbody {
      background: linear-gradient(135deg, var(--acc), #7c6bf5);
      border-radius: 16px 4px 16px 16px;
      padding: 11px 15px;
      max-width: 72%;
      color: #fff;
      box-shadow: 0 4px 20px rgba(108,99,255,.3);
    }
    .msg.msg-user .mcontent {
      color: rgba(255,255,255,.95);
    }
    .msg.msg-user .mcontent strong { color: #fff; }
    .msg.msg-user .mcontent em { color: rgba(255,255,255,.8); }
    /* AI bubble */
    .msg.msg-ai .msgbody {
      background: var(--p2);
      border: 1px solid var(--b1);
      border-radius: 4px 16px 16px 16px;
      padding: 12px 16px;
      max-width: 90%;
    }

    /* ── THINKING / LOADING ANIMATION ── */
    .ai-thinking {
      display: flex;
      flex-direction: column;
      gap: 10px;
      padding: 14px 18px;
      background: var(--p2);
      border: 1px solid var(--b1);
      border-radius: 4px 16px 16px 16px;
      max-width: 320px;
    }
    .ai-thinking-top {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .ai-orb-wrap {
      position: relative;
      width: 28px;
      height: 28px;
      flex-shrink: 0;
    }
    .ai-orb {
      width: 12px;
      height: 12px;
      border-radius: 50%;
      background: linear-gradient(135deg, var(--acc), #a78bfa);
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      box-shadow: 0 0 10px var(--acc-glow);
      animation: orbPulse 1.6s ease-in-out infinite;
    }
    .ai-orb-ring {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      border: 2px solid transparent;
      border-top-color: var(--acc);
      border-right-color: rgba(108,99,255,.3);
      position: absolute;
      top: 0;
      left: 0;
      animation: orbSpin 1s linear infinite;
    }
    @keyframes orbPulse {
      0%,100%{transform:translate(-50%,-50%) scale(1);opacity:.9}
      50%{transform:translate(-50%,-50%) scale(1.3);opacity:1;box-shadow:0 0 18px var(--acc-glow)}
    }
    @keyframes orbSpin {
      to{transform:rotate(360deg)}
    }
    .ai-thinking-label {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .ai-thinking-title {
      font-family: 'JetBrains Mono', monospace;
      font-size: 11px;
      font-weight: 700;
      color: var(--acc);
      letter-spacing: .3px;
    }
    .ai-thinking-step {
      font-family: 'JetBrains Mono', monospace;
      font-size: 10px;
      color: var(--t3);
      transition: all .4s ease;
    }
    /* shimmer bar */
    .ai-shimmer {
      width: 100%;
      height: 3px;
      border-radius: 3px;
      background: linear-gradient(90deg, var(--b1) 0%, var(--acc) 40%, #a78bfa 60%, var(--b1) 100%);
      background-size: 200% 100%;
      animation: shimmerSlide 1.8s linear infinite;
    }
    @keyframes shimmerSlide {
      0%{background-position:100% 0}
      100%{background-position:-100% 0}
    }
    /* step dots row */
    .ai-thinking-dots {
      display: flex;
      gap: 5px;
      align-items: center;
    }
    .ai-thinking-dots span {
      width: 5px;
      height: 5px;
      border-radius: 50%;
      background: var(--acc);
      opacity: .2;
      animation: thinkDot 1.4s ease-in-out infinite;
    }
    .ai-thinking-dots span:nth-child(2){animation-delay:.18s}
    .ai-thinking-dots span:nth-child(3){animation-delay:.36s}
    .ai-thinking-dots span:nth-child(4){animation-delay:.54s}
    .ai-thinking-dots span:nth-child(5){animation-delay:.72s}
    @keyframes thinkDot{
      0%,80%,100%{opacity:.2;transform:scale(1)}
      40%{opacity:1;transform:scale(1.6);background:var(--teal)}
    }

    .av {
      width: 32px;
      height: 32px;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: 'JetBrains Mono', monospace;
      font-size: 9px;
      font-weight: 600;
      flex-shrink: 0;
      margin-top: 1px
    }

    .av-u {
      background: var(--p3);
      border: 1px solid var(--b2);
      color: var(--t2)
    }

    .av-a {
      background: linear-gradient(135deg, var(--acc), #a78bfa);
      color: #fff;
      box-shadow: 0 0 14px var(--acc-glow)
    }

    .mbody {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
    }

    .mmeta {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 7px
    }

    .mname {
      font-size: 12px;
      font-weight: 600;
      color: var(--t2);
      font-family: 'Outfit', sans-serif
    }

    .mname.ai {
      color: var(--acc)
    }

    .mtime {
      font-family: 'JetBrains Mono', monospace;
      font-size: 10px;
      color: var(--t3)
    }

    .mbtns {
      margin-left: auto;
      display: flex;
      gap: 4px;
      opacity: 0;
      transition: opacity .15s
    }

    .mwrap:hover .mbtns {
      opacity: 1
    }

    .mbtn-sm {
      background: none;
      border: 1px solid var(--b1);
      color: var(--t3);
      padding: 3px 8px;
      border-radius: 5px;
      cursor: pointer;
      font-size: 10px;
      font-family: 'JetBrains Mono', monospace;
      transition: all .14s;
      display: flex;
      align-items: center;
      gap: 4px
    }

    .mbtn-sm:hover {
      background: var(--p3);
      color: var(--t2);
      border-color: var(--b2)
    }

    .mcontent {
      font-size: 14.5px;
      line-height: 1.78;
      color: var(--t1)
    }

    .mcontent p {
      margin-bottom: 10px
    }

    .mcontent p:last-child {
      margin-bottom: 0
    }

    .mcontent strong {
      color: #c4b5fd;
      font-weight: 600
    }

    .mcontent em {
      color: var(--t2)
    }

    .mcontent h1,
    .mcontent h2,
    .mcontent h3 {
      color: var(--acc);
      margin: 14px 0 7px;
      font-weight: 700
    }

    .mcontent h1 {
      font-size: 19px
    }

    .mcontent h2 {
      font-size: 16px
    }

    .mcontent h3 {
      font-size: 14px
    }

    .mcontent ul,
    .mcontent ol {
      padding-left: 20px;
      margin: 8px 0
    }

    .mcontent li {
      margin-bottom: 5px;
      margin-left: 24px;
      list-style-position: outside;
    }

    .mcontent blockquote {
      border-left: 3px solid var(--acc);
      padding: 8px 14px;
      margin: 10px 0;
      background: var(--acc-dim);
      border-radius: 0 7px 7px 0;
      color: var(--t2)
    }

    .mcontent code.ic {
      font-family: 'JetBrains Mono', monospace;
      font-size: 12.5px;
      background: rgba(108, 99, 255, .12);
      border: 1px solid rgba(108, 99, 255, .22);
      color: #c4b5fd;
      padding: 1px 6px;
      border-radius: 4px
    }

    .mcontent table {
      width: 100%;
      border-collapse: collapse;
      margin: 12px 0;
      font-size: 13px
    }

    .mcontent th {
      background: var(--p3);
      padding: 8px 12px;
      border: 1px solid var(--b1);
      font-weight: 600;
      text-align: left;
      color: var(--t1)
    }

    .mcontent td {
      padding: 8px 12px;
      border: 1px solid var(--b1);
      color: var(--t2)
    }

    .mcontent tr:nth-child(even) td {
      background: var(--p2)
    }

    /* ─ FILE ANALYSIS BOX ─ */
    .file-analysis {
      background: var(--p2);
      border: 1px solid var(--b1);
      border-left: 3px solid var(--teal);
      border-radius: 8px;
      padding: 10px 13px;
      margin-bottom: 10px;
      font-size: 12px;
      color: var(--t2);
      display: flex;
      align-items: center;
      gap: 8px
    }

    .file-analysis .fa-icon {
      font-size: 16px;
      flex-shrink: 0
    }

    .file-analysis .fa-info {
      flex: 1;
      min-width: 0
    }

    .file-analysis .fa-name {
      font-weight: 600;
      color: var(--t1);
      font-size: 12px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis
    }

    .file-analysis .fa-meta {
      font-size: 10px;
      color: var(--t3);
      font-family: 'JetBrains Mono', monospace
    }

    /* ─ CODE BLOCK ─ */
    .cblock {
      margin: 14px 0;
      border-radius: 11px;
      overflow: hidden;
      border: 1px solid var(--b1);
      background: var(--p2)
    }

    .cblock-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 9px 14px;
      background: var(--p3);
      border-bottom: 1px solid var(--b1);
      gap: 10px
    }

    .chead-l {
      display: flex;
      align-items: center;
      gap: 9px;
      min-width: 0
    }

    .cdots {
      display: flex;
      gap: 5px;
      flex-shrink: 0
    }

    .cdot {
      width: 10px;
      height: 10px;
      border-radius: 50%
    }

    .cfile {
      font-family: 'JetBrains Mono', monospace;
      font-size: 12px;
      color: var(--t1);
      font-weight: 500;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis
    }

    .clang {
      font-family: 'JetBrains Mono', monospace;
      font-size: 9px;
      background: var(--acc-dim);
      border: 1px solid rgba(108, 99, 255, .28);
      color: var(--acc);
      padding: 2px 8px;
      border-radius: 20px;
      letter-spacing: .5px;
      flex-shrink: 0
    }

    .chead-r {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-shrink: 0
    }

    .cbtn {
      font-family: 'JetBrains Mono', monospace;
      font-size: 10px;
      background: var(--p2);
      border: 1px solid var(--b2);
      color: var(--t2);
      padding: 4px 10px;
      border-radius: 5px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 5px;
      transition: all .15s;
      white-space: nowrap
    }

    .cbtn:hover {
      border-color: var(--acc);
      color: var(--acc);
      background: var(--acc-dim)
    }

    .cbtn.dl:hover {
      border-color: var(--green);
      color: var(--green);
      background: rgba(77, 255, 180, .08)
    }

    .cbtn.ok {
      border-color: var(--green) !important;
      color: var(--green) !important;
      background: rgba(77, 255, 180, .08) !important
    }

    .cblock-scroll {
      overflow-x: auto;
      max-height: 480px;
      overflow-y: auto
    }

    .cblock-scroll::-webkit-scrollbar {
      width: 4px;
      height: 4px
    }

    .cblock-scroll::-webkit-scrollbar-thumb {
      background: var(--b2)
    }

    .ccode-wrap {
      display: flex;
      min-width: 100%;
    }

    .line-nums {
      display: flex;
      flex-direction: column;
      padding: 16px 14px;
      background: var(--p2);
      border-right: 1px solid var(--b2);
      color: var(--t3);
      font-family: 'JetBrains Mono', monospace;
      font-size: 13px;
      line-height: 1.75;
      text-align: right;
      user-select: none;
    }

    .line-num {
      display: block;
    }

    .ccode {
      display: block;
      font-family: 'JetBrains Mono', monospace;
      font-size: 13px;
      line-height: 1.75;
      color: #cdd6f4;
      padding: 16px 20px;
      white-space: pre !important;
      tab-size: 4;
      -moz-tab-size: 4;
      overflow-x: auto;
      word-break: normal;
      background: transparent !important;
      margin: 0 !important;
      border: none !important;
      flex: 1;
    }


    /* typing */
    .tdots {
      display: flex;
      gap: 5px;
      padding: 4px 0
    }

    .tdots span {
      width: 7px;
      height: 7px;
      background: var(--acc);
      border-radius: 50%;
      opacity: .3;
      animation: bdot 1.2s ease-in-out infinite
    }

    .tdots span:nth-child(2) {
      animation-delay: .2s
    }

    .tdots span:nth-child(3) {
      animation-delay: .4s
    }

    @keyframes bdot {
      30% {
        opacity: 1;
        transform: translateY(-4px)
      }

      0%,
      60%,
      100% {
        opacity: .3;
        transform: none
      }
    }

    /* file chip */
    .fatt {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      background: var(--p3);
      border: 1px solid var(--b2);
      border-radius: 7px;
      padding: 7px 12px;
      margin-bottom: 10px;
      font-size: 12px;
      color: var(--t2);
      max-width: 260px
    }

    /* ─ INPUT ZONE ─ */
    .izone {
      flex-shrink: 0;
      padding: 10px 20px max(16px, env(safe-area-inset-bottom));
      border-top: 1px solid rgba(255, 255, 255, 0.08);
      background: rgba(7, 8, 15, 0.94);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      position: relative;
      z-index: 50;
    }

    .iinner {
      max-width: 860px;
      margin: 0 auto;
    }

    .itbar {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 12px;
      flex-wrap: nowrap;
      overflow-x: auto;
      padding: 4px 2px 8px 2px;
      -webkit-overflow-scrolling: touch;
    }
    .itbar::-webkit-scrollbar { height: 4px; }
    .itbar::-webkit-scrollbar-thumb { background: rgba(56, 189, 248, 0.25); border-radius: 4px; }

    .itbtn {
      background: rgba(15, 20, 32, 0.85);
      border: 1px solid rgba(255, 255, 255, 0.12);
      color: #e2e8f0 !important;
      padding: 6px 12px;
      border-radius: 10px;
      font-family: 'Outfit', sans-serif;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
      transition: all .18s cubic-bezier(0.4, 0, 0.2, 1);
      white-space: nowrap;
      flex-shrink: 0;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    }
    .itbtn:hover {
      background: rgba(28, 38, 58, 0.95);
      border-color: rgba(255, 255, 255, 0.25);
      color: #ffffff !important;
      transform: translateY(-1px);
    }

    .itbtn svg {
      flex-shrink: 0;
      stroke-width: 2;
    }

    /* Refined Low-Glow Cyber Tool Badges */
    .itbtn.btn-attach {
      color: #38bdf8 !important;
      border-color: rgba(56, 189, 248, 0.35);
      background: rgba(56, 189, 248, 0.08);
    }
    .itbtn.btn-attach:hover {
      background: rgba(56, 189, 248, 0.18);
      border-color: #38bdf8;
      color: #ffffff !important;
    }

    .itbtn.btn-image {
      color: #c084fc !important;
      border-color: rgba(192, 132, 252, 0.35);
      background: rgba(192, 132, 252, 0.08);
    }
    .itbtn.btn-image:hover {
      background: rgba(192, 132, 252, 0.18);
      border-color: #c084fc;
      color: #ffffff !important;
    }

    .itbtn.btn-voice {
      color: #fb7185 !important;
      border-color: rgba(244, 63, 94, 0.35);
      background: rgba(244, 63, 94, 0.08);
    }
    .itbtn.btn-voice:hover, .itbtn.btn-voice.listening {
      background: rgba(244, 63, 94, 0.22);
      border-color: #f43f5e;
      color: #ffffff !important;
    }

    .itbtn.btn-web {
      color: #2dd4bf !important;
      border-color: rgba(45, 212, 191, 0.35);
      background: rgba(45, 212, 191, 0.08);
    }
    .itbtn.btn-web:hover, .itbtn.btn-web.on {
      background: rgba(45, 212, 191, 0.22);
      border-color: #2dd4bf;
      color: #ffffff !important;
    }

    .itbtn.btn-code {
      color: #fbbf24 !important;
      border-color: rgba(251, 191, 36, 0.35);
      background: rgba(251, 191, 36, 0.08);
    }
    .itbtn.btn-code:hover {
      background: rgba(251, 191, 36, 0.18);
      border-color: #fbbf24;
      color: #ffffff !important;
    }

    .itbtn.btn-memory {
      color: #818cf8 !important;
      border-color: rgba(129, 140, 248, 0.35);
      background: rgba(129, 140, 248, 0.08);
    }
    .itbtn.btn-memory:hover {
      background: rgba(129, 140, 248, 0.2);
      border-color: #818cf8;
      color: #ffffff !important;
    }

    .itbtn.btn-focus {
      color: #34d399 !important;
      border-color: rgba(52, 211, 153, 0.35);
      background: rgba(52, 211, 153, 0.08);
    }
    .itbtn.btn-focus:hover, .itbtn.btn-focus.active {
      background: rgba(52, 211, 153, 0.2);
      border-color: #34d399;
      color: #ffffff !important;
    }

    .itbtn.btn-tools {
      color: #e879f9 !important;
      border-color: rgba(232, 121, 249, 0.35);
      background: rgba(232, 121, 249, 0.08);
    }
    .itbtn.btn-tools:hover {
      background: rgba(232, 121, 249, 0.2);
      border-color: #e879f9;
      color: #ffffff !important;
    }

    /* ── OVERFLOW TOOLS DROPDOWN & ULTRA TOOLS ANIMATIONS ── */
    .tools-overflow {
      position: relative;
      flex-shrink: 0;
    }
    .tools-overflow-menu {
      display: none;
      position: absolute;
      bottom: calc(100% + 10px);
      left: 0;
      background: rgba(13, 18, 36, 0.96);
      border: 1px solid rgba(56, 189, 248, 0.35);
      border-radius: 14px;
      padding: 8px;
      z-index: 200;
      min-width: 260px;
      box-shadow: 0 16px 45px rgba(0,0,0,0.85), 0 0 25px rgba(56, 189, 248, 0.2);
      flex-direction: column;
      gap: 6px;
      backdrop-filter: blur(24px);
      transform: translateY(8px) scale(0.95);
      opacity: 0;
      transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
      pointer-events: none;
    }
    .tools-overflow-menu.open {
      display: flex;
      transform: translateY(0) scale(1);
      opacity: 1;
      pointer-events: auto;
    }
    .tools-overflow-menu .itbtn {
      width: 100%;
      padding: 8px 12px;
      border-radius: 8px;
      justify-content: flex-start;
    }

    /* ── AKNEX ULTRA TOOLS SUITE MODAL (ANIMATED) ── */
    .ultra-tools-modal {
      position: fixed;
      inset: 0;
      background: rgba(4, 7, 18, 0.88);
      backdrop-filter: blur(16px);
      z-index: 1350;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 16px;
      opacity: 0;
      transition: opacity 0.25s ease;
    }
    .ultra-tools-modal.open {
      display: flex;
      opacity: 1;
      animation: modalFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }
    .ultra-tools-box {
      background: linear-gradient(180deg, rgba(13, 18, 36, 0.98) 0%, rgba(8, 12, 24, 0.98) 100%);
      border: 1.5px solid rgba(56, 189, 248, 0.4);
      border-radius: 22px;
      width: 980px;
      max-width: 96vw;
      max-height: 90vh;
      display: flex;
      flex-direction: column;
      box-shadow: 0 25px 80px rgba(0, 0, 0, 0.85), 0 0 45px rgba(56, 189, 248, 0.2);
      overflow: hidden;
      transform: scale(0.94) translateY(16px);
      animation: boxPopUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }
    .tool-filter-pill {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--b2);
      color: var(--t2);
      padding: 6px 14px;
      border-radius: 20px;
      font-size: 11.5px;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.18s ease;
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    .tool-filter-pill:hover, .tool-filter-pill.active {
      background: rgba(56, 189, 248, 0.15);
      border-color: rgba(56, 189, 248, 0.6);
      color: #38bdf8;
      box-shadow: 0 0 14px rgba(56, 189, 248, 0.25);
    }
    .tool-suite-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      gap: 14px;
      padding: 4px 2px;
    }
    .tool-suite-card {
      background: rgba(18, 24, 44, 0.7);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 14px;
      padding: 16px;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
      position: relative;
      overflow: hidden;
      animation: toolCardFadeIn 0.35s ease backwards;
    }
    @keyframes toolCardFadeIn {
      from { opacity: 0; transform: translateY(10px); }
      to { opacity: 1; transform: translateY(0); }
    }
    .tool-suite-card:hover {
      transform: translateY(-4px);
      border-color: rgba(56, 189, 248, 0.65);
      background: rgba(22, 32, 58, 0.95);
      box-shadow: 0 14px 32px rgba(0, 0, 0, 0.6), 0 0 24px rgba(56, 189, 248, 0.25);
    }
    .tool-suite-card::before {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0; height: 2px;
      background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.85), transparent);
      opacity: 0;
      transition: opacity 0.25s;
    }
    .tool-suite-card:hover::before {
      opacity: 1;
    }

    .isep {
      width: 1px;
      height: 18px;
      background: rgba(255, 255, 255, 0.12);
      margin: 0 2px;
      flex-shrink: 0;
    }

    .fchips {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      margin-bottom: 8px
    }

    .fchip {
      background: rgba(18, 22, 36, 0.9);
      border: 1px solid rgba(56, 189, 248, 0.3);
      border-radius: 8px;
      padding: 6px 10px;
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 11.5px;
      color: #f1f5f9;
      max-width: 240px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    .fchip span {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap
    }

    .fchip .ftype {
      font-size: 9px;
      font-family: 'JetBrains Mono', monospace;
      color: #38bdf8;
      background: rgba(56, 189, 248, 0.15);
      border-radius: 4px;
      padding: 1px 6px;
      flex-shrink: 0;
      font-weight: 700;
    }

    .fremove {
      background: none;
      border: none;
      color: var(--t3);
      cursor: pointer;
      font-size: 14px;
      line-height: 1;
      padding: 0;
      flex-shrink: 0;
      transition: color .14s
    }
    .fremove:hover { color: var(--red); }

    /* ── UNIFIED CLEAN GLASS INPUT BOX ── */
    .ibox {
      display: flex;
      align-items: center;
      background: rgba(15, 20, 34, 0.9);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 14px;
      transition: border-color .2s ease, box-shadow .2s ease;
      box-shadow: 0 4px 20px rgba(0,0,0,0.4);
      padding: 4px 6px;
      position: relative;
    }

    .ibox:focus-within {
      border-color: rgba(56, 189, 248, 0.45);
      box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(56, 189, 248, 0.1);
    }

    #inp {
      flex: 1;
      background: transparent;
      border: none;
      outline: none;
      color: #f8fafc;
      font-family: 'Outfit', sans-serif;
      font-size: 14px;
      padding: 8px 12px;
      resize: none;
      min-height: 40px;
      max-height: 200px;
      line-height: 1.5;
    }

    #inp::placeholder {
      color: #64748b;
      font-weight: 400;
    }

    /* Inline mic button */
    .in-box-voice-btn {
      background: rgba(244, 63, 94, 0.08);
      border: 1px solid rgba(244, 63, 94, 0.3);
      color: #fb7185;
      width: 34px;
      height: 34px;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 2px 2px;
      flex-shrink: 0;
      transition: all 0.18s ease;
      font-size: 14px;
    }
    .in-box-voice-btn:hover, .in-box-voice-btn.listening {
      background: rgba(244, 63, 94, 0.22);
      border-color: #f43f5e;
      color: #fff;
      box-shadow: 0 0 16px rgba(244, 63, 94, 0.5);
      animation: pulseMic 1.2s infinite alternate;
    }
    @keyframes pulseMic {
      0% { transform: scale(1); box-shadow: 0 0 8px rgba(244, 63, 94, 0.4); }
      100% { transform: scale(1.08); box-shadow: 0 0 18px rgba(244, 63, 94, 0.8); }
    }

    /* ── REAL-TIME VOICE VISUALIZER CONTAINER ── */
    .voice-visualizer-container {
      position: absolute;
      top: -46px;
      left: 50%;
      transform: translateX(-50%);
      background: rgba(15, 23, 42, 0.95);
      border: 1.5px solid rgba(244, 63, 94, 0.5);
      border-radius: 20px;
      padding: 6px 16px;
      display: none;
      align-items: center;
      gap: 10px;
      box-shadow: 0 8px 24px rgba(244, 63, 94, 0.25), 0 0 20px rgba(0, 0, 0, 0.6);
      backdrop-filter: blur(16px);
      z-index: 60;
      animation: voicePulse 1.5s infinite alternate;
      white-space: nowrap;
      pointer-events: none;
    }
    .voice-visualizer-container.listening, .voice-visualizer-container.active {
      display: flex;
    }
    .voice-visualizer-container.processing {
      display: flex;
      border-color: rgba(56, 189, 248, 0.6);
      box-shadow: 0 8px 24px rgba(56, 189, 248, 0.25);
    }
    .vv-wave-bars {
      display: flex;
      align-items: center;
      gap: 3px;
      height: 18px;
    }
    .vv-bar {
      width: 3px;
      height: 16px;
      background: #f43f5e;
      border-radius: 3px;
      transform-origin: center bottom;
      animation: waveBar 0.8s ease-in-out infinite alternate;
    }
    .voice-visualizer-container.processing .vv-bar {
      background: #38bdf8;
    }
    .vv-bar:nth-child(1) { animation-delay: 0.1s; height: 8px; }
    .vv-bar:nth-child(2) { animation-delay: 0.3s; height: 16px; }
    .vv-bar:nth-child(3) { animation-delay: 0.5s; height: 20px; }
    .vv-bar:nth-child(4) { animation-delay: 0.2s; height: 14px; }
    .vv-bar:nth-child(5) { animation-delay: 0.4s; height: 9px; }

    @keyframes waveBar {
      0% { transform: scaleY(0.3); }
      100% { transform: scaleY(1.4); }
    }
    @keyframes voicePulse {
      0% { box-shadow: 0 4px 16px rgba(244, 63, 94, 0.3); }
      100% { box-shadow: 0 4px 28px rgba(244, 63, 94, 0.65); }
    }
    .vv-status-text {
      font-size: 11.5px;
      font-weight: 700;
      color: #f8fafc;
      font-family: 'JetBrains Mono', monospace;
      letter-spacing: 0.3px;
    }

    /* ── 6-DIGIT EMAIL OTP VERIFICATION INPUTS ── */
    .otp-input-digit {
      width: 46px;
      height: 52px;
      text-align: center;
      font-size: 24px;
      font-weight: 800;
      font-family: 'JetBrains Mono', monospace;
      background: var(--p2);
      border: 1.5px solid var(--b2);
      border-radius: 10px;
      color: #38bdf8;
      outline: none;
      transition: all 0.18s ease;
    }
    .otp-input-digit:focus {
      border-color: #38bdf8;
      box-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
      transform: scale(1.06);
      background: var(--p3);
    }

    /* ── MODEL SELECTOR PILL ── */
    .custom-model-select {
      position: relative;
      margin: 2px 2px;
      flex-shrink: 0;
    }

    .model-select-btn {
      background: rgba(24, 32, 50, 0.85);
      border: 1px solid rgba(255, 255, 255, 0.12);
      color: #e2e8f0;
      height: 36px;
      padding: 0 10px;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
      font-family: 'Outfit', sans-serif;
      font-size: 12px;
      font-weight: 600;
      transition: all 0.18s ease;
      white-space: nowrap;
    }

    .model-select-btn:hover {
      background: rgba(36, 48, 74, 0.95);
      border-color: rgba(56, 189, 248, 0.35);
      color: #ffffff;
    }

    .model-select-arrow {
      font-size: 9px;
      color: #94a3b8;
      transition: transform 0.2s;
    }

    .model-dropdown-menu {
      display: none;
      position: absolute;
      bottom: calc(100% + 8px);
      right: 0;
      width: 230px;
      background: #0d1322;
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 12px;
      padding: 6px;
      z-index: 500;
      box-shadow: 0 12px 36px rgba(0,0,0,0.85);
      backdrop-filter: blur(20px);
      flex-direction: column;
      gap: 3px;
      animation: menuPopUp 0.18s ease;
    }
    .model-dropdown-menu.open { display: flex; }

    .model-option {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 8px 10px;
      border-radius: 8px;
      cursor: pointer;
      background: transparent;
      border: 1px solid transparent;
      transition: all 0.15s ease;
      user-select: none;
    }
    .model-option:hover {
      background: rgba(255, 255, 255, 0.06);
      border-color: rgba(255, 255, 255, 0.1);
    }
    .model-option.selected {
      background: rgba(14, 165, 233, 0.12);
      border-color: rgba(14, 165, 233, 0.35);
    }
    .m-opt-ico {
      font-size: 16px;
      flex-shrink: 0;
    }
    .m-opt-text {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 1px;
    }
    .m-opt-text strong {
      font-size: 12px;
      font-weight: 700;
      color: #f1f5f9;
      line-height: 1.2;
    }
    .m-opt-text small {
      font-size: 10.5px;
      color: #94a3b8;
      line-height: 1.2;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .m-opt-badge {
      font-family: 'JetBrains Mono', monospace;
      font-size: 9px;
      font-weight: 800;
      padding: 2px 6px;
      border-radius: 4px;
      text-transform: uppercase;
      flex-shrink: 0;
      background: rgba(255, 255, 255, 0.08);
      color: #cbd5e1;
    }
    .m-opt-badge.speed { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
    .m-opt-badge.brain { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
    .m-opt-badge.swift { background: rgba(52, 211, 153, 0.15); color: #34d399; }
    .m-opt-badge.code { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }

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

    /* ── SEND & STOP BUTTONS ── */
    #sbtn {
      height: 40px;
      min-width: 86px;
      padding: 0 16px;
      margin: 2px 3px;
      border-radius: 10px;
      border: none;
      background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
      color: #ffffff !important;
      font-family: 'Outfit', sans-serif;
      font-size: 13.5px;
      font-weight: 700;
      letter-spacing: 0.3px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 7px;
      flex-shrink: 0;
      transition: all 0.2s ease;
      box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
    }
    #sbtn svg {
      width: 14px;
      height: 14px;
      stroke-width: 2.4;
      flex-shrink: 0;
    }
    #sbtn:hover:not(:disabled) {
      background: linear-gradient(135deg, #0ea5e9 0%, #1d4ed8 100%);
      box-shadow: 0 4px 14px rgba(2, 132, 199, 0.45);
      transform: translateY(-1px);
    }
    #sbtn.ready {
      background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
      box-shadow: 0 2px 12px rgba(14, 165, 233, 0.45);
    }
    #sbtn:disabled {
      background: rgba(255, 255, 255, 0.08);
      color: #94a3b8;
      border: 1px solid rgba(255, 255, 255, 0.1);
      box-shadow: none;
      cursor: pointer;
      opacity: 0.75;
    }
    #sbtn.sending {
      background: linear-gradient(135deg, #0369a1 0%, #1e40af 100%) !important;
      box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25), 0 2px 8px rgba(2, 132, 199, 0.4) !important;
      animation: sbtn-pulse 0.9s ease-in-out infinite;
    }
    @keyframes sbtn-pulse {
      0%, 100% { box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25), 0 2px 8px rgba(2, 132, 199, 0.4); }
      50% { box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.12), 0 4px 16px rgba(2, 132, 199, 0.55); }
    }

    #stopbtn {
      height: 40px;
      min-width: 76px;
      padding: 0 14px;
      margin: 2px 3px;
      border-radius: 10px;
      border: 1px solid rgba(239, 68, 68, 0.4);
      background: #dc2626;
      color: #ffffff;
      font-family: 'Outfit', sans-serif;
      font-size: 13px;
      font-weight: 700;
      cursor: pointer;
      display: none;
      align-items: center;
      justify-content: center;
      gap: 6px;
      flex-shrink: 0;
      transition: all 0.18s ease;
      box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
    }
    #stopbtn:hover {
      background: #b91c1c;
      transform: translateY(-1px);
    }

    .ihint {
      font-family: 'JetBrains Mono', monospace;
      font-size: 10px;
      color: var(--t3);
      text-align: center;
      margin-top: 8px;
      opacity: .4;
      letter-spacing: .2px
    }

    /* ── MODAL ── */
    .overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, .72);
      backdrop-filter: blur(6px);
      z-index: 100;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      pointer-events: none;
      transition: opacity .2s
    }

    .overlay.on {
      opacity: 1;
      pointer-events: all
    }

    .modal {
      background: var(--p1);
      border: 1px solid var(--b2);
      border-radius: 14px;
      padding: 26px;
      width: 400px;
      max-width: 90vw;
      transform: scale(.95) translateY(10px);
      transition: transform .2s
    }

    .overlay.on .modal {
      transform: none
    }

    .modal h3 {
      font-size: 18px;
      font-weight: 700;
      margin-bottom: 7px
    }

    .modal p {
      font-size: 13px;
      color: var(--t2);
      margin-bottom: 18px;
      line-height: 1.6
    }

    .modal-btns {
      display: flex;
      gap: 8px;
      justify-content: flex-end
    }

    .mdbtn {
      padding: 9px 18px;
      border-radius: 8px;
      font-family: 'Outfit', sans-serif;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all .15s
    }

    .mdbtn.sec {
      background: var(--p3);
      border: 1px solid var(--b2);
      color: var(--t2)
    }

    .mdbtn.sec:hover {
      color: var(--t1)
    }

    .mdbtn.pri {
      background: var(--acc);
      border: none;
      color: #fff
    }

    .mdbtn.pri:hover {
      background: #5a52e0
    }

    /* ─ TOAST ─ */
    .toast {
      position: fixed;
      bottom: 22px;
      left: 22px;
      z-index: 200;
      background: var(--p2);
      border: 1px solid var(--b2);
      border-radius: 9px;
      padding: 10px 16px;
      font-size: 13px;
      color: var(--t1);
      display: flex;
      align-items: center;
      gap: 9px;
      transform: translateY(16px);
      opacity: 0;
      transition: all .22s;
      pointer-events: none;
      box-shadow: 0 8px 32px rgba(0, 0, 0, .5)
    }

    .toast.on {
      transform: none;
      opacity: 1
    }

    .tdot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--green);
      flex-shrink: 0
    }

    .tdot.err {
      background: var(--red)
    }

    /* ─ ERROR BOX ─ */
    .errbox {
      background: rgba(255, 94, 122, .08);
      border: 1px solid rgba(255, 94, 122, .22);
      border-left: 3px solid var(--red);
      padding: 13px 15px;
      border-radius: 8px;
      font-family: 'JetBrains Mono', monospace;
      font-size: 12px;
      color: var(--red);
      line-height: 1.8
    }

    /* ═══════════════════════════════════════════════════════════════
       MOBILE & RESPONSIVE ARCHITECTURE (MOBILE-FIRST REFLOW)
       ═══════════════════════════════════════════════════════════════ */

    /* ── BASE CONTAINER CONSTRAINTS (NO HORIZONTAL OVERFLOW) ── */
    * {
      box-sizing: border-box;
    }
    html, body {
      max-width: 100vw;
      overflow-x: hidden;
      margin: 0;
      padding: 0;
    }

    .main {
      width: 100%;
      max-width: 100%;
      min-width: 0;
      overflow-x: hidden;
    }

    #chat {
      width: 100%;
      max-width: 100%;
      overflow-x: hidden;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    .mwrap {
      width: min(100%, 880px);
      margin: 0 auto;
      padding: 0 16px;
      box-sizing: border-box;
    }

    .mcontent {
      word-break: break-word;
      overflow-wrap: break-word;
    }

    .mcontent pre, 
    .mcontent .cblock {
      max-width: 100%;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }

    .mcontent table {
      display: block;
      max-width: 100%;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      border-collapse: collapse;
    }

    .iinner {
      width: min(100%, 860px);
      margin: 0 auto;
      padding: 0;
    }

    .sidebar-backdrop {
      display: none;
    }

    /* ── TABLET BREAKPOINT (768px to 1023px) ── */
    @media (min-width: 768px) and (max-width: 1023px) {
      :root {
        --sidebar: 240px;
      }
      .wgrid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
      }
      .tbtn span {
        display: inline !important;
      }
      .tb-right {
        gap: 6px;
      }
      .izone {
        padding: 8px 16px max(12px, env(safe-area-inset-bottom));
      }
    }

    /* ── MOBILE BREAKPOINT (< 768px) — TRUE NATIVE AI APP REFLOW ── */
    @media (max-width: 767px) {
      :root {
        --sidebar: 0px;
      }

      /* 1. SIDEBAR AS SLIDE-IN SHEET / DRAWER */
      .sidebar {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        width: min(85vw, 300px) !important;
        z-index: 10000 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s ease !important;
        box-shadow: none !important;
        background: rgba(10, 14, 26, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border-right: 1px solid rgba(255, 255, 255, 0.12) !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        margin-left: 0 !important;
      }

      .sidebar.open {
        transform: translateX(0) !important;
        box-shadow: 16px 0 48px rgba(0, 0, 0, 0.85) !important;
      }

      .sidebar-backdrop {
        display: block !important;
        position: fixed !important;
        inset: 0 !important;
        background: rgba(0, 0, 0, 0.72) !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        z-index: 9990 !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transition: opacity 0.25s ease !important;
      }

      .sidebar-backdrop.open {
        opacity: 1 !important;
        pointer-events: auto !important;
      }

      /* 2. REFLOW TOPBAR (SLEEK APP HEADER) */
      .topbar {
        height: 52px !important;
        padding: 0 12px !important;
        gap: 8px !important;
        background: rgba(7, 8, 15, 0.96) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
      }

      .tb-left {
        gap: 8px !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
      }

      .menu-btn {
        width: 36px !important;
        height: 36px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 9px !important;
        background: rgba(255, 255, 255, 0.06) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
      }

      .chat-name {
        max-width: 140px !important;
        font-size: 13.5px !important;
        font-weight: 700 !important;
        color: #f8fafc !important;
      }

      .ver-tag {
        display: none !important;
      }

      .conn-pill {
        padding: 2px 6px !important;
        font-size: 9.5px !important;
      }
      .conn-pill span:not(#connDot) {
        display: none !important;
      }

      .tb-right {
        gap: 6px !important;
        flex-shrink: 0 !important;
      }

      /* Icon-Only Buttons on Mobile Header */
      .tbtn span,
      #themeLabel {
        display: none !important;
      }

      .tbtn {
        padding: 6px 10px !important;
        font-size: 12px !important;
        border-radius: 8px !important;
        min-height: 34px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
      }

      .theme-btn {
        padding: 6px 10px !important;
        border-radius: 8px !important;
        min-height: 34px !important;
      }

      #loginBtnTop {
        padding: 5px 10px !important;
        font-size: 11px !important;
      }

      /* 3. CHAT AREA & MESSAGES REFLOW */
      #chat {
        padding: 12px 0 140px 0 !important;
      }

      .mwrap {
        padding: 0 12px !important;
        margin-bottom: 12px !important;
      }

      .mavatar {
        width: 28px !important;
        height: 28px !important;
        font-size: 11px !important;
        border-radius: 8px !important;
      }

      .mhead {
        gap: 6px !important;
        margin-bottom: 4px !important;
      }

      .mname {
        font-size: 11.5px !important;
      }

      .mbtns {
        opacity: 1 !important;
      }

      .mcontent {
        font-size: 13.5px !important;
        line-height: 1.65 !important;
      }

      .mcontent h1 { font-size: 16.5px !important; margin: 10px 0 5px !important; }
      .mcontent h2 { font-size: 14.5px !important; margin: 8px 0 4px !important; }
      .mcontent h3 { font-size: 13.5px !important; margin: 6px 0 3px !important; }

      .mcontent ul, .mcontent ol {
        padding-left: 14px !important;
      }

      .mcontent li {
        margin-left: 10px !important;
        margin-bottom: 3px !important;
      }

      .cblock {
        margin: 8px 0 !important;
        border-radius: 8px !important;
      }

      .cblock-head {
        padding: 6px 10px !important;
      }

      .ccode {
        padding: 10px !important;
        font-size: 11.5px !important;
      }

      /* 4. WELCOME HERO ON MOBILE */
      #welcome {
        padding: 4px 12px !important;
        margin: 6px auto 0 !important;
      }

      .whero-brand {
        margin-bottom: 10px !important;
      }

      .whero-icon-container {
        width: 70px !important;
        height: 70px !important;
      }

      .whero-icon {
        width: 60px !important;
        height: 60px !important;
        border-radius: 16px !important;
      }

      .whero-icon img {
        width: 36px !important;
        height: 36px !important;
      }

      .whero-glow-ring {
        inset: -8px !important;
        filter: blur(12px) !important;
      }

      .whero-orbital-ring {
        inset: -5px !important;
        border-radius: 20px !important;
      }

      .whero-orbital-ring-2 {
        display: none !important;
      }

      .wtitle {
        font-size: 21px !important;
        letter-spacing: -0.5px !important;
        line-height: 1.25 !important;
        margin-bottom: 4px !important;
      }

      .w-cheer {
        font-size: 12px !important;
        line-height: 1.45 !important;
        margin-bottom: 12px !important;
        padding: 0 4px !important;
      }

      .wgrid {
        grid-template-columns: 1fr !important;
        gap: 7px !important;
        padding: 0 !important;
      }

      .wcard {
        padding: 10px 12px !important;
        border-radius: 10px !important;
        font-size: 12px !important;
      }

      .wcard-ico {
        font-size: 16px !important;
      }

      /* 5. INPUT ZONE (CLEAN BOTTOM BAR) */
      .izone {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        padding: 6px 10px max(10px, env(safe-area-inset-bottom)) 10px !important;
        background: rgba(7, 8, 15, 0.97) !important;
        backdrop-filter: blur(24px) !important;
        -webkit-backdrop-filter: blur(24px) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
        z-index: 100 !important;
      }

      .itbar {
        gap: 6px !important;
        margin-bottom: 6px !important;
        padding: 2px 0 4px 0 !important;
      }

      .itbtn {
        padding: 4px 9px !important;
        font-size: 11px !important;
        border-radius: 8px !important;
        gap: 4px !important;
      }

      .ibox {
        padding: 7px 10px !important;
        border-radius: 14px !important;
        background: rgba(15, 23, 42, 0.9) !important;
        border: 1.5px solid rgba(255, 255, 255, 0.14) !important;
      }

      #inp {
        font-size: 14px !important;
        max-height: 100px !important;
        min-height: 22px !important;
        padding: 2px 0 !important;
      }

      .ibox-foot {
        margin-top: 4px !important;
        gap: 6px !important;
      }

      #reasoningModeSelect {
        padding: 4px 6px !important;
        font-size: 10.5px !important;
        max-width: 110px !important;
        border-radius: 6px !important;
      }

      #sbtn {
        width: 32px !important;
        height: 32px !important;
        padding: 0 !important;
        font-size: 13px !important;
        border-radius: 8px !important;
        align-items: center;
        justify-content: center;
      }

      /* 6. MODALS & POPUPS ON MOBILE (BOTTOM SHEET OR CENTERED) */
      .memory-modal,
      .ultra-tools-modal,
      .modal {
        padding: 8px !important;
        align-items: flex-end !important;
      }

      .memory-box,
      .ultra-tools-box,
      .modal-box {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 88dvh !important;
        border-radius: 18px 18px 10px 10px !important;
        padding: 16px 14px !important;
      }

      .mem-wizard-card {
        padding: 14px !important;
        border-radius: 12px !important;
      }

      .mem-wizard-qtitle {
        font-size: 14px !important;
      }

      .mem-wizard-input {
        font-size: 13px !important;
        padding: 10px 12px !important;
      }

      .tool-suite-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
      }

      .file-upload-progress-container {
        padding: 8px 12px !important;
        margin: 4px auto !important;
        border-radius: 10px !important;
      }

      .sp-fab {
        bottom: 85px !important;
        right: 12px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 16px !important;
      }

      .speak-panel {
        bottom: 135px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
      }
    }

    /* ── REASONING BAR ── */
    .reasoning-bar {
      display: flex;
      gap: 8px;
      margin-bottom: 10px;
      align-items: center;
      padding: 0 4px;
    }
    .rmode-btn {
      background: var(--p3);
      border: 1px solid var(--b1);
      color: var(--t2);
      padding: 6px 12px;
      border-radius: 20px;
      font-size: 11px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }
    .rmode-btn:hover {
      background: var(--p2);
      color: var(--t1);
      border-color: var(--b2);
    }
    .rmode-btn.active {
      background: var(--acc-dim);
      border-color: var(--acc);
      color: var(--t1);
      box-shadow: 0 0 10px var(--acc-dim);
    }

    /* ── DROPDOWN ── */
    .dropdown {
      position: relative;
      display: inline-block;
    }
    .dropdown-content {
      display: none;
      position: absolute;
      right: 0;
      top: 36px;
      background: var(--p2);
      border: 1px solid var(--b2);
      border-radius: 8px;
      min-width: 140px;
      z-index: 100;
      box-shadow: 0 8px 32px rgba(0,0,0,0.5);
      overflow: hidden;
    }
    .dropdown-content a {
      color: var(--t2);
      padding: 10px 14px;
      text-decoration: none;
      display: block;
      font-size: 12px;
      font-weight: 500;
      transition: all 0.15s ease;
      border-bottom: 1px solid var(--b1);
    }
    .dropdown-content a:last-child {
      border-bottom: none;
    }
    .dropdown-content a:hover {
      background: var(--p3);
      color: var(--t1);
    }

    /* ── AI TERMINAL ── */
    .terminal-panel {
      position: fixed;
      bottom: 0;
      left: var(--sidebar);
      right: 0;
      height: 320px;
      background: #05070c;
      border-top: 2px solid var(--b1);
      display: none;
      flex-direction: column;
      z-index: 90;
      box-shadow: 0 -8px 32px rgba(0,0,0,0.4);
    }
    .terminal-header {
      height: 40px;
      background: #090d16;
      border-bottom: 1px solid var(--b1);
      padding: 0 16px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      color: #38bdf8;
      font-family: 'JetBrains Mono', monospace;
      font-size: 12px;
      font-weight: bold;
    }
    .terminal-body {
      flex: 1;
      padding: 16px;
      overflow-y: auto;
      font-family: 'JetBrains Mono', monospace;
      font-size: 12px;
      color: #f1f5f9;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .terminal-input-row {
      display: flex;
      align-items: center;
      gap: 8px;
      border-top: 1px solid var(--b1);
      padding: 12px 16px;
      background: #06090e;
    }
    .terminal-prompt {
      color: #22c55e;
      font-weight: bold;
    }
    .terminal-input {
      flex: 1;
      background: transparent;
      border: none;
      outline: none;
      color: #38bdf8;
      font-family: inherit;
      font-size: inherit;
    }
    .terminal-btn {
      background: #0f172a;
      border: 1px solid #334155;
      color: #94a3b8;
      border-radius: 4px;
      padding: 4px 10px;
      cursor: pointer;
      font-family: inherit;
      font-size: 11px;
      transition: all 0.15s;
    }
    .terminal-btn:hover {
      border-color: #38bdf8;
      color: #f8fafc;
    }

    /* ── PREVIEW PANEL ── */
    .preview-panel {
      width: 500px;
      background: var(--p1);
      border-left: 1px solid var(--b1);
      display: none;
      flex-direction: column;
      flex-shrink: 0;
      z-index: 95;
    }
    .preview-header {
      height: 56px;
      background: var(--p2);
      border-bottom: 1px solid var(--b1);
      padding: 0 16px;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .preview-container {
      flex: 1;
      overflow: auto;
      background: #0a0e17;
      color: #f1f5f9;
      position: relative;
    }

    /* ── SYSTEM MAINTENANCE OVERLAY ── */
    #maintenanceOverlay {
      position: fixed;
      inset: 0;
      background: radial-gradient(ellipse at 50% 20%, rgba(59, 130, 246, 0.14) 0%, #060812 75%);
      z-index: 9999;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 24px;
      backdrop-filter: blur(16px);
      animation: fadeIn 0.3s ease;
    }
    .maint-card {
      background: rgba(13, 18, 31, 0.95);
      border: 1px solid rgba(59, 130, 246, 0.35);
      border-radius: 24px;
      padding: 40px 32px;
      max-width: 540px;
      width: 100%;
      text-align: center;
      box-shadow: 0 0 80px rgba(59, 130, 246, 0.15), 0 30px 60px rgba(0, 0, 0, 0.8);
      position: relative;
    }
    .maint-logo-glow {
      width: 88px;
      height: 88px;
      margin: 0 auto 20px;
      background: #0b0c0e;
      border-radius: 22px;
      padding: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 0 30px rgba(59, 130, 246, 0.4);
      border: 1px solid rgba(255, 255, 255, 0.12);
      animation: maintPulse 2.5s infinite ease-in-out;
    }
    @keyframes maintPulse {
      0%, 100% { transform: scale(1); box-shadow: 0 0 30px rgba(59, 130, 246, 0.4); }
      50% { transform: scale(1.05); box-shadow: 0 0 45px rgba(99, 102, 241, 0.6); }
    }
    .maint-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: rgba(245, 158, 11, 0.14);
      border: 1px solid rgba(245, 158, 11, 0.35);
      color: #f59e0b;
      padding: 5px 14px;
      border-radius: 20px;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.5px;
      text-transform: uppercase;
      margin-bottom: 16px;
    }
    .maint-badge::before {
      content: '';
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: #f59e0b;
      box-shadow: 0 0 8px #f59e0b;
    }
    .maint-title {
      font-size: 24px;
      font-weight: 800;
      color: #fff;
      margin-bottom: 12px;
      letter-spacing: -0.5px;
    }
    .maint-desc {
      font-size: 13.5px;
      color: var(--t2);
      line-height: 1.6;
      margin-bottom: 24px;
    }
    .maint-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin-bottom: 24px;
      text-align: left;
    }
    .maint-grid-item {
      background: rgba(23, 32, 51, 0.7);
      border: 1px solid var(--b1);
      border-radius: 10px;
      padding: 10px 14px;
    }
    .maint-grid-item strong {
      font-size: 11px;
      color: var(--t3);
      text-transform: uppercase;
      display: block;
      font-family: 'JetBrains Mono', monospace;
    }
    .maint-grid-item span {
      font-size: 13px;
      font-weight: 600;
      color: #38bdf8;
    }
    .maint-btn-row {
      display: flex;
      justify-content: center;
      gap: 12px;
      flex-wrap: wrap;
    }
    .maint-btn-primary {
      background: linear-gradient(135deg, var(--acc), #8b5cf6);
      color: #fff;
      border: none;
      padding: 10px 20px;
      border-radius: 10px;
      font-size: 13px;
      font-weight: 700;
      cursor: pointer;
      box-shadow: 0 4px 16px var(--acc-glow);
      transition: all 0.2s;
    }
    .maint-btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
    .maint-btn-secondary {
      background: var(--p3);
      border: 1px solid var(--b1);
      color: var(--t2);
      padding: 10px 18px;
      border-radius: 10px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
    }
    .maint-btn-secondary:hover { color: #fff; border-color: var(--acc); }

    /* ── CONNECTION STATUS PILL ── */
    .conn-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 10px;
      border-radius: 20px;
      background: rgba(13, 18, 31, 0.85);
      border: 1px solid rgba(255, 255, 255, 0.12);
      font-size: 11px;
      font-weight: 600;
      color: #94a3b8;
      cursor: pointer;
      user-select: none;
      transition: all 0.2s;
    }
    .conn-pill:hover { border-color: rgba(56, 189, 248, 0.4); color: #f8fafc; }
    .conn-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: #10b981;
      box-shadow: 0 0 8px #10b981;
      transition: all 0.3s;
    }
    .conn-dot.reconnecting {
      background: #f59e0b;
      box-shadow: 0 0 10px #f59e0b;
      animation: pulse 1.2s infinite;
    }
    .conn-dot.offline {
      background: #ef4444;
      box-shadow: 0 0 10px #ef4444;
    }

    /* ── FOCUS MODE BANNER ── */
    .focus-banner {
      background: linear-gradient(90deg, rgba(16, 185, 129, 0.12) 0%, rgba(6, 182, 212, 0.1) 100%);
      border-bottom: 1px solid rgba(16, 185, 129, 0.25);
      padding: 8px 16px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      animation: slideDown 0.3s ease;
      z-index: 10;
    }
    .focus-banner-content {
      display: flex;
      align-items: center;
      gap: 10px;
      flex: 1;
      min-width: 0;
    }
    .focus-ico { font-size: 16px; flex-shrink: 0; }
    .focus-banner-info { min-width: 0; flex: 1; }
    .focus-banner-info strong {
      font-size: 12px;
      font-weight: 700;
      color: #34d399;
      display: block;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .focus-prog-bar {
      width: 100%;
      max-width: 180px;
      height: 5px;
      background: rgba(255, 255, 255, 0.1);
      border-radius: 4px;
      margin-top: 3px;
      overflow: hidden;
    }
    .focus-prog-fill {
      height: 100%;
      background: linear-gradient(90deg, #10b981, #06b6d4);
      border-radius: 4px;
      transition: width 0.4s ease;
    }
    .focus-btn-action {
      background: rgba(16, 185, 129, 0.2);
      border: 1px solid rgba(16, 185, 129, 0.4);
      color: #a7f3d0;
      border-radius: 6px;
      padding: 3px 10px;
      font-size: 11px;
      font-weight: 700;
      cursor: pointer;
      flex-shrink: 0;
      transition: all 0.2s;
    }
    .focus-btn-action:hover {
      background: rgba(16, 185, 129, 0.35);
      color: #fff;
    }

    /* ── CONTEXT RECALL CARD ── */
    .context-recall-card {
      margin: 12px auto;
      max-width: 680px;
      width: calc(100% - 24px);
      background: rgba(15, 23, 42, 0.75);
      border: 1.5px solid rgba(129, 140, 248, 0.35);
      border-radius: 14px;
      padding: 12px 16px;
      backdrop-filter: blur(12px);
      box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(129, 140, 248, 0.15);
      animation: fadeIn 0.3s ease;
    }
    .cr-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 8px;
      gap: 8px;
    }
    .cr-badge {
      font-size: 11.5px;
      font-weight: 800;
      color: #c7d2fe;
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    .cr-meta {
      font-size: 10.5px;
      color: #94a3b8;
    }
    .cr-items {
      display: flex;
      flex-direction: column;
      gap: 4px;
      margin-bottom: 10px;
    }
    .cr-item {
      font-size: 12px;
      color: #e2e8f0;
      padding: 4px 8px;
      background: rgba(30, 41, 59, 0.5);
      border-radius: 6px;
      border-left: 3px solid #818cf8;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .cr-item-cat {
      font-size: 9.5px;
      font-weight: 700;
      color: #818cf8;
      text-transform: uppercase;
    }
    .cr-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }
    .cr-btn {
      padding: 5px 12px;
      border-radius: 8px;
      font-size: 11px;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.2s;
      border: none;
    }
    .cr-btn.use-ctx {
      background: linear-gradient(135deg, #6366f1, #8b5cf6);
      color: #fff;
      box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
    }
    .cr-btn.use-ctx:hover { opacity: 0.9; transform: translateY(-1px); }
    .cr-btn.ignore-ctx {
      background: rgba(255, 255, 255, 0.08);
      color: #94a3b8;
    }
    .cr-btn.ignore-ctx:hover { color: #fff; background: rgba(255, 255, 255, 0.15); }
    .cr-btn.manage-ctx {
      background: transparent;
      border: 1px solid rgba(129, 140, 248, 0.4);
      color: #c7d2fe;
      margin-left: auto;
    }
    .cr-btn.manage-ctx:hover { background: rgba(129, 140, 248, 0.15); }

    /* ── AUTH BOOTSTRAP LOADER OVERLAY ── */
    #authBootOverlay {
      position: fixed;
      inset: 0;
      background: #060812;
      z-index: 10000;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    #authBootOverlay.hide {
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
    }
    .boot-card {
      text-align: center;
      max-width: 380px;
      padding: 24px;
    }
    .boot-logo {
      width: 72px;
      height: 72px;
      margin: 0 auto 16px;
      border-radius: 18px;
      box-shadow: 0 0 40px rgba(6, 182, 212, 0.4);
      animation: floatLogo 2s ease-in-out infinite;
    }
    .boot-spinner {
      width: 24px;
      height: 24px;
      border: 2.5px solid rgba(56, 189, 248, 0.2);
      border-top-color: #38bdf8;
      border-radius: 50%;
      margin: 16px auto;
      animation: spin 0.8s linear infinite;
    }
    .boot-text {
      font-size: 14px;
      font-weight: 700;
      color: #f8fafc;
      letter-spacing: 0.5px;
      margin-bottom: 4px;
    }
    .boot-sub {
      font-size: 11px;
      color: #64748b;
    }

    /* ── MEMORY MODAL & TABS ── */
    #memoryModal {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.8);
      z-index: 9998;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 20px;
      backdrop-filter: blur(12px);
    }
    #memoryModal.open { display: flex; }
    .mem-modal-content {
      background: #0c1220;
      border: 1.5px solid rgba(129, 140, 248, 0.35);
      border-radius: 20px;
      max-width: 680px;
      width: 100%;
      max-height: 85vh;
      display: flex;
      flex-direction: column;
      box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8), 0 0 30px rgba(129, 140, 248, 0.2);
      overflow: hidden;
    }
    .mem-modal-header {
      padding: 16px 20px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .mem-modal-header h3 {
      margin: 0;
      font-size: 16px;
      font-weight: 800;
      color: #f8fafc;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .mem-tabs {
      display: flex;
      padding: 0 16px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
      background: rgba(15, 23, 42, 0.6);
      gap: 6px;
      overflow-x: auto;
    }
    .mem-tab-btn {
      padding: 10px 14px;
      background: none;
      border: none;
      border-bottom: 2px solid transparent;
      color: #94a3b8;
      font-size: 12px;
      font-weight: 700;
      cursor: pointer;
      white-space: nowrap;
      transition: all 0.2s;
    }
    .mem-tab-btn.active {
      color: #c7d2fe;
      border-bottom-color: #818cf8;
    }
    .mem-modal-body {
      padding: 16px 20px;
      overflow-y: auto;
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .mem-card {
      background: rgba(23, 32, 51, 0.6);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 10px;
      padding: 12px 14px;
      display: flex;
      flex-direction: column;
      gap: 6px;
      transition: all 0.2s;
    }
    .mem-card:hover { border-color: rgba(129, 140, 248, 0.4); }
    .mem-card-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .mem-tag {
      font-size: 9.5px;
      font-weight: 800;
      padding: 2px 7px;
      border-radius: 4px;
      text-transform: uppercase;
      background: rgba(129, 140, 248, 0.15);
      color: #a5b4fc;
    }
    .mem-card-text {
      font-size: 12.5px;
      color: #e2e8f0;
      line-height: 1.45;
    }
    .mem-card-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 4px;
      font-size: 10px;
      color: #64748b;
    }
    .mem-card-del {
      background: none;
      border: none;
      color: #f43f5e;
      cursor: pointer;
      font-size: 11px;
      font-weight: 700;
      padding: 2px 6px;
    }
    .mem-form-row {
      display: flex;
      gap: 8px;
      margin-bottom: 8px;
    }
    .mem-input {
      flex: 1;
      background: rgba(15, 23, 42, 0.8);
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 8px;
      padding: 8px 12px;
      color: #fff;
      font-size: 12px;
      outline: none;
    }
    .mem-input:focus { border-color: #818cf8; }
    .mem-select {
      background: #0f172a;
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 8px;
      padding: 8px 10px;
      color: #e2e8f0;
      font-size: 11.5px;
      outline: none;
    }

    /* ── AUTH & SETTINGS MODAL STYLES ── */
    .memory-modal {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.85);
      z-index: 9998;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 20px;
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
    }
    .memory-modal.open {
      display: flex !important;
    }
    .google-auth-btn-prominent {
      width: 100%;
      background: #ffffff;
      color: #0f172a;
      border: 1.5px solid rgba(255, 255, 255, 0.4);
      padding: 13px 18px;
      border-radius: 12px;
      font-size: 13.5px;
      font-weight: 800;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 12px;
      box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .google-auth-btn-prominent:hover {
      background: #f8fafc;
      transform: translateY(-2px);
      box-shadow: 0 8px 24px rgba(66, 133, 244, 0.35);
      border-color: #38bdf8;
    }
    .auth-divider {
      display: flex;
      align-items: center;
      margin: 14px 0 16px;
      opacity: 0.8;
    }
    .auth-divider::before, .auth-divider::after {
      content: '';
      flex: 1;
      height: 1px;
      background: var(--b2);
    }
    .auth-divider span {
      font-size: 10.5px;
      font-weight: 800;
      letter-spacing: 1px;
      padding: 0 10px;
      color: var(--t2);
      font-family: 'JetBrains Mono', monospace;
    }
    .mem-tab-btn {
      background: transparent;
      border: 1px solid transparent;
      color: var(--t2);
      padding: 7px 14px;
      border-radius: 8px;
      font-size: 12px;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.18s ease;
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    .mem-tab-btn:hover {
      color: var(--t1);
      background: var(--p2);
    }
    .mem-tab-btn.active {
      background: var(--p3);
      border-color: var(--b2);
      color: var(--acc);
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
    }
    .mem-wizard-input, .mem-input, .mem-select {
      background: var(--p2);
      border: 1.5px solid var(--b2);
      border-radius: 9px;
      padding: 9px 12px;
      color: var(--t1);
      font-size: 12.5px;
      font-family: inherit;
      outline: none;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .mem-wizard-input:focus, .mem-input:focus, .mem-select:focus {
      border-color: var(--acc);
      box-shadow: 0 0 0 3px var(--acc-dim);
    }
    .btn-primary {
      background: linear-gradient(135deg, var(--acc), #8b5cf6);
      color: #ffffff;
      border: none;
      padding: 9px 18px;
      border-radius: 9px;
      font-size: 12.5px;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
      box-shadow: 0 4px 14px var(--acc-dim);
    }
    .btn-primary:hover {
      transform: translateY(-1px);
      box-shadow: 0 6px 18px var(--acc-glow);
    }
    .btn-secondary {
      background: var(--p2);
      border: 1.5px solid var(--b2);
      color: var(--t1);
      padding: 9px 16px;
      border-radius: 9px;
      font-size: 12.5px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
    }
    .btn-secondary:hover {
      border-color: var(--acc);
      color: var(--acc);
      background: var(--p3);
    }
    .otp-input-digit {
      width: 44px;
      height: 52px;
      border-radius: 10px;
      border: 2px solid var(--b2);
      background: var(--p2);
      color: var(--acc);
      font-size: 22px;
      font-weight: 800;
      text-align: center;
      font-family: 'JetBrains Mono', monospace;
      outline: none;
      transition: all 0.2s;
    }
    .otp-input-digit:focus {
      border-color: var(--acc);
      background: var(--p3);
      box-shadow: 0 0 16px var(--acc-glow);
      transform: scale(1.05);
    }
    .switch {
      position: relative;
      display: inline-block;
      width: 38px;
      height: 20px;
    }
    .switch input {
      opacity: 0;
      width: 0;
      height: 0;
    }
    .slider {
      position: absolute;
      cursor: pointer;
      inset: 0;
      background-color: var(--p3);
      border: 1px solid var(--b2);
      transition: .25s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .slider:before {
      position: absolute;
      content: "";
      height: 14px;
      width: 14px;
      left: 2px;
      bottom: 2px;
      background-color: #94a3b8;
      transition: .25s cubic-bezier(0.16, 1, 0.3, 1);
    }
    input:checked + .slider {
      background-color: var(--acc);
      border-color: var(--acc);
    }
    input:checked + .slider:before {
      transform: translateX(18px);
      background-color: #ffffff;
    }
    .slider.round {
      border-radius: 20px;
    }
    .slider.round:before {
      border-radius: 50%;
    }
    .settings-section-card {
      background: var(--p2);
      border: 1.5px solid var(--b1);
      border-radius: 14px;
      padding: 16px 18px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    }
    .settings-card-title {
      font-size: 12.5px;
      font-weight: 800;
      color: var(--t1);
      display: flex;
      align-items: center;
      gap: 8px;
      text-transform: uppercase;
      letter-spacing: 0.6px;
      border-bottom: 1px solid var(--b1);
      padding-bottom: 8px;
      margin-bottom: 2px;
    }
    .settings-item-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 16px;
      padding: 8px 0;
      border-bottom: 1px solid rgba(255,255,255,0.04);
    }
    .settings-item-row:last-child {
      border-bottom: none;
      padding-bottom: 0;
    }
    .settings-item-info {
      display: flex;
      flex-direction: column;
      gap: 2px;
      flex: 1;
      min-width: 0;
    }
    .settings-item-label {
      font-size: 12.5px;
      font-weight: 700;
      color: var(--t1);
    }
    .settings-item-sub {
      font-size: 11px;
      color: var(--t2);
      line-height: 1.4;
    }
    .settings-theme-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
      gap: 10px;
    }
    .settings-theme-card {
      background: var(--p3);
      border: 1.5px solid var(--b2);
      border-radius: 12px;
      padding: 14px 10px;
      text-align: center;
      cursor: pointer;
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
    }
    .settings-theme-card:hover {
      border-color: var(--acc);
      transform: translateY(-2px);
      box-shadow: 0 4px 14px var(--acc-dim);
    }
    .settings-theme-card.active {
      border-color: var(--acc);
      background: rgba(56, 189, 248, 0.12);
      box-shadow: 0 0 18px var(--acc-dim);
    }
    .settings-lang-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
      gap: 8px;
      max-height: 220px;
      overflow-y: auto;
      padding-right: 4px;
    }
    .settings-lang-card {
      background: var(--p3);
      border: 1px solid var(--b2);
      border-radius: 10px;
      padding: 8px 10px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 12px;
      font-weight: 600;
      color: var(--t1);
      transition: all 0.18s;
    }
    .settings-lang-card:hover {
      border-color: var(--acc);
      background: var(--p2);
    }
    .settings-lang-card.active {
      border-color: var(--acc);
      background: rgba(56, 189, 248, 0.14);
      color: var(--acc);
      font-weight: 700;
    }
    .swatch-btn {
      width: 26px;
      height: 26px;
      border-radius: 50%;
      border: 2px solid transparent;
      cursor: pointer;
      transition: transform 0.18s, border-color 0.18s;
    }
    .swatch-btn:hover, .swatch-btn.active {
      transform: scale(1.15);
      border-color: #fff;
    }
    .lang-opt {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 10px;
      border-radius: 8px;
      color: var(--t1);
      text-decoration: none;
      font-size: 12px;
      font-weight: 600;
      transition: background 0.15s;
    }
    .lang-opt:hover {
      background: var(--p2);
      color: var(--acc);
    }

    /* ── CLEAN MODEL INFO PILL (No raw IDs like 347) ── */
    .model-info-pill {
      background: rgba(15, 23, 42, 0.85);
      border: 1px solid rgba(56, 189, 248, 0.3);
      color: #7dd3fc;
      border-radius: 6px;
      padding: 2px 8px;
      font-family: 'JetBrains Mono', monospace;
      font-size: 10px;
      font-weight: 700;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      margin-left: 6px;
      transition: all 0.2s;
    }
    .model-info-pill:hover {
      background: rgba(56, 189, 248, 0.2);
      border-color: #38bdf8;
      color: #fff;
    }

    /* ── AMBIENT CYBER BACKGROUND ANIMATIONS ── */
    .ambient-bg-layer {
      position: fixed;
      inset: 0;
      pointer-events: none;
      z-index: 0;
      overflow: hidden;
      opacity: 0.65;
      transition: opacity 0.5s ease;
    }
    .ambient-orb {
      position: absolute;
      border-radius: 50%;
      filter: blur(80px);
      opacity: 0.45;
      animation: floatAmbientOrb 20s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
    }
    .ambient-orb-1 {
      width: 520px;
      height: 520px;
      top: -10%;
      left: 15%;
      background: radial-gradient(circle, var(--acc-glow) 0%, rgba(6,182,212,0) 70%);
      animation-duration: 18s;
    }
    .ambient-orb-2 {
      width: 480px;
      height: 480px;
      bottom: -10%;
      right: 10%;
      background: radial-gradient(circle, rgba(139,92,246,0.38) 0%, rgba(139,92,246,0) 70%);
      animation-duration: 24s;
      animation-delay: -5s;
    }
    .ambient-orb-3 {
      width: 400px;
      height: 400px;
      top: 45%;
      left: 55%;
      background: radial-gradient(circle, rgba(16,185,129,0.28) 0%, rgba(16,185,129,0) 70%);
      animation-duration: 22s;
      animation-delay: -10s;
    }
    .ambient-orb-4 {
      width: 350px;
      height: 350px;
      top: 15%;
      right: 25%;
      background: radial-gradient(circle, rgba(249,115,22,0.22) 0%, rgba(249,115,22,0) 70%);
      animation-duration: 28s;
      animation-delay: -14s;
    }

    @keyframes floatAmbientOrb {
      0% { transform: translate(0, 0) scale(1); }
      33% { transform: translate(60px, -40px) scale(1.1); }
      66% { transform: translate(-40px, 50px) scale(0.92); }
      100% { transform: translate(30px, 20px) scale(1.05); }
    }

    /* ── REAL FILE & IMAGE UPLOAD PROGRESS BAR ── */
    .file-upload-progress-container {
      margin: 8px auto;
      max-width: 860px;
      padding: 12px 16px;
      background: rgba(15, 23, 42, 0.95);
      border: 1px solid rgba(56, 189, 248, 0.35);
      border-radius: 14px;
      box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(56,189,248,0.18);
      backdrop-filter: blur(14px);
      animation: fadeIn 0.2s ease;
      position: relative;
      z-index: 60;
    }
    .fup-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
    }
    .fup-file-info {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
    }
    .fup-icon {
      font-size: 22px;
      flex-shrink: 0;
    }
    .fup-filename {
      font-size: 13px;
      font-weight: 700;
      color: #f8fafc;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 240px;
    }
    .fup-meta {
      font-size: 10.5px;
      color: #94a3b8;
      font-family: 'JetBrains Mono', monospace;
    }
    .fup-percent {
      font-size: 13px;
      font-weight: 800;
      color: #38bdf8;
      font-family: 'JetBrains Mono', monospace;
    }
    .fup-bar-track {
      width: 100%;
      height: 6px;
      background: rgba(255, 255, 255, 0.08);
      border-radius: 6px;
      overflow: hidden;
      position: relative;
    }
    .fup-bar-fill {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, #06b6d4, #8b5cf6);
      border-radius: 6px;
      transition: width 0.18s ease-out;
      box-shadow: 0 0 12px rgba(6,182,212,0.6);
    }

    /* ── STEP-BY-STEP MEMORY QUESTION WIZARD ── */
    .mem-wizard-container {
      display: flex;
      flex-direction: column;
      gap: 14px;
      padding: 4px;
    }
    .mem-wizard-progress-bar {
      width: 100%;
      height: 6px;
      background: rgba(255,255,255,0.08);
      border-radius: 6px;
      overflow: hidden;
      margin-bottom: 8px;
    }
    .mem-wizard-progress-fill {
      height: 100%;
      background: linear-gradient(90deg, #06b6d4, #8b5cf6);
      border-radius: 6px;
      transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
      box-shadow: 0 0 10px rgba(6,182,212,0.5);
    }
    .mem-wizard-step-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 11px;
      font-weight: 800;
      color: #38bdf8;
      background: rgba(56,189,248,0.12);
      border: 1px solid rgba(56,189,248,0.3);
      padding: 3px 10px;
      border-radius: 12px;
      font-family: 'JetBrains Mono', monospace;
    }
    .mem-wizard-card {
      background: rgba(15, 23, 42, 0.7);
      border: 1.5px solid rgba(129, 140, 248, 0.3);
      border-radius: 14px;
      padding: 20px;
      transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
      box-shadow: 0 8px 32px rgba(0,0,0,0.35);
      animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .mem-wizard-qtitle {
      font-size: 15px;
      font-weight: 800;
      color: #f8fafc;
      margin-bottom: 6px;
    }
    .mem-wizard-qsub {
      font-size: 12px;
      color: #94a3b8;
      margin-bottom: 14px;
      line-height: 1.45;
    }
    .mem-wizard-input {
      width: 100%;
      background: rgba(10, 15, 28, 0.9);
      border: 1.5px solid rgba(255, 255, 255, 0.15);
      border-radius: 10px;
      padding: 12px 14px;
      color: #f8fafc;
      font-size: 13.5px;
      outline: none;
      transition: all 0.2s ease;
      font-family: inherit;
    }
    .mem-wizard-input:focus {
      border-color: #38bdf8;
      box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
    }
    .mem-wizard-nav {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 14px;
    }
    .mem-wizard-hint {
      font-size: 11px;
      color: #64748b;
      display: flex;
      align-items: center;
      gap: 4px;
      font-family: 'JetBrains Mono', monospace;
    }

    @keyframes slideInRight {
      from { opacity: 0; transform: translateX(24px); }
      to { opacity: 1; transform: translateX(0); }
    }
    @keyframes slideInLeft {
      from { opacity: 0; transform: translateX(-24px); }
      to { opacity: 1; transform: translateX(0); }
    }

    /* ═══════════════════════════════════════════
       SETTINGS & PREFERENCES MODAL RICH STYLES
       ═══════════════════════════════════════════ */
    .settings-section-card {
      background: var(--p2);
      border: 1px solid var(--b2);
      border-radius: 14px;
      padding: 16px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    }
    .settings-card-title {
      font-size: 13px;
      font-weight: 800;
      color: var(--t1);
      display: flex;
      align-items: center;
      gap: 8px;
      border-bottom: 1px solid var(--b1);
      padding-bottom: 8px;
    }
    .settings-item-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      padding: 6px 0;
    }
    .settings-item-info {
      flex: 1;
      min-width: 0;
    }
    .settings-item-label {
      font-size: 12.5px;
      font-weight: 700;
      color: var(--t1);
    }
    .settings-item-sub {
      font-size: 11px;
      color: var(--t2);
      margin-top: 2px;
      line-height: 1.4;
    }
    .settings-theme-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
      gap: 10px;
    }
    .settings-theme-card {
      background: var(--p3);
      border: 1.5px solid var(--b2);
      border-radius: 12px;
      padding: 14px 10px;
      display: flex;
      flex-direction: column;
      align-items: center;
      text-align: center;
      gap: 4px;
      cursor: pointer;
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .settings-theme-card:hover {
      border-color: var(--acc);
      transform: translateY(-2px);
      box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    }
    .settings-theme-card.active {
      border-color: var(--acc);
      background: rgba(56, 189, 248, 0.1);
      box-shadow: 0 0 16px var(--acc-glow);
    }
    .settings-lang-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
      gap: 8px;
      max-height: 260px;
      overflow-y: auto;
      padding-right: 4px;
    }
    .settings-lang-card {
      background: var(--p3);
      border: 1.5px solid var(--b2);
      border-radius: 10px;
      padding: 10px 12px;
      display: flex;
      align-items: center;
      gap: 10px;
      cursor: pointer;
      transition: all 0.18s ease;
      font-size: 12px;
      font-weight: 600;
      color: var(--t1);
    }
    .settings-lang-card:hover {
      border-color: var(--acc);
      background: rgba(56, 189, 248, 0.08);
      transform: translateX(2px);
    }
    .settings-lang-card.active {
      border-color: var(--acc);
      background: rgba(56, 189, 248, 0.15);
      box-shadow: 0 0 12px var(--acc-glow);
    }
    .swatch-btn {
      width: 24px;
      height: 24px;
      border-radius: 50%;
      border: 2px solid rgba(255,255,255,0.2);
      cursor: pointer;
      transition: all 0.18s ease;
    }
    .swatch-btn:hover {
      transform: scale(1.2);
      border-color: #fff;
      box-shadow: 0 0 10px rgba(255,255,255,0.5);
    }

    /* Switch toggle */
    .switch {
      position: relative;
      display: inline-block;
      width: 40px;
      height: 22px;
      flex-shrink: 0;
    }
    .switch input {
      opacity: 0;
      width: 0;
      height: 0;
    }
    .slider {
      position: absolute;
      cursor: pointer;
      top: 0; left: 0; right: 0; bottom: 0;
      background-color: var(--p3);
      border: 1px solid var(--b2);
      transition: .25s;
    }
    .slider:before {
      position: absolute;
      content: "";
      height: 14px;
      width: 14px;
      left: 3px;
      bottom: 3px;
      background-color: var(--t2);
      transition: .25s;
    }
    .switch input:checked + .slider {
      background-color: var(--acc);
      border-color: var(--acc);
    }
    .switch input:checked + .slider:before {
      transform: translateX(18px);
      background-color: #ffffff;
    }
    .slider.round {
      border-radius: 22px;
    }
    .slider.round:before {
      border-radius: 50%;
    }

    /* ── MOBILE RESPONSIVE CRACKING FIXES ── */
    @media (max-width: 768px) {
      html, body {
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
        position: fixed;
        width: 100%;
      }
      .main {
        height: 100dvh;
        max-height: 100dvh;
        width: 100%;
        overflow: hidden;
      }
      .topbar {
        padding: 0 12px;
        height: 50px;
      }
      .menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
      }
      .chat-name {
        max-width: 140px;
        font-size: 13px;
      }
      #chat {
        padding: 14px 0 10px;
      }
      #welcome {
        margin: 8px auto 0;
        padding: 0 14px;
      }
      .wic-wrapper {
        margin-bottom: 10px;
      }
      .wic {
        width: 74px;
        height: 74px;
        border-radius: 20px;
      }
      .wic img {
        width: 60px !important;
        height: 60px !important;
      }
      .w-greeting-badge {
        font-size: 10px;
        padding: 4px 12px;
        margin-bottom: 8px;
      }
      .wtitle {
        font-size: 24px;
        line-height: 1.2;
      }
      .w-cheer {
        font-size: 12px;
        margin-bottom: 8px;
      }
      .wsub {
        font-size: 9.5px;
        margin-bottom: 16px;
      }
      .wgrid {
        grid-template-columns: 1fr;
        gap: 6px;
      }
      .wcard {
        padding: 10px 12px;
      }
      .wcard-ico {
        font-size: 16px;
        margin-bottom: 4px;
      }
      .wcard-txt {
        font-size: 11.5px;
      }
      .izone {
        padding: 8px 10px max(12px, env(safe-area-inset-bottom));
      }
      .itbar {
        gap: 4px;
        margin-bottom: 6px;
      }
      .itbtn {
        padding: 5px 9px;
        font-size: 10.5px;
      }
      #inp {
        font-size: 16px !important; /* Prevents mobile iOS safari zoom cracking */
        padding: 8px 10px;
        min-height: 40px;
      }
      .model-select-btn {
        height: 34px;
        padding: 0 8px;
        font-size: 10.5px;
      }
      .model-dropdown-menu {
        width: calc(100vw - 24px);
        max-width: 300px;
        right: -60px;
      }
      #sbtn {
        height: 34px;
        padding: 0 12px;
        font-size: 12px;
      }
    }

    /* ═══════════════════════════════════════════════════════════════
       ZERO-LEAK VIEWPORT ARCHITECTURE — CRITICAL FIXES
       ═══════════════════════════════════════════════════════════════ */

    /* Prevent ALL horizontal scroll leaks */
    html, body {
      overflow-x: hidden !important;
      max-width: 100vw !important;
    }

    /* Message body content — prevent code blocks and tables from causing horizontal overflow */
    .msgbody {
      overflow-wrap: anywhere;
      word-break: break-word;
      max-width: 100%;
      overflow-x: auto;
    }

    .msgbody pre {
      max-width: 100%;
      overflow-x: auto;
      white-space: pre-wrap;
      word-wrap: break-word;
    }

    .msgbody table {
      max-width: 100%;
      overflow-x: auto;
      display: block;
      font-size: 12px;
    }

    .msgbody img {
      max-width: 100%;
      height: auto;
    }

    /* Modal overflow safety */
    .memory-modal .memory-box {
      max-width: calc(100vw - 20px) !important;
      max-height: 90dvh !important;
      overflow-y: auto;
    }

    /* Chat container must fill available height exactly */
    .main {
      height: 100dvh;
      height: 100svh;
      max-height: 100dvh;
      overflow: hidden;
    }

    #chat {
      flex: 1;
      overflow-y: auto;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
      max-width: 100%;
    }

    /* Input zone safe-area for iOS notch */
    .izone {
      padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
    }

    /* Topbar overflow prevention */
    .topbar {
      overflow: hidden;
      max-width: 100%;
    }

    .topbar-right {
      overflow: hidden;
      flex-shrink: 1;
      min-width: 0;
    }

    /* Model engine selector styles */
    .model-engine-select {
      background: var(--p2);
      border: 1px solid var(--b1);
      border-radius: 8px;
      color: var(--t1);
      font-size: 12px;
      font-weight: 600;
      padding: 6px 10px;
      cursor: pointer;
      outline: none;
      font-family: 'Outfit', sans-serif;
      transition: all 0.2s;
      -webkit-appearance: none;
      appearance: none;
    }

    .model-engine-select:hover,
    .model-engine-select:focus {
      border-color: var(--acc);
      box-shadow: 0 0 12px var(--acc-dim);
    }

    /* Responsive mobile fixes for topbar items */
    @media (max-width: 480px) {
      .topbar-right .tbtn span.tbtn-text {
        display: none !important;
      }
      .topbar-right {
        gap: 4px !important;
      }
      .model-engine-select {
        font-size: 10px;
        padding: 4px 6px;
        max-width: 100px;
      }
    }

    @media (max-width: 768px) {
      .memory-modal .memory-box {
        max-width: calc(100vw - 16px) !important;
        max-height: 88dvh !important;
        padding: 16px !important;
        border-radius: 14px !important;
      }
    }

    /* ═══════════════════════════════════════════════════════════════
       LANGUAGE SELECTOR DROPDOWN (PROMINENT, HIGH-CONTRAST, NO CLIPPING)
       ═══════════════════════════════════════════════════════════════ */
    .itbar,
    .ibox,
    .izone {
      overflow: visible !important;
    }

    .dropdown-lang {
      position: relative;
      display: inline-block;
    }

    #langMenu.dropdown-content {
      position: absolute;
      bottom: calc(100% + 8px);
      left: 0;
      min-width: 250px;
      max-width: 320px;
      max-height: 320px;
      overflow-y: auto;
      background: var(--p1);
      border: 1.5px solid var(--b2);
      border-radius: 14px;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 24px rgba(56, 189, 248, 0.2);
      padding: 8px;
      z-index: 99999 !important;
      display: none;
      backdrop-filter: blur(24px);
      -webkit-backdrop-filter: blur(24px);
    }

    #langMenu.dropdown-content.show {
      display: block !important;
      animation: langDropdownIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    @keyframes langDropdownIn {
      0% {
        opacity: 0;
        transform: translateY(8px) scale(0.96);
      }
      100% {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }

    .lang-opt {
      display: flex !important;
      align-items: center;
      gap: 10px;
      padding: 9px 12px;
      color: #f1f5f9 !important;
      text-decoration: none !important;
      font-size: 12.5px;
      font-weight: 600;
      border-radius: 9px;
      transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
      margin-bottom: 3px;
      background: transparent;
      border: 1px solid transparent;
      cursor: pointer;
    }

    .lang-opt:hover {
      background: rgba(56, 189, 248, 0.14) !important;
      color: #38bdf8 !important;
      border-color: rgba(56, 189, 248, 0.3);
      transform: translateX(4px);
    }

    /* ═══════════════════════════════════════════════════════════════
       NEW CHAT ULTRA-SMOOTH AESTHETIC ANIMATION (ZERO GLITCH)
       ═══════════════════════════════════════════════════════════════ */
    @keyframes welcomeSessionIn {
      0% {
        opacity: 0;
        transform: translate3d(0, 18px, 0) scale(0.96);
        filter: blur(8px);
      }
      60% {
        opacity: 0.95;
        transform: translate3d(0, -2px, 0) scale(1.01);
        filter: blur(0px);
      }
      100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
        filter: blur(0);
      }
    }

    .welcome.welcome-session-reset,
    .welcome.chat-create-burst {
      animation: welcomeSessionIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
      position: relative;
    }

    .welcome.welcome-session-reset .wcard,
    .welcome.chat-create-burst .wcard {
      animation: cardPopIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
    }
    .welcome.welcome-session-reset .wcard:nth-child(1),
    .welcome.chat-create-burst .wcard:nth-child(1) { animation-delay: 0.03s; }
    .welcome.welcome-session-reset .wcard:nth-child(2),
    .welcome.chat-create-burst .wcard:nth-child(2) { animation-delay: 0.06s; }
    .welcome.welcome-session-reset .wcard:nth-child(3),
    .welcome.chat-create-burst .wcard:nth-child(3) { animation-delay: 0.09s; }
    .welcome.welcome-session-reset .wcard:nth-child(4),
    .welcome.chat-create-burst .wcard:nth-child(4) { animation-delay: 0.12s; }
    .welcome.welcome-session-reset .wcard:nth-child(5),
    .welcome.chat-create-burst .wcard:nth-child(5) { animation-delay: 0.15s; }
    .welcome.welcome-session-reset .wcard:nth-child(6),
    .welcome.chat-create-burst .wcard:nth-child(6) { animation-delay: 0.18s; }

    .chat-reset-flash {
      animation: resetGlow 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    @keyframes resetGlow {
      0% {
        box-shadow: inset 0 0 45px rgba(56, 189, 248, 0.35), 0 0 30px rgba(139, 92, 246, 0.2);
      }
      100% {
        box-shadow: none;
      }
    }