/* Conversation content. The page stays quiet; content carries the hierarchy. */
.chat-main {
    position: relative;
    display: flex;
    min-width: 0;
    height: 100vh;
    height: 100dvh;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-main);
}

.messages-container {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    overflow-y: auto;
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
}

.chat-scroll-inner {
    display: flex;
    width: min(100%, 768px);
    min-height: 100%;
    flex: 1;
    flex-direction: column;
    gap: 28px;
    margin: 0 auto;
    padding: 36px 20px 156px;
}

.welcome-screen {
    width: 100%;
    max-width: 720px;
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: auto;
    padding: 42px 0 66px;
    animation: welcome-in 260ms ease-out;
}

@keyframes welcome-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero-avatar {
    width: 44px;
    height: 44px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--accent);
    color: #fff;
    font-size: 21px;
    box-shadow: 0 10px 24px rgba(15, 143, 112, 0.2);
}

.welcome-screen h1 {
    color: var(--text-main);
    font-size: clamp(25px, 3vw, 32px);
    font-weight: 650;
    letter-spacing: -0.045em;
    text-align: center;
}

.welcome-screen p {
    margin-top: 9px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

.quick-prompts-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 32px;
}

.prompt-chip {
    position: relative;
    min-height: 108px;
    padding: 15px 39px 14px 15px;
    border: 1px solid var(--border-color);
    border-radius: 13px;
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
    text-align: left;
    transition: border-color 130ms ease, background-color 130ms ease, transform 130ms ease;
}

.prompt-chip::after {
    position: absolute;
    right: 15px;
    bottom: 13px;
    color: var(--text-subtle);
    content: "↗";
    font-size: 16px;
    transition: transform 130ms ease, color 130ms ease;
}

.prompt-chip:hover {
    border-color: var(--border-strong);
    background: var(--bg-hover);
}

.prompt-chip:hover::after {
    color: var(--text-main);
    transform: translate(2px, -2px);
}

.chip-icon { display: none; }
.chip-content { display: block; }

.chip-title {
    color: var(--text-main);
    font-size: 13px;
    font-weight: 550;
    line-height: 1.35;
}

.chip-desc {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.45;
}

.message-row {
    display: flex;
    width: 100%;
    gap: 12px;
    animation: message-in 180ms ease-out;
}

@keyframes message-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-row.user { justify-content: flex-end; }

.avatar {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 50%;
    font-size: 11px;
}

.assistant .avatar {
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    box-shadow: 0 2px 6px rgba(15, 143, 112, 0.2);
}

.user .avatar {
    background: var(--bg-active);
    color: var(--text-muted);
}

.bubble-wrapper {
    min-width: 0;
    max-width: calc(100% - 40px);
    flex: 1;
}

.user .bubble-wrapper {
    max-width: min(82%, 560px);
    flex: 0 1 auto;
}

.bubble {
    overflow-wrap: anywhere;
    font-size: 14px;
    line-height: 1.7;
}

.user .bubble {
    padding: 10px 14px;
    border-radius: 18px;
    background: var(--user-bubble-bg);
    color: var(--user-bubble-text);
}

.assistant .bubble {
    padding-top: 2px;
    color: var(--assistant-text);
}

.reasoning-accordion {
    overflow: hidden;
    margin: 0 0 13px;
    border: 1px solid var(--reasoning-border);
    border-left: 4px solid var(--accent);
    border-radius: 9px;
    background: var(--reasoning-bg);
}

.reasoning-accordion summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 10px 10px;
    color: var(--accent-hover);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 650;
    list-style: none;
}

.reasoning-accordion summary::-webkit-details-marker { display: none; }
.summary-left { display: flex; align-items: center; gap: 7px; }
.summary-left::before {
    display: inline-flex;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    background: var(--accent);
    color: #fff;
    content: "✦";
    font-size: 10px;
}
.chevron-icon { color: var(--text-subtle); font-size: 10px; transition: transform 150ms ease; }
.reasoning-accordion[open] .chevron-icon { transform: rotate(180deg); }

.thinking-pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: thinking-pulse 1.2s ease-in-out infinite;
}

@keyframes thinking-pulse { 50% { opacity: 0.3; transform: scale(0.75); } }

.reasoning-content {
    margin-left: 10px;
    padding: 0 12px 12px 0;
    color: var(--reasoning-text);
    font-size: 12.5px;
    line-height: 1.7;
}

.reasoning-content p { margin-bottom: 8px; }
.reasoning-content p:last-child { margin-bottom: 0; }

.typing-cursor {
    display: inline-block;
    width: 5px;
    height: 16px;
    margin-left: 3px;
    border-radius: 2px;
    background: var(--text-main);
    vertical-align: -3px;
    animation: cursor-blink 850ms step-end infinite;
}

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

.assistant-action-bar {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 10px;
    color: var(--text-subtle);
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 7px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-subtle);
    cursor: pointer;
    font-size: 11px;
    transition: background-color 120ms ease, color 120ms ease;
}

.action-btn:hover { background: var(--bg-hover); color: var(--text-main); }

.message-metrics-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-left: 3px;
    color: var(--text-subtle);
    font-size: 10px;
}

.message-metrics-badge strong { color: var(--text-muted); font-weight: 500; }

.assistant .bubble p { margin-bottom: 12px; }
.assistant .bubble p:last-child { margin-bottom: 0; }
.assistant .bubble h1,
.assistant .bubble h2,
.assistant .bubble h3,
.assistant .bubble h4 { margin: 18px 0 8px; color: var(--text-main); font-weight: 650; line-height: 1.35; }
.assistant .bubble h1 { font-size: 21px; }
.assistant .bubble h2 { font-size: 18px; }
.assistant .bubble h3 { font-size: 16px; }
.assistant .bubble ul,
.assistant .bubble ol { margin: 8px 0 12px 22px; }
.assistant .bubble li { margin-bottom: 4px; }
.assistant .bubble blockquote { margin: 12px 0; padding-left: 12px; border-left: 3px solid var(--border-strong); color: var(--text-muted); }
.assistant .bubble table { width: 100%; margin: 14px 0; border-collapse: collapse; font-size: 13px; }
.assistant .bubble th,
.assistant .bubble td { padding: 8px 10px; border: 1px solid var(--border-color); text-align: left; }
.assistant .bubble th { background: var(--bg-hover); font-weight: 600; }

.code-block-wrapper {
    overflow: hidden;
    margin: 14px 0;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--code-bg);
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--code-header-bg);
    color: #b4b4b4;
    font-family: var(--font-mono);
    font-size: 11px;
}

.copy-code-btn {
    border: 0;
    border-radius: 5px;
    padding: 4px 7px;
    background: transparent;
    color: #d4d4d4;
    cursor: pointer;
    font-size: 10px;
}

.copy-code-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.bubble pre {
    overflow-x: auto;
    margin: 0;
    padding: 13px 14px;
    background: transparent;
    color: var(--code-text);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.65;
}

.bubble code {
    border-radius: 4px;
    padding: 2px 4px;
    background: var(--bg-hover);
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.bubble pre code { padding: 0; background: transparent; color: inherit; }
.generation-note { margin-top: 12px; color: var(--text-muted); font-size: 12px; }
.generation-error { color: #dc2626; }
