/* ===================================================================
   styles.css — 植物大战僵尸 · 无限成长版 样式
   =================================================================== */

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

body {
    background: linear-gradient(145deg, #1a3c1f, #2a5a2a);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    padding: 10px;
}

.game-wrapper {
    background: #4c7a4c;
    padding: 20px 30px 30px;
    border-radius: 48px 48px 32px 32px;
    box-shadow: 0 20px 30px rgba(0,0,0,0.7), inset 0 2px 4px rgba(255,255,200,0.3);
    border-bottom: 6px solid #2d4f2d;
    position: relative;
}

canvas {
    display: block;
    margin: 0 auto;
    width: 900px;
    height: 600px;
    border-radius: 24px;
    box-shadow: inset 0 0 0 2px #2f5a2f, 0 12px 18px rgba(0,0,0,0.5);
    background: #7cb87c;
    cursor: crosshair;
}

/* ---- 大厅导航 ---- */
.hall-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 0 0 8px;
}

.hall-nav a {
    background: #2e572e;
    color: #d4e8b0;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 4px 14px;
    border-radius: 30px;
    box-shadow: inset 0 2px 5px #1d3a1d;
    transition: 0.15s;
}

.hall-nav a:hover {
    background: #3a6a3a;
    color: #f9f1d9;
}

/* ---- 难度选择栏 ---- */
.difficulty-bar {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0 0 8px;
}

.diff-btn {
    background: #2e572e;
    border: none;
    color: #8aaa7a;
    font-weight: bold;
    font-size: 0.95rem;
    padding: 5px 16px;
    border-radius: 40px;
    box-shadow: inset 0 2px 5px #1d3a1d;
    cursor: pointer;
    transition: 0.15s ease;
    opacity: 0.6;
    flex: 1;
    max-width: 120px;
}

.diff-btn:hover {
    opacity: 0.9;
    color: #d4e8b0;
    background: #3a6a3a;
}

.diff-btn.active {
    opacity: 1;
    color: #f9f1d9;
    background: #4f8f4f;
    box-shadow: 0 2px 0 #2b4a2b, 0 0 8px rgba(100,200,100,0.3);
}

/* ---- 操作栏（重置按钮 + 设置） ---- */
.action-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 10px 0 0;
    flex-wrap: wrap;
}

.plant-panel {
    display: flex;
    justify-content: center;
    gap: 12px;
    background: #2e572e;
    padding: 6px 16px;
    border-radius: 60px;
    box-shadow: inset 0 2px 5px #1d3a1d, 0 4px 6px rgba(0,0,0,0.3);
    margin: 0 0 8px;
}

.plant-btn {
    background: #5f8b4b;
    border: none;
    color: #f9f1d9;
    font-weight: bold;
    font-size: 1.2rem;
    padding: 6px 18px;
    border-radius: 40px;
    box-shadow: 0 4px 0 #2b4a2b, 0 2px 8px rgba(0,0,0,0.4);
    transition: 0.07s ease;
    cursor: pointer;
    letter-spacing: 0.5px;
    min-width: 80px;
}

.plant-btn.active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #1f3a1f;
    background: #7daf62;
    outline: 2px solid #f9f1d9;
}

.plant-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0px 0 #1f3a1f;
}

/* ---- 计分板 ---- */
.score-board {
    background: #1d3a1d;
    padding: 5px 14px;
    border-radius: 40px;
    box-shadow: inset 0 2px 6px #0f1f0f;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 8px;
    font-size: 0.95rem;
}

.reset-btn {
    background: #ab5a3a;
    border: none;
    color: #f9f1d9;
    font-weight: bold;
    font-size: 1.2rem;
    padding: 6px 18px;
    border-radius: 40px;
    box-shadow: 0 4px 0 #6d3a24;
    transition: 0.07s ease;
    cursor: pointer;
    white-space: nowrap;
}

.reset-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0px 0 #6d3a24;
}

.reset-hard {
    background: #6a3a4a;
    box-shadow: 0 4px 0 #3d2230;
    font-size: 1.0rem;
    padding: 6px 14px;
}

.reset-hard:active {
    box-shadow: 0 0px 0 #3d2230;
}

.info-text {
    background: #121f12;
    padding: 4px 16px;
    border-radius: 30px;
    font-size: 1.0rem;
}

