/* 游戏页面样式 */

/* 主容器 */
.game-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* 面包屑导航 */
.breadcrumb {
    margin-bottom: 2rem;
    font-size: 0.9rem;
    color: #666;
}

.breadcrumb a {
    color: #0066cc;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* 游戏选择区域 */
.game-selection {
    margin-bottom: 3rem;
    text-align: center;
}

.game-selection h2 {
    margin-bottom: 0.5rem;
    color: #00838f;
    font-size: 2.2rem;
}

.section-description {
    margin-bottom: 2rem;
    color: #555;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.game-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
}

.game-card {
    flex: 1;
    min-width: 280px;
    max-width: 350px;
    background-color: #fff;
    border-radius: 16px;
    box-shadow: 0 6px 16px rgba(0, 131, 143, 0.1);
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 131, 143, 0.15);
}

.game-icon {
    margin-bottom: 1rem;
    display: inline-block;
    padding: 1rem;
    border-radius: 50%;
    background-color: rgba(0, 131, 143, 0.1);
    color: #00838f;
    width: 280px;
    height: 280px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    font-size: 3.5rem;
}

.game-image {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    border-radius: 50%;
}

.game-card h3 {
    color: #00838f;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.game-card p {
    margin-bottom: 1.5rem;
    color: #555;
}

.game-difficulty {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.difficulty {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
}

.easy {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.medium {
    background-color: #fff3e0;
    color: #ef6c00;
}

.hard {
    background-color: #ffebee;
    color: #c62828;
}

.stars {
    color: #ffc107;
    letter-spacing: 2px;
}

.play-btn {
    padding: 0.8rem 1.5rem;
    background-color: #00acc1;
    color: white;
    border: none;
    border-radius: 30px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 172, 193, 0.3);
}

.play-btn:hover {
    background-color: #0097a7;
    box-shadow: 0 6px 12px rgba(0, 151, 167, 0.4);
    transform: translateY(-2px);
}

/* 游戏区域 */
.game-area {
    margin-bottom: 3rem;
    background-color: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: none; /* 初始隐藏，通过JavaScript显示 */
}

.game-controls {
    background-color: #f5f5f5;
    background-image: linear-gradient(to right, #f0f8ff, #e6f3ff);
    padding: 1.2rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
}

.control-header {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.control-header h3 {
    margin: 0;
    color: #00838f;
    font-size: 1.5rem;
}

.score-display, .timer {
    display: flex;
    align-items: center;
    background-color: #e0f7fa;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.score-display {
    background-color: #e3f2fd;
    color: #0277bd;
}

.timer {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.control-buttons {
    display: flex;
    gap: 1rem;
}

.control-buttons button {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#restart-game {
    background-color: #e0f7fa;
    color: #00838f;
}

#restart-game:hover {
    background-color: #b2ebf2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#back-to-selection {
    background-color: #f5f5f5;
    color: #555;
    border: 1px solid #ddd;
}

#back-to-selection:hover {
    background-color: #eeeeee;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 游戏内容 */
.game-content {
    padding: 2rem;
    display: none; /* 初始隐藏，通过JavaScript显示 */
}

/* 抛物线射手游戏 */
#parabola-shooter-game {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

.game-canvas-container {
    flex: 2;
    min-height: 450px;
    min-width: 600px;
    border-radius: 12px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
    background-color: #f9f9f9;
    margin-bottom: 20px;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #e0e0e0;
}

.game-canvas-container canvas {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    background-color: white;
}

.game-panel {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.game-instructions {
    background-color: #e0f7fa;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border-left: 4px solid #00acc1;
}

.game-instructions:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.game-instructions h4 {
    color: #00838f;
    margin-top: 0;
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
}

.game-controls-panel {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.control-group {
    margin-bottom: 1.2rem;
    display: flex;
    flex-direction: column;
}

.control-group label {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #333;
}

.control-group input[type="range"] {
    width: 100%;
    margin-bottom: 0.5rem;
    height: 8px;
    -webkit-appearance: none;
    background: #e0e0e0;
    border-radius: 4px;
    outline: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #00acc1;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #0097a7;
    transform: scale(1.1);
}

.control-group input[type="range"]:focus {
    box-shadow: 0 0 0 2px rgba(0, 172, 193, 0.3);
}

#shoot-button {
    width: 100%;
    padding: 1rem;
    margin-top: 1rem;
    background-color: #00acc1;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 172, 193, 0.3);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#shoot-button:hover {
    background-color: #0097a7;
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 151, 167, 0.4);
}

.equation-display {
    background-color: #f0f4f8;
    padding: 1.2rem;
    border-radius: 12px;
    text-align: center;
    font-size: 1.1rem;
    color: #333;
    font-weight: 500;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #4a6da7;
}

#current-equation {
    font-weight: bold;
    color: #0066cc;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
}

/* 方程配对游戏 */
.matching-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
}

.graphs-section, .equations-section {
    width: 100%;
}

.graphs-section h4, .equations-section h4 {
    color: #00838f;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.3rem;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.graphs-section h4:after, .equations-section h4:after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #00acc1;
    border-radius: 2px;
}

/* 特殊网格布局，当有5个或6个元素时自动调整为3×2布局 */
.graph-items, .equation-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

/* 当有5个或6个元素时的布局 - 使用3×2网格 */
.graph-items.items-5, .equation-grid.items-5,
.graph-items.items-6, .equation-grid.items-6 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

/* 5个元素时，最后一个元素不显示 */
.graph-items.items-5 > *:nth-child(6), 
.equation-grid.items-5 > *:nth-child(6) {
    display: none;
}

.graph-items {
    margin-bottom: 2.5rem;
}

.graph-item {
    background-color: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    position: relative;
    padding: 0.5rem;
}

.graph-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    border-color: #b2ebf2;
}

