@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@600;700&display=swap');

:root {
    --bg: #000000;
    --red: #e50914;
    --white: #ffffff;
    --panel: rgba(0, 0, 0, 0.8);
    --panel-border: rgba(255, 255, 255, 0.24);
    --panel-soft: rgba(255, 255, 255, 0.08);
    --muted: rgba(255, 255, 255, 0.75);
    --glow: 0 0 24px rgba(229, 9, 20, 0.35);
}

html, body {
    margin: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    color: var(--white);
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.bg-anim {
    position: fixed;
    inset: -20%;
    background: radial-gradient(60% 60% at 20% 30%, rgba(229, 9, 20, 0.18), transparent 60%),
                radial-gradient(50% 50% at 80% 70%, rgba(229, 9, 20, 0.12), transparent 60%);
    filter: blur(30px);
    animation: drift 18s ease-in-out infinite;
    z-index: 0;
}

.decor {
    position: fixed;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    border: 2px solid rgba(229, 9, 20, 0.35);
    box-shadow: 0 0 60px rgba(229, 9, 20, 0.28), inset 0 0 30px rgba(229, 9, 20, 0.2);
    z-index: 0;
    opacity: 0.9;
    animation: float 10s ease-in-out infinite;
}

.decor-left {
    left: -140px;
    top: 120px;
}

.decor-right {
    right: -160px;
    bottom: 80px;
    animation-delay: 1.5s;
}

.rings {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    animation: ringDrift 22s ease-in-out infinite;
}

.rings::before,
.rings::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(229, 9, 20, 0.32);
    box-shadow: 0 0 40px rgba(229, 9, 20, 0.22);
    animation: ringFloat 14s ease-in-out infinite;
}

.rings::before {
    width: 360px;
    height: 360px;
    left: 4%;
    top: 8%;
}

.rings::after {
    width: 500px;
    height: 500px;
    right: 6%;
    bottom: 6%;
    animation-delay: 2.5s;
}

.dots {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
        radial-gradient(rgba(229, 9, 20, 0.16) 1.5px, transparent 1.5px);
    background-size: 36px 36px, 72px 72px;
    background-position: 0 0, 18px 18px;
    opacity: 0.7;
    animation: dotDrift 16s linear infinite;
}

.app {
    position: relative;
    width: min(1400px, 97vw);
    height: min(94vh, 980px);
    max-height: 94vh;
    padding: clamp(22px, 2.4vw, 34px);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 18px;
    z-index: 1;
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(11, 11, 11, 0.78), rgba(0, 0, 0, 0.84));
    backdrop-filter: blur(5px);
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(229, 9, 20, 0.15);
    overflow: hidden;
}

.title {
    font-size: clamp(34px, 4.4vw, 60px);
    letter-spacing: 1.5px;
    color: var(--red);
    text-align: left;
    margin: 0;
    line-height: 1;
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 700;
    opacity: 0;
    transform: translateY(-20px);
    animation: fadeSlideIn 0.7s ease-out forwards;
}

.subtitle {
    margin: -8px 0 4px;
    color: var(--muted);
    font-size: clamp(14px, 1.6vw, 18px);
    font-weight: 500;
    letter-spacing: 0.2px;
    opacity: 0;
    transform: translateY(-10px);
    animation: fadeSlideIn 0.7s ease-out 0.08s forwards;
}

.prompt-input {
    width: 100%;
    height: 56px;
    background: rgba(0, 0, 0, 0.72);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    color: var(--white);
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 17px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    padding: 12px 16px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    opacity: 0;
    transform: translateY(12px);
    animation: fadeSlideIn 0.7s ease-out 0.15s forwards;
}

.prompt-input::placeholder {
    color: var(--muted);
}

.prompt-input:focus {
    border-color: rgba(229, 9, 20, 0.8);
    background: rgba(0, 0, 0, 0.88);
    box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.2);
}

.actions {
    display: flex;
    gap: 16px;
    opacity: 0;
    transform: translateY(12px);
    animation: fadeSlideIn 0.7s ease-out 0.25s forwards;
}

.btn {
    min-width: 124px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid var(--red);
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 700;
    font-size: 21px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
    box-shadow: 0 0 0 rgba(0,0,0,0);
    padding: 0 24px;
}

.btn-ask {
    background: var(--red);
    color: var(--white);
    box-shadow: var(--glow);
}

.btn-clear {
    background: rgba(255, 255, 255, 0.95);
    color: #111111;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.btn:active {
    transform: translateY(1px) scale(0.98);
}

