@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=Syne:wght@400;600;700;800&display=swap');

  :root {
    --bg: #080A0F;
    --surface: #0E1117;
    --surface2: #141820;
    --border: rgba(255,255,255,0.06);
    --border-hover: rgba(255,255,255,0.12);
    --text: #E8EAF0;
    --text-muted: #6B7280;
    --text-dim: #374151;
    --accent: #3B82F6;
    --accent-glow: rgba(59,130,246,0.15);
    --accent2: #06B6D4;
    --success: #10B981;
    --orbit: rgba(59,130,246,0.08);
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    min-height: 100vh;
    cursor: default;
    overflow-x: hidden;
  }

  body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 600px;
    background: radial-gradient(ellipse, rgba(59,130,246,0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
  }

  .no-mobile { display: block; }
  .mobile-only { display: none; }
  @media only screen and (max-width: 600px) {
    .no-mobile { display: none; }
    .mobile-only { display: block; }
  }
  .dnone { display: none; }

  .orbit-bg {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none; z-index: 0; opacity: 0; transition: opacity 1s ease;
  }
  .orbit-bg.visible { opacity: 1; }
  .orbit-ring {
    position: absolute;
    border: 1px solid rgba(59,130,246,0.04);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    left: 50%; top: 50%;
  }

  header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    padding: 16px 24px; display: flex; align-items: center;
    justify-content: space-between; border-bottom: 1px solid transparent;
    transition: all 0.3s; backdrop-filter: blur(0px);
  }
  header.scrolled {
    border-bottom-color: var(--border);
    backdrop-filter: blur(20px);
    background: rgba(8,10,15,0.8);
  }

  .logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
  .logo-icon { width: 28px; height: 28px; position: relative; }
  .logo-icon svg { width: 100%; height: 100%; }
  .logo-text { font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
  .logo-text span { color: var(--accent); }
  .header-right { display: flex; align-items: center; gap: 16px; }
  .privacy-badge {
    display: flex; align-items: center; gap: 6px; padding: 5px 10px;
    background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.15);
    border-radius: 20px; font-size: 11px; color: var(--success); letter-spacing: 0.3px;
  }
  .privacy-dot {
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--success); animation: pulse-dot 2s infinite;
  }

  #home {
    min-height: 100vh; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 80px 24px 40px; position: relative; z-index: 1;
  }
  .hero-label {
    font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
    color: var(--accent); margin-bottom: 20px; opacity: 0;
    animation: fadeUp 0.6s ease 0.2s forwards;
  }
  .hero-title {
    font-family: 'Syne', sans-serif; font-size: clamp(36px, 6vw, 64px);
    font-weight: 800; text-align: center; line-height: 1.1;
    letter-spacing: -1.5px; margin-bottom: 16px; opacity: 0;
    animation: fadeUp 0.6s ease 0.4s forwards;
  }
  .hero-title .gradient {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  }
  .hero-sub {
    font-size: 15px; color: var(--text-muted); text-align: center;
    max-width: 380px; line-height: 1.6; margin-bottom: 40px; opacity: 0;
    animation: fadeUp 0.6s ease 0.6s forwards;
  }

  .search-wrapper { width: 100%; max-width: 640px; opacity: 0; animation: fadeUp 0.6s ease 0.8s forwards; }
  .search-box {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; padding: 14px 16px; transition: all 0.2s ease; position: relative;
  }
  .search-box:focus-within {
    border-color: rgba(59,130,246,0.4);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 8px 32px rgba(0,0,0,0.3);
  }
  .search-icon { color: var(--text-muted); flex-shrink: 0; transition: color 0.2s; }
  .search-box:focus-within .search-icon { color: var(--accent); }
  #search-input {
    flex: 1; background: none; border: none; outline: none;
    color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 16px; font-weight: 400;
  }
  #search-input::placeholder { color: var(--text-dim); }
  .search-btn {
    background: var(--accent); border: none; border-radius: 8px;
    padding: 8px 16px; color: white; font-family: 'DM Sans', sans-serif;
    font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s;
    white-space: nowrap; display: flex; align-items: center; gap: 6px;
  }
  .search-btn:hover { background: #2563EB; transform: translateY(-1px); }
  .search-btn:active { transform: translateY(0); }
  .search-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
  .search-hints { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; justify-content: center; }
  .hint-chip {
    padding: 5px 12px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 20px; font-size: 12px; color: var(--text-muted); cursor: pointer; transition: all 0.2s;
  }
  .hint-chip:hover { border-color: var(--border-hover); color: var(--text); }

  #results-page { display: none; min-height: 100vh; padding-top: 70px; }
  .results-header {
    border-bottom: 1px solid var(--border); padding: 16px 24px;
    display: flex; align-items: center; gap: 16px;
    background: rgba(8,10,15,0.9); backdrop-filter: blur(20px);
    position: sticky; top: 60px; z-index: 90;
    margin: auto;
    max-width: 900px;
  }
  .results-search-box {
    flex: 1; max-width: 600px; display: flex; align-items: center; gap: 10px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 10px 14px; transition: all 0.2s;
  }
  .results-search-box:focus-within { border-color: rgba(59,130,246,0.4); box-shadow: 0 0 0 3px var(--accent-glow); }
  #results-input {
    flex: 1; background: none; border: none; outline: none;
    color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 14px;
  }

  .results-layout {
    max-width: 900px; margin: 0 auto; padding: 24px 24px 60px;
    display: grid; grid-template-columns: 1fr 300px; gap: 24px;
  }
  @media (max-width: 700px) {
    .results-layout { grid-template-columns: 1fr; }
    .results-sidebar { display: none; }
  }

  .ai-answer {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; padding: 20px; margin-bottom: 20px;
    position: relative; overflow: hidden;
  }
  .ai-answer::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
  }
  .ai-answer-header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
  .ai-badge {
    display: flex; align-items: center; gap: 6px; font-size: 11px;
    font-weight: 600; letter-spacing: 0.5px; color: var(--accent); text-transform: uppercase;
  }
  .ai-model-tag {
    margin-left: auto; font-size: 10px; color: var(--text-muted);
    padding: 2px 8px; background: var(--surface2); border-radius: 4px;
  }
  #ai-text { font-size: 14px; line-height: 1.75; color: rgba(232,234,240,0.85); }
  .ai-thinking { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 13px; }
  .thinking-dots span {
    display: inline-block; width: 4px; height: 4px; border-radius: 50%;
    background: var(--accent); margin: 0 2px; animation: bounce 1.2s infinite;
  }
  .thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
  .thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

  .results-label {
    font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
    color: var(--text-muted); margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
  }
  .results-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

  .result-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 16px; margin-bottom: 10px;
    transition: all 0.2s; cursor: pointer; text-decoration: none; display: block;
  }
  .result-card:hover {
    border-color: var(--border-hover); background: var(--surface2);
    transform: translateY(-1px); box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  }
  .result-domain { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
  .domain-favicon {
    width: 14px; height: 14px; border-radius: 3px; background: var(--surface2);
    display: flex; align-items: center; justify-content: center;
    font-size: 8px; overflow: hidden; flex-shrink: 0;
  }
  .domain-text { font-size: 11px; color: var(--success); letter-spacing: 0.3px; }
  .result-title { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; line-height: 1.4; }
  .result-card:hover .result-title { color: var(--accent); }
  .result-snippet {
    font-size: 12px; color: var(--text-muted); line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }

  .results-sidebar { position: relative; }
  .sidebar-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 16px; margin-bottom: 12px; position: sticky; top: 130px;
  }
  .sidebar-title { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px; }
  .history-item {
    display: flex; align-items: center; gap: 8px; padding: 8px 0;
    border-bottom: 1px solid var(--border); cursor: pointer; transition: color 0.2s;
    font-size: 13px; color: var(--text-muted);
  }
  .history-item:last-child { border-bottom: none; }
  .history-item:hover { color: var(--text); }
  .history-icon { opacity: 0.5; flex-shrink: 0; }
  .clear-history { margin-top: 10px; font-size: 11px; color: var(--text-dim); cursor: pointer; transition: color 0.2s; text-align: center; }
  .clear-history:hover { color: #EF4444; }

  .privacy-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
  .stat-item { background: var(--surface2); border-radius: 8px; padding: 10px; text-align: center; }
  .stat-num { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 700; color: var(--accent); }
  .stat-label { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

  .error-box {
    background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2);
    border-radius: 10px; padding: 14px 16px; font-size: 13px; color: #FCA5A5;
    margin-bottom: 16px; display: none;
  }
  .empty-results { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 14px; display: none; }

  .chat-bubble { word-break: break-word; white-space: pre-wrap; }

  @keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
  @keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }
  @keyframes spin { to { transform: rotate(360deg); } }
  .spinner { width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
  ::-webkit-scrollbar { width: 4px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

  .home-section-label {
    font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
    color: var(--text-dim); margin-bottom: 8px; text-align: center;
  }
  .hints-section { margin-top: 0; }
  .spaces-home-section { margin-top: 24px; width: 100%; max-width: 640px; opacity: 0; animation: fadeUp 0.6s ease 1s forwards; }
  .spaces-chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
  .space-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px;
    background: rgba(59,130,246,0.06); border: 1px solid rgba(59,130,246,0.2);
    border-radius: 20px; font-size: 12px; color: var(--accent);
    cursor: pointer; transition: all 0.2s; max-width: 180px;
  }
  .space-chip:hover { background: var(--accent-glow); border-color: rgba(59,130,246,0.4); }
  .space-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .spaces-view-all {
    font-size: 11px; color: var(--text-muted); cursor: pointer;
    padding: 6px 10px; border-radius: 20px; transition: color 0.2s; white-space: nowrap;
    background: none; border: none; font-family: 'DM Sans', sans-serif;
  }
  .spaces-view-all:hover { color: var(--accent); }

  #spaces-page { display: none; min-height: 100vh; padding-top: 60px; }
  .spaces-layout { display: grid; grid-template-columns: 260px 1fr; height: calc(100vh - 60px); }
  @media (max-width: 700px) {
    .spaces-layout { grid-template-columns: 1fr; }
    .spaces-sidebar { display: none; }
    .spaces-sidebar.mobile-open { display: flex; position: fixed; top: 60px; left: 0; right: 0; bottom: 0; z-index: 80; }
  }
  .spaces-sidebar {
    border-right: 1px solid var(--border); background: var(--surface);
    display: flex; flex-direction: column; overflow: hidden;
  }
  .spaces-sidebar-header {
    padding: 14px 16px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
  }
  .spaces-sidebar-title { font-size: 12px; font-weight: 600; color: var(--text); letter-spacing: 0.3px; }
  .spaces-list { flex: 1; overflow-y: auto; padding: 8px; }
  .space-list-item {
    display: flex; align-items: center; gap: 8px; padding: 10px 12px;
    border-radius: 8px; cursor: pointer; transition: all 0.2s;
    margin-bottom: 2px; position: relative;
  }
  .space-list-item:hover { background: var(--surface2); }
  .space-list-item.active { background: var(--accent-glow); border: 1px solid rgba(59,130,246,0.2); }
  .space-list-item-name { font-size: 13px; color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .space-list-item-date { font-size: 10px; color: var(--text-dim); flex-shrink: 0; }
  .space-delete-btn {
    opacity: 0; background: none; border: none; color: #EF4444; cursor: pointer;
    padding: 2px 4px; border-radius: 4px; font-size: 11px; transition: opacity 0.2s; flex-shrink: 0;
  }
  .space-list-item:hover .space-delete-btn { opacity: 1; }
  .spaces-empty-sidebar { padding: 24px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

  .spaces-main { display: flex; flex-direction: column; overflow: hidden; }
  .spaces-main-header {
    padding: 14px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px; flex-shrink: 0;
    background: rgba(8,10,15,0.9); backdrop-filter: blur(20px);
  }
  .space-main-name { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 600; color: var(--text); flex: 1; }
  .spaces-content { flex: 1; overflow-y: auto; padding: 20px; }
  .space-original-query {
    font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
    color: var(--text-muted); margin-bottom: 8px;
  }
  .space-query-text {
    font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 700;
    color: var(--text); margin-bottom: 16px; line-height: 1.3;
  }
  .space-ai-answer {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 16px; margin-bottom: 16px; position: relative; overflow: hidden;
  }
  .space-ai-answer::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
  }
  .space-conv-label { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); margin: 16px 0 10px; }
  .space-empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }

  .save-space-btn {
    display: inline-flex; align-items: center; gap: 7px;
    background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.2);
    color: var(--success); padding: 8px 16px; border-radius: 8px;
    font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all 0.2s;
  }
  .save-space-btn:hover { background: rgba(16,185,129,0.15); }

  .modal-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7); z-index: 200; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
  }
  .modal-overlay.open { display: flex; }
  .modal {
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    padding: 24px; width: 90%; max-width: 420px; position: relative;
  }
  .modal-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
  .modal-desc { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: 20px; }
  .modal-input {
    width: 100%; background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; padding: 10px 14px; color: var(--text);
    font-family: 'DM Sans', sans-serif; font-size: 14px; outline: none;
    transition: border-color 0.2s; margin-bottom: 16px;
  }
  .modal-input:focus { border-color: rgba(59,130,246,0.4); }
  .modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
  .modal-btn-cancel {
    background: none; border: 1px solid var(--border); color: var(--text-muted);
    padding: 8px 16px; border-radius: 8px; font-family: 'DM Sans', sans-serif;
    font-size: 13px; cursor: pointer; transition: all 0.2s;
  }
  .modal-btn-cancel:hover { border-color: var(--border-hover); color: var(--text); }
  .modal-btn-save {
    background: var(--accent); border: none; color: white; padding: 8px 20px;
    border-radius: 8px; font-family: 'DM Sans', sans-serif; font-size: 13px;
    font-weight: 500; cursor: pointer; transition: all 0.2s;
  }
  .modal-btn-save:hover { background: #2563EB; }

  .info-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--text-muted);
    color: var(--text-muted); font-size: 9px; cursor: pointer; flex-shrink: 0;
    transition: all 0.2s; font-style: italic; font-family: serif;
  }
  .info-badge:hover { border-color: var(--accent); color: var(--accent); }

  .site-footer {
    display: flex; align-items: center; justify-content: center; gap: 20px;
    padding: 20px 24px; border-top: 1px solid var(--border);
    font-size: 11px; color: var(--text-dim); margin-top: 40px;
  }
  .site-footer a { color: var(--text-dim); text-decoration: none; transition: color 0.2s; }
  .site-footer a:hover { color: var(--text-muted); }


