:root{
    --bg1:#1a1f2e; --bg2:#2a3142; --yuta:#4fc3f7; --panel:#242a38; --gold:#ffd54f;
    --perfect:#66bb6a; --good:#ffd54f; --miss:#ef5350; --safe:#66bb6a;
  }
  *{box-sizing:border-box; user-select:none;}
  body{
    margin:0; font-family:'Hiragino Sans','Yu Gothic',sans-serif;
    background:linear-gradient(180deg,var(--bg1),var(--bg2)); color:#eee;
    min-height:100vh; display:flex; flex-direction:column; align-items:center; padding:20px;
  }
  h1{font-size:1.05rem; color:#aab4c8; margin:0 0 4px; font-weight:600;}
  .sub{font-size:.72rem;color:#6d7893; margin-bottom:12px; text-align:center;}
  .screen{width:100%; max-width:460px; display:none;}
  .screen.active{display:block;}

  .statbar{
    display:flex; justify-content:space-between; gap:6px; flex-wrap:wrap;
    background:#20263480; border:1px solid #333c4d; border-radius:10px;
    padding:10px 12px; font-size:.72rem; color:#cfd6e4; margin-bottom:14px;
  }
  .statbar b{color:var(--gold);}

  .nav{display:flex; gap:6px; margin-bottom:14px; flex-wrap:wrap;}
  .nav button{flex:1; min-width:70px; padding:8px 4px; border-radius:8px; border:1px solid #3a4356; background:#2f374a; color:#cfd6e4; font-size:.72rem; cursor:pointer;}
  .nav button.active{background:var(--yuta); color:#0a1520; font-weight:700;}

  #settingsBtn{
    position:fixed; top:14px; right:14px; z-index:50;
    width:38px; height:38px; border-radius:50%; border:1px solid #3a4356;
    background:#2f374a; color:#dfe4ee; font-size:1.1rem; cursor:pointer;
  }

  /* ≡ top-left so it does not clash with ⚙️ top-right */
  .hhp-nav-btn{
    top:14px !important; left:14px !important; right:auto !important; bottom:auto !important;
    width:38px; height:38px; font-size:1.15rem;
  }
  .hhp-nav-panel{
    top:60px !important; left:14px !important; right:auto !important; bottom:auto !important;
  }
  .guide-toast{
    position:fixed; top:70px; left:50%; transform:translateX(-50%) translateY(-8px);
    background:#ffd54f; color:#0a1520; font-size:.85rem; font-weight:700;
    padding:10px 18px; border-radius:10px; z-index:80; opacity:0; pointer-events:none;
    transition:opacity .25s, transform .25s; max-width:90vw; text-align:center;
    box-shadow:0 4px 16px rgba(0,0,0,.35);
  }
  .guide-toast.show{opacity:1; transform:translateX(-50%) translateY(0);}

  #settingsModal, #confirmRestartModal{
    display:none; position:fixed; inset:0; background:rgba(10,14,22,.7);
    align-items:center; justify-content:center; z-index:100;
  }
  #settingsModal.show, #confirmRestartModal.show{display:flex;}
  #settingsPanel{
    background:#242a38; border:1px solid #3a4356; border-radius:14px;
    padding:20px; width:100%; max-width:300px; text-align:center;
  }
  .settings-title{font-size:1rem; font-weight:700; color:#dfe4ee; margin-bottom:14px;}

  .hud{display:flex; justify-content:space-between; font-size:.82rem; color:#cfd6e4; margin-bottom:8px;}
  .bar-bg{height:10px; background:#151925; border-radius:6px; overflow:hidden; margin-bottom:14px;}
  .bar-fill{height:100%; width:100%; transition:width .1s linear;}
  .bar-fill.gold{background:var(--gold);}

  .stage{
    position:relative; width:100%; height:220px; background:var(--panel);
    border-radius:12px; display:flex; align-items:flex-end; justify-content:center;
    overflow:hidden; box-shadow:inset 0 0 0 1px #333c4d;
  }
  .floor{position:absolute; bottom:0; left:0; right:0; height:36px; background:#1c2130;}

  .primary-btn{
    margin-top:16px; width:100%; padding:20px; font-size:1.05rem; font-weight:800;
    border:none; border-radius:14px; background:var(--yuta); color:#0a1520; cursor:pointer;
  }
  .primary-btn:active{transform:scale(.97);}
  .primary-btn:disabled{opacity:.35;}
  .secondary-btn{
    margin-top:10px; width:100%; padding:12px; background:#3a4356; color:#dfe4ee;
    border:none; border-radius:10px; cursor:pointer; font-size:.85rem;
  }
  .result{margin-top:14px; background:#20263480; border:1px solid #333c4d; border-radius:10px; padding:14px; text-align:center; display:none;}
  .result.show{display:block;}
  .result .score{font-size:1.5rem; font-weight:800; color:var(--gold);}
  .result .exp{font-size:.85rem; color:#8f9ab0; margin-top:4px;}
  .result .detail{font-size:.7rem; color:#6d7893; margin-top:6px;}
  .hit-pop, .judge-pop{position:absolute; font-weight:800; pointer-events:none;}
  .hit-pop{font-size:1.05rem; color:var(--gold); animation:popUp .5s ease-out forwards;}
  .judge-pop{font-size:1.05rem; animation:popUp .5s ease-out forwards;}
  @keyframes popUp{0%{opacity:1; transform:translateY(0) scale(1);} 100%{opacity:0; transform:translateY(-26px) scale(1.25);}}

  /* rhythm */
  .phone-ring{
    position:absolute; top:26px; left:28%; transform:translateX(-50%);
    width:56px; height:56px; border-radius:50%; display:flex; align-items:center; justify-content:center;
    font-size:1.5rem; background:#2f374a; border:3px solid #3a4356;
    transition:border-color .15s, box-shadow .15s, transform .15s;
  }
  .phone-ring.active{border-color:var(--gold); box-shadow:0 0 18px 4px rgba(255,213,79,.5); transform:translateX(-50%) scale(1.15);}
  .phone-ring.judge-perfect{border-color:var(--perfect); box-shadow:0 0 18px 4px rgba(102,187,106,.6);}
  .phone-ring.judge-good{border-color:var(--good);}
  .phone-ring.judge-miss{border-color:var(--miss);}

  /* balance */
  .balance-meter{width:100%; height:16px; background:#151925; border-radius:8px; overflow:hidden; position:relative; margin-bottom:14px;}
  .balance-zone-safe{position:absolute; left:35%; right:35%; top:0; bottom:0; background:rgba(102,187,106,.25);}
  .balance-indicator{position:absolute; top:0; bottom:0; width:6px; background:var(--gold); left:50%; transform:translateX(-50%); transition:left .08s linear; border-radius:3px;}
  .strap{position:absolute; top:0; width:3px; height:44px; background:#3a4356; transform-origin:top center;}
  .strap-handle{position:absolute; bottom:-10px; left:50%; transform:translateX(-50%); width:16px; height:10px; border:2px solid #3a4356; border-bottom:none; border-radius:8px 8px 0 0;}
  .balance-btns{display:flex; gap:10px; margin-top:16px;}
  .bal-btn{flex:1; padding:20px 8px; font-size:1.15rem; font-weight:800; border:none; border-radius:14px; background:var(--yuta); color:#0a1520; cursor:pointer;}
  .bal-btn:active{transform:scale(.95);}
  .bal-btn:disabled{opacity:.35;}

  /* battle */
  .stage-track{display:flex; flex-wrap:wrap; gap:6px; justify-content:center; margin-bottom:12px;}
  .stage-chip{background:#2f374a; border:1px solid #3a4356; color:#cfd6e4; padding:6px 10px; border-radius:20px; font-size:.68rem; cursor:default; opacity:.5;}
  .stage-chip.cleared{background:#2f4a35; border-color:#4a7a52; color:#a9e2b3; opacity:.85;}
  .stage-chip.cleared::before{content:"✓ ";}
  .stage-chip.current{background:#4fc3f7; color:#0a1520; font-weight:700; border-color:#4fc3f7; opacity:1; cursor:pointer;}
  .stage-progress-label{font-size:.72rem; color:#8f9ab0; text-align:center; margin-bottom:10px;}
  .next-stage-banner{
    background:#2f4a3580; border:1px solid #4a7a52; border-radius:10px; padding:14px;
    text-align:center; margin-bottom:12px; display:none;
  }
  .next-stage-banner.show{display:block;}
  .next-stage-banner .primary-btn{margin-top:8px;}
  .arena{position:relative; width:100%; height:290px; background:var(--panel); border-radius:12px; overflow:hidden; box-shadow:inset 0 0 0 1px #333c4d;}
  .ground{position:absolute; bottom:0; left:0; right:0; height:40px; background:#1c2130;}
  .hpbars{display:flex; justify-content:space-between; margin:12px 0; gap:14px;}
  .hpblock{flex:1;}
  .hpblock .name{font-size:.78rem;color:#aab4c8;margin-bottom:4px;}
  .hpbar-bg{background:#151925;border-radius:6px;height:10px;overflow:hidden;}
  .hpbar-fill{height:100%;border-radius:6px;transition:width .4s ease;}
  #yutaHpFill{background:var(--yuta);}
  #enemyHpFill{background:#ef5350;}
  .controls{display:flex;gap:8px;margin-top:14px;flex-wrap:wrap;justify-content:center;}
  button.battle-btn{background:var(--yuta); color:#0a1520; border:none; padding:9px 16px; border-radius:8px; font-size:.85rem; font-weight:700; cursor:pointer;}
  button.battle-btn.secondary{background:#3a4356;color:#dfe4ee;}
  button.battle-btn.secondary.ready{background:#0d47a1; color:#ffffff; font-weight:800;}
  button.battle-btn:disabled{opacity:.4;}
  #log{margin-top:12px; font-size:.8rem; color:#8f9ab0; min-height:1.2em; text-align:center;}
  .stress-bar-wrap{margin-top:12px;}
  .stress-label{display:flex; justify-content:space-between; font-size:.72rem; color:#cfd6e4; margin-bottom:4px;}
  .dmgtext{position:absolute; font-weight:800; font-size:1.3rem; pointer-events:none; animation:floatUp .8s ease-out forwards;}
  @keyframes floatUp{0%{opacity:1; transform:translateY(0);} 100%{opacity:0; transform:translateY(-40px);}}
  .shockwave{fill:none; stroke-width:4; opacity:.9; animation:ring .5s ease-out forwards;}
  @keyframes ring{0%{r:4; opacity:1;} 100%{r:38; opacity:0;}}

  .seo-text-box {
    margin: 28px auto 8px;
    width: 100%;
    max-width: 460px;
    background: rgba(255,255,255,0.92);
    padding: 18px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.7;
    color: #444;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    text-align: left;
    user-select: text;
  }
  .seo-text-box h2 {
    margin: 0 0 8px;
    font-size: 1rem;
    color: #222;
  }
  .seo-text-box p { margin: 0 0 10px; }
  .seo-text-box p:last-child { margin-bottom: 0; }
