/* 全局样式 */
:root {
    --primary-color: #4CAF50;
    --primary-dark: #3a8c3d;
    --primary-light: #81c784;
    --secondary-color: #ff7700;
    --secondary-dark: #d65c00;
    --secondary-light: #ffaa66;
    --success-color: #4CAF50;
    --warning-color: #e67e22;
    --danger-color: #e74c3c;
    --neutral-color: #34495e;
    --light-bg: #edf6ff;
    --card-bg: white;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --border-radius: 12px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 游戏容器 */
.game-container {
    width: 100%;
    max-width: 1400px;
    height: 98vh;
    margin: 0 auto;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

/* 页面通用样式 */
.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.hidden {
    display: none;
}

/* 按钮通用样式 */
.primary-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 12px 30px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.primary-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.primary-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.primary-btn:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 首页样式 */
#homePage {
    background-color: var(--light-bg);
}

.home-content {
    flex: 1;
    padding: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    z-index: 2;
}

.home-illustration {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.home-illustration img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.game-title {
    font-size: 4em;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.game-subtitle {
    font-size: 1.6em;
    color: var(--secondary-color);
    margin-bottom: 30px;
}

.home-desc {
    max-width: 80%;
    font-size: 1.2em;
    margin-bottom: 40px;
    line-height: 1.7;
}

/* 关卡过场页样式 */
#levelIntroPage {
    background-color: var(--light-bg);
}

.level-intro-content {
    flex: 1;
    padding: 40px 40px 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    overflow-y: auto;
    justify-content: center;
    align-items: flex-start;
}

.level-map-preview {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.level-map-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.level-title {
    font-size: 2.2em;
    color: var(--primary-color);
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.level-title:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 4px;
    background-color: var(--secondary-color);
    border-radius: 2px;
}

.mission-brief {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.mission-brief h3 {
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.route-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
    align-self: center;
}

.route-point {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.route-point i {
    font-size: 28px;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.route-arrow {
    font-size: 30px;
    color: var(--secondary-color);
    font-weight: bold;
}

/* 主游戏页样式 */
#gamePage {
    flex-direction: column;
}

.game-header {
    background: linear-gradient(to right, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 5px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-area i {
    font-size: 1.8em;
}

.logo-area h1 {
    font-size: 1.6em;
    color: white;
    font-weight: 600;
}

.level-indicator {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 5px 20px;
}

.level-tag {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95em;
}

.progress-bar {
    width: 150px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 50%; /* 初始状态：第一关，50% */
    background-color: white;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.next-level-btn {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.next-level-btn:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.25);
}

.next-level-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.game-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.map-container {
    flex: 2.5;
    background-color: #e6f2ff;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

#mapCanvas {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background-color: #e6f7e0; /* 更淡的绿色背景 */
    /* 点缀小草和小花SVG纹理 */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='60'><g><rect width='80' height='60' fill='none'/><path d='M10 55 Q12 50 14 55' stroke='%2396c24e' stroke-width='1.5' fill='none'/><path d='M30 50 Q32 45 34 50' stroke='%2377b255' stroke-width='1.2' fill='none'/><path d='M60 58 Q61 54 63 58' stroke='%2396c24e' stroke-width='1.5' fill='none'/><circle cx='20' cy='54' r='2' fill='%23ffd6e0'/><circle cx='50' cy='52' r='1.5' fill='%23fff7a0'/><circle cx='70' cy='56' r='1.5' fill='%23b6e388'/></g></svg>");
    background-size: 80px 60px;
}

.control-container {
    flex: 1;
    min-height: 200px;
    background-color: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    padding: 12px;
}

.command-panel {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 12px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.command-panel h2 {
    color: var(--primary-color);
    font-size: 1.4em;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.command-display {
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 15px;
    min-height: 50px;
    font-size: 1.2em;
    margin-bottom: 15px;
}

.word-blocks-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.word-btn {
    background-color: #f1f1f1;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.word-btn:hover {
    background-color: #e0e0e0;
    transform: translateY(-2px);
}

.word-btn:active {
    transform: translateY(0);
}

.command-actions {
    display: flex;
    gap: 6px;
    margin-top: 2px;
}

.action-btn {
    flex: 1;
    padding: 8px 4px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
    font-size: 0.95em;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.submit-btn {
    background: linear-gradient(to bottom, #2ecc71, #27ae60);
    color: white;
}

.submit-btn:hover {
    background: linear-gradient(to bottom, #27ae60, #219653);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.submit-btn:active {
    transform: translateY(0);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

.edit-btn {
    background: linear-gradient(to bottom, #3498db, #2980b9);
    color: white;
}

.edit-btn:hover {
    background: linear-gradient(to bottom, #2980b9, #2471a3);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.edit-btn:active {
    transform: translateY(0);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

.clear-btn {
    background: linear-gradient(to bottom, #e74c3c, #c0392b);
    color: white;
}

.clear-btn:hover {
    background: linear-gradient(to bottom, #c0392b, #a93226);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.clear-btn:active {
    transform: translateY(0);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

/* New styles for input area */
.command-input-area {
    margin-bottom: 6px;
}

.input-label {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--neutral-color);
}

.input-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    background-color: #f8f9fa;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.input-line span {
    color: #4a5568;
    font-weight: 500;
}

.command-input {
    flex-grow: 1;
    border: none;
    background: transparent;
    padding: 4px 0;
    font-size: 1.1em;
    text-align: center;
    min-width: 60px;
    max-width: 100px;
    border-bottom: 2px solid #ccc;
    outline: none;
    transition: border-color 0.3s ease;
}

.command-input.active-input {
    border-bottom-color: var(--primary-color);
    background-color: rgba(0, 120, 215, 0.05);
}

.angle-input {
    max-width: 80px;
}

.distance-input {
    max-width: 100px;
}

/* Styles for new button groups */
.buttons-container {
    background-color: rgba(240, 240, 240, 0.3);
    border-radius: 10px;
    padding: 5px;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 0; /* 移除按钮组底部间距，由容器统一管理 */
    justify-content: space-between;
}

.control-btn {
    background: linear-gradient(to bottom, #ffffff, #f3f3f3);
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 5px 0;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 0;
    flex: 1;
    text-align: center;
    max-width: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.control-btn:hover {
    background: linear-gradient(to bottom, #f8f8f8, #e8e8e8);
    transform: translateY(-1px);
    box-shadow: 0 2px 3px rgba(0,0,0,0.1);
}

.control-btn:active {
    background: linear-gradient(to bottom, #e8e8e8, #d8d8d8);
    transform: translateY(0);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

/* 方向按钮组样式 */
.direction-group {
    background-color: rgba(0, 120, 215, 0.08);
    padding: 4px;
    border-radius: 8px;
    margin-top: 0; /* 移除顶部间距，由容器管理 */
}

.direction-btn {
    color: #0078d7;
    font-weight: 500;
}

/* 数字按钮组样式 */
.number-group {
    background-color: rgba(255, 119, 0, 0.08);
    padding: 4px;
    border-radius: 8px;
    justify-content: space-between;
}

.number-btn {
    color: #ff7700;
    font-weight: 500;
}

.zero-btn {
    background: linear-gradient(to bottom, #ffffff, #f8f8f8);
}

/* 弹窗样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

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

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

.modal-content {
    background-color: white;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    animation: slideUp 0.4s ease forwards;
}

@keyframes slideUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.success-modal .modal-header {
    background-color: var(--success-color);
}

.error-modal .modal-header {
    background-color: var(--danger-color);
}

.modal-header {
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.modal-header i {
    font-size: 2em;
}

.modal-header h2 {
    font-size: 1.6em;
}

.modal-body {
    padding: 25px;
}

.stars-container {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.stars-container i {
    color: #f1c40f;
    font-size: 2.5em;
}

.error-feedback-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.feedback-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    border-radius: 8px;
    background-color: #f8f9fa;
}

.item-icon {
    font-size: 1.4em;
}

.item-icon .bi-check-circle-fill {
    color: var(--success-color);
}

.item-icon .bi-x-circle-fill {
    color: var(--danger-color);
}

.item-text {
    font-size: 1.1em;
}

.modal-btn {
    width: 100%;
    border: none;
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background-color 0.3s ease;
}

.modal-btn:hover {
    background-color: var(--primary-dark);
}

/* 结算页样式 */
#completionPage {
    justify-content: center;
    align-items: center;
    background-color: var(--light-bg);
}

.completion-content {
    width: 80%;
    max-width: 800px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 40px;
    text-align: center;
}

.completion-title {
    color: var(--primary-color);
    font-size: 2.5em;
    margin-bottom: 30px;
}

.completion-message {
    font-size: 1.2em;
    margin-bottom: 40px;
    line-height: 1.8;
}

.stats-summary {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-item i {
    font-size: 2em;
    color: var(--primary-color);
}

.stat-content {
    text-align: left;
}

.stat-title {
    font-size: 0.95em;
    color: var(--text-light);
}

.stat-value {
    font-size: 1.4em;
    font-weight: 600;
    color: var(--text-color);
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .home-content, .level-intro-content {
        padding: 30px;
    }
    
    .game-title {
        font-size: 3em;
    }
    
    .home-desc {
        max-width: 90%;
    }
}

@media (max-width: 992px) {
    .page {
        flex-direction: column;
    }
    
    .home-illustration, .level-map-preview {
        height: 300px;
    }
    
    .game-content {
        flex-direction: column;
    }
    
    .game-title {
        font-size: 2.5em;
    }
    
    .home-desc {
        max-width: 100%;
        margin-bottom: 20px;
    }
    
    .stats-summary {
        flex-direction: column;
        gap: 20px;
    }
    
    .stat-item {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .level-indicator {
        display: none;
    }
    
    .home-content, .level-intro-content {
        padding: 20px;
    }
    
    .command-panel {
        padding: 15px;
    }
    
    .completion-content {
        width: 90%;
        padding: 30px 20px;
    }
    
    .completion-title {
        font-size: 2em;
    }
}

@media (max-width: 576px) {
    .logo-area h1 {
        font-size: 1.3em;
    }
    
    .word-btn {
        padding: 6px 10px;
        font-size: 0.9em;
    }
} 