/* ============================================================
 * Edlix AI — Main UI Stylesheet
 * Extracted from index.html (inline <style> blocks in <head>)
 * Author: Revant Sahu | Nagchetra Labs
 * ============================================================ */

    :root {
      /* --- 1. BASE COLORS (Defining the 'var' sources) --- */
      --purple: #7c3aed;
      --purple-lt: #a78bfa;
      --purple-dk: #5b21b6;
      --purple-dk2: #2e1065;
      --pink: #ec4899;
      --cyan: #06b6d4;
      --cyan-dk: #0891b2;
      --green: #10b981;
      --yellow: #f59e0b;
      --orange: #f97316;
      --amber: #fbbf24;
      --indigo: #6366f1;
      --teal: #14b8a6;
      --emerald: #10b981;
      --emerald-dk: #059669;
      --danger: #ef4444;
      --danger-lt: #f87171;
      --danger-dk: #b91c1c;
      --blue-light: #60a5fa;
      --white: #ffffff;
      --black: #000000;

      /* --- 2. BACKGROUNDS & SURFACES --- */
      --bg-deep: #020617;
      --bg-void: #000000;
      --bg-surface: #0f172a;
      --bg-surface-2: #1e293b;
      --bg-card: #00030d07;
      --bg-dark-card: #111827;
      --bg-input: #00030c00;
      --bg-wiki: #0d0f1f;
      --bg-mm-center: #1a1c2e;
      --bg-overlay: rgba(0, 0, 0, 0.5);
      --bg-overlay-95: #0a0010ee;
      --bg-terminal: var(--bg-deep);
      --bg-skeleton: #1e293b;
      --bg-skeleton-2: #2a2f4a;

      /* --- 3. BORDERS & GLOWS --- */
      --border: #4c00ff;
      --border-glow: #5c3bff55;
      --radius: 14px;

      /* --- 4. TYPOGRAPHY --- */
      --text: #e2e8f0;
      --text-muted: #6b7280;
      --text-dim: #94a3b8;
      --text-bright: #f0f0f0;
      --font-main: 'Space Grotesk', sans-serif;
      --font-mono: 'JetBrains Mono', monospace;

      /* --- 5. SEARCH & NAVIGATION --- */
      --sidebar-w: 280px;
      --search-purple: #8b5cf6;
      --search-slate: #334155;
      --search-dark: #0f172a;

      /* --- 6. FACE / CHARACTER CUSTOMIZATION --- */
      --face-primary: var(--purple);
      --face-secondary: var(--purple-lt);
      --face-bg: #1e1b4b;
      --face-border: var(--purple);
      --face-glow: #7c3aed66;
      --face-eye-color: var(--purple);
      --face-pupil: var(--purple-lt);
      --bg-eye: #111111;

      /* --- 7. SPECIAL UTILITIES --- */
      --terminal-green: #00ff9c;
      --blue-glass: #2563eb;
      --neutral-dark: #333333;
      --neutral-mid: #555555;
      --sk-speed: 1.4s;
    }

    .input-disabled {
      pointer-events: none;
      opacity: 0.6;
      filter: blur(0.5px);
    }

    .input-loading {
      display: flex;
      align-items: center;
      gap: 10px;
      color: var(--purple-lt);
      font-size: 13px;
      padding: 10px;
    }

    .hidden {
      display: none;
    }

    /* Dot loader */
    .loader-dots {
      display: flex;
      gap: 4px;
    }

    .loader-dots span {
      width: 6px;
      height: 6px;
      background: var(--cyan);
      border-radius: 50%;
      animation: dotBounce 0.8s infinite ease-in-out;
    }

    .loader-dots span:nth-child(2) {
      animation-delay: 0.1s;
    }

    .loader-dots span:nth-child(3) {
      animation-delay: 0.2s;
    }

    @keyframes dotBounce {

      0%,
      80%,
      100% {
        transform: scale(0.6);
        opacity: 0.5;
      }

      40% {
        transform: scale(1);
        opacity: 1;
      }
    }

    .secret-terminal {
      position: fixed;
      inset: 0;
      background: var(--bg-terminal);
      color: var(--terminal-green);
      font-family: monospace;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      z-index: 9999;
      animation: fadeIn .3s;
    }

    .terminal-text {
      text-shadow: 0 0 10px var(--terminal-green);
      animation: blink 1s infinite;
    }

    @keyframes blink {
      50% {
        opacity: .6;
      }
    }

    #input-bar-skeleton {
      padding: 16px 20px;
      border-top: 1px solid var(--border);
      background: var(--bg-deep);
    }

    .sk {
      position: relative;
      overflow: hidden;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 16px;
    }

    /* shimmer */
    .sk::after {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg,
          transparent,
          var(--purple-lt),
          var(--cyan),
          transparent);
      transform: translateX(-100%);
      animation: skMove 1.4s infinite;
    }

    @keyframes skMove {
      100% {
        transform: translateX(100%)
      }
    }

    .sk-textarea {
      height: 34px;
      margin: 12px;
      border-radius: 10px;
      background: var(--bg-deep);
    }

    .sk-actions {
      display: flex;
      gap: 8px;
      padding: 0 12px 12px 12px;
      justify-content: flex-end;
    }

    .sk-icon {
      width: 30px;
      height: 30px;
      border-radius: 8px;
      background: var(--bg-deep);
    }

    .sk-send {
      width: 70px;
      height: 30px;
      border-radius: 10px;
      background: var(--purple);
    }

    .sk-footer {
      display: flex;
      justify-content: space-between;
      margin-top: 8px;
    }

    .sk-small {
      width: 80px;
      height: 10px;
      border-radius: 6px;
      background: var(--bg-card);
    }

    .somosa {
      display: none;
    }

    /* ══════════════════════════════════════════════
   IMAGE GEN — Animation, Toolbar, Gallery
══════════════════════════════════════════════ */

    /* Image Gen Loading State */
    .img-gen-loader {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 10px;
      padding: 16px;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 14px;
      min-width: 260px;
    }

    .img-gen-stage {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 13px;
      color: var(--text-muted);
      transition: color 0.3s;
    }

    .img-gen-stage.active {
      color: var(--purple-lt);
    }

    .img-gen-stage.done {
      color: var(--green);
    }

    .img-gen-icon {
      width: 28px;
      height: 28px;
      border-radius: 8px;
      background: var(--bg-deep);
      border: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      flex-shrink: 0;
    }

    .img-gen-stage.active .img-gen-icon {
      border-color: var(--purple);
      animation: imgIconPulse 1s ease-in-out infinite;
    }

    .img-gen-stage.done .img-gen-icon {
      border-color: var(--green);
    }

    @keyframes imgIconPulse {

      0%,
      100% {
        box-shadow: 0 0 0 0 var(--purple)44;
      }

      50% {
        box-shadow: 0 0 0 6px transparent;
      }
    }

    .img-gen-dots {
      display: flex;
      gap: 4px;
      margin-left: 38px;
    }

    .img-gen-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--purple);
      animation: imgDotBounce 1.2s ease-in-out infinite;
    }

    .img-gen-dot:nth-child(2) {
      animation-delay: 0.2s;
    }

    .img-gen-dot:nth-child(3) {
      animation-delay: 0.4s;
    }

    @keyframes imgDotBounce {

      0%,
      80%,
      100% {
        transform: scale(0.6);
        opacity: 0.4;
      }

      40% {
        transform: scale(1);
        opacity: 1;
      }
    }

    .img-prompt-preview {
      font-size: 11px;
      color: var(--text-muted);
      font-style: italic;
      margin-left: 38px;
      padding: 6px 10px;
      background: var(--bg-deep);
      border-radius: 8px;
      border-left: 2px solid var(--purple)66;
      max-width: 300px;
      word-break: break-word;
    }

    /* Shimmer overlay on generating image */
    .img-shimmer-wrap {
      position: relative;
      border-radius: 12px;
      overflow: hidden;
    }

    .img-shimmer {
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg, transparent 0%, var(--purple)22 50%, transparent 100%);
      background-size: 200% 100%;
      animation: imgShimmer 1.5s linear infinite;
      border-radius: 12px;
    }

    @keyframes imgShimmer {
      0% {
        background-position: 200% 0;
      }

      100% {
        background-position: -200% 0;
      }
    }

    /* Generated Image Container */
    .edlix-image-result {
      display: flex;
      flex-direction: column;
      gap: 8px;
      max-width: 480px;
    }

    .edlix-image-result img {
      width: 100%;
      border-radius: 12px;
      border: 1px solid var(--border);
      display: block;
      animation: imgReveal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    @keyframes imgReveal {
      from {
        opacity: 0;
        transform: scale(0.95);
      }

      to {
        opacity: 1;
        transform: scale(1);
      }
    }

    /* Image Toolbar */
    .edlix-img-toolbar {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
    }

    .img-tool-btn {
      display: flex;
      align-items: center;
      gap: 5px;
      padding: 6px 12px;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: var(--bg-card);
      color: var(--text-dim);
      font-size: 12px;
      font-family: var(--font-main);
      cursor: pointer;
      transition: all 0.15s;
      font-weight: 500;
    }

    .img-tool-btn:hover {
      border-color: var(--purple);
      color: var(--text);
      background: var(--purple)11;
    }

    .img-tool-btn.primary {
      background: linear-gradient(135deg, var(--purple), var(--purple-dk));
      border-color: transparent;
      color: var(--white);
    }

    .img-tool-btn.primary:hover {
      opacity: 0.9;
    }

    .img-tool-btn:active {
      transform: scale(0.96);
    }

    .img-prompt-label {
      font-size: 11px;
      color: var(--text-muted);
      padding: 4px 0;
      font-style: italic;
    }

    /* Gallery Section */
    #gallery-section {
      display: none;
      flex-direction: column;
      height: 100%;
      overflow: hidden;
    }

    .gallery-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 20px 24px 16px;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }

    .gallery-title {
      font-size: 18px;
      font-weight: 700;
      color: var(--text);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .gallery-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      gap: 14px;
      padding: 20px 24px;
      overflow-y: auto;
      flex: 1;
    }

    .gallery-item {
      border-radius: 12px;
      overflow: hidden;
      border: 1px solid var(--border);
      background: var(--bg-card);
      cursor: pointer;
      transition: all 0.2s;
      position: relative;
      group: true;
    }

    .gallery-item:hover {
      border-color: var(--purple);
      transform: translateY(-2px);
      box-shadow: 0 8px 24px var(--purple)33;
    }

    .gallery-item img {
      width: 100%;
      aspect-ratio: 1;
      object-fit: cover;
      display: block;
    }

    .gallery-item-info {
      padding: 8px 10px;
    }

    .gallery-item-prompt {
      font-size: 11px;
      color: var(--text-muted);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .gallery-item-date {
      font-size: 10px;
      color: var(--text-dim);
      margin-top: 2px;
    }

    .gallery-item-overlay {
      position: absolute;
      inset: 0;
      background: var(--bg-deep)cc;
      display: none;
      align-items: center;
      justify-content: center;
      gap: 8px;
      border-radius: 12px;
    }

    .gallery-item:hover .gallery-item-overlay {
      display: flex;
    }

    .gallery-empty {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 12px;
      padding: 60px 24px;
      color: var(--text-muted);
      text-align: center;
      grid-column: 1/-1;
    }

    .gallery-empty-icon {
      font-size: 48px;
      opacity: 0.4;
    }

    /* Gallery sidebar link */
    .gallery-nav-btn {
      display: flex;
      align-items: center;
      gap: 9px;
      padding: 9px 12px;
      border-radius: 10px;
      border: none;
      background: transparent;
      color: var(--text-dim);
      font-size: 13px;
      font-family: var(--font-main);
      cursor: pointer;
      width: 100%;
      text-align: left;
      transition: all 0.15s;
    }

    .gallery-nav-btn:hover {
      color: var(--text);
      background: var(--border);
    }

    .gallery-nav-btn.active {
      color: var(--purple-lt);
      background: var(--purple)22;
    }

    /* ── Edlix BG ──────────────────────────── */
    #particles-js {
      position: absolute;
      inset: 0;
      z-index: 0;
      pointer-events: none;
      overflow: hidden;
    }

    #edlix-bg-canvas {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      opacity: 0.48;
    }

    .edlix-rw {
      position: absolute;
      top: 50%;
      left: 50%;
      border-radius: 50%;
      animation: edlix-spin linear infinite;
      will-change: transform;
    }

    .edlix-rw:nth-child(1) {
      width: 520px;
      height: 520px;
      margin: -260px 0 0 -260px;
      animation-duration: 10s
    }

    .edlix-rw:nth-child(2) {
      width: 420px;
      height: 420px;
      margin: -210px 0 0 -210px;
      animation-duration: 16s;
      animation-direction: reverse
    }

    .edlix-rw:nth-child(3) {
      width: 330px;
      height: 330px;
      margin: -165px 0 0 -165px;
      animation-duration: 24s
    }

    .edlix-r {
      width: 100%;
      height: 100%;
      border-radius: 50%;
      transition: all 0.6s ease
    }

    @keyframes edlix-spin {
      to {
        transform: rotate(360deg)
      }
    }

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



    .mobile-skeleton {
      display: none;
    }

    @media(max-width:768px) {
      .mobile-skeleton {
        display: flex;
        flex-direction: column;
        gap: 14px;
        padding: 16px 12px;
        z-index: 999999999999999999;
      }
    }

    .sk-msg {
      display: flex;
      gap: 10px;
      align-items: flex-start;
    }

    .sk-msg.right {
      justify-content: flex-end;
    }

    .sk-avatar {
      width: 30px;
      height: 30px;
      border-radius: 8px;
      background: var(--bg-skeleton);
      animation: skeleton 1.4s infinite;
    }

    .sk-bubble {
      width: 70%;
      height: 44px;
      border-radius: 12px;
      background: var(--bg-skeleton);
      animation: skeleton 1.4s infinite;
    }

    .sk-bubble.w60 {
      width: 60%;
    }

    .sk-input {
      position: fixed;
      bottom: 70px;
      left: 12px;
      right: 12px;
      height: 44px;
      border-radius: 16px;
      background: var(--bg-skeleton);
      animation: skeleton 1.4s infinite;
    }

    @keyframes skeleton {
      0% {
        opacity: 0.4
      }

      50% {
        opacity: 1
      }

      100% {
        opacity: 0.4
      }
    }

    .sk-bubble,
    .sk-avatar,
    .sk-input {
      background: linear-gradient(90deg, var(--bg-skeleton) 25%, var(--bg-skeleton-2) 50%, var(--bg-skeleton) 75%);
      background-size: 200% 100%;
      animation: shimmer 1.2s infinite;
    }

    @keyframes shimmer {
      from {
        background-position: 200% 0
      }

      to {
        background-position: -200% 0
      }
    }

    #topbar {
      transition: transform 0.3s ease;
    }


    body {
      font-family: var(--font-main);
      background: var(--bg-deep);
      color: var(--text);
      min-height: 100vh;
      overflow: hidden;
      display: flex;
    }

    /* ── SCROLLBAR ───────────────────────────────────── */
    ::-webkit-scrollbar {
      width: 4px;
    }

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

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

    /* ── SIDEBAR ─────────────────────────────────────── */


    /* Collapsed: width squeezes to 0, main fills the freed space automatically */
    #sidebar.closed {
      width: 0;
      min-width: 0;
      padding-left: 0;
      padding-right: 0;
      border-right-width: 0;
      opacity: 0;
      pointer-events: none;
    }

    .sidebar-brand {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 8px 10px;
      margin-bottom: 4px;
    }

    .brand-logo {
      width: 36px;
      height: 36px;
      background: linear-gradient(135deg, var(--purple), var(--pink));
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      font-weight: 700;
      color: var(--white);
      box-shadow: 0 0 20px var(--purple)66;
    }

    .brand-name {
      font-size: 18px;
      font-weight: 700;
      color: var(--white);
      letter-spacing: -0.5px;
    }

    .brand-version {
      font-size: 10px;
      background: var(--purple)33;
      color: var(--purple-lt);
      border-radius: 99px;
      padding: 1px 7px;
      font-weight: 600;
    }

    .new-chat-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      background: linear-gradient(135deg, var(--purple), var(--purple-dk));
      border: none;
      border-radius: var(--radius);
      color: var(--white);
      font-family: var(--font-main);
      font-size: 14px;
      font-weight: 600;
      padding: 12px 16px;
      cursor: pointer;
      transition: 0.2s;
      box-shadow: 0 4px 20px var(--purple)44;
    }

    .new-chat-btn:hover {
      opacity: 0.9;
      transform: translateY(-1px);
      box-shadow: 0 8px 28px var(--purple)55;
    }

    .sidebar-label {
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 1.5px;
      text-transform: uppercase;
      color: var(--text-muted);
      padding: 0 8px;
    }

    #sidebar {
      width: var(--sidebar-w);
      min-width: var(--sidebar-w);
      height: 100vh;

      background: var(--bg-card);
      border-right: 1px solid var(--border);

      display: flex;
      flex-direction: column;

      padding: 20px 16px 16px 16px;
      gap: 16px;
      /* Controlled spacing */

      overflow: hidden;
      flex-shrink: 0;

      transition:
        width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
        min-width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
        padding 0.25s ease,
        opacity 0.2s ease;

      z-index: 100;
    }


    #conversation-list {
      flex: 1 1 auto;
      min-height: 0;

      overflow-y: auto;
      overflow-x: hidden;

      display: block;
      padding: 4px 6px 4px 4px;

      scroll-behavior: smooth;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
    }




    .conv-item {
      display: flex;
      align-items: center;
      gap: 10px;

      padding: 12px 14px;
      margin-bottom: 4px;
      min-height: 52px;

      border-radius: 12px;

      font-size: 13px;
      color: var(--text-dim);

      cursor: pointer;
      transition: all 0.15s ease;

      overflow: hidden;
    }

    .conv-item:hover {
      background: var(--border);
      color: var(--text);
    }

    .conv-item.active {
      background: var(--purple)22;
      color: var(--purple-lt);
      border-left: 3px solid var(--purple);
    }

    .conv-item .conv-icon {
      font-size: 14px;
      flex-shrink: 0;
    }

    .conv-item .conv-title {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      line-height: 1.3;
    }

    .conv-item:last-child {
      margin-bottom: 0;
    }

    .sidebar-bottom {
      flex-shrink: 0;
      border-top: 1px solid var(--border);
      padding-top: 14px;

      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .user-card {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 12px;
      border-radius: 10px;
      background: var(--bg-deep);
      cursor: pointer;
      transition: 0.15s;
    }

    .user-card:hover {
      background: var(--border);
    }

    .user-avatar {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background: linear-gradient(135deg, var(--purple), var(--pink));
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      font-weight: 700;
      color: var(--white);
      flex-shrink: 0;
      overflow: hidden;
    }

    .user-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .user-info {
      flex: 1;
      overflow: hidden;
    }

    .user-name {
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .user-status {
      font-size: 11px;
      color: var(--text-muted);
    }

    .auth-btn {
      display: flex;
      align-items: center;
      gap: 8px;
      background: var(--bg-deep);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text-dim);
      font-family: var(--font-main);
      font-size: 13px;
      padding: 10px 14px;
      cursor: pointer;
      width: 100%;
      transition: 0.15s;
    }

    .auth-btn:hover {
      border-color: var(--purple);
      color: var(--text);
    }

    .auth-btn svg {
      flex-shrink: 0;
    }

    .auth-btn-signup {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      background: linear-gradient(135deg, var(--purple), var(--purple-dk));
      border: none;
      border-radius: 10px;
      color: var(--white);
      font-family: var(--font-main);
      font-size: 13px;
      padding: 10px 14px;
      cursor: pointer;
      width: 100%;
      transition: 0.15s;
      font-weight: 600;
    }

    .auth-btn-signup:hover {
      opacity: 0.9;
      transform: translateY(-1px);
    }

    .auth-btn-signup svg {
      flex-shrink: 0;
    }

    .sidebar-nav-link {
      display: flex;
      align-items: center;
      gap: 9px;
      padding: 9px 12px;
      border-radius: 10px;
      text-decoration: none;
      font-size: 13px;
      font-weight: 500;
      color: var(--text-dim);
      background: var(--bg-deep);
      border: 1px solid var(--border);
      transition: 0.15s;
    }

    .sidebar-nav-link:hover {
      color: var(--text);
      border-color: var(--purple);
      background: var(--purple)11;
    }

    /* ── MAIN ────────────────────────────────────────── */
    #main {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-width: 0;
      height: 100vh;
      position: relative;
    }

    /* ── TOP BAR ─────────────────────────────────────── */
    #topbar {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 14px 20px;
      border-bottom: 1px solid var(--border);
      background: var(--bg-deep);
      z-index: 50;
      flex-shrink: 0;
    }

    #sidebar-toggle {
      background: none;
      border: none;
      cursor: pointer;
      color: var(--text-dim);
      padding: 6px;
      border-radius: 8px;
      transition: 0.15s;
      display: flex;
    }

    #sidebar-toggle:hover {
      color: var(--text);
      background: var(--border);
    }

    .topbar-title {
      font-size: 15px;
      font-weight: 600;
      color: var(--text);
    }

    .topbar-icon-btn {
      display: flex;
      align-items: center;
      gap: 5px;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 9px;
      color: var(--text-dim);
      font-family: var(--font-main);
      font-size: 12px;
      font-weight: 500;
      padding: 6px 11px;
      cursor: pointer;
      text-decoration: none;
      transition: 0.15s;
      white-space: nowrap;
    }

    .topbar-icon-btn:hover {
      color: var(--text);
      border-color: var(--purple);
      background: var(--purple)11;
    }

    .topbar-icon-btn svg {
      flex-shrink: 0;
    }

    @media (max-width: 640px) {
      .topbar-btn-label {
        display: none;
      }

      .topbar-icon-btn {
        padding: 7px 8px;
      }
    }

    .topbar-mode-badge {
      font-size: 11px;
      font-weight: 600;
      padding: 4px 10px;
      border-radius: 99px;
      display: flex;
      align-items: center;
      gap: 5px;
    }

    .mode-chat {
      background: var(--purple)22;
      color: var(--purple-lt);
      border: 1px solid var(--purple)44;
    }

    .mode-notes {
      background: var(--cyan)22;
      color: var(--cyan);
      border: 1px solid var(--cyan)44;
    }

    .mode-quiz {
      background: var(--yellow)22;
      color: var(--yellow);
      border: 1px solid var(--yellow)44;
    }

    .mode-selector {
      display: flex;
      gap: 4px;
      background: var(--bg-card);
      border-radius: 10px;
      padding: 4px;
    }

    /* ── TOOLS DROPDOWN ──────────────────────────────── */
    #tools-dropdown-wrap {
      position: relative;
      display: flex;
      align-items: center;
    }

    #tools-trigger {
      display: flex;
      align-items: center;
      gap: 6px;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 9px;
      color: var(--text-dim);
      font-family: var(--font-main);
      font-size: 12px;
      font-weight: 600;
      padding: 7px 12px;
      cursor: pointer;
      transition: 0.15s;
      white-space: nowrap;
    }

    #tools-trigger:hover {
      color: var(--text);
      border-color: var(--purple);
      background: var(--purple)11;
    }

    #tools-trigger.open {
      color: var(--purple-lt);
      border-color: var(--purple);
      background: var(--purple)18;
    }

    #tools-menu {
      display: none;
      flex-direction: column;
      gap: 2px;
      position: absolute;
      top: calc(100% + 8px);
      right: 0;
      background: var(--bg-surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 6px;
      min-width: 190px;
      box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
      z-index: 200;
      animation: toolsMenuIn 0.15s ease;
    }

    #tools-menu.open {
      display: flex;
    }

    @keyframes toolsMenuIn {
      from {
        opacity: 0;
        transform: translateY(-6px) scale(0.97);
      }

      to {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }

    .tools-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 9px 12px;
      border-radius: 8px;
      cursor: pointer;
      color: var(--text-dim);
      font-size: 13px;
      font-weight: 500;
      text-decoration: none;
      background: none;
      border: none;
      font-family: var(--font-main);
      width: 100%;
      text-align: left;
      transition: 0.12s;
    }

    .tools-item:hover {
      background: var(--bg-card);
      color: var(--text);
    }

    .tools-item svg {
      flex-shrink: 0;
    }

    .tools-item-icon {
      width: 28px;
      height: 28px;
      border-radius: 7px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      font-size: 14px;
    }

    .tools-divider {
      height: 1px;
      background: var(--border);
      margin: 4px 6px;
    }

    .mode-btn {
      padding: 6px 14px;
      border-radius: 7px;
      font-size: 12px;
      font-weight: 600;
      border: none;
      cursor: pointer;
      font-family: var(--font-main);
      color: var(--text-muted);
      background: none;
      transition: 0.15s;
    }

    .mode-btn.active {
      background: var(--purple);
      color: var(--white);
    }

    .mode-btn:hover:not(.active) {
      color: var(--text);
      background: var(--border);
    }

    /* ── CHAT AREA ───────────────────────────────────── */
    #chat-area {
      flex: 1;
      overflow-y: auto;
      padding: 32px 24px;
      display: flex;
      flex-direction: column;
      gap: 24px;
      align-items: center;
      overflow-x: hidden;
    }

    /* ── WELCOME SCREEN ──────────────────────────────── */
    #welcome-screen {
      display: none;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 28px;
      height: 100%;
      animation: fadeUp 0.6s ease;
      overflow: hidden;
      width: 100%;
    }

    #welcome-screen:not(.hidden) {
      display: flex;
    }
    #welcome-screen.hidden {
      display: none !important;
    }

    @keyframes fadeUp {
      from {
        opacity: 0;
        transform: translateY(20px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .welcome-orb {
      width: 80px;
      height: 80px;
      border-radius: 24px;
      background: linear-gradient(135deg, var(--purple), var(--pink));
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 36px;
      box-shadow: 0 0 60px var(--purple)55, 0 0 120px var(--purple)22;
      animation: pulse-glow 3s ease-in-out infinite;
    }

    @keyframes pulse-glow {

      0%,
      100% {
        box-shadow: 0 0 60px var(--purple)55, 0 0 120px var(--purple)22;
      }

      50% {
        box-shadow: 0 0 80px var(--purple)77, 0 0 160px var(--purple)33;
      }
    }

    .welcome-title {
      font-size: 32px;
      font-weight: 700;
      color: var(--white);
      text-align: center;
      line-height: 1.2;
    }

    .welcome-sub {
      font-size: 15px;
      color: var(--text-muted);
      text-align: center;
      max-width: 380px;
      line-height: 1.6;
    }

    .quick-prompts {
      display: none;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
      width: 100%;
      max-width: 560px;
    }

    .quick-prompt {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 14px 16px;
      cursor: pointer;
      transition: 0.2s;
      text-align: left;
    }

    .quick-prompt:hover {
      border-color: var(--purple);
      background: var(--purple)11;
      transform: translateY(-2px);
    }

    .quick-prompt .qp-icon {
      font-size: 18px;
      margin-bottom: 6px;
    }

    .quick-prompt .qp-title {
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
    }

    .quick-prompt .qp-desc {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 2px;
    }

    /* ── MESSAGES ────────────────────────────────────── */
    .message-row {
      display: flex;
      gap: 12px;
      max-width: 900px;
      width: 100%;
      animation: fadeUp 0.3s ease;
    }

    .message-row.user {
      flex-direction: row-reverse;
      align-self: flex-end;
      width: fit-content;
    }

    .message-row.bot {
      align-self: flex-start;
    }

    .message-avatar {
      width: 34px;
      height: 34px;
      border-radius: 10px;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      margin-top: 2px;
    }

    .message-avatar.edlix {
      background: linear-gradient(135deg, var(--purple), var(--pink));
      box-shadow: 0 0 16px var(--purple)44;
    }

    .message-avatar.user-av {
      background: var(--bg-card);
      border: 1px solid var(--border);
      overflow: hidden;
    }

    .message-avatar.user-av img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: 10px;
    }

    .message-bubble {
      max-width: 700px;
      width: 100%;
      border-radius: var(--radius);
      padding: 14px 18px;
      line-height: 1.7;
      font-size: 14.5px;
      position: relative;

      /* cyber glass style */
      backdrop-filter: blur(10px);
      border: 1px solid var(--border);
      box-shadow:
        0 0 12px var(--border-glow),
        inset 0 0 6px color-mix(in srgb, var(--white) 2%, transparent);
    }

    /* USER MESSAGE */
    .message-row.user .message-bubble {
      background: linear-gradient(135deg,
          var(--purple),
          var(--pink));

      color: var(--white);
      border-bottom-right-radius: 4px;

      box-shadow:
        0 0 12px var(--purple),
        0 0 25px var(--border-glow);
    }

    /* BOT MESSAGE */
    .message-row.bot .message-bubble {
      background: linear-gradient(145deg,
          var(--bg-card),
          var(--face-bg));

      border: 1px solid var(--border);
      color: var(--text);
      border-bottom-left-radius: 4px;

      box-shadow:
        0 0 10px var(--border-glow),
        inset 0 0 8px color-mix(in srgb, var(--white) 2%, transparent);
    }

    /* subtle animated glow */
    .message-bubble::before {
      content: "";
      position: absolute;
      inset: -1px;
      border-radius: inherit;
      background: linear-gradient(120deg,
          transparent,
          var(--purple-lt),
          transparent);
      opacity: 0.15;
      pointer-events: none;
    }

    .message-meta {
      font-size: 11px;
      color: var(--text-muted);
      margin-top: 6px;

      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;

      font-family: var(--font-mono);
      letter-spacing: 0.3px;
    }

    .message-row.user .message-meta {
      justify-content: flex-end;
    }

    .message-bubble:hover {
      box-shadow:
        0 0 15px var(--purple),
        0 0 30px var(--border-glow);
    }

    /* ── BASE ACTION BUTTON ── */
    .msg-action-btn {
      background: none;
      border: none;
      cursor: pointer;
      color: var(--text-muted);
      font-size: 11px;
      padding: 3px 7px;
      border-radius: 6px;
      transition: color 0.15s, background 0.15s, transform 0.12s;
      font-family: var(--font-main);
      display: inline-flex;
      align-items: center;
      gap: 3px;
      line-height: 1;
      user-select: none;
    }

    .msg-action-btn:hover {
      color: var(--text);
      background: var(--border-glow);
      transform: translateY(-1px);
    }

    .msg-action-btn:active {
      transform: scale(0.91);
    }

    /* keep copy-msg-btn as alias */
    .copy-msg-btn {
      background: none;
      border: none;
      cursor: pointer;
      color: var(--text-muted);
      font-size: 11px;
      padding: 3px 7px;
      border-radius: 6px;
      transition: 0.15s;
      font-family: var(--font-main);
      display: inline-flex;
      align-items: center;
      gap: 3px;
    }

    .copy-msg-btn:hover {
      color: var(--text);
      background: var(--border-glow);
    }

    /* ── LIKE ── */
    .like-btn.liked {
      color: var(--green) !important;
      background: color-mix(in srgb, var(--green) 14%, transparent) !important;
    }

    .like-btn.liked .like-icon {
      display: inline-block;
      animation: likePopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    @keyframes likePopIn {
      0% {
        transform: scale(0.4) rotate(-20deg);
      }

      60% {
        transform: scale(1.4) rotate(10deg);
      }

      100% {
        transform: scale(1) rotate(0deg);
      }
    }

    /* ── DISLIKE ── */
    .dislike-btn.disliked {
      color: var(--pink) !important;
      background: color-mix(in srgb, var(--pink) 14%, transparent) !important;
    }

    .dislike-btn.disliked .dislike-icon {
      display: inline-block;
      animation: dislikeShake 0.4s ease;
    }

    @keyframes dislikeShake {

      0%,
      100% {
        transform: translateX(0);
      }

      20% {
        transform: translateX(-3px) rotate(-8deg);
      }

      40% {
        transform: translateX(3px) rotate(8deg);
      }

      60% {
        transform: translateX(-2px) rotate(-4deg);
      }

      80% {
        transform: translateX(2px) rotate(4deg);
      }
    }

    /* ── RETRY ── */
    .retry-btn:hover .retry-icon {
      display: inline-block;
      animation: retrySpin 0.5s ease;
    }

    .retry-btn.spinning .retry-icon {
      display: inline-block;
      animation: retrySpin 0.6s linear infinite;
    }

    @keyframes retrySpin {
      from {
        transform: rotate(0deg);
      }

      to {
        transform: rotate(360deg);
      }
    }

    /* ── EDIT ── */
    .edit-btn:hover .edit-icon {
      display: inline-block;
      animation: editWiggle 0.35s ease;
    }

    @keyframes editWiggle {

      0%,
      100% {
        transform: rotate(0deg);
      }

      30% {
        transform: rotate(-12deg);
      }

      70% {
        transform: rotate(8deg);
      }
    }

    .message-row.user .message-bubble {
      margin-left: auto;
    }

    /* ── INLINE EDIT AREA ── */
    .bubble-edit-wrap {
      display: flex;
      flex-direction: column;
      gap: 8px;
      width: 100%;
    }

    .bubble-edit-textarea {
      width: 100%;
      min-height: 60px;
      background: color-mix(in srgb, var(--purple) 8%, transparent);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 10px 14px;
      color: var(--text);
      font-family: var(--font-main);
      font-size: 14px;
      line-height: 1.6;
      resize: vertical;
      outline: none;
      transition: border-color 0.2s;
    }

    .bubble-edit-textarea:focus {
      border-color: var(--purple-lt);
    }

    .bubble-edit-actions {
      display: flex;
      gap: 8px;
      justify-content: flex-end;
    }

    .bubble-edit-save {
      background: var(--purple);
      border: none;
      color: var(--white);
      font-family: var(--font-main);
      font-size: 12px;
      font-weight: 600;
      padding: 5px 14px;
      border-radius: 8px;
      cursor: pointer;
      transition: background 0.15s, transform 0.1s;
    }

    .bubble-edit-save:hover {
      background: var(--purple-lt);
      color: var(--black);
    }

    .bubble-edit-save:active {
      transform: scale(0.95);
    }

    .bubble-edit-cancel {
      background: none;
      border: 1px solid var(--border);
      color: var(--text-muted);
      font-family: var(--font-main);
      font-size: 12px;
      padding: 5px 14px;
      border-radius: 8px;
      cursor: pointer;
      transition: 0.15s;
    }

    .bubble-edit-cancel:hover {
      color: var(--text);
      border-color: var(--purple);
    }

    /* ── REMOVE ANIMATION ── */
    .bubble-removing {
      animation: bubbleFadeOut 0.32s ease forwards !important;
      pointer-events: none;
    }

    @keyframes bubbleFadeOut {
      from {
        opacity: 1;
        transform: translateY(0) scale(1);
      }

      to {
        opacity: 0;
        transform: translateY(6px) scale(0.97);
      }
    }

    /* ── BOT CONTENT STYLES ──────────────────────────── */
    .message-bubble h2,
    .message-bubble h3 {
      font-weight: 700;
      margin: 12px 0 6px;
      color: var(--purple-lt);
      letter-spacing: 0.2px;
    }

    .message-bubble h2 {
      font-size: 17px;
    }

    .message-bubble h3 {
      font-size: 15px;
    }

    .message-bubble p {
      margin: 6px 0;
    }

    .message-bubble ul {
      padding-left: 20px;
      margin: 6px 0;
    }

    .message-bubble li {
      margin: 3px 0;
    }

    .message-bubble strong {
      color: var(--white);
    }

    .message-bubble a {
      color: var(--cyan);
      transition: color 0.18s ease, opacity 0.18s ease;
    }

    .message-bubble a:hover {
      opacity: 0.92;
    }

    /* Shared premium interaction layer */
    .message-bubble .box,
    .message-bubble .code-wrapper,
    .message-bubble .graph-container,
    .message-bubble .flowchart-wrap,
    .sd-outer,
    .sd-btn,
    .sd-node,
    .message-bubble table tr td {
      transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease,
        color 0.18s ease;
    }

    .message-bubble .box {
      background: linear-gradient(165deg, var(--bg-card), rgba(0, 0, 0, 0.2));
      border: 1px solid color-mix(in srgb, var(--white) 8%, transparent);
      /* Subtle border */
      border-radius: 16px;
      /* Smoother corners */
      padding: 16px 20px;
      margin: 12px 0;
      box-shadow: 0 4px 20px color-mix(in srgb, var(--bg-deep) 40%, transparent);
      position: relative;
      overflow: hidden;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      backdrop-filter: blur(10px);
      /* Clean glass effect */
    }

    /* The "Glow Trace" - Futuristic Top Light */
    .message-bubble .box::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 1px;
      background: linear-gradient(90deg, transparent, var(--purple), transparent);
      opacity: 0.3;
    }

    /* Modern Hover State */
    .message-bubble .box:hover {
      box-shadow: 0 12px 40px color-mix(in srgb, var(--bg-deep) 60%, transparent);
      border-color: color-mix(in srgb, var(--white) 20%, transparent);
      background: linear-gradient(165deg, var(--bg-card), rgba(255, 255, 255, 0.02));
    }

    /* Category Accent Glows (Replacing simple solid borders) */
    .message-bubble .box.overview {
      border-left: 4px solid var(--cyan);
      box-shadow: -5px 0 15px -5px var(--cyan);
    }

    .message-bubble .box.steps {
      border-left: 4px solid var(--green);
      box-shadow: -5px 0 15px -5px var(--green);
    }

    .message-bubble .box.example {
      border-left: 4px solid var(--yellow);
      box-shadow: -5px 0 15px -5px var(--yellow);
    }

    .message-bubble .box.definition {
      border-left: 4px solid var(--purple-lt);
      box-shadow: -5px 0 15px -5px var(--purple-lt);
    }

    .message-bubble .box.summary {
      border-left: 4px solid var(--pink);
      box-shadow: -5px 0 15px -5px var(--pink);
    }

    /* Subtle Animated Shine on Hover */
    .message-bubble .box::after {
      content: "";
      position: absolute;
      top: -50%;
      left: -50%;
      width: 200%;
      height: 200%;
      background: radial-gradient(circle, color-mix(in srgb, var(--white) 5%, transparent) 0%, transparent 70%);
      opacity: 0;
      transition: opacity 0.5s ease;
      pointer-events: none;
    }


    /* Code wrapper */
    .message-bubble .code-wrapper {
      background: var();
      border: 1px solid var(--border);
      border-radius: 12px;
      margin: 8px 0;
      overflow: hidden;
      box-shadow: 0 3px 14px var(--border-glow);
    }

    .message-bubble .code-wrapper:hover {
      transform: translateY(-2px);
      border-color: var(--purple);
      box-shadow: 0 10px 26px var(--border-glow);
    }

    .message-bubble .code-wrapper .code-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 8px 14px;
      background: bgcolor-mix(in srgb, var(--border) 10%, transparent);
      border-bottom: 1px solid var(--border);
    }

    .message-bubble .code-wrapper .language-label {
      font-size: 11px;
      font-weight: 600;
      color: var(--purple-lt);
      font-family: var(--font-mono);
      letter-spacing: 0.25px;
    }

    .message-bubble .code-wrapper .coppybin {
      background: var(--bg-card);
      border: 1px solid var(--border);
      color: var(--text-dim);
      font-size: 11px;
      padding: 3px 10px;
      border-radius: 6px;
      cursor: pointer;
      font-family: var(--font-main);
      transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    }

    .message-bubble .code-wrapper .coppybin:hover {
      color: var(--text);
      border-color: var(--purple);
      background: var(--purple)11;
      box-shadow: 0 0 0 1px var(--purple)22 inset;
      transform: translateY(-1px);
    }

    .message-bubble .code-wrapper .code-block {
      margin: 0;
      padding: 14px;
      overflow-x: auto;
      font-size: 13px;
      font-family: var(--font-mono);
      line-height: 1.6;
    }

    .message-bubble .code-wrapper code {
      background: none;
    }

    /* Tables */
    .message-bubble table {
      width: 100%;
      border-collapse: collapse;
      margin: 10px 0;
      font-size: 13px;
      overflow: hidden;
      border-radius: 10px;
    }

    .message-bubble th {
      background: var(--purple)22;
      color: var(--purple-lt);
      padding: 8px 12px;
      text-align: left;
      font-weight: 600;
      border-bottom: 2px solid var(--purple)44;
    }

    .message-bubble td {
      padding: 8px 12px;
      border-bottom: 1px solid var(--border);
      color: var(--text-dim);
    }

    .message-bubble tr:hover td {
      background: var(--border)44;
      color: var(--text);
    }

    .message-bubble tr:hover {
      transform: translateY(-1px);
    }

    /* Graph container */
    .message-bubble .graph-container {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 16px;
      margin: 10px 0;
      box-shadow: 0 3px 14px var(--border-glow);
    }

    .message-bubble .graph-container:hover {
      border-color: var(--cyan);
      box-shadow: 0 10px 26px var(--border-glow);
      transform: translateY(-2px);
    }

    /* Flowchart */
    .message-bubble .flowchart-wrap {
      background: var(--bg-card);
      border: 1px solid var(--border-glow);
      border-radius: 12px;
      padding: 16px;
      margin: 10px 0;
      overflow-x: auto;
      box-shadow: 0 3px 14px var(--border-glow);
    }

    .message-bubble .flowchart-wrap:hover {
      border-color: var(--purple);
      box-shadow: 0 10px 26px var(--border-glow);
      transform: translateY(-2px);
    }

    /* ── EDLIX DIAGRAM ─────────────────────────────────────────── */
    .sd-outer {
      margin: 14px 0;
      border-radius: 14px;
      border: 1px solid var(--border-glow);
      background: var(--bg-card);
      overflow: hidden;
      font-family: var(--font-main);
      box-shadow: 0 4px 18px var(--border-glow);
    }

    .sd-outer:hover {
      box-shadow: 0 12px 30px var(--border-glow);
      border-color: var(--purple);
    }

    .sd-toolbar {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      background: var(--bg-card);
      border-bottom: 1px solid var(--border-glow);
    }

    .sd-title {
      font-weight: 600;
      color: var(--purple-lt);
      font-size: 13px;
      flex: 1;
      letter-spacing: 0.2px;
    }

    .sd-btn {
      background: none;
      border: 1px solid var(--border);
      border-radius: 7px;
      color: var(--text-muted);
      padding: 3px 9px;
      font-size: 11px;
      cursor: pointer;
      font-family: var(--font-main);
    }

    .sd-btn:hover {
      color: var(--text);
      border-color: var(--purple);
      background: var(--purple)11;
      transform: translateY(-1px);
      box-shadow: 0 0 0 1px var(--purple)18 inset;
    }

    .sd-viewport {
      overflow: auto;
      position: relative;
      min-height: 280px;
      cursor: grab;
    }

    .sd-viewport:active {
      cursor: grabbing;
    }

    .sd-stage {
      position: relative;
      transform-origin: top left;
      transition: transform 0.15s ease;
    }

    /* Fullscreen */
    .sd-outer.sd-fs {
      position: fixed;
      inset: 0;
      z-index: 9999;
      border-radius: 0;
      display: flex;
      flex-direction: column;
    }

    .sd-outer.sd-fs .sd-viewport {
      flex: 1;
      min-height: unset;
    }

    /* Nodes */
    .sd-node {
      position: absolute;
      min-width: 110px;
      max-width: 160px;
      padding: 10px 12px;
      border-radius: 10px;
      font-size: 12px;
      font-weight: 500;
      color: var(--text);
      text-align: center;
      cursor: move;
      user-select: none;
      box-shadow: 0 3px 12px var(--border-glow);
      border: 2px solid transparent;
      z-index: 10;
      will-change: transform, box-shadow;
    }

    .sd-node:hover {
      transform: translateY(-3px) scale(1.01);
      box-shadow: 0 12px 24px var(--border-glow);
    }

    .sd-node:active {
      transform: translateY(-1px) scale(0.995);
    }

    .sd-node-emoji {
      font-size: 18px;
      display: block;
      margin-bottom: 3px;
      line-height: 1.1;
    }

    .sd-node-label {
      font-size: 11px;
      line-height: 1.3;
      word-break: break-word;
    }

    .sd-node-start {
      background: color-mix(in srgb, var(--green) 15%, var(--bg-deep));
      border-color: var(--green);
    }

    .sd-node-end {
      background: color-mix(in srgb, var(--pink) 15%, var(--bg-deep));
      border-color: var(--pink);
    }

    .sd-node-process {
      background: color-mix(in srgb, var(--purple) 15%, var(--bg-deep));
      border-color: var(--purple);
    }

    .sd-node-decision {
      background: color-mix(in srgb, var(--yellow) 15%, var(--bg-deep));
      border-color: var(--yellow);
      border-radius: 6px;
    }

    .sd-node-info {
      background: color-mix(in srgb, var(--cyan) 15%, var(--bg-deep));
      border-color: var(--cyan);
    }

    /* SVG canvas behind nodes */
    .sd-svg {
      position: absolute;
      top: 0;
      left: 0;
      pointer-events: none;
      overflow: visible;
    }

    .sd-edge {
      stroke: var(--purple-lt);
      stroke-width: 2;
      fill: none;
    }

    .sd-edge-label {
      fill: var(--purple-lt);
      font-size: 10px;
      font-family: var(--font-main);
      text-anchor: middle;
      dominant-baseline: middle;
    }

    .sd-arrow {
      fill: var(--purple-lt);
    }

    /* Performance-friendly motion safety */
    @media (prefers-reduced-motion: reduce) {

      .message-bubble .box,
      .message-bubble .code-wrapper,
      .message-bubble .graph-container,
      .message-bubble .flowchart-wrap,
      .sd-outer,
      .sd-btn,
      .sd-node,
      .message-bubble table tr td {
        transition: none !important;
      }

      .message-bubble .box:hover,
      .message-bubble .code-wrapper:hover,
      .message-bubble .graph-container:hover,
      .message-bubble .flowchart-wrap:hover,
      .sd-node:hover,
      .sd-btn:hover {
        transform: none !important;
      }
    }

    /* Typing dots */
    .typing-dots {
      display: flex;
      gap: 5px;
      align-items: center;
      padding: 4px 0;
    }

    .typing-dots span {
      width: 8px;
      height: 8px;
      background: var(--purple-lt);
      border-radius: 50%;
      animation: typingBounce 1.2s infinite;
    }

    .typing-dots span:nth-child(2) {
      animation-delay: 0.2s;
    }

    .typing-dots span:nth-child(3) {
      animation-delay: 0.4s;
    }

    @keyframes typingBounce {

      0%,
      80%,
      100% {
        transform: scale(0.7);
        opacity: 0.5;
      }

      40% {
        transform: scale(1);
        opacity: 1;
      }
    }

    /* ── NOTES RENDERER ──────────────────────────────── */
    .notes-section {
      margin: 12px 0;
    }

    .notes-section-heading {
      font-size: 15px;
      font-weight: 700;
      color: var(--purple-lt);
      margin-bottom: 10px;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    /* Update your notes container to this */
    #notes-list {
      display: flex;
      flex-wrap: wrap;
      /* Allows notes to move to the next line instead of squishing */
      gap: 20px;
      /* Adds clean spacing between notes */
      width: 100%;
      /* Use the full width of the parent */
      padding: 10px;
      justify-content: flex-start;
      /* Aligns items to the left */
      box-sizing: border-box;
    }

    /* Update the individual note cards */
    .note-item {
      flex: 1 1 300px;
      /* Grow to fill space, shrink if needed, base width 300px */
      max-width: 100%;
      /* Prevents it from ever pushing past the screen edge */
      min-height: 150px;
      background: var(--card-bg);
      /* Use your existing variable */
      border-radius: 12px;
      padding: 15px;
      display: flex;
      flex-direction: column;
      word-wrap: break-word;
      /* Crucial: Prevents long text from breaking the layout */
      overflow-wrap: break-word;
      box-shadow: 0 4px 15px color-mix(in srgb, var(--bg-deep) 10%, transparent);
    }

    /* Ensure the parent container of the notes isn't restricting width */
    #notes-section {
      width: 100%;
      max-width: 1400px;
      /* Or whatever your site's max width is */
      margin: 0 auto;
      overflow-x: hidden;
      /* Safety net against horizontal scrolls */
    }

    .box-grid {
      display: grid;
      gap: 10px;
      margin: 8px 0;
    }

    .box-grid.cols-2 {
      grid-template-columns: repeat(2, 1fr);
    }

    .box-grid.cols-3 {
      grid-template-columns: repeat(3, 1fr);
    }

    .box-grid-item {
      background: var(--bg-dark-card);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 12px;
    }

    .box-grid-item strong {
      color: var(--cyan);
      display: block;
      margin-bottom: 4px;
      font-size: 13px;
    }

    .box-grid-item p {
      color: var(--text-dim);
      font-size: 13px;
      margin: 0;
    }

    .flow-steps {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin: 8px 0;
    }

    .flow-step {
      display: flex;
      gap: 12px;
      align-items: flex-start;
      background: var(--bg-dark-card);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 12px;
    }

    .flow-step-num {
      width: 26px;
      height: 26px;
      border-radius: 50%;
      background: var(--purple);
      color: var(--white);
      font-size: 12px;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .flow-step p {
      color: var(--text-dim);
      font-size: 13px;
      margin: 0;
      line-height: 1.5;
    }

    /* Flash cards */
    .flash-grid {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 100%;
      overflow: hidden;
      /* IMPORTANT */
    }

    .flash-grid {
      width: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .flash-card {
      width: 100%;

      height: 240px;
      perspective: 1000px;
      cursor: pointer;
      position: relative;
    }

    .flash-card {
      width: 100%;
      max-width: 100%;
      flex-shrink: 0;
      /* IMPORTANT */
    }

    .flash-grid * {
      max-width: 100%;
    }

    .flash-inner {
      position: relative;
      width: 100%;
      height: 100%;
      transition: transform 0.6s cubic-bezier(.4, 2, .3, 1);
      transform-style: preserve-3d;
    }

    @media (max-width: 600px) {
      .eg-flash-wrap {
        max-width: 100%;
      }

      .flash-card {
        height: 220px;
      }

      .flash-front,
      .flash-back {
        font-size: 1rem;
      }
    }

    .flash-card.flipped .flash-inner {
      transform: rotateY(180deg);
    }

    .flash-front,
    .flash-back {
      position: absolute;
      inset: 0;
      border-radius: 16px;
      padding: 20px;

      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;

      font-size: 1.05rem;
      backface-visibility: hidden;

      border: 1px solid var(--border-glow);

      background: linear-gradient(135deg,
          var(--bg-card),
          var(--bg-deep));

      box-shadow: 0 0 20px var(--border-glow);
    }

    .flash-back {
      transform: rotateY(180deg);
      background: linear-gradient(135deg,
          var(--purple)22,
          var(--bg-deep));
      color: var(--purple-lt);
    }

    /* Exam Points */
    .exam-points {
      display: flex;
      flex-direction: column;
      gap: 6px;
      margin: 8px 0;
    }

    .exam-point {
      display: flex;
      gap: 10px;
      align-items: flex-start;
      padding: 10px 14px;
      background: var(--green)11;
      border: 1px solid var(--green)33;
      border-radius: 8px;
      font-size: 13px;
      color: var(--text-dim);
    }

    .exam-point::before {
      content: "✓";
      color: var(--green);
      font-weight: 700;
      flex-shrink: 0;
    }

    /* Mistakes */
    .mistakes-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin: 8px 0;
    }

    .mistake-item {
      padding: 12px 14px;
      background: var(--pink)11;
      border: 1px solid var(--pink)33;
      border-radius: 8px;
    }

    .mistake-item strong {
      color: var(--pink);
      display: block;
      font-size: 13px;
      margin-bottom: 3px;
    }

    .mistake-item p {
      color: var(--text-dim);
      font-size: 13px;
      margin: 0;
    }

    /* Points */
    .points-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin: 8px 0;
    }

    .point-item {
      padding: 10px 14px;
      background: var(--bg-dark-card);
      border: 1px solid var(--border);
      border-radius: 8px;
    }

    .point-item strong {
      color: var(--yellow);
      display: block;
      font-size: 13px;
      margin-bottom: 3px;
    }

    .point-item p {
      color: var(--text-dim);
      font-size: 13px;
      margin: 0;
    }

    /* ── QUIZ SECTION ────────────────────────────────── */
    #quiz-section {
      flex: 1;
      overflow-y: auto;
      padding: 24px;
      display: none;
      flex-direction: column;
      gap: 20px;
    }

    #quiz-section.active {
      display: flex;
    }

    .quiz-header {
      text-align: center;
    }

    .quiz-header h2 {
      font-size: 22px;
      font-weight: 700;
      color: var(--white);
    }

    .quiz-header p {
      color: var(--text-muted);
      font-size: 14px;
      margin-top: 4px;
    }

    .quiz-setup-form {
      display: flex;
      gap: 12px;
      align-items: center;
      flex-wrap: wrap;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 16px 20px;
    }

    .quiz-input {
      flex: 1;
      min-width: 200px;
      background: var(--bg-deep);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text);
      font-family: var(--font-main);
      font-size: 14px;
      padding: 10px 14px;
      outline: none;
      transition: 0.15s;
    }

    .quiz-input:focus {
      border-color: var(--purple);
    }

    .quiz-input::placeholder {
      color: var(--text-muted);
    }

    .quiz-select {
      background: var(--bg-deep);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text);
      font-family: var(--font-main);
      font-size: 13px;
      padding: 10px 14px;
      cursor: pointer;
      outline: none;
    }

    .start-quiz-btn {
      background: linear-gradient(135deg, var(--yellow), var(--orange));
      border: none;
      border-radius: 10px;
      color: var(--bg-deep);
      font-family: var(--font-main);
      font-size: 14px;
      font-weight: 700;
      padding: 10px 22px;
      cursor: pointer;
      transition: 0.15s;
      white-space: nowrap;
    }

    .start-quiz-btn:hover {
      opacity: 0.9;
      transform: translateY(-1px);
    }

    .quiz-progress-bar {
      background: var(--border);
      border-radius: 99px;
      height: 5px;
      overflow: hidden;
    }

    .quiz-progress-fill {
      height: 100%;
      background: linear-gradient(90deg, var(--purple), var(--pink));
      border-radius: 99px;
      transition: width 0.4s ease;
    }

    .quiz-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 24px;
      animation: fadeUp 0.3s ease;
    }

    .quiz-q {
      font-size: 16px;
      font-weight: 600;
      color: var(--white);
      margin-bottom: 18px;
      line-height: 1.5;
    }

    .quiz-options {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .quiz-option {
      padding: 13px 18px;
      border-radius: 10px;
      cursor: pointer;
      border: 1px solid var(--border);
      background: var(--bg-deep);
      color: var(--text-dim);
      font-size: 14px;
      transition: 0.15s;
      text-align: left;
      font-family: var(--font-main);
    }

    .quiz-option:hover {
      border-color: var(--purple);
      color: var(--text);
    }

    .quiz-option.correct {
      border-color: var(--green);
      background: var(--green)11;
      color: var(--green);
    }

    .quiz-option.wrong {
      border-color: var(--pink);
      background: var(--pink)11;
      color: var(--pink);
    }

    /* ── NOTES SECTION ───────────────────────────────── */
    #notes-section {
      flex: 1;
      overflow-y: auto;
      padding: 24px;
      display: none;
      flex-direction: column;
      gap: 20px;
    }

    #notes-section.active {
      display: flex;
    }

    .notes-input-form {
      display: flex;
      gap: 12px;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: va r(--radius);
      padding: 16px 20px;
      align-items: center;
    }

    /* ── INPUT BAR ───────────────────────────────────── */
    #input-bar {
      padding: 12px 20px 16px;
      border-top: 1px solid var(--border);
      background: var(--bg-deep);
      flex-shrink: 0;
    }

    .input-wrapper {
      display: flex;
      flex-direction: column;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 18px;
      padding: 12px 14px 10px;
      transition: 0.2s;
      gap: 0;
    }

    .input-wrapper:focus-within {
      border-color: var(--purple);
      box-shadow: 0 0 0 3px var(--purple)22;
    }

    /* TOP ROW: textarea only */
    .input-top-row {
      display: flex;
      align-items: flex-end;
      gap: 8px;
    }

    #chat-input {
      flex: 1;
      background: none;
      border: none;
      outline: none;
      color: var(--text);
      font-family: var(--font-main);
      font-size: 14.5px;
      resize: none;
      line-height: 1.6;
      min-height: 24px;
      max-height: 180px;
      padding: 0;
    }

    #chat-input::placeholder {
      color: var(--text-muted);
    }

    /* BOTTOM ROW: tools left | mic center | send right */
    .input-bottom-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 8px;
      padding-top: 8px;
      border-top: 1px solid var(--border)66;
    }

    .input-left-tools {
      display: flex;
      align-items: center;
      gap: 4px;
    }

    .input-center-mic {
      display: flex;
      align-items: center;
      justify-content: center;
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
    }

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

    .input-right-tools {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-left: auto;
    }

    .input-action-btn {
      background: none;
      border: none;
      cursor: pointer;
      color: var(--text-muted);
      padding: 6px;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: 0.15s;
      font-size: 15px;
    }

    .input-action-btn:hover {
      color: var(--text);
      background: var(--border);
    }

    /* Mic button - larger, prominent */
    .mic-center-btn {
      width: 38px;
      height: 38px;
      background: linear-gradient(135deg, var(--purple)33, var(--pink)22);
      border: 1px solid var(--purple)66;
      border-radius: 50%;
      cursor: pointer;
      color: var(--purple-lt);
      padding: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: 0.2s;
      font-size: 16px;
    }

    .mic-center-btn:hover {
      background: linear-gradient(135deg, var(--purple)55, var(--pink)33);
      border-color: var(--purple);
      box-shadow: 0 0 14px var(--purple)44;
    }

    .mic-center-btn.recording {
      background: linear-gradient(135deg, var(--pink), var(--purple));
      border-color: var(--pink);
      animation: micPulse 1s ease-in-out infinite;
    }

    @keyframes micPulse {

      0%,
      100% {
        box-shadow: 0 0 0 0 var(--pink)44
      }

      50% {
        box-shadow: 0 0 0 8px transparent
      }
    }

    .send-btn {
      background: linear-gradient(135deg, var(--purple), var(--purple-dk));
      border: none;
      border-radius: 10px;
      cursor: pointer;
      color: var(--white);
      padding: 8px 14px;
      display: flex;
      align-items: center;
      transition: 0.15s;
      font-family: var(--font-main);
      font-size: 13px;
      font-weight: 600;
      gap: 5px;
      white-space: nowrap;
    }

    .send-btn:hover:not(:disabled) {
      opacity: 0.9;
      transform: translateY(-1px);
    }

    .send-btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    .send-btn.stop-mode {
      background: linear-gradient(135deg, #ef4444, #dc2626) !important;
      animation: stopPulse 1.5s ease-in-out infinite;
    }
    .send-btn.stop-mode:hover {
      opacity: 0.85 !important;
    }
    @keyframes stopPulse {
      0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
      50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    }

    .input-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 6px;
      padding: 0 2px;
    }

    .input-hints {
      font-size: 11px;
      color: var(--text-muted);
    }

    .char-count {
      font-size: 11px;
      color: var(--text-muted);
    }

    /* ── FILE DROP ZONE ──────────────────────────────── */
    #drop-overlay {
      display: none;
      position: absolute;
      inset: 0;
      background: var(--purple)22;
      border: 2px dashed var(--purple);
      border-radius: var(--radius);
      z-index: 200;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      gap: 12px;
    }

    #drop-overlay.active {
      display: flex;
    }

    #drop-overlay p {
      font-size: 20px;
      font-weight: 700;
      color: var(--purple-lt);
    }

    /* ── AUTH MODAL ──────────────────────────────────── */
    #auth-modal {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 999;
      background: color-mix(in srgb, var(--bg-deep) 67%, transparent);
      backdrop-filter: blur(8px);
      align-items: center;
      justify-content: center;
    }

    #auth-modal.open {
      display: flex;
    }

    .auth-modal-inner {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 20px;
      padding: 36px;
      width: 380px;
      max-width: 90vw;
      display: flex;
      flex-direction: column;
      gap: 20px;
      animation: fadeUp 0.3s ease;
    }

    .auth-modal-logo {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .auth-modal-title {
      font-size: 22px;
      font-weight: 700;
      color: var(--white);
    }

    .auth-modal-sub {
      font-size: 14px;
      color: var(--text-muted);
      line-height: 1.5;
    }

    .google-signin-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      background: var(--white);
      border: none;
      border-radius: 12px;
      color: var(--bg-dark-card);
      font-family: var(--font-main);
      font-size: 15px;
      font-weight: 600;
      padding: 14px;
      cursor: pointer;
      transition: 0.15s;
    }

    .google-signin-btn:hover {
      opacity: 0.9;
      transform: translateY(-1px);
    }

    .auth-skip {
      background: none;
      border: 1px solid var(--border);
      border-radius: 12px;
      color: var(--text-muted);
      font-family: var(--font-main);
      font-size: 14px;
      padding: 12px;
      cursor: pointer;
      transition: 0.15s;
    }

    .auth-skip:hover {
      color: var(--text);
      border-color: var(--text-dim);
    }

    .auth-features {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .auth-feature {
      display: flex;
      gap: 8px;
      align-items: center;
      font-size: 13px;
      color: var(--text-dim);
    }

    .auth-feature .af-icon {
      color: var(--green);
      font-size: 14px;
    }

    /* ── MOBILE ──────────────────────────────────────── */
    #mobile-sidebar-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: color-mix(in srgb, var(--bg-deep) 67%, transparent);
      z-index: 99;
    }

    @media (max-width: 768px) {

      /* Sidebar slides from left as overlay — HIDDEN by default */
      #sidebar {
        position: fixed !important;
        left: -280px !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 280px !important;
        min-width: 280px !important;
        max-width: 280px !important;
        height: 100dvh !important;
        padding: 20px 16px !important;
        border-right-width: 1px !important;
        opacity: 1 !important;
        pointer-events: none !important;
        transform: none !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 9999 !important;
      }

      /* Closed state — same as default (off-screen) */
      #sidebar.closed {
        left: -280px !important;
        pointer-events: none !important;
        transform: none !important;
      }

      /* Open state — slides in from left */
      #sidebar.mobile-open {
        left: 0 !important;
        pointer-events: auto !important;
        transform: none !important;
      }

      #mobile-sidebar-backdrop.visible {
        display: block;
      }

      /* TOPBAR: clean 3-item mobile bar */
      #topbar {
        padding: 10px 14px;
        gap: 8px;
        position: relative;
      }

      /* Hide mode selector from topbar on mobile — moved to bottom nav */
      #topbar .mode-selector {
        display: none;
      }

      /* Hide some topbar buttons on mobile */
      #topbar [title="Visit EdlixPost"],
      #topbar [title="Quiz Mode"] {
        display: none;
      }

      /* Right side buttons: only voice + settings + user */
      #topbar>div:last-child {
        gap: 4px;
      }

      .topbar-icon-btn {
        padding: 6px 8px;
      }

      .topbar-btn-label {
        display: none;
      }
    }

    /* CHAT AREA: reduce padding */
    #chat-area {
      padding: 16px 12px 12px;
      gap: 16px;
    }

    /* MESSAGES: better mobile sizing */
    .message-bubble {
      font-size: 14px;
      padding: 12px 14px;
      max-width: calc(100vw - 80px);
    }

    .message-avatar {
      width: 30px;
      height: 30px;
      border-radius: 8px;
    }

    /* INPUT BAR: proper mobile bottom bar — fixed at bottom above bottom nav */
    #input-bar {
      padding: 8px 10px 10px;
      border-top: 1px solid var(--border);
      position: sticky;
      bottom: 0;
      background: var(--bg-deep);
      z-index: 10;
    }

    /* Chat section: ensure no extra bottom gap pushing input up */
    #chat-section {
      padding-bottom: 0 !important;
    }

    .input-wrapper {
      border-radius: 20px;
      padding: 10px 12px 8px;
    }

    #chat-input {
      font-size: 14px;
    }

    .send-btn {
      padding: 7px 12px;
      font-size: 12px;
      border-radius: 12px;
    }

    .send-btn span {
      display: none;
    }

    .input-footer {
      margin-top: 4px;
    }

    .mic-center-btn {
      width: 34px;
      height: 34px;
    }

    /* WELCOME SCREEN: mobile-optimized compact layout */
    #welcome-screen {
      gap: 20px;
      padding: 20px 16px;
      justify-content: center;
      align-items: center;
      text-align: center;
    }

    #edlixFace1 {
      margin-left: auto;
      margin-right: auto;
    }

    /* Hide side panels entirely on mobile */
    .welcome-side-panel {
      display: none !important;
    }

    .welcome-center {
      padding: 0 !important;
      width: 100%;
    }

    /* Face: smaller on mobile */

    /* Hide spinning aura rings on mobile to save space */
    .aura-ring-1,
    .aura-ring-2 {
      display: none !important;
    }

    /* Greeting: smaller */
    .welcome-title {
      font-size: 20px !important;
    }

    .welcome-sub {
      font-size: 13px !important;
      max-width: 100% !important;
    }

    /* Quick prompts: horizontal scroll on mobile */
    .quick-prompts {
      grid-template-columns: repeat(2, 1fr) !important;
      gap: 8px !important;
      width: 100% !important;
    }

    .quick-prompt {
      padding: 11px 12px !important;
    }

    .quick-prompt .qp-icon {
      font-size: 16px !important;
      margin-bottom: 4px !important;
    }

    .quick-prompt .qp-title {
      font-size: 12px !important;
    }

    .quick-prompt .qp-desc {
      font-size: 11px !important;
      display: none;
    }

    /* Grids */
    .flash-grid {
      grid-template-columns: 1fr;
    }

    .box-grid.cols-2,
    .box-grid.cols-3 {
      grid-template-columns: 1fr;
    }

    /* Settings panel: full screen on mobile */
    #settings-panel {
      width: 100% !important;
      max-width: 100% !important;
    }

    #settings-overlay {
      align-items: flex-end;
    }

    #settings-panel {
      border-radius: 20px 20px 0 0;
      border-left: none !important;
      border-top: 1px solid var(--border);
      max-height: 90vh;
      animation: slideUpMobile 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    @keyframes slideUpMobile {
      from {
        transform: translateY(100%);
        opacity: 0;
      }

      to {
        transform: translateY(0);
        opacity: 1;
      }
    }

    /* Quiz/Notes: tighter padding */
    #quiz-section {
      padding: 16px !important;
    }

    #notes-section {
      padding: 16px !important;
    }

    .quiz-setup-form {
      flex-direction: column;
      gap: 8px;
    }

    .quiz-input,
    .quiz-select {
      width: 100%;
    }

    /* Voice overlay: adjust for mobile bottom spacing */
    #voice-overlay {
      padding-bottom: 70px;
    }

    .somosa {
      display: none !important;
    }


    /* BOTTOM NAV */

    .mob-nav-item {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 3px;
      cursor: pointer;
      background: none;
      border: none;
      font-family: var(--font-main);
      color: var(--text-muted);
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.3px;
      transition: 0.15s;
      padding: 0;
      -webkit-tap-highlight-color: transparent;
    }

    .mob-nav-item:active {
      background: var(--purple)11;
    }

    .mob-nav-item.active {
      color: var(--purple-lt);
    }

    .mob-nav-item svg,
    .mob-nav-item .mob-nav-icon {
      transition: 0.15s;
    }

    .mob-nav-item.active svg {
      filter: drop-shadow(0 0 6px var(--purple)88);
    }

    .mob-nav-item .mob-nav-dot {
      width: 4px;
      height: 4px;
      border-radius: 50%;
      background: var(--purple);
      margin-top: 1px;
      opacity: 0;
      transition: 0.15s;
    }

    .mob-nav-item.active .mob-nav-dot {
      opacity: 1;
    }


    /* Extra small phones */
    @media (max-width: 380px) {
      .quick-prompts {
        grid-template-columns: 1fr !important;
      }

      #edlixFace1 {
        width: 90px !important;
        height: 90px !important;
        overflow: visible !important;
      }

      .welcome-title {
        font-size: 18px !important;
      }
    }

    /* Streamed text cursor blink */
    .stream-cursor::after {
      content: "▋";
      animation: blink 0.8s infinite;
      color: var(--purple-lt);
    }

    @keyframes blink {

      0%,
      100% {
        opacity: 1;
      }

      50% {
        opacity: 0;
      }
    }

    /* Scrollbar in chat */
    #chat-area::-webkit-scrollbar {
      width: 4px;
    }

    #chat-area::-webkit-scrollbar-thumb {
      background: var(--border);
      border-radius: 99px;
    }

    /* ── EDLIX FACE ───────────────────────────────────── */
    #edlixFace1,
    #voice-face {
      position: relative;
      width: 260px;
      height: 260px;
      background: var(--face-bg);
      border-radius: 40%;
      border: 3px solid var(--face-border);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      box-shadow: 0 0 40px var(--face-glow), 0 0 80px var(--face-glow), inset 0 0 30px color-mix(in srgb, var(--face-primary) 10%, transparent);
      transition: all 0.4s ease;
      cursor: pointer;
      flex-shrink: 0;
      overflow: visible;
      margin-top: 28px;
    }

    #edlixFace1:hover,
    #voice-face:hover {
      box-shadow: 0 0 60px var(--face-glow), 0 0 120px color-mix(in srgb, var(--pink) 33%, transparent), inset 0 0 40px color-mix(in srgb, var(--face-primary) 20%, transparent);
      border-color: var(--pink);
      transform: scale(1.04);
    }

    /* Headphones */
    .headphone {
      position: absolute;
      width: 30px;
      height: 70px;
      background: linear-gradient(180deg, var(--face-primary), color-mix(in srgb, var(--face-primary) 70%, var(--black)));
      border-radius: 20px;
      top: 50%;
      transform: translateY(-65%);
      box-shadow: 0 0 14px var(--face-glow), 0 0 28px color-mix(in srgb, var(--face-primary) 50%, transparent);
      z-index: 2;
    }

    .hp-left {
      left: -44px;
      border-radius: 10px 4px 4px 10px;
    }

    .hp-right {
      right: -44px;
      border-radius: 4px 10px 10px 4px;
    }

    /* Headphone connector arms (the part connecting earcup to headband) */
    .hp-left::before,
    .hp-right::before {
      content: "";
      position: absolute;
      width: 10px;
      height: 17px;
      background: var(--face-secondary);
      top: -10px;
      border-radius: 4px;
      box-shadow: 0 0 6px color-mix(in srgb, var(--face-secondary) 88%, transparent);
    }

    .hp-left::before {
      right: 2px;
    }

    .hp-right::before {
      left: 2px;
    }

    .headband {
      position: absolute;
      top: -22px;
      left: -25px;
      right: -25px;
      height: 100px;
      background: transparent;
      border: 3px solid var(--face-secondary);
      border-bottom: none;
      border-radius: 900px 900px 0 0;
      box-shadow: 0 -4px 16px color-mix(in srgb, var(--face-primary) 77%, transparent), 0 -8px 32px color-mix(in srgb, var(--face-primary) 33%, transparent);
      z-index: 1;
    }

    /* Headband padding cushion effect */
    .headband::after {
      content: "";
      position: absolute;
      top: 3px;
      left: 12px;
      right: 12px;
      height: 5px;
      background: linear-gradient(90deg, transparent, var(--purple)44, transparent);
      border-radius: 99px;
    }

    /* Eyes */
    .edlix-eyes {
      display: flex;
      gap: 48px;
      margin-bottom: 14px;
    }

    .eye {
      width: 28px;
      height: 28px;
      background: var(--bg-eye);
      border: 2px solid var(--face-eye-color);
      border-radius: 50%;
      position: relative;
      box-shadow: 0 0 10px color-mix(in srgb, var(--face-eye-color) 66%, transparent);
      transition: transform 0.1s ease;
      overflow: hidden;
    }

    .eye::before {
      /* pupil */
      content: "";
      position: absolute;
      width: 13px;
      height: 13px;
      background: radial-gradient(circle at 40% 40%, var(--face-pupil), var(--face-eye-color));
      border-radius: 50%;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      box-shadow: 0 0 8px var(--face-pupil);
    }

    .eye::after {
      /* glint */
      content: "";
      position: absolute;
      width: 5px;
      height: 5px;
      background: var(--white);
      border-radius: 50%;
      top: 6px;
      left: 8px;
      opacity: 0.8;
    }

    /* Blinking animation */
    @keyframes eyeBlink {

      0%,
      92%,
      100% {
        transform: scaleY(1);
      }

      96% {
        transform: scaleY(0.05);
      }
    }

    .eye {
      animation: eyeBlink 4s ease-in-out infinite;
    }

    #eyeRight {
      animation-delay: 0.08s;
    }

    /* Mouth */
    .mouth {
      width: 36px;
      height: 18px;
      background: transparent;
      overflow: hidden;
      position: relative;
    }

    .mouth::before {
      content: "";
      position: absolute;
      width: 36px;
      height: 36px;
      background: var(--face-primary);
      border-radius: 50%;
      top: -22px;
      /* hides top half */
      left: 0;
      box-shadow: 0 4px 10px var(--purple)55;
    }

    /* Expression states */
    #edlixFace1.edlix-thinking .mouth,
    #voice-face.edlix-thinking .mouth {
      width: 30px;
      height: 6px;
      border-radius: 0;
      border-bottom: 2.5px solid var(--purple);
      border-left: none;
      border-right: none;
    }

    #edlixFace1.edlix-thinking .eye {
      animation: none;
      border-color: var(--yellow);
    }

    #edlixFace1.edlix-thinking .eye::before {
      background: radial-gradient(circle at 40% 40%, var(--yellow), var(--amber));
    }


    /* Scan line effect */
    #edlixFace1::after,
    #voice-face::after {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: 40%;
      background: linear-gradient(transparent 49%, var(--purple)08 50%, transparent 51%);
      background-size: 100% 6px;
      pointer-events: none;
      opacity: 0.6;
    }

    /* Pulse ring */
    @keyframes facePulse {
      0% {
        box-shadow: 0 0 40px var(--purple)66, 0 0 80px var(--purple)22, inset 0 0 30px var(--purple)11, 0 0 0 0 var(--purple)44;
      }

      70% {
        box-shadow: 0 0 40px var(--purple)66, 0 0 80px var(--purple)22, inset 0 0 30px var(--purple)11, 0 0 0 16px transparent;
      }

      100% {
        box-shadow: 0 0 40px var(--purple)66, 0 0 80px var(--purple)22, inset 0 0 30px var(--purple)11, 0 0 0 0 transparent;
      }
    }

    #edlixFace1,
    #voice-face {
      animation: facePulse 5s ease-in-out infinite;
    }

    /* ── VOICE WAVE BARS ─────────────────────────────── */
    .wave-bar {
      width: 5px;
      background: var(--purple);
      border-radius: 99px;
      height: 10px;
      transition: height 0.15s ease;
      animation: wavePulse 1.2s ease-in-out infinite;
    }

    .wave-bar:nth-child(2) {
      animation-delay: 0.1s;
    }

    .wave-bar:nth-child(3) {
      animation-delay: 0.2s;
    }

    .wave-bar:nth-child(4) {
      animation-delay: 0.3s;
      background: var(--pink);
    }

    .wave-bar:nth-child(5) {
      animation-delay: 0.2s;
    }

    .wave-bar:nth-child(6) {
      animation-delay: 0.1s;
    }

    .wave-bar:nth-child(7) {
      animation-delay: 0.05s;
    }

    .wave-bar:nth-child(8) {
      animation-delay: 0s;
    }

    @keyframes wavePulse {

      0%,
      100% {
        height: 8px;
        opacity: 0.4;
      }

      50% {
        height: 40px;
        opacity: 1;
      }
    }

    #voice-waves.idle .wave-bar {
      animation: none;
      height: 8px;
      opacity: 0.3;
    }

    #voice-waves.speaking .wave-bar {
      animation-duration: 0.5s;
    }

    /* ── SPIN ANIMATION (for settings loading) ───────── */
    @keyframes spin360 {
      from {
        transform: rotate(0deg);
      }

      to {
        transform: rotate(360deg);
      }
    }

    /* ── VOICE FACE EXPRESSION STATES ───────────────── */
    /* Listening: eyes pulse with cyan */
    #voice-face.edlix-listening .eye {
      border-color: var(--cyan);
      animation: eyeListenPulse 0.8s ease-in-out infinite;
    }

    #voice-face.edlix-listening .eye::before {
      background: radial-gradient(circle at 40% 40%, var(--cyan), var(--cyan));
    }

    @keyframes eyeListenPulse {

      0%,
      100% {
        box-shadow: 0 0 8px var(--cyan)88;
      }

      50% {
        box-shadow: 0 0 20px var(--cyan)cc;
      }
    }

    /* Thinking: eyes turn yellow, scan left-right */
    #voice-face.edlix-thinking .eye {
      border-color: var(--yellow);
      animation: eyeScan 1s ease-in-out infinite alternate;
    }

    @keyframes eyeScan {
      from {
        --px: -4px;
      }

      to {
        --px: 4px;
      }
    }

    /* Speaking: eyes turn green, mouth bigger */
    #voice-face.edlix-happy .eye {
      border-color: var(--green);
      animation: eyeHappy 0.4s ease-in-out infinite alternate;
    }

    @keyframes eyeHappy {
      from {
        transform: scaleY(1);
      }

      to {
        transform: scaleY(0.8);
      }
    }

    /* Processing ripple on voice face */
    @keyframes voiceProcessRipple {
      0% {
        box-shadow: 0 0 60px var(--yellow)88, 0 0 120px var(--yellow)33, 0 0 0 0 var(--yellow)44;
      }

      70% {
        box-shadow: 0 0 60px var(--yellow)88, 0 0 120px var(--yellow)33, 0 0 0 20px transparent;
      }

      100% {
        box-shadow: 0 0 60px var(--yellow)88, 0 0 120px var(--yellow)33, 0 0 0 0 transparent;
      }
    }

    #voice-face.edlix-thinking {
      border-color: var(--yellow);
      animation: voiceProcessRipple 1.2s ease-out infinite;
    }

    /* ── QUIZ CINEMATIC ──────────────────────────────── */
    .quiz-cinematic-wrap {
      position: relative;
      overflow: hidden;
    }

    /* Starfield bg for quiz */
    #quiz-section {
      position: relative;
      background: transparent;
    }

    .quiz-stars-bg {
      position: fixed;
      inset: 0;
      pointer-events: none;
      z-index: 0;
      background:
        radial-gradient(ellipse at 20% 50%, var(--purple)08 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, var(--pink)06 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, var(--cyan)05 0%, transparent 40%);
      animation: quizBgShift 8s ease-in-out infinite alternate;
    }

    @keyframes quizBgShift {
      from {
        opacity: 0.5;
      }

      to {
        opacity: 1;
      }
    }

    .quiz-card {
      position: relative;
      z-index: 1;
      transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    .quiz-card:hover {
      box-shadow: 0 0 30px var(--purple)22;
    }

    /* Question entrance animation */
    @keyframes quizCardIn {
      from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
      }

      to {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }

    .quiz-card {
      animation: quizCardIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    /* Option hover glow */
    .quiz-option {
      position: relative;
      overflow: hidden;
    }

    .quiz-option::after {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(135deg, var(--purple)00, var(--purple)11);
      opacity: 0;
      transition: opacity 0.2s;
    }

    .quiz-option:hover::after {
      opacity: 1;
    }

    .quiz-option.correct {
      animation: correctFlash 0.5s ease;
    }

    .quiz-option.wrong {
      animation: wrongShake 0.4s ease;
    }

    @keyframes correctFlash {
      0% {
        background: var(--green)44;
      }

      100% {
        background: var(--green)11;
      }
    }

    @keyframes wrongShake {

      0%,
      100% {
        transform: translateX(0);
      }

      25% {
        transform: translateX(-6px);
      }

      75% {
        transform: translateX(6px);
      }
    }

    /* Score counter */
    .quiz-score-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: var(--green)22;
      border: 1px solid var(--green)44;
      border-radius: 99px;
      padding: 4px 12px;
      font-size: 13px;
      font-weight: 700;
      color: var(--green);
    }

    /* Quiz progress bar glowing */
    .quiz-progress-fill {
      box-shadow: 0 0 12px var(--purple)66;
      animation: progressGlow 2s ease-in-out infinite alternate;
    }

    @keyframes progressGlow {
      from {
        box-shadow: 0 0 8px var(--purple)44;
      }

      to {
        box-shadow: 0 0 20px var(--purple)88;
      }
    }

    /* Results fireworks effect */
    @keyframes resultsPop {
      0% {
        transform: scale(0.5) rotate(-10deg);
        opacity: 0;
      }

      60% {
        transform: scale(1.1) rotate(3deg);
      }

      100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
      }
    }

    .quiz-results-icon {
      animation: resultsPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    /* Smooth mode transitions */
    #chat-section,
    #notes-section,
    #quiz-section {
      transition: opacity 0.2s ease;
    }

    #edlix-modal-overlay {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 2000;
      background: color-mix(in srgb, var(--bg-deep) 80%, transparent);
      backdrop-filter: blur(10px);
      align-items: center;
      justify-content: center;
    }

    #edlix-modal-overlay.open {
      display: flex;
    }

    .edlix-modal {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 20px;
      padding: 32px 36px;
      width: 420px;
      max-width: 92vw;
      display: flex;
      flex-direction: column;
      gap: 18px;
      animation: fadeUp 0.25s ease;
      box-shadow: 0 0 60px color-mix(in srgb, var(--bg-deep) 53%, transparent);
    }

    .edlix-modal-icon {
      font-size: 40px;
      text-align: center;
    }

    .edlix-modal-title {
      font-size: 20px;
      font-weight: 700;
      color: var(--white);
      text-align: center;
    }

    .edlix-modal-text {
      font-size: 14px;
      color: var(--text-muted);
      text-align: center;
      line-height: 1.6;
    }

    .edlix-modal-body {
      /* custom HTML slot */
    }

    .edlix-modal-actions {
      display: flex;
      gap: 10px;
      justify-content: center;
      margin-top: 4px;
    }

    .edlix-modal-btn {
      flex: 1;
      padding: 12px 20px;
      border-radius: 12px;
      border: none;
      font-family: var(--font-main);
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: 0.15s;
    }

    .edlix-modal-btn.primary {
      background: linear-gradient(135deg, var(--purple), var(--purple-dk));
      color: var(--white);
    }

    .edlix-modal-btn.primary:hover {
      opacity: 0.9;
      transform: translateY(-1px);
    }

    .edlix-modal-btn.danger {
      background: linear-gradient(135deg, var(--danger), var(--danger-dk));
      color: var(--white);
    }

    .edlix-modal-btn.secondary {
      background: var(--bg-deep);
      border: 1px solid var(--border);
      color: var(--text-muted);
    }

    .edlix-modal-btn.secondary:hover {
      color: var(--text);
      border-color: var(--text-dim);
    }

    .edlix-modal-input {
      width: 100%;
      background: var(--bg-deep);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text);
      font-family: var(--font-main);
      font-size: 14px;
      padding: 11px 14px;
      outline: none;
      transition: 0.15s;
      box-sizing: border-box;
    }

    .edlix-modal-input:focus {
      border-color: var(--purple);
      box-shadow: 0 0 0 3px var(--purple)22;
    }

    .edlix-modal-input::placeholder {
      color: var(--text-muted);
    }

    .edlix-modal-textarea {
      width: 100%;
      background: var(--bg-deep);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text);
      font-family: var(--font-main);
      font-size: 14px;
      padding: 11px 14px;
      outline: none;
      transition: 0.15s;
      box-sizing: border-box;
      resize: vertical;
      min-height: 100px;
      line-height: 1.6;
    }

    .edlix-modal-textarea:focus {
      border-color: var(--purple);
    }

    /* ── SETTINGS PANEL ──────────────────────────────────── */
    #settings-overlay {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 1500;
      background: color-mix(in srgb, var(--bg-deep) 73%, transparent);
      backdrop-filter: blur(12px);
    }

    #settings-overlay.open {
      display: flex;
    }

    #settings-panel {
      position: absolute;
      right: 0;
      top: 0;
      bottom: 0;
      width: 480px;
      max-width: 95vw;
      background: var(--bg-card);
      border-left: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      overflow: hidden;
    }

    @keyframes slideInRight {
      from {
        transform: translateX(100%);
        opacity: 0;
      }

      to {
        transform: translateX(0);
        opacity: 1;
      }
    }

    .settings-header {
      padding: 22px 24px 18px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      gap: 14px;
      flex-shrink: 0;
    }

    .settings-header h2 {
      font-size: 18px;
      font-weight: 700;
      color: var(--white);
      flex: 1;
    }

    .settings-close-btn {
      background: none;
      border: none;
      cursor: pointer;
      color: var(--text-muted);
      padding: 7px;
      border-radius: 8px;
      display: flex;
      transition: 0.15s;
    }

    .settings-close-btn:hover {
      color: var(--text);
      background: var(--border);
    }

    .settings-tabs {
      display: flex;
      border-bottom: 1px solid var(--border);
      padding: 0 8px;
      flex-shrink: 0;
      overflow-x: auto;
      scrollbar-width: none;
    }

    .settings-tabs::-webkit-scrollbar {
      display: none;
    }

    .settings-tab {
      padding: 12px 16px;
      font-size: 13px;
      font-weight: 600;
      color: var(--text-muted);
      cursor: pointer;
      border-bottom: 2px solid transparent;
      transition: 0.15s;
      white-space: nowrap;
      background: none;
      border-top: none;
      border-left: none;
      border-right: none;
      font-family: var(--font-main);
    }

    .settings-tab.active {
      color: var(--purple-lt);
      border-bottom-color: var(--purple);
    }

    .settings-tab:hover:not(.active) {
      color: var(--text);
    }

    .settings-body {
      flex: 1;
      overflow-y: auto;
      padding: 24px;
      display: flex;
      flex-direction: column;
      gap: 22px;
    }

    .settings-section {
      display: flex;
      flex-direction: column;
      gap: 14px;
    }

    .settings-section-title {
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 1.5px;
      text-transform: uppercase;
      color: var(--text-muted);
    }

    .settings-field {
      display: flex;
      flex-direction: column;
      gap: 7px;
    }

    .settings-label {
      font-size: 13px;
      font-weight: 600;
      color: var(--text-dim);
    }

    .settings-input {
      background: var(--bg-deep);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text);
      font-family: var(--font-main);
      font-size: 14px;
      padding: 11px 14px;
      outline: none;
      transition: 0.15s;
      box-sizing: border-box;
      width: 100%;
    }

    .settings-input:focus {
      border-color: var(--purple);
      box-shadow: 0 0 0 3px var(--purple)22;
    }

    .settings-textarea {
      background: var(--bg-deep);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text);
      font-family: var(--font-main);
      font-size: 14px;
      padding: 11px 14px;
      outline: none;
      transition: 0.15s;
      resize: vertical;
      min-height: 90px;
      width: 100%;
      box-sizing: border-box;
      line-height: 1.6;
    }

    .settings-textarea:focus {
      border-color: var(--purple);
    }

    .settings-avatar-row {
      display: flex;
      align-items: center;
      gap: 16px;
    }

    .settings-avatar-preview {
      width: 64px;
      height: 64px;
      border-radius: 50%;
      overflow: hidden;
      background: linear-gradient(135deg, var(--purple), var(--pink));
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 24px;
      font-weight: 700;
      color: var(--white);
      flex-shrink: 0;
      border: 2px solid var(--border);
    }

    .settings-avatar-preview img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .settings-avatar-actions {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .settings-btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 9px 16px;
      border-radius: 10px;
      border: none;
      font-family: var(--font-main);
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: 0.15s;
    }

    .settings-btn.primary {
      background: var(--purple);
      color: var(--white);
    }

    .settings-btn.primary:hover {
      opacity: 0.85;
    }

    .settings-btn.secondary {
      background: var(--bg-deep);
      border: 1px solid var(--border);
      color: var(--text-muted);
    }

    .settings-btn.secondary:hover {
      color: var(--text);
      border-color: var(--text-dim);
    }

    .settings-btn.danger {
      background: color-mix(in srgb, var(--danger) 13%, transparent);
      border: 1px solid color-mix(in srgb, var(--danger) 33%, transparent);
      color: var(--danger-lt);
    }

    .settings-btn.danger:hover {
      background: color-mix(in srgb, var(--danger) 20%, transparent);
    }

    .settings-btn.save {
      background: linear-gradient(135deg, var(--purple), var(--purple-dk));
      color: var(--white);
      width: 100%;
      justify-content: center;
    }

    .settings-btn.save:hover {
      opacity: 0.9;
      transform: translateY(-1px);
    }

    .settings-divider {
      height: 1px;
      background: var(--border);
    }

    .saved-item-card {
      background: var(--bg-deep);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 14px 16px;
      display: flex;
      align-items: flex-start;
      gap: 12px;
    }

    .saved-item-icon {
      font-size: 22px;
      flex-shrink: 0;
    }

    .saved-item-info {
      flex: 1;
      min-width: 0;
    }

    .saved-item-title {
      font-size: 14px;
      font-weight: 600;
      color: var(--text);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .saved-item-meta {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 3px;
    }

    .saved-item-actions {
      display: flex;
      gap: 6px;
      flex-shrink: 0;
    }

    .saved-item-btn {
      background: none;
      border: 1px solid var(--border);
      border-radius: 7px;
      color: var(--text-muted);
      font-size: 11px;
      font-weight: 600;
      padding: 4px 10px;
      cursor: pointer;
      font-family: var(--font-main);
      transition: 0.15s;
    }

    .saved-item-btn:hover {
      color: var(--text);
      border-color: var(--text-dim);
    }

    .saved-item-btn.del {
      color: var(--pink);
      border-color: var(--pink)44;
    }

    .saved-item-btn.del:hover {
      background: var(--pink)11;
    }

    .empty-state {
      text-align: center;
      padding: 32px 20px;
      color: var(--text-muted);
      font-size: 13px;
      background: var(--bg-deep);
      border-radius: 12px;
      border: 1px dashed var(--border);
    }

    .empty-state .es-icon {
      font-size: 32px;
      margin-bottom: 10px;
    }

    #settings-tab-profile {}

    #settings-tab-instructions {
      display: none;
    }

    #settings-tab-history {
      display: none;
    }

    #settings-tab-saved {
      display: none;
    }

    /* ── PC WELCOME ACTION PANELS ────────────────────────── */
    #welcome-screen {
      position: relative;
    }

    .welcome-side-panel {
      display: none;
    }


    /* ═══════════════════════════════════════════════════════
       EDLIX AI — VOICE MODE  v4 (chat sidebar + alive PC layout)
       ═══════════════════════════════════════════════════════ */

    /* ── Full overlay ── */
    #voice-overlay {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 500;
      background: color-mix(in srgb, var(--bg-overlay) 97%, transparent);
      backdrop-filter: blur(28px);
      overflow: hidden;
      flex-direction: column;
    }

    /* ══ EXIT LOADER — shown when Close is clicked ══ */
    #vm-exit-loader {
      position: absolute;
      inset: 0;
      z-index: 200;
      display: none;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 18px;
      background: color-mix(in srgb, var(--bg-overlay) 97%, transparent);
      backdrop-filter: blur(20px);
    }

    #vm-exit-loader.show {
      display: flex;
    }

    .vm-exit-spinner {
      width: 58px;
      height: 58px;
      border-radius: 50%;
      border: 2.5px solid color-mix(in srgb, var(--white) 3%, transparent);
      border-top-color: var(--purple);
      border-right-color: var(--pink);
      border-bottom-color: var(--cyan);
      animation: vmExitSpin 0.9s linear infinite;
    }

    @keyframes vmExitSpin {
      to {
        transform: rotate(360deg);
      }
    }

    .vm-exit-label {
      font-size: 11px;
      color: var(--text-muted);
      letter-spacing: 2px;
      text-transform: uppercase;
      animation: vmExitPulse 1.4s ease-in-out infinite;
    }

    @keyframes vmExitPulse {

      0%,
      100% {
        opacity: .35
      }

      50% {
        opacity: 1
      }
    }

    /* ══ AMBIENT MOVING GLOW BLOBS ══ */
    #vm-glows {
      position: absolute;
      inset: 0;
      z-index: 0;
      pointer-events: none;
      overflow: hidden;
    }

    .vmg {
      position: absolute;
      border-radius: 50%;
      filter: blur(110px);
      opacity: 0;
      transition: opacity 1.6s ease;
    }

    #vmg1 {
      width: 520px;
      height: 520px;
      background: var(--purple);
      animation: vmgDrift1 14s ease-in-out infinite;
    }

    #vmg2 {
      width: 380px;
      height: 380px;
      background: var(--pink);
      animation: vmgDrift2 10s ease-in-out infinite;
    }

    #vmg3 {
      width: 440px;
      height: 440px;
      background: var(--teal);
      animation: vmgDrift3 17s ease-in-out infinite;
    }

    #vmg4 {
      width: 300px;
      height: 300px;
      background: var(--indigo);
      animation: vmgDrift4 12s ease-in-out infinite;
    }

    /* idle: slight purple */
    #voice-overlay.vm-idle #vmg1 {
      opacity: .045;
    }

    /* listening: cyan + purple */
    #voice-overlay.vm-listening #vmg1 {
      opacity: .07;
    }

    #voice-overlay.vm-listening #vmg3 {
      opacity: .055;
    }

    /* processing: pink + indigo */
    #voice-overlay.vm-processing #vmg2 {
      opacity: .07;
    }

    #voice-overlay.vm-processing #vmg4 {
      opacity: .06;
    }

    /* speaking: green tones via cyan + pink */
    #voice-overlay.vm-speaking #vmg2 {
      opacity: .08;
    }

    #voice-overlay.vm-speaking #vmg3 {
      opacity: .07;
    }

    @keyframes vmgDrift1 {
      0% {
        transform: translate(-5%, 15%);
      }

      25% {
        transform: translate(55%, -10%);
      }

      50% {
        transform: translate(75%, 60%);
      }

      75% {
        transform: translate(5%, 75%);
      }

      100% {
        transform: translate(-5%, 15%);
      }
    }

    @keyframes vmgDrift2 {
      0% {
        transform: translate(78%, 65%);
      }

      30% {
        transform: translate(5%, 5%);
      }

      65% {
        transform: translate(65%, -15%);
      }

      100% {
        transform: translate(78%, 65%);
      }
    }

    @keyframes vmgDrift3 {
      0% {
        transform: translate(45%, -18%);
      }

      40% {
        transform: translate(-10%, 55%);
      }

      72% {
        transform: translate(88%, 80%);
      }

      100% {
        transform: translate(45%, -18%);
      }
    }

    @keyframes vmgDrift4 {
      0% {
        transform: translate(25%, 88%);
      }

      38% {
        transform: translate(88%, 22%);
      }

      68% {
        transform: translate(-8%, -8%);
      }

      100% {
        transform: translate(25%, 88%);
      }
    }

    /* ══ TOP BAR ══ */
    #vm-topbar {
      flex-shrink: 0;
      height: 54px;
      position: relative;
      z-index: 5;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 22px;
      border-bottom: 1px solid color-mix(in srgb, var(--white) 3%, transparent);
    }

    #vm-topbar-left {
      display: flex;
      align-items: center;
      gap: 14px;
    }

    #vm-topbar-logo {
      font-family: var(--font-main);
      font-size: 13px;
      font-weight: 700;
      letter-spacing: 2.5px;
      text-transform: uppercase;
      background: linear-gradient(90deg, var(--purple-lt), var(--pink));
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }

    /* User chip in topbar */
    #vm-user-chip {
      display: flex;
      align-items: center;
      gap: 7px;
      background: color-mix(in srgb, var(--white) 3%, transparent);
      border: 1px solid color-mix(in srgb, var(--white) 6%, transparent);
      border-radius: 20px;
      padding: 4px 10px 4px 4px;
    }

    #vm-user-chip-avatar {
      width: 24px;
      height: 24px;
      border-radius: 50%;
      overflow: hidden;
      background: linear-gradient(135deg, var(--purple), var(--pink));
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 10px;
      font-weight: 700;
      color: var(--white);
      flex-shrink: 0;
    }

    #vm-user-chip-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    #vm-user-chip-name {
      font-size: 11px;
      color: var(--text-dim);
      font-weight: 500;
    }

    #vm-topbar-right {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .vm-tb-btn {
      background: none;
      border: 1px solid color-mix(in srgb, var(--white) 8%, transparent);
      border-radius: 9px;
      color: var(--text-muted);
      font-family: var(--font-main);
      font-size: 11px;
      font-weight: 500;
      padding: 6px 12px;
      cursor: pointer;
      transition: .2s;
      display: flex;
      align-items: center;
      gap: 5px;
    }

    .vm-tb-btn:hover {
      border-color: var(--purple);
      color: var(--purple-lt);
    }

    .vm-tb-btn.muted {
      border-color: var(--cyan);
      color: var(--cyan);
    }

    .vm-tb-close:hover {
      border-color: var(--pink);
      color: var(--pink);
    }

    /* Chat toggle button */
    #vm-chat-toggle {
      background: none;
      border: 1px solid color-mix(in srgb, var(--white) 8%, transparent);
      border-radius: 9px;
      color: var(--text-muted);
      font-family: var(--font-main);
      font-size: 11px;
      font-weight: 500;
      padding: 6px 12px;
      cursor: pointer;
      transition: .2s;
      display: flex;
      align-items: center;
      gap: 5px;
    }

    #vm-chat-toggle:hover {
      border-color: var(--purple);
      color: var(--purple-lt);
    }

    #vm-chat-toggle.active {
      border-color: var(--purple);
      color: var(--purple-lt);
      background: var(--purple)15;
    }

    /* ══ BODY: center stage | collapsible sidebar ══ */
    #vm-body {
      flex: 1;
      min-height: 0;
      display: flex;
      position: relative;
      z-index: 2;
    }

    /* ══ CENTER STAGE — face + PC elements ══ */
    #vm-center-col {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 24px 32px;
      gap: 0;
      position: relative;
    }

    /* ── PC DECORATIVE ELEMENTS ── */
    /* Floating stat chips */
    .vm-stat-chip {
      position: absolute;
      display: flex;
      align-items: center;
      gap: 7px;
      background: rgba(255, 255, 255, .04);
      border: 1px solid rgba(255, 255, 255, .08);
      backdrop-filter: blur(12px);
      border-radius: 12px;
      padding: 8px 14px;
      font-size: 11px;
      color: var(--text-muted);
      font-family: var(--font-main);
      animation: vmChipFloat 4s ease-in-out infinite;
      pointer-events: none;
    }

    .vm-stat-chip .chip-icon {
      font-size: 14px;
    }

    .vm-stat-chip .chip-val {
      color: var(--text);
      font-weight: 600;
    }

    #vsc-model {
      top: 18%;
      left: 8%;
      animation-delay: 0s;
    }

    #vsc-msgs {
      top: 26%;
      right: 7%;
      animation-delay: 0.8s;
    }

    #vsc-lang {
      bottom: 22%;
      left: 6%;
      animation-delay: 1.4s;
    }

    #vsc-time {
      bottom: 28%;
      right: 6%;
      animation-delay: 2.1s;
    }

    @keyframes vmChipFloat {

      0%,
      100% {
        transform: translateY(0px);
        opacity: .55;
      }

      50% {
        transform: translateY(-6px);
        opacity: .85;
      }
    }

    /* Orbit ring decorations */
    .vm-orbit {
      position: absolute;
      border-radius: 50%;
      border: 1px solid rgba(255, 255, 255, .04);
      pointer-events: none;
    }

    #vo1 {
      width: 420px;
      height: 420px;
      animation: vmOrbitSpin 28s linear infinite;
      border-color: color-mix(in srgb, var(--purple) 12%, transparent);
    }

    #vo2 {
      width: 560px;
      height: 560px;
      animation: vmOrbitSpin 45s linear infinite reverse;
      border-color: color-mix(in srgb, var(--pink) 7%, transparent);
    }

    #vo3 {
      width: 280px;
      height: 280px;
      animation: vmOrbitSpin 18s linear infinite;
      border-color: color-mix(in srgb, var(--cyan) 9%, transparent);
    }

    @keyframes vmOrbitSpin {
      to {
        transform: rotate(360deg);
      }
    }

    /* Orbit dots */
    .vm-orbit::after {
      content: '';
      position: absolute;
      top: -3px;
      left: 50%;
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: currentColor;
      margin-left: -3px;
    }

    #vo1 {
      color: color-mix(in srgb, var(--purple) 50%, transparent);
    }

    #vo2 {
      color: color-mix(in srgb, var(--pink) 40%, transparent);
    }

    #vo3 {
      color: color-mix(in srgb, var(--cyan) 50%, transparent);
    }

    /* Corner scan lines */
    .vm-scanline {
      position: absolute;
      pointer-events: none;
      opacity: .06;
    }

    .vm-scanline-h {
      height: 1px;
      background: linear-gradient(90deg, transparent, var(--purple), transparent);
      width: 60%;
    }

    .vm-scanline-v {
      width: 1px;
      background: linear-gradient(180deg, transparent, var(--cyan), transparent);
      height: 55%;
    }

    #vsl1 {
      top: 50%;
      left: 20%;
    }

    #vsl2 {
      bottom: 30%;
      right: 20%;
    }

    #vsl3 {
      top: 20%;
      left: 50%;
    }

    #vsl4 {
      bottom: 20%;
      right: 50%;
    }

    /* Mic-waking overlay */
    #vm-wake-overlay {
      position: absolute;
      inset: 0;
      z-index: 10;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 18px;
      background: color-mix(in srgb, var(--bg-overlay) 94%, transparent);
      transition: opacity .45s;
    }

    #vm-wake-overlay.hidden {
      opacity: 0;
      pointer-events: none;
    }

    .vm-wake-spinner {
      width: 52px;
      height: 52px;
      border-radius: 50%;
      border: 2.5px solid color-mix(in srgb, var(--white) 6%, transparent);
      border-top-color: var(--purple);
      border-right-color: var(--pink);
      animation: vmSpin .85s linear infinite;
    }

    @keyframes vmSpin {
      to {
        transform: rotate(360deg);
      }
    }

    .vm-wake-text {
      font-size: 11px;
      color: var(--text-muted);
      letter-spacing: 1.5px;
      text-transform: uppercase;
    }

    /* Face */
    .voice-face-wrap {
      position: relative;
      flex-shrink: 0;
      z-index: 2;
    }

    .voice-ring {
      position: absolute;
      border-radius: 50%;
      border: 1.5px solid transparent;
      animation: vRing 6s linear infinite;
      pointer-events: none;
      transition: all .6s ease;
    }

    .voice-ring.r1 {
      inset: -10px;
      background: linear-gradient(var(--bg-overlay), var(--bg-overlay)) padding-box, linear-gradient(135deg, var(--purple), var(--pink)) border-box;
    }

    .voice-ring.r2 {
      inset: -20px;
      animation-duration: 10s;
      animation-direction: reverse;
      opacity: .4;
      background: linear-gradient(var(--bg-overlay), var(--bg-overlay)) padding-box, linear-gradient(135deg, var(--pink), var(--cyan)) border-box;
    }

    .voice-ring.r3 {
      inset: -32px;
      animation-duration: 16s;
      opacity: .15;
      background: linear-gradient(var(--bg-overlay), var(--bg-overlay)) padding-box, linear-gradient(135deg, var(--cyan), var(--purple)) border-box;
    }

    @keyframes vRing {
      to {
        transform: rotate(360deg)
      }
    }

    #voice-overlay.vm-listening .voice-ring.r1 {
      background: linear-gradient(var(--bg-overlay), var(--bg-overlay)) padding-box, linear-gradient(135deg, var(--cyan), var(--teal)) border-box;
      animation-duration: 3s;
    }

    #voice-overlay.vm-processing .voice-ring.r1 {
      background: linear-gradient(var(--bg-overlay), var(--bg-overlay)) padding-box, linear-gradient(135deg, var(--yellow), var(--amber)) border-box;
      animation-duration: 1.5s;
    }

    #voice-overlay.vm-speaking .voice-ring.r1 {
      background: linear-gradient(var(--bg-overlay), var(--bg-overlay)) padding-box, linear-gradient(135deg, var(--emerald), var(--emerald-dk)) border-box;
      animation-duration: 4s;
    }

    #voice-overlay.vm-speaking #voice-face .mouth {
      animation: mouthTalk .32s ease-in-out infinite alternate;
    }

    @keyframes mouthTalk {
      0% {
        height: 4px;
        border-radius: 0 0 6px 6px
      }

      100% {
        height: 15px;
        border-radius: 0 0 18px 18px
      }
    }

    /* Command panel */
    #vm-cmd {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 12px;
      width: 100%;
      z-index: 2;
      margin-top: 18px;
    }

    #vm-status {
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
      letter-spacing: .5px;
      text-align: center;
      min-height: 18px;
    }

    #vm-live {
      font-size: 11px;
      color: var(--text-muted);
      text-align: center;
      min-height: 15px;
      line-height: 1.5;
    }

    #voice-waves {
      display: flex;
      gap: 4px;
      align-items: center;
      height: 36px;
    }

    .wave-bar {
      width: 3px;
      border-radius: 3px;
      background: var(--purple-lt);
      height: 5px;
      transition: height .08s ease;
    }

    #voice-overlay.vm-processing .wave-bar {
      animation: wvThink 1.6s ease-in-out infinite;
    }

    #voice-overlay.vm-speaking .wave-bar {
      animation: wvSpeak 0.7s ease-in-out infinite;
    }

    .wave-bar:nth-child(1) {
      animation-delay: .00s
    }

    .wave-bar:nth-child(2) {
      animation-delay: .14s
    }

    .wave-bar:nth-child(3) {
      animation-delay: .28s
    }

    .wave-bar:nth-child(4) {
      animation-delay: .07s
    }

    .wave-bar:nth-child(5) {
      animation-delay: .21s
    }

    .wave-bar:nth-child(6) {
      animation-delay: .35s
    }

    .wave-bar:nth-child(7) {
      animation-delay: .10s
    }

    .wave-bar:nth-child(8) {
      animation-delay: .25s
    }

    @keyframes wvThink {

      0%,
      100% {
        height: 4px;
        opacity: .3
      }

      50% {
        height: 20px;
        opacity: 1
      }
    }

    @keyframes wvSpeak {

      0%,
      100% {
        height: 6px
      }

      50% {
        height: 26px
      }
    }

    #vm-silence-dots {
      display: flex;
      gap: 5px;
      align-items: center;
    }

    .sil-dot {
      width: 5px;
      height: 5px;
      border-radius: 50%;
      background: color-mix(in srgb, var(--white) 8%, transparent);
      transition: background .15s, box-shadow .15s;
    }

    .sil-dot.active {
      background: var(--cyan);
      box-shadow: 0 0 5px var(--cyan);
    }

    #vm-stop-btn {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: none;
      border: 1.5px solid var(--pink);
      color: var(--pink);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: .2s;
    }

    #vm-stop-btn:hover {
      background: color-mix(in srgb, var(--pink) 6%, transparent);
    }

    @keyframes voiceRipple {
      0% {
        box-shadow: 0 0 0 0 var(--purple)55
      }

      70% {
        box-shadow: 0 0 0 26px transparent
      }

      100% {
        box-shadow: 0 0 0 0 transparent
      }
    }

    #voice-face.speaking {
      animation: voiceRipple 2s ease-out infinite;
    }

    /* ══ COLLAPSIBLE CHAT SIDEBAR ══ */
    #vm-chat-sidebar {
      width: 320px;
      min-width: 320px;
      display: flex;
      flex-direction: column;
      border-left: 1px solid color-mix(in srgb, var(--white) 4%, transparent);
      background: color-mix(in srgb, var(--bg-surface) 70%, transparent);
      backdrop-filter: blur(16px);
      overflow: hidden;
      transition: width .3s cubic-bezier(.4, 0, .2, 1), min-width .3s cubic-bezier(.4, 0, .2, 1), opacity .25s ease;
      position: relative;
      z-index: 3;
    }

    #vm-chat-sidebar.collapsed {
      width: 0;
      min-width: 0;
      opacity: 0;
      pointer-events: none;
    }

    #vm-sidebar-head {
      flex-shrink: 0;
      padding: 14px 16px 11px;
      border-bottom: 1px solid color-mix(in srgb, var(--white) 3%, transparent);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .vm-sb-title {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .vm-sb-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--purple);
      box-shadow: 0 0 8px var(--purple);
      animation: vmDotPulse 2s ease-in-out infinite;
    }

    @keyframes vmDotPulse {

      0%,
      100% {
        opacity: 1;
        transform: scale(1)
      }

      50% {
        opacity: .5;
        transform: scale(.8)
      }
    }

    .vm-sb-label {
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 2px;
      text-transform: uppercase;
      color: var(--text-muted);
    }

    #vm-clear-btn {
      background: none;
      border: none;
      cursor: pointer;
      color: var(--text-muted);
      font-size: 10px;
      letter-spacing: .5px;
      font-family: var(--font-main);
      padding: 3px 7px;
      border-radius: 6px;
      transition: .15s;
    }

    #vm-clear-btn:hover {
      color: var(--pink);
      background: var(--pink)11;
    }

    /* Messages */
    #vm-msgs-combined {
      flex: 1;
      overflow-y: auto;
      padding: 14px 12px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      scrollbar-width: thin;
      scrollbar-color: color-mix(in srgb, var(--white) 5%, transparent) transparent;
    }

    #vm-msgs-combined::-webkit-scrollbar {
      width: 2px;
    }

    /* hidden compat divs */
    #vm-msgs-user,
    #vm-msgs-edlix {
      display: none;
    }

    /* ══ GLASS BUBBLES ══ */
    .vm-row {
      display: flex;
      gap: 7px;
      align-items: flex-end;
      animation: vmBubIn .35s cubic-bezier(.16, 1, .3, 1);
    }

    @keyframes vmBubIn {
      from {
        opacity: 0;
        transform: translateY(8px)
      }

      to {
        opacity: 1;
        transform: none
      }
    }

    .vm-row.user {
      flex-direction: row-reverse;
      align-self: flex-end;
      max-width: 88%;
    }

    .vm-row.edlix {
      flex-direction: row;
      align-self: flex-start;
      max-width: 88%;
    }

    .vm-bub {
      padding: 9px 13px;
      border-radius: 15px;
      font-size: 12.5px;
      line-height: 1.65;
      word-break: break-word;
      position: relative;
      overflow: hidden;
      backdrop-filter: blur(18px);
      -webkit-backdrop-filter: blur(18px);
    }

    /* User — blue glass */
    .vm-row.user .vm-bub {
      background: color-mix(in srgb, var(--blue-glass) 20%, transparent);
      border: 1px solid color-mix(in srgb, var(--blue-light) 28%, transparent);
      color: color-mix(in srgb, var(--blue-light) 80%, var(--white));
      border-bottom-right-radius: 3px;
      box-shadow: 0 4px 20px color-mix(in srgb, var(--blue-glass) 15%, transparent), inset 0 1px 0 rgba(255, 255, 255, .1);
    }

    /* Edlix AI — purple glass */
    .vm-row.edlix .vm-bub {
      background: color-mix(in srgb, var(--purple) 18%, transparent);
      border: 1px solid color-mix(in srgb, var(--purple-lt) 22%, transparent);
      color: color-mix(in srgb, var(--purple-lt) 60%, var(--white));
      border-bottom-left-radius: 3px;
      box-shadow: 0 4px 20px rgba(109, 40, 217, .15), inset 0 1px 0 rgba(255, 255, 255, .07);
    }

    /* shimmer highlight */
    .vm-bub::before {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(135deg, rgba(255, 255, 255, .06) 0%, transparent 55%);
      pointer-events: none;
    }

    .vm-av {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      flex-shrink: 0;
      overflow: hidden;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 11px;
      font-weight: 700;
    }

    .vm-av.user-av {
      background: color-mix(in srgb, var(--blue-glass) 25%, transparent);
      border: 1px solid color-mix(in srgb, var(--blue-light) 30%, transparent);
      color: var(--blue-light);
      backdrop-filter: blur(8px);
    }

    .vm-av.edlix-av {
      background: linear-gradient(135deg, var(--purple), var(--pink));
      box-shadow: 0 0 10px var(--purple)55;
    }

    .vm-av img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    /* ── Mobile ── */
    @media(max-width:700px) {
      #vm-chat-sidebar {
        display: none;
      }

      #vm-center-col {
        padding: 16px;
      }

      .vm-stat-chip {
        display: none;
      }

      .vm-orbit {
        display: none;
      }

      .vm-scanline {
        display: none;
      }

      #vm-chat-toggle {
        display: none;
      }

      #vm-user-chip {
        display: none;
      }
    }

    /* ── TOPBAR HIDE ON MOBILE ───────────────────────── */
    .topbar-hide-mobile {}

    /* shown by default */

    /* ── STREAMED VISUAL PLACEHOLDER ───────────────── */
    .visual-placeholder {
      background: var(--bg-card);
      border: 1px dashed var(--border);
      border-radius: 12px;
      padding: 16px;
      margin: 12px 0;
      display: flex;
      align-items: center;
      gap: 12px;
      animation: v-pulse 2s infinite ease-in-out;
      color: var(--text-muted);
      font-family: var(--font-main);
    }

    @keyframes v-pulse {

      0%,
      100% {
        opacity: 0.5;
        transform: scale(0.995);
      }

      50% {
        opacity: 0.8;
        transform: scale(1);
      }
    }

    .v-loader-dots {
      display: flex;
      gap: 4px;
    }

    .v-loader-dots span {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--purple-lt);
      animation: v-dot-bounce 1.4s infinite ease-in-out both;
    }

    .v-loader-dots span:nth-child(1) {
      animation-delay: -0.32s;
    }

    .v-loader-dots span:nth-child(2) {
      animation-delay: -0.16s;
    }

    @keyframes v-dot-bounce {

      0%,
      80%,
      100% {
        transform: scale(0);
        opacity: 0.3;
      }

      40% {
        transform: scale(1);
        opacity: 1;
      }
    }

    .v-loading-text::after {
      content: "Designing layout...";
      animation: v-text-cycle 6s infinite;
    }

    @keyframes v-text-cycle {

      0%,
      20% {
        content: "Analyzing concepts...";
      }

      25%,
      45% {
        content: "Drafting visual layout...";
      }

      50%,
      70% {
        content: "Generating data points...";
      }

      75%,
      95% {
        content: "Finalizing design...";
      }

      100% {
        content: "Analyzing concepts...";
      }
    }

    /* ── iOS SAFE AREA ───────────────────────────────── */
    @supports (padding-bottom: env(safe-area-inset-bottom)) {
      #main {
        padding-bottom: env(safe-area-inset-bottom);
      }
    }

    @media (max-width: 768px) {
      .topbar-hide-mobile {
        display: none !important;
      }
    }

    .settings-toggle-btn {
      display: flex;
      align-items: center;
      gap: 5px;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 9px;
      color: var(--text-muted);
      font-family: var(--font-main);
      font-size: 12px;
      font-weight: 500;
      padding: 6px 11px;
      cursor: pointer;
      transition: 0.15s;
    }

    .settings-toggle-btn:hover {
      color: var(--text);
      border-color: var(--purple);
      background: var(--purple)11;
    }

    .theme-inline-box {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 14px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      animation: fadeUp 0.3s ease;
    }

    .theme-inline-title {
      font-size: 14px;
      font-weight: 600;
    }

    .theme-inline-grid {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .theme-inline-swatch {
      width: 22px;
      height: 22px;
      border-radius: 6px;
      border: 1px solid var(--border);
    }


    .hidden {
      display: none !important;
    }

    .skeleton {
      position: relative;
      overflow: hidden;
      background: color-mix(in srgb, var(--bg-card) 70%, var(--bg-deep));
      border: 1px solid var(--border);
      border-radius: var(--radius);
    }

    .skeleton::after {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg,
          transparent,
          color-mix(in srgb, var(--text) 8%, transparent),
          transparent);
      transform: translateX(-100%);
      animation: shimmer 1.4s infinite;
    }

    @keyframes shimmer {
      100% {
        transform: translateX(100%);
      }
    }

    @keyframes softPulse {

      0%,
      100% {
        opacity: 0.85;
      }

      50% {
        opacity: 1;
      }
    }

    .skeleton.pulse {
      animation: softPulse 2s ease-in-out infinite;
    }

    /* Sidebar skeleton */
    .sidebar-skeleton .sk {
      position: relative;
      overflow: hidden;
      background: color-mix(in srgb, var(--bg-card) 70%, var(--bg-deep));
      border: 1px solid var(--border);
      border-radius: 10px;
    }

    .sidebar-skeleton .sk::after {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg,
          transparent,
          color-mix(in srgb, var(--text) 7%, transparent),
          transparent);
      transform: translateX(-100%);
      animation: skShimmer 1.3s infinite;
    }

    @keyframes skShimmer {
      100% {
        transform: translateX(100%);
      }
    }

    .skeleton::after {
      background: linear-gradient(90deg,
          transparent,
          color-mix(in srgb, var(--purple) 18%, transparent),
          transparent);
    }

    .skeleton {
      box-shadow: 0 0 0 transparent;
      transition: 0.3s;
    }

    .skeleton.pulse {
      box-shadow: 0 0 14px var(--border-glow);
    }

    #mobile-splash {
      position: fixed;
      inset: 0;
      background: var(--bg-void);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 99999;
      transition: opacity 0.4s ease;
    }

    .splash-inner {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 28px;
    }

    /* Glow text */
    .splash-title {
      font-size: 28px;
      font-weight: 700;
      background: linear-gradient(90deg, var(--purple), var(--pink));
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      animation: splashGlow 2s ease-in-out infinite;
    }

    @keyframes splashGlow {

      0%,
      100% {
        filter: drop-shadow(0 0 8px var(--purple));
      }

      50% {
        filter: drop-shadow(0 0 18px var(--pink));
      }
    }

    /* Slight breathing effect on face */
    #mobile-splash #edlixFace1 {
      animation: splashPulse 2.5s ease-in-out infinite;
    }

    @keyframes splashPulse {

      0%,
      100% {
        transform: scale(1);
      }

      50% {
        transform: scale(1.05);
      }
    }

    @media (max-width: 768px) {
      #mobile-splash {
        display: flex;
      }
    }


    #fatal-error-overlay {
      position: fixed;
      inset: 0;
      background: color-mix(in srgb, var(--bg-deep) 90%, transparent);
      backdrop-filter: blur(10px);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 999999;
    }

    .fatal-box {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 18px;
      padding: 32px;
      text-align: center;
      max-width: 320px;
      animation: fadeUp 0.3s ease;
      box-shadow: 0 20px 60px var(--border-glow);
    }

    .fatal-title {
      font-size: 18px;
      font-weight: 700;
      margin-bottom: 8px;
      color: var(--text);
    }

    .fatal-desc {
      font-size: 13px;
      color: var(--text-dim);
      margin-bottom: 20px;
      line-height: 1.5;
    }

    .fatal-btn {
      background: linear-gradient(135deg,
          var(--purple),
          var(--pink));
      border: none;
      border-radius: 10px;
      padding: 10px 22px;
      color: var(--white);
      font-weight: 600;
      cursor: pointer;
      transition: 0.25s;
    }

    .fatal-btn:hover {
      filter: brightness(1.15);
      box-shadow: 0 6px 20px var(--border-glow);
    }

    .quiz-results-wrap {
      max-width: 700px;
      margin: auto;
      display: flex;
      flex-direction: column;
      gap: 28px;
    }

    .result-circle-wrap {
      position: relative;
      width: 180px;
      height: 180px;
      margin: auto;
    }

    .result-circle-text {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }

    .result-pct {
      font-size: 28px;
      font-weight: 800;
    }

    .result-label {
      font-size: 13px;
      color: var(--text-muted);
    }

    .result-graph {
      display: flex;
      height: 10px;
      border-radius: 99px;
      overflow: hidden;
      background: var(--border);
    }

    .bar.correct {
      background: var(--green);
    }

    .bar.wrong {
      background: var(--pink);
    }

    .result-legend {
      display: flex;
      justify-content: space-between;
      font-size: 13px;
    }

    .result-table {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .result-row {
      border-radius: 12px;
      border: 1px solid var(--border);
      overflow: hidden;
    }

    .row-head {
      display: flex;
      justify-content: space-between;
      padding: 10px 14px;
      cursor: pointer;
      background: var(--bg-card);
    }

    .row-body {
      display: none;
      padding: 12px 14px;
      font-size: 13px;
      background: var(--bg-dark-card);
      line-height: 1.5;
    }

    .row-body.open {
      display: block;
    }

    .row-correct {
      border-left: 4px solid var(--green);
    }

    .row-wrong {
      border-left: 4px solid var(--pink);
    }

    .explain {
      margin-top: 8px;
      padding: 8px;
      border-radius: 8px;
      background: var(--purple)11;
    }

    .result-buttons {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
    }

    .result-btn {
      flex: 1;
      padding: 12px;
      border-radius: 12px;
      background: var(--purple);
      border: none;
      color: var(--white);
      font-weight: 600;
      cursor: pointer;
    }

    .result-btn.alt {
      background: linear-gradient(135deg, var(--cyan), var(--cyan-dk));
    }

    @media (max-width: 768px) {
      .quiz-results-wrap {
        padding: 0 10px;
      }

      .result-circle-wrap {
        width: 150px;
        height: 150px;
      }

      .result-pct {
        font-size: 22px;
      }

      .result-buttons {
        flex-direction: column;
      }

      .quick-prompts {
        display: grid;
      }
    }

    /* ── QUIZ/NOTES/SETTINGS SKELETONS ──────────────── */
    .sk-section-header {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      padding: 16px 0 8px;
    }

    .sk-face {
      width: 120px;
      height: 120px;
      border-radius: 40%;
      background: linear-gradient(135deg, var(--bg-card), var(--border));
      position: relative;
      overflow: hidden;
    }

    .sk-face::after {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--purple) 20%, transparent), transparent);
      transform: translateX(-100%);
      animation: skMove var(--sk-speed) infinite;
    }

    .sk-title-line {
      height: 22px;
      border-radius: 8px;
      background: var(--bg-card);
      position: relative;
      overflow: hidden;
    }

    .sk-title-line::after {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--purple-lt) 15%, transparent), transparent);
      transform: translateX(-100%);
      animation: skMove var(--sk-speed) infinite;
    }

    .sk-form-row {
      display: flex;
      gap: 10px;
      align-items: center;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 16px;
    }

    .sk-input-wide {
      flex: 1;
      height: 40px;
      border-radius: 10px;
      background: var(--bg-deep);
      position: relative;
      overflow: hidden;
    }

    .sk-input-wide::after {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 8%, transparent), transparent);
      transform: translateX(-100%);
      animation: skMove var(--sk-speed) infinite;
    }

    .sk-btn {
      height: 40px;
      border-radius: 10px;
      background: linear-gradient(135deg, color-mix(in srgb, var(--yellow) 40%, transparent), color-mix(in srgb, var(--yellow) 20%, transparent));
      position: relative;
      overflow: hidden;
    }

    .sk-btn::after {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--yellow) 25%, transparent), transparent);
      transform: translateX(-100%);
      animation: skMove var(--sk-speed) infinite;
    }

    .sk-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 20px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      position: relative;
      overflow: hidden;
    }

    .sk-card::before {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--purple) 8%, transparent), transparent);
      transform: translateX(-100%);
      animation: skMove var(--sk-speed) infinite;
    }

    .sk-line {
      height: 14px;
      border-radius: 6px;
      background: var(--border);
    }

    .sk-line.w-80 {
      width: 80%;
    }

    .sk-line.w-60 {
      width: 60%;
    }

    .sk-line.w-40 {
      width: 40%;
    }

    .sk-line.w-100 {
      width: 100%;
    }

    .sk-options {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-top: 4px;
    }

    .sk-option {
      height: 44px;
      border-radius: 10px;
      background: var(--bg-deep);
      border: 1px solid var(--border);
      position: relative;
      overflow: hidden;
    }

    .sk-option::after {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 6%, transparent), transparent);
      transform: translateX(-100%);
      animation: skMove var(--sk-speed) 0.1s infinite;
    }

    /* Settings skeleton */
    .sk-settings-profile {
      display: flex;
      gap: 14px;
      align-items: center;
      padding: 16px;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
    }

    .sk-avatar-circle {
      width: 64px;
      height: 64px;
      border-radius: 50%;
      background: linear-gradient(135deg, var(--purple), var(--pink));
      opacity: 0.3;
      flex-shrink: 0;
      position: relative;
      overflow: hidden;
    }

    .sk-settings-rows {
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin-top: 12px;
    }

    .sk-settings-row {
      height: 48px;
      border-radius: 10px;
      background: var(--bg-deep);
      border: 1px solid var(--border);
      position: relative;
      overflow: hidden;
    }

    .sk-settings-row::after {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--purple-lt) 12%, transparent), transparent);
      transform: translateX(-100%);
      animation: skMove var(--sk-speed) infinite;
    }

    /* ── QUICK PROMPTS FOR NOTES/QUIZ ──────────────── */
    .section-quick-prompts {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
      gap: 10px;
      margin-top: 4px;
    }

    .sqp-chip {
      display: flex;
      align-items: center;
      gap: 8px;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 9px 12px;
      cursor: pointer;
      font-size: 12px;
      font-weight: 500;
      color: var(--text-dim);
      font-family: var(--font-main);
      transition: all 0.18s ease;
      text-align: left;
    }

    .sqp-chip:hover {
      border-color: var(--purple);
      color: var(--text);
      background: color-mix(in srgb, var(--purple) 10%, var(--bg-card));
      transform: translateY(-1px);
      box-shadow: 0 4px 14px color-mix(in srgb, var(--purple) 20%, transparent);
    }

    .sqp-chip .sqp-icon {
      font-size: 15px;
      flex-shrink: 0;
    }

    /* Section skeletons fade in/out */
    #quiz-skeleton,
    #notes-skeleton {
      display: none;
      flex-direction: column;
      gap: 16px;
      padding: 24px;
      animation: fadeUp 0.3s ease;
    }

    #quiz-skeleton.active,
    #notes-skeleton.active {
      display: flex;
    }

    /* ── CINEMATIC GLOW EFFECTS ──────────────────────── */
    .glow-line {
      height: 1px;
      background: linear-gradient(90deg, transparent, var(--purple), var(--cyan), transparent);
      opacity: 0.4;
      margin: 0;
    }

    .neon-badge {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      background: color-mix(in srgb, var(--purple) 15%, transparent);
      border: 1px solid color-mix(in srgb, var(--purple) 40%, transparent);
      border-radius: 99px;
      padding: 3px 10px;
      font-size: 11px;
      font-weight: 600;
      color: var(--purple-lt);
      letter-spacing: 0.5px;
      box-shadow: 0 0 12px color-mix(in srgb, var(--purple) 20%, transparent);
    }

    .neon-badge::before {
      content: "";
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--purple-lt);
      box-shadow: 0 0 6px var(--purple-lt);
      animation: blink 1.5s ease-in-out infinite;
    }

    /* ── THEME GALLERY IN SETTINGS ─────────────────── */
    .theme-gallery {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
      gap: 10px;
    }

    .theme-card {
      border-radius: 12px;
      border: 2px solid var(--border);
      padding: 12px;

      cursor: pointer;
      transition: all 0.2s ease;
      position: relative;
      overflow: hidden;
    }

    .theme-card:hover {
      border-color: var(--purple);
      transform: translateY(-2px);
      box-shadow: 0 8px 24px color-mix(in srgb, var(--purple) 25%, transparent);
    }

    .theme-card.active-theme {
      border-color: var(--purple);
      box-shadow: 0 0 0 2px color-mix(in srgb, var(--purple) 40%, transparent);
    }

    .theme-card.active-theme::after {
      content: "✓";
      position: absolute;
      top: 6px;
      right: 8px;
      font-size: 12px;
      font-weight: 700;
      color: var(--purple-lt);
    }

    .theme-preview {
      width: 100%;
      height: 44px;
      border-radius: 8px;
      margin-bottom: 8px;
      position: relative;
      overflow: hidden;
    }

    .theme-name {
      font-size: 11px;
      font-weight: 600;
      color: var(--text-dim);
      text-align: center;
      font-family: var(--font-main);
    }

    /* ── FACE CUSTOMIZER ──────────────────────────── */
    .face-option-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
      gap: 8px;
    }

    .face-option {
      border-radius: 12px;
      border: 2px solid var(--border);
      padding: 8px;
      cursor: pointer;
      transition: all 0.18s;
      text-align: center;
      background: var(--bg-deep);
    }

    .face-option:hover {
      border-color: var(--purple);
      background: color-mix(in srgb, var(--purple) 8%, var(--bg-deep));
    }

    .face-option.selected {
      border-color: var(--purple);
      background: color-mix(in srgb, var(--purple) 12%, var(--bg-deep));
    }

    .face-option-mini {
      width: 42px;
      height: 42px;
      border-radius: 30%;
      margin: 0 auto 6px;
      border: 2px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
    }

    .face-option-label {
      font-size: 10px;
      color: var(--text-muted);
      font-family: var(--font-main);
      font-weight: 600;
    }

    /* Color picker row */
    .color-picker-row {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      align-items: center;
    }

    .color-swatch {
      width: 28px;
      height: 28px;
      border-radius: 8px;
      border: 2px solid transparent;
      cursor: pointer;
      transition: all 0.15s;
      position: relative;
    }

    .color-swatch:hover {
      transform: scale(1.15);
    }

    .color-swatch.selected {
      border-color: var(--text);
      box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--text);
    }

    .color-custom-input {
      width: 28px;
      height: 28px;
      border-radius: 8px;
      border: 2px solid var(--border);
      cursor: pointer;
      background: none;
      padding: 0;
    }

    @keyframes skMove {
      100% {
        transform: translateX(100%);
      }
    }


    /* ───────────────── TABLET OVERLAY SIDEBAR ───────────────── */
    @media (min-width:768px) and (max-width:1024px) {
      .somosa {
        display: none !important;
      }

      /* Sidebar overlay — HIDDEN by default on tablet */
      #sidebar {
        position: fixed !important;
        left: -260px !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 260px !important;
        min-width: 260px !important;
        padding: 16px 12px !important;
        background: var(--bg-card) !important;
        border-right: 1px solid var(--border) !important;
        transform: none !important;
        transition: left .32s cubic-bezier(.4, 0, .2, 1) !important;
        z-index: 9999 !important;
        opacity: 1 !important;
        pointer-events: none !important;
      }

      /* Open state */
      #sidebar.mobile-open {
        left: 0 !important;
        pointer-events: auto !important;
        transform: none !important;
      }

      /* Desktop collapse neutralized on tablet */
      #sidebar.closed {
        left: -260px !important;
        width: 260px !important;
        min-width: 260px !important;
        opacity: 1 !important;
        pointer-events: none !important;
        transform: none !important;
      }

      /* Backdrop */
      #mobile-sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: color-mix(in srgb, var(--bg-deep) 67%, transparent);
        backdrop-filter: blur(4px);
        z-index: 180;
        display: none;
      }

      #mobile-sidebar-backdrop.visible {
        display: block;
      }

      /* Layout tuning */
      #chat-area {
        padding: 24px 18px;
        gap: 20px;
      }

      .message-row {
        max-width: 720px;
      }

      .message-bubble {
        font-size: 14px;
        padding: 13px 16px;
      }

      #welcome-screen {
        gap: 24px;
        padding: 24px;
        justify-content: center;
        align-items: center;
        text-align: center;
      }

      .welcome-title {
        font-size: 26px;
      }

      .welcome-sub {
        font-size: 14px;
      }

      .quick-prompts {
        grid-template-columns: repeat(2, 1fr);
        max-width: 500px;
      }

      #edlixFace1 {
        margin-left: auto;
        margin-right: auto;
      }

      #input-bar {
        padding: 14px 18px;
      }

      .input-wrapper {
        border-radius: 18px;
      }

      #quiz-section,
      #notes-section {
        padding: 20px;
      }

      /* Topbar simplification */
      #topbar .mode-selector,
      .topbar-btn-label,
      #topbar [title="Visit EdlixPost"],
      #topbar [title="Quiz Mode"] {
        display: none;
      }

      .quick-prompts {
        display: grid;
      }
    }

    /* Desktop collapse override for overlay widths */
    @media (max-width:1024px) {
      #sidebar.closed {
        width: 260px !important;
        min-width: 260px !important;
        opacity: 1 !important;
        pointer-events: none !important;
        left: -280px !important;
        transform: none !important;
      }
    }

    @media (min-width: 1024px) {
      #welcome-screen {
        flex-direction: row !important;
        align-items: stretch !important;
        justify-content: center;
        gap: 0 !important;
        padding: 20px 0;
      }

      .welcome-center {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 28px;
        flex: 0 0 auto;
        padding: 0 32px;
        justify-content: center;
      }

      .welcome-side-panel {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 220px;
        flex-shrink: 0;
        padding: 16px 0;
        justify-content: center;
      }

      .welcome-panel-title {
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 1.5px;
        text-transform: uppercase;
        color: var(--text-muted);
        margin-bottom: 4px;
        padding: 0 4px;
      }

      .panel-action-btn {
        display: flex;
        align-items: center;
        gap: 10px;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 12px 14px;
        cursor: pointer;
        transition: 0.2s;
        width: 100%;
        text-align: left;
        color: var(--text-dim);
        font-family: var(--font-main);
        font-size: 13px;
        font-weight: 500;
      }

      .panel-action-btn:hover {
        border-color: var(--purple);
        background: var(--purple)11;
        color: var(--text);
        transform: translateY(-2px);
        box-shadow: 0 4px 16px var(--purple)22;
      }

      .panel-action-btn .pab-icon {
        font-size: 18px;
        flex-shrink: 0;
      }

      .panel-action-btn .pab-text {
        display: flex;
        flex-direction: column;
      }

      .panel-action-btn .pab-title {
        font-size: 13px;
        font-weight: 600;
        color: var(--text);
      }

      .panel-action-btn .pab-desc {
        font-size: 11px;
        color: var(--text-muted);
        margin-top: 1px;
      }


    }

    .panel-action-btn {
      display: flex;
      flex-direction: column;
      /* stack icon + text */
      align-items: center;
      /* horizontal center */
      justify-content: center;
      /* vertical center */
      text-align: center;
      gap: 0px;
    }

    .pab-text {
      display: flex;
      flex-direction: column;
      align-items: center;
      text-align: center;
    }

    .pab-icon {
      display: flex;
      align-items: center;
      justify-content: center;
    }

    #sidebar2 {
      background: var(--bg-deep);
      border-right: 1px solid var(--border);
      width: var(--sidebar-w);
      display: flex;
      flex-direction: column;
    }

    .sk {
      position: relative;
      overflow: hidden;
      background: var(--bg-card);
      border: 1px solid var(--border);
      box-shadow: inset 0 0 8px var(--border-glow);
    }

    .sk::after {
      content: "";
      position: absolute;
      inset: 0;

      background: linear-gradient(90deg,
          transparent,
          var(--purple-lt),
          var(--cyan),
          transparent);

      transform: translateX(-100%);
      animation: edlixSkeleton 1.6s infinite;
    }

    @keyframes edlixSkeleton {
      100% {
        transform: translateX(100%);
      }
    }

    .sidebar-skeleton {
      background:
        radial-gradient(circle at 80% 20%, var(--purple), transparent 40%),
        radial-gradient(circle at 20% 80%, var(--pink), transparent 40%),
        var(--bg-deep);
    }

    .sk {
      animation: skPulse 2.8s ease-in-out infinite;
    }

    @keyframes skPulse {

      0%,
      100% {
        box-shadow: inset 0 0 8px var(--border-glow);
      }

      50% {
        box-shadow:
          inset 0 0 12px var(--border-glow),
          0 0 10px var(--purple);
      }
    }

    .toolbox {
      position: absolute;
      bottom: calc(100% + 8px);
      left: 0;
      right: 0;
      background: linear-gradient(135deg, var(--bg-surface), var(--bg-surface));
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 8px;
      display: flex;
      flex-direction: row;
      gap: 6px;
      flex-wrap: wrap;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px var(--border-glow);
      z-index: 200;
      /* Slide up animation */
      transform-origin: bottom center;
      animation: toolboxSlideUp 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    @keyframes toolboxSlideUp {
      from {
        transform: translateY(12px) scale(0.97);
        opacity: 0;
      }

      to {
        transform: translateY(0) scale(1);
        opacity: 1;
      }
    }

    .toolbox.hidden {
      display: none;
    }

    .toolbox button {
      background: transparent;
      border: none;
      color: var(--text);
      padding: 8px 10px;
      text-align: left;
      border-radius: 8px;
      cursor: pointer;
      font-family: var(--font-main);
      font-size: 13px;
    }

    .toolbox button:hover {
      background: color-mix(in srgb, var(--purple) 15%, transparent);
    }

    /* Mobile: horizontal scrolling pill row */
    @media (max-width: 600px) {
      .toolbox {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 8px 10px;
        gap: 8px;
        scrollbar-width: none;
        bottom: calc(100% + 6px);
        border-radius: 14px;
      }

      .toolbox::-webkit-scrollbar {
        display: none;
      }

      .tool-toggle {
        flex-shrink: 0;
        white-space: nowrap;
      }
    }

    .tool-toggle {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 6px 10px;
      border: 1px solid var(--border);
      background: var(--bg-deep);
      border-radius: 10px;
      cursor: pointer;
      transition: .25s;
      color: var(--text-dim);
      font-family: var(--font-main);
      font-size: 13px;
    }

    .tool-toggle:hover {
      border-color: var(--purple);
      color: var(--text);
    }

    .tool-toggle.dim {
      opacity: .35;
    }

    .switch {
      width: 38px;
      height: 20px;
      background: var(--border);
      border-radius: 20px;
      position: relative;
      transition: .25s;
      flex-shrink: 0;
    }

    .knob {
      width: 16px;
      height: 16px;
      background: var(--text-muted);
      border-radius: 50%;
      position: absolute;
      top: 2px;
      left: 2px;
      transition: .25s;
    }

    .tool-toggle.active .switch {
      background: var(--green);
    }

    .tool-toggle.active .knob {
      left: 20px;
      background: var(--white);
    }


    /* ── Reasoning loader — pulsing brain ───────────────────────────────────── */
    .think-loader {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 12px 0 6px;
    }

    .think-loader-brain {
      font-size: 22px;
      animation: brainPulse 1.4s ease-in-out infinite;
      filter: drop-shadow(0 0 6px var(--purple));
    }

    @keyframes brainPulse {

      0%,
      100% {
        transform: scale(1);
        opacity: 0.7;
        filter: drop-shadow(0 0 4px var(--purple));
      }

      50% {
        transform: scale(1.18);
        opacity: 1;
        filter: drop-shadow(0 0 12px var(--purple));
      }
    }

    .think-loader-dots {
      display: flex;
      gap: 5px;
    }

    .think-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--purple);
      animation: thinkDot 1.3s ease-in-out infinite;
    }

    .think-dot:nth-child(2) {
      animation-delay: .2s;
      background: var(--purple-lt);
    }

    .think-dot:nth-child(3) {
      animation-delay: .4s;
      background: var(--pink);
    }

    @keyframes thinkDot {

      0%,
      80%,
      100% {
        opacity: .3;
        transform: translateY(0);
      }

      40% {
        opacity: 1;
        transform: translateY(-4px);
      }
    }

    .think-loader-text {
      font-size: 13px;
      color: var(--text-muted);
      letter-spacing: .3px;
      animation: fadeText 2s ease-in-out infinite;
    }

    @keyframes fadeText {

      0%,
      100% {
        opacity: .5;
      }

      50% {
        opacity: 1;
      }
    }

    /* ── Think box — live reasoning panel ──────────────────────────────────── */
    .think-box {
      background: linear-gradient(135deg, color-mix(in srgb, var(--purple) 8%, transparent), rgba(236, 72, 153, .04));
      border: 1px solid color-mix(in srgb, var(--purple) 30%, transparent);
      border-left: 3px solid var(--purple);
      border-radius: 12px;
      margin-bottom: 10px;
      overflow: hidden;
      transition: all .3s ease;
    }

    .think-box summary {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 14px;
      cursor: pointer;
      font-size: 13px;
      font-weight: 600;
      color: var(--purple-lt);
      user-select: none;
      letter-spacing: .3px;
    }

    .think-box summary::-webkit-details-marker {
      display: none;
    }

    .think-box summary::before {
      content: "▶";
      font-size: 9px;
      transition: transform .2s ease;
      color: var(--purple);
    }

    .think-box[open] summary::before {
      transform: rotate(90deg);
    }

    .think-box-badge {
      font-size: 11px;
      background: color-mix(in srgb, var(--purple) 20%, transparent);
      color: var(--purple-lt);
      padding: 2px 8px;
      border-radius: 20px;
      margin-left: auto;
      animation: fadeIn .3s ease;
    }

    .think-content {
      padding: 0 14px 12px;
      font-size: 13px;
      line-height: 1.65;
      color: var(--text-muted);
      border-top: 1px solid color-mix(in srgb, var(--purple) 15%, transparent);
      max-height: 320px;
      overflow-y: auto;
      scrollbar-width: thin;
      scrollbar-color: var(--purple) transparent;
    }

    /* Thinking in progress — subtle pulse on the border */
    .think-box.thinking {
      border-left-color: var(--purple);
      animation: thinkBorderPulse 1.5s ease-in-out infinite;
    }

    @keyframes thinkBorderPulse {

      0%,
      100% {
        border-left-color: var(--purple);
        box-shadow: none;
      }

      50% {
        border-left-color: var(--purple-lt);
        box-shadow: -2px 0 12px color-mix(in srgb, var(--purple) 30%, transparent);
      }
    }

    /* Answer reveal — slides in after thinking */
    .reasoning-answer {
      animation: answerReveal .5s cubic-bezier(.22, 1, .36, 1) both;
    }

    @keyframes answerReveal {
      from {
        opacity: 0;
        transform: translateY(8px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    /* Stats bar — shows token counts after completion */
    .reason-stats {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-top: 8px;
      font-size: 11px;
      color: var(--text-dim);
      padding: 4px 0;
      border-top: 1px solid var(--border);
    }

    .reason-stat-pill {
      background: color-mix(in srgb, var(--purple) 12%, transparent);
      color: var(--purple-lt);
      padding: 2px 8px;
      border-radius: 20px;
      font-size: 11px;
    }

    .search-box {
      background: linear-gradient(145deg, var(--bg-surface-2), var(--bg-dark-card));
      border: 1px solid var(--search-purple);
      border-radius: 14px;
      padding: 16px;
      animation: fadeIn 0.4s ease;
    }

    .search-title {
      font-weight: bold;
      margin-bottom: 8px;
      color: var(--purple-lt);
    }

    .search-stage {
      font-size: 14px;
      margin-bottom: 10px;
      opacity: 0.85;
    }

    .search-progress {
      height: 6px;
      background: var(--search-dark);
      border-radius: 10px;
      overflow: hidden;
    }

    .search-progress-bar {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, var(--search-purple), var(--pink));
      transition: width 0.4s ease;
    }

    .search-results-box {
      margin-top: 15px;
      padding: 12px;
      background: var(--bg-surface-2);
      border-radius: 12px;
      border: 1px solid var(--search-slate);
    }

    .search-source {
      margin-bottom: 12px;
    }

    .source-name {
      font-weight: bold;
      margin-bottom: 5px;
      color: var(--pink);
    }

    .search-source ul {
      padding-left: 18px;
    }

    @keyframes fadeIn {
      from {
        opacity: 0;
        transform: translateY(5px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    ::selection {
      background-color: var(--face-border);
      /* highlight color */
      color: var(--text);
      /* text color */
    }

    .sidebar-section {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .sidebar-toggle {
      background: none;
      border: none;
      color: var(--text);
      font-size: 14px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      cursor: pointer;
      padding: 8px 10px;
      border-radius: 8px;
      transition: 0.2s;
    }

    .sidebar-toggle:hover {
      background: var(--bg-card);
    }

    .sidebar-content {
      display: flex;
      flex-direction: column;
      gap: 6px;
      padding-left: 8px;
      max-height: 0;
      overflow: hidden;
      transition: max-height 0.3s ease;
    }

    .sidebar-section.active .sidebar-content {
      max-height: 200px;
      overflow-y: auto;
      scrollbar-width: thin;
      scrollbar-color: var(--border) transparent;
    }

    .sidebar-section.active .sidebar-content::-webkit-scrollbar {
      width: 3px;
    }

    .sidebar-section.active .sidebar-content::-webkit-scrollbar-thumb {
      background: var(--border);
      border-radius: 99px;
    }

    .arrow {
      transition: 0.3s;
    }

    .sidebar-section.active .arrow {
      transform: rotate(180deg);
    }

    .sidebar-nav-link:hover {
      background: var(--bg-card);
      box-shadow: 0 0 8px var(--border);
    }


    /* ── AURA WRAP ── */
    .edlix-aura-wrap {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      isolation: isolate;
      flex-shrink: 0;
    }

    #aura-canvas {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      pointer-events: none;
      z-index: 0;
    }

    .aura-glow {
      position: absolute;
      inset: -80px;
      border-radius: 50%;
      background: radial-gradient(ellipse at 50% 50%,
          var(--face-glow) 0%,
          color-mix(in srgb, var(--purple) 10%, transparent) 45%,
          transparent 70%);
      pointer-events: none;
      z-index: 1;
    }

    .aura-ring {
      position: absolute;
      border-radius: 50%;
      pointer-events: none;
      z-index: 2;
    }

    .aura-ring-1 {
      inset: -22px;
      border: 1px solid transparent;
      background:
        linear-gradient(var(--face-bg), var(--face-bg)) padding-box,
        conic-gradient(from 0deg,
          var(--cyan) 0%,
          transparent 20%,
          var(--purple-lt) 50%,
          transparent 70%,
          var(--cyan) 100%) border-box;
      animation: edlixRingSpin 7s linear infinite;
    }

    .aura-ring-2 {
      inset: -42px;
      border: 1px solid transparent;
      background:
        linear-gradient(var(--face-bg), var(--face-bg)) padding-box,
        conic-gradient(from 180deg,
          var(--pink) 0%,
          transparent 25%,
          var(--purple) 55%,
          transparent 80%,
          var(--pink) 100%) border-box;
      animation: edlixRingSpin 11s linear infinite reverse;
      opacity: 0.55;
    }

    @keyframes edlixRingSpin {
      to {
        rotate: 360deg;
      }
    }

    #edlixFace1 {
      position: relative;
      z-index: 10;
    }


    /* ── MESSAGE META ROW ── */
    .message-meta {
      font-size: 11px;
      color: var(--text-muted);
      margin-top: 5px;
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
    }

    .message-row.user .message-meta {
      justify-content: flex-end;
    }

    /* ── BASE ACTION BUTTON ── */
    .msg-action-btn {
      background: none;
      border: none;
      cursor: pointer;
      color: var(--text-muted);
      font-size: 11px;
      padding: 3px 7px;
      border-radius: 6px;
      transition: color 0.15s, background 0.15s, transform 0.15s;
      font-family: var(--font-main);
      display: inline-flex;
      align-items: center;
      gap: 4px;
      line-height: 1;
      user-select: none;
    }

    .msg-action-btn:hover {
      color: var(--text);
      background: var(--border-glow);
      transform: translateY(-1px);
    }

    .msg-action-btn:active {
      transform: scale(0.92);
    }

    /* keep existing copy-msg-btn working unchanged */
    .copy-msg-btn {
      background: none;
      border: none;
      cursor: pointer;
      color: var(--text-muted);
      font-size: 11px;
      padding: 3px 7px;
      border-radius: 6px;
      transition: 0.15s;
      font-family: var(--font-main);
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }

    .copy-msg-btn:hover {
      color: var(--text);
      background: var(--border-glow);
    }

    /* ── LIKE BUTTON ── */
    .like-btn.liked {
      color: var(--green) !important;
      background: color-mix(in srgb, var(--green) 12%, transparent) !important;
    }

    .like-btn.liked .like-icon {
      animation: likePopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    /* ── DISLIKE BUTTON ── */
    .dislike-btn.disliked {
      color: var(--pink) !important;
      background: color-mix(in srgb, var(--pink) 12%, transparent) !important;
    }

    .dislike-btn.disliked .dislike-icon {
      animation: dislikeShake 0.4s ease;
    }

    @keyframes likePopIn {
      0% {
        transform: scale(0.5) rotate(-20deg);
      }

      60% {
        transform: scale(1.35) rotate(10deg);
      }

      100% {
        transform: scale(1) rotate(0deg);
      }
    }

    @keyframes dislikeShake {

      0%,
      100% {
        transform: translateX(0);
      }

      20% {
        transform: translateX(-3px) rotate(-8deg);
      }

      40% {
        transform: translateX(3px) rotate(8deg);
      }

      60% {
        transform: translateX(-2px) rotate(-4deg);
      }

      80% {
        transform: translateX(2px) rotate(4deg);
      }
    }

    /* ── RETRY BUTTON ── */
    .retry-btn:hover .retry-icon {
      animation: retrySpin 0.5s ease;
    }

    @keyframes retrySpin {
      from {
        transform: rotate(0deg);
      }

      to {
        transform: rotate(360deg);
      }
    }

    .retry-btn.spinning .retry-icon {
      animation: retrySpin 0.6s linear infinite;
    }

    /* ── EDIT BUTTON ── */
    .edit-btn:hover .edit-icon {
      animation: editWiggle 0.35s ease;
    }

    @keyframes editWiggle {

      0%,
      100% {
        transform: rotate(0deg);
      }

      30% {
        transform: rotate(-12deg);
      }

      70% {
        transform: rotate(8deg);
      }
    }

    /* ── INLINE EDIT AREA (shown when editing user bubble) ── */
    .bubble-edit-wrap {
      display: flex;
      flex-direction: column;
      gap: 8px;
      width: 100%;
    }

    .bubble-edit-textarea {
      width: 100%;
      min-height: 60px;
      background: color-mix(in srgb, var(--purple) 8%, transparent);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 10px 14px;
      color: var(--text);
      font-family: var(--font-main);
      font-size: 14px;
      line-height: 1.6;
      resize: vertical;
      outline: none;
      transition: border-color 0.2s;
    }

    .bubble-edit-textarea:focus {
      border-color: var(--purple-lt);
    }

    .bubble-edit-actions {
      display: flex;
      gap: 8px;
      justify-content: flex-end;
    }

    .bubble-edit-save {
      background: var(--purple);
      border: none;
      color: var(--white);
      font-family: var(--font-main);
      font-size: 12px;
      font-weight: 600;
      padding: 5px 14px;
      border-radius: 8px;
      cursor: pointer;
      transition: background 0.15s, transform 0.1s;
    }

    .bubble-edit-save:hover {
      background: var(--purple-lt);
      color: var(--black);
    }

    .bubble-edit-save:active {
      transform: scale(0.95);
    }

    .bubble-edit-cancel {
      background: none;
      border: 1px solid var(--border);
      color: var(--text-muted);
      font-family: var(--font-main);
      font-size: 12px;
      padding: 5px 14px;
      border-radius: 8px;
      cursor: pointer;
      transition: 0.15s;
    }

    .bubble-edit-cancel:hover {
      color: var(--text);
      border-color: var(--purple);
    }

    /* ── BUBBLE FADE OUT (for delete animations) ── */
    .bubble-removing {
      animation: bubbleFadeOut 0.35s ease forwards !important;
    }

    @keyframes bubbleFadeOut {
      from {
        opacity: 1;
        transform: translateY(0) scale(1);
      }

      to {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
      }
    }

    #gallery-section {
      position: fixed;
      top: 0;
      left: var(--sidebar-w);
      /* sit next to sidebar on desktop */
      width: calc(100% - var(--sidebar-w));
      height: 100dvh;
      background: var(--bg-deep);
      display: none;
      flex-direction: column;
      z-index: 100;
      /* below sidebar (z-index ~200) so sidebar stays on top */
      overflow: hidden;
    }

    /* on mobile sidebar is an overlay, gallery takes full width */
    @media(max-width:768px) {
      #gallery-section {
        left: 0;
        width: 100%;
        z-index: 200;
      }
    }

    .gallery-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 14px 20px;
      border-bottom: 1px solid var(--border);
      flex-wrap: wrap;
      gap: 8px;
      flex-shrink: 0;
      background: var(--bg-deep);
    }

    .gallery-title {
      font-weight: 600;
      font-size: 16px;
    }

    #gallery-section .privacy-box {
      margin: 10px 16px 0;
      padding: 10px 12px;
      border-radius: 10px;
      display: flex;
      gap: 10px;
      font-size: 12px;
      flex-shrink: 0;
    }

    .gallery-grid {
      flex: 1;
      overflow-y: auto;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
      padding: 14px 16px;
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
      gap: 12px;
      align-content: start;
      /* prevents items stretching to fill empty space */
    }

    @media(max-width:600px) {
      .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 10px 10px;
      }

      .gallery-header {
        padding: 10px 12px;
      }

      #gallery-section .privacy-box {
        margin: 8px 10px 0;
        font-size: 11px;
      }
    }

    .gallery-item img {
      width: 100%;
      aspect-ratio: 1;
      /* square thumbnails, no fixed px height */
      object-fit: cover;
      border-radius: 10px;
      display: block;
    }


    /* ── Info Cards ─────────────────────────────────────────────────────────────── */
    .eg-cards-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin: 12px 0;
    }

    .eg-cards-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin: 12px 0;
    }

    .eg-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 14px 14px 14px 16px;
      border-left-width: 3px;
      display: flex;
      gap: 12px;
      align-items: flex-start;
      transition: transform 0.15s, box-shadow 0.15s;
    }

    .eg-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    }

    .eg-card-icon {
      font-size: 20px;
      width: 36px;
      height: 36px;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .eg-card-title {
      font-weight: 600;
      font-size: 14px;
      color: var(--text);
      margin-bottom: 4px;
      line-height: 1.2;
    }

    .eg-card-body {
      font-size: 13px;
      color: var(--text-dim);
      line-height: 1.5;
    }

    /* ── Choice Buttons ─────────────────────────────────────────────────────────── */
    .eg-choice-wrap {
      margin: 14px 0 4px;
    }

    .eg-choice-prompt {
      font-size: 13px;
      color: var(--text-muted);
      margin-bottom: 8px;
      font-weight: 500;
    }

    .eg-choice-strip {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .eg-choice-btn {
      font-family: var(--font-main);
      font-size: 13px;
      font-weight: 500;
      padding: 8px 16px;
      border-radius: 10px;
      cursor: pointer;
      transition: all 0.15s;
      border: 1.5px solid transparent;
      line-height: 1.2;
    }

    .eg-choice-btn.primary {
      background: linear-gradient(135deg, var(--purple), var(--purple-dk));
      color: var(--white);
      border-color: transparent;
    }

    .eg-choice-btn.primary:hover {
      opacity: 0.88;
      transform: translateY(-1px);
    }

    .eg-choice-btn.secondary {
      background: transparent;
      color: var(--cyan);
      border-color: var(--cyan);
    }

    .eg-choice-btn.secondary:hover {
      background: var(--cyan)18;
      transform: translateY(-1px);
    }

    .eg-choice-btn.outline {
      background: transparent;
      color: var(--text-dim);
      border-color: var(--border);
    }

    .eg-choice-btn.outline:hover {
      border-color: var(--purple);
      color: var(--purple-lt);
      transform: translateY(-1px);
    }

    .eg-choice-btn:active {
      transform: scale(0.97) !important;
    }

    .eg-choice-btn.used {
      opacity: 0.4;
      cursor: default;
      pointer-events: none;
    }

    /* ── Expandable Sections ─────────────────────────────────────────────────────── */
    .eg-expand-wrap {
      margin: 12px 0;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .eg-expand-item {
      border: 1px solid var(--border);
      border-radius: 10px;
      overflow: hidden;
      background: var(--bg-card);
      transition: border-color 0.2s;
    }

    .eg-expand-item:hover {
      border-color: var(--purple)66;
    }

    .eg-expand-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 16px;
      cursor: pointer;
      user-select: none;
    }

    .eg-expand-title {
      font-size: 14px;
      font-weight: 600;
      color: var(--text);
    }

    .eg-expand-preview {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 2px;
    }

    .eg-expand-chevron {
      color: var(--text-muted);
      font-size: 16px;
      transition: transform 0.25s;
      flex-shrink: 0;
    }

    .eg-expand-item.open .eg-expand-chevron {
      transform: rotate(180deg);
    }

    .eg-expand-body {
      padding: 0 16px;
      max-height: 0;
      overflow: hidden;
      transition: max-height 0.35s ease, padding 0.2s;
      font-size: 13px;
      color: var(--text-dim);
      line-height: 1.65;
    }

    .eg-expand-body.open {
      padding: 0 16px 14px;
      max-height: 800px;
    }

    /* ── SVG Science Diagram ─────────────────────────────────────────────────────── */
    .eg-svg-wrap {
      background: var(--bg-surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      overflow: hidden;
      margin: 12px 0;
      position: relative;
    }

    .eg-svg-title {
      font-size: 13px;
      font-weight: 600;
      color: var(--text-muted);
      padding: 10px 14px 6px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .eg-svg-inner {
      display: flex;
      justify-content: center;
      padding: 12px;
      overflow-x: auto;
    }

    .eg-svg-inner svg {
      max-width: 100%;
    }

    /* ── Coordinate Plane ────────────────────────────────────────────────────────── */
    .eg-coord-wrap {
      background: var(--bg-surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      overflow: hidden;
      margin: 12px 0;
    }

    .eg-coord-title {
      font-size: 13px;
      font-weight: 600;
      color: var(--text-muted);
      padding: 10px 14px 6px;
      border-bottom: 1px solid var(--border);
    }

    .eg-coord-inner {
      display: flex;
      justify-content: center;
      padding: 12px;
      overflow-x: auto;
    }

    /* ── Enhanced Graph Container ────────────────────────────────────────────────── */
    .eg-graph-wrap {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 14px;
      margin: 12px 0;
    }

    .eg-graph-title {
      font-size: 14px;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 10px;
    }

    .eg-graph-legend {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin-bottom: 12px;
    }

    .eg-graph-legend-chip {
      display: flex;
      align-items: center;
      gap: 5px;
      font-size: 12px;
      color: var(--text-dim);
    }

    .eg-graph-legend-dot {
      width: 10px;
      height: 10px;
      border-radius: 2px;
      flex-shrink: 0;
    }

    .eg-graph-canvas-wrap {
      position: relative;
      width: 100%;
    }

    /* ── Enhanced Flashcards ─────────────────────────────────────────────────────── */

    .eg-flash-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 12px;
    }

    .eg-flash-topic {
      font-size: 13px;
      font-weight: 600;
      color: var(--purple-lt);
    }

    .eg-flash-progress {
      font-size: 12px;
      color: var(--text-muted);
      background: var(--bg-card);
      border: 1px solid var(--border);
      padding: 3px 10px;
      border-radius: 20px;
    }

    .eg-flash-wrap {
      width: 100%;

      margin: 0 auto;
      overflow: hidden;
    }

    .eg-flash-wrap {
      width: 100vw;
      max-width: 700px;
      margin-left: -20px;
      /* adjust based on padding */
    }

    .eg-flash-nav {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 16px;
      margin-top: 12px;
    }

    .eg-flash-nav-btn {
      font-family: var(--font-main);
      font-size: 13px;
      font-weight: 500;
      padding: 7px 18px;
      border-radius: 8px;
      cursor: pointer;
      border: 1px solid var(--border);
      background: var(--bg-card);
      color: var(--text-dim);
      transition: all 0.15s;
    }

    .eg-flash-nav-btn:hover {
      border-color: var(--purple);
      color: var(--purple-lt);
    }

    .eg-flash-nav-btn:disabled {
      opacity: 0.35;
      cursor: default;
      pointer-events: none;
    }

    .eg-flash-counter {
      font-size: 13px;
      color: var(--text-muted);
      min-width: 50px;
      text-align: center;
    }

    .eg-flash-hint-btn {
      font-family: var(--font-main);
      font-size: 12px;
      padding: 4px 12px;
      border-radius: 6px;
      cursor: pointer;
      border: 1px solid var(--yellow)55;
      background: transparent;
      color: var(--yellow);
      transition: all 0.15s;
      margin-top: 8px;
    }

    .eg-flash-hint-btn:hover {
      background: var(--yellow)18;
    }

    .eg-flash-hint-text {
      font-size: 12px;
      color: var(--yellow);
      margin-top: 6px;
      padding: 6px 10px;
      background: var(--yellow)0f;
      border-radius: 6px;
      border-left: 2px solid var(--yellow)66;
      display: none;
    }

    .eg-flash-hint-text.show {
      display: block;
    }

    /* ── Enhanced Diagram Hover Tooltip ─────────────────────────────────────────── */
    .sd-node {
      cursor: pointer;
      transition: filter 0.15s;
    }

    .sd-node:hover {
      filter: brightness(1.2);
    }

    .sd-tooltip {
      position: absolute;
      background: var(--bg-surface);
      border: 1px solid var(--purple)88;
      border-radius: 8px;
      padding: 8px 12px;
      font-size: 12px;
      color: var(--text);
      max-width: 220px;
      pointer-events: none;
      z-index: 999;
      box-shadow: 0 4px 20px color-mix(in srgb, var(--bg-deep) 60%, transparent);
      display: none;
      line-height: 1.4;
    }

    .sd-tooltip.visible {
      display: block;
    }

    /* ── Box section upgrades ────────────────────────────────────────────────────── */
    .box.warning {
      background: rgba(239, 68, 68, 0.08);
      border-left: 3px solid var(--pink);
      border-radius: 8px;
      padding: 12px 16px;
      margin: 8px 0;
      color: var(--text);
    }

    /* ═══════════════════════════════════════════════════
   EDLIX AI — DASHBOARD VISUAL SYSTEM v4
   Paste this entire block inside your <style> tag
   ═══════════════════════════════════════════════════ */

    /* ── Stat Row (metric cards strip) ──────────────────── */
    .edx-stat-row {
      display: grid;
      gap: 10px;
      margin: 12px 0 6px;
    }

    .edx-stat-row.cols-2 {
      grid-template-columns: repeat(2, 1fr);
    }

    .edx-stat-row.cols-3 {
      grid-template-columns: repeat(3, 1fr);
    }

    .edx-stat-row.cols-4 {
      grid-template-columns: repeat(4, 1fr);
    }

    .edx-stat-card {
      background: var(--bg-surface-2);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 14px 16px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      position: relative;
      overflow: hidden;
      transition: border-color 0.2s, transform 0.15s;
    }

    .edx-stat-card::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 2px;
      background: var(--edx-accent, var(--purple));
      opacity: 0.7;
    }

    .edx-stat-card:hover {
      border-color: var(--edx-accent, var(--purple));
      transform: translateY(-2px);
    }

    .edx-stat-label {
      font-size: 11px;
      font-weight: 600;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.6px;
    }

    .edx-stat-value {
      font-size: 28px;
      font-weight: 700;
      line-height: 1.1;
      color: var(--edx-accent, var(--text));
    }

    .edx-stat-sub {
      font-size: 11px;
      color: var(--text-muted);
      margin-top: 2px;
    }

    .edx-stat-icon {
      position: absolute;
      top: 12px;
      right: 14px;
      font-size: 22px;
      opacity: 0.18;
    }

    /* ── Dashboard Grid (2 or 3 column) ─────────────────── */
    .edx-dash-grid {
      display: grid;
      gap: 12px;
      margin: 12px 0;
    }

    .edx-dash-grid.cols-2 {
      grid-template-columns: 1fr 1fr;
    }

    .edx-dash-grid.cols-3 {
      grid-template-columns: 1fr 1fr 1fr;
    }

    .edx-dash-grid.cols-1-2 {
      grid-template-columns: 1fr 2fr;
    }

    .edx-dash-grid.cols-2-1 {
      grid-template-columns: 2fr 1fr;
    }

    .edx-dash-grid.cols-1-1-2 {
      grid-template-columns: 1fr 1fr 2fr;
    }

    /* ── Dashboard Panel (a card inside the grid) ───────── */
    .edx-panel {
      background: var(--bg-surface);
      border: 1px solid var(--border);
      border-radius: 14px;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    .edx-panel-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 11px 16px;
      border-bottom: 1px solid var(--border);
      background: var(--bg-surface-2);
      flex-shrink: 0;
    }

    .edx-panel-title {
      font-size: 12px;
      font-weight: 600;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .edx-panel-badge {
      font-size: 10px;
      padding: 2px 8px;
      border-radius: 99px;
      background: var(--purple)22;
      color: var(--purple-lt);
      font-weight: 600;
    }

    .edx-panel-body {
      padding: 14px 16px;
      flex: 1;
    }

    .edx-panel-body.no-pad {
      padding: 0;
    }

    /* Chart panel — canvas needs room */
    .edx-panel-body.chart-body {
      padding: 12px;
      position: relative;
    }

    /* ── Full-width section header ───────────────────────── */
    .edx-section-head {
      display: flex;
      align-items: center;
      gap: 10px;
      margin: 16px 0 8px;
      padding-bottom: 8px;
      border-bottom: 1px solid var(--border);
    }

    .edx-section-head-title {
      font-size: 15px;
      font-weight: 700;
      color: var(--text);
    }

    .edx-section-head-line {
      flex: 1;
      height: 1px;
      background: linear-gradient(to right, var(--border), transparent);
    }

    /* ── Info grid (concept cards) ───────────────────────── */
    .edx-info-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 8px;
      margin: 8px 0;
    }

    .edx-info-card {
      background: var(--bg-surface-2);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 12px 14px;
      border-left: 3px solid var(--edx-accent, var(--purple));
      transition: border-color 0.15s, transform 0.12s;
    }

    .edx-info-card:hover {
      border-color: var(--edx-accent, var(--purple));
      transform: translateY(-1px);
    }

    .edx-info-card-icon {
      font-size: 20px;
      margin-bottom: 6px;
      line-height: 1;
    }

    .edx-info-card-title {
      font-size: 13px;
      font-weight: 700;
      color: var(--text);
      margin-bottom: 4px;
    }

    .edx-info-card-body {
      font-size: 12px;
      color: var(--text-dim);
      line-height: 1.5;
    }

    /* ── Progress bar row ────────────────────────────────── */
    .edx-progress-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .edx-progress-item {}

    .edx-progress-label-row {
      display: flex;
      justify-content: space-between;
      margin-bottom: 4px;
      font-size: 12px;
    }

    .edx-progress-name {
      color: var(--text-dim);
    }

    .edx-progress-val {
      color: var(--text);
      font-weight: 600;
    }

    .edx-progress-track {
      height: 6px;
      background: var(--bg-skeleton);
      border-radius: 99px;
      overflow: hidden;
    }

    .edx-progress-fill {
      height: 100%;
      border-radius: 99px;
      transition: width 1s cubic-bezier(.4, 0, .2, 1);
      background: var(--edx-bar-color, var(--purple));
    }

    /* ── Choice chip strip ───────────────────────────────── */
    .edx-chip-strip {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin: 10px 0 4px;
    }

    .edx-chip-label {
      font-size: 12px;
      color: var(--text-muted);
      margin-bottom: 6px;
      font-weight: 500;
    }

    .edx-chip {
      font-family: var(--font-main);
      font-size: 13px;
      font-weight: 500;
      padding: 7px 15px;
      border-radius: 99px;
      cursor: pointer;
      border: 1.5px solid var(--border);
      background: var(--bg-surface-2);
      color: var(--text-dim);
      transition: all 0.15s;
      white-space: nowrap;
    }

    .edx-chip:hover {
      border-color: var(--purple);
      color: var(--purple-lt);
      background: var(--purple)11;
      transform: translateY(-1px);
    }

    .edx-chip.primary {
      background: linear-gradient(135deg, var(--purple), var(--purple-dk));
      border-color: transparent;
      color: var(--white);
    }

    .edx-chip.primary:hover {
      opacity: 0.88;
      transform: translateY(-1px);
    }

    .edx-chip.cyan {
      border-color: var(--cyan)66;
      color: var(--cyan);
      background: var(--cyan)0d;
    }

    .edx-chip.cyan:hover {
      background: var(--cyan)1a;
      border-color: var(--cyan);
    }

    .edx-chip.used {
      opacity: 0.35;
      pointer-events: none;
    }

    /* ── Expandable accordion ────────────────────────────── */
    .edx-accordion {
      display: flex;
      flex-direction: column;
      gap: 6px;
      margin: 10px 0;
    }

    .edx-acc-item {
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--bg-surface);
      overflow: hidden;
      transition: border-color 0.2s;
    }

    .edx-acc-item:hover {
      border-color: var(--purple)55;
    }

    .edx-acc-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 11px 16px;
      cursor: pointer;
      user-select: none;
      gap: 12px;
    }

    .edx-acc-title {
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
      flex: 1;
    }

    .edx-acc-preview {
      font-size: 11px;
      color: var(--text-muted);
      margin-top: 1px;
    }

    .edx-acc-chevron {
      color: var(--text-muted);
      font-size: 14px;
      transition: transform 0.25s;
      flex-shrink: 0;
    }

    .edx-acc-item.open .edx-acc-chevron {
      transform: rotate(180deg);
    }

    .edx-acc-body {
      max-height: 0;
      overflow: hidden;
      transition: max-height 0.35s ease, padding 0.2s;
      font-size: 13px;
      color: var(--text-dim);
      line-height: 1.65;
      padding: 0 16px;
    }

    .edx-acc-body.open {
      max-height: 1000px;
      padding: 0 16px 14px;
    }

    /* ══════════════════════════════════════════════════════
   SAHU WIDGET — sandboxed iframe widget container
══════════════════════════════════════════════════════ */
    .edx-canva-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 16px;
      overflow: hidden;
      margin: 16px 0;
      display: flex;
      flex-direction: column;
    }

    .edx-canva-header {
      padding: 12px 16px;
      background: rgba(0, 0, 0, 0.2);
      border-bottom: 1px solid var(--border);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .edx-canva-title {
      font-weight: 700;
      font-size: 14px;
      color: var(--text);
    }

    .edx-canva-lang {
      font-size: 10px;
      color: var(--text-dim);
      font-weight: 600;
      letter-spacing: 0.5px;
    }

    .edx-canva-code-preview {
      padding: 16px;
      background: #000;
      max-height: 120px;
      overflow: hidden;
      opacity: 0.8;
    }

    .edx-canva-code-preview pre {
      margin: 0;
      font-size: 12px;
      color: var(--cyan);
      font-family: var(--font-mono);
    }

    /* ── Edlix Canvas Side Panel ──────────────────────────── */
    .edx-canvas-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.6);
      backdrop-filter: blur(4px);
      z-index: 99998;
      opacity: 0;
      transition: opacity 0.3s ease;
      pointer-events: none;
    }
    .edx-canvas-overlay.open {
      opacity: 1;
      pointer-events: all;
    }
    .edx-canvas-panel {
      position: fixed;
      top: 0; right: 0;
      width: 55vw;
      max-width: 900px;
      height: 100vh;
      background: var(--bg-deep);
      border-left: 1px solid var(--border);
      z-index: 99999;
      display: flex;
      flex-direction: column;
      transform: translateX(100%);
      transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
      box-shadow: -8px 0 40px rgba(0,0,0,0.5);
    }
    .edx-canvas-panel.open { transform: translateX(0); }
    .edx-canvas-topbar {
      padding: 10px 16px;
      border-bottom: 1px solid var(--border);
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: var(--bg-card);
      flex-shrink: 0;
    }
    .edx-canvas-topbar-left { display:flex; align-items:center; gap:10px; }
    .edx-canvas-topbar-title { font-weight:700; font-size:14px; color:var(--text); }
    .edx-canvas-topbar-lang {
      font-size:10px; font-weight:700; letter-spacing:1px; color:var(--cyan);
      background:rgba(34,211,238,0.1); border:1px solid rgba(34,211,238,0.2);
      padding:2px 8px; border-radius:99px;
    }
    .edx-canvas-topbar-actions { display:flex; gap:8px; align-items:center; }
    .edx-canvas-btn {
      background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.1);
      color:var(--text-dim); border-radius:8px; padding:6px 12px;
      font-size:12px; font-weight:600; cursor:pointer;
      font-family:var(--font-main); transition:all 0.15s;
      display:flex; align-items:center; gap:5px;
    }
    .edx-canvas-btn:hover { background:rgba(255,255,255,0.1); color:var(--text); }
    .edx-canvas-btn.primary { background:var(--purple); border-color:var(--purple); color:white; }
    .edx-canvas-btn.primary:hover { opacity:0.85; }
    .edx-canvas-btn.run {
      background:rgba(74,222,128,0.15); border-color:rgba(74,222,128,0.3); color:var(--green);
    }
    .edx-canvas-btn.run:hover { background:rgba(74,222,128,0.25); }
    .edx-canvas-close {
      background:none; border:none; color:var(--text-muted);
      cursor:pointer; font-size:20px; padding:4px; line-height:1; transition:color 0.15s;
    }
    .edx-canvas-close:hover { color:var(--pink); }
    .edx-canvas-tabs {
      display:flex; border-bottom:1px solid var(--border);
      background:rgba(0,0,0,0.2); flex-shrink:0;
    }
    .edx-canvas-tab {
      padding:8px 18px; font-size:12px; font-weight:600; color:var(--text-muted);
      cursor:pointer; border-bottom:2px solid transparent; transition:all 0.15s;
      font-family:var(--font-main); background:none;
      border-top:none; border-left:none; border-right:none;
    }
    .edx-canvas-tab.active { color:var(--purple-lt); border-bottom-color:var(--purple); background:rgba(124,58,237,0.06); }
    .edx-canvas-tab:hover:not(.active) { color:var(--text-dim); background:rgba(255,255,255,0.03); }
    .edx-canvas-body { flex:1; display:flex; min-height:0; overflow:hidden; }
    .edx-canvas-editor-pane {
      flex:1; display:flex; flex-direction:column; min-width:0;
      border-right:1px solid var(--border);
    }
    .edx-canvas-editor-label {
      padding:6px 14px; font-size:10px; font-weight:700; letter-spacing:0.8px;
      color:var(--text-muted); background:rgba(0,0,0,0.3);
      border-bottom:1px solid var(--border); text-transform:uppercase; flex-shrink:0;
    }
    .edx-canvas-textarea {
      flex:1; width:100%; border:none; background:#0d0d14;
      color:var(--cyan); font-family:var(--font-mono);
      padding:16px; font-size:13px; resize:none; outline:none;
      line-height:1.6; tab-size:2;
    }
    .edx-canvas-textarea::selection { background:var(--purple)44; }
    .edx-canvas-preview-pane { flex:1; display:flex; flex-direction:column; min-width:0; }
    .edx-canvas-preview-label {
      padding:6px 14px; font-size:10px; font-weight:700; letter-spacing:0.8px;
      color:var(--text-muted); background:rgba(0,0,0,0.3);
      border-bottom:1px solid var(--border); text-transform:uppercase;
      display:flex; justify-content:space-between; align-items:center; flex-shrink:0;
    }
    .edx-canvas-iframe { flex:1; width:100%; border:none; background:white; }
    .edx-canvas-nopreview {
      flex:1; display:flex; align-items:center; justify-content:center;
      color:var(--text-muted); font-size:13px; background:#0d0d14;
    }
    @media (max-width:768px) {
      .edx-canvas-panel { width:100vw; max-width:100vw; }
      .edx-canvas-body { flex-direction:column; }
      .edx-canvas-editor-pane { border-right:none; border-bottom:1px solid var(--border); flex:none; height:50%; }
      .edx-canvas-preview-pane { flex:none; height:50%; }
      .edx-canvas-topbar-actions { gap:4px; }
      .edx-canvas-btn { padding:5px 8px; font-size:11px; }
    }

    .edx-widget-wrap {
      border: 1px solid var(--border);
      border-radius: var(--radius);
      background: var(--bg-card);
      margin: 12px 0;
      overflow: hidden;
      box-shadow: 0 4px 24px var(--purple)18;
      transition: box-shadow 0.2s;
    }

    .edx-widget-wrap:hover {
      box-shadow: 0 6px 32px var(--purple)30;
    }

    .edx-widget-header {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 14px;
      background: var(--bg-deep);
      border-bottom: 1px solid var(--border);
      user-select: none;
    }

    .edx-widget-icon {
      font-size: 15px;
      flex-shrink: 0;
    }

    .edx-widget-title {
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
      flex: 1;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .edx-widget-badge {
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 1.2px;
      color: var(--purple-lt);
      background: var(--purple)22;
      border: 1px solid var(--purple)44;
      border-radius: 99px;
      padding: 2px 8px;
      flex-shrink: 0;
    }

    .edx-widget-fullscreen {
      background: none;
      border: 1px solid var(--border);
      color: var(--text-muted);
      border-radius: 6px;
      width: 26px;
      height: 26px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 13px;
      cursor: pointer;
      transition: all 0.15s;
      flex-shrink: 0;
      padding: 0;
    }

    .edx-widget-fullscreen:hover {
      border-color: var(--purple);
      color: var(--purple-lt);
      background: var(--purple)11;
    }

    .edx-widget-body {
      position: relative;
      width: 100%;
      overflow: hidden;
    }

    .edx-widget-iframe {
      display: block;
      width: 100%;
      height: 100%;
      border: none;
      background: var(--bg-deep);
    }

    /* ══════════════════════════════════════════════════════
   EDX TOOLTIP — hover keyword → explanation popup
══════════════════════════════════════════════════════ */
    .edx-tip {
      border-bottom: 1px dashed var(--purple)88;
      color: var(--purple-lt);
      cursor: help;
      position: relative;
      display: inline;
    }

    .edx-tip::after {
      content: attr(data-tip);
      position: absolute;
      bottom: calc(100% + 8px);
      left: 50%;
      transform: translateX(-50%) scale(0.92);
      background: var(--bg-wiki);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 9px 13px;
      font-size: 12px;
      font-weight: 400;
      color: var(--text-dim);
      line-height: 1.5;
      width: max-content;
      max-width: 260px;
      white-space: normal;
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.18s ease, transform 0.18s ease;
      z-index: 9000;
      box-shadow: 0 8px 32px color-mix(in srgb, var(--bg-deep) 53%, transparent);
      font-family: var(--font-main);
    }

    .edx-tip:hover::after {
      opacity: 1;
      transform: translateX(-50%) scale(1);
    }

    /* ══════════════════════════════════════════════════════
   EDX WIKI LINK — click word → Wikipedia side panel
══════════════════════════════════════════════════════ */
    .edx-wiki {
      border-bottom: 1px solid var(--cyan)66;
      color: var(--cyan);
      cursor: pointer;
      transition: color 0.15s;
      display: inline;
    }

    .edx-wiki:hover {
      color: var(--white);
      border-bottom-color: var(--cyan);
    }

    /* Wiki side panel */
    #edx-wiki-panel {
      position: fixed;
      top: 0;
      right: -420px;
      width: 400px;
      height: 100vh;
      background: var(--bg-surface);
      border-left: 1px solid var(--border);
      z-index: 8000;
      display: flex;
      flex-direction: column;
      transition: right 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
      box-shadow: -8px 0 40px color-mix(in srgb, var(--bg-deep) 53%, transparent);
      font-family: var(--font-main);
    }

    #edx-wiki-panel.open {
      right: 0;
    }

    .edx-wiki-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 16px 20px;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }

    .edx-wiki-title {
      font-size: 15px;
      font-weight: 700;
      color: var(--text);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .edx-wiki-close {
      background: none;
      border: 1px solid var(--border);
      color: var(--text-muted);
      border-radius: 8px;
      width: 28px;
      height: 28px;
      cursor: pointer;
      font-size: 14px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.15s;
    }

    .edx-wiki-close:hover {
      border-color: var(--pink);
      color: var(--pink);
    }

    .edx-wiki-body {
      flex: 1;
      overflow-y: auto;
      padding: 20px;
    }

    .edx-wiki-body::-webkit-scrollbar {
      width: 3px;
    }

    .edx-wiki-body::-webkit-scrollbar-thumb {
      background: var(--border);
      border-radius: 99px;
    }

    .edx-wiki-image {
      width: 100%;
      max-height: 200px;
      object-fit: cover;
      border-radius: 10px;
      border: 1px solid var(--border);
      margin-bottom: 14px;
    }

    .edx-wiki-summary {
      font-size: 13px;
      color: var(--text-dim);
      line-height: 1.7;
      margin-bottom: 16px;
    }

    .edx-wiki-link {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      color: var(--cyan);
      font-size: 12px;
      font-weight: 600;
      text-decoration: none;
      border: 1px solid var(--cyan)44;
      border-radius: 8px;
      padding: 6px 12px;
      transition: all 0.15s;
    }

    .edx-wiki-link:hover {
      background: var(--cyan)11;
      border-color: var(--cyan);
    }

    .edx-wiki-loader {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 12px;
      padding: 40px 20px;
      color: var(--text-muted);
      font-size: 13px;
    }

    .edx-wiki-spinner {
      width: 32px;
      height: 32px;
      border: 2px solid var(--border);
      border-top-color: var(--cyan);
      border-radius: 50%;
      animation: wikiSpin 0.7s linear infinite;
    }

    @keyframes wikiSpin {
      to {
        transform: rotate(360deg);
      }
    }

    .edx-wiki-overlay {
      position: fixed;
      inset: 0;
      background: color-mix(in srgb, var(--bg-deep) 33%, transparent);
      z-index: 7999;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.3s;
    }

    .edx-wiki-overlay.open {
      opacity: 1;
      pointer-events: all;
    }

    /* ══════════════════════════════════════════════════════
   EDX IMAGE GRID — SahuAI queries → rendered image grid
══════════════════════════════════════════════════════ */
    .edx-image-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
      gap: 10px;
      margin: 12px 0;
    }

    .edx-image-grid.count-1 {
      grid-template-columns: 1fr;
      max-width: 360px;
    }

    .edx-image-grid.count-2 {
      grid-template-columns: 1fr 1fr;
    }

    .edx-image-grid.count-3 {
      grid-template-columns: repeat(3, 1fr);
    }

    .edx-img-item {
      position: relative;
      border-radius: 10px;
      overflow: hidden;
      border: 1px solid var(--border);
      background: var(--bg-card);
      aspect-ratio: 4/3;
      cursor: zoom-in;
      transition: transform 0.2s, box-shadow 0.2s;
    }

    .edx-img-item:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 24px color-mix(in srgb, var(--bg-deep) 40%, transparent);
    }

    .edx-img-item img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      transition: opacity 0.3s;
    }

    .edx-img-caption {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      background: linear-gradient(transparent, color-mix(in srgb, var(--bg-deep) 80%, transparent));
      padding: 20px 10px 8px;
      font-size: 10px;
      color: var(--text-dim);
      font-weight: 500;
    }

    .edx-img-skeleton {
      background: linear-gradient(90deg, var(--bg-card) 25%, var(--border) 50%, var(--bg-card) 75%);
      background-size: 200% 100%;
      animation: imgSkel 1.5s infinite linear;
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
    }

    .edx-img-skeleton::after {
      content: "🖼️";
      font-size: 20px;
      opacity: 0.3;
    }

    @keyframes imgSkel {
      0% {
        background-position: 200% 0
      }

      100% {
        background-position: -200% 0
      }
    }

    /* Lightbox */
    #edx-lightbox {
      position: fixed;
      inset: 0;
      background: color-mix(in srgb, var(--bg-deep) 93%, transparent);
      z-index: 9999;
      display: none;
      align-items: center;
      justify-content: center;
      cursor: zoom-out;
    }

    #edx-lightbox.open {
      display: flex;
    }

    #edx-lightbox img {
      max-width: 90vw;
      max-height: 90vh;
      border-radius: 10px;
      object-fit: contain;
    }

    /* ══════════════════════════════════════════════════════
   EDX FORMULA WIDGET — Desmos graph embed
══════════════════════════════════════════════════════ */
    .edx-formula-wrap {
      border: 1px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
      margin: 12px 0;
      background: var(--bg-card);
    }

    .edx-formula-header {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 14px;
      background: var(--bg-deep);
      border-bottom: 1px solid var(--border);
    }

    .edx-formula-icon {
      font-size: 14px;
    }

    .edx-formula-title {
      font-size: 12px;
      font-weight: 600;
      color: var(--text);
      flex: 1;
      font-family: var(--font-mono);
    }

    .edx-formula-badge {
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 1px;
      color: var(--purple-lt);
      background: var(--purple)22;
      border: 1px solid var(--purple)44;
      border-radius: 99px;
      padding: 2px 8px;
    }

    .edx-formula-body {
      position: relative;
    }

    .edx-formula-body iframe {
      display: block;
      width: 100%;
      border: none;
    }

    /* ── Comparison table (styled) ───────────────────────── */
    .edx-compare-table {
      width: 100%;
      border-collapse: collapse;
      margin: 8px 0;
      font-size: 13px;
    }

    .edx-compare-table th {
      background: var(--purple)22;
      color: var(--purple-lt);
      padding: 9px 12px;
      text-align: left;
      font-weight: 700;
      border-bottom: 2px solid var(--purple)44;
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: 0.4px;
    }

    .edx-compare-table td {
      padding: 9px 12px;
      border-bottom: 1px solid var(--border);
      color: var(--text-dim);
      vertical-align: top;
    }

    .edx-compare-table tr:last-child td {
      border-bottom: none;
    }

    .edx-compare-table tr:hover td {
      background: color-mix(in srgb, var(--white) 2%, transparent);
    }

    .edx-compare-table td.highlight {
      color: var(--cyan);
      font-weight: 600;
    }

    /* ── Responsive collapse on mobile ──────────────────── */
    @media (max-width: 520px) {

      .edx-dash-grid.cols-2,
      .edx-dash-grid.cols-3,
      .edx-dash-grid.cols-1-2,
      .edx-dash-grid.cols-2-1,
      .edx-dash-grid.cols-1-1-2 {
        grid-template-columns: 1fr;
      }

      .edx-stat-row.cols-3,
      .edx-stat-row.cols-4 {
        grid-template-columns: repeat(2, 1fr);
      }

      .edx-info-grid {
        grid-template-columns: 1fr;
      }
    }

    /* ── Span helpers (for grid items to span cols) ───────── */
    .edx-span-2 {
      grid-column: span 2;
    }

    .edx-span-3 {
      grid-column: span 3;
    }

    .edx-span-full {
      grid-column: 1 / -1;
    }


    @keyframes mmSpin {
      to {
        transform: rotate(360deg);
      }
    }

    @keyframes mmFadeIn {
      from {
        opacity: 0;
        transform: translateY(12px);
      }

      to {
        opacity: 1;
        transform: none;
      }
    }

    @keyframes mmNodePop {
      0% {
        transform: scale(0.85);
        opacity: 0
      }

      60% {
        transform: scale(1.05)
      }

      100% {
        transform: scale(1);
        opacity: 1
      }
    }

    @keyframes mmPulse {

      0%,
      100% {
        opacity: 0.6
      }

      50% {
        opacity: 1
      }
    }

    /* Mind map page wrapper */
    .mm-page {
      background: var(--bg-deep);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
      animation: mmFadeIn 0.5s ease;
    }

    /* Topic header */
    .mm-header {
      padding: 18px 24px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
    }

    .mm-header-title {
      font-size: 20px;
      font-weight: 700;
      color: var(--text);
    }

    .mm-subject-badge {
      font-size: 11px;
      padding: 4px 10px;
      border-radius: 999px;
      font-weight: 600;
      letter-spacing: 0.5px;
      text-transform: uppercase;
    }

    /* Cytoscape container */
    #mm-cy {
      width: 100%;
      height: 520px;
      background: radial-gradient(ellipse at center, var(--bg-mm-center) 0%, var(--black) 70%);
      position: relative;
      touch-action: none;
    }

    #mm-canvas-wrap {
      width: 100%;
      overflow: hidden;
    }

    /* Node card panels (below the graph) */
    .mm-panels {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      padding: 16px;
    }

    /* Individual panel - flex-basis 280px, wraps automatically */
    .mm-panel {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 12px;
      overflow: hidden;
      animation: mmNodePop 0.4s ease both;
      flex: 1 1 280px;
      min-width: 0;
      max-width: 100%;
    }

    .mm-panel-header {
      padding: 10px 14px;
      display: flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      user-select: none;
      transition: background 0.2s;
    }

    .mm-panel-header:hover {
      background: var(--bg-deep);
    }

    .mm-panel-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      flex-shrink: 0;
    }

    .mm-panel-label {
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
      flex: 1;
    }

    .mm-panel-chevron {
      font-size: 11px;
      color: var(--text-muted);
      transition: transform 0.3s ease;
      flex-shrink: 0;
    }

    /* Collapse / Expand - max-height animation */
    .mm-panel-wrapper {
      max-height: 0;
      overflow: hidden;
      transition: max-height 0.32s ease, opacity 0.25s ease;
      opacity: 0;
    }

    .mm-panel-wrapper.open {
      max-height: 600px;
      opacity: 1;
    }

    .mm-panel-body {
      padding: 12px 14px;
      border-top: 1px solid var(--border)55;
    }

    /* Bullet list visual */
    .mm-bullets {
      display: flex;
      flex-direction: column;
      gap: 5px;
    }

    .mm-bullet {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      font-size: 13px;
      color: var(--text-dim);
      line-height: 1.5;
    }

    .mm-bullet::before {
      content: "•";
      color: var(--purple-lt);
      flex-shrink: 0;
      margin-top: 1px;
    }

    /* Timeline visual */
    .mm-timeline {
      display: flex;
      flex-direction: column;
      gap: 0;
    }

    .mm-tl-item {
      display: flex;
      gap: 12px;
      align-items: flex-start;
      padding: 6px 0;
      border-left: 2px solid var(--border);
      padding-left: 14px;
      position: relative;
      font-size: 13px;
      color: var(--text-dim);
    }

    .mm-tl-item::before {
      content: "";
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--purple);
      position: absolute;
      left: -5px;
      top: 10px;
      flex-shrink: 0;
    }

    .mm-tl-date {
      font-size: 11px;
      font-weight: 700;
      color: var(--yellow);
      white-space: nowrap;
      min-width: 60px;
    }

    /* Comparison table */
    .mm-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 12px;
    }

    .mm-table th {
      background: var(--purple)22;
      color: var(--purple-lt);
      padding: 7px 10px;
      text-align: left;
      font-weight: 600;
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.3px;
    }

    .mm-table td {
      padding: 6px 10px;
      color: var(--text-dim);
      border-top: 1px solid var(--border)33;
    }

    .mm-table tr:nth-child(even) td {
      background: var(--bg-deep)88;
    }

    /* Formula box */
    .mm-formula {
      background: var(--bg-deep);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 12px 16px;
      font-family: var(--font-mono);
      font-size: 15px;
      color: var(--yellow);
      text-align: center;
      letter-spacing: 0.5px;
    }

    .mm-formula-label {
      font-size: 11px;
      color: var(--text-muted);
      text-align: center;
      margin-top: 6px;
      font-family: var(--font-main);
    }

    /* Stat chips */
    .mm-stat-chips {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .mm-stat-chip {
      padding: 5px 10px;
      border-radius: 8px;
      background: var(--bg-deep);
      border: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    .mm-stat-val {
      font-size: 15px;
      font-weight: 700;
      color: var(--cyan);
    }

    .mm-stat-lbl {
      font-size: 10px;
      color: var(--text-muted);
    }

    /* SVG placeholder icons */
    .mm-svg-wrap {
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 12px 0;
    }

    /* Zoom controls */
    .mm-zoom-controls {
      position: absolute;
      bottom: 12px;
      right: 12px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      z-index: 10;
    }

    .mm-zoom-btn {
      width: 32px;
      height: 32px;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text);
      font-size: 16px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background 0.2s;
    }

    .mm-zoom-btn:hover {
      background: var(--purple)22;
    }

    /* Subject badge colors */
    .mm-badge-bio {
      background: color-mix(in srgb, var(--green) 27%, transparent);
      color: var(--green);
      border: 1px solid color-mix(in srgb, var(--green) 20%, transparent);
    }

    .mm-badge-phy {
      background: color-mix(in srgb, var(--blue-glass) 27%, transparent);
      color: var(--blue-light);
      border: 1px solid color-mix(in srgb, var(--blue-light) 20%, transparent);
    }

    .mm-badge-chem {
      background: color-mix(in srgb, var(--orange) 27%, transparent);
      color: var(--orange);
      border: 1px solid color-mix(in srgb, var(--orange) 20%, transparent);
    }

    .mm-badge-history {
      background: color-mix(in srgb, var(--yellow) 27%, transparent);
      color: var(--yellow);
      border: 1px solid color-mix(in srgb, var(--yellow) 20%, transparent);
    }

    .mm-badge-geo {
      background: color-mix(in srgb, var(--green) 27%, transparent);
      color: var(--emerald);
      border: 1px solid color-mix(in srgb, var(--emerald) 20%, transparent);
    }

    .mm-badge-eco {
      background: color-mix(in srgb, var(--purple) 27%, transparent);
      color: var(--purple-lt);
      border: 1px solid color-mix(in srgb, var(--purple-lt) 20%, transparent);
    }

    .mm-badge-math {
      background: color-mix(in srgb, var(--purple-dk) 27%, transparent);
      color: var(--purple-lt);
      border: 1px solid color-mix(in srgb, var(--purple-lt) 20%, transparent);
    }

    .mm-badge-lang {
      background: color-mix(in srgb, var(--pink) 27%, transparent);
      color: var(--pink);
      border: 1px solid color-mix(in srgb, var(--pink) 20%, transparent);
    }

    .mm-badge-gen {
      background: color-mix(in srgb, var(--bg-dark-card) 27%, transparent);
      color: var(--text-dim);
      border: 1px solid color-mix(in srgb, var(--text-dim) 20%, transparent);
    }

    @media (max-width: 700px) {
      #mm-cy {
        height: 60vh;
        min-height: 300px;
        max-height: 500px;
      }

      .mm-page {
        border-radius: 10px;
      }

      .mm-panels {
        padding: 10px;
        gap: 8px;
        flex-direction: column;
      }

      .mm-panel {
        flex: 1 1 100%;
        max-width: 100%;
      }

      .mm-header {
        padding: 12px 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
      }

      .mm-header-title {
        font-size: 16px;
        line-height: 1.3;
      }

      .mm-zoom-controls {
        bottom: 10px !important;
        right: 10px !important;
      }
    }

    @media (max-width: 480px) {
      #mm-cy {
        height: 50vh;
        min-height: 260px;
      }

      .mm-panel-label {
        font-size: 12px;
      }

      .mm-header {
        padding: 10px 12px;
      }

      .mm-header-title {
        font-size: 14px;
      }
    }

    /* ═══════════════════════════════ MISSION QUIZ ═══════════════════════════════ */
    #mission-quiz-overlay {
      position: fixed;
      inset: 0;
      z-index: 8000;
      background: var(--black);
      font-family: var(--font-main);
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    #mq-bg {
      position: absolute;
      inset: 0;
      background-size: cover;
      background-position: center;
      transition: opacity 1.2s ease;
      opacity: 0;
    }

    #mq-bg.loaded {
      opacity: 1;
    }

    #mq-bg-vignette {
      position: absolute;
      inset: 0;
      background: linear-gradient(to bottom, color-mix(in srgb, var(--bg-deep) 60%, transparent) 0%, rgba(0, 0, 0, .15) 40%, rgba(0, 0, 0, .55) 80%, rgba(0, 0, 0, .9) 100%);
      pointer-events: none;
    }

    #mq-header {
      position: relative;
      z-index: 10;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 20px;
      background: color-mix(in srgb, var(--bg-deep) 55%, transparent);
      backdrop-filter: blur(14px);
      border-bottom: 1px solid rgba(var(--cyan-raw, 34, 211, 238), .15);
      gap: 16px;
    }

    #mq-mission-tag {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 11px;
      font-weight: 800;
      letter-spacing: 2px;
      color: var(--cyan);
      text-transform: uppercase;
      white-space: nowrap;
    }

    #mq-header-center {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      min-width: 0;
    }

    #mq-progress-wrap {
      width: 100%;
      max-width: 340px;
      height: 4px;
      background: rgba(255, 255, 255, .1);
      border-radius: 99px;
      overflow: hidden;
    }

    #mq-progress-bar {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, var(--cyan), var(--purple-lt));
      border-radius: 99px;
      transition: width .6s ease;
      box-shadow: 0 0 8px color-mix(in srgb, var(--cyan) 53%, transparent);
    }

    #mq-qcount {
      font-size: 11px;
      color: color-mix(in srgb, var(--white) 45%, transparent);
      letter-spacing: 1px;
    }

    #mq-header-right {
      display: flex;
      align-items: center;
      gap: 12px;
      white-space: nowrap;
    }

    #mq-score-display {
      font-size: 13px;
      font-weight: 700;
      color: var(--yellow);
      letter-spacing: .5px;
    }

    #mq-exit-btn {
      background: color-mix(in srgb, var(--pink) 15%, transparent);
      border: 1px solid color-mix(in srgb, var(--pink) 40%, transparent);
      color: var(--pink);
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 1px;
      padding: 6px 12px;
      border-radius: 8px;
      cursor: pointer;
      font-family: var(--font-main);
      transition: background .2s;
    }

    #mq-exit-btn:hover {
      background: color-mix(in srgb, var(--pink) 30%, transparent);
    }

    /* Loader */
    #mq-loader {
      position: relative;
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 5;
    }

    #mq-loader-canvas {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
    }

    #mq-loader-content {
      position: relative;
      z-index: 2;
      text-align: center;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 18px;
      padding: 40px 24px;
      max-width: 480px;
      width: 100%;
    }

    #mq-loader-icon {
      font-size: 52px;
      animation: mqFloat 3s ease-in-out infinite;
    }

    @keyframes mqFloat {

      0%,
      100% {
        transform: translateY(0)
      }

      50% {
        transform: translateY(-10px)
      }
    }

    #mq-loader-title {
      font-size: 28px;
      font-weight: 900;
      letter-spacing: 4px;
      color: var(--white);
      text-shadow: 0 0 30px rgba(var(--cyan-raw, 34, 211, 238), .6);
    }

    #mq-loader-subtitle {
      font-size: 13px;
      color: rgba(var(--cyan-raw, 34, 211, 238), .8);
      letter-spacing: 2px;
      text-transform: uppercase;
      padding: 6px 18px;
      border: 1px solid rgba(var(--cyan-raw, 34, 211, 238), .3);
      border-radius: 20px;
      background: rgba(var(--cyan-raw, 34, 211, 238), .07);
    }

    #mq-loader-stages {
      display: flex;
      flex-direction: column;
      gap: 10px;
      width: 100%;
      max-width: 340px;
    }

    .mq-stage {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 16px;
      border-radius: 10px;
      background: rgba(255, 255, 255, .04);
      border: 1px solid rgba(255, 255, 255, .08);
      transition: all .4s;
    }

    .mq-stage.active {
      background: rgba(var(--cyan-raw, 34, 211, 238), .08);
      border-color: rgba(var(--cyan-raw, 34, 211, 238), .3);
      box-shadow: 0 0 16px rgba(var(--cyan-raw, 34, 211, 238), .1);
    }

    .mq-stage.done {
      background: color-mix(in srgb, var(--green) 7%, transparent);
      border-color: color-mix(in srgb, var(--green) 30%, transparent);
    }

    .mqs-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--neutral-dark);
      border: 2px solid var(--neutral-mid);
      flex-shrink: 0;
      transition: all .3s;
    }

    .mq-stage.active .mqs-dot {
      background: var(--cyan);
      border-color: var(--cyan);
      box-shadow: 0 0 8px var(--cyan);
      animation: mqPulse 1s infinite;
    }

    .mq-stage.done .mqs-dot {
      background: var(--green);
      border-color: var(--green);
      box-shadow: 0 0 6px var(--green);
      animation: none;
    }

    @keyframes mqPulse {

      0%,
      100% {
        opacity: 1
      }

      50% {
        opacity: .5
      }
    }

    .mqs-label {
      flex: 1;
      font-size: 13px;
      font-weight: 600;
      color: color-mix(in srgb, var(--white) 60%, transparent);
      letter-spacing: .5px;
    }

    .mq-stage.active .mqs-label {
      color: var(--white);
    }

    .mqs-status {
      font-size: 14px;
    }

    #mq-loader-bar-wrap {
      width: 100%;
      max-width: 340px;
      height: 3px;
      background: rgba(255, 255, 255, .08);
      border-radius: 99px;
      overflow: hidden;
    }

    #mq-loader-bar {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, var(--cyan), var(--purple-lt));
      border-radius: 99px;
      transition: width .8s ease;
      box-shadow: 0 0 8px color-mix(in srgb, var(--cyan) 33%, transparent);
    }

    #mq-loader-msg {
      font-size: 12px;
      color: color-mix(in srgb, var(--white) 35%, transparent);
      letter-spacing: 1px;
      min-height: 18px;
      font-style: italic;
    }

    /* Question screen */
    #mq-question-screen {
      flex: 1;
      position: relative;
      z-index: 5;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 20px;
      gap: 16px;
    }

    #mq-intro-bubble {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      max-width: 600px;
      width: 100%;
      background: color-mix(in srgb, var(--bg-deep) 65%, transparent);
      border: 1px solid rgba(var(--cyan-raw, 34, 211, 238), .25);
      border-radius: 14px;
      padding: 14px 18px;
      backdrop-filter: blur(8px);
      animation: mqSlideDown .4s ease;
    }

    @keyframes mqSlideDown {
      from {
        opacity: 0;
        transform: translateY(-10px)
      }

      to {
        opacity: 1;
        transform: none
      }
    }

    #mq-intro-icon {
      font-size: 20px;
      flex-shrink: 0;
      margin-top: 2px;
    }

    #mq-intro-text {
      font-size: 14px;
      color: rgba(var(--cyan-raw, 34, 211, 238), .9);
      font-style: italic;
      line-height: 1.5;
      letter-spacing: .3px;
    }

    #mq-card {
      max-width: 640px;
      width: 100%;
      animation: mqCardIn .5s cubic-bezier(.34, 1.56, .64, 1);
    }

    @keyframes mqCardIn {
      from {
        opacity: 0;
        transform: scale(.92) translateY(20px)
      }

      to {
        opacity: 1;
        transform: none
      }
    }

    #mq-card-inner {
      background: color-mix(in srgb, var(--face-bg) 88%, transparent);
      border: 1px solid rgba(255, 255, 255, .12);
      border-radius: 20px;
      padding: 28px;
      backdrop-filter: blur(20px);
      box-shadow: 0 8px 40px color-mix(in srgb, var(--bg-deep) 50%, transparent), 0 0 0 1px rgba(var(--cyan-raw, 34, 211, 238), .06) inset;
    }

    #mq-q-label {
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 2.5px;
      color: rgba(var(--cyan-raw, 34, 211, 238), .6);
      text-transform: uppercase;
      margin-bottom: 12px;
    }

    #mq-q-text {
      font-size: 18px;
      font-weight: 600;
      color: var(--text-bright);
      line-height: 1.5;
      margin-bottom: 22px;
    }

    #mq-options {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .mq-option {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 14px 18px;
      border-radius: 12px;
      background: rgba(255, 255, 255, .05);
      border: 1.5px solid rgba(255, 255, 255, .1);
      cursor: pointer;
      transition: all .18s;
      font-size: 14px;
      color: var(--text);
      text-align: left;
      font-family: var(--font-main);
      width: 100%;
    }

    .mq-option:hover:not(:disabled) {
      background: rgba(var(--cyan-raw, 34, 211, 238), .08);
      border-color: rgba(var(--cyan-raw, 34, 211, 238), .35);
      transform: translateX(4px);
    }

    .mq-opt-letter {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 26px;
      height: 26px;
      border-radius: 50%;
      background: color-mix(in srgb, var(--purple) 25%, transparent);
      color: var(--purple-lt);
      font-weight: 800;
      font-size: 12px;
      flex-shrink: 0;
    }

    .mq-option.correct {
      background: color-mix(in srgb, var(--green) 15%, transparent) !important;
      border-color: var(--green) !important;
      color: var(--green);
      transform: none !important;
    }

    .mq-option.correct .mq-opt-letter {
      background: color-mix(in srgb, var(--green) 30%, transparent);
      color: var(--green);
    }

    .mq-option.wrong {
      background: color-mix(in srgb, var(--pink) 12%, transparent) !important;
      border-color: var(--pink) !important;
      color: var(--pink);
      transform: none !important;
    }

    .mq-option.wrong .mq-opt-letter {
      background: color-mix(in srgb, var(--pink) 25%, transparent);
      color: var(--pink);
    }

    /* Feedback */
    #mq-feedback {
      position: fixed;
      inset: 0;
      z-index: 20;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 14px;
      padding: 40px 24px;
      text-align: center;
      animation: mqFeedIn .35s ease;
    }

    @keyframes mqFeedIn {
      from {
        opacity: 0
      }

      to {
        opacity: 1
      }
    }

    #mq-feedback.correct-bg {
      background: color-mix(in srgb, var(--green) 5%, var(--bg-deep));
    }

    #mq-feedback.wrong-bg {
      background: color-mix(in srgb, var(--pink) 5%, var(--bg-deep));
    }

    #mq-feedback-icon {
      font-size: 64px;
      animation: mqBounce .5s ease;
    }

    @keyframes mqBounce {
      0% {
        transform: scale(0)
      }

      60% {
        transform: scale(1.2)
      }

      100% {
        transform: scale(1)
      }
    }

    #mq-feedback-text {
      font-size: 26px;
      font-weight: 800;
      color: var(--white);
    }

    #mq-feedback-tts {
      font-size: 15px;
      color: color-mix(in srgb, var(--white) 70%, transparent);
      font-style: italic;
      max-width: 420px;
      line-height: 1.5;
      padding: 12px 20px;
      border-radius: 12px;
      background: rgba(255, 255, 255, .06);
      border: 1px solid rgba(255, 255, 255, .1);
    }

    #mq-next-btn {
      margin-top: 8px;
      padding: 14px 36px;
      border-radius: 12px;
      background: linear-gradient(135deg, var(--purple), rgba(var(--cyan-raw, 34, 211, 238), .25));
      border: 1px solid rgba(var(--cyan-raw, 34, 211, 238), .4);
      color: var(--white);
      font-size: 14px;
      font-weight: 700;
      letter-spacing: 1.5px;
      cursor: pointer;
      font-family: var(--font-main);
      transition: transform .15s, box-shadow .15s;
      box-shadow: 0 0 20px color-mix(in srgb, var(--purple) 40%, transparent);
    }

    #mq-next-btn:hover {
      transform: scale(1.03);
      box-shadow: 0 0 30px rgba(var(--cyan-raw, 34, 211, 238), .4);
    }

    /* Results */
    #mq-results-screen {
      flex: 1;
      position: relative;
      z-index: 5;
      overflow-y: auto;
      padding: 20px;
    }

    #mq-results-inner {
      max-width: 640px;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 20px;
      padding-bottom: 40px;
      text-align: center;
    }

    #mq-results-grade-emoji {
      font-size: 56px;
      animation: mqBounce .6s ease;
    }

    #mq-results-title {
      font-size: 28px;
      font-weight: 900;
      letter-spacing: 2px;
      color: var(--white);
    }

    #mq-results-topic {
      font-size: 13px;
      color: color-mix(in srgb, var(--white) 45%, transparent);
      letter-spacing: 1px;
    }

    #mq-results-ring-wrap {
      position: relative;
      width: 200px;
      height: 200px;
      flex-shrink: 0;
    }

    #mq-results-ring-svg {
      width: 100%;
      height: 100%;
    }

    #mq-results-ring-text {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }

    #mq-results-pct {
      font-size: 36px;
      font-weight: 900;
      color: var(--cyan);
    }

    #mq-results-score-label {
      font-size: 12px;
      color: color-mix(in srgb, var(--white) 45%, transparent);
    }

    #mq-results-chips {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      justify-content: center;
    }

    .mq-res-chip {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      padding: 12px 20px;
      border-radius: 12px;
      font-size: 20px;
      font-weight: 800;
      min-width: 70px;
    }

    .mq-res-chip small {
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 1px;
      opacity: .7;
      text-transform: uppercase;
    }

    .mq-res-chip.green {
      background: color-mix(in srgb, var(--green) 12%, transparent);
      border: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
      color: var(--green);
    }

    .mq-res-chip.red {
      background: color-mix(in srgb, var(--pink) 12%, transparent);
      border: 1px solid color-mix(in srgb, var(--pink) 30%, transparent);
      color: var(--pink);
    }

    .mq-res-chip.cyan {
      background: rgba(var(--cyan-raw, 34, 211, 238), .1);
      border: 1px solid rgba(var(--cyan-raw, 34, 211, 238), .25);
      color: var(--cyan);
    }

    .mq-res-chip.purple {
      background: color-mix(in srgb, var(--purple) 12%, transparent);
      border: 1px solid color-mix(in srgb, var(--purple) 30%, transparent);
      color: var(--purple-lt);
    }

    #mq-results-commander-msg {
      font-size: 15px;
      font-style: italic;
      color: rgba(var(--cyan-raw, 34, 211, 238), .9);
      padding: 16px 24px;
      border: 1px solid rgba(var(--cyan-raw, 34, 211, 238), .2);
      border-radius: 14px;
      background: rgba(var(--cyan-raw, 34, 211, 238), .06);
      max-width: 500px;
      line-height: 1.6;
    }

    #mq-results-breakdown-title {
      font-size: 11px;
      font-weight: 800;
      letter-spacing: 2px;
      color: color-mix(in srgb, var(--white) 35%, transparent);
      text-transform: uppercase;
      align-self: flex-start;
    }

    #mq-results-breakdown {
      width: 100%;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .mq-breakdown-row {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      padding: 10px 14px;
      border-radius: 10px;
      background: rgba(255, 255, 255, .04);
      border: 1px solid rgba(255, 255, 255, .07);
      text-align: left;
      font-size: 13px;
      color: color-mix(in srgb, var(--white) 65%, transparent);
    }

    .mq-breakdown-row.bd-correct {
      border-color: color-mix(in srgb, var(--green) 20%, transparent);
    }

    .mq-breakdown-row.bd-wrong {
      border-color: color-mix(in srgb, var(--pink) 20%, transparent);
    }

    .mq-bd-icon {
      font-size: 16px;
      flex-shrink: 0;
      margin-top: 1px;
    }

    .mq-bd-q {
      flex: 1;
      line-height: 1.4;
    }

    #mq-results-actions {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      justify-content: center;
    }

    .mq-res-btn {
      padding: 14px 28px;
      border-radius: 12px;
      background: linear-gradient(135deg, var(--purple), var(--purple-dk2));
      border: 1px solid color-mix(in srgb, var(--purple) 50%, transparent);
      color: var(--white);
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      font-family: var(--font-main);
      transition: transform .15s, box-shadow .15s;
      letter-spacing: .5px;
    }

    .mq-res-btn:hover {
      transform: scale(1.03);
      box-shadow: 0 0 20px color-mix(in srgb, var(--purple) 50%, transparent);
    }

    .mq-res-btn.alt {
      background: rgba(255, 255, 255, .06);
      border-color: rgba(255, 255, 255, .15);
    }

    .mq-res-btn.alt:hover {
      background: rgba(255, 255, 255, .1);
      box-shadow: none;
    }

    @media(max-width:600px) {
      #mq-header {
        padding: 10px 12px;
      }

      #mq-q-text {
        font-size: 16px;
      }

      #mq-loader-title {
        font-size: 22px;
      }

      #mq-card-inner {
        padding: 20px 16px;
      }

      #mq-results-pct {
        font-size: 28px;
      }
    }

    /* ════════════════════════════════════════════════════
   EDLIX STUDY TIMER — CSS
════════════════════════════════════════════════════ */

    #study-timer-trigger {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 6px 12px;
      background: transparent;
      border: 1px solid var(--border);
      border-radius: 99px;
      color: var(--text-muted);
      font-family: var(--font-main);
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
      letter-spacing: 0.3px;
      white-space: nowrap;
    }

    #study-timer-trigger:hover {
      border-color: var(--purple);
      color: var(--purple-lt);
      background: var(--purple)11;
    }

    #study-timer-trigger.active-session {
      border-color: var(--green);
      color: var(--green);
      background: color-mix(in srgb, var(--green) 7%, transparent);
      animation: timerPulse 2s infinite;
    }

    #study-timer-trigger.break-session {
      border-color: var(--cyan);
      color: var(--cyan);
      background: color-mix(in srgb, var(--cyan) 7%, transparent);
    }

    @keyframes timerPulse {

      0%,
      100% {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 20%, transparent);
      }

      50% {
        box-shadow: 0 0 0 6px transparent;
      }
    }

    #study-timer-dropdown {
      position: absolute;
      top: calc(100% + 8px);
      right: 0;
      width: 280px;
      background: var(--bg-overlay-95);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 18px;
      display: none;
      flex-direction: column;
      gap: 14px;
      z-index: 9999;
      backdrop-filter: blur(20px);
      box-shadow: 0 8px 40px color-mix(in srgb, var(--purple) 27%, transparent), 0 2px 12px color-mix(in srgb, var(--bg-deep) 53%, transparent);
      animation: stdDropIn 0.18s ease;
    }

    #study-timer-dropdown.open {
      display: flex;
    }

    @keyframes stdDropIn {
      from {
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
      }

      to {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }

    .std-label {
      font-size: 11px;
      font-weight: 700;
      color: var(--text-muted);
      letter-spacing: 0.8px;
      text-transform: uppercase;
    }

    .std-chips {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .std-chip {
      padding: 5px 12px;
      border-radius: 99px;
      border: 1px solid var(--border);
      background: transparent;
      color: var(--text-dim);
      font-size: 12px;
      font-weight: 600;
      font-family: var(--font-main);
      cursor: pointer;
      transition: all 0.15s;
    }

    .std-chip:hover,
    .std-chip.selected {
      border-color: var(--purple);
      color: var(--purple-lt);
      background: var(--purple)22;
    }

    .std-custom-row {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .std-custom-input {
      flex: 1;
      background: color-mix(in srgb, var(--purple) 15%, var(--bg-deep));
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text);
      font-family: var(--font-main);
      font-size: 13px;
      padding: 7px 10px;
      outline: none;
      transition: border-color 0.2s;
      min-width: 0;
    }

    .std-custom-input:focus {
      border-color: var(--purple);
    }

    .std-custom-input::placeholder {
      color: var(--text-muted);
    }

    .std-break-info {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 12px;
      color: var(--text-muted);
      background: color-mix(in srgb, var(--white) 3%, transparent);
      border-radius: 8px;
      padding: 8px 10px;
      border: 1px solid color-mix(in srgb, var(--white) 4%, transparent);
    }

    .std-start-btn {
      width: 100%;
      padding: 10px;
      background: linear-gradient(135deg, var(--purple), var(--purple-dk2));
      border: none;
      border-radius: 10px;
      color: var(--white);
      font-family: var(--font-main);
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.2s;
      letter-spacing: 0.3px;
    }

    .std-start-btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 20px var(--purple)66;
    }

    /* Focus Mode */
    body.focus-mode {
      filter: brightness(0.82) saturate(0.7);
    }

    body.focus-mode #topbar {
      background: color-mix(in srgb, var(--bg-deep) 60%, transparent) !important;
    }

    body.focus-mode canvas {
      opacity: 0.12 !important;
      transition: opacity 0.8s;
    }

    /* focused-hide: any element with this class will vanish when focus mode is ON */
    body.focus-mode .focused-hide {
      display: none !important;
    }

    #focus-mode-banner {
      display: none;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 5px 16px;
      background: color-mix(in srgb, var(--purple) 9%, transparent);
      border-bottom: 1px solid color-mix(in srgb, var(--purple) 20%, transparent);
      font-size: 12px;
      font-weight: 600;
      color: var(--purple-lt);
      letter-spacing: 0.4px;
      position: relative;
      z-index: 1;
      flex-shrink: 0;
    }

    body.focus-mode #focus-mode-banner {
      display: flex;
    }

    /* Break Popup */
    #study-break-popup {
      position: fixed;
      inset: 0;
      background: color-mix(in srgb, var(--bg-deep) 80%, transparent);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 99999;
      backdrop-filter: blur(10px);
    }

    #study-break-popup.open {
      display: flex;
      animation: popFadeIn 0.3s ease;
    }

    @keyframes popFadeIn {
      from {
        opacity: 0;
      }

      to {
        opacity: 1;
      }
    }

    .break-popup-card {
      background: linear-gradient(135deg, color-mix(in srgb, var(--purple) 8%, var(--bg-deep)), color-mix(in srgb, var(--purple) 5%, var(--bg-deep)));
      border: 1px solid var(--cyan);
      border-radius: 24px;
      padding: 36px 32px 28px;
      max-width: 380px;
      width: 90%;
      text-align: center;
      box-shadow: 0 0 60px color-mix(in srgb, var(--cyan) 20%, transparent), 0 0 120px color-mix(in srgb, var(--purple) 13%, transparent);
      animation: cardBounceIn 0.4s cubic-bezier(.34, 1.56, .64, 1);
    }

    @keyframes cardBounceIn {
      from {
        transform: scale(0.85) translateY(20px);
        opacity: 0;
      }

      to {
        transform: scale(1) translateY(0);
        opacity: 1;
      }
    }

    .break-wave-emoji {
      font-size: 52px;
      margin-bottom: 8px;
      display: block;
    }

    .break-greeting {
      font-size: 20px;
      font-weight: 700;
      color: var(--white);
      margin-bottom: 6px;
    }

    .break-greeting span {
      color: var(--cyan);
    }

    .break-steps {
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin: 20px 0 18px;
      text-align: left;
    }

    .break-step {
      display: flex;
      align-items: center;
      gap: 12px;
      background: color-mix(in srgb, var(--white) 3%, transparent);
      border-radius: 10px;
      padding: 10px 14px;
      font-size: 13px;
      font-weight: 500;
      color: var(--text);
      border: 1px solid color-mix(in srgb, var(--white) 4%, transparent);
    }

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

    .break-timer-display {
      font-size: 36px;
      font-weight: 800;
      color: var(--cyan);
      font-family: var(--font-mono);
      margin-bottom: 4px;
      letter-spacing: 2px;
    }

    .break-timer-label {
      font-size: 11px;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 1px;
      margin-bottom: 18px;
    }

    .break-end-btn {
      width: 100%;
      padding: 12px;
      background: linear-gradient(135deg, var(--purple), var(--purple-dk2));
      border: none;
      border-radius: 12px;
      color: var(--white);
      font-family: var(--font-main);
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.2s;
      margin-bottom: 10px;
    }

    .break-end-btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 20px var(--purple)66;
    }

    .break-finish-btn {
      width: 100%;
      padding: 10px;
      background: transparent;
      border: 1px solid color-mix(in srgb, var(--white) 13%, transparent);
      border-radius: 12px;
      color: var(--text-muted);
      font-family: var(--font-main);
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
    }

    .break-finish-btn:hover {
      border-color: var(--pink);
      color: var(--pink);
    }

    /* Fullscreen escape warning — full overlay popup */
    #fs-escape-warning {
      position: fixed;
      inset: 0;
      background: color-mix(in srgb, var(--bg-deep) 87%, transparent);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 999999;
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      /* Mobile: ensure it covers everything including bottom nav */
      padding: 20px;
      box-sizing: border-box;
    }

    #fs-escape-warning.open {
      display: flex;
      animation: popFadeIn 0.25s ease;
    }

    @media (max-width: 768px) {
      #fs-escape-warning {
        z-index: 9999999;
      }

      /* above mobile bottom nav */
      .fs-warn-card {
        max-width: 100%;
        width: 100%;
        border-radius: 16px;
        padding: 28px 20px 20px;
      }
    }

    .fs-warn-card {
      background: linear-gradient(135deg, color-mix(in srgb, var(--pink) 10%, var(--bg-deep)), color-mix(in srgb, var(--purple) 8%, var(--bg-deep)));
      border: 1px solid var(--pink);
      border-radius: 20px;
      padding: 32px 28px 24px;
      max-width: 340px;
      width: 90%;
      text-align: center;
      box-shadow: 0 0 60px color-mix(in srgb, var(--pink) 27%, transparent), 0 0 120px color-mix(in srgb, var(--purple) 13%, transparent);
      animation: cardBounceIn 0.35s cubic-bezier(.34, 1.56, .64, 1);
    }

    .fs-warn-icon {
      font-size: 44px;
      margin-bottom: 10px;
      display: block;
    }

    .fs-warn-title {
      font-size: 18px;
      font-weight: 700;
      color: var(--white);
      margin-bottom: 8px;
    }

    .fs-warn-sub {
      font-size: 13px;
      color: var(--text-muted);
      margin-bottom: 22px;
      line-height: 1.5;
    }

    .fs-warn-back-btn {
      width: 100%;
      padding: 11px;
      margin-bottom: 10px;
      background: linear-gradient(135deg, var(--purple), var(--purple-dk2));
      border: none;
      border-radius: 11px;
      color: var(--white);
      font-family: var(--font-main);
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.2s;
    }

    .fs-warn-back-btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 20px var(--purple)66;
    }

    .fs-warn-stop-btn {
      width: 100%;
      padding: 10px;
      background: transparent;
      border: 1px solid color-mix(in srgb, var(--white) 13%, transparent);
      border-radius: 11px;
      color: var(--text-muted);
      font-family: var(--font-main);
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
    }

    .fs-warn-stop-btn:hover {
      border-color: var(--pink);
      color: var(--pink);
    }

    #study-timer-rel-wrap {
      position: relative;
      display: flex;
      align-items: center;
    }

    /* ── POINTS / LEADERBOARD STYLES ───────────────────────── */
    .pts-lb-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 14px;
      border-radius: 12px;
      background: var(--bg-deep);
      border: 1px solid var(--border);
      transition: 0.2s;
    }

    .pts-lb-item.me {
      background: color-mix(in srgb, var(--purple) 12%, var(--bg-deep));
      border-color: var(--purple)66;
    }

    .pts-lb-rank {
      font-size: 18px;
      font-weight: 800;
      width: 28px;
      text-align: center;
      flex-shrink: 0;
      color: var(--text-muted);
    }

    .pts-lb-rank.gold {
      color: var(--yellow);
      text-shadow: 0 0 10px color-mix(in srgb, var(--yellow) 53%, transparent);
    }

    .pts-lb-rank.silver {
      color: var(--text-dim);
      text-shadow: 0 0 10px color-mix(in srgb, var(--text-dim) 33%, transparent);
    }

    .pts-lb-rank.bronze {
      color: var(--orange);
      text-shadow: 0 0 10px color-mix(in srgb, var(--orange) 33%, transparent);
    }

    .pts-lb-avatar {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      background: linear-gradient(135deg, var(--purple), var(--pink));
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 15px;
      font-weight: 700;
      color: var(--white);
      flex-shrink: 0;
      overflow: hidden;
    }

    .pts-lb-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .pts-lb-name {
      flex: 1;
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
    }

    .pts-lb-badge {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.5px;
      padding: 2px 7px;
      border-radius: 99px;
    }

    .pts-lb-coins {
      font-size: 14px;
      font-weight: 800;
      color: var(--yellow);
      display: flex;
      align-items: center;
      gap: 3px;
    }

    /* Topbar coin chip hover */
    #topbar-coins-chip:hover {
      background: var(--purple)44;
      border-color: var(--purple);
    }

    /* Points toast notification */
    .pts-toast {
      position: fixed;
      bottom: 80px;
      right: 16px;
      background: linear-gradient(135deg, color-mix(in srgb, var(--purple) 15%, var(--bg-deep)), color-mix(in srgb, var(--purple) 8%, var(--bg-deep)));
      border: 1px solid var(--purple);
      border-radius: 12px;
      padding: 10px 16px;
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 13px;
      font-weight: 700;
      color: var(--purple-lt);
      z-index: 99998;
      box-shadow: 0 4px 20px var(--purple)44;
      animation: ptsToastIn 0.3s cubic-bezier(.34, 1.56, .64, 1);
      pointer-events: none;
    }

    .pts-toast.negative {
      border-color: var(--pink);
      color: var(--pink);
    }

    @keyframes ptsToastIn {
      from {
        opacity: 0;
        transform: translateY(10px) scale(0.9)
      }

      to {
        opacity: 1;
        transform: none
      }
    }

    @keyframes ptsToastOut {
      to {
        opacity: 0;
        transform: translateY(-6px) scale(0.95)
      }
    }

    /* Container for all notes */
    .notes-section {
      width: 100%;
      margin-bottom: 24px;
      box-sizing: border-box;
    }

    /* Fix for Box Grid (The most likely culprit for overlap) */
    .box-grid {
      display: flex;
      flex-wrap: wrap;
      /* Allows items to wrap to next line */
      gap: 16px;
      width: 100%;
    }

    .box-grid-item {
      flex: 1 1 300px;
      /* Grow to fill space, basis of 300px */
      min-width: 250px;
      max-width: 100%;
      /* Prevents going outside parent */
      background: var(--bg-deep);
      border: 1px solid var(--border);
      padding: 15px;
      border-radius: 10px;
      word-wrap: break-word;
      /* Prevents long text from breaking layout */
    }

    /* Fix for Flashcards */
    .flash-grid {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      justify-content: center;
    }

    /* Fix for Tables (Prevents horizontal overflow) */
    .notes-section table {
      width: 100% !important;
      display: table;
      /* Force standard table behavior */
      table-layout: auto;
      /* Let columns adjust to content */
      border-radius: 8px;
      overflow: hidden;
    }

    /* Global Fix for any text overflow */
    .notes-section p,
    .notes-section div {
      max-width: 100%;
      overflow-wrap: break-word;
    }
  </style>


    /* ── PC WELCOME ACTION PANELS ────────────────────────── */
    #welcome-screen {
      position: relative;
      flex-direction: row !important;
      align-items: center !important;
      justify-content: center !important;
      gap: 120px !important;
      padding: 0 40px;
      height: 100%;
    }

    .welcome-left-col {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      gap: 24px;
    }



    .welcome-face-text {
      text-align: center;

    }

    .welcome-face-text .wft-name {
      font-size: 15px;
      font-weight: 700;
      color: white;
    }

    .welcome-face-text .wft-name span {
      background: linear-gradient(90deg, var(--purple-lt), var(--pink));
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }

    .welcome-face-text .wft-sub {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 4px;
      line-height: 1.5;
    }

    .welcome-right-box {
      display: flex;
      gap: 0;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 18px;
      overflow: hidden;
      box-shadow: 0 0 40px var(--purple)11;
      flex-shrink: 0;
    }

    .wrb-prompts {
      padding: 18px;
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .wrb-label {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 1.5px;
      text-transform: uppercase;
      color: var(--text-muted);
    }

    .wrb-prompts-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 8px;
    }

    .wp-block {
      background: var(--bg-deep);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 13px 12px;
      cursor: pointer;
      transition: all 0.2s ease;
      text-align: left;
      width: 160px;
      height: 110px;
    }

    .wp-block:hover {
      border-color: var(--purple);
      transform: translateY(-2px);
      box-shadow: 0 6px 20px var(--purple)22;
      background: color-mix(in srgb, var(--purple) 8%, var(--bg-deep));
    }

    .wp-block .wp-icon {
      font-size: 20px;
      margin-bottom: 6px;
      display: block;
    }

    .wp-block .wp-title {
      font-size: 12px;
      font-weight: 600;
      color: var(--text);
      line-height: 1.3;
    }

    .wp-block .wp-desc {
      font-size: 11px;
      color: var(--text-muted);
      margin-top: 2px;
    }

    .wrb-actions {
      width: 175px;
      flex-shrink: 0;
      padding: 18px 14px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .wqa-btn {
      display: flex;
      align-items: center;
      gap: 10px;
      background: var(--bg-deep);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 10px 12px;
      cursor: pointer;
      transition: all 0.18s;
      font-family: var(--font-main);
      text-align: left;
      width: 100%;
    }

    .wqa-btn:hover {
      border-color: var(--purple);
      background: color-mix(in srgb, var(--purple) 8%, var(--bg-deep));
      transform: translateX(2px);
    }

    .wqa-btn .wqa-icon {
      font-size: 16px;
      flex-shrink: 0;
    }

    .wqa-btn .wqa-title {
      font-size: 12px;
      font-weight: 600;
      color: var(--text);
      display: block;
    }

    .wqa-btn .wqa-desc {
      font-size: 10px;
      color: var(--text-muted);
    }

    .welcome-side-panel {
      display: none;
    }

    .welcome-center {
      display: contents;
    }

    .quick-prompts {
      display: none !important;
    }

    @media (max-width: 768px) {
      #welcome-screen {
        flex-direction: column !important;
        padding: 16px !important;
        gap: 20px !important;
        /* Thoda space badhaya face aur boxes ke beech */
        justify-content: flex-start !important;
        overflow-y: auto;
        align-items: center !important;
        /* Pura content center align karne ke liye */
      }

      .welcome-left-col {
        flex-direction: column;
        /* Row se Column kiya taaki text neeche aaye */
        align-items: center;
        /* Face aur Text dono horizontal center honge */
        text-align: center;
        gap: 10px;
        /* Face aur Text ke beech ka gap */
        width: 100%;
      }

      .welcome-face-text {
        width: 100%;
        /* Width auto ya 100% rakho center align ke liye */
        max-width: 280px;
        /* Ek limit set kardi taaki text zyada fail na jaye */
        font-size: 15px;
        /* Mobile ke liye thoda chota size adjust kar lo */
      }

      /* --- Boxes & Actions Adjustment --- */
      .welcome-right-box {
        flex-direction: column;
        width: 100%;
      }

      .wrb-prompts {
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding-bottom: 12px;
      }

      .wrb-actions {
        width: 100%;
        padding-top: 12px;
      }



      .wp-block {
        width: 100%;
        /* Mobile par full width blocks zyada premium lagte hain */
        height: auto;
      }
    }

    @media (max-width: 768px) {

      /* --- INPUT CONTAINER FIX --- */
      .input-container {
        width: 95% !important;
        /* Mobile par thoda gap side se */
        margin: 0 auto 85px auto !important;
        /* Bottom margin badhaya taaki nav se upar rahe */
        padding: 12px 16px !important;
        border-radius: 20px !important;
        background: var(--bg-surface) !important;
        backdrop-filter: blur(12px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
        position: relative;
        z-index: 100;
      }

      /* --- WELCOME SCREEN SCROLL FIX --- */
      #welcome-screen {
        height: calc(100vh - 180px) !important;
        /* Taaki input bar ke liye space bache */
        padding-bottom: 100px !important;
      }

      /* --- TEXT AREA FIX --- */
      #chat-input {
        font-size: 16px !important;
        /* Taaki iOS zoom na kare automatically */
        max-height: 120px !important;
      }
    }

    /* Container jo expand hoga */
    .expandable-wrapper {
      display: grid;
      grid-template-rows: 0fr;
      /* Shuruat mein height 0 */
      transition: grid-template-rows 0.3s ease-out;
      overflow: hidden;
    }

    /* Jab active class lagegi */
    .expandable-wrapper.open {
      grid-template-rows: 1fr;
      /* Apne aap content ki height le lega */
    }

    /* Iske andar ka asli content */
    .expandable-content {
      min-height: 0;
      /* Ye zaroori hai grid transition ke liye */
    }

    /* ═══════════════════════════════════════════════════════════════════════════
       WALLET / PAYWALL — Cyberpunk Micro-Transaction Popup
       ═══════════════════════════════════════════════════════════════════════════ */

    #edlix-paywall {
      position: fixed;
      inset: 0;
      z-index: 10000;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.25s ease;
    }
    #edlix-paywall.visible {
      opacity: 1;
      pointer-events: auto;
    }

    .pw-backdrop {
      position: absolute;
      inset: 0;
      background: rgba(0, 0, 0, 0.7);
      backdrop-filter: blur(6px);
    }

    .pw-card {
      position: relative;
      width: 380px;
      max-width: 92vw;
      max-height: 90vh;
      overflow-y: auto;
      background: linear-gradient(135deg, #1a1025 0%, #0f0a1a 100%);
      border: 1px solid rgba(124, 58, 237, 0.4);
      border-radius: 16px;
      padding: 28px 24px;
      box-shadow: 0 0 40px rgba(124, 58, 237, 0.2), 0 0 80px rgba(59, 130, 246, 0.1);
      animation: pwSlideUp 0.3s ease;
    }
    @keyframes pwSlideUp {
      from { transform: translateY(30px); opacity: 0; }
      to { transform: translateY(0); opacity: 1; }
    }

    .pw-close {
      position: absolute;
      top: 12px;
      right: 16px;
      background: none;
      border: none;
      color: #94a3b8;
      font-size: 22px;
      cursor: pointer;
      line-height: 1;
      padding: 4px;
      transition: color 0.2s;
    }
    .pw-close:hover { color: #f87171; }

    .pw-header {
      text-align: center;
      margin-bottom: 20px;
    }
    .pw-icon {
      font-size: 36px;
      margin-bottom: 8px;
      filter: drop-shadow(0 0 12px rgba(250, 204, 21, 0.5));
    }
    .pw-title {
      font-size: 18px;
      font-weight: 700;
      color: #f1f5f9;
      margin-bottom: 4px;
    }
    .pw-sub {
      font-size: 13px;
      color: #94a3b8;
    }

    .pw-options {
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin-bottom: 16px;
    }
    .pw-option {
      display: flex;
      align-items: center;
      width: 100%;
      padding: 14px 16px;
      background: rgba(124, 58, 237, 0.1);
      border: 1px solid rgba(124, 58, 237, 0.3);
      border-radius: 12px;
      color: #e2e8f0;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
      text-align: left;
    }
    .pw-option:hover {
      background: rgba(124, 58, 237, 0.25);
      border-color: rgba(124, 58, 237, 0.6);
      box-shadow: 0 0 20px rgba(124, 58, 237, 0.2);
      transform: translateY(-1px);
    }
    .pw-option-main { flex: 1; }

    .pw-divider {
      display: flex;
      align-items: center;
      gap: 12px;
      margin: 12px 0;
      color: #475569;
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: 1px;
    }
    .pw-divider::before,
    .pw-divider::after {
      content: "";
      flex: 1;
      height: 1px;
      background: rgba(71, 85, 105, 0.4);
    }

    .pw-coin-packs {
      display: flex;
      gap: 8px;
      margin-bottom: 12px;
    }
    .pw-coin-btn {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 12px 8px;
      background: rgba(59, 130, 246, 0.08);
      border: 1px solid rgba(59, 130, 246, 0.25);
      border-radius: 12px;
      color: #e2e8f0;
      cursor: pointer;
      transition: all 0.2s;
      position: relative;
    }
    .pw-coin-btn:hover {
      background: rgba(59, 130, 246, 0.2);
      border-color: rgba(59, 130, 246, 0.5);
      box-shadow: 0 0 16px rgba(59, 130, 246, 0.2);
      transform: translateY(-2px);
    }
    .pw-coin-best {
      border-color: rgba(250, 204, 21, 0.5);
      background: rgba(250, 204, 21, 0.08);
    }
    .pw-coin-best:hover {
      border-color: rgba(250, 204, 21, 0.8);
      background: rgba(250, 204, 21, 0.15);
      box-shadow: 0 0 16px rgba(250, 204, 21, 0.3);
    }
    .pw-coin-badge {
      position: absolute;
      top: -8px;
      font-size: 9px;
      font-weight: 800;
      background: linear-gradient(135deg, #f59e0b, #f97316);
      color: #0f0a1a;
      padding: 2px 8px;
      border-radius: 6px;
      letter-spacing: 0.5px;
    }
    .pw-coin-amt {
      font-size: 22px;
      font-weight: 800;
      background: linear-gradient(135deg, #818cf8, #38bdf8);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    .pw-coin-label {
      font-size: 11px;
      color: #94a3b8;
      margin-top: 2px;
    }

    .pw-balance {
      text-align: center;
      font-size: 13px;
      color: #94a3b8;
      padding: 8px;
      background: rgba(250, 204, 21, 0.05);
      border-radius: 8px;
      border: 1px solid rgba(250, 204, 21, 0.15);
    }
    .pw-balance strong {
      color: #facc15;
      font-weight: 700;
    }

    .pw-donate-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      width: 100%;
      padding: 12px;
      background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(249, 115, 22, 0.15));
      border: 1px solid rgba(245, 158, 11, 0.3);
      border-radius: 12px;
      color: #fbbf24;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
    }
    .pw-donate-btn:hover {
      background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(249, 115, 22, 0.3));
      border-color: rgba(245, 158, 11, 0.6);
      box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
      transform: translateY(-1px);
    }

    .pw-daily-info {
      text-align: center;
      font-size: 11px;
      color: #475569;
      margin-top: 12px;
    }

    /* Wallet usage bar (topbar) */
    .wallet-usage-bar {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .wallet-coin-display {
      display: flex;
      align-items: center;
      gap: 4px;
      padding: 4px 10px;
      background: rgba(250, 204, 21, 0.08);
      border: 1px solid rgba(250, 204, 21, 0.2);
      border-radius: 20px;
      cursor: pointer;
      transition: all 0.2s;
      font-size: 13px;
      color: #facc15;
      font-weight: 700;
    }
    .wallet-coin-display:hover {
      background: rgba(250, 204, 21, 0.15);
      border-color: rgba(250, 204, 21, 0.4);
      box-shadow: 0 0 12px rgba(250, 204, 21, 0.15);
    }
    .wallet-coin-icon { font-size: 14px; }
    .wallet-daily-dots {
      display: flex;
      gap: 4px;
    }
    .w-dot {
      font-size: 11px;
      opacity: 0.7;
      transition: opacity 0.2s;
    }
    .w-dot-empty {
      opacity: 0.25;
    }

    /* Loading overlay */
    #edlix-paywall-loading {
      position: fixed;
      inset: 0;
      z-index: 10001;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgba(0, 0, 0, 0.6);
      backdrop-filter: blur(4px);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s;
    }
    #edlix-paywall-loading.visible {
      opacity: 1;
      pointer-events: auto;
    }
    .pw-spinner {
      width: 40px;
      height: 40px;
      border: 3px solid rgba(124, 58, 237, 0.2);
      border-top-color: #7c3aed;
      border-radius: 50%;
      animation: pwSpin 0.8s linear infinite;
    }
    @keyframes pwSpin { to { transform: rotate(360deg); } }

    /* Toast notifications */
    .edlix-toast {
      position: fixed;
      bottom: 24px;
      left: 50%;
      transform: translateX(-50%) translateY(20px);
      padding: 12px 20px;
      background: rgba(15, 23, 42, 0.95);
      border: 1px solid rgba(124, 58, 237, 0.4);
      border-radius: 12px;
      color: #e2e8f0;
      font-size: 13px;
      font-weight: 500;
      z-index: 10002;
      opacity: 0;
      transition: all 0.3s ease;
      backdrop-filter: blur(8px);
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
      max-width: 90vw;
      text-align: center;
    }
    .edlix-toast.visible {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }
    .edlix-toast-error {
      border-color: rgba(239, 68, 68, 0.5);
      background: rgba(30, 10, 10, 0.95);
    }
    .edlix-toast-warn {
      border-color: rgba(245, 158, 11, 0.5);
      background: rgba(30, 20, 5, 0.95);
    }

    /* PWA Install floating button */
    .pwa-install-fab {
      position: fixed;
      bottom: 120px;
      right: 16px;
      z-index: 250;
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 10px 16px;
      background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(168, 85, 247, 0.15));
      border: 1px solid rgba(124, 58, 237, 0.3);
      border-radius: 24px;
      color: #c084fc;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.3s;
      backdrop-filter: blur(8px);
      font-family: 'Space Grotesk', sans-serif;
    }
    .pwa-install-fab:hover {
      background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(168, 85, 247, 0.3));
      border-color: rgba(124, 58, 237, 0.6);
      box-shadow: 0 0 20px rgba(124, 58, 237, 0.25);
      transform: translateY(-2px);
    }
    /* Hide install button when app is running as installed PWA */
    @media (display-mode: standalone), (display-mode: fullscreen) {
      .pwa-install-fab { display: none !important; }
    }

    /* Donation floating button */
    .chai-fab {
      position: fixed;
      bottom: 80px;
      right: 16px;
      z-index: 250;
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 10px 16px;
      background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(249, 115, 22, 0.12));
      border: 1px solid rgba(245, 158, 11, 0.25);
      border-radius: 24px;
      color: #fbbf24;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.3s;
      backdrop-filter: blur(8px);
    }
    .chai-fab:hover {
      background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(249, 115, 22, 0.25));
      border-color: rgba(245, 158, 11, 0.5);
      box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
      transform: translateY(-2px);
    }

    @media (max-width: 768px) {
      .pw-card { padding: 20px 16px; }
      .chai-fab { bottom: 70px; right: 10px; padding: 8px 12px; font-size: 12px; }
      .pwa-install-fab { bottom: 110px; right: 10px; padding: 8px 12px; font-size: 12px; }
    }
  </style>