.chat-history {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 16px;
    box-sizing: border-box;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    display: block;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeSlideIn 0.7s ease-out 0.35s forwards;
    scrollbar-width: thin;
    scrollbar-color: rgba(229, 9, 20, 0.8) rgba(255, 255, 255, 0.08);
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

@media (min-width: 1500px) {
    .app {
        width: min(1540px, 96vw);
        height: min(95vh, 1040px);
        max-height: 95vh;
        padding: 28px 34px;
    }

    .title {
        font-size: clamp(40px, 3.2vw, 64px);
    }

    .chat-history {
        padding: 18px;
    }

    .message {
        max-width: min(78%, 860px);
        font-size: 17px;
    }
}

.chat-history * {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

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

.chat-history::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
}

.chat-history::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(229, 9, 20, 0.95), rgba(140, 7, 12, 0.95));
    border-radius: 999px;
}

.message {
    width: fit-content;
    max-width: min(82%, 700px);
    padding: 12px 14px;
    margin: 10px 0;
    border-radius: 14px;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.55;
    background: rgba(16, 16, 16, 0.95);
    color: var(--white);
    border: 1px solid var(--panel-soft);
    word-break: break-word;
}

.response.message {
    margin-right: auto;
    display: inline-block;
    width: fit-content;
    max-width: calc(100% - 260px);
    padding: 16px 18px;
    line-height: 1.7;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
    border-color: rgba(255, 255, 255, 0.2);
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

.response.message.is-pending {
    min-width: 280px;
    border-color: rgba(229, 9, 20, 0.68);
    box-shadow: inset 0 0 0 1px rgba(229, 9, 20, 0.14);
}

.response.message.is-error {
    border-color: rgba(229, 9, 20, 0.92);
    color: rgba(255, 241, 241, 0.96);
}

.message-status {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 24px;
    color: var(--muted);
}

.message-status-label {
    font-weight: 600;
    letter-spacing: 0.2px;
}

.message-status-dots {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.message-status-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--red);
    opacity: 0.25;
    animation: statusPulse 1.2s ease-in-out infinite;
}

.message-status-dots span:nth-child(2) {
    animation-delay: 0.16s;
}

.message-status-dots span:nth-child(3) {
    animation-delay: 0.32s;
}

.response.message p {
    margin: 0 0 0.8rem;
}

.response.message p:last-child {
    margin-bottom: 0;
}

.response.message ul,
.response.message ol {
    margin: 0.15rem 0 0.95rem 1.35rem;
    padding-left: 1rem;
}

.response.message li {
    margin: 0 0 0.5rem;
    line-height: 1.65;
}

.response.message li:last-child {
    margin-bottom: 0;
}

.user.message {
    margin-left: auto;
    background: rgba(229, 9, 20, 0.14);
    border-color: rgba(229, 9, 20, 0.92);
    box-shadow: 0 0 0 1px rgba(229, 9, 20, 0.1) inset;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

.message-character {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-4%, 3%) scale(1.03); }
    100% { transform: translate(2%, -2%) scale(1); }
}

@keyframes float {
    0% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
    100% { transform: translateY(0); }
}

@keyframes ringFloat {
    0% { transform: translateY(0) scale(1); opacity: 0.8; }
    50% { transform: translateY(-16px) scale(1.03); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 0.85; }
}

@keyframes ringDrift {
    0% { transform: translate(0, 0); }
    50% { transform: translate(-12px, 8px); }
    100% { transform: translate(8px, -10px); }
}

@keyframes dotDrift {
    0% { transform: translate(0, 0); background-position: 0 0, 18px 18px; }
    100% { transform: translate(-40px, -20px); background-position: -60px -30px, -42px -12px; }
}

@keyframes fadeSlideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes statusPulse {
    0%, 80%, 100% {
        transform: translateY(0) scale(0.82);
        opacity: 0.25;
    }
    40% {
        transform: translateY(-2px) scale(1);
        opacity: 1;
    }
}

@media (max-width: 860px) {
    html, body {
        align-items: stretch;
        justify-content: stretch;
        overflow: auto;
    }

    .bg-anim,
    .decor,
    .rings,
    .dots {
        position: fixed;
    }

    .app {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 22px 14px 18px;
    }

    .actions {
        flex-wrap: wrap;
    }

    .btn {
        min-width: 130px;
        flex: 1;
    }

    .chat-history {
        min-height: 0;
    }

    .message {
        max-width: 90%;
        font-size: 15px;
    }

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

    .response.message.is-pending {
        min-width: 220px;
    }
}