.graph-item.selected {
    border-color: #00acc1;
    box-shadow: 0 0 0 3px rgba(0, 172, 193, 0.3);
    transform: translateY(-5px);
}

.graph-item.matched {
    border-color: #81c784;
    background-color: rgba(129, 199, 132, 0.1);
}

.graph-item canvas {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.equation-item {
    background-color: #e3f2fd;
    padding: 1.2rem 1rem;
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    border: 2px solid transparent;
    font-size: 1.1rem;
}

.equation-item:hover {
    background-color: #bbdefb;
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
    border-color: #90caf9;
}

.equation-item.selected {
    background-color: #90caf9;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.3);
    border-color: #2196f3;
    transform: translateY(-5px);
}

.equation-item.matched {
    background-color: rgba(129, 199, 132, 0.2);
    border-color: #81c784;
}

/* 正确匹配和错误匹配的动画 */
@keyframes correct-match {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes wrong-match {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.correct-animation {
    animation: correct-match 0.6s ease;
}

.incorrect-animation {
    animation: wrong-match 0.5s ease;
}

/* 顶点猎人游戏 */
.vertex-hunter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

.graph-display {
    width: 100%;
    min-height: 400px;
    min-width: 500px;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
    margin-bottom: 20px;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#vertex-hunter-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: white;
}

.vertex-input-area {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.current-function {
    background-color: #e0f7fa;
    padding: 1rem;
    border-radius: 8px;
}

.current-function h4 {
    color: #00838f;
    margin-bottom: 0.5rem;
}

.function-display {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1.2rem;
}

.vertex-input-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background-color: #f5f5f5;
    border-radius: 8px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-weight: bold;
    color: #333;
}

.input-group input {
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#submit-vertex {
    margin-top: 0.5rem;
    padding: 0.8rem;
    background-color: #00acc1;
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#submit-vertex:hover {
    background-color: #0097a7;
}

.feedback-message {
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
}

.feedback-message.correct {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.feedback-message.incorrect {
    background-color: #ffebee;
    color: #c62828;
}

/* 游戏结束弹窗 */
.game-over-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    text-align: center;
}

.modal-content h2 {
    color: #00838f;
    margin-bottom: 1rem;
}

#final-score {
    font-size: 1.5rem;
    font-weight: bold;
    color: #00acc1;
}

.achievements {
    margin: 1.5rem 0;
}

.achievement {
    display: inline-flex;
    align-items: center;
    padding: 0.8rem 1.5rem;
    background-color: #e0f7fa;
    border-radius: 30px;
}

.achievement-icon {
    font-size: 1.5rem;
    margin-right: 0.8rem;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.modal-buttons button {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#play-again {
    background-color: #00acc1;
    color: white;
}

#play-again:hover {
    background-color: #0097a7;
}

#choose-another-game {
    background-color: #f5f5f5;
    color: #555;
    border: 1px solid #ddd;
}

#choose-another-game:hover {
    background-color: #eeeeee;
}

