/* ============================================================
   MYSTIC MESSENGER — JUMIN HAN BIRTHDAY ROUTE
   Complete Design System & Styles
   ============================================================ */

/* ----------------------------------------------------------
   1. CSS CUSTOM PROPERTIES
---------------------------------------------------------- */
:root {
    /* === Backgrounds === */
    --bg-deep:        #07071a;
    --bg-primary:     #0B0B1E;
    --bg-secondary:   #111130;
    --bg-surface:     #16163a;
    --bg-chat:        #0d0d24;

    /* === Character Theme Colors === */
    --jumin-color:    #8a7fd4;
    --jumin-bubble:   #252545;
    --seven-color:    #ff5c5c;
    --seven-bubble:   #3d2029;
    --yoosung-color:  #59c944;
    --yoosung-bubble: #1e3520;

    /* === Player === */
    --player-bubble-from: #d4edbc;
    --player-bubble-to:   #b5d99a;
    --player-text:    #1a3d1a;

    /* === System === */
    --system-color:   #b0a896;

    /* === Text === */
    --text-primary:   #e8e8f0;
    --text-secondary: #9e9ebd;
    --text-muted:     #5a5a7a;

    /* === Accent === */
    --accent-gold:    #c9a84c;
    --accent-purple:  #7b6fc7;
    --accent-glow:    rgba(123, 111, 199, 0.35);

    /* === UI === */
    --border-subtle:  rgba(255, 255, 255, 0.06);
    --border-glow:    rgba(123, 111, 199, 0.25);
    --shadow-heavy:   0 20px 60px rgba(0, 0, 0, 0.6);
    --shadow-glow:    0 0 30px rgba(123, 111, 199, 0.15);

    /* === Sizing === */
    --app-max-width:  440px;
    --app-max-height: 780px;
    --bubble-radius:  18px;
    --avatar-size:    38px;

    /* === Timing === */
    --ease-smooth:    cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce:    cubic-bezier(0.34, 1.56, 0.64, 1);

    /* === Font === */
    --font-main:      'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono:      'Fira Code', 'Consolas', monospace;
}

/* ----------------------------------------------------------
   2. RESET & BASE
---------------------------------------------------------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-main);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100dvh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
    background: none;
}

input {
    font-family: inherit;
    border: none;
    outline: none;
    background: none;
}

/* ----------------------------------------------------------
   3. STARRY BACKGROUND
---------------------------------------------------------- */
#stars-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at 20% 50%, #0f0f35 0%, var(--bg-deep) 70%);
}

.star {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    animation: twinkle var(--dur, 3s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

@keyframes twinkle {
    0%, 100% { opacity: 0.15; transform: scale(0.8); }
    50%      { opacity: 0.9;  transform: scale(1.2); }
}

/* ----------------------------------------------------------
   4. APP CONTAINER
---------------------------------------------------------- */
#app {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100dvh;
    max-width: var(--app-max-width);
    overflow: hidden;
    background: var(--bg-primary);
}

/* Desktop: phone-like frame */
@media (min-width: 600px) and (min-height: 600px) {
    #app {
        height: min(var(--app-max-height), 90dvh);
        border-radius: 28px;
        border: 1.5px solid var(--border-subtle);
        box-shadow: var(--shadow-heavy), var(--shadow-glow);
    }
}

/* ----------------------------------------------------------
   5. SCREEN TRANSITIONS
---------------------------------------------------------- */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s var(--ease-smooth), visibility 0.5s;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* ----------------------------------------------------------
   5.1. FLOATING HEART ANIMATION
---------------------------------------------------------- */
.floating-heart {
    position: absolute;
    bottom: 20%;
    left: 50%;
    font-size: 2.5rem;
    color: var(--jumin-color);
    pointer-events: none;
    z-index: 50;
    animation: floatUpHeart 2.5s ease-out forwards;
    filter: drop-shadow(0 0 10px rgba(138, 127, 212, 0.6));
}

@keyframes floatUpHeart {
    0% { transform: translate(-50%, 0) scale(0); opacity: 0; }
    15% { transform: translate(-50%, -30px) scale(1.2); opacity: 1; }
    30% { transform: translate(-50%, -50px) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -200px) scale(1); opacity: 0; }
}

/* ----------------------------------------------------------
   6. LOGIN SCREEN
---------------------------------------------------------- */
#login-screen {
    justify-content: center;
    align-items: center;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(123, 111, 199, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 80%, rgba(201, 168, 76, 0.05) 0%, transparent 50%),
        var(--bg-primary);
}

