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

body {
    font-family: 'Fredoka One', Arial, sans-serif;
    background: linear-gradient(135deg, #FDF6E3 0%, #F7E8D0 50%, #FFEAA7 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: #333;
}

/* Content Container */
.content-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Modern Hero Header Styles */
.hero-header {
    position: relative;
    min-height: 280px;
    display: flex;
    align-items: center;
    overflow: hidden;
    margin-bottom: 40px;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        #FF6B9D 0%, 
        #6C63FF 50%, 
        #4ECDC4 100%);
    opacity: 0.9;
}

.hero-decoration {
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.hero-decoration-2 {
    position: absolute;
    bottom: -30px;
    left: -30px;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

.hero-content {
    position: relative;
    z-index: 10;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 40px;
    align-items: center;
}

.hero-text {
    color: white;
}

.hero-title {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 0; /* Reset to prevent spacing issues */
}

.title-emoji {
    font-size: 3rem;
    animation: bounce 2s infinite;
}

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

.title-main {
    font-size: 2.8rem;
    font-weight: bold;
    background: linear-gradient(45deg, #fff, #FFE4E1);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    font-size: 1.2rem;
    margin-bottom: 20px;
    opacity: 0.95;
    font-weight: 500;
    font-family: Arial, sans-serif;
}

.hero-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tag {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.hero-cta {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

.cta-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 1rem;
    border: 2px solid transparent;
}

.cta-button.primary {
    background: rgba(255, 255, 255, 0.95);
    color: #FF6B9D;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.cta-button.primary:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
}

.cta-button.secondary {
    background: transparent;
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
}

.cta-button.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
}

.cta-icon {
    font-size: 1.1rem;
}

/* Game Container */
#game-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 40px 0;
    padding: 20px;
    min-height: 600px; /* 固定最小高度，防止布局跳动 */
    position: relative;
    overflow: hidden; /* 防止内容溢出 */
}

/* Game Loading Styles */
.game-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.loading-content {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #FF6B9D;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 30px auto;
}

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

.loading-title {
    font-size: 1.8rem;
    color: #FF6B9D;
    margin-bottom: 15px;
    font-weight: bold;
}

.loading-text {
    font-size: 1.1rem;
    color: #666;
    font-family: Arial, sans-serif;
    margin: 0;
}

#game-container canvas {
    border: 2px solid white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background-color: white;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1; /* 确保 1:1 比例 */
    object-fit: contain; /* 保持比例，不拉伸 */
}

.button {
    background-color: #4CAF50;
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.button:hover {
    background-color: #45a049;
    transform: scale(1.05);
}

.button:active {
    transform: scale(0.98);
}

.loading-text {
    font-size: 24px;
    color: #333;
    text-align: center;
}

@media (max-width: 900px) {
    #game-container canvas {
        border: 1px solid white;
        max-width: min(95vw, 95vh); /* 取视口宽高最小值保持正方形 */
        max-height: min(95vw, 95vh);
        width: auto;
        height: auto;
        aspect-ratio: 1 / 1; /* 确保 1:1 比例 */
    }
}

/* Section Styles */
.game-info-section, .instructions-section, .about-section, .features-section {
    padding: 60px 20px;
    margin: 40px 0;
}

/* Game Information Section */
.game-info-section {
    background: rgba(255, 99, 132, 0.1);
    backdrop-filter: blur(10px);
    border-left: 5px solid #FF6384;
}

.instructions-section {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

.about-section {
    background: rgba(255, 182, 193, 0.2);
    backdrop-filter: blur(10px);
}

.features-section {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

.game-info-section h2, .instructions-section h2, .about-section h2, .features-section h2 {
    text-align: center;
    font-size: 2.5rem;
    color: #FF6B9D;
    margin-bottom: 40px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* Game Info Content */
.info-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.copyright-notice, .game-disclaimer {
    background: rgba(255, 255, 255, 0.9);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.copyright-notice h3, .game-disclaimer h3 {
    font-size: 1.5rem;
    color: #FF6384;
    margin-bottom: 20px;
    font-weight: bold;
}

.copyright-notice p, .game-disclaimer p {
    color: #666;
    font-size: 1rem;
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin-bottom: 15px;
}

.creator-info {
    background: rgba(255, 182, 193, 0.2);
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    border-left: 3px solid #FF6384;
}

.creator-info p {
    margin-bottom: 10px;
    color: #555;
}

.creator-info a {
    color: #1DA1F2;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.creator-info a:hover {
    color: #0d8bd9;
    text-decoration: underline;
}

/* Game Flow Description */
.game-flow-description {
    text-align: center;
    margin: 30px 0;
}

.flow-intro {
    font-size: 1.2rem;
    color: #555;
    font-family: Arial, sans-serif;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Instructions Grid */
.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.instruction-item {
    text-align: center;
    padding: 35px 25px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.instruction-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

/* Phase-specific styling */
.phase-1 {
    border-top: 4px solid #FF6B9D;
}

.phase-2 {
    border-top: 4px solid #6C63FF;
}

.phase-3 {
    border-top: 4px solid #4ECDC4;
}

.phase-number {
    position: absolute;
    top: -2px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #FF6B9D, #6C63FF);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.instruction-icon {
    font-size: 3.5rem;
    margin: 20px 0 15px 0;
    display: block;
}

.instruction-item h3 {
    font-size: 1.6rem;
    color: #333;
    margin-bottom: 15px;
    font-weight: bold;
}

.instruction-item p {
    color: #666;
    font-size: 1.1rem;
    font-family: Arial, sans-serif;
    line-height: 1.5;
}

/* Game Tips Section */
.game-tips {
    margin-top: 50px;
    padding: 30px;
    background: rgba(255, 235, 59, 0.1);
    border-radius: 15px;
    border-left: 5px solid #FFD700;
}

.tips-title {
    text-align: center;
    font-size: 1.8rem;
    color: #FF6B9D;
    margin-bottom: 25px;
    font-weight: bold;
}

.tips-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tip-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    font-family: Arial, sans-serif;
    line-height: 1.5;
}

.tip-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.tip-item span:last-child {
    color: #555;
    font-size: 1rem;
}

/* About Section */
.about-content {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.9);
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.about-text p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 20px;
    font-family: Arial, sans-serif;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.feature-item {
    text-align: center;
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.feature-item h3 {
    font-size: 1.5rem;
    color: #6C63FF;
    margin-bottom: 15px;
}

.feature-item p {
    color: #666;
    font-size: 1rem;
    font-family: Arial, sans-serif;
}

/* Footer */
.game-footer {
    background: rgba(108, 99, 255, 0.9);
    color: white;
    text-align: center;
    padding: 40px 20px;
    margin-top: 60px;
}

.game-footer p {
    margin: 10px 0;
    font-family: Arial, sans-serif;
}

/* Responsive Design */
@media (max-width: 900px) {
    .hero-header {
        min-height: 240px;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 30px 20px;
        text-align: center;
    }
    
    .title-main {
        font-size: 2.2rem;
    }
    
    .title-emoji {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .hero-cta {
        align-items: center;
        flex-direction: row;
        justify-content: center;
        gap: 15px;
    }
    
    .cta-button {
        padding: 12px 20px;
        font-size: 0.95rem;
    }
    
    .hero-decoration {
        width: 120px;
        height: 120px;
        top: -30px;
        right: -30px;
    }
    
    .hero-decoration-2 {
        width: 100px;
        height: 100px;
        bottom: -20px;
        left: -20px;
    }
    
    .game-info-section h2, .instructions-section h2, .about-section h2, .features-section h2 {
        font-size: 2rem;
    }
    
    .info-content, .instructions-grid, .features-grid {
        grid-template-columns: 1fr;
    }
    
    .copyright-notice, .game-disclaimer {
        padding: 20px;
    }
    
    .instruction-item {
        padding: 25px 20px;
    }
    
    .phase-number {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .instruction-icon {
        font-size: 3rem;
    }
    
    .tips-grid {
        gap: 12px;
    }
    
    .tip-item {
        padding: 12px;
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .flow-intro {
        font-size: 1.1rem;
        padding: 0 10px;
    }
    
    #game-container {
        min-height: 400px; /* 移动端减少高度 */
    }
    
    #game-container canvas {
        border: 1px solid white;
        max-width: min(95vw, 95vh); /* 使用视口最小值保持正方形 */
        max-height: min(95vw, 95vh);
        width: auto;
        height: auto;
        aspect-ratio: 1 / 1; /* 强制 1:1 比例 */
    }
    
    .loading-content {
        padding: 20px;
    }
    
    .loading-spinner {
        width: 40px;
        height: 40px;
        margin-bottom: 20px;
    }
    
    .loading-title {
        font-size: 1.4rem;
    }
    
    .loading-text {
        font-size: 1rem;
    }
}

@media (max-height: 700px) {
    #game-container canvas {
        border: 1px solid white;
        max-width: min(95vw, 95vh); /* 保持正方形比例 */
        max-height: min(95vw, 95vh);
        width: auto;
        height: auto;
        aspect-ratio: 1 / 1;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    #game-container {
        min-height: 320px;
        padding: 10px;
    }
    
    #game-container canvas {
        max-width: min(90vw, 90vh); /* 更小的边距 */
        max-height: min(90vw, 90vh);
        border-width: 1px;
    }
}