.hint-text {
    background: #2e4a2e;
    padding: 4px 18px;
    border-radius: 40px;
    font-size: 0.95rem;
    color: #d4e8b0;
    min-width: 120px;
    text-align: center;
}

.round-display {
    background: #1a2f1a;
    padding: 4px 18px;
    border-radius: 40px;
    font-size: 1.0rem;
    color: #f9d97a;
}

/* ---- 设置面板 ---- */
.settings-toggle {
    background: rgba(0,0,0,0.3);
    border: none;
    color: #8aaa7a;
    font-size: 0.95rem;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: 0.2s;
    opacity: 0.6;
}

.settings-toggle:hover {
    opacity: 0.9;
    color: #f9f1d9;
}

.settings-panel {
    display: none;
    background: #1f3a1f;
    padding: 18px 22px;
    border-radius: 32px;
    margin-top: 14px;
    box-shadow: inset 0 0 0 2px #2f5a2f, 0 8px 20px rgba(0,0,0,0.6);
    color: #d4e8b0;
    font-size: 0.9rem;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px 16px;
    border: 1px solid #4f7a4f;
}

.settings-panel.open {
    display: grid;
}

.settings-panel label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-weight: 500;
    font-size: 0.85rem;
}

.settings-panel input {
    background: #2a4a2a;
    border: 1px solid #4f7a4f;
    border-radius: 30px;
    padding: 5px 12px;
    color: #f9f1d9;
    font-weight: bold;
    font-size: 0.9rem;
    width: 100%;
    outline: none;
    transition: 0.15s;
}

.settings-panel input:focus {
    border-color: #b3d9a0;
    box-shadow: 0 0 10px #3f7a3f;
}

/* ---- 预设下拉框 ---- */
.preset-label {
    grid-column: 1 / -1;
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 1rem !important;
    padding-bottom: 6px;
    border-bottom: 1px solid #3f6a3f;
    margin-bottom: 4px;
}

.preset-label select {
    background: #2a4a2a;
    border: 1px solid #4f7a4f;
    border-radius: 30px;
    padding: 5px 14px;
    color: #f9f1d9;
    font-weight: bold;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    min-width: 110px;
}

.preset-label select:focus {
    border-color: #b3d9a0;
    box-shadow: 0 0 10px #3f7a3f;
}

.settings-panel .apply-btn {
    grid-column: 1 / -1;
    background: #5f8b4b;
    border: none;
    color: #f9f1d9;
    font-weight: bold;
    font-size: 1.1rem;
    padding: 8px;
    border-radius: 40px;
    cursor: pointer;
    box-shadow: 0 4px 0 #2b4a2b;
    transition: 0.07s;
    margin-top: 4px;
}

.settings-panel .apply-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0px 0 #2b4a2b;
}

/* ---- 开关样式 ---- */
.toggle-label {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.9rem !important;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #3a5a3a;
    border-radius: 24px;
    transition: 0.3s;
}

.slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #a0c0a0;
    border-radius: 50%;
    transition: 0.3s;
}

.switch input:checked + .slider {
    background: #5f8b4b;
}

.switch input:checked + .slider::before {
    transform: translateX(20px);
    background: #f9f1d9;
}

/* ---- 响应式 ---- */
@media (max-width: 950px) {
    .game-wrapper { padding: 10px; }
    canvas { width: 100%; height: auto; aspect-ratio: 900/600; }
    .difficulty-bar { gap: 6px; margin: 0 0 6px; }
    .diff-btn { font-size: 0.85rem; padding: 4px 12px; max-width: 100px; }
    .score-board { font-size: 0.85rem; padding: 4px 10px; gap: 6px; margin: 0 0 6px; }
    .plant-panel { gap: 8px; padding: 4px 12px; margin: 0 0 6px; }
    .plant-btn { font-size: 1.0rem; padding: 4px 14px; min-width: 60px; }
    .action-bar { gap: 8px; margin: 8px 0 0; }
    .reset-btn { font-size: 1.0rem; padding: 4px 14px; }
    .settings-panel { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 500px) {
    .diff-btn { font-size: 0.8rem; padding: 3px 10px; max-width: 80px; }
    .plant-btn { font-size: 0.9rem; padding: 3px 10px; min-width: 50px; }
    .reset-btn { font-size: 0.85rem; padding: 3px 10px; }
    .settings-panel { grid-template-columns: 1fr; }
}
