  :root{
    --bg:#0a0714; --panel:#141024; --ink:#e8e2f5;
    --accent:#c9a7ff; --gold:#ffd76e; --red:#ff5d7a;
  }
  *{margin:0;padding:0;box-sizing:border-box}
  body{
    background:var(--bg); color:var(--ink);
    font-family:"Hiragino Kaku Gothic ProN","Yu Gothic",Meiryo,sans-serif;
    display:flex; justify-content:center; align-items:center;
    min-height:100vh; user-select:none;
  }
  #wrap{
    display:flex; gap:0;
    border:1px solid #2a2144; box-shadow:0 0 60px #1d0f3a, 0 0 120px rgba(90,40,160,.25);
  }
  canvas{display:block; background:#05030c; touch-action:none;}
  #side{
    width:220px; background:var(--panel);
    border-left:1px solid #2a2144;
    padding:22px 18px; display:flex; flex-direction:column; gap:14px;
  }
  #side h1{
    font-size:15px; letter-spacing:.18em; color:var(--accent);
    border-bottom:1px solid #2a2144; padding-bottom:10px; font-weight:600;
  }
  .stat{display:flex; flex-direction:column; gap:2px}
  .stat .label{font-size:10px; letter-spacing:.25em; color:#8b7fb5}
  .stat .value{font-size:18px; font-family:"Courier New",monospace; font-weight:bold}
  .stat .value.gold{color:var(--gold)}
  .stat .value.red{color:var(--red)}
  .stars{font-size:16px; color:var(--red); letter-spacing:2px}
  .stars.bomb{color:#7ee6a0}
  #powbar{height:8px; background:#241b3f; border-radius:4px; overflow:hidden; margin-top:4px}
  #powfill{height:100%; width:0%; background:linear-gradient(90deg,#8a5cff,var(--gold)); transition:width .15s}
  #keys{
    margin-top:auto; font-size:10px; color:#6f639b; line-height:1.9;
    border-top:1px solid #2a2144; padding-top:12px;
  }
  #keys b{color:#a99ad4; display:inline-block; width:52px; font-family:monospace}
  /* スマホ的レイアウト(サイドパネル非表示+全画面キャンバス)になる条件:
     - 狭い画面(PCウィンドウを小さくした場合も含む)
     - タッチデバイスの縦向き(スマホ縦・タブレット縦)
     - タッチデバイスの横向きでも幅が狭い場合(スマホ横)
     タブレット横向き(pointer:coarse かつ landscape かつ十分広い)はここに当てはまらず、
     PCと同じサイドパネル付きレイアウトのまま(操作自体はタッチのままでよい) */
  @media (max-width:740px),
         (pointer:coarse) and (orientation:portrait),
         (pointer:coarse) and (orientation:landscape) and (max-width:999px){
    #side{display:none}
    #wrap{border:none; box-shadow:none}
    canvas{width:100vw; height:100vh; object-fit:contain}
  }
