@font-face {
  font-family: 'MR';
  src: url('../assets/font/mr.woff2') format('woff2');
  font-weight: 900;
  font-display: swap;
}
:root {
  --font: 'MR', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Yu Gothic', 'Meiryo', sans-serif;
  --pink: #ff4fa0;
  --ink: #2a0f46;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #0b0616;
  overscroll-behavior: none;
}
body {
  background: radial-gradient(ellipse at 50% 30%, #2a1050 0%, #0b0616 70%);
  font-family: var(--font); font-weight: 900; color: #fff;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
#app {
  position: fixed; top: 0; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(100vw, 64vh); width: min(100vw, 64dvh);
  height: 100vh; height: 100dvh;
  overflow: hidden; touch-action: none; background: #0b0616;
  box-shadow: 0 0 60px rgba(255, 79, 160, 0.25);
}
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

#pause {
  position: absolute; top: calc(env(safe-area-inset-top) + 8px); right: 10px;
  width: 42px; height: 42px; border-radius: 50%; border: 3px solid #fff;
  background: rgba(20, 8, 36, 0.7); color: #fff; font: 900 16px var(--font);
  display: none; z-index: 5; letter-spacing: -1px;
}
#pause.on { display: block; }

#screens { position: absolute; inset: 0; display: none; z-index: 10; }
#screens.on { display: block; }
.screen {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: calc(env(safe-area-inset-top) + 12px) 14px calc(env(safe-area-inset-bottom) + 12px);
  animation: fadein 0.25s ease-out;
}
.screen.dim { background: rgba(10, 4, 22, 0.62); }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---------------- logo */
.logo, .load-logo { display: flex; flex-direction: column; align-items: center; line-height: 1; transform: rotate(-4deg); }
.logo-sub {
  font-size: clamp(22px, 7vw, 34px); color: #fff;
  -webkit-text-stroke: 6px var(--pink); paint-order: stroke fill;
  text-shadow: 0 4px 0 #2a0f46; letter-spacing: 2px;
}
.logo-main {
  margin-top: 6px; font-size: clamp(40px, 13.5vw, 64px); letter-spacing: -1px;
  background: linear-gradient(180deg, #fff6a8 0%, #ffd23f 45%, #ff8a2a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 2px #2a0f46;
  filter: drop-shadow(0 5px 0 #2a0f46) drop-shadow(0 0 18px rgba(255, 140, 60, 0.6));
}
.title .logo { animation: logo-bob 2.4s ease-in-out infinite; }
@keyframes logo-bob { 0%, 100% { transform: rotate(-4deg) scale(1); } 50% { transform: rotate(-3deg) scale(1.04); } }

.title-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 420px; }
.title-stk { width: min(62vw, 250px); filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35)); animation: stk-bounce 1.6s ease-in-out infinite; }
@keyframes stk-bounce { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
.title-stage {
  font-size: 18px; color: #ffd23f; padding: 4px 16px; border-radius: 99px;
  background: rgba(20, 8, 36, 0.75); border: 2px solid #ffd23f;
}
.howto { font-size: 12.5px; color: #e9ddff; text-align: center; line-height: 1.6; text-shadow: 0 2px 0 #000; }
.copy { font-size: 10px; color: rgba(255, 255, 255, 0.55); margin-top: 2px; }
.note { font-size: 10.5px; color: #cdb8ff; text-align: center; }

/* ---------------- buttons */
.btn {
  font: 900 18px var(--font); color: #fff; border: none; cursor: pointer;
  border-radius: 99px; padding: 14px 26px; min-height: 52px;
  background: linear-gradient(180deg, #ff7ac0 0%, #ff4fa0 50%, #e2337f 100%);
  box-shadow: 0 5px 0 #8a1450, 0 8px 18px rgba(0, 0, 0, 0.4);
  text-shadow: 0 2px 0 rgba(80, 0, 40, 0.6);
  transition: transform 0.06s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #8a1450; }
.btn-main {
  width: min(84vw, 330px); font-size: 22px; padding: 16px 20px;
  background: linear-gradient(180deg, #fff27a 0%, #ffc62a 50%, #ff9a1a 100%);
  color: #3a1400; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  box-shadow: 0 6px 0 #a24a00, 0 10px 22px rgba(0, 0, 0, 0.45);
  animation: pulse 1.2s ease-in-out infinite;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-main:active { box-shadow: 0 1px 0 #a24a00; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.045); } }
.btn-sub { font-size: 16px; padding: 10px 20px; min-height: 46px; }
.btn-sub.small { font-size: 13px; min-height: 38px; padding: 8px 16px; background: linear-gradient(180deg, #6d5a90, #4a3a68); box-shadow: 0 4px 0 #241838; }
.btn-icon { width: 52px; padding: 0; font-size: 22px; background: linear-gradient(180deg, #6d5a90, #4a3a68); box-shadow: 0 5px 0 #241838; }
.row { display: flex; gap: 10px; align-items: center; justify-content: center; }
.btn-stk { width: 40px; height: 40px; margin: -10px 0; }
.badge { display: inline-block; font-size: 11px; color: #3a1400; background: #ffe14f; border-radius: 99px; padding: 0 7px; vertical-align: middle; }
.badge:empty { display: none; }

/* ---------------- panels */
.panel {
  width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 18px 16px; border-radius: 26px;
  background: linear-gradient(180deg, rgba(48, 20, 86, 0.95), rgba(22, 10, 42, 0.96));
  border: 3px solid rgba(255, 120, 200, 0.75);
  box-shadow: 0 0 0 4px rgba(20, 6, 40, 0.8), 0 0 40px rgba(255, 79, 160, 0.35);
  animation: pop 0.35s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes pop { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.h1 { font-size: 30px; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.h1.clear { color: #ffe14f; font-size: 36px; animation: logo-bob 1.6s ease-in-out infinite; }
.h1.fail { color: #c9cce0; }
.mid-stk { width: min(42vw, 170px); filter: drop-shadow(0 5px 0 rgba(0, 0, 0, 0.35)); }
.result .mid-stk { width: min(34vw, 140px); }
.lbl { font-size: 14px; color: #ffd23f; margin-bottom: -8px; }
.big { font-size: clamp(40px, 13vw, 58px); -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; line-height: 1.1; }
.stamp {
  font-size: 26px; padding: 4px 18px; border: 4px solid var(--vc); color: var(--vc); border-radius: 12px;
  transform: rotate(-8deg) scale(3); opacity: 0; background: rgba(10, 4, 22, 0.6);
  -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill;
}
.stamp.on { animation: stamp 0.35s cubic-bezier(.3, 1.6, .5, 1) forwards; }
@keyframes stamp { to { transform: rotate(-8deg) scale(1); opacity: 1; } }
.coins { font-size: 13px; color: #e9ddff; text-align: center; line-height: 1.7; }
.coins b { color: #ffe14f; }
.coins .sum { font-size: 26px; color: #ffe14f; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.coin-ic {
  display: inline-block; width: 0.9em; height: 0.9em; border-radius: 50%; vertical-align: -0.1em; margin-right: 3px;
  background: radial-gradient(circle at 35% 35%, #fff3a0, #ffc928 50%, #d88a10);
  box-shadow: inset 0 0 0 2px #7a4a08;
}
.tip { font-size: 13px; color: #fff; background: rgba(255, 255, 255, 0.1); padding: 8px 12px; border-radius: 12px; text-align: center; }

/* ---------------- shop */
.shop { gap: 8px; max-height: 100%; }
.wallet { font-size: 24px; color: #ffe14f; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.cards { display: flex; flex-direction: column; gap: 7px; width: 100%; overflow-y: auto; touch-action: pan-y; }
.card {
  display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 16px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--mc) 30%, #1a0c30), #1a0c30);
  border: 2px solid var(--mc);
}
.card.bought { animation: bought 0.4s ease-out; }
@keyframes bought { 0% { transform: scale(1.06); filter: brightness(1.8); } 100% { transform: scale(1); filter: none; } }
.card .pt { width: 54px; height: 54px; flex: none; }
.card .info { flex: 1; min-width: 0; }
.card .nm { font-size: 15px; }
.card .pt-part { font-size: 11px; color: var(--mc); }
.card .up { font-size: 13px; color: #ffd23f; }
.card .lv { color: #fff; font-size: 12px; margin-left: 4px; }
.card .ds { font-size: 10.5px; color: #d9cdf5; line-height: 1.3; }
.card .buy { padding: 8px 10px; min-height: 42px; font-size: 15px; min-width: 86px; box-shadow: 0 4px 0 #8a1450; }
.card .buy.off { filter: grayscale(0.9) brightness(0.7); }
.shop-react { position: absolute; right: 8px; bottom: 90px; width: 110px; height: 110px; pointer-events: none; }
.shop-react .pop { width: 100%; animation: react 1.6s ease-out forwards; }
@keyframes react { 0% { transform: scale(0); } 15% { transform: scale(1.1); } 25% { transform: scale(1); } 85% { opacity: 1; } 100% { opacity: 0; } }

/* ---------------- loading */
#loading {
  position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: radial-gradient(ellipse at 50% 40%, #3a1460, #0b0616 75%);
  transition: opacity 0.5s;
}
#loading.done { opacity: 0; pointer-events: none; }
.load-track { width: 60%; max-width: 260px; height: 12px; border-radius: 99px; background: rgba(255, 255, 255, 0.15); overflow: hidden; border: 2px solid #fff; }
#load-bar { width: 0; height: 100%; background: linear-gradient(90deg, #ff4fa0, #ffd23f); transition: width 0.2s; }
.load-note { font-size: 12px; letter-spacing: 3px; color: #cdb8ff; }
@media (max-height: 640px) {
  .title-stk { width: min(44vw, 170px); }
  .btn-main { padding: 12px 18px; font-size: 20px; }
  .mid-stk { width: min(30vw, 120px); }
}

/* ---------------- band song: now playing / loading */
#np {
  position: absolute; left: 50%; top: calc(env(safe-area-inset-top) + 96px); z-index: 6; pointer-events: none;
  display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 99px; white-space: nowrap;
  background: rgba(20, 8, 36, 0.8); border: 2px solid rgba(255, 120, 200, 0.85); font-size: 14px;
  opacity: 0; transform: translateX(-50%);
}
#np.on { animation: np 4.2s ease-out forwards; }
@keyframes np {
  0% { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  10% { opacity: 1; transform: translateX(-50%) translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(0); }
}
.np-note { color: #ffd23f; font-size: 18px; }
.np-a { color: #cdb8ff; font-size: 11px; }
#songload {
  position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 4, 22, 0.45); font-size: 18px;
}
#songload div { padding: 10px 18px; border-radius: 16px; background: rgba(20, 8, 36, 0.92); border: 2px solid #ffd23f; animation: pulse 1s infinite; }
.title-song { font-size: 13px; color: #ffd6ea; text-shadow: 0 2px 0 #000; }
.rank { font-size: 15px; }
.rank b { font-size: 24px; color: #ffe14f; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.rank-S b { color: #ff5fa8; }
.rank .pct { font-size: 12px; color: #cdb8ff; }
.bosst { font-size: 13px; color: #e9ddff; margin-top: -6px; }
.bosst b { color: #ff5fa8; }
