@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #fafafa;
    --bg-alt: #ffffff;
    --text: #111111;
    --text-dim: #555555;
    --text-muted: #999999;
    --border: #e0e0e0;
    --border-light: #f0f0f0;
    --accent: #f97316;
    --accent-hover: #ea580c;
    --nav-bg: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] {
    --bg: #0a0a0a;
    --bg-alt: #141414;
    --text: #f5f5f5;
    --text-dim: #a0a0a0;
    --text-muted: #666666;
    --border: #2a2a2a;
    --border-light: #1a1a1a;
    --nav-bg: rgba(10, 10, 10, 0.85);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

::selection {
    background: var(--accent);
    color: white;
}

a {
    color: var(--text);
    text-decoration: none;
}

a:hover {
    color: var(--accent);
}

.container {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 20px;
}

nav {
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 760px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
}

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

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-links a {
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--accent);
}

.theme-toggle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-alt);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--text);
}

.theme-toggle:hover {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: currentColor;
}

.sun-icon {
    display: block;
    stroke: var(--text);
    fill: none;
}

.moon-icon {
    display: none;
    fill: var(--text);
}

[data-theme="dark"] .sun-icon {
    display: none;
}

[data-theme="dark"] .moon-icon {
    display: block;
    fill: #f5f5f5;
}

[data-theme="dark"] .theme-toggle {
    border-color: #444;
    background: #222;
}

main {
    flex: 1;
}

.hero {
    padding: 50px 0 40px;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 6px;
    color: var(--text);
}

.hero .tagline {
    color: var(--text-dim);
    font-size: 1rem;
    margin-bottom: 28px;
}

.search-box {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    border: none;
    font-size: 1rem;
    color: var(--text);
    outline: none;
    background: transparent;
    font-family: inherit;
}

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

.search-controls {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
}

.depth-selector {
    width: 100%;
}

.depth-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 10px;
    display: block;
}

.depth-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.depth-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.depth-btn:hover {
    border-color: var(--text-muted);
    background: var(--bg-alt);
}

.depth-btn.active {
    border-color: var(--accent);
    background: rgba(249, 115, 22, 0.1);
}

.depth-icon {
    font-size: 1.2rem;
}

.depth-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

.depth-time {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.search-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.search-btn:hover {
    background: var(--accent-hover);
}

.search-btn:disabled {
    background: var(--border);
    cursor: not-allowed;
}

.progress-container {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 16px;
}

.progress-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.progress-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.connection-banner {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    padding: 12px 20px;
    z-index: 99;
    animation: slideDown 0.3s ease;
}

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

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

.connection-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    max-width: 760px;
    margin: 0 auto;
}

.connection-icon {
    font-size: 1.2rem;
}

.connection-text {
    font-size: 0.9rem;
    font-weight: 500;
}

.connection-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.retry-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.retry-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.progress-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.progress-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 300px;
    overflow-y: auto;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-dim);
    padding: 4px 0;
}

.step-icon {
    width: 18px;
    text-align: center;
    font-size: 0.75rem;
}

.step-icon.pending {
    color: var(--text-muted);
}

.step-icon.loading {
    color: var(--accent);
}

.step-icon.done {
    color: #22c55e;
}

.step-icon.error {
    color: #ef4444;
}

.step-text {
    flex: 1;
}

.step-text.active {
    color: var(--text);
    font-weight: 500;
}

.step-extra {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--border-light);
    padding: 2px 6px;
    border-radius: 4px;
}

.ai-answer {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.ai-answer-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin-bottom: 14px;
}

.markdown-body {
    color: var(--text-dim);
    line-height: 1.7;
    font-size: 0.95rem;
}

.markdown-body h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 20px 0 12px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.markdown-body h2 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 18px 0 10px;
    color: var(--text);
}

.markdown-body h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 14px 0 8px;
    color: var(--text);
}

.markdown-body p {
    margin-bottom: 12px;
}

.markdown-body ul,
.markdown-body ol {
    margin: 10px 0 10px 24px;
}

.markdown-body li {
    margin-bottom: 6px;
}

.markdown-body a {
    color: var(--accent);
    text-decoration: underline;
}

