:root {
    --bg: #0a0a0c;
    --bg2: #111115;
    --bg3: #1a1a20;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-g: rgba(99, 102, 241, 0.12);
    --text: #e8e8ed;
    --text2: #8888a0;
    --text3: #55556a;
    --border: #2a2a32;
    --border-s: #1e1e26;
    --green: #34d399;
    --mono: 'JetBrains Mono', 'Fira Code', monospace;
    --sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Page container ── */
.page {
    height: 100vh;
    height: 100dvh;
    max-width: 640px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    background-image:
        radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
}

/* ── Scroll area ── */
.scroll-area {
    height: 100%;
    overflow-y: auto;
    scrollbar-width: none;
    display: flex;
    flex-direction: column;
}

.scroll-area::-webkit-scrollbar {
    display: none;
}

/* ── Logo bar ── */
.logo-bar {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    padding: 16px 0 0;
}

.logo-mark {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

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

.logo-text {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text2);
    letter-spacing: 0.08em;
}

.logo-text b {
    color: var(--accent);
    font-weight: 500;
}

/* ── Availability banner ── */
.avail-banner {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 12px 24px 0;
    padding: 10px 16px;
    background: var(--bg2);
    border: 1px solid var(--border-s);
    border-radius: 100px;
}

.avail-left {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--green);
    font-family: var(--mono);
}

.avail-dot {
    width: 7px;
    height: 7px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--green);
}

.avail-divider {
    width: 1px;
    height: 16px;
    background: var(--border);
}

.avail-right {
    font-size: 12px;
    color: var(--text2);
    display: flex;
    align-items: center;
    gap: 4px;
}

.avail-right svg {
    width: 14px;
    height: 14px;
    color: var(--text3);
}

/* ── Status indicator (chat mode) ── */
.status-ind {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 10px;
    color: var(--green);
    font-family: var(--mono);
    flex-shrink: 0;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s, opacity 0.4s, padding 0.4s;
    padding: 0;
}

.status-ind.visible {
    max-height: 30px;
    opacity: 1;
    padding: 8px;
}

.s-dot {
    width: 5px;
    height: 5px;
    background: var(--green);
    border-radius: 50%;
}

/* ── Top spacer ── */
.top-spacer {
    flex-shrink: 0;
    transition: height 0.5s ease;
}

/* ── Hero ── */
.hero {
    flex-shrink: 0;
    text-align: center;
    padding: 0 24px 12px;
}

.tagline {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.2;
}

.subtitle {
    font-size: 13px;
    color: var(--text3);
}

/* ── Input container ── */
.input-container {
    flex-shrink: 0;
    padding: 4px 16px 12px;
}

.input-container.docked {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: var(--bg);
    border-top: 1px solid var(--border-s);
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

.input-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-field {
    flex: 1;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    font-family: var(--sans);
    font-size: 14px;
    color: var(--text);
    outline: none;
    min-height: 44px;
    transition: border-color 0.2s ease;
}

.input-field::placeholder {
    color: var(--text3);
}

.input-field:focus {
    border-color: var(--accent);
}

.input-field:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-btn {
    width: 44px;
    height: 44px;
    background: var(--accent);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.4;
    transition: opacity 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.send-btn svg {
    width: 18px;
    height: 18px;
    color: white;
}

.send-btn.active {
    opacity: 1;
}

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

/* ── Categories ── */
.categories {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 4px 24px 12px;
    flex-shrink: 0;
    transition: opacity 0.3s, max-height 0.4s, padding 0.4s;
    overflow: hidden;
}

.categories.hidden {
    opacity: 0;
    max-height: 0;
    padding: 0;
    pointer-events: none;
}

.cat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 68px;
    padding: 10px 6px;
    border: 1px solid var(--border-s);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text2);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.15s;
    font-family: var(--sans);
    font-size: 10px;
}

.cat-card:active {
    background: var(--bg3);
    transform: scale(0.95);
}

