* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #0f0f0f;
    color: white;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

body::after {
    content: '';
    position: fixed;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 40%, rgba(223, 42, 42, 0.12) 0%, transparent 60%),
                radial-gradient(circle at 80% 70%, rgba(223, 42, 42, 0.08) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.app {
    width: 100%;
    max-width: 900px;
    height: 100vh;
    padding: 1rem 0.5rem;
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    transition: all 0.5s ease;
}

.centered-mode {
    justify-content: center;
    align-items: center;
}

.chat-mode {
    justify-content: flex-start;
}

.brand {
    transition: all 0.5s ease;
    text-align: center;
    width: 100%;
}

.centered-mode .brand h1 {
    font-size: clamp(5rem, 18vw, 9rem);
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, #ffffff 30%, #df2a2a 70%, #ff9f9f 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: glow 3s infinite alternate;
    filter: drop-shadow(0 0 30px rgba(223, 42, 42, 0.5));
}

.chat-mode .brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.chat-mode .brand h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 0%, #ffffff 30%, #df2a2a 70%, #ff9f9f 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 15px rgba(223, 42, 42, 0.5));
    display: inline-block;
}

@keyframes glow {
    0% { filter: drop-shadow(0 0 20px rgba(223, 42, 42, 0.3)); }
    100% { filter: drop-shadow(0 0 70px rgba(223, 42, 42, 1)); }
}

.chat-area {
    width: 100%;
    display: none;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.5rem 1rem;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.chat-area::-webkit-scrollbar {
    display: none;
}

.input-container {
    width: 100%;
    transition: all 0.5s ease;
    margin-top: 1rem;
}

.chat-mode .input-container {
    margin-top: auto;
}

.input-panel {
    width: 100%;
    background: rgba(18, 18, 18, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(223, 42, 42, 0.3);
    border-radius: 60px;
    padding: 0.4rem;
    display: flex;
    align-items: flex-end;
    gap: 0.2rem;
    box-shadow: 0 0 20px rgba(223, 42, 42, 0.2), 0 0 40px rgba(223, 42, 42, 0.1);
    transition: border-radius 0.2s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-panel:focus-within {
    border-color: #df2a2a;
    box-shadow: 0 0 25px rgba(223, 42, 42, 0.6), 0 0 50px rgba(223, 42, 42, 0.3);
}

.file-btn {
    background: rgba(40, 40, 40, 0.6);
    border: 1px solid rgba(223, 42, 42, 0.15);
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.4rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: not-allowed;
    transition: all 0.2s ease;
    flex-shrink: 0;
    opacity: 0.5;
    pointer-events: none;
    margin-left: 0.2rem;
    margin-bottom: 0.2rem;
}

.message-input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.1rem;
    padding: 0.9rem 0.8rem;
    outline: none;
    min-width: 0;
    resize: none;
    font-family: inherit;
    line-height: 1.5;
    max-height: calc(1.5em * 9);
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    align-self: center;
}

.message-input::-webkit-scrollbar {
    display: none;
}

.message-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.right-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    margin-right: 0.2rem;
    margin-bottom: 0.2rem;
}

.icon-btn {
    background: rgba(40, 40, 40, 0.6);
    border: 1px solid rgba(223, 42, 42, 0.15);
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.3rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: not-allowed;
    transition: all 0.2s ease;
    flex-shrink: 0;
    opacity: 0.5;
    pointer-events: none;
}

.send-btn {
    background: #df2a2a;
    border: 1px solid #ff6a6a;
    color: white;
    opacity: 1;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 0 15px rgba(223, 42, 42, 0.6);
    transition: all 0.2s ease;
    font-size: 1.2rem;
}

.send-btn:hover {
    background: #f03a3a;
    box-shadow: 0 0 30px #df2a2a;
}

.send-btn:active {
    transform: scale(0.95);
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    position: relative;
    margin-bottom: 0.5rem;
}

.user-wrapper {
    align-items: flex-end;
}

.bot-wrapper {
    align-items: flex-start;
}

.message-bubble {
    max-width: 75%;
    padding: 0.9rem 1.6rem;
    border-radius: 24px;
    font-size: 1.05rem;
    line-height: 1.5;
    word-break: break-word;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 2;
}

.user-message {
    background: #242424;
    border: 1px solid #333;
    border-bottom-right-radius: 6px;
    color: white;
}

.bot-message {
    background: #1c1c1c;
    border: 1px solid #333;
    border-bottom-left-radius: 6px;
    color: #f0f0f0;
}

.editing {
    border: 2px solid #df2a2a !important;
}

.message-footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.3rem;
    margin-bottom: 0.2rem;
}

@media (hover: hover) {
    .message-footer {
        opacity: 0;
        transition: opacity 0.2s ease;
    }
    .message-wrapper:hover .message-footer {
        opacity: 1;
    }
}

@media (hover: none) {
    .message-footer {
        opacity: 1;
    }
}

.user-wrapper .message-footer {
    justify-content: flex-end;
    padding-right: 0.5rem;
}

.bot-wrapper .message-footer {
    justify-content: flex-start;
    padding-left: 0.5rem;
}

.message-time {
    font-size: 0.7rem;
    color: #888;
}

.footer-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.footer-btn {
    background: transparent;
    border: none;
    color: #df2a2a;
    font-size: 0.8rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(223, 42, 42, 0.1);
    border: 1px solid rgba(223, 42, 42, 0.2);
}

.footer-btn:hover {
    background: rgba(223, 42, 42, 0.2);
    border-color: #df2a2a;
    transform: scale(1.1);
    color: white;
}

.footer-btn:active {
    transform: scale(0.95);
}

.empty-chat {
    color: #555;
    text-align: center;
    padding: 2rem;
    font-size: 0.95rem;
    border: 1px dashed #333;
    border-radius: 40px;
    background: #0c0c0c80;
    backdrop-filter: blur(4px);
    margin-top: 2rem;
}

.toast {
    position: fixed;
    bottom: 7rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid #df2a2a;
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 30px;
    font-size: 0.9rem;
    box-shadow: 0 0 20px rgba(223, 42, 42, 0.3);
    z-index: 100;
    animation: toastFade 2s ease forwards;
    pointer-events: none;
}

@keyframes toastFade {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}