/* 主题变量 */
:root {
    /* 浅色主题 */
    --primary-color: #4A90E2;
    --secondary-color: #50E3C2;
    --background-color: #FFFFFF;
    --surface-color: #F5F5F5;
    --text-color: #333333;
    --text-secondary: #666666;
    --border-color: #E0E0E0;
    --success-color: #4CAF50;
    --error-color: #F44336;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --grid-color: rgba(0, 0, 0, 0.05);
    --game-border-color: #757577;
}

/* 深色主题 */
[data-theme="dark"] {
    --primary-color: #64B5F6;
    --secondary-color: #4DB6AC;
    --background-color: #121212;
    --surface-color: #1E1E1E;
    --text-color: #FFFFFF;
    --text-secondary: #B0B0B0;
    --border-color: #333333;
    --success-color: #81C784;
    --error-color: #E57373;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --grid-color: rgba(255, 255, 255, 0.05);
}

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

/* 布局 */
.container {
    max-width: 1200px;
    margin: 20px auto;
}

main {
    min-height: calc(100vh - 120px);
    padding: 20px 0;
}

/* 导航栏样式 */
.top-nav {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 10px 0;
}

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

.nav-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
    font-size: 1.5em;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.nav-brand:hover {
    transform: scale(1.05);
}

.brand-icon {
    width: 28px;
    height: 28px;
    margin-right: 10px;
    color: #4CAF50;
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #666;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(76, 175, 80, 0.1);
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.nav-link:hover::before {
    transform: translateY(0);
}

.nav-link:hover {
    color: #4CAF50;
}

.nav-link.active {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
}

.nav-link.active .nav-icon {
    color: #4CAF50;
}

.nav-icon {
    width: 20px;
    height: 20px;
    color: #666;
    transition: color 0.3s ease;
    position: relative;
    z-index: 1;
}

.nav-link:hover .nav-icon {
    color: #4CAF50;
}

.nav-text {
    position: relative;
    z-index: 1;
}

/* 响应式导航栏 */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 15px;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    .nav-link {
        padding: 6px 10px;
        font-size: 0.9em;
    }
}

/* 卡片样式 */
.card {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

/* 按钮样式 */
.btn {
    position: relative;
    font-family: 'Patrick Hand', cursive;
    font-size: 1.2em;
    padding: 12px 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s;
    overflow: visible;
}

.btn::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: transparent;
    border: 2px solid var(--primary-color);
    border-radius: 14px;
    transform: rotate(-1deg);
    transition: transform 0.2s;
}

.btn::after {
    content: '🎲';
    position: absolute;
    font-size: 1.4em;
    right: -15px;
    top: -15px;
    transform: rotate(15deg);
    opacity: 0;
    transition: all 0.3s;
}

.btn:hover {
    transform: translateY(-2px) rotate(1deg);
}

.btn:hover::before {
    transform: rotate(2deg);
}

.btn:hover::after {
    opacity: 1;
    transform: rotate(-15deg);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn:disabled::before {
    border-style: dashed;
}

.btn:disabled::after {
    display: none;
}

/* 按钮动画 */
@keyframes wiggle {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
}

/* 游戏按钮特殊样式 */
#roll-btn, #flip-btn, #shake-btn, #spin-btn {
    animation: wiggle 2s ease-in-out infinite;
    margin: 20px 0;
}

#roll-btn:hover, #flip-btn:hover, #shake-btn:hover, #spin-btn:hover {
    animation: none;
}

/* 游戏按钮图标 */
#roll-btn::after { content: '🎲'; }
#flip-btn::after { content: '🪙'; }
#shake-btn::after { content: '🎱'; }
#spin-btn::after { content: '🎡'; }

/* 小按钮样式 */
.btn.btn-small {
    font-size: 1em;
    padding: 8px 20px;
    background: transparent;
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.btn.btn-small.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn.btn-small:hover {
    background: var(--surface-color);
    transform: translateY(-2px);
}

.btn.btn-small.active:hover {
    background: var(--primary-color);
}

.btn.btn-small::before {
    border-color: var(--border-color);
}

.btn.btn-small.active::before {
    border-color: var(--primary-color);
}

.btn.btn-small::after {
    display: none;
}

/* 手绘容器 */
.sketch-container {
    position: relative;
    padding: 20px;
    border-radius: 12px;
    background-color: var(--surface-color);
    background-image: linear-gradient(rgba(197, 246, 248, 0.9), rgba(170, 170, 170, 0.9)), url('../assets/images/background.png');
    background-position: center;
    background-repeat: no-repeat;
    border: 2px solid var(--game-border-color);
    box-shadow: 
        inset 2px 2px 5px rgba(255, 255, 255, 0.5),
        inset -2px -2px 5px rgba(0, 0, 0, 0.1),
        5px 5px 10px rgba(0, 0, 0, 0.05);
}

.sketch-container::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: var(--game-border-color);
    transform: rotate(-1deg);
}

.sketch-container::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 10px;
    right: 10px;
    height: 2px;
    background: var(--game-border-color);
    transform: rotate(1deg);
}

/* 引导页样式 */
.onboarding {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--background-color);
    z-index: 2000;
    display: none;
}

.onboarding-slide {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.onboarding-dots {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--border-color);
    transition: background-color 0.3s;
}

.onboarding-dot.active {
    background-color: var(--primary-color);
}

/* 页面过渡动画 */
.page-transition {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
}

/* 手绘效果 */
.doodle-canvas {
    pointer-events: none;
    z-index: 1;
}

[data-doodle] {
    position: relative;
}

/* 无障碍支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* 加载动画 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 工具类 */
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.hidden { display: none; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }

/* 设备框架 */
.device-frame {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 2000;
}

.device-frame::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(var(--shadow-color), transparent);
    opacity: 0.5;
}

.device-frame::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(transparent, var(--shadow-color));
    opacity: 0.5;
}

/* 网格背景 */
.grid-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.5;
    z-index: -1;
}

/* 游戏卡片网格 */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
    margin-bottom: 80px; /* 为底部导航留出空间 */
}

.game-card {
    background-color: var(--surface-color);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px var(--shadow-color);
}

.game-card h3 {
    margin: 12px 0 4px;
    font-size: 20px;
    font-weight: 600;
}

.game-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.game-header {
    text-align: center;
    padding: 0 20px 20px;
    margin-bottom: 30px;
}

.game-title {
    font-family: 'Patrick Hand', cursive;
    font-size: 2.5em;
    color: #333;
    margin-bottom: 10px;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--surface-color);
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    box-shadow: 0 -2px 10px var(--shadow-color);
    z-index: 1001;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-secondary);
    gap: 4px;
    transition: color 0.3s;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item span {
    font-size: 12px;
} 