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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Canvas for physics animation */
#physicsCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: auto;
}

/* Overlay content */
.overlay {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: block;
    padding: 0;
    background: transparent;
    pointer-events: none;
}

/* Hero section */
.hero {
    text-align: center;
    margin-bottom: 0;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;
    max-width: 450px;
    min-width: 300px;
}

.birthday-title {
    font-size: clamp(1.4rem, 3.5vw, 2rem);
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 8px;
    animation: bounce 2s ease-in-out infinite;
    line-height: 1.3;
}

.name-highlight {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: bold;
    color: #ffd700;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.4);
    display: block;
    margin-top: 5px;
}

.subtitle {
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: #f0f0f0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    margin: 0 auto;
}

/* Content sections */
.content {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 320px;
    margin: 0;
    width: 320px;
    position: fixed;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.message-form, .messages {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
}

.message-form h3, .messages h3 {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 15px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.stats {
    text-align: center;
    margin-bottom: 15px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stats span {
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Form styles */
#wishForm {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#authorName, #wishText {
    padding: 12px 15px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
}

#authorName:focus, #wishText:focus {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#wishText {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

button[type="submit"] {
    padding: 15px 30px;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

button[type="submit"]:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

button[type="submit"]:active {
    transform: translateY(-1px);
}

/* Messages list */
.messages-list {
    max-height: 250px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message-item {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 15px;
    border-left: 4px solid #ff6b6b;
    animation: slideIn 0.5s ease-out;
}

.message-author {
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
    font-size: 14px;
}

.message-text {
    color: #f0f0f0;
    line-height: 1.4;
}

.message-time {
    font-size: 12px;
    color: #ddd;
    margin-top: 8px;
    text-align: right;
}

.new-message {
    animation: newMessageSlide 0.5s ease-out, newMessageGlow 3s ease-in-out;
    border-left-color: #4ecdc4;
    background: rgba(78, 205, 196, 0.1);
}

.new-badge {
    background: #ff6b6b;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 8px;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes newMessageSlide {
    from {
        opacity: 0;
        transform: translateX(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes newMessageGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(78, 205, 196, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(78, 205, 196, 0.6);
    }
}

/* Instructions */
.instructions {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    animation: pulse 2s ease-in-out infinite;
}

/* Animations */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

/* Responsive design */
@media (max-width: 1024px) and (min-width: 769px) {
    /* Планшеты */
    .content {
        width: 280px;
        max-width: 280px;
        left: 10px;
    }
    
    .hero {
        max-width: 400px;
        top: 10px;
    }
}

@media (max-width: 768px) {
    /* Мобильные устройства */
    .hero {
        position: fixed;
        top: 5px;
        left: 50%;
        transform: translateX(-50%);
        max-width: calc(100% - 20px);
        min-width: calc(100% - 20px);
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    .birthday-title {
        font-size: clamp(1.2rem, 4vw, 1.5rem);
        margin-bottom: 5px;
        animation: none; /* Отключаем анимацию на мобильных */  
    }
    
    .name-highlight {
        font-size: clamp(1.6rem, 6vw, 2rem);
        margin-top: 2px;
    }
    
    .subtitle {
        font-size: clamp(0.8rem, 3vw, 1rem);
    }
    
    .content {
        width: calc(100% - 20px);
        max-width: calc(100% - 20px);
        position: fixed;
        left: 10px;
        top: 80px;
        transform: none;
        max-height: calc(100vh - 90px);
        gap: 12px;
    }
    
    .message-form, .messages {
        padding: 12px;
    }
    
    .messages-list {
        max-height: 150px;
    }
    
    .instructions {
        bottom: 5px;
        font-size: 11px;
        padding: 6px 12px;
        left: 50%;
        transform: translateX(-50%);
        max-width: calc(100% - 20px);
        text-align: center;
    }
}

/* Toggle button for mobile */
.panel-toggle {
    display: none;
    position: fixed;
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
    z-index: 5;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.panel-toggle:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
}

.content.collapsed {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 480px) {
    .panel-toggle {
        display: block;
    }
    
    .hero {
        padding: 10px 12px;
        top: 5px;
        font-size: 0.85rem;
    }
    
    .birthday-title {
        font-size: clamp(1rem, 3.5vw, 1.3rem);
        margin-bottom: 3px;
    }
    
    .name-highlight {
        font-size: clamp(1.4rem, 5vw, 1.8rem);
        margin-top: 1px;
    }
    
    .subtitle {
        font-size: clamp(0.7rem, 2.5vw, 0.9rem);
        line-height: 1.3;
    }
    
    .content {
        top: 65px;
        left: 5px;
        width: calc(100% - 10px);
        max-width: calc(100% - 10px);
        max-height: calc(100vh - 75px);
        gap: 10px;
        transition: all 0.3s ease;
    }
    
    .message-form, .messages {
        padding: 10px;
    }
    
    .message-form h3, .messages h3 {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    
    .messages-list {
        max-height: 120px;
    }
    
    .instructions {
        bottom: 3px;
        font-size: 10px;
        padding: 4px 8px;
    }
}

/* Custom scrollbar */
.messages-list::-webkit-scrollbar {
    width: 6px;
}

.messages-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.messages-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

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