:root {
    --bg-gradient-start: #050816;
    --bg-gradient-end: #0b1220;
    --accent: #38bdf8;
    --accent-soft: rgba(56, 189, 248, 0.15);
    --accent-strong: rgba(56, 189, 248, 0.35);
    --card-bg: rgba(15, 23, 42, 0.92);
    --card-border: rgba(148, 163, 184, 0.3);
    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --danger: #f97373;
}

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

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at top left, #1d2347 0, transparent 55%),
        radial-gradient(circle at bottom right, #0f766e 0, transparent 55%),
        linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    color: var(--text-main);
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    overflow-x: hidden;
}

.floating-orbit {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.floating-orbit::before,
.floating-orbit::after {
    content: "";
    position: absolute;
    width: 520px;
    height: 520px;
    border-radius: 999px;
    background: conic-gradient(
        from 140deg,
        rgba(56, 189, 248, 0.7),
        transparent 40%,
        rgba(147, 197, 253, 0.6)
    );
    filter: blur(20px);
    opacity: 0.15;
    animation: slow-orbit 26s linear infinite;
}

.floating-orbit::before {
    top: -160px;
    left: -120px;
}

.floating-orbit::after {
    bottom: -180px;
    right: -140px;
    animation-direction: reverse;
}

@keyframes slow-orbit {
    from {
        transform: rotate(0deg) translate3d(0, 0, 0);
    }
    to {
        transform: rotate(360deg) translate3d(0, 0, 0);
    }
}

.shell {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 960px;
    padding: 24px;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-logo {
    width: 40px;
    height: 40px;
    border-radius: 16px;
    background:
        radial-gradient(circle at 30% 20%, #e0f2fe 0, transparent 55%),
        radial-gradient(circle at 70% 80%, #38bdf8 0, transparent 55%),
        radial-gradient(circle at 70% 30%, #22c55e 0, transparent 45%);
    position: relative;
    box-shadow:
        0 0 0 1px rgba(15, 23, 42, 0.9),
        0 0 30px rgba(56, 189, 248, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ai-logo::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 10%, rgba(15, 23, 42, 0.4), transparent 45%);
    mix-blend-mode: multiply;
}

.ai-logo::after {
    content: "AI";
    position: relative;
    font-family: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
    font-weight: 600;
    letter-spacing: 0.1em;
    font-size: 13px;
    color: #0f172a;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.7),
        0 0 14px rgba(15, 23, 42, 0.35);
}

.brand-text-title {
    font-family: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.brand-text-sub {
    font-size: 13px;
    color: var(--text-muted);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background:
        radial-gradient(circle at top left, rgba(45, 212, 191, 0.25), transparent),
        rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.8);
    font-size: 12px;
    color: var(--text-muted);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.9);
}

.card {
    position: relative;
    border-radius: 26px;
    padding: 22px 22px 18px;
    background:
        radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.25), transparent 55%),
        radial-gradient(circle at 100% 0%, rgba(59, 130, 246, 0.35), transparent 60%),
        var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow:
        0 24px 80px rgba(15, 23, 42, 0.95),
        0 0 0 1px rgba(15, 23, 42, 0.9),
        0 0 40px rgba(56, 189, 248, 0.3);
    backdrop-filter: blur(24px) saturate(140%);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 140px);
}

.card::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: radial-gradient(circle at top center, rgba(15, 23, 42, 0.4), transparent 60%);
    mix-blend-mode: soft-light;
    opacity: 0.8;
    pointer-events: none;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.card-title-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-title {
    font-size: 16px;
    font-weight: 500;
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.chip {
    font-size: 11px;
    padding: 5px 9px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chip-glow {
    background:
        radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.3), transparent 55%),
        rgba(15, 23, 42, 0.86);
    color: #e0f2fe;
    border-color: rgba(56, 189, 248, 0.6);
}

.chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.8);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.8);
}