.login-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 32px;
    width: 100%;
    max-width: 360px;
    animation: fadeSlideUp 0.8s var(--ease-smooth);
}

/* --- RFA Emblem --- */
.rfa-emblem {
    position: relative;
    width: 90px;
    height: 90px;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emblem-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1.5px solid rgba(123, 111, 199, 0.3);
    animation: emblemPulse 3s ease-in-out infinite;
}

.emblem-ring-2 {
    inset: -8px;
    border-color: rgba(123, 111, 199, 0.12);
    animation-delay: 1.5s;
}

.emblem-inner {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: 6px;
    color: var(--accent-purple);
    text-shadow: 0 0 20px var(--accent-glow);
    padding-left: 6px; /* offset letter-spacing */
}

@keyframes emblemPulse {
    0%, 100% { transform: scale(1);    opacity: 0.6; }
    50%      { transform: scale(1.08); opacity: 1; }
}

/* --- Title & Subtitle --- */
.login-title {
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-primary);
    margin-bottom: 6px;
    position: relative;
}

/* Glitch effect */
.login-title::before,
.login-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    pointer-events: none;
}

.login-title::before {
    color: #ff3c5c;
    animation: glitchTop 4s infinite linear alternate-reverse;
    clip-path: inset(0 0 65% 0);
}

.login-title::after {
    color: #3cf5ff;
    animation: glitchBottom 3.5s infinite linear alternate-reverse;
    clip-path: inset(65% 0 0 0);
}

@keyframes glitchTop {
    0%, 90%, 100% { transform: translate(0); }
    92%           { transform: translate(-3px, -1px); }
    94%           { transform: translate(3px, 1px); }
    96%           { transform: translate(-2px, 0); }
    98%           { transform: translate(2px, -1px); }
}

@keyframes glitchBottom {
    0%, 88%, 100% { transform: translate(0); }
    90%           { transform: translate(2px, 1px); }
    93%           { transform: translate(-3px, 0); }
    95%           { transform: translate(2px, -1px); }
    97%           { transform: translate(-2px, 1px); }
}

.login-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 40px;
}

/* --- Login Form --- */
.login-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.input-group {
    position: relative;
}

.input-group input {
    width: 100%;
    padding: 14px 18px;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    transition: all 0.3s var(--ease-smooth);
}

.input-group input::placeholder {
    color: var(--text-muted);
    font-weight: 300;
}

.input-group input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px rgba(123, 111, 199, 0.1);
}

.input-underline {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-purple), transparent);
    transition: all 0.4s var(--ease-smooth);
    transform: translateX(-50%);
    border-radius: 2px;
}

.input-group input:focus ~ .input-underline {
    width: 80%;
}

/* --- Login Button --- */
#login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--accent-purple), #5a4fb8);
    border-radius: 12px;
    transition: all 0.3s var(--ease-smooth);
    position: relative;
    overflow: hidden;
}

#login-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

#login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(123, 111, 199, 0.4);
}

#login-btn:hover::before {
    opacity: 1;
}

#login-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.1rem;
    transition: transform 0.3s var(--ease-smooth);
}

#login-btn:hover .btn-icon {
    transform: translateX(4px);
}

/* --- Error Message --- */
.error-msg {
    font-size: 0.82rem;
    color: var(--seven-color);
    min-height: 20px;
    margin-top: 14px;
    text-align: center;
    font-family: var(--font-mono);
    opacity: 0;
    transform: translateY(-6px);
    transition: all 0.3s var(--ease-smooth);
}

.error-msg.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Shake Animation --- */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-8px); }
    40%      { transform: translateX(8px); }
    60%      { transform: translateX(-5px); }
    80%      { transform: translateX(5px); }
}

.shake {
    animation: shake 0.45s ease-in-out;
}

/* --- Footer --- */
.login-footer {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 36px;
    letter-spacing: 0.5px;
    font-family: var(--font-mono);
    opacity: 0.5;
}

/* ----------------------------------------------------------
   7. CHAT SCREEN
---------------------------------------------------------- */
#chat-screen {
    background: var(--bg-chat);
}

/* --- Chat Header --- */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(11, 11, 30, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 10;
    flex-shrink: 0;
}

.chat-header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.chat-room-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-room-members {
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.header-icon-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-secondary);
    transition: all 0.25s var(--ease-smooth);
}

.header-icon-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.chat-clock {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* --- Chat Messages Area --- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scroll-behavior: smooth;
}

