/* Chord Party のスタイル。
   ビジュアルの土台は Chord Gym(ルートの styles.css ライトテーマ)のDNAを引き継ぐ:
   ニュートラル背景 + 白パネル + 細い罫線 + 青アクセント + コード/楽譜表記。
   その上に、おとだまキャラと大きなタップ対象(64px+)で子ども向けの遊びやすさを保つ。 */
:root {
  --bg: #F7F6F3; --panel: #FFFFFF; --panel-2: #EFEEE9; --border: #DDDCD4;
  --text: #26262A; --dim: #6E6E78; --faint: #A2A2AA;
  --blue: #2F7FD6; --blue-deep: #1E5E96; --blue-bg: #DCEDFF; --blue-tx: #0E4B85;
  --warm: #E8884E; --gold: #C98A1F; --sun: #FFC93C; --night: #8F84F2; --ok: #2E8B57;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Maru Gothic ProN", "BIZ UDGothic", "Yu Gothic", -apple-system, sans-serif;
  display: flex; justify-content: center;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; touch-action: manipulation; color: inherit; }
svg { display: block; }

.screen {
  width: 100%; max-width: 480px; min-height: 100dvh;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center;
  position: relative;
}

/* ---------- タイトル ---------- */
#scrTitle { justify-content: center; gap: 14px; text-align: center; }
.title-chars { display: flex; gap: 26px; }
.chara { filter: drop-shadow(0 3px 2px rgba(38, 38, 42, .10)); }
.bounce1 { animation: bounce 1.6s ease-in-out infinite; }
.bounce2 { animation: bounce 1.6s ease-in-out .4s infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.logo { margin: 6px 0 0; font-size: 40px; letter-spacing: .01em; color: var(--text); font-weight: 700; }
.logo-sub { font-size: 15px; line-height: 1.7; color: var(--dim); font-weight: 700; }
.title-foot { font-size: 12px; color: var(--faint); margin-top: 10px; }

/* ---------- 共通ボタン ---------- */
.big-btn {
  width: 100%; max-width: 340px; min-height: 64px; border-radius: 18px; border: none;
  font-size: 19px; font-weight: 800; margin-top: 10px;
  transition: transform .12s ease;
}
.big-btn:active { transform: scale(.97); }
.big-btn.primary { background: var(--blue); color: #fff; box-shadow: 0 2px 0 var(--blue-deep); }
.big-btn.ghost { background: var(--panel); color: var(--dim); border: 1px solid var(--border); font-size: 16px; min-height: 56px; }
.big-btn:disabled { opacity: .45; box-shadow: none; }
.chip-btn {
  min-width: 44px; min-height: 44px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--panel); color: var(--dim);
  font-size: 14px; font-weight: 700; padding: 8px 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.chip-btn:active { transform: scale(.96); }
.star svg { color: #DCD7C8; }
.star.on svg { color: var(--gold); }

/* ---------- シート(ゲート・ペイウォール) ---------- */
.sheet-wrap {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(38, 38, 42, .40);
}
.sheet {
  width: 100%; max-width: 480px; background: var(--panel); border-radius: 20px 20px 0 0;
  border: 1px solid var(--border); border-bottom: none;
  padding: 26px 24px calc(26px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  animation: sheetUp .28s ease-out;
}
@keyframes sheetUp { from { transform: translateY(40%); opacity: .4; } to { transform: none; opacity: 1; } }
.gate-icon { color: var(--blue); display: flex; gap: 6px; }
.gate-text { font-size: 22px; font-weight: 800; color: var(--text); }
.gate-sub { font-size: 14px; line-height: 1.8; color: var(--dim); }
.parent-note {
  background: var(--blue-bg); color: var(--blue-tx); border-radius: 12px; padding: 10px 14px;
  font-size: 13px; font-weight: 700; margin-top: 6px;
}
.gate-quiz { margin-top: 8px; font-size: 15px; font-weight: 700; }
.quiz-row { display: flex; gap: 10px; justify-content: center; margin-top: 8px; }
.quiz-row button {
  width: 64px; height: 52px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--panel); font-size: 20px; font-weight: 800; color: var(--text);
}
.plan-box { width: 100%; }
.plan-row { display: flex; gap: 10px; width: 100%; margin-top: 8px; }
.plan-btn {
  flex: 1; border: 1px solid var(--border); background: var(--panel); border-radius: 14px;
  padding: 14px 8px; display: flex; flex-direction: column; gap: 4px; color: var(--text);
}
.plan-btn b { font-size: 17px; }
.plan-btn span { font-size: 11px; color: var(--dim); }
.plan-btn.best { background: var(--blue-bg); border-color: var(--blue); }
.plan-web-note { font-size: 11.5px; color: var(--faint); margin-top: 8px; }

/* ---------- ワールドマップ ---------- */
#scrMap { gap: 12px; justify-content: flex-start; }
.map-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.star-total { font-size: 16px; font-weight: 800; color: var(--gold); display: flex; align-items: center; gap: 5px; letter-spacing: .02em; }
#worldList { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.world-card { width: 100%; background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 16px 18px; }
.world-name { font-size: 14.5px; font-weight: 800; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; color: var(--text); letter-spacing: .02em; }
.w-char svg { filter: drop-shadow(0 1px 1px rgba(38, 38, 42, .12)); }
.world-card.locked { background: var(--panel-2); }
.world-lock { font-size: 13px; color: var(--faint); font-weight: 700; padding: 6px 0 2px; }

/* じゆうえんそうへの入口カード */
.free-card {
  width: 100%; border: 1px solid var(--border); border-radius: 18px; padding: 13px 18px;
  background: var(--panel); display: flex; align-items: center; gap: 12px; text-align: left;
}
.free-card:active { transform: scale(.985); }
.fc-txt { display: flex; flex-direction: column; gap: 2px; }
.fc-t { font-size: 16px; font-weight: 800; color: var(--text); }
.fc-d { font-size: 12px; color: var(--faint); font-weight: 700; }

.stage-path { display: flex; flex-direction: column; gap: 10px; }
.stage-row { display: flex; }
.stage-row.right { justify-content: flex-end; }
.stage-row.center { justify-content: center; }
.stage-node {
  width: 76px; height: 76px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--panel);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-weight: 800; font-size: 21px; color: var(--dim); position: relative;
}
.stage-node .st-stars { display: flex; }
.stage-node.cleared { background: var(--blue-bg); border-color: var(--blue); color: var(--blue-tx); }
.stage-node.cleared .st-stars .star svg { color: #B9D6F2; }
.stage-node.cleared .st-stars .star.on svg { color: var(--gold); }
.stage-node.current { background: var(--blue); border-color: var(--blue-deep); color: #fff; box-shadow: 0 2px 0 var(--blue-deep); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
.stage-node.locked { background: var(--panel-2); color: var(--faint); }
.stage-node.locked .st-lock svg { color: #C8C4B8; }
.stage-node:active { transform: scale(.95); }
.st-trial {
  position: absolute; top: -8px; right: -16px; background: var(--ok); color: #fff;
  font-size: 10px; font-weight: 800; border-radius: 9px; padding: 3px 8px;
}

/* ---------- プレイ ---------- */
#scrPlay { justify-content: space-between; }
.play-head { width: 100%; display: flex; align-items: center; gap: 12px; }
.midi-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 700; color: var(--ok);
  background: #E4F2E9; border-radius: 10px; padding: 4px 9px; white-space: nowrap;
}
.q-dots { display: flex; gap: 7px; flex: 1; justify-content: center; flex-wrap: wrap; }
.q-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--border); transition: .2s; }
.q-dot.ok { background: var(--blue); }
.q-dot.ng { background: #E8A9A9; }
.q-dot.now { background: var(--warm); transform: scale(1.3); }

.play-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; position: relative; width: 100%; min-height: 0; }
.listen-chara {
  border: 1px solid var(--border); border-radius: 50%; padding: 10px;
  background: radial-gradient(circle at 35% 30%, #FFFFFF, #F3F0E8);
}
.listen-chara.playing { animation: wiggle .5s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(-4deg) scale(1.02); } 50% { transform: rotate(4deg) scale(1.05); } }
.play-prompt { font-size: 15px; font-weight: 800; color: var(--dim); text-align: center; min-height: 22px; }
/* コードネーム表記(Gym のコード名タイポグラフィのDNA) */
.play-chord { font-size: 21px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; min-height: 26px; }
.p-staff {
  width: 100%; max-width: 360px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px; padding: 6px 8px 2px;
}
.replay { font-size: 14px; padding: 11px 18px; border-radius: 22px; min-height: 48px; }

.feedback-stamp {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%) rotate(-7deg);
  font-size: 26px; font-weight: 900; padding: 9px 20px; border-radius: 14px;
  animation: stampIn .25s cubic-bezier(.2, 1.6, .4, 1);
  pointer-events: none; white-space: nowrap; z-index: 5;
}
.feedback-stamp.good { color: #fff; background: var(--blue); }
.feedback-stamp.bad { color: #fff; background: var(--warm); }
@keyframes stampIn { from { transform: translateX(-50%) rotate(-7deg) scale(2.2); opacity: 0; } to { transform: translateX(-50%) rotate(-7deg) scale(1); opacity: 1; } }

/* 回答: 画面下半分の大きなキャラボタン(白パネル+色の縁取り) */
.answer-area { width: 100%; display: flex; gap: 12px; min-height: 28vh; min-height: 28dvh; padding-bottom: 4px; }
.answer-btn {
  flex: 1; border-radius: 18px; min-width: 0; background: var(--panel);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  transition: transform .1s ease, filter .2s;
}
.answer-btn:active { transform: scale(.96); }
.answer-btn .a-label { font-size: 18px; font-weight: 900; }
.answer-btn.q-maj { border: 2px solid #E0B32A; background: #FFF8E1; color: #7A5B12; box-shadow: 0 2px 0 #E0B32A; }
.answer-btn.q-min { border: 2px solid var(--night); background: #F0EEFC; color: #4A4090; box-shadow: 0 2px 0 #8F84F2; }
.answer-btn.q-dim { border: 2px solid #B4A8E8; background: #F5F2FC; color: #4E4470; box-shadow: 0 2px 0 #B4A8E8; }
.answer-btn.q-aug { border: 2px solid #E799BE; background: #FCF1F6; color: #8A3B5C; box-shadow: 0 2px 0 #E799BE; }
.answer-btn.dim { filter: grayscale(.7) opacity(.45); }
.answer-btn.is-answer { outline: 4px solid var(--blue); }
.answer-btn .a-char svg { max-width: 100%; height: auto; }

/* ひいて まねする: 大きな1オクターブ鍵盤(Gymの鍵盤の色言語: ガイド=青系) */
.echo-area { width: 100%; min-height: 28vh; min-height: 28dvh; display: flex; align-items: stretch; }
.pkb-wrap { width: 100%; }
.pkb { position: relative; display: flex; width: 100%; height: 100%; min-height: 26vh; min-height: 26dvh; }
.pkb-key { border: none; transition: background .12s; }
.pkb-key.white {
  flex: 1; background: var(--panel); border: 1px solid #B9B8B0; border-radius: 0 0 10px 10px;
  margin: 0 1px; box-shadow: 0 2px 0 #C9C7BE;
}
.pkb-key.black {
  position: absolute; top: 0; width: 9%; height: 58%; transform: translateX(-50%);
  background: #2A2A30; border-radius: 0 0 7px 7px; box-shadow: 0 2px 0 #17171B; z-index: 2;
}
.pkb-key.down.white, .pkb-key.white:active { background: var(--panel-2); }
.pkb-key.down.black, .pkb-key.black:active { background: #50505A; }
.pkb-key.guide.white { background: var(--blue-bg); border-color: var(--blue); }
.pkb-key.guide.black { background: var(--blue-deep); }
.pkb-key.got.white { background: #A8D2FF; border-color: var(--blue-deep); }
.pkb-key.got.black { background: var(--blue); }

/* ---------- リザルト ---------- */
#scrResult { justify-content: center; gap: 10px; text-align: center; }
.result-chara { animation: bounce 1.4s ease-in-out infinite; filter: drop-shadow(0 3px 2px rgba(38, 38, 42, .10)); }
.result-stars { display: flex; gap: 10px; min-height: 58px; }
.result-stars .r-star svg { color: #DCD7C8; }
.result-stars .r-star { opacity: .5; transform: scale(.8); }
.result-stars .r-star.on { opacity: 1; animation: starPop .5s cubic-bezier(.2, 1.8, .4, 1) both; }
.result-stars .r-star.on svg { color: var(--gold); }
.result-stars .r-star.on:nth-child(2) { animation-delay: .25s; }
.result-stars .r-star.on:nth-child(3) { animation-delay: .5s; }
@keyframes starPop { from { transform: scale(2.4) rotate(20deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
.result-text { font-size: 24px; font-weight: 900; color: var(--text); }
.result-sub { font-size: 14px; color: var(--dim); font-weight: 700; margin-bottom: 8px; }
.new-char {
  display: flex; align-items: center; gap: 10px; background: var(--blue-bg);
  border: 1px solid var(--blue); border-radius: 14px; padding: 10px 16px;
  font-size: 13.5px; font-weight: 800; color: var(--blue-tx); margin: 4px 0;
  animation: sheetUp .4s ease-out;
}

.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i {
  position: absolute; top: -20px; width: 9px; height: 13px; border-radius: 3px;
  animation: fall 2.6s linear infinite;
}
@keyframes fall { to { transform: translateY(110dvh) rotate(720deg); } }

/* ---------- じゆうえんそう ---------- */
#scrFree { justify-content: space-between; gap: 12px; }
.free-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.free-chara {
  border: 1px solid var(--border); border-radius: 50%; padding: 10px;
  background: radial-gradient(circle at 35% 30%, #FFFFFF, #F3F0E8);
}
.free-chara.pop { animation: freePop .4s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes freePop { from { transform: scale(.7); } to { transform: scale(1); } }
.free-kb { width: 100%; min-height: 34vh; min-height: 34dvh; display: flex; align-items: stretch; }

/* ---------- ずかん ---------- */
#scrZukan { justify-content: flex-start; gap: 16px; }
.zukan-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: 100%; }
.zukan-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 16px 6px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.zukan-card:active { transform: scale(.97); }
.zukan-card .z-name { font-size: 15px; font-weight: 800; }
.zukan-card .z-desc { font-size: 11px; color: var(--faint); }
.zukan-card .z-chord {
  font-size: 12.5px; font-weight: 700; color: var(--blue-tx); background: var(--blue-bg);
  border-radius: 8px; padding: 2px 10px; margin-top: 3px; letter-spacing: -0.2px;
}
.zukan-card.locked { background: var(--panel-2); }
.zukan-card.locked .z-name { color: var(--faint); }
.zukan-hint { font-size: 12.5px; color: var(--faint); text-align: center; line-height: 1.7; }

@media (min-width: 480px) {
  .screen { padding-left: 28px; padding-right: 28px; }
}
