/* 遊戲全局樣式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex; 
    flex-direction: column; 
    align-items: center;
    background-color: #f0fdf4; /* 極淡綠色背景 */
    color: #166534; /* 深綠色文字 */
    margin: 0;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    margin: 0;
    color: #15803d;
    font-size: 2.5rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.subtitle {
    margin-top: 5px;
    font-size: 1.1rem;
    color: #166534;
    opacity: 0.8;
}

/* 控制列樣式 */
.controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 10px;
    font-weight: bold;
}

select {
    padding: 6px;
    border-radius: 6px;
    border: 1px solid #bbf7d0;
    background: #f8fafc;
    cursor: pointer;
}

button {
    padding: 10px 18px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    transition: all 0.2s;
    background-color: #22c55e;
    color: white;
}

button:hover {
    background-color: #16a34a;
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

button.secondary {
    background-color: #94a3b8;
}

button.secondary:hover {
    background-color: #64748b;
}

button:disabled {
    background-color: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

/* 地圖包裝容器 */
.map-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

/* 資訊面板 */
.info-panel {
    width: 816px; /* 34px * 24 */
    background: white;
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    font-size: 1.1rem;
    min-height: 1.5rem;
    border-left: 5px solid #4ade80;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats {
    font-size: 0.9rem;
    color: #64748b;
}

/* 網格地圖 */
.grid {
    display: grid;
    /* 14 rows, 24 cols */
    grid-template-columns: repeat(24, 34px);
    grid-template-rows: repeat(14, 34px);
    gap: 1px;
    background-color: #dcfce7;
    padding: 4px;
    border-radius: 8px;
    border: 4px solid #86efac;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    user-select: none;
}

/* 格子樣式 */
.node {
    width: 34px;
    height: 34px;
    background-color: #f0fdf4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    transition: background-color 0.1s;
    border-radius: 2px;
}

.node:hover {
    background-color: #dcfce7;
}

/* 特殊格子狀態 */
.node.obstacle {
    /* 不設背景色，用 emoji 呈現 */
}

.node.start {
    background-color: #86efac;
}

.node.end {
    background-color: #fecaca;
}

/* A* 搜尋狀態 */
.node.enqueue {
    background-color: #e9d5ff; /* 淡紫色 - 正在考慮 */
    animation: pulse 0.3s ease-out;
}

.node.visited {
    background-color: #dbeafe; /* 淡藍色 - 已檢查 */
}

/* 路徑樣式 */
.node.path {
    background-color: #fef08a; /* 淺黃色 */
    transition: background-color 0.3s;
}

.node.bunny-on-top {
    background-color: #fef08a;
    z-index: 10;
}

.node.footprint {
    background-color: #fef9c3;
    font-size: 14px;
}

@keyframes pulse {
    0% { transform: scale(0.8); }
    100% { transform: scale(1); }
}

/* 遊戲結算彈窗 (簡單版) */
#result-overlay {
    margin-top: 15px;
    font-weight: bold;
    color: #15803d;
    text-align: center;
    height: 24px;
}