/* ── Import CSS ── */
.box-importx{
    width:26px;height:38px;text-align:center;font-family:monospace;font-size:18px;font-weight:700;background:var(--surface2);border:2px solid var(--border);border-radius:8px;color:var(--accent);outline:none;text-transform:uppercase;
}

@media (max-width: 627px) {
    .box-importx{
        width:18px;height:26px;text-align:center;font-family:monospace;font-size:13px;font-weight:700;background:var(--surface2);border:2px solid var(--border);border-radius:5px;color:var(--accent);outline:none;text-transform:uppercase;
    }
}


/* ── Light mode ── */
[data-theme="light"] {
  --bg: #F3F4F6;
  --surface: #FFFFFF;
  --surface2: #F9FAFB;
  --border: rgba(0,0,0,0.08);
  --border-hover: rgba(0,0,0,0.15);
  --text: #111827;
  --text-muted: #6B7280;
  --text-dim: #9CA3AF;
  --accent: #2563EB;
  --accent-glow: rgba(37,99,235,0.1);
  --accent2: #0891B2;
  --success: #059669;
  --orbit: rgba(37,99,235,0.05);
}
[data-theme="light"] body::before {
  background: radial-gradient(ellipse, rgba(37,99,235,0.04) 0%, transparent 70%);
}
[data-theme="light"] header.scrolled {
  background: rgba(243,244,246,0.9);
}
[data-theme="light"] .results-header {
  background: rgba(243,244,246,0.95);
}
[data-theme="light"] .spaces-main-header {
  background: rgba(243,244,246,0.95);
}
[data-theme="light"] #ai-text {
  color: rgba(17,24,39,0.85);
}
[data-theme="light"] .space-ai-answer {
  color: rgba(17,24,39,0.85);
}
[data-theme="light"] .space-ai-answer div {
  color: rgba(17,24,39,0.85);
}
[data-theme="light"] .modal-overlay {
  background: rgba(0,0,0,0.4);
}