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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
    position: relative;
}

#visualizer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.3;
}

.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
    animation: confetti-fall 3s ease-in forwards;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

.music-toggle-btn {
    position: fixed;
    top: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border: none;
    box-shadow: 0 5px 20px rgba(30, 60, 114, 0.5);
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: floatIn 0.5s ease-out;
}

.music-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(30, 60, 114, 0.7);
}

.music-toggle-btn:active {
    transform: scale(0.95);
}

.music-icon {
    font-size: 1.5rem;
}

.floating-add-btn {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border: none;
    box-shadow: 0 5px 20px rgba(30, 60, 114, 0.5);
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: floatIn 0.5s ease-out;
}

@keyframes floatIn {
    from {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.floating-add-btn:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 8px 30px rgba(30, 60, 114, 0.7);
}

.floating-add-btn:active {
    transform: scale(0.95) rotate(90deg);
}

.plus-icon {
    font-size: 2rem;
    color: white;
    font-weight: 300;
    line-height: 1;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    transform: scale(0.7);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-title {
    margin-bottom: 25px;
    color: #333;
    font-size: 1.8rem;
    text-align: center;
}

.view-message-content {
    max-width: 600px;
}

#viewMessageContent {
    color: #333;
    line-height: 1.8;
    font-size: 1.1rem;
}

#viewMessageContent .message-name {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #1e3c72;
}

#viewMessageContent .message-text {
    margin-top: 15px;
    white-space: pre-wrap;
    cursor: default;
    overflow: visible;
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
}

#viewMessageContent .message-photo {
    margin-top: 20px;
}

#viewMessageContent .message-photo img {
    max-width: 100%;
    border-radius: 10px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.8s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.title {
    font-size: 3.5rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 10px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.subtitle {
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}


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

.message-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2a5298;
    box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.photo-upload-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    font-size: 1rem;
}

.photo-input {
    width: 100%;
    padding: 10px;
    border: 2px dashed #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.photo-input:hover {
    border-color: #2a5298;
    background: #f8f9fa;
}

.photo-preview {
    margin-top: 15px;
    display: none;
}

.photo-preview.active {
    display: block;
}

.photo-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.photo-preview .remove-photo {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 15px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
}

.photo-preview .remove-photo:hover {
    background: #d32f2f;
}

.submit-btn {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(30, 60, 114, 0.4);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 60, 114, 0.6);
}

.submit-btn:active {
    transform: translateY(0);
}

.messages-section {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.messages-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.loading {
    text-align: center;
    color: white;
    font-size: 1.2rem;
    padding: 40px;
    grid-column: 1 / -1;
}

.message-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInScale 0.5s ease-out;
    position: relative;
    height: 200px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.message-card::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: linear-gradient(90deg, #1e3c72, #2a5298, #ffd700, #2a5298, #1e3c72, #2a5298, #ffd700, #2a5298, #1e3c72);
    background-size: 300% 100%;
    border-radius: 18px;
    z-index: -1;
    animation: borderFlow 6s linear infinite;
}

.message-card::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    background: white;
    border-radius: 11px;
    z-index: -1;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes borderFlow {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 300% 0%;
    }
}

@keyframes shimmer {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.message-card:hover {
    transform: translateY(-5px) rotate(1deg);
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.message-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.message-info {
    flex: 1;
}

.message-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 2px;
}

.message-time {
    display: none;
}

.message-text {
    color: #555;
    line-height: 1.6;
    font-size: 1rem;
    word-wrap: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    flex: 1;
    cursor: pointer;
    position: relative;
}

.message-text.truncated::after {
    content: '... Read more';
    position: absolute;
    bottom: 0;
    right: 0;
    background: linear-gradient(to right, transparent, white 20%);
    padding-left: 40px;
    color: #2a5298;
    font-weight: 600;
}

.message-photo {
    margin-top: 15px;
    border-radius: 10px;
    overflow: hidden;
}

.message-photo img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.message-photo img:hover {
    transform: scale(1.05);
}

.success-message {
    background: #4caf50;
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
    animation: fadeInUp 0.5s ease-out;
}

.error-message {
    background: #f44336;
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
    animation: shake 0.5s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@media (max-width: 768px) {
    .header {
        padding: 0 80px;
        margin-top: 20px;
    }

    .title {
        font-size: 2rem;
    }

    .emoji-desktop {
        display: none;
    }

    .subtitle {
        font-size: 1rem;
    }

    .messages-container {
        grid-template-columns: 1fr;
    }

    .music-toggle-btn {
        width: 50px;
        height: 50px;
        top: 15px;
        left: 15px;
    }

    .music-icon {
        font-size: 1.2rem;
    }

    .floating-add-btn {
        width: 50px;
        height: 50px;
        top: 15px;
        right: 15px;
    }

    .plus-icon {
        font-size: 1.5rem;
    }

    .modal-content {
        padding: 30px 20px;
    }
}
