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

:root {
    --bg: #0d0d0d;
    --surface: #141414;
    --surface-hover: #1a1a1a;
    --border: #2a2a2a;
    --border-hover: #3a3a3a;
    --text: #ececec;
    --text-dim: #999;
    --text-muted: #666;
    --white: #fff;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100dvh;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100%;
}

/* ---- Sidebar ---- */
#sidebar {
    width: 260px;
    background: #0a0a0a;
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 8px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
}

#sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 4px 10px;
}

#logo {
    height: 28px;
    width: auto;
}

#home-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 20px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
#home-link:hover { color: var(--text); background: var(--surface-hover); }

#disclaimer {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    padding: 8px 4px 0;
    line-height: 1.4;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

#new-chat {
    background: var(--white);
    color: #0d0d0d;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    font-weight: 550;
    cursor: pointer;
    transition: opacity 0.15s;
}
#new-chat:hover { opacity: 0.85; }

#history {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-item {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-dim);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s;
}
.chat-item:hover { background: var(--surface-hover); }
.chat-item.active { background: var(--surface); color: var(--text); }

/* ---- Main ---- */
#main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#chat {
    flex: 1;
    overflow-y: auto;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 768px;
    width: 100%;
    margin: 0 auto;
}

.message { line-height: 1.6; }

.message.user { text-align: right; }
.message.assistant { text-align: left; }

.bubble {
    display: inline-block;
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 15px;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: left;
    line-height: 1.6;
}

.message.user .bubble {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px 12px 4px 12px;
}

.message.assistant .bubble {
    background: transparent;
    padding-left: 0;
}

.cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background: var(--text);
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* ---- Input ---- */
#input-area {
    padding: 16px;
    display: flex;
    gap: 8px;
    max-width: 768px;
    width: 100%;
    margin: 0 auto;
}

#prompt {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s;
}
#prompt:focus { border-color: var(--border-hover); }
#prompt::placeholder { color: var(--text-muted); }

#send {
    background: var(--white);
    color: #0d0d0d;
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 550;
    cursor: pointer;
    transition: opacity 0.15s;
}
#send:hover { opacity: 0.85; }
#send:disabled { opacity: 0.35; cursor: default; }

/* ---- Input controls row ---- */
#input-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

#thinking-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-dim);
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 8px;
    transition: background 0.15s;
    user-select: none;
    white-space: nowrap;
}
#thinking-label:hover { background: var(--surface-hover); }
#thinking-label input { accent-color: var(--white); }

/* ---- Queue info banner ---- */
#queue-info {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    padding: 0 16px 8px;
    min-height: 20px;
}
#queue-info.visible {
    color: #f0a030;
}

/* ---- Thinking window (minimal, no box, bottom fade) ---- */
.think-container {
    margin-bottom: 12px;
}

.think-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
    font-family: 'Consolas', 'Courier New', monospace;
}

.think-window {
    max-height: 180px;
    min-height: 32px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.55;
    color: #999;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'Consolas', 'Courier New', monospace;
    scroll-behavior: auto;
    -webkit-mask-image: linear-gradient(to bottom, black 65%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 65%, transparent 100%);
}

.think-window::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.response-text {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
}
