﻿:root {
    --bg: #fbfbfc;
    --panel: #ffffff;
    --panel-border: #e7e7eb;
    --text: #1f1f24;
    --muted: #73737d;
    --assistant: #ffffff;
    --user: #f1f1f4;
    --user-text: #1f1f24;
    --accent: #121214;
    --accent-soft: #2d2d33;
    --error: #b84f4a;
    --shadow: 0 18px 44px rgba(18, 18, 20, 0.06);
    --radius-lg: 4px;
    --radius-md: 4px;
    --content-width: 960px;
    --composer-width: 760px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, #ffffff 0%, #fafafd 100%);
}

a {
    color: inherit;
}

code {
    font-family: Consolas, "Courier New", monospace;
}

.site-header {
    height: 10px;
}

.site-footer,
.page-shell {
    width: min(calc(100% - 2rem), var(--content-width));
    margin: 0 auto;
}

.page-shell {
    min-height: 100vh;
    padding: 1.25rem 0 10.5rem;
}

.chat-stage {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.chat-stage.is-empty {
    min-height: calc(100vh - 12rem);
    justify-content: center;
}

.chat-stage:not(.is-empty) {
    padding-top: 0.5rem;
}

.hero-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.1rem;
    text-align: center;
}

.chat-stage:not(.is-empty) .hero-panel {
    gap: 0.9rem;
}

.hero-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.hero-logo-wrap {
    width: 52px;
    height: 52px;
    padding: 0.15rem;
    border: 1px solid var(--panel-border);
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(18, 18, 20, 0.05);
}

.hero-logo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.hero-title {
    max-width: 11ch;
    margin: 0;
    font-size: clamp(2.7rem, 8vw, 5rem);
    line-height: 0.94;
    letter-spacing: -0.07em;
    font-weight: 600;
}

.chat-stage:not(.is-empty) .hero-title {
    font-size: clamp(1.7rem, 3vw, 2.35rem);
}

.chat-card {
    position: relative;
    min-height: 46vh;
}

.chat-stage.is-empty .chat-card {
    min-height: 0;
}

.chat-messages {
    overflow-y: auto;
    padding: 0 0 11rem;
    scrollbar-width: thin;
    scrollbar-color: #d0d0d7 transparent;
}

.donation-cta {
    position: fixed;
    right: clamp(1rem, calc((100vw - var(--content-width)) / 2 + 1rem), 3rem);
    top: 10px;
    z-index: 30;
}

