:root{
  --bg:#0f1724;
  --panel:#0b1220;
  --fg:#e6edf3;
  --muted:#9fb0c8;
  --accent:#16a34a;
  --btn:#1f2d45;
  --stroke:#cfe7ff; /* 迷路の線 */
  --player:#ffb86b; /* プレイヤー色 */
  --goal:#16a34a;   /* ゴール色 */
  --path:rgba(255,200,100,0.85); /* 解表示 */
}
*{box-sizing:border-box}
html,body{height:100%;margin:0;font-family:Yu Gothic,Meiryo,system-ui,Arial;background:var(--bg);color:var(--fg)}
main{max-width:900px;margin:24px auto;padding:18px;background:linear-gradient(180deg,#07102888,transparent);border-radius:8px}
h1{margin:0 0 8px;font-size:20px}
#info{margin:0 0 12px;color:var(--muted)}
#mazeCanvas{display:block;background:var(--panel);border-radius:6px;max-width:100%;height:auto}
.controls{margin-top:10px}
.controls button{margin-right:8px;padding:8px 12px;border-radius:6px;border:0;background:var(--btn);color:var(--fg);cursor:pointer}
.controls button:hover{filter:brightness(1.08)}

.theme-toggle{display:inline-flex;align-items:center;gap:8px;margin-right:8px}
.theme-toggle button{padding:6px 10px;border-radius:6px;border:0;background:rgba(255,255,255,0.04);cursor:pointer}

/* Light theme */
.light-theme{
  --bg:#f7fafc;
  --panel:#ffffff;
  --fg:#0b1220;
  --muted:#4b5563;
  --accent:#059669;
  --btn:#e6eef3;
  --stroke:#374151; /* ダークな線色で見やすく */
  --player:#b45309; /* 認識しやすいオレンジ */
  --goal:#059669;   /* 緑は少し濃く */
  --path:rgba(45,55,72,0.9);
}

/* Responsive and touch controls */
.canvas-wrap{position:relative;display:inline-block}
.touch-controls{position:absolute;right:8px;bottom:8px;display:none;align-items:center;gap:6px}
.tc-mid{display:flex;flex-direction:row;gap:6px;margin-top:6px}
.tc-btn{width:44px;height:44px;border-radius:8px;border:0;background:rgba(255,255,255,0.08);color:var(--fg);font-size:18px}
.tc-btn:active{background:rgba(255,255,255,0.14)}

@media (max-width:720px){
  main{margin:12px;padding:12px}
  h1{font-size:18px}
  #mazeCanvas{width:100%;height:auto;border-radius:8px}
  .controls{display:flex;gap:8px;flex-wrap:wrap}
  .touch-controls{display:flex}
  .tc-btn{width:56px;height:56px;font-size:20px;border-radius:10px}
}

/* Modal for README */
.modal{position:fixed;inset:0;display:none;align-items:center;justify-content:center;background:rgba(2,6,23,0.6);z-index:60;padding:20px}
.modal.show{display:flex}
.modal-content{width:100%;max-width:900px;background:var(--panel);color:var(--fg);border-radius:10px;overflow:hidden;box-shadow:0 8px 30px rgba(2,6,23,0.6)}
.modal-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid rgba(255,255,255,0.04)}
.modal-close{background:transparent;border:0;color:var(--fg);cursor:pointer}
.modal-body{padding:12px 16px;max-height:70vh;overflow:auto}
.modal-body pre{white-space:pre-wrap;font-family:inherit;font-size:13px;line-height:1.4;color:var(--fg)}

