@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;500;700&family=Creepster&display=swap");

:root {
    --bg: radial-gradient(circle at 20% 20%, rgba(255, 145, 0, 0.12), transparent 60%),
          radial-gradient(circle at 80% 0%, rgba(102, 0, 204, 0.16), transparent 60%),
          linear-gradient(180deg, #060014 0%, #0f0324 55%, #05000f 100%);
    --panel: rgba(16, 9, 28, 0.82);
    --panel-strong: rgba(24, 10, 42, 0.92);
    --border: rgba(255, 112, 36, 0.4);
    --border-strong: rgba(255, 112, 36, 0.6);
    --accent: #7c3aed;
    --primary: #ff6a1a;
    --primary-strong: #ff8642;
    --text: #f9f7ff;
    --muted: rgba(249, 247, 255, 0.65);
    --shadow: 0 35px 80px rgba(5, 0, 20, 0.8);
    --radius-lg: 26px;
    --radius-md: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    font-family: "Poppins", sans-serif;
    background: var(--bg);
    color: var(--text);
}

.chat-shell {
    width: min(640px, 100%);
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 34px 32px 30px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: radial-gradient(circle at top right, rgba(255, 112, 36, 0.18), transparent 65%) no-repeat,
                radial-gradient(circle at bottom left, rgba(124, 58, 237, 0.18), transparent 60%) no-repeat,
                var(--panel);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.chat-shell::before,
.chat-shell::after {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(255, 112, 36, 0.25), transparent 70%);
    filter: blur(6px);
    z-index: -1;
}

.chat-shell::before {
    top: -80px;
    right: -70px;
    transform: rotate(22deg);
}

.chat-shell::after {
    bottom: -80px;
    left: -90px;
    transform: rotate(-18deg);
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.chat-title h1 {
    font-family: "Creepster", cursive;
    font-size: 2.6rem;
    margin: 0;
    color: var(--primary);
    text-shadow: 0 0 18px rgba(255, 106, 26, 0.32);
    letter-spacing: 1px;
}

.glyph {
    font-size: 2rem;
    color: var(--accent);
}

#reset {
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 10px 18px;
    background: rgba(124, 58, 237, 0.15);
    color: var(--text);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, border 0.2s ease;
}

#reset:hover {
    border-color: rgba(124, 58, 237, 0.55);
    background: rgba(124, 58, 237, 0.25);
    transform: translateY(-1px);
}

.chat-history {
    flex: 1;
    min-height: 320px;
    max-height: 420px;
    overflow-y: auto;
    padding: 22px 20px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: var(--panel-strong);
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.12);
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
}

.chat-history[data-empty]:empty::after {
    content: attr(data-empty);
    color: var(--muted);
    text-align: center;
    font-size: 0.95rem;
}

.chat-line {
    display: grid;
    gap: 8px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(8, 4, 18, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 0 0 1px rgba(91, 44, 255, 0.12);
    line-height: 1.6;
    animation: fadeIn 0.2s ease;
}

.chat-line--user {
    background: rgba(255, 106, 26, 0.12);
    border-color: rgba(255, 106, 26, 0.45);
    align-self: flex-end;
}

.chat-line--phantom {
    background: rgba(124, 58, 237, 0.12);
    border-color: rgba(124, 58, 237, 0.42);
    align-self: flex-start;
}

.chat-role {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.chat-form {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(12, 6, 22, 0.82);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 12px 12px 12px 18px;
}

.chat-form input[type="text"] {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.05rem;
    font-family: inherit;
}

.chat-form input[type="text"]::placeholder {
    color: rgba(249, 247, 255, 0.35);
}

.chat-form input[type="text"]:focus {
    outline: none;
}

.chat-form button {
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 18px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
    color: #140314;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(255, 106, 26, 0.36);
}

.chat-form button:active {
    transform: translateY(0);
}

.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;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 680px) {
    body {
        padding: 26px 14px;
    }

    .chat-shell {
        padding: 26px 24px 24px;
    }

    .chat-title h1 {
        font-size: 2.3rem;
    }

    .chat-history {
        min-height: 280px;
        max-height: 360px;
    }
}