.donation-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.7rem 1rem;
    border: 1px solid rgba(18, 18, 20, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 14px 30px rgba(18, 18, 20, 0.08);
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    backdrop-filter: blur(10px);
    transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.donation-button:hover {
    transform: translateY(-1px);
    background: #ffffff;
    box-shadow: 0 18px 34px rgba(18, 18, 20, 0.12);
}

.donation-button:focus-visible {
    outline: 2px solid #121214;
    outline-offset: 3px;
}

.chat-stage.is-empty .chat-messages {
    display: none;
}

.chat-messages::-webkit-scrollbar {
    width: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #d0d0d7;
    border-radius: 999px;
}

.message {
    display: flex;
    margin-bottom: 1rem;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 220ms ease, transform 220ms ease;
}

.message.is-entering {
    opacity: 0;
    transform: translateY(10px);
}

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

.message-assistant {
    justify-content: flex-start;
}

.message-bubble {
    max-width: min(84%, 46rem);
    padding: 1rem 1.1rem;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    background: var(--assistant);
}

.message-user .message-bubble {
    background: var(--user);
    color: var(--user-text);
}

.message-error .message-bubble {
    color: var(--error);
    background: #fff5f4;
}

.message-bubble p {
    margin: 0;
    line-height: 1.72;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-bubble h3 {
    margin: 0 0 0.45rem;
    font-size: 1rem;
    line-height: 1.35;
    letter-spacing: -0.02em;
}

.message-bubble p + h3,
.message-bubble ul + h3,
.message-bubble h3 + p,
.message-bubble p + ul {
    margin-top: 0.85rem;
}

.message-bubble ul {
    margin: 0;
    padding-left: 1.15rem;
}

.message-bubble li {
    margin: 0.35rem 0 0;
    line-height: 1.65;
}

.message-bubble li:first-child {
    margin-top: 0;
}

.message-bubble strong {
    font-weight: 700;
}

.message-bubble em {
    font-style: italic;
}

.typing-indicator {
    position: fixed;
    left: 50%;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
    z-index: 999;
    width: min(calc(100% - 2rem), 30rem);
}

.thinking-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    padding: 1rem 1.1rem;
    border: 1px solid #d9d9e2;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 20px 48px rgba(18, 18, 20, 0.12);
}

.thinking-loader {
    position: relative;
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
}

.thinking-ring,
.thinking-core {
    position: absolute;
    inset: 0;
    border-radius: 50%;
}

.thinking-ring {
    border: 3px solid rgba(18, 18, 20, 0.08);
    border-top-color: rgba(18, 18, 20, 0.95);
    animation: spin 1s linear infinite;
}

.thinking-ring-b {
    inset: 8px;
    animation-direction: reverse;
    animation-duration: 1.35s;
}

.thinking-core {
    inset: 18px;
    background: radial-gradient(circle, #141417 0%, #303036 100%);
    box-shadow: 0 0 0 10px rgba(18, 18, 20, 0.05);
    animation: pulse-core 1.6s ease-in-out infinite;
}

.thinking-title {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.chat-composer {
    position: fixed;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    z-index: 40;
    width: min(calc(100% - 2rem), var(--composer-width));
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 0.72rem 0.9rem;
    border: 1px solid var(--panel-border);
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow);
}

.chat-composer textarea {
    width: 100%;
    min-height: 40px;
    max-height: 170px;
    resize: none;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 1rem;
    line-height: 1.45;
}

.chat-composer textarea::placeholder {
    color: #8b8b96;
}

.composer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.chat-stage.is-empty .chat-composer {
    padding: 0.62rem 0.85rem;
    border-radius: 24px;
}

.chat-stage.is-empty .chat-composer textarea {
    min-height: 32px;
    font-size: 0.98rem;
    line-height: 1.35;
}

.composer-note {
    margin: 0;
    color: var(--muted);
    font-size: 1.2rem;
    line-height: 1;
}

.composer-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.chat-composer button {
    border: none;
    border-radius: 999px;
    background: var(--accent);
    color: #ffffff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 180ms ease, opacity 180ms ease, transform 180ms ease;
}

.chat-composer button:hover:not(:disabled) {
    background: var(--accent-soft);
    transform: translateY(-1px);
}

.chat-composer button:disabled {
    opacity: 0.55;
    cursor: wait;
    transform: none;
}

.button-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.2rem;
}

.thinking-copy p {
    margin: 0;
}

.chat-composer .button-secondary {
    border: 1px solid var(--panel-border);
    background: transparent;
    color: var(--text);
}

.chat-composer .button-secondary:hover:not(:disabled) {
    background: #f5f5f7;
}

.site-footer {
    padding: 0.2rem 0 1rem;
}

.site-footer p {
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
    text-align: center;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

@keyframes pulse-core {
    0%,
    100% {
        transform: scale(0.92);
        opacity: 0.88;
    }

    50% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 720px) {
    .page-shell {
        padding-bottom: 10rem;
    }

    .hero-title {
        max-width: 10ch;
        font-size: clamp(2.2rem, 12vw, 3.5rem);
    }

    .typing-indicator {
        top: 50%;
        width: min(calc(100% - 1.5rem), 28rem);
    }

    .thinking-panel,
    .composer-bar {
        align-items: center;
    }

    .message-bubble {
        max-width: 92%;
    }

    .donation-cta {
        right: 1rem;
        bottom: 6.3rem;
    }

    .donation-button {
        min-height: 40px;
        padding: 0.68rem 0.9rem;
        font-size: 0.88rem;
    }
}
