* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: #FFFFFF url('img/sea.png') repeat center center / 400px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 32px;
    color: #2c2c2c;
    line-height: 1.7;

    @media (min-width: 600px) {
        padding: 42px;
    }
}

a {
    color: #000000;
}

.chat-container {
    width: 100%;
    max-width: 680px;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    min-height: 94vh;
    max-height: 94vh;
    overflow: hidden;
    background-color: #FFFFFF;
    padding: 16px;

    @media (min-width: 600px) {
        min-height: 90vh;
        max-height: 90vh;
    }
}

.chat-header {
    padding: 16px 20px 20px;
    text-align: center;

    @media (min-width: 600px) {
        padding: 16px 32px;
    }
}

.chat-header img {
    width: 120px;
    height: auto;
    border-radius: 100%;

    @media (min-width: 600px) {
        width: 160px;
    }
}

.chat-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #000000;
    letter-spacing: -0.02em;

    @media (min-width: 600px) {
        font-size: 24px;
    }
}

.chat-header p {
    font-size: 14px;
    color: #000000;
    font-weight: 400;

    @media (min-width: 600px) {
        font-size: 15px;
    }
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
    background-color: #FFFFFF;
    border: 1px dotted #777777;
    border-radius: 24px;

    @media (min-width: 600px) {
        padding: 32px;
    }
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #d0d0d0;
}

.message {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
}

.message.user {
    align-items: flex-end;
}

.message.assistant {
    align-items: flex-start;
}

.message-content {
    max-width: 90%;
    padding: 14px 18px;
    border-radius: 14px;
    word-wrap: break-word;
    font-size: 15px;
    line-height: 1.6;

    @media (min-width: 600px) {
        max-width: 85%;
    }
}

.chat-image {
    max-width: 100%;
    border-radius: 10px;
    margin: 8px 0;
    display: block;
}

.message.user .message-content {
    background: #1a1a1a;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.message.assistant .message-content {
    background: #f7f7f7;
    color: #2c2c2c;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.sources {
    font-size: 13px;
    color: #888;
    margin-top: 8px;
    max-width: 85%;
    font-weight: 400;
}

.chat-input {
    display: flex;
    padding: 16px 20px;
    gap: 8px;
    background-color: #EAEAEA;
    border-radius: 24px;
    margin-top: 8px;

    @media (min-width: 600px) {
        padding: 24px 32px;
        gap: 12px;
    }
}

.chat-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    font-size: 16px; /* Prevents zoom on iOS */
    font-family: inherit;
    transition: all 0.2s ease;
    background: #fafafa;

    @media (min-width: 600px) {
        padding: 14px 18px;
        font-size: 15px;
    }
}

.chat-input input:focus {
    outline: none;
    border-color: #1a1a1a;
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

.chat-input input::placeholder {
    color: #aaa;
}

.chat-input button {
    padding: 12px 20px;
    background: #1a1a1a;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);

    @media (min-width: 600px) {
        padding: 14px 28px;
    }
}

.chat-input button:hover:not(:disabled) {
    background: #2c2c2c;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
    transform: translateY(-1px);
}

.chat-input button:active:not(:disabled) {
    transform: translateY(0);
}

.chat-input button:disabled {
    background: #e0e0e0;
    cursor: not-allowed;
    box-shadow: none;
    color: #999;
}

.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #f0f0f0;
    border-top: 2px solid #1a1a1a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

footer {
    padding: 24px 16px 8px;
    font-size: 12px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 16px;
}