.markdown-body a:hover {
    color: var(--accent-hover);
}

.markdown-body strong {
    font-weight: 600;
    color: var(--text);
}

.markdown-body code {
    background: var(--border-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.markdown-body blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 14px;
    margin: 12px 0;
    color: var(--text-dim);
    font-style: italic;
}

.sources-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.sources-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.source-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: var(--text-dim);
    transition: border-color 0.2s;
    max-width: 300px;
    overflow: hidden;
}

.source-item:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.source-engine {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--border-light);
    padding: 2px 5px;
    border-radius: 3px;
    flex-shrink: 0;
}

.source-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.streaming-cursor {
    display: inline-block;
    color: var(--accent);
    animation: blink 0.8s infinite;
    font-weight: normal;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

.results-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.result-item {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}

.result-item:hover {
    border-color: var(--accent);
}

.result-engine {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--border-light);
    padding: 2px 6px;
    border-radius: 3px;
    margin-bottom: 5px;
}

.result-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.result-title a {
    color: var(--text);
}

.result-title a:hover {
    color: var(--accent);
}

.result-url {
    font-size: 0.8rem;
    color: var(--accent);
    margin-bottom: 5px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-snippet {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.5;
}

.about-hero {
    text-align: center;
    padding: 40px 0;
}

.about-hero h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.about-hero p {
    color: var(--text-dim);
    max-width: 500px;
    margin: 0 auto;
}

.creator-section {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 24px;
}

.creator-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.creator-avatar {
    width: 100px;
    height: 100px;
    border-radius: 16px;
    object-fit: cover;
}

.creator-info h2 {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.creator-role {
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 4px;
}

.creator-location {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.creator-bio {
    color: var(--text-dim);
    margin-bottom: 20px;
    line-height: 1.7;
}

.social-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--border-light);
    border-radius: 8px;
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.social-link:hover {
    background: var(--accent);
    color: #fff;
}

.social-link svg {
    width: 20px;
    height: 20px;
}

.support-section {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), rgba(251, 146, 60, 0.1));
    border: 1px solid rgba(249, 115, 22, 0.3);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
}

.support-section h2 {
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.support-section p {
    color: var(--text-dim);
    margin-bottom: 20px;
}

section {
    padding: 40px 0;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
}

.docs-content h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 28px;
    margin-bottom: 10px;
    color: var(--text);
}

.docs-content h2:first-child {
    margin-top: 0;
}

.docs-content p {
    color: var(--text-dim);
    margin-bottom: 12px;
}

.docs-content ul,
.docs-content ol {
    color: var(--text-dim);
    margin-left: 20px;
    margin-bottom: 12px;
}

.docs-content li {
    margin-bottom: 5px;
}

.docs-content code {
    background: var(--border-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.85rem;
    color: #c7254e;
}

[data-theme="dark"] .docs-content code {
    color: #ff6b9d;
}

.code-block {
    background: #1a1a1a;
    color: #e5e5e5;
    border-radius: 10px;
    padding: 16px 20px;
    margin: 12px 0;
    overflow-x: auto;
    font-family: 'SF Mono', Consolas, 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.7;
    white-space: pre;
    border: 1px solid #333;
}

[data-theme="dark"] .code-block {
    background: #0d0d0d;
    border-color: #222;
}

.disclaimer-box {
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.3);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 24px;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.disclaimer-box strong {
    color: var(--accent);
}

.params-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 20px;
    font-size: 0.85rem;
}

.params-table th,
.params-table td {
    padding: 10px 12px;
    text-align: left;
    border: 1px solid var(--border);
}

.params-table th {
    background: var(--bg-alt);
    font-weight: 600;
    color: var(--text);
}

.params-table td {
    color: var(--text-dim);
}