/* --- Message Wrapper --- */
.message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 88%;
    animation: messageIn 0.35s var(--ease-bounce);
}

.message-character {
    align-self: flex-start;
}

.message-player {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-consecutive {
    margin-top: -2px;
}

.message-consecutive .message-avatar-col {
    visibility: hidden;
}

.message-consecutive .message-sender {
    display: none;
}

/* --- Avatar --- */
.message-avatar-col {
    flex-shrink: 0;
    padding-top: 18px; /* align with bubble below name */
}

.avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.7rem;
    color: #fff;
    letter-spacing: 0.5px;
    background-color: var(--char-color, #666);
    background-image: linear-gradient(135deg,
        var(--char-color, #666),
        color-mix(in srgb, var(--char-color, #666), black 30%)
    );
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
}

.avatar-jumin  { --char-color: var(--jumin-color); }
.avatar-707    { --char-color: var(--seven-color); }
.avatar-yoosung { --char-color: var(--yoosung-color); }

/* --- Message Content --- */
.message-content-col {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.message-sender {
    font-size: 0.72rem;
    font-weight: 600;
    padding-left: 4px;
    letter-spacing: 0.3px;
}

/* --- Message Bubbles --- */
.message-bubble {
    padding: 10px 16px;
    border-radius: var(--bubble-radius);
    font-size: 0.88rem;
    line-height: 1.55;
    word-wrap: break-word;
    position: relative;
    font-weight: 400;
}

/* Character bubbles: rounded except top-left corner */
.bubble-jumin,
.bubble-707,
.bubble-yoosung {
    border-top-left-radius: 4px;
}

.bubble-jumin {
    background: var(--jumin-bubble);
    color: #d8d6f0;
    border: 1px solid rgba(138, 127, 212, 0.12);
}

.bubble-707 {
    background: var(--seven-bubble);
    color: #f5d0d0;
    border: 1px solid rgba(255, 92, 92, 0.12);
}

.bubble-yoosung {
    background: var(--yoosung-bubble);
    color: #cff0ca;
    border: 1px solid rgba(89, 201, 68, 0.12);
}

/* Player bubble: right-aligned, rounded except top-right */
.bubble-player {
    background: linear-gradient(135deg, var(--player-bubble-from), var(--player-bubble-to));
    color: var(--player-text);
    border-top-right-radius: 4px;
    font-weight: 450;
}

/* --- System Messages --- */
.system-message {
    align-self: center;
    text-align: center;
    font-size: 0.75rem;
    color: var(--system-color);
    background: rgba(176, 168, 150, 0.08);
    border: 1px solid rgba(176, 168, 150, 0.1);
    padding: 6px 18px;
    border-radius: 20px;
    margin: 10px 0;
    animation: messageIn 0.35s var(--ease-smooth);
    letter-spacing: 0.3px;
    max-width: 90%;
}

/* --- Emoji-only messages (large emoji) --- */
.message-bubble.emoji-only {
    font-size: 2rem;
    background: transparent !important;
    border: none !important;
    padding: 4px 8px;
    line-height: 1.3;
}

/* ----------------------------------------------------------
   8. TYPING INDICATOR
---------------------------------------------------------- */
.typing-bubble {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 20px;
    border-radius: var(--bubble-radius);
    border-top-left-radius: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
}

.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8d8c91;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%           { transform: scale(1);   opacity: 1; }
}

/* ----------------------------------------------------------
   9. CHOICE BUTTONS
---------------------------------------------------------- */
.choices-container {
    padding: 0 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s var(--ease-smooth);
}

.choices-container.visible {
    max-height: 400px;
    opacity: 1;
    padding-top: 10px;
}

.choice-btn {
    width: 100%;
    padding: 13px 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: left;
    line-height: 1.45;
    background: rgba(123, 111, 199, 0.08);
    border: 1px solid rgba(123, 111, 199, 0.2);
    border-radius: 14px;
    transition: all 0.3s var(--ease-smooth);
    animation: choiceFadeIn 0.4s var(--ease-smooth) backwards;
    position: relative;
    overflow: hidden;
}

.choice-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(123, 111, 199, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.choice-btn:hover {
    background: rgba(123, 111, 199, 0.18);
    border-color: rgba(123, 111, 199, 0.45);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(123, 111, 199, 0.15);
}

.choice-btn:hover::before {
    opacity: 1;
}

.choice-btn:active {
    transform: scale(0.98);
    transition-duration: 0.1s;
}

@keyframes choiceFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* ----------------------------------------------------------
   10. ENDING SCREEN
---------------------------------------------------------- */
#ending-screen {
    justify-content: center;
    align-items: center;
    background:
        radial-gradient(ellipse at 50% 40%, rgba(123, 111, 199, 0.06) 0%, transparent 60%),
        var(--bg-primary);
}

.ending-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 32px;
    text-align: center;
    animation: endingReveal 0.8s var(--ease-smooth);
}

.ending-badge {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: badgeFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

@keyframes badgeFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50%      { transform: translateY(-8px) scale(1.05); }
}

.ending-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.ending-divider {
    width: 60px;
    height: 2px;
    border-radius: 2px;
    margin: 16px 0 20px;
    opacity: 0.5;
}

.ending-image {
    max-width: 100%;
    max-height: 250px;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    object-fit: cover;
}

.ending-text {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 340px;
    margin-bottom: 32px;
    white-space: pre-line;
}

/* Good Ending */
.ending-good .ending-title {
    background: linear-gradient(135deg, #e8b4d8, #d4a0e8, #c9a84c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ending-good .ending-divider {
    background: linear-gradient(90deg, var(--jumin-color), var(--accent-gold));
}

/* Normal Ending */
.ending-normal .ending-title {
    background: linear-gradient(135deg, #ffdd57, #ff9f43, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ending-normal .ending-divider {
    background: linear-gradient(90deg, #ffdd57, #ff6b6b);
}

/* Bad Ending */
.ending-bad .ending-title {
    color: var(--text-muted);
}

.ending-bad .ending-divider {
    background: var(--text-muted);
}

/* --- Restart Button --- */
.restart-btn {
    padding: 12px 32px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 25px;
    transition: all 0.3s var(--ease-smooth);
}

.restart-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.ending-credits {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 24px;
    letter-spacing: 0.5px;
    opacity: 0.6;
}

/* ----------------------------------------------------------
   10.5. CREDITS / SPECIAL LETTER SCREEN
---------------------------------------------------------- */
#credits-screen {
    background: var(--bg-deep);
    justify-content: center;
    align-items: center;
}

.letter-container {
    width: 90%;
    max-width: 360px;
    background: #fdfbf7;
    border-radius: 8px;
    padding: 30px 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    color: #2b2b2b;
    position: relative;
    animation: letterFadeIn 1.5s ease-out forwards;
}

.letter-container::before {
    content: '';
    position: absolute;
    top: 10px; left: 10px; right: 10px; bottom: 10px;
    border: 1px solid rgba(138, 127, 212, 0.3);
    pointer-events: none;
}

.letter-title {
    font-size: 1.4rem;
    font-family: 'Georgia', serif;
    color: var(--jumin-color);
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(138, 127, 212, 0.3);
    padding-bottom: 10px;
}

.letter-text {
    font-family: 'Georgia', serif;
    font-size: 0.95rem;
    line-height: 1.8;
    text-align: left;
    white-space: pre-line;
}

.letter-signature {
    text-align: right;
    margin-top: 20px;
    font-style: italic;
    color: var(--jumin-color);
}

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

/* ----------------------------------------------------------
   11. GLOBAL ANIMATIONS
---------------------------------------------------------- */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes endingReveal {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ----------------------------------------------------------
   12. CONFETTI CANVAS
---------------------------------------------------------- */
#confetti-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    pointer-events: none;
}

/* ----------------------------------------------------------
   13. SCROLLBAR
---------------------------------------------------------- */
.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Firefox */
.chat-messages {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

/* ----------------------------------------------------------
   14. RESPONSIVE
---------------------------------------------------------- */

/* Small phones */
@media (max-width: 380px) {
    .login-wrapper {
        padding: 30px 20px;
    }

    .rfa-emblem {
        width: 72px;
        height: 72px;
        margin-bottom: 20px;
    }

    .login-title {
        font-size: 1.15rem;
    }

    .message-bubble {
        font-size: 0.84rem;
    }

    .choice-btn {
        font-size: 0.82rem;
        padding: 11px 16px;
    }
}

/* Tall phones — give chat more room */
@media (max-height: 680px) {
    .login-wrapper {
        padding: 24px 24px;
    }

    .rfa-emblem {
        width: 64px;
        height: 64px;
        margin-bottom: 16px;
    }

    .login-subtitle {
        margin-bottom: 28px;
    }
}

/* ----------------------------------------------------------
   15. REDUCED MOTION
---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
