/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --dark-color: #1f2937;
    --light-color: #f8fafc;
    --gray-color: #6b7280;
    --white-color: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: var(--light-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    font-size: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white-color);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--white-color);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--white-color);
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

/* 导航栏 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: var(--shadow);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-logo {
    display: flex;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

.nav-logo i {
    margin-right: 8px;
    font-size: 28px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-link {
    text-decoration: none;
    color: var(--dark-color);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.bar {
    width: 25px;
    height: 3px;
    background: var(--dark-color);
    margin: 3px 0;
    transition: var(--transition);
}

/* 主页横幅 */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white-color);
    padding: 100px 0 50px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    flex: 1;
    max-width: 600px;
    z-index: 1;
    position: relative;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: bold;
    margin-bottom: 20px;
    animation: fadeInUp 1s ease;
}

.hero-subtitle {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.9;
    animation: fadeInUp 1s ease 0.2s both;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    animation: fadeInUp 1s ease 0.4s both;
}

.hero-visual {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.floating-cube {
    animation: float 6s ease-in-out infinite;
}

.cube {
    width: 100px;
    height: 100px;
    position: relative;
    transform-style: preserve-3d;
    animation: rotate 20s linear infinite;
}

.face {
    position: absolute;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.front { transform: translateZ(50px); }
.back { transform: translateZ(-50px) rotateY(180deg); }
.right { transform: translateX(50px) rotateY(90deg); }
.left { transform: translateX(-50px) rotateY(-90deg); }
.top { transform: translateY(-50px) rotateX(90deg); }
.bottom { transform: translateY(50px) rotateX(-90deg); }

/* 精彩推荐 */
.featured {
    padding: 80px 0;
    background: var(--white-color);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 50px;
    color: var(--dark-color);
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 50px;
}

.featured-card {
    background: var(--white-color);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    text-align: center;
}

.featured-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.card-image {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white-color);
    font-size: 32px;
}

.card-content h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--dark-color);
}

.card-content p {
    color: var(--gray-color);
    margin-bottom: 20px;
    line-height: 1.6;
}

/* 游戏特色 */
.features {
    padding: 80px 0;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

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

.feature-item {
    text-align: center;
    padding: 30px 20px;
}

.feature-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--accent-color), #f97316);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white-color);
    font-size: 28px;
}

.feature-item h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--dark-color);
}

.feature-item p {
    color: var(--gray-color);
    line-height: 1.6;
}

/* 魔方游戏着陆页样式 */
.rubiks-cube-container {
    width: 400px;
    height: 400px;
    margin: 0 auto;
    position: relative;
    perspective: 1200px;
}

/* 魔方小块样式 */
.cube-piece {
    position: absolute;
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.cube-piece:hover {
    transform: scale(1.05);
}

.piece-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 1px solid #333;
    box-sizing: border-box;
    transition: all 0.3s ease;
    cursor: pointer;
}

.piece-face:hover {
    filter: brightness(1.2);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* 魔方颜色 */
.piece-face.front { background: #ff0000; }
.piece-face.back { background: #ff8c00; }
.piece-face.right { background: #0066ff; }
.piece-face.left { background: #00cc00; }
.piece-face.top { background: #ffffff; }
.piece-face.bottom { background: #ffff00; }

.game-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 30px;
}

.stat-item {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 25px;
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--white-color);
}

/* 魔方控制区域 */
.rubiks-controls-section {
    padding: 60px 0;
    background: var(--white-color);
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    margin-top: 40px;
}

.control-group {
    background: var(--light-color);
    padding: 30px;
    border-radius: var(--border-radius);
    text-align: center;
}

.control-group h3 {
    margin-bottom: 20px;
    color: var(--dark-color);
    font-size: 1.3rem;
}

.control-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

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

.instruction-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: var(--white-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.instruction-item i {
    color: var(--primary-color);
    font-size: 1.2rem;
    width: 20px;
}

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

.stat-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--white-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.stat-title {
    font-weight: 600;
    color: var(--dark-color);
}

.stat-display .stat-value {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.1rem;
}

/* 页脚 */
.footer {
    background: var(--dark-color);
    color: var(--white-color);
    padding: 50px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 30px;
}

.footer-section h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section a {
    color: var(--gray-color);
    text-decoration: none;
    transition: var(--transition);
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--gray-color);
    color: var(--gray-color);
}

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

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

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

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--white-color);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow);
        padding: 20px 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .nav-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .hero {
        flex-direction: column;
        text-align: center;
        padding: 120px 20px 50px;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .hero-visual {
        margin-top: 50px;
    }

    .cube {
        width: 80px;
        height: 80px;
    }

    .face {
        width: 80px;
        height: 80px;
    }

    .front { transform: translateZ(40px); }
    .back { transform: translateZ(-40px) rotateY(180deg); }
    .right { transform: translateX(40px) rotateY(90deg); }
    .left { transform: translateX(-40px) rotateY(-90deg); }
    .top { transform: translateY(-40px) rotateX(90deg); }
    .bottom { transform: translateY(40px) rotateX(-90deg); }

    .featured-grid {
        grid-template-columns: 1fr;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .rubiks-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .rubiks-cube-container {
        width: 300px;
        height: 300px;
    }

    .controls-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .control-buttons {
        flex-direction: column;
        align-items: center;
    }

    .game-stats {
        flex-direction: column;
        gap: 20px;
    }

    .section-title {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .featured-card {
        padding: 20px;
    }

    .rubiks-cube {
        width: 200px;
        height: 200px;
    }

    .cube {
        width: 60px;
        height: 60px;
    }

    .face {
        width: 60px;
        height: 60px;
    }

    .front { transform: translateZ(30px); }
    .back { transform: translateZ(-30px) rotateY(180deg); }
    .right { transform: translateX(30px) rotateY(90deg); }
    .left { transform: translateX(-30px) rotateY(-90deg); }
    .top { transform: translateY(-30px) rotateX(90deg); }
    .bottom { transform: translateY(30px) rotateX(-90deg); }
}
