/* ══════════════════════════════════════════════════════════════
   カズの隠しメニュー（3回タップ）と裏ショップ
   元デザインは Tailwind + CDN フォントだったが、この作品は
   全アセットをローカルへ置く方針なので、同じ見た目を素のCSSで組み直す。
   フォントも既存画面と同じ Cinzel,serif のフォールバックに合わせる。
   ══════════════════════════════════════════════════════════════ */

/* ── 共通パーツ ── */
.pm-cut { clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px); }
.pm-cut-sm { clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px); }

@keyframes pm-appear { from { transform: scale(.85) translateY(20px); opacity: 0 } to { transform: scale(1) translateY(0); opacity: 1 } }
@keyframes pm-secret-glow {
  0%, 100% { box-shadow: inset 0 0 25px #b026ff4d, 0 0 40px #b026ff80 }
  50%      { box-shadow: inset 0 0 40px #ff2a6d66, 0 0 60px #ff2a6db3 }
}
@keyframes pm-rainbow { to { filter: hue-rotate(360deg) } }
@keyframes pm-rotate-glow { to { transform: rotate(360deg) } }
@keyframes pm-ping { 75%, 100% { transform: scale(2); opacity: 0 } }
@keyframes pm-pulse { 50% { opacity: .4 } }

/* ══ VIEW 1：隠しポップアップ ══
   拠点の上に重ねるだけ。画面遷移はしないので背景は薄い暗幕に留める。 */
.phantom-secret {
  position: fixed; z-index: 480; inset: 0;
  display: grid; place-items: center; padding: 16px;
  background: #02030899;
  font-family: "Noto Sans JP", system-ui, sans-serif;
  -webkit-user-select: none; user-select: none;
}
.phantom-secret[hidden] { display: none }
.phantom-secret::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, #4c1d9550, transparent 60%);
}

.pm-popup {
  position: relative; width: min(100%, 384px);
  padding: 24px;
  background: #08060cf5;
  border: 1.5px solid #ff2a6d99;
  animation: pm-appear .35s cubic-bezier(.16, 1, .3, 1) both, pm-secret-glow 3s ease-in-out infinite;
}
.pm-popup-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: 0; padding: 4px;
  color: #94a3b8; font: 700 11px/1 ui-monospace, monospace; letter-spacing: .18em;
  cursor: pointer;
}
.pm-popup-close:hover { color: #fff }

.pm-tag {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 16px; padding: 3px 10px;
  background: #f43f5e1a; border: 1px solid #f43f5e4d; color: #fb7185;
  font: 700 10px/1.6 ui-monospace, monospace; letter-spacing: .18em; text-transform: uppercase;
}

.pm-speech {
  margin-bottom: 24px; padding: 16px;
  background: #000000b3; border: 1px solid #ffffff1a;
}
.pm-speech p { margin: 0; text-align: center; font-weight: 700; font-size: 13px; line-height: 1.75; color: #fff; letter-spacing: .02em }
.pm-speech-sub {
  margin-top: 12px; padding-top: 8px; border-top: 1px solid #ffffff1a;
  text-align: center; color: #fb7185; font: 700 11px/1.5 ui-monospace, monospace; letter-spacing: .08em;
}

.pm-actions { display: grid; gap: 14px }
.pm-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 14px 16px;
  border: 1.5px solid; color: #fff; font-weight: 700; font-size: 12px; letter-spacing: .06em;
  cursor: pointer; transition: all .25s cubic-bezier(.16, 1, .3, 1);
}
.pm-btn i { font-style: normal; font-family: ui-monospace, monospace; font-size: 10px; opacity: .8 }
.pm-btn:active { transform: scale(.98) }
.pm-btn-purple { background: linear-gradient(135deg, #4c1d95, #2e1065 50%, #1e1b4b); border-color: #c084fc; box-shadow: inset 0 0 15px #a855f799, 0 0 20px #9333ea80 }
.pm-btn-purple:hover { background: linear-gradient(135deg, #6b21a8, #3b0764 50%, #312e81); border-color: #fff; box-shadow: inset 0 0 20px #d8b4fee6, 0 0 30px #c084fccc; transform: translateY(-2px) }
.pm-btn-rose { background: linear-gradient(135deg, #9f1239, #881337 50%, #4c0519); border-color: #fb7185; box-shadow: inset 0 0 15px #f43f5e99, 0 0 20px #e11d4880 }
.pm-btn-rose:hover { background: linear-gradient(135deg, #be123c, #9f1239 50%, #700a1e); border-color: #fff; box-shadow: inset 0 0 20px #fda4afe6, 0 0 30px #f43f5ecc; transform: translateY(-2px) }
.pm-btn-quiet {
  width: 100%; padding: 8px; background: none; border: 0;
  color: #94a3b8; font: 400 11px/1.5 ui-monospace, monospace; letter-spacing: .08em; cursor: pointer;
}
.pm-btn-quiet:hover { color: #e2e8f0 }

/* ══ VIEW 2：裏ショップ（全画面） ══ */
.phantom-shop {
  position: fixed; z-index: 490; inset: 0;
  display: grid; grid-template-rows: auto 1fr; justify-items: center;
  padding: 16px 12px; overflow: hidden;
  background: #030407;
  color: #fff; font-family: "Noto Sans JP", system-ui, sans-serif;
  -webkit-user-select: none; user-select: none;
}
.phantom-shop[hidden] { display: none }
.phantom-shop::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 40%, #164e6350, transparent 62%);
}

.pm-shop-head { position: relative; width: min(100%, 448px); text-align: center; margin-bottom: 16px }
.pm-shop-kicker {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 4px 12px;
  background: #ffffff0d; border: 1px solid #ffffff1a; color: #cbd5e1;
  font: 400 10px/1.6 ui-monospace, monospace; letter-spacing: .18em; text-transform: uppercase;
}
.pm-shop-kicker b { width: 6px; height: 6px; background: #22d3ee; animation: pm-ping 1s cubic-bezier(0, 0, .2, 1) infinite }
.pm-shop-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px }
.pm-shop-back {
  padding: 5px 10px; background: #ffffff0d; border: 1px solid #ffffff33; color: #94a3b8;
  font: 400 12px/1.4 ui-monospace, monospace; cursor: pointer;
}
.pm-shop-back:hover { color: #fff }
.pm-shop-title {
  flex: 1; margin: 0; font-family: Cinzel, "Noto Sans JP", serif; font-size: 22px; font-weight: 800; letter-spacing: .08em;
  background: linear-gradient(135deg, #ff2a6d, #05d9e8, #ff007f, #7000ff, #00ffcc, #ff2a6d);
  background-size: 300% 300%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
  animation: pm-rainbow 6s linear infinite;
  filter: drop-shadow(0 0 15px #05d9e866);
}
.pm-shop-note { margin: 4px 0 0; color: #94a3b8; font-size: 10px; letter-spacing: .08em }

.pm-shop-list {
  width: min(100%, 448px); display: grid; gap: 10px; align-content: start;
  overflow-y: auto; overscroll-behavior: contain; padding: 0 4px 24px 0;
}

.pm-item { position: relative; background: #0a0c12f0; border: 1px solid #ffffff40; box-shadow: inset 0 0 15px #ffffff08; transition: border-color .3s, box-shadow .3s }
.pm-item.open { border: 1.5px solid #ffffffbf; box-shadow: inset 0 0 25px #ffffff14, 0 0 20px #ffffff26 }
/* 01番だけは虹色の回転グローを外周に置く */
.pm-item-featured { padding: 2px; border: 0; overflow: hidden; background: none }
.pm-item-featured::before {
  content: ""; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: conic-gradient(#ff2a6d, #05d9e8, #ff007f, #7000ff, #00ffcc, #ff2a6d);
  animation: pm-rotate-glow 4s linear infinite; z-index: 0;
}
.pm-item-featured > .pm-item-inner { position: relative; z-index: 1; background: #0a0c12f0 }

.pm-item-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 14px; background: none; border: 0; text-align: left; cursor: pointer; color: inherit;
}
.pm-item-id {
  display: grid; place-items: center; width: 28px; height: 28px; flex: none;
  font: 700 12px/1 ui-monospace, monospace;
}
.pm-item-name { display: grid; gap: 2px; min-width: 0 }
.pm-item-name small { font: 400 9px/1.3 ui-monospace, monospace; letter-spacing: .18em; display: flex; align-items: center; gap: 5px }
.pm-item-name small i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pm-pulse 2s ease-in-out infinite; font-style: normal }
.pm-item-name b { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: #fff }
.pm-item-right { display: flex; align-items: center; gap: 8px; flex: none }
.pm-item-price { padding: 2px 8px; font: 700 10px/1.6 ui-monospace, monospace; border: 1px solid }
.pm-item-arrow { color: #94a3b8; font-size: 12px; transition: transform .3s }
.pm-item.open .pm-item-arrow { transform: rotate(180deg) }

.pm-item-body { max-height: 0; overflow: hidden; opacity: 0; transition: max-height .35s cubic-bezier(.16, 1, .3, 1), opacity .25s }
.pm-item.open .pm-item-body { max-height: 360px; opacity: 1 }
.pm-item-body > div { padding: 10px 14px 14px; display: grid; gap: 10px; border-top: 1px solid #ffffff26; margin: 0 14px 0; padding-inline: 0 }
.pm-item-body p { margin: 0; color: #cbd5e1; font-size: 11px; line-height: 1.7 }
.pm-item-stats { display: grid; gap: 6px; padding: 8px; background: #ffffff08; border: 1px solid #ffffff0d; font-size: 10px }
.pm-item-stats span { display: flex; justify-content: space-between; color: #cbd5e1 }
.pm-item-stats span b { color: #fff }
.pm-item-cta {
  width: 100%; padding: 9px; border: 0; font-weight: 700; font-size: 11px; cursor: pointer;
  transition: filter .2s, transform .1s;
}
.pm-item-cta:hover { filter: brightness(1.12) }
.pm-item-cta:active { transform: scale(.98) }

/* ── トースト ── */
.pm-toasts {
  position: fixed; z-index: 520; left: 16px; right: 16px; bottom: 24px;
  display: grid; gap: 12px; justify-items: center; pointer-events: none;
}
.pm-toast {
  display: flex; align-items: center; gap: 12px; width: min(100%, 384px); padding: 14px;
  background: #0f172af2; border: 1px solid #ffffff80; box-shadow: 0 25px 50px -12px #000000bf;
  font-size: 12px; animation: pm-appear .35s cubic-bezier(.16, 1, .3, 1) both;
}
.pm-toast b { display: grid; place-items: center; width: 24px; height: 24px; flex: none; background: #fff; color: #000; font: 700 11px/1 ui-monospace, monospace }
.pm-toast div strong { display: block; font-weight: 700; color: #fff }
.pm-toast div small { display: block; color: #94a3b8; font-size: 10px }

@media (prefers-reduced-motion: reduce) {
  .pm-popup, .pm-toast { animation: none }
  .pm-item-featured::before, .pm-shop-title, .pm-shop-kicker b, .pm-item-name small i { animation: none }
}

/* ══ VIEW 3：選曲画面 PHANTOM BEAT ARCADE ══ */
.phantom-arcade {
  position: fixed; z-index: 490; inset: 0;
  display: grid; grid-template-rows: auto 1fr auto; justify-items: center;
  padding: 16px 12px; overflow: hidden;
  background: #030407; color: #fff;
  font-family: "Noto Sans JP", system-ui, sans-serif;
  -webkit-user-select: none; user-select: none;
}
.phantom-arcade[hidden] { display: none }
.phantom-arcade::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 40%, #8813374d, transparent 62%);
}

.pm-arcade-head { position: relative; width: min(100%, 448px); text-align: center; margin-bottom: 20px }
.pm-arcade-kicker {
  display: inline-block; margin-bottom: 8px; padding: 4px 12px;
  background: #f43f5e1a; border: 1px solid #f43f5e4d; color: #fb7185;
  font: 400 10px/1.6 ui-monospace, monospace; letter-spacing: .18em; text-transform: uppercase;
  animation: pm-pulse 2s ease-in-out infinite;
}
.pm-arcade-title {
  flex: 1; margin: 0; color: #fff;
  font: 900 italic 22px/1 ui-monospace, "Noto Sans JP", monospace; letter-spacing: -.02em;
}
.pm-arcade-title span { color: #f43f5e }

.pm-track-list {
  width: min(100%, 448px); display: grid; gap: 12px; align-content: start;
  overflow-y: auto; overscroll-behavior: contain; padding: 0 6px 20px 0;
}

.pm-track {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 16px; width: 100%; padding: 16px;
  background: linear-gradient(135deg, #1e293bcc, #0f172ae6);
  border: 1px solid #ffffff1a; color: inherit; text-align: left; cursor: pointer;
  transition: all .3s cubic-bezier(.16, 1, .3, 1);
}
.pm-track::before {
  content: ""; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, #05d9e833, transparent); transition: .5s;
}
.pm-track:not(.locked):hover::before { left: 100% }
.pm-track:not(.locked):hover { border-color: #05d9e8; box-shadow: 0 0 20px #05d9e866; transform: scale(1.02) }
.pm-track:not(.locked):active { transform: scale(.99) }
.pm-track.locked { opacity: .45; cursor: not-allowed }

.pm-track-no {
  display: grid; place-items: center; width: 48px; height: 48px; flex: none;
  font: 700 20px/1 ui-monospace, monospace;
}
.pm-track-main { flex: 1; min-width: 0; display: grid; gap: 3px }
.pm-track-main small { color: #22d3ee; font: 700 10px/1.3 ui-monospace, monospace; letter-spacing: .06em }
.pm-track-main b { font-size: 14px; font-weight: 700; letter-spacing: .06em; color: #fff }
.pm-track-diff {
  justify-self: start; margin-top: 3px; padding: 1px 6px;
  font: 700 9px/1.6 ui-monospace, monospace; letter-spacing: .08em;
}
.pm-track-score {
  flex: none; text-align: right; color: #94a3b8;
  font: 400 10px/1.5 ui-monospace, monospace;
}
.pm-track-score b { display: block; font-size: 12px; font-weight: 700 }
.pm-track-score em { font-style: normal; letter-spacing: .12em }

.pm-arcade-foot {
  width: min(100%, 448px); padding: 10px 0 4px; border-top: 1px solid #ffffff1a;
  text-align: center; color: #94a3b8; font: 400 10px/1.5 ui-monospace, monospace; letter-spacing: .12em;
}

@media (prefers-reduced-motion: reduce) {
  .pm-arcade-kicker { animation: none }
  .pm-track, .pm-track::before { transition: none }
}
