* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #120b1f; color: #fff;
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", system-ui, sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  overscroll-behavior: none; touch-action: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

.screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: env(safe-area-inset-top) 12px env(safe-area-inset-bottom);
}
.screen.dim { background: rgba(10, 4, 20, .72); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.screen.pass { pointer-events: none; }

.big-btn {
  display: block; width: 100%; padding: 15px 18px; border: 0; border-radius: 999px;
  background: linear-gradient(180deg, #ff6aa2, #e8306f); color: #fff; font-size: 20px; font-weight: 900;
  box-shadow: 0 5px 0 #8c1745, 0 10px 24px rgba(255, 60, 120, .35); letter-spacing: .04em;
}
.big-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #8c1745; }
.mid-btn {
  display: block; width: 100%; padding: 12px; border-radius: 999px; border: 2px solid rgba(255,255,255,.5);
  background: rgba(255,255,255,.08); font-size: 16px; font-weight: 800;
}
.pill-btn {
  padding: 8px 14px; border-radius: 999px; border: 2px solid rgba(255,255,255,.55);
  background: rgba(0,0,0,.35); font-size: 14px; font-weight: 800;
}
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 2px solid rgba(255,255,255,.7);
  background: rgba(0,0,0,.45); font-weight: 900; font-size: 15px; letter-spacing: -1px;
}

/* title */
.title-wrap { width: min(92vw, 420px); text-align: center; }
.title-key { width: min(62vw, 260px); filter: drop-shadow(0 8px 20px rgba(255, 80, 160, .5)); animation: bob 1.1s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-8px) rotate(2deg); } }
.logo { margin: 6px 0 4px; line-height: 1; }
.logo .l1 { display: block; font-size: 22px; letter-spacing: .2em; color: #ffd9ea; }
.logo .l2 {
  display: block; font-size: 48px; font-weight: 900; font-style: italic; color: #fff;
  -webkit-text-stroke: 2px #e8306f; text-shadow: 0 4px 0 #8c1745, 0 0 22px rgba(255, 70, 150, .8);
}
.lead { margin: 12px 0 22px; font-weight: 700; opacity: .9; }
.credit { margin-top: 18px; font-size: 12px; opacity: .6; }

/* select */
#scrSelect { flex-direction: column; align-items: stretch; justify-content: flex-start; padding-left: 0; padding-right: 0; background: linear-gradient(180deg, rgba(18,11,31,.4), rgba(18,11,31,.85)); }
.sel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 6px; }
.sel-head h2 { margin: 0; font-size: 22px; font-weight: 900; }
.song-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 12px 12px; touch-action: pan-y; }
.song {
  display: flex; align-items: center; gap: 10px; width: 100%; margin: 0 0 9px; padding: 7px 10px 7px 7px;
  border-radius: 16px; border: 2px solid rgba(255,255,255,.14); background: rgba(255,255,255,.07); text-align: left;
}
.song.sel { border-color: #ff6aa2; background: rgba(255, 90, 150, .2); box-shadow: 0 0 18px rgba(255, 80, 150, .35); }
.song img { width: 58px; height: 58px; flex: none; border-radius: 12px; background: rgba(255,255,255,.9); }
.song .meta { flex: 1; min-width: 0; }
.song .ttl { font-size: 17px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song .sub { font-size: 12px; opacity: .75; margin-top: 2px; }
.song .ranks { display: flex; gap: 5px; margin-top: 4px; }
.song .rk { font-size: 11px; font-weight: 900; padding: 1px 6px; border-radius: 6px; background: rgba(0,0,0,.35); opacity: .9; }
.rk.e { color: #7dffb0; } .rk.n { color: #ffd76a; } .rk.h { color: #ff7a9c; }
.sel-foot { padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); background: rgba(10, 5, 20, .9); border-top: 1px solid rgba(255,255,255,.12); }
.sel-now { margin: -2px 0 8px; font-size: 14px; font-weight: 900; color: #ffd9ea; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diff-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.diff-tabs button {
  flex: 1; padding: 8px 4px; border-radius: 12px; border: 2px solid rgba(255,255,255,.25); background: rgba(255,255,255,.06);
  font-weight: 900; font-size: 14px; line-height: 1.15;
}
.diff-tabs button small { display: block; font-size: 11px; opacity: .8; }
.diff-tabs button.on.easy { border-color: #4be38b; background: rgba(75, 227, 139, .25); }
.diff-tabs button.on.normal { border-color: #ffc93c; background: rgba(255, 201, 60, .25); }
.diff-tabs button.on.hard { border-color: #ff4f7a; background: rgba(255, 79, 122, .25); }

/* panels */
.panel { width: min(92vw, 380px); padding: 18px 18px 20px; border-radius: 22px; background: rgba(32, 18, 52, .96); border: 2px solid rgba(255,255,255,.18); box-shadow: 0 20px 50px rgba(0,0,0,.5); text-align: center; }
.panel > * + * { margin-top: 10px; }
.st-mid { width: 150px; height: 150px; }
.center-box { text-align: center; font-weight: 800; }

/* HUD */
#hud { position: fixed; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 10px; padding: calc(6px + env(safe-area-inset-top)) 10px 6px; pointer-events: none; }
#hud button { pointer-events: auto; }
.hud-left { min-width: 0; flex: 0 1 auto; }
#hudTitle { font-size: 11px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
#hudScore { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: .02em; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
.hud-gauge { position: relative; flex: 1; height: 16px; border-radius: 99px; background: rgba(0,0,0,.5); border: 2px solid rgba(255,255,255,.35); overflow: hidden; }
#gaugeFill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #ff9a3c, #ff3c8e); transition: width .12s linear; }
#gaugeFill.clear { background: linear-gradient(90deg, #ffe14a, #ff6ad5, #6ad9ff); }
.gauge-mark { position: absolute; left: 70%; top: -2px; bottom: -2px; width: 2px; background: #fff; opacity: .85; }
.hud-gauge span { position: absolute; left: 8px; top: 0; font-size: 10px; line-height: 12px; font-weight: 900; text-shadow: 0 1px 2px #000; }

/* countdown */
#countNum { font-size: 120px; font-weight: 900; font-style: italic; color: #fff; -webkit-text-stroke: 3px #e8306f; text-shadow: 0 6px 0 #8c1745; }

/* result */
.result { padding-top: 14px; }
.res-clear { font-size: 26px; font-weight: 900; font-style: italic; letter-spacing: .05em; }
.res-clear.ok { color: #ffe14a; text-shadow: 0 0 16px rgba(255, 210, 60, .8); }
.res-clear.ng { color: #9fb4ff; }
.res-top { display: flex; align-items: center; justify-content: center; gap: 14px; }
.st-res { width: 128px; height: 128px; }
.res-rank { font-size: 76px; font-weight: 900; font-style: italic; line-height: 1; -webkit-text-stroke: 2px #fff; color: #ff4f8b; text-shadow: 0 5px 0 #6b1236; }
.res-badge { font-size: 13px; font-weight: 900; color: #ffe14a; min-height: 1em; }
.res-song { font-size: 14px; opacity: .85; }
.res-score { font-size: 38px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.05; }
.res-best { font-size: 13px; color: #ffe14a; min-height: 1em; font-weight: 800; }
.res-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.res-table th { text-align: left; font-size: 12px; padding: 3px 4px; opacity: .9; }
.res-table td { text-align: right; padding: 3px 8px 3px 4px; font-weight: 900; font-variant-numeric: tabular-nums; }
.j-p { color: #ffe14a; } .j-g { color: #ff7ad1; } .j-o { color: #6ad9ff; } .j-m { color: #9a9ab0; }
.res-btns > * + * { margin-top: 10px; }
.big-btn.again { display: flex; align-items: center; justify-content: center; gap: 8px; }
.big-btn.again img { width: 40px; height: 40px; margin: -10px 0; }

/* settings */
.settings label { display: block; text-align: left; font-weight: 800; margin-top: 12px; }
.settings label b { float: right; color: #ffd76a; }
.settings input[type=range] { width: 100%; margin-top: 8px; touch-action: pan-x; }
.settings .hint { font-size: 12px; opacity: .75; text-align: left; line-height: 1.5; }
.settings .row { display: flex; gap: 8px; justify-content: center; }
.settings h3 { margin: 0; }