.params-table code {
    background: var(--border-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.8rem;
}

.api-endpoint {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.api-method {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.api-method.post {
    background: #22c55e;
    color: white;
}

.api-method.get {
    background: #3b82f6;
    color: white;
}

.api-path {
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.85rem;
}

.api-desc {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-top: 5px;
    margin-bottom: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
}

.btn-disabled {
    background: var(--border);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-disabled:hover {
    background: var(--border);
    transform: none;
}

footer {
    padding: 20px 0;
    border-top: 1px solid var(--border);
    margin-top: auto;
    background: var(--bg);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.footer-links {
    display: flex;
    gap: 18px;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-copy {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-copy a {
    color: var(--accent);
}

@media (max-width: 600px) {

    html,
    body {
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100vw;
    }

    body {
        padding-bottom: 150px !important;
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }

    html {
        height: -webkit-fill-available;
    }

    * {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .container {
        padding: 0 12px;
        max-width: 100%;
        overflow-x: hidden;
    }

    .hero h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .hero p {
        font-size: 0.9rem;
    }

    .creator-header {
        flex-direction: column;
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }

    .search-controls {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .depth-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .depth-btn {
        padding: 10px 6px;
    }

    .depth-name {
        font-size: 0.7rem;
    }

    .depth-time {
        font-size: 0.6rem;
    }

    .search-btn {
        width: 100%;
        padding: 14px;
    }

    .ai-answer {
        padding: 14px;
        border-radius: 10px;
        margin: 0 -4px 16px;
        width: calc(100% + 8px);
    }

    .ai-answer-label {
        font-size: 0.7rem;
    }

    .markdown-body {
        font-size: 0.9rem;
        line-height: 1.6;
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .markdown-body h1 {
        font-size: 1.2rem;
    }

    .markdown-body h2 {
        font-size: 1.05rem;
    }

    .markdown-body h3 {
        font-size: 0.95rem;
    }

    .markdown-body p {
        margin-bottom: 10px;
    }

    .markdown-body pre {
        overflow-x: auto;
        max-width: 100%;
        font-size: 0.75rem;
    }

    .markdown-body code {
        word-break: break-all;
    }

    .markdown-body a {
        word-break: break-all;
    }

    .result-item {
        padding: 12px;
        margin: 0 -4px 10px;
        width: calc(100% + 8px);
    }

    .result-title {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .result-title a {
        word-break: break-word;
    }

    .result-url {
        font-size: 0.7rem;
        max-width: 100%;
    }

    .result-snippet {
        font-size: 0.8rem;
        line-height: 1.5;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .result-engine {
        font-size: 0.6rem;
    }

    .progress-tracker {
        padding: 14px;
    }

    .progress-title {
        font-size: 0.8rem;
    }

    .progress-step {
        font-size: 0.8rem;
        padding: 6px 0;
    }

    .step-icon {
        width: 18px;
        height: 18px;
        font-size: 0.65rem;
    }

    .step-text {
        font-size: 0.8rem;
        max-width: calc(100% - 30px);
        word-break: break-word;
    }

    .sources-box {
        padding: 14px;
    }

    .source-item {
        font-size: 0.8rem;
        padding: 8px 10px;
    }

    .source-engine {
        font-size: 0.55rem;
    }

    .source-title {
        font-size: 0.8rem;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }

    .nav-links {
        gap: 8px;
    }

    .nav-links a {
        font-size: 0.75rem;
    }

    .logo {
        font-size: 1rem;
    }

    .logo-icon {
        width: 22px;
        height: 22px;
    }

    .theme-toggle {
        width: 32px;
        height: 32px;
    }

    footer {
        padding: 30px 0 120px;
        margin-bottom: 0;
        padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
    }

    main {
        padding-bottom: 60px;
    }

    .section-title {
        font-size: 1.3rem;
    }

    .docs-content {
        font-size: 0.9rem;
    }

    .docs-content h2 {
        font-size: 1.1rem;
    }

    .code-block {
        font-size: 0.7rem;
        padding: 12px;
        overflow-x: auto;
    }

    .api-endpoint {
        flex-wrap: wrap;
        gap: 6px;
    }

    .api-path {
        font-size: 0.75rem;
        word-break: break-all;
    }

    .params-table {
        font-size: 0.75rem;
        display: block;
        overflow-x: auto;
    }

    .params-table th,
    .params-table td {
        padding: 8px 6px;
    }

    .disclaimer-box {
        padding: 12px;
        font-size: 0.85rem;
    }
}