/* パラギャル スタイル。ピンク・ヒョウ柄・ラメ・ハート。文字は読みやすさ優先 */
:root {
  --pink: #ff4fa0;
  --pink-deep: #d6247f;
  --pink-soft: #ffd6ea;
  --pink-bg: #fff0f7;
  --purple: #8a3ffc;
  --gold: #ffc933;
  --aqua: #2ec4e6;
  --ink: #3b1d33;
  --ink-soft: #7a5a70;
  --white: #fff;
  --radius: 18px;
  --font-body: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-logo: "Dela Gothic One", "M PLUS Rounded 1c", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--ink);
  background-color: #e9a8c8;
  /* PCで見たとき用のヒョウ柄の余白 */
  background-image:
    radial-gradient(ellipse 14px 9px at 20px 22px, #6a3517 0 70%, transparent 72%),
    radial-gradient(ellipse 14px 9px at 62px 58px, #6a3517 0 70%, transparent 72%),
    radial-gradient(ellipse 9px 6px at 22px 22px, #f0c48a 0 70%, transparent 72%),
    radial-gradient(ellipse 9px 6px at 64px 58px, #f0c48a 0 70%, transparent 72%);
  background-size: 84px 84px;
  overflow-x: hidden;
}

#app {
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  background: linear-gradient(180deg, #fff0f7 0%, #ffe0f0 100%);
  position: relative;
  overflow-x: hidden;
  box-shadow: 0 0 40px rgba(120, 20, 80, 0.35);
}
.screen { min-height: 100dvh; }

button { font-family: inherit; cursor: pointer; }

/* ---------- ボタン ---------- */
.btn-main, .btn-sub {
  display: block;
  width: 100%;
  border: 3px solid #fff;
  border-radius: 999px;
  font-weight: 800;
  font-size: 18px;
  padding: 14px 18px;
  letter-spacing: 0.04em;
  transition: transform 0.08s;
}
.btn-main {
  color: #fff;
  background: linear-gradient(180deg, #ff7ec0 0%, #ff3d9a 55%, #e0237f 100%);
  box-shadow: 0 4px 0 #a8135f, 0 6px 14px rgba(214, 36, 127, 0.4);
  text-shadow: 0 1px 0 rgba(120, 10, 70, 0.5);
}
.btn-sub {
  color: var(--pink-deep);
  background: linear-gradient(180deg, #fff 0%, #ffe1f0 100%);
  box-shadow: 0 4px 0 #e69abf, 0 6px 12px rgba(214, 36, 127, 0.2);
}
.btn-main:active, .btn-sub:active { transform: translateY(3px); box-shadow: 0 1px 0 #a8135f; }
.btn-main:disabled { filter: grayscale(0.7); opacity: 0.7; cursor: not-allowed; }
.btn-compact { font-size: 16px; padding: 10px 14px; }
.btn-share { background: linear-gradient(180deg, #7fe0ff 0%, #2ec4e6 60%, #1a9bbd 100%); box-shadow: 0 4px 0 #11708a, 0 6px 14px rgba(26, 155, 189, 0.4); }
.btn-small {
  border: 2px solid #fff;
  border-radius: 999px;
  background: #fff;
  color: var(--pink-deep);
  font-weight: 800;
  font-size: 14px;
  padding: 7px 14px;
  box-shadow: 0 2px 0 #e69abf;
}
.btn-accent { background: var(--pink); color: #fff; box-shadow: 0 2px 0 #a8135f; }
.btn-row, .action-row { display: flex; gap: 10px; margin-top: 10px; }
.btn-row > *, .action-row > * { flex: 1; font-size: 15px; padding: 12px 10px; }
.action-row .btn-main { font-size: 17px; }

.chip {
  border: 2px solid var(--pink-soft);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  padding: 8px 14px;
}
.chip.is-on { background: var(--pink); border-color: var(--pink-deep); color: #fff; }

.hint { font-size: 13px; color: var(--ink-soft); margin: 8px 0 0; line-height: 1.5; }
.muted { color: var(--ink-soft); font-weight: 500; }

/* ---------- タイトル ---------- */
.screen-title { background: linear-gradient(180deg, #ffc2e0 0%, #ffe9f4 55%, #fff 100%); position: relative; overflow: hidden; }
.title-glitter {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(circle at 12% 18%, #fff 0 2px, transparent 3px),
    radial-gradient(circle at 82% 12%, #fff 0 3px, transparent 4px),
    radial-gradient(circle at 30% 46%, #fff 0 2px, transparent 3px),
    radial-gradient(circle at 90% 52%, #fff 0 2px, transparent 3px),
    radial-gradient(circle at 8% 78%, #fff 0 3px, transparent 4px),
    radial-gradient(circle at 70% 88%, #fff 0 2px, transparent 3px);
  animation: twinkle 2.4s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.4; } to { opacity: 1; } }
.title-wrap { position: relative; padding: 22px 22px 28px; display: flex; flex-direction: column; align-items: center; }
.title-sub {
  margin: 0; font-weight: 800; font-size: 13px; color: var(--pink-deep); letter-spacing: 0.12em;
  background: #fff; border-radius: 999px; padding: 4px 14px; border: 2px solid var(--pink-soft);
}
.logo {
  margin: 10px 0 0; font-family: var(--font-logo); font-weight: 400; font-size: 52px; line-height: 1.1; text-align: center;
  background: linear-gradient(180deg, #ff9ad0 0%, #ff2f86 50%, #9d2cff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 0 #fff) drop-shadow(2px 2px 0 #fff) drop-shadow(-2px -2px 0 #fff) drop-shadow(2px -2px 0 #fff) drop-shadow(-2px 2px 0 #fff) drop-shadow(0 4px 6px rgba(160, 20, 100, 0.35));
}
.title-avatar { width: 220px; height: 360px; margin: 6px 0 4px; filter: drop-shadow(0 6px 8px rgba(160, 20, 100, 0.25)); }
.avatar-canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.avatar-wrap { position: relative; }
.avatar-wrap.is-loading::after { content: ''; position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; border: 3px solid rgba(255, 79, 160, 0.25); border-top-color: var(--pink); animation: avspin 0.8s linear infinite; }
@keyframes avspin { to { transform: rotate(360deg); } }
.pt-card {
  display: flex; align-items: baseline; gap: 6px; background: #fff; border: 3px solid var(--pink); border-radius: 999px;
  padding: 6px 20px; margin: 4px 0 16px; box-shadow: 0 3px 0 #e69abf;
}
.pt-label { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.pt-card b { font-size: 28px; color: var(--pink-deep); font-weight: 800; }
.pt-card small { font-weight: 800; color: var(--pink-deep); }
.menu { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.menu .btn-sub:last-child { grid-column: 1 / -1; }
.menu .btn-main { grid-column: 1 / -1; font-size: 24px; padding: 16px; }
.title-note { font-size: 12px; color: var(--ink-soft); text-align: center; margin: 14px 0 0; line-height: 1.5; }
.title-note.warn { color: #b3261e; font-weight: 800; }
.debug-tag { margin: 8px 0 0; font-size: 12px; font-weight: 800; color: #fff; background: var(--purple); border-radius: 999px; padding: 4px 12px; }

/* ---------- 共通ページ ---------- */
.page { padding: 12px 14px 28px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.page-head h2 {
  margin: 0; font-size: 20px; font-weight: 800; color: #fff; flex: 1; text-align: center;
  background: linear-gradient(90deg, #ff6fb1, #ff3d9a, #b45cff); border-radius: 999px; padding: 6px 12px;
  border: 2px solid #fff; box-shadow: 0 2px 0 #c0307f;
}
.pt-badge { background: #fff; border: 2px solid var(--pink); border-radius: 999px; padding: 4px 12px; font-weight: 800; color: var(--pink-deep); min-width: 66px; text-align: center; }
.pt-badge small { margin-left: 2px; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; border: 2px solid var(--pink-soft); background: #fff; border-radius: 12px 12px 0 0; color: var(--ink-soft);
  font-weight: 800; font-size: 14px; padding: 8px 14px;
}
.tab.is-on { background: var(--pink); color: #fff; border-color: var(--pink-deep); }

.item-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.item-card {
  background: #fff; border: 3px solid var(--pink-soft); border-radius: var(--radius); padding: 8px; text-align: center;
  color: var(--ink); position: relative;
}
.item-card.is-sel { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(255, 79, 160, 0.25); }
.item-card.is-owned { background: #f7f2ff; }
.item-thumb { aspect-ratio: 1 / 1; background: linear-gradient(180deg, #fff6fb, #ffe6f2); border-radius: 12px; overflow: hidden; }
.item-thumb img { width: 100%; height: 100%; display: block; object-fit: cover; opacity: 0; transition: opacity 0.2s; }
.item-thumb img.ready { opacity: 1; }
.item-name { font-weight: 800; font-size: 14px; margin-top: 6px; line-height: 1.3; min-height: 2.6em; display: flex; align-items: center; justify-content: center; }
.item-price { font-weight: 800; color: var(--pink-deep); font-size: 16px; }
.item-price small { font-size: 12px; }
.owned-tag { display: inline-block; font-size: 12px; background: var(--purple); color: #fff; border-radius: 999px; padding: 2px 10px; }
.owned-tag.worn { background: var(--pink); }

/* お店 */
.shop-top { display: flex; gap: 12px; align-items: stretch; margin-bottom: 8px; }
.preview-avatar { width: 128px; height: 214px; flex: 0 0 auto; background: linear-gradient(180deg, #fff6fb, #ffd6ea); border-radius: var(--radius); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--pink-soft); }
.shop-detail { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 8px; min-width: 0; }
.detail-name { font-weight: 800; font-size: 18px; line-height: 1.3; }
.detail-price { font-weight: 800; font-size: 24px; color: var(--pink-deep); }
.detail-price small { font-size: 14px; }
.detail-hint { font-size: 14px; color: var(--ink-soft); line-height: 1.6; margin: 0; }

/* クローゼット */
.closet-stage { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 6px; }
.closet-avatar { width: 190px; height: 316px; background: linear-gradient(180deg, #fff6fb, #ffd6ea); border-radius: var(--radius); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--pink-soft); }
.skin-select { display: flex; gap: 8px; }
.skin-chip { display: flex; align-items: center; gap: 6px; border: 2px solid var(--pink-soft); background: #fff; border-radius: 999px; font-weight: 800; font-size: 13px; padding: 5px 12px 5px 6px; color: var(--ink); }
.skin-chip i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #d9b3c6; display: block; }
.skin-chip.is-on { border-color: var(--pink); background: var(--pink-bg); box-shadow: 0 0 0 2px rgba(255, 79, 160, 0.3); }

/* ---------- 踊る ---------- */
.game-stage {
  position: relative; height: 100dvh; min-height: 600px; max-height: 960px; overflow: hidden; color: #fff;
  background: radial-gradient(ellipse at 50% 30%, #6b1f8c 0%, #2b0a45 70%, #1a0430 100%);
  --lane-bottom: 56px;
}
.game-stage.has-pad { --lane-bottom: 226px; }
.cam-video, .cam-skel { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.cam-video.is-on { opacity: 0.55; }
.cam-skel.is-on { opacity: 0.9; }
.game-dim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 0, 40, 0.45), rgba(20, 0, 40, 0.15) 40%, rgba(20, 0, 40, 0.5)); pointer-events: none; }
.hud { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 4px; gap: 8px; z-index: 5; }
.hud-score, .hud-combo { display: flex; flex-direction: column; align-items: center; font-weight: 800; line-height: 1.1; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6); }
.hud-score span:last-child { font-size: 26px; }
.hud-combo span:first-child { font-size: 26px; color: #ffe14a; }
.hud-label { font-size: 10px; letter-spacing: 0.1em; opacity: 0.9; }
.progress { position: absolute; top: 58px; left: 12px; right: 12px; height: 5px; background: rgba(255, 255, 255, 0.25); border-radius: 3px; z-index: 5; overflow: hidden; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, #ff7ec0, #ffe14a); }

.lane { position: absolute; left: 50%; transform: translateX(-50%); top: 76px; bottom: var(--lane-bottom); width: 128px; z-index: 3; }
.lane-bg { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 79, 160, 0.25)); border-left: 3px solid rgba(255, 255, 255, 0.55); border-right: 3px solid rgba(255, 255, 255, 0.55); border-radius: 6px; }
.notes { position: absolute; inset: 0; overflow: hidden; z-index: 1; }
.judge-line { z-index: 0; position: absolute; left: -10px; right: -10px; height: 0; margin-top: -4px; border-top: 8px solid #ffe14a; border-radius: 4px; box-shadow: 0 0 14px 3px #ffe14a, 0 0 32px 6px rgba(255, 225, 74, 0.55); }
.judge-line span { position: absolute; left: calc(100% - 6px); top: -40px; font-size: 12px; font-weight: 800; line-height: 1.15; text-align: center; white-space: nowrap; color: #ffe14a; background: rgba(20, 0, 40, 0.6); border-radius: 8px; padding: 3px 4px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); }
.judge-line.flash { animation: linefl 0.25s ease-out; }
@keyframes linefl { 0% { border-top-color: #fff; box-shadow: 0 0 22px 10px #fff, 0 0 60px 26px rgba(255, 255, 255, 0.75); } 100% { border-top-color: #ffe14a; box-shadow: 0 0 14px 3px #ffe14a, 0 0 32px 6px rgba(255, 225, 74, 0.55); } }
.note {
  position: absolute; left: 50%; top: 0; width: var(--note, 78px); height: var(--note, 78px); will-change: transform;
  background: var(--mc, #ff4fa0); border: 3px solid #fff; border-radius: 18px;
  box-shadow: 0 0 0 3px var(--md, #a8135f), 0 3px 10px rgba(0, 0, 0, 0.4); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2px;
}
.note svg { width: calc(var(--note, 78px) * 0.65); height: calc(var(--note, 78px) * 0.65); }
.note span { font-size: 11.5px; font-weight: 800; line-height: 1; margin-top: 1px; white-space: nowrap; text-shadow: 0 1px 0 var(--md), 0 0 3px var(--md); }
.note.hit-perfect { animation: hitfade 0.35s ease-out forwards; border-color: #ffe14a; }
.note.hit-good { animation: hitfade 0.35s ease-out forwards; border-color: #8fd8ff; }
.note.flash { border-color: #fff; box-shadow: 0 0 0 4px #fff, 0 0 34px 14px #fff; filter: brightness(1.35); }
.note.miss { opacity: 0.4; filter: grayscale(0.8); }
@keyframes hitfade { 0% { opacity: 1; scale: 1; } 100% { opacity: 0; scale: 1.5; } }

.feedback { position: absolute; left: 50%; transform: translateX(-50%); bottom: 4px; font-weight: 800; font-size: 20px; opacity: 0; white-space: nowrap; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7); pointer-events: none; z-index: 4; }
.feedback.show { animation: fbpop 0.5s ease-out forwards; }
.feedback.perfect { color: #ffe14a; font-size: 24px; }
.feedback.good { color: #8fd8ff; }
.feedback.miss { color: #ff9ab0; }
@keyframes fbpop { 0% { opacity: 0; transform: translateX(-50%) scale(0.6); } 20% { opacity: 1; transform: translateX(-50%) scale(1.15); } 100% { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(1); } }

.side-left { position: absolute; left: 6px; bottom: calc(var(--lane-bottom) - 4px); width: 118px; z-index: 3; }
.mini-avatar { width: 118px; height: 196px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4)); }
.side-right { position: absolute; right: 8px; top: 120px; width: 96px; z-index: 3; text-align: center; background: rgba(0, 0, 0, 0.3); border-radius: 14px; padding: 8px 4px; }
.now-label { font-size: 11px; font-weight: 800; opacity: 0.9; }
.now-icon { width: 54px; height: 54px; margin: 4px auto 2px; border-radius: 14px; border: 3px solid transparent; }
.now-icon svg { width: 100%; height: 100%; }
.now-name { font-size: 12px; font-weight: 800; min-height: 1.2em; }

.pad { position: absolute; left: 8px; right: 8px; bottom: 30px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; z-index: 6; }
.pad-btn {
  position: relative; height: 74px; border: 3px solid #fff; border-radius: 16px; color: #fff; font-weight: 800; font-size: 12px;
  background: var(--mc, #ff4fa0); box-shadow: 0 0 0 2px var(--md, #a8135f); text-shadow: 0 1px 0 var(--md), 0 0 3px var(--md);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; touch-action: manipulation; user-select: none; padding: 2px;
}
.pad-btn svg { width: 38px; height: 38px; }
.pad-btn:active { filter: brightness(1.2); transform: scale(0.96); }
.pad-btn kbd { position: absolute; top: 3px; right: 6px; font-family: inherit; font-size: 11px; opacity: 0.9; }

.privacy-note { position: absolute; left: 10px; right: 10px; bottom: 6px; margin: 0; font-size: 10.5px; text-align: center; color: rgba(255, 255, 255, 0.85); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); z-index: 6; }
.countdown { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-logo); font-size: 96px; color: #ffe14a; text-shadow: 0 0 20px #ff3d9a, 4px 4px 0 #d6247f; z-index: 8; pointer-events: none; }
.countdown.pop { animation: cdpop 0.6s ease-out; }
@keyframes cdpop { from { transform: scale(1.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.overlay { position: absolute; inset: 0; z-index: 10; background: rgba(30, 0, 45, 0.82); display: flex; align-items: center; justify-content: center; padding: 14px; overflow-y: auto; }
.panel { width: 100%; max-width: 360px; background: linear-gradient(180deg, #fff, #ffe9f4); color: var(--ink); border-radius: 24px; border: 4px solid var(--pink); padding: 18px 18px 16px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); }
.panel-small { text-align: center; }
.panel-title { margin: 0 0 6px; text-align: center; font-family: var(--font-logo); font-weight: 400; font-size: 28px; color: var(--pink-deep); }
.panel-text { margin: 0 0 10px; font-size: 14px; line-height: 1.6; }
.diff-select { display: flex; gap: 8px; justify-content: center; margin: 8px 0 4px; }
.diff-select .chip { flex: 1; font-size: 16px; padding: 10px; }
.best-line { text-align: center; margin: 4px 0 12px; font-size: 13px; color: var(--ink-soft); font-weight: 800; }
.panel .btn-main, .panel .btn-sub { margin-top: 10px; }
.howto { margin: 12px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.6; color: var(--ink-soft); }
.privacy-note-in { margin: 10px 0 0; font-size: 12px; font-weight: 800; color: var(--pink-deep); text-align: center; }
.rank { text-align: center; font-family: var(--font-logo); font-size: 64px; line-height: 1.1; color: var(--pink); text-shadow: 3px 3px 0 var(--gold); }
.res-score { display: flex; justify-content: space-between; align-items: baseline; font-weight: 800; border-bottom: 2px dashed var(--pink-soft); padding: 4px 4px 8px; }
.res-score b { font-size: 28px; color: var(--pink-deep); }
.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.res-cell { background: #fff; border-radius: 12px; border: 2px solid var(--pink-soft); padding: 6px 10px; display: flex; justify-content: space-between; align-items: baseline; font-weight: 800; font-size: 12px; }
.res-cell b { font-size: 20px; }
.res-cell.is-perfect b { color: #e0a000; } .res-cell.is-good b { color: #1a9bbd; } .res-cell.is-miss b { color: #d6455f; }
.res-points { text-align: center; font-weight: 800; background: var(--gold); border-radius: 999px; padding: 8px; font-size: 15px; border: 2px solid #fff; box-shadow: 0 2px 0 #c99200; }
.res-points b { font-size: 24px; }

/* ---------- プリ ---------- */
.booth { position: relative; width: 100%; max-width: 330px; margin: 0 auto; aspect-ratio: 3 / 4; border-radius: 20px; overflow: hidden; border: 4px solid #fff; box-shadow: 0 0 0 2px var(--pink), 0 6px 16px rgba(160, 20, 100, 0.3); background: #fff; }
.booth svg, .booth canvas { width: 100%; height: 100%; display: block; }
.booth-count { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-logo); font-size: 130px; color: #fff; text-shadow: 0 0 24px #ff3d9a, 5px 5px 0 #d6247f; background: rgba(60, 0, 50, 0.25); }
.booth-count.pop { animation: cdpop 0.7s ease-out; }
.booth-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.booth-flash.go { animation: flash 0.45s ease-out; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
.opt-block { margin-top: 12px; }
.opt-block h3 { margin: 0 0 6px; font-size: 14px; color: var(--pink-deep); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
#puriShoot { margin-top: 16px; font-size: 22px; }
.canvas-wrap { width: 100%; max-width: 330px; margin: 0 auto; border-radius: 16px; overflow: hidden; border: 4px solid #fff; box-shadow: 0 0 0 2px var(--pink), 0 6px 16px rgba(160, 20, 100, 0.3); background: #fff; line-height: 0; }
#puriCanvas { width: 100%; height: auto; aspect-ratio: 3 / 4; touch-action: none; cursor: crosshair; display: block; }
.tool-tabs { margin-top: 10px; }
.tool-panel { background: #fff; border-radius: 0 14px 14px 14px; border: 2px solid var(--pink-soft); padding: 10px; min-height: 84px; }
.swatches { display: flex; gap: 10px; margin-bottom: 10px; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px #d9b3c6; padding: 0; }
.swatch.is-on { box-shadow: 0 0 0 3px var(--pink-deep); transform: scale(1.1); }
.stamp-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stamp-btn { background: #fff6fb; border: 2px solid var(--pink-soft); border-radius: 12px; padding: 4px; aspect-ratio: 1 / 1; }
.stamp-btn svg { width: 100%; height: 100%; display: block; }
.stamp-btn img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.stamp-btn.is-on { border-color: var(--pink); background: var(--pink-soft); }
.text-row { display: flex; gap: 8px; }
.text-row input { flex: 1; min-width: 0; font-family: inherit; font-weight: 800; font-size: 16px; border: 2px solid var(--pink-soft); border-radius: 12px; padding: 8px 10px; color: var(--ink); }
.book-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.book-item { padding: 0; border: 3px solid #fff; border-radius: 10px; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px var(--pink-soft); aspect-ratio: 3 / 4; }
.book-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewer { position: fixed; inset: 0; z-index: 30; background: rgba(30, 0, 45, 0.88); display: flex; justify-content: center; overflow-y: auto; }
.viewer-inner { width: 100%; max-width: 380px; padding: 16px; }
.viewer-inner img { width: 100%; border-radius: 14px; border: 4px solid #fff; display: block; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); max-width: min(92vw, 400px);
  background: rgba(59, 29, 51, 0.95); color: #fff; font-weight: 800; font-size: 14px; padding: 10px 16px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 100; text-align: center; line-height: 1.4;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-height: 700px) {
  .title-avatar { height: 280px; width: 170px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- アバターのビート演出（ポーズは1種のためCSSで弾ませる） ---------- */
.bounce .avatar-canvas { transform-origin: 50% 100%; animation: beat 0.8s ease-in-out infinite; }
.mini-avatar.bounce .avatar-canvas { animation-duration: 0.4s; } /* BPM150 = 0.4秒/拍 */
.mini-avatar.hit .avatar-canvas { animation: beathit 0.25s ease-out; }
@keyframes beat { 0%, 100% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(-4%) scale(0.985, 1.02); } }
@keyframes beathit { 0% { transform: translateY(0) scale(1.06, 0.94); } 50% { transform: translateY(-7%) scale(0.98, 1.04); } 100% { transform: translateY(0) scale(1, 1); } }
@media (prefers-reduced-motion: reduce) { .bounce .avatar-canvas, .mini-avatar.hit .avatar-canvas { animation: none; } }

.boot-loader { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, #fff6fb, #ffd6ea); color: var(--pink-deep); font-weight: 800; font-size: 18px; }
.boot-loader[hidden] { display: none; }

/* ---------- v3: 曲・難易度の選択 ---------- */
.song-select { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 4px; }
.song-select .chip { width: 100%; text-align: left; font-size: 15px; padding: 10px 14px; }
.diff-select .chip { font-size: 14px; padding: 10px 4px; }
.sim-note { margin: 10px 0 0; font-size: 12px; font-weight: 800; color: #fff; background: var(--purple); border-radius: 12px; padding: 6px 10px; line-height: 1.5; }

/* ---------- v3: フリ紹介 ---------- */
.intro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 4px; }
.intro-card {
  background: var(--mc); border: 3px solid #fff; box-shadow: 0 0 0 3px var(--md); border-radius: 18px; color: #fff;
  display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 6px 10px; min-width: 0;
  text-shadow: 0 1px 0 var(--md), 0 0 4px var(--md);
}
.intro-icon { width: 84px; height: 84px; }
.intro-icon svg { width: 100%; height: 100%; }
.intro-card b { font-size: 18px; font-weight: 800; line-height: 1.2; margin-top: 2px; }
.intro-card span { text-wrap: balance; font-size: 12.5px; font-weight: 800; line-height: 1.4; margin-top: 3px; }

/* ---------- v3: ポーズ練習 ---------- */
.overlay-clear { background: rgba(30, 0, 45, 0.25); align-items: flex-start; }
.practice { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 70px; }
.practice-step { font-weight: 800; font-size: 14px; background: rgba(0, 0, 0, 0.45); border-radius: 999px; padding: 3px 14px; }
.practice-desc { font-weight: 800; font-size: 16px; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8); }
.practice-bar { width: min(62vw, 270px); height: 12px; border-radius: 6px; background: rgba(255, 255, 255, 0.3); overflow: hidden; border: 2px solid #fff; }
.practice-bar div { height: 100%; width: 0; background: #ffe14a; }
.practice-msg { font-weight: 800; font-size: 20px; min-height: 1.4em; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8); }
.practice-card.ok { animation: okpop 0.4s ease-out; box-shadow: 0 0 0 5px #ffe14a, 0 0 30px 8px #ffe14a; }
@keyframes okpop { 0% { transform: scale(1); } 40% { transform: scale(1.1); } 100% { transform: scale(1); } }
.game-stage.has-pad .pad { z-index: 12; }

/* ---------- v3: カメラ時の画面（色と大きさで伝える） ---------- */
.edge-glow { display: none; pointer-events: none; }
.edge-glow {
  position: absolute; inset: 0; z-index: 2; opacity: 0; transition: opacity 0.12s;
  box-shadow: inset 0 0 0 6px var(--glow, transparent), inset 0 0 70px 16px var(--glow, transparent);
}
.has-cam .edge-glow { display: block; }
.has-cam .side-right { display: none; }
/* v3.2: カメラ時も落ちてくるレーン。幅を広げ、ノーツ（--note）を大きくする */
.has-cam .lane { width: min(70vw, 290px); z-index: 4; }
.has-cam .lane-bg { background: linear-gradient(180deg, rgba(20, 0, 40, 0.3), rgba(255, 79, 160, 0.22)); }
.has-cam .note { border-radius: 26px; padding: 4px; gap: 2px; }
.has-cam .note span { font-size: 20px; margin-top: 0; }
.has-cam .cam-video.is-on { opacity: 0.7; }
.cue-judge { display: none; position: absolute; left: 0; right: 0; top: 92px; text-align: center; pointer-events: none; z-index: 7; height: 44px; line-height: 44px; font-size: 36px; font-weight: 800; opacity: 0; white-space: nowrap; text-shadow: 0 3px 6px rgba(0, 0, 0, 0.8); }
.has-cam .cue-judge { display: block; }
.cue-judge.show { animation: judgepop 0.6s ease-out forwards; }
.cue-judge.perfect { color: #ffe14a; }
.cue-judge.good { color: #8fd8ff; }
.cue-judge.miss { color: #ff9ab0; }
@keyframes judgepop { 0% { opacity: 0; transform: scale(0.6); } 20% { opacity: 1; transform: scale(1.15); } 70% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: translateY(-10px); } }
.cue-card, .practice-card {
  position: relative; width: var(--cue-size, min(62vw, 270px)); height: var(--cue-size, min(62vw, 270px)); background: var(--mc);
  border: 5px solid #fff; box-shadow: 0 0 0 5px var(--md), 0 8px 20px rgba(0, 0, 0, 0.5); border-radius: 30px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #fff;
  text-shadow: 0 2px 0 var(--md), 0 0 6px var(--md);
}
.cue-icon { width: 62%; aspect-ratio: 1 / 1; }
.cue-icon svg { width: 100%; height: 100%; display: block; }
.cue-name { font-size: clamp(28px, 8.4vw, 34px); font-weight: 800; line-height: 1.1; white-space: nowrap; }
.practice-card { --cue-size: min(62vw, 270px); }
.practicing .lane, .practicing .cue-judge, .practicing .side-left, .practicing .progress, .practicing .edge-glow { visibility: hidden; }

/* ---------- v3.1: タップでスタート / 音が止まった表示 ---------- */
.tap-overlay { z-index: 13; flex-direction: column; gap: 10px; background: rgba(30, 0, 45, 0.55); text-align: center; color: #fff; cursor: pointer; text-shadow: 0 3px 8px rgba(0, 0, 0, 0.7); }
.tap-ready { font-family: var(--font-logo); font-size: 44px; color: #ffe14a; text-shadow: 0 0 20px #ff3d9a, 3px 3px 0 #d6247f; }
.tap-go { font-size: 30px; font-weight: 800; line-height: 1.3; animation: tapbeat 1s ease-in-out infinite; }
.tap-sub { margin-top: 6px; font-size: 16px; font-weight: 800; background: rgba(0, 0, 0, 0.45); border-radius: 999px; padding: 6px 16px; }
@keyframes tapbeat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.audio-banner { position: absolute; left: 50%; top: 62px; transform: translateX(-50%); z-index: 9; max-width: calc(100% - 20px); width: max-content; text-align: center; font-size: 12px; font-weight: 800; color: #fff; background: rgba(214, 36, 127, 0.92); border: 2px solid #fff; border-radius: 999px; padding: 4px 12px; line-height: 1.3; pointer-events: none; }
.audio-banner[hidden] { display: none; }
.intro-timing { font-weight: 800; color: var(--pink-deep); text-align: center; margin: 0 0 8px; }

/* ---------- v4.0: ミッション・コレクション・はじめてのコーデ・ひきつぎ・ホーム画面追加 ---------- */
.goal-card { width: 100%; margin-top: 14px; background: #fff; border: 3px solid var(--pink-soft); border-radius: 18px; padding: 12px 14px; box-shadow: 0 3px 0 #f1c3da; }
.collection { font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.collection b { color: var(--pink-deep); font-size: 18px; }
.collection-track { height: 10px; background: #ffe9f4; border-radius: 999px; margin: 6px 0 10px; overflow: hidden; }
.collection-bar { height: 100%; width: 0; background: linear-gradient(90deg, #ff9ad0, var(--pink)); border-radius: 999px; transition: width 0.4s; }
.mission-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mission { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; }
.mission-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--pink-soft); background: #fff; flex: none; position: relative; }
.mission.is-done .mission-check { background: var(--pink); border-color: var(--pink); }
.mission.is-done .mission-check::after { content: ''; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.mission-name { flex: 1; }
.mission.is-done .mission-name { color: var(--ink-soft); text-decoration: line-through; }
.mission-reward { font-size: 12px; color: #fff; background: var(--gold); color: #6b4a00; border-radius: 999px; padding: 2px 8px; }
.mission.is-done .mission-reward { background: var(--pink-soft); color: var(--pink-deep); }
.link-btn { background: none; border: none; color: var(--ink-soft); font-weight: 800; font-size: 12px; text-decoration: underline; margin-top: 10px; padding: 6px; }
.install-hint, .move-note { width: 100%; margin-top: 12px; background: #fff8e1; border: 2px solid var(--gold); border-radius: 14px; padding: 10px 12px; }
.install-hint .install-text, .move-note p { margin: 0; font-size: 13px; font-weight: 800; line-height: 1.5; }
.install-hint .btn-row { margin-top: 8px; }
.install-hint .btn-row > * { flex: none; padding: 6px 12px; font-size: 13px; }
.move-note .btn-main { margin-top: 8px; }
.overlay-fixed { position: fixed; z-index: 50; }
.panel-sub { margin: 12px 0 6px; font-size: 14px; color: var(--pink-deep); }
.transfer-box { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 12px; border: 2px solid var(--pink-soft); border-radius: 12px; padding: 8px; resize: none; color: var(--ink); background: #fff; word-break: break-all; }
.starter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.starter-card { background: #fff; border: 3px solid var(--pink-soft); border-radius: 16px; padding: 6px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-family: inherit; color: var(--ink); }
.starter-card:active { transform: scale(0.97); border-color: var(--pink); }
.starter-avatar { width: 100%; aspect-ratio: 2 / 3; }
.starter-card b { font-size: 14px; color: var(--pink-deep); }
.starter-card span { font-size: 10px; line-height: 1.4; color: var(--ink-soft); font-weight: 500; }
.res-mission { margin: 8px 0 0; text-align: center; font-size: 13px; font-weight: 800; color: var(--purple); background: #f3ebff; border-radius: 12px; padding: 6px 10px; }

/* v4.1: プリの保存導線 */
.save-status { margin: 10px 0 0; text-align: center; font-size: 12px; font-weight: 800; color: #1a7f4b; background: #e6f8ee; border-radius: 999px; padding: 5px 10px; }
#actExport, #vExport { margin-top: 12px; }
.export-hint { text-align: center; margin: 6px 0 0; }
#actToBook { margin-top: 10px; }
.viewer .export-hint { color: rgba(255, 255, 255, 0.85); }

/* v6: クラウド保存 */
.cloud-status { margin: 8px 0 0; font-size: 11px; font-weight: 800; color: var(--ink-soft); }
.cloud-status[data-state="ok"] { color: #1a7f4b; }
.cloud-status[data-state="error"] { color: #b3261e; }
.panel-scroll { max-height: calc(100vh - 28px); max-height: calc(100dvh - 28px); overflow-y: auto; }
.cloud-input { display: block; width: 100%; margin: 6px 0; padding: 10px 12px; font-size: 16px; font-family: inherit; border: 2px solid var(--pink-soft); border-radius: 12px; color: var(--ink); background: #fff; }
.cloud-id { font-family: ui-monospace, Menlo, monospace; font-size: 24px; font-weight: 800; letter-spacing: 0.12em; text-align: center; color: var(--pink-deep); background: #fff; border: 2px dashed var(--pink); border-radius: 12px; padding: 10px 6px; margin: 6px 0; user-select: all; -webkit-user-select: all; }
.cloud-off { color: #b3261e; font-weight: 800; }
.transfer-legacy { margin-top: 14px; }
.transfer-legacy summary { cursor: pointer; font-size: 13px; font-weight: 800; color: var(--ink-soft); padding: 6px 0; }