/* 排行榜 */
.leaderboard {
    margin-bottom: 3rem;
}

.leaderboard h2 {
    margin-bottom: 1.5rem;
    color: #00838f;
    text-align: center;
}

.leaderboard-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.6rem 1.2rem;
    background-color: #f5f5f5;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background-color: #e0f7fa;
}

.tab-btn.active {
    background-color: #00acc1;
    color: white;
}

.leaderboard-content {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.leaderboard-table th {
    background-color: #e0f7fa;
    color: #00838f;
}

.leaderboard-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.leaderboard-table tr:hover {
    background-color: #f0f0f0;
}

/* 暗黑模式样式 */
body.dark-mode .game-card,
body.dark-mode .game-area,
body.dark-mode .leaderboard-content,
body.dark-mode .modal-content {
    background-color: #2c3e50;
}

body.dark-mode .game-controls {
    background-color: #1e272e;
}

body.dark-mode .game-canvas-container,
body.dark-mode .equation-display,
body.dark-mode .vertex-input-form,
body.dark-mode .graph-display,
body.dark-mode .graph-item {
    background-color: #34495e;
}

body.dark-mode .game-instructions,
body.dark-mode .current-function {
    background-color: #1a2930;
}

body.dark-mode .score-display,
body.dark-mode .timer {
    background-color: #1a2930;
    color: #e0f7fa;
}

body.dark-mode #restart-game {
    background-color: #1a2930;
    color: #4db6ac;
}

body.dark-mode .tab-btn {
    background-color: #34495e;
    color: #e0e0e0;
}

body.dark-mode .tab-btn.active {
    background-color: #00838f;
}

body.dark-mode .leaderboard-table th {
    background-color: #1a2930;
}

body.dark-mode .leaderboard-table tr:nth-child(even) {
    background-color: #34495e;
}

body.dark-mode .leaderboard-table tr:hover {
    background-color: #2c3e50;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .control-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    #parabola-shooter-game,
    .vertex-hunter-container {
        flex-direction: column;
    }
    
    .game-canvas-container,
    .graph-display {
        height: 300px;
    }
    
    .graph-items, .equation-grid, 
    .graph-items.items-5, .equation-grid.items-5,
    .graph-items.items-6, .equation-grid.items-6 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .game-card {
        min-width: 100%;
    }
    
    .leaderboard-tabs {
        flex-direction: column;
        align-items: center;
    }
}

/* 响应式设计 - 在小屏幕上改为单列布局 */
@media (max-width: 600px) {
    .graph-items, .equation-grid,
    .graph-items.items-5, .equation-grid.items-5,
    .graph-items.items-6, .equation-grid.items-6 {
        grid-template-columns: 1fr;
    }
}

/* 暗黑模式下的游戏图标 */
body.dark-mode .game-icon {
    background-color: rgba(0, 188, 212, 0.15);
} 