.cat-card svg {
    width: 22px;
    height: 22px;
}

/* ── Examples ── */
.examples {
    flex-shrink: 0;
    padding: 8px 20px 20px;
    transition: opacity 0.3s, max-height 0.4s, padding 0.4s;
    overflow: hidden;
}

.examples.hidden {
    opacity: 0;
    max-height: 0;
    padding: 0;
    pointer-events: none;
}

.examples-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.examples-label {
    font-size: 10px;
    color: var(--text3);
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.refresh-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-s);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text3);
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s;
}

.refresh-btn:active {
    color: var(--accent);
    border-color: var(--accent);
    transform: rotate(180deg);
}

.refresh-btn svg {
    width: 14px;
    height: 14px;
}

.example-chips {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    transition: opacity 0.2s;
}

.example-chips.fading {
    opacity: 0;
}

.example-chip {
    padding: 7px 12px;
    border: 1px solid var(--border-s);
    border-radius: 100px;
    font-size: 11px;
    color: var(--text3);
    background: transparent;
    cursor: pointer;
    font-family: var(--sans);
    -webkit-tap-highlight-color: transparent;
    transition: all 0.15s;
}

.example-chip:active {
    background: var(--bg3);
    color: var(--text2);
}

/* ── Bottom fill (centering spacer) ── */
.bottom-fill {
    flex: 1;
    min-height: 0;
}

/* ── Messages ── */
.messages {
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-shrink: 0;
}

.msg {
    animation: msgIn 0.3s ease;
}

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

.msg.user {
    align-self: flex-end;
    max-width: 80%;
}

.msg.user .bubble {
    background: var(--bg3);
    border-radius: 16px 16px 4px 16px;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text);
    word-break: break-word;
    white-space: pre-wrap;
}

.msg.assistant {
    align-self: flex-start;
    max-width: 88%;
}

.msg-label {
    font-size: 10px;
    font-family: var(--mono);
    color: var(--accent);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.msg.assistant .msg-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    word-break: break-word;
    white-space: pre-wrap;
}

/* ── Option buttons ── */
.options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    animation: fadeIn 0.3s ease;
}

.opt-btn {
    padding: 8px 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 13px;
    color: var(--text);
    background: transparent;
    cursor: pointer;
    font-family: var(--sans);
    -webkit-tap-highlight-color: transparent;
    transition: all 0.15s;
}

.opt-btn:active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.opt-btn.chosen {
    background: var(--accent-g);
    border-color: var(--accent);
    color: var(--accent);
    pointer-events: none;
}

.opt-btn.dimmed {
    opacity: 0.3;
    pointer-events: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ── Typing indicator ── */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--text3);
    border-radius: 50%;
    animation: bounce 1.4s infinite;
}

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

@keyframes bounce {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

/* ── Scrollbar (desktop) ── */
@media (min-width: 768px) {
    .scroll-area {
        scrollbar-width: thin;
        scrollbar-color: var(--border) transparent;
    }

    .scroll-area::-webkit-scrollbar {
        display: block;
        width: 6px;
    }

    .scroll-area::-webkit-scrollbar-track {
        background: transparent;
    }

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

    .page {
        border-left: 1px solid var(--border-s);
        border-right: 1px solid var(--border-s);
    }

    .tagline {
        font-size: 28px;
    }

    .subtitle {
        font-size: 14px;
    }

    .cat-card {
        width: 76px;
        padding: 12px 8px;
    }

    .cat-card:hover {
        background: var(--bg3);
        color: var(--text);
    }

    .example-chip:hover {
        background: var(--bg3);
        color: var(--text2);
    }

    .opt-btn:not(.chosen):not(.dimmed):hover {
        border-color: var(--accent);
        color: var(--accent);
        background: var(--accent-g);
    }

    .refresh-btn:hover {
        color: var(--accent);
        border-color: var(--accent);
    }

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