.chat-window {
    flex: 1;
    min-height: 0;
    border-radius: 18px;
    padding: 14px 14px 10px;
    background: radial-gradient(circle at 0 0, rgba(15, 23, 42, 0.85), rgba(15, 23, 42, 0.98));
    border: 1px solid rgba(31, 41, 55, 0.9);
    box-shadow: inset 0 1px 0 rgba(249, 250, 251, 0.02);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-log {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 10px;
}

.message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.message-avatar {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background:
        radial-gradient(circle at 30% 20%, #e0f2fe 0, transparent 55%),
        radial-gradient(circle at 70% 80%, #38bdf8 0, transparent 60%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    font-family: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
    color: #0f172a;
    box-shadow:
        0 0 0 1px rgba(15, 23, 42, 0.9),
        0 0 16px rgba(56, 189, 248, 0.6);
}

.message-avatar.user {
    background:
        radial-gradient(circle at 30% 20%, #fed7aa 0, transparent 55%),
        radial-gradient(circle at 70% 80%, #fb923c 0, transparent 60%);
    color: #7c2d12;
}

.message-bubble {
    max-width: 100%;
    border-radius: 16px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.45;
    background: rgba(31, 41, 55, 0.95);
    border: 1px solid rgba(55, 65, 81, 0.7);
}

.message-bubble.assistant {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.98));
    border-color: rgba(56, 189, 248, 0.55);
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.35);
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: rgba(148, 163, 184, 0.85);
    margin-top: 4px;
}

.typing-dot {
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.8);
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

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

.input-row {
    margin-top: 10px;
    padding: 10px;
    border-radius: 18px;
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.98));
    border: 1px solid rgba(31, 41, 55, 0.9);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-top-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.textarea-wrapper {
    flex: 1;
    position: relative;
}

textarea {
    width: 100%;
    min-height: 80px;
    max-height: 160px;
    resize: vertical;
    padding: 10px 12px 28px;
    border-radius: 14px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    outline: none;
    background: radial-gradient(circle at 0 0, rgba(15, 23, 42, 0.85), rgba(15, 23, 42, 0.98));
    color: var(--text-main);
    font-size: 13px;
    line-height: 1.4;
    font-family: inherit;
    box-shadow: inset 0 1px 0 rgba(249, 250, 251, 0.02);
    transition:
        border-color 0.14s ease,
        box-shadow 0.14s ease,
        background 0.16s ease;
}

textarea::placeholder {
    color: rgba(148, 163, 184, 0.9);
}

textarea:focus {
    border-color: rgba(56, 189, 248, 0.85);
    box-shadow:
        0 0 0 1px rgba(15, 23, 42, 1),
        0 0 0 1px rgba(56, 189, 248, 0.75),
        0 0 24px rgba(56, 189, 248, 0.55);
    background: radial-gradient(circle at 0 0, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 1));
}

.textarea-hint {
    position: absolute;
    bottom: 6px;
    right: 10px;
    font-size: 10px;
    color: rgba(148, 163, 184, 0.85);
}

button[type="submit"] {
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 999px;
    background:
        radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.45), transparent 60%),
        linear-gradient(135deg, #22d3ee, #3b82f6);
    color: #0f172a;
    font-size: 13px;
    font-weight: 600;
    font-family: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    box-shadow:
        0 12px 34px rgba(37, 99, 235, 0.65),
        0 0 0 1px rgba(15, 23, 42, 0.9);
    white-space: nowrap;
    min-width: 110px;
    transition:
        transform 0.1s ease,
        box-shadow 0.1s ease,
        filter 0.12s ease,
        background 0.12s ease;
}

button[type="submit"] .icon {
    font-size: 14px;
    transform: translateX(0);
    transition: transform 0.12s ease;
}

button[type="submit"]:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow:
        0 16px 40px rgba(37, 99, 235, 0.75),
        0 0 0 1px rgba(15, 23, 42, 0.9);
}

button[type="submit"]:hover .icon {
    transform: translateX(2px);
}

button[type="submit"]:active {
    transform: translateY(0);
    box-shadow:
        0 8px 22px rgba(37, 99, 235, 0.7),
        0 0 0 1px rgba(15, 23, 42, 0.9);
}

button[type="submit"]:disabled {
    cursor: default;
    opacity: 0.6;
    box-shadow:
        0 8px 18px rgba(15, 23, 42, 0.9),
        0 0 0 1px rgba(15, 23, 42, 0.9);
}

.input-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 11px;
    color: var(--text-muted);
}

.small-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(31, 41, 55, 0.95);
}

.kbd {
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid rgba(75, 85, 99, 0.9);
    background: rgba(17, 24, 39, 0.9);
    font-size: 10px;
    font-family: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
    color: rgba(209, 213, 219, 1);
}

.error-text {
    color: var(--danger);
}

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

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logout-link {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 8px;
    transition: color 0.15s ease, background 0.15s ease;
}

.logout-link:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
}

/* Login form */

.login-card {
    max-width: 400px;
    margin: 0 auto;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-error {
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(249, 115, 115, 0.15);
    border: 1px solid rgba(249, 115, 115, 0.4);
    color: var(--danger);
    font-size: 13px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.login-field input {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-main);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-field input:focus {
    border-color: rgba(56, 189, 248, 0.7);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.5);
}

.login-submit {
    margin-top: 4px;
    padding: 12px 20px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #22d3ee, #3b82f6);
    color: #0f172a;
    font-size: 14px;
    font-weight: 600;
    font-family: "Space Grotesk", system-ui, sans-serif;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.1s ease;
}

.login-submit:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.login-submit:active {
    transform: translateY(0);
}

/* Responsive adjustments */

@media (max-width: 768px) {
    body {
        align-items: flex-start;
        padding: 16px 10px 24px;
    }

    .shell {
        padding: 0;
        max-width: 100%;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 14px;
    }

    .header-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .login-card {
        max-width: 100%;
    }

    .card {
        padding: 14px 12px 12px;
        border-radius: 20px;
        max-height: none;
        height: auto;
    }

    .chat-window {
        max-height: 60vh;
    }

    .input-top-row {
        align-items: stretch;
    }

    button[type="submit"] {
        padding-inline: 12px;
        min-width: 96px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 12px 8px 20px;
    }

    .card {
        border-radius: 18px;
    }

    .chat-window {
        max-height: 55vh;
    }

    .header {
        gap: 8px;
    }

    .brand-text-title {
        font-size: 18px;
    }
}

