.maze-tool-wrapper { --p-bg: #ffffff; --p-border: #e2e8f0; --p-primary: #3b82f6; --p-text: #0f172a; width: 100%; max-width: 800px; margin: 0 auto; background: var(--p-bg); border-radius: 24px; padding: 32px; border: 1px solid var(--p-border); box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05); transition: 0.3s; display: flex; flex-direction: column; align-items: center; }
.maze-header-main { font-size: 1.5rem; font-weight: 600; color: var(--p-text); margin-bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; }
.maze-badge { background: #dbeafe; color: #1d4ed8; padding: 4px 12px; border-radius: 30px; font-size: 0.8rem; font-weight: 500; }
.maze-subtitle { color: #64748b; font-size: 0.95rem; padding-bottom: 16px; border-bottom: 1px solid var(--p-border); margin-bottom: 24px; text-align: center; width: 100%; }

/* 难度控制面板 */
.maze-control-panel { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-bottom: 24px; width: 100%; }
.maze-select { padding: 10px 16px; background: #f8fafc; border: 1px solid #cbd5e1; color: var(--p-text); border-radius: 12px; outline: none; font-size: 1rem; font-weight: 600; cursor: pointer; transition: 0.2s; }
.maze-select:focus { border-color: var(--p-primary); }
.maze-btn { background: var(--p-primary); color: white; border: none; padding: 10px 20px; border-radius: 12px; font-weight: 600; cursor: pointer; transition: 0.2s; box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3); display: flex; align-items: center; gap: 6px; justify-content: center; font-size: 1rem; }
.maze-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(59, 130, 246, 0.4); }

/* HUD 数据显示台 */
.maze-hud { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; max-width: 600px; margin-bottom: 20px; }
.maze-stat-box { background: #f8fafc; border: 1px solid var(--p-border); border-radius: 12px; padding: 10px; text-align: center; box-shadow: inset 0 2px 4px rgba(0,0,0,0.02); }
.maze-stat-label { font-size: 0.8rem; color: #64748b; margin-bottom: 4px; font-weight: 600; text-transform: uppercase; }
.maze-stat-val { font-size: 1.25rem; font-weight: 800; color: var(--p-text); font-family: monospace; }

/* 玩法说明条 */
.maze-instruction { width: 100%; max-width: 600px; background: #f1f5f9; border-radius: 12px; padding: 12px 16px; margin-bottom: 20px; color: #475569; font-size: 0.9rem; text-align: center; border: 1px solid #cbd5e1; line-height: 1.5; }

/* 游戏画布区 */
.maze-board { position: relative; width: 100%; max-width: 600px; aspect-ratio: 1 / 1; background: #0f172a; border-radius: 16px; border: 4px solid #334155; display: grid; place-items: center; overflow: hidden; box-shadow: 0 15px 30px rgba(0,0,0,0.2); outline: none; cursor: grab; }
.maze-board:active { cursor: grabbing; }
.maze-board canvas { width: 96%; height: 96%; image-rendering: pixelated; border-radius: 8px; }

/* 移动端十字方向键 (D-Pad) */
.maze-dpad { display: grid; grid-template-columns: repeat(3, 60px); grid-template-rows: repeat(2, 60px); gap: 8px; justify-content: center; margin-top: 24px; }
.maze-dpad-btn { background: #f1f5f9; border: 2px solid #cbd5e1; border-radius: 12px; font-size: 1.5rem; color: #475569; display: flex; align-items: center; justify-content: center; cursor: pointer; user-select: none; transition: 0.1s; }
.maze-dpad-btn:active { background: #e2e8f0; transform: scale(0.9); }
.maze-dpad-up { grid-column: 2; grid-row: 1; }
.maze-dpad-left { grid-column: 1; grid-row: 2; }
.maze-dpad-down { grid-column: 2; grid-row: 2; }
.maze-dpad-right { grid-column: 3; grid-row: 2; }

/* 游戏结束弹窗 */
.maze-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); display: none; place-items: center; z-index: 100; border-radius: 12px; }
.maze-card { background: #1e293b; border: 1px solid #475569; border-radius: 16px; padding: 24px; text-align: center; color: white; width: 85%; box-shadow: 0 20px 40px rgba(0,0,0,0.5); animation: mazePop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.maze-card h2 { margin: 0 0 12px 0; font-size: 1.8rem; color: #fbbf24; }
.maze-card p { margin: 0 0 20px 0; color: #cbd5e1; font-size: 0.95rem; line-height: 1.6; }
@keyframes mazePop { 0% { transform: scale(0.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* 黑夜模式强力覆盖 */
[data-theme="dark"] .maze-tool-wrapper { background: #1e293b !important; border-color: #334155 !important; }
[data-theme="dark"] .maze-select { background: #0f172a; border-color: #475569; color: #f8fafc; }
[data-theme="dark"] .maze-stat-box { background: #0f172a; border-color: #475569; box-shadow: none; }
[data-theme="dark"] .maze-stat-val { color: #f8fafc; }
[data-theme="dark"] .maze-instruction { background: #0f172a; border-color: #334155; color: #94a3b8; }
[data-theme="dark"] .maze-board { border-color: #475569; background: #020617; box-shadow: 0 10px 25px rgba(0,0,0,0.8); }
[data-theme="dark"] .maze-dpad-btn { background: #0f172a; border-color: #334155; color: #94a3b8; }
[data-theme="dark"] .maze-dpad-btn:active { background: #1e293b; }

@media (min-width: 800px) {
    .maze-dpad { display: none; }
}