:root {
    --cyan: #00E6FF;
    --blue: #007BFF;
    --dark-bg: #0B1220;
    --darker-bg: #121820;
    --light-gray: #E0E0E0;
    --muted: rgba(224, 224, 224, 0.65);
    --accent: #2F9BDE;
    --danger: #FF6B6B;
    --radius: 18px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top, var(--darker-bg), var(--dark-bg));
    color: var(--light-gray);
    font-family: 'Raleway', -apple-system, BlinkMacSystemFont, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
}

.page {
    width: 100%;
    max-width: 640px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.top-banner {
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.35);
    color: #FFB3B3;
    font-size: 0.8rem;
    padding: 0.5rem 0.9rem;
    border-radius: 12px;
    text-align: center;
}

.brand-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-header__avatar {
    font-size: 1.8rem;
}

.brand-header__title {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
}

.brand-header__subtitle {
    font-size: 0.8rem;
    color: var(--muted);
}

.chat-panel {
    background: rgba(18, 24, 32, 0.85);
    border: 1px solid rgba(0, 230, 255, 0.18);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    height: 70vh;
    max-height: 620px;
    overflow: hidden;
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.msg {
    max-width: 82%;
    padding: 0.6rem 0.9rem;
    border-radius: 16px;
    font-size: 0.92rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

.msg--bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    border-bottom-left-radius: 4px;
}

.msg--user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--cyan), var(--blue));
    color: var(--darker-bg);
    font-weight: 600;
    border-bottom-right-radius: 4px;
}

.msg--error {
    align-self: center;
    background: rgba(255, 107, 107, 0.12);
    color: #FFB3B3;
    font-size: 0.82rem;
}

.typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 0.6rem 0.9rem;
}

.typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cyan);
    opacity: 0.6;
    animation: bounce 1.2s infinite ease-in-out;
}

.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

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

.chat-input-row {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-input-row input {
    flex: 1;
    padding: 0.7rem 0.9rem;
    border-radius: 18px;
    border: 1px solid rgba(0, 230, 255, 0.25);
    background: var(--dark-bg);
    color: var(--light-gray);
    font-family: inherit;
    font-size: 0.92rem;
}

.chat-input-row input:focus {
    outline: none;
    border-color: var(--cyan);
}

.chat-input-row button {
    background: linear-gradient(135deg, var(--cyan), var(--blue));
    color: var(--darker-bg);
    border: none;
    border-radius: 18px;
    padding: 0 1.2rem;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
}

.chat-input-row button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.debug-panel {
    font-size: 0.75rem;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.debug-panel button {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--muted);
    border-radius: 10px;
    padding: 0.2rem 0.6rem;
    cursor: pointer;
    font-size: 0.72rem;
}

.debug-panel__stats {
    display: none;
    gap: 0.75rem;
    font-family: monospace;
}

.debug-panel__stats.is-visible {
    display: flex;
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    body { padding: 0.75rem; }
    .chat-panel { height: 78vh; }
    .msg { max-width: 90%; }
}
