*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;overscroll-behavior:none;touch-action:manipulation}
body{font-family:system-ui,Arial,sans-serif;background:#1a2a4a;color:#fff;text-align:center;display:flex;flex-direction:column;min-height:100dvh;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);user-select:none}
header{padding:10px;background:#0f1e38}h1{margin:0;font-size:clamp(18px,5vw,28px)}h1 span{color:#ffd23f}header p{margin:4px 0 0;opacity:.9;font-size:clamp(12px,3.5vw,15px)}
#hud{display:flex;justify-content:center;gap:8px;flex-wrap:wrap;margin:10px}.pill{background:#fff;color:#123;padding:9px 13px;border-radius:999px;font-weight:800;min-height:44px;display:flex;align-items:center}
#wrap{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:0 10px 10px}
#board{display:grid;grid-template-columns:repeat(6,1fr);gap:6px;width:min(92vw,58dvh,520px);aspect-ratio:1/1;background:#2b3f66;padding:8px;border-radius:16px}
@media(min-width:768px){#board{width:min(62vw,62dvh,620px)}}
.cell{border-radius:10px;background:#3a557f;display:flex;align-items:center;justify-content:center;font-size:clamp(22px,7vw,38px);cursor:pointer;min-height:44px;border:2px solid transparent}
.cell.path{background:#ffd23f}.cell.player{background:#ff5a8a}.cell.goal{background:#2ecc71}.cell.wall{background:#1a2a4a;pointer-events:none}.cell.danger{background:#e53935}
.cell.current{outline:3px solid #fff;transform:scale(1.05)}
button{padding:14px 18px;min-height:52px;border:0;border-radius:14px;background:#ffd23f;color:#123;font-weight:900;cursor:pointer;font-size:16px}
button.secondary{background:#fff}button:active{transform:scale(.97)}
#controls{display:flex;flex-wrap:wrap;justify-content:center;gap:8px}
#msg{min-height:28px;color:#ffd23f;font-weight:700}
#overlay{position:fixed;inset:0;background:rgba(0,0,0,.85);display:flex;flex-direction:column;align-items:center;justify-content:center;padding:20px;z-index:10}
.hidden{display:none!important}
