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

:root {
    --bg: #09090b;
    --card: #18181b;
    --card-80: rgba(24, 24, 27, 0.8);
    --border: #27272a;
    --muted: #3f3f46;
    --muted-fg: #a1a1aa;
    --fg: #fafafa;
    --fg-dim: #d4d4d8;
    --accent: #a78bfa;
    --radius: 9999px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.page {
    width: 100%;
    max-width: 680px;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 30vh;
    min-height: 100vh;
}

/* ---- Dock ---- */
.dock-area {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.dock {
    position: relative;
}

/* Collapsed: round button */
.dock-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--fg);
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}
.dock-trigger:hover {
    background: var(--muted);
    transform: scale(1.05);
}

/* Expanded: pill input */
.dock-form {
    display: none;
    align-items: center;
    gap: 8px;
    height: 48px;
    width: 380px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card-80);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
    animation: expandIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes expandIn {
    from { width: 48px; opacity: 0; }
    to   { width: 380px; opacity: 1; }
}

.dock-form-icon {
    margin-left: 16px;
    color: var(--muted-fg);
    flex-shrink: 0;
}

.dock-form input {
    flex: 1;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--fg);
    font-size: 14px;
    font-family: inherit;
}
.dock-form input::placeholder { color: var(--muted-fg); }

.dock-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-right: 8px;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    color: var(--muted-fg);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.15s;
}
.dock-close:hover {
    background: var(--muted);
    transform: scale(1.1);
}

/* States */
.dock.expanded .dock-trigger { display: none; }
.dock.expanded .dock-form   { display: flex; }
.dock.collapsed .dock-trigger { display: flex; }
.dock.collapsed .dock-form   { display: none; }

/* Move dock up once results show */
.page.has-results { padding-top: 10vh; transition: padding-top 0.4s ease; }

/* ---- Loading ---- */
.loading {
    display: none;
    gap: 6px;
    justify-content: center;
    padding: 40px 0;
}
.loading.active { display: flex; }

.loading-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--muted-fg);
    animation: bounce 1.2s ease-in-out infinite;
}
.loading-dot:nth-child(2) { animation-delay: 0.15s; }
.loading-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-8px); opacity: 1; }
}

/* ---- Results ---- */
.results {
    display: none;
    width: 100%;
}
.results.active {
    display: block;
    animation: fadeUp 0.35s ease;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.result-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}

.result-explanation {
    color: var(--fg-dim);
    line-height: 1.7;
    font-size: 14px;
    margin-bottom: 16px;
}
.result-explanation strong { color: var(--fg); }

.result-explanation .inline-code {
    background: rgba(167, 139, 250, 0.12);
    color: var(--accent);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
}

/* Code blocks */
.code-block-wrapper {
    margin: 12px 0;
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--border);
}

.code-lang {
    font-size: 11px;
    color: var(--muted-fg);
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.copy-btn {
    font-family: inherit;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted-fg);
    cursor: pointer;
    transition: all 0.15s;
}
.copy-btn:hover { background: var(--muted); color: var(--fg); }
.copy-btn.copied { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.3); color: #6ee7b7; }

pre {
    margin: 0;
    background: #0c0c0e !important;
    padding: 16px !important;
    overflow-x: auto;
}

pre code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.65;
}

/* Error */
.error-message {
    background: rgba(239,68,68,0.06);
    border: 1px solid rgba(239,68,68,0.15);
    border-radius: 8px;
    padding: 16px;
    color: #fca5a5;
    font-size: 13px;
}

@media (max-width: 480px) {
    .dock-form { width: calc(100vw - 32px); }
    @keyframes expandIn {
        from { width: 48px; opacity: 0; }
        to   { width: calc(100vw - 32px); opacity: 1; }
    }
}
