/* AI Chat Maze UI */
:root{
  --bg:#0b1220; --panel:#0e1626; --text:#e6eefc; --muted:#96a2b8;
  --accent:#00D1FF; --accent-2:#7cfcff;
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,system-ui,Segoe UI,Arial,sans-serif}
.topbar{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:#0a1120;border-bottom:1px solid #182036}
.topbar h1{margin:0;font-size:18px;letter-spacing:.2px}
.topbar .back{color:var(--muted);text-decoration:none}
.layout{display:grid;grid-template-columns:1fr 320px;gap:16px;padding:16px}
@media(max-width:820px){.layout{grid-template-columns:1fr}.chat{order:-1}}

/* Maze */
#maze-section{display:flex;flex-direction:column;gap:10px;align-items:center}
#maze-container{display:grid;grid-template-columns:repeat(12,40px);grid-auto-rows:40px;gap:4px;padding:12px;background:var(--panel);border:1px solid #162034;border-radius:12px;box-shadow:0 12px 24px -12px rgba(0,0,0,.6);touch-action:none}
.cell{width:40px;height:40px;border-radius:8px;transition:transform .12s ease, box-shadow .2s ease}
.cell.wall{background:#0a1120;border:1px solid #121a2a}
.cell.path{background:#0f1a2e;border:1px solid #14223a}
.cell.goal{background:#082a36;border:1px solid #0b3544;box-shadow:0 0 16px 4px rgba(0,209,255,.45)}
.cell.player{outline:2px solid var(--accent);box-shadow:0 0 10px 2px rgba(0,209,255,.35)}
.cell.player::after{content:"";display:block;width:14px;height:14px;border-radius:50%;background:var(--accent);margin:12px auto}
#maze-container.moved .cell.player{transform:scale(1.04)}
.btn-row{display:flex;flex-wrap:wrap;gap:8px}
.status{min-height:24px;color:var(--muted)}
.howto{max-width:520px;background:#0c1528;border:1px solid #162034;border-radius:8px;padding:8px 10px}
.howto summary{cursor:pointer;color:var(--muted)}
.howto ul{margin:8px 0 0 16px}

.controls{display:flex;flex-direction:column;align-items:center;gap:6px;margin-top:8px}
.controls .row{display:flex;gap:6px}
.dir{width:44px;height:44px;border-radius:10px;border:1px solid #1a2540;background:#0c1528;color:var(--text);font-size:18px;cursor:pointer}
.dir:hover{filter:brightness(1.05)}

/* Chat */
.chat{background:var(--panel);border:1px solid #162034;border-radius:12px;padding:12px;display:flex;flex-direction:column;gap:12px}
.ai-header{display:flex;gap:10px;align-items:center}
.ai-avatar{width:36px;height:36px;border-radius:8px;border:1px solid #1b2740;background:linear-gradient(135deg,#15223a,#0c1426)}
.ai-name{font-weight:600}
.ai-tag{font-size:12px;color:var(--muted)}
.ai-response{min-height:64px;padding:10px;border-radius:8px;background:#0c1528;border:1px solid #162034}
.level-select{display:block;margin-top:8px;color:var(--muted)}
.level-select select{margin-left:6px;background:#0c1528;color:var(--text);border:1px solid #162034;border-radius:6px;padding:4px 6px}
.btn{background:linear-gradient(90deg,var(--accent),var(--accent-2));color:#00131a;border:none;border-radius:10px;padding:10px 12px;font-weight:600;cursor:pointer;transition:filter .2s ease, transform .1s ease}
.btn:hover{filter:brightness(1.05)}
.btn:active{transform:scale(.98)}

.cell.path-hint{outline:2px dashed rgba(0,209,255,.6)}
/* Modal */
.modal{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.5)}
.hidden{display:none}
.modal-card{background:var(--panel);border:1px solid #162034;border-radius:12px;padding:18px 16px;min-width:280px;text-align:center;box-shadow:0 12px 24px -12px rgba(0,0,0,.6)}
