body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #f0f2f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Loading Animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(-45deg, #ff9a9e, #fad0c4, #a18cd1, #fbc2eb);
    background-size: 400% 400%;
    animation: gradient-bg 2s ease infinite;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

body.loaded::before {
    opacity: 0;
    visibility: hidden;
}

body::after {
    content: '加载中...';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    color: white;
    z-index: 10000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

body.loaded::after {
    opacity: 0;
    visibility: hidden;
}

/* Season Variables */
:root {
    --bg-gradient: linear-gradient(-45deg, #ff9a9e, #fad0c4, #a18cd1, #fbc2eb);
    --particle-color: #ffb7b2;
    --card-shadow: rgba(255, 183, 178, 0.4);
    --header-bg: rgba(255, 255, 255, 0.85);
    --text-color: #333;
}

/* Season Themes */
body.season-spring {
    --bg-gradient: linear-gradient(-45deg, #ff9a9e, #fad0c4, #ffd1ff, #fbc2eb);
    --card-shadow: rgba(255, 154, 158, 0.3);
}

body.season-summer {
    --bg-gradient: linear-gradient(-45deg, #4facfe, #00f2fe, #43e97b, #38f9d7);
    --card-shadow: rgba(67, 233, 123, 0.3);
}

body.season-autumn {
    --bg-gradient: linear-gradient(-45deg, #fa709a, #fee140, #ffba93, #ffc3a0);
    --card-shadow: rgba(254, 225, 64, 0.3);
}

body.season-winter {
    --bg-gradient: linear-gradient(-45deg, #a18cd1, #fbc2eb, #e6dee9, #cfd9df);
    --card-shadow: rgba(161, 140, 209, 0.3);
}

#qr-wall {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: var(--bg-gradient);
    background-size: 400% 400%;
    animation: gradient-bg 15s ease infinite;
    overflow: hidden;
    transition: background 2s ease, opacity 0.5s ease;
}

/* Canvas for Particles */
#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* Season Indicator */
.season-indicator {
    position: absolute;
    bottom: 60px;
    right: 20px;
    background: rgba(255, 255, 255, 0.6);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 16px;
    color: #555;
    z-index: 100;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
}

.season-indicator:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.05);
}

.season-indicator:active {
    transform: scale(0.95);
}

.season-icon {
    font-size: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes gradient-bg {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.bg-shape {
    display: none; 
}

/* Header Info */
.profile-header {
    position: absolute;
    top: 20px;
    left: 40px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    max-width: 300px;
    animation: slideIn 0.8s ease;
}

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

.profile-header h1 {
    margin: 0;
    font-size: 24px;
    color: #333;
    font-weight: 600;
}

.profile-header p {
    margin: 10px 0 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* Polaroid Style */
.qr-item {
    position: absolute;
    background: #fff;
    padding: 15px 15px 45px 15px;
    box-shadow: 0 4px 6px var(--card-shadow), 0 1px 3px rgba(0,0,0,0.08);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 170px;
    transform-origin: center;
    will-change: transform, opacity;
}

.qr-item:hover {
    z-index: 1000 !important;
    transform: scale(1.15) rotate(0deg) !important;
    box-shadow: 0 15px 30px var(--card-shadow);
}

.qr-code {
    width: 140px;
    height: 140px;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-code img {
    max-width: 100%;
    max-height: 100%;
}

.qr-caption {
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 100%;
    text-align: center;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    color: #555;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    padding: 0 10px;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.5px;
}

.qr-item:hover .qr-caption {
    opacity: 1;
    color: #000;
}

/* 3D Carousel Styles */
#carousel-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 1500;
    overflow: hidden;
    perspective: 1000px;
}

#carousel-container.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

#drag-container {
    position: relative;
    display: flex;
    margin: auto;
    transform-style: preserve-3d;
    transform: rotateX(-10deg);
}

#spin-container {
    position: relative;
    display: flex;
    width: 170px;
    height: 200px;
    transform-style: preserve-3d;
    animation: spin 30s infinite linear;
}

#spin-container .qr-item {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    box-shadow: 0 0 8px #fff;
    -webkit-box-reflect: below 10px linear-gradient(transparent, transparent, #0005);
    transition: transform 1s;
}

#spin-container .qr-item:hover {
    box-shadow: 0 0 15px #ff9;
    transform: scale(1.1) rotate(0deg) !important;
}

#ground {
    width: 900px;
    height: 900px;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translate(-50%, -50%) rotateX(90deg);
    background: radial-gradient(center center, farthest-side, #9993, transparent);
}

@keyframes spin {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}

#carousel-control {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
}

#back-btn {
    padding: 12px 24px;
    background: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    font-weight: 500;
}

#back-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}

#back-btn:active {
    transform: scale(0.95);
}

/* Modal for details */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    text-align: center;
    position: relative;
    animation: scaleIn 0.3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    transition: all 0.3s ease;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
    transform: rotate(90deg);
}

.modal-date {
    font-size: 14px;
    color: #888;
    margin-bottom: 10px;
    display: block;
}

.modal-text {
    font-size: 18px;
    line-height: 1.6;
    color: #333;
}

#modal-qr {
    margin-bottom: 20px;
}

/* 备案信息样式 */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    padding: 10px 0;
    text-align: center;
    z-index: 1000;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.备案信息 a {
    margin: 0;
    font-size: 12px;
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
}

.备案信息 a:hover {
    color: #333;
    text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .profile-header {
        left: 20px;
        right: 20px;
        max-width: none;
        padding: 15px 20px;
    }
    
    .profile-header h1 {
        font-size: 20px;
    }
    
    .profile-header p {
        font-size: 12px;
    }
    
    .qr-item {
        width: 130px;
        padding: 10px 10px 35px 10px;
    }
    
    .qr-code {
        width: 110px;
        height: 110px;
    }
    
    .qr-caption {
        font-size: 12px;
    }
    
    .season-indicator {
        bottom: 70px;
        right: 10px;
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .season-icon {
        font-size: 18px;
    }
    
    #back-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .modal-content {
        margin: 20px;
        padding: 20px;
    }
    
    .modal-text {
        font-size: 16px;
    }
    
    .footer {
        padding: 8px 0;
    }
    
    .备案信息 a {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .profile-header {
        top: 10px;
        left: 10px;
        right: 10px;
        padding: 12px 15px;
    }
    
    .profile-header h1 {
        font-size: 18px;
    }
    
    .profile-header p {
        font-size: 11px;
        margin-top: 8px;
    }
    
    .qr-item {
        width: 100px;
        padding: 8px 8px 28px 8px;
    }
    
    .qr-code {
        width: 84px;
        height: 84px;
    }
    
    .qr-caption {
        font-size: 10px;
        bottom: 8px;
    }
    
    .season-indicator {
        bottom: 65px;
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .season-icon {
        font-size: 16px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) {
    .qr-item:hover {
        transform: none;
    }
    
    .qr-item:active {
        transform: scale(1.05);
    }
    
    .season-indicator:hover {
        background: rgba(255, 255, 255, 0.6);
        transform: none;
    }
    
    .season-indicator:active {
        background: rgba(255, 255, 255, 0.8);
        transform: scale(0.95);
    }
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .qr-code {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    #spin-container {
        animation: none;
    }
}
