/* =========================================================
   ゲピミニパズル / style.css
   トンマナ：アメコミ。白地＋太い黒の主線＋ハーフトーン＋原色。
   指で押しやすい大きさを最優先。
   ========================================================= */
:root {
  --paper: #ffffff;
  --cream: #fff8ec;
  --ink: #1d1220;            /* 本文と主線 */
  --line: #1d1220;
  --sub: #7a6a86;
  --hair: rgba(29, 18, 32, .14);

  --red: #ff4d6d;
  --orange: #ff9a20;
  --gold: #ffd83a;
  --gold-ink: #c97a00;
  --green: #3ddb8e;
  --blue: #4bb4ff;
  --purple: #b06cff;
  --pink: #ff5fae;

  --shadow: 0 4px 0 var(--line), 0 10px 16px rgba(29, 18, 32, .18);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  --pop: "Arial Black", Impact, var(--font);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none; user-select: none;
  overscroll-behavior: none;
}

#app { position: fixed; inset: 0; }

.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background:
    radial-gradient(120% 55% at 12% 0%, rgba(255,216,58,.55) 0%, transparent 58%),
    radial-gradient(110% 50% at 92% 6%, rgba(75,180,255,.45) 0%, transparent 58%),
    radial-gradient(120% 60% at 50% 110%, rgba(255,95,174,.35) 0%, transparent 60%),
    #fff8ec;
  animation: fadein .22s ease both;
}
.screen::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(29,18,32,.1) 1.1px, transparent 1.2px);
  background-size: 8px 8px;
  opacity: .5;
}
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }
[hidden] { display: none !important; }

/* ---------- ボタン ---------- */
.btn {
  position: relative;
  font-family: var(--font);
  font-weight: 800; font-size: 16px;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: 999px;
  padding: 12px 22px;
  min-height: 48px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .08s, box-shadow .08s;
  touch-action: manipulation;
}
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line), 0 3px 6px rgba(29,18,32,.2); }
.btn:disabled { opacity: .45; box-shadow: 0 4px 0 var(--line); cursor: default; }
.btn-primary { background: linear-gradient(180deg, #ffe98a, #ffbe22); }
.btn-ghost { background: var(--paper); }
.btn-lg { font-size: 19px; padding: 15px 30px; min-height: 58px; width: 100%; max-width: 340px; }
.btn-sm { font-size: 13px; padding: 8px 14px; min-height: 38px; }
.btn-icon {
  width: 46px; height: 46px; min-height: 46px; padding: 0;
  display: grid; place-items: center; font-size: 22px; line-height: 1;
}

/* ---------- 見出しバー ---------- */
.bar {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-t)) 12px 10px;
  background: linear-gradient(180deg, #ffe480, #ffc32e);
  border-bottom: 4px solid var(--line);
  flex: 0 0 auto;
}
.bar::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.7) 1.3px, transparent 1.4px);
  background-size: 7px 7px; opacity: .6;
}
.bar > * { position: relative; }
.bar h2 {
  flex: 1; margin: 0; text-align: center;
  font-family: var(--pop); font-size: 18px; letter-spacing: .04em;
  color: #fff; -webkit-text-stroke: 6px var(--line); paint-order: stroke fill;
}
.bar-pad { width: 46px; }
.bar-bottom {
  border-bottom: 0; border-top: 4px solid var(--line);
  padding-bottom: calc(12px + var(--safe-b));
  justify-content: center;
}
.park-foot { justify-content: space-between; gap: 8px; }
.kokoro { display: flex; align-items: center; gap: 4px; font-weight: 800; font-size: 12px; color: var(--ink); }
.kokoro i { font-style: normal; color: var(--red); font-size: 16px; }
.kokoro b { font-family: var(--pop); font-size: 20px; }
.kokoro small { font-size: 10px; }
.kokoro em { font-style: normal; font-family: var(--pop); font-size: 14px; margin-left: 6px; color: var(--gold-ink); }

/* ---------- 左上のプロフィール ---------- */
.profile {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px;
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--line);
  cursor: pointer; font-family: var(--font);
  transition: transform .08s, box-shadow .08s;
}
.profile:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.profile-face {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid var(--line); background: #fff;
  object-fit: cover; flex: 0 0 auto;
}
.profile-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.profile-text b { font-size: 14px; color: var(--ink); }
.profile-text small { font-size: 9px; color: var(--gold-ink); font-weight: 800; }

/* =========================================================
   タイトル
   ========================================================= */
.title-bg { position: absolute; inset: 0; overflow: hidden; }
.title-bg .pk-svg { width: 100%; height: 100%; display: block; }
.title-bg::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,248,236,0) 0%, rgba(255,248,236,.75) 48%, #fff8ec 76%);
}
.title-inner {
  position: relative; z-index: 1;
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
  gap: 10px; padding: 0 20px calc(22px + var(--safe-b));
  text-align: center;
}
.logo { margin: 0 0 2px; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.logo-sub {
  font-size: 13px; font-weight: 800; letter-spacing: .12em;
  background: var(--red); color: #fff;
  border: 3px solid var(--line);
  padding: 4px 14px; border-radius: 999px;
  box-shadow: 0 3px 0 var(--line);
}
.logo-main {
  font-family: var(--pop); font-size: clamp(30px, 10vw, 52px); line-height: 1.05;
  white-space: nowrap;
  color: var(--gold);
  -webkit-text-stroke: 9px var(--line); paint-order: stroke fill;
  text-shadow: 0 7px 0 var(--line);
  letter-spacing: .02em;
}
.title-cast {
  display: flex; align-items: flex-end; justify-content: center; gap: -8px;
  margin: -2px 0 0;
}
.title-cast img {
  width: min(30vw, 130px); height: auto;
  filter: drop-shadow(0 6px 6px rgba(29,18,32,.3));
}
.title-cast img:nth-child(1) { transform: translateX(14px) rotate(-6deg) scale(.86); animation: bob 2.9s ease-in-out infinite; }
.title-cast img:nth-child(2) { position: relative; z-index: 2; animation: bob 2.6s ease-in-out .2s infinite; }
.title-cast img:nth-child(3) { transform: translateX(-14px) rotate(6deg) scale(.86); animation: bob 3.1s ease-in-out .4s infinite; }
@keyframes bob { 0%,100% { translate: 0 0; } 50% { translate: 0 -9px; } }
.title-row { display: flex; gap: 8px; }
.title-note { margin: 2px 0 0; font-size: 12px; color: var(--sub); font-weight: 800; }

/* =========================================================
   キャラクター選択
   ========================================================= */
.char-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; position: relative; z-index: 1; }
.char-list { display: flex; flex-direction: column; gap: 14px; padding: 14px; }

.char-card {
  border: 4px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 6px 0 var(--line), 0 12px 18px rgba(29,18,32,.16);
  overflow: hidden;
  opacity: .7;
  transition: opacity .15s, transform .15s, box-shadow .15s;
}
.char-card.on {
  opacity: 1; transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--line), 0 0 0 4px var(--accent), 0 12px 22px rgba(29,18,32,.22);
}

.char-head {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  border-bottom: 4px solid var(--line);
}
.char-head::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.55) 1.4px, transparent 1.5px);
  background-size: 7px 7px; opacity: .55;
}
.char-pose {
  position: relative; width: 84px; height: 84px; flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 4px rgba(29,18,32,.32));
}
.char-name { position: relative; flex: 1; min-width: 0; color: var(--ink); }
.char-title { display: block; font-size: 11px; font-weight: 800; opacity: .85; }
.char-name b {
  font-family: var(--pop); font-size: 26px; line-height: 1.1; display: block;
  color: #fff; -webkit-text-stroke: 5px var(--line); paint-order: stroke fill;
}
.char-name p { margin: 4px 0 0; font-size: 12px; line-height: 1.5; font-weight: 700; }
.char-check {
  position: absolute; top: 10px; right: 12px;
  width: 30px; height: 30px; border-radius: 50%;
  background: #fff; border: 3px solid var(--line);
  display: grid; place-items: center; color: var(--ink); font-weight: 900;
  opacity: 0; transform: scale(.5); transition: .16s;
}
.char-card.on .char-check { opacity: 1; transform: scale(1); }

.char-skills { display: flex; flex-direction: column; gap: 8px; padding: 12px; }

.skill-card {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--cream);
  border: 2px solid var(--hair);
  border-left: 6px solid var(--accent);
  border-radius: 14px; padding: 10px;
  text-align: left;
}
.skill-ic {
  flex: 0 0 auto; display: block;
  border-radius: 12px; background-color: #fff;
  border: 3px solid var(--line);
  background-repeat: no-repeat;
}
.skill-body { min-width: 0; }
.skill-body b { font-size: 15px; color: var(--ink); }
.skill-body p { margin: 3px 0 0; font-size: 12px; line-height: 1.55; color: #5d4f6b; }
.skill-body p b { color: var(--gold-ink); font-size: 12px; }
.skill-from { display: flex; align-items: center; gap: 4px; margin-top: 7px; }
.skill-from span { font-size: 10px; color: #8d7f9a; margin-left: 3px; font-weight: 800; }
.pdot { width: 22px; height: 22px; background-size: contain; background-repeat: no-repeat; display: block; }

/* プロフィールのモーダル */
.prof-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin: -20px -18px 12px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  border-bottom: 4px solid var(--line);
  text-align: left; color: var(--ink);
}
.prof-head img { width: 78px; height: 78px; object-fit: contain; flex: 0 0 auto;
  filter: drop-shadow(0 4px 4px rgba(29,18,32,.32)); }
.prof-head b {
  font-family: var(--pop); font-size: 24px; line-height: 1.1; display: block;
  color: #fff; -webkit-text-stroke: 5px var(--line); paint-order: stroke fill;
}
.prof-head p { margin: 4px 0 0; font-size: 12px; line-height: 1.5; font-weight: 700; }
.prof-note { margin: 0 0 4px; font-size: 12px; color: var(--sub); font-weight: 800; }
.prof-note b { color: var(--gold-ink); }
.prof .char-skills { padding: 8px 0 0; }

/* =========================================================
   遊園地ホーム
   ========================================================= */
.park-wrap {
  flex: 1 1 auto; min-height: 0; position: relative; z-index: 1;
  display: flex; align-items: stretch; justify-content: center;
  overflow: hidden;
  /* 絵は下ぞろえなので、上のあまりは空の色でうめる */
  background: linear-gradient(180deg, #8ddcff 0%, #b6e8ff 60%, #cdf0ff 100%);
}
.pk-svg { width: 100%; height: 100%; display: block; }

.pk-attr { cursor: pointer; }
.pk-attr .pk-hit { pointer-events: all; }
.pk-attr:active { filter: brightness(1.1); }
.pk-attr.locked { filter: grayscale(.65) opacity(.75); }
.pk-ghost { animation: ghost 2.4s ease-in-out infinite; }
@keyframes ghost { 0%,100% { opacity: .45; } 50% { opacity: .95; } }
.pk-tag text { pointer-events: none; }

/* 完成したときの動き */
.pk-wheel.go { transform-origin: 50px 40px; animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pk-attr.done .pk-horse { animation: hop 1.6s ease-in-out infinite; }
@keyframes hop { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.pk-attr.done .pk-cups { transform-origin: 50px 78px; animation: spin 6s linear infinite; }
.pk-cart.go { animation: ride 4.4s cubic-bezier(.6,0,.4,1) infinite; }
@keyframes ride {
  0%   { transform: translate(8px, 88px); }
  35%  { transform: translate(34px, 20px); }
  55%  { transform: translate(56px, 22px); }
  70%  { transform: translate(50px, 44px); }
  100% { transform: translate(92px, 90px); }
}
.pk-attr.done .pk-sparkle { animation: twinkle 1.6s ease-in-out infinite; transform-origin: 50px 24px; }
@keyframes twinkle { 0%,100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.15); } }

/* =========================================================
   アトラクションのシート／ステージの札
   ========================================================= */
.atr-art {
  height: 150px; margin: -8px -6px 4px;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #cdf0ff, #e9ffe4);
  border: 3px solid var(--line); border-radius: 16px;
  overflow: hidden;
}
.pk-solo-svg { width: 100%; height: 100%; }
.atr-sub { margin: 4px 0 10px; font-size: 12px; line-height: 1.6; color: var(--sub); font-weight: 700; }

.atr-bar {
  position: relative; height: 20px; margin: 0 0 12px;
  background: #efe6f5; border: 3px solid var(--line); border-radius: 999px; overflow: hidden;
}
.atr-bar span {
  position: absolute; inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--accent, #ffd83a), #ffd83a);
  transition: width .4s cubic-bezier(.2,.9,.3,1);
}
.atr-bar em {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: .06em;
}

.st-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.st-chip {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 12px;
  background: var(--paper);
  border: 3px solid var(--line); border-radius: 14px;
  box-shadow: 0 3px 0 var(--line);
  font-family: var(--font); cursor: pointer; text-align: left;
}
.st-chip:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.st-chip b { font-family: var(--pop); font-size: 14px; flex: 0 0 auto; }
.st-chip span { flex: 1; font-size: 12px; font-weight: 800; color: var(--sub); }
.st-chip i { font-style: normal; font-size: 13px; color: var(--gold); letter-spacing: -1px; }
.st-chip.done { background: #fff7dc; }
.st-chip.next { background: linear-gradient(180deg, #ffe98a, #ffd056); animation: nextpulse 1.6s ease-in-out infinite; }
@keyframes nextpulse { 50% { box-shadow: 0 3px 0 var(--line), 0 0 0 5px rgba(255,196,40,.45); } }
.st-chip.locked { opacity: .5; box-shadow: 0 3px 0 var(--line); cursor: default; }

.res-build {
  height: 120px; margin: 6px 0 8px;
  background: linear-gradient(180deg, #cdf0ff, #e9ffe4);
  border: 3px solid var(--line); border-radius: 14px; overflow: hidden;
}

/* =========================================================
   ゲーム
   ========================================================= */
#scr-game {
  background:
    radial-gradient(120% 40% at 50% 0%, rgba(255,216,58,.5) 0%, transparent 60%),
    linear-gradient(180deg, #fff8ec 0%, #ffeef7 55%, #e9f6ff 100%);
}

.hud {
  position: relative; z-index: 2;
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: calc(8px + var(--safe-t)) 14px 8px;
  background: var(--paper);
  border-bottom: 4px solid var(--line);
}
.btn-pause { width: 40px; height: 40px; min-height: 40px; font-size: 14px; flex: 0 0 auto; }
.hud-moves { flex: 1; text-align: center; }
.hud-label { display: block; font-size: 10px; color: var(--sub); letter-spacing: .04em; white-space: nowrap; font-weight: 800; }
.hud-moves b { font-family: var(--pop); font-size: 26px; line-height: 1.1; color: var(--ink); }
.hud-moves.low b { color: var(--red); animation: blink .7s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.hud-score { flex: 0 0 auto; text-align: right; min-width: 76px; }
.hud-score b { font-family: var(--pop); font-size: 20px; color: var(--gold-ink); }

.mission-strip {
  position: relative; z-index: 1;
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  background: rgba(255,255,255,.8);
  border-bottom: 2px solid var(--hair);
}
.mission-face {
  width: 42px; height: 42px; flex: 0 0 auto;
  border-radius: 50%; border: 3px solid var(--line);
  background: #fff; object-fit: cover;
}
.hud-missions { flex: 1; display: flex; flex-wrap: wrap; gap: 7px; }
.mchip {
  display: flex; align-items: center; gap: 5px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 999px; padding: 3px 12px 3px 4px;
}
.mchip.done { background: #d9fbe9; border-color: #12a866; }
.mchip.done::after { content: '✓'; color: #12a866; font-weight: 900; font-size: 13px; }
.mchip b { font-family: var(--pop); font-size: 15px; color: var(--ink); }
.mchip .mmax { font-size: 11px; color: var(--sub); }
.gicon {
  width: 26px; height: 26px; display: block;
  background-size: contain; background-repeat: no-repeat; background-position: center;
}
.gicon-score {
  font-style: normal; color: var(--gold-ink); font-size: 18px; text-align: center; line-height: 26px;
}

.board-wrap { position: relative; flex: 1 1 auto; min-height: 0; z-index: 1; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.stage-tag {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  z-index: 2; pointer-events: none;
  font-size: 12px; font-weight: 800; letter-spacing: .06em;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: 999px; padding: 4px 16px;
  box-shadow: 0 3px 0 var(--line);
  white-space: nowrap;
}

.combo-pop {
  position: absolute; inset: auto 0 auto 0; top: 30%;
  z-index: 3; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  opacity: 0;
}
.combo-pop.show { animation: combo .85s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes combo {
  0% { opacity: 0; transform: scale(.4) rotate(-10deg); }
  25% { opacity: 1; transform: scale(1.15) rotate(3deg); }
  40% { transform: scale(1) rotate(0deg); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.1) translateY(-18px); }
}
.combo-pop b {
  font-family: var(--pop); font-size: 60px; line-height: .9;
  color: var(--gold);
  -webkit-text-stroke: 10px var(--line); paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--line);
}
.combo-pop b i { font-style: normal; font-size: 26px; }
.combo-pop span {
  font-family: var(--pop); font-size: 22px;
  color: #fff;
  -webkit-text-stroke: 7px var(--line); paint-order: stroke fill;
}

/* ---------- スキルバー ---------- */
.skill-bar {
  position: relative; z-index: 2;
  flex: 0 0 auto;
  padding: 8px 10px calc(8px + var(--safe-b));
  background: var(--paper);
  border-top: 4px solid var(--line);
}
.skill-bar.flash { animation: barflash .6s ease; }
@keyframes barflash {
  0%, 100% { background: var(--paper); }
  30% { background: #ffeeb8; }
}
.gauge {
  position: relative; height: 18px; border-radius: 999px;
  background: #efe6f5;
  border: 3px solid var(--line);
  overflow: hidden; margin-bottom: 8px;
}
.gauge-fill {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  background: linear-gradient(90deg, #ff4d6d, #ffd83a 55%, #3ddb8e);
  transition: width .25s cubic-bezier(.2,.9,.3,1);
}
.gauge-fill::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.6) 1.2px, transparent 1.3px);
  background-size: 6px 6px;
}
.gauge-label {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 10px; font-weight: 800; letter-spacing: .1em;
  color: var(--ink);
}

.skill-slots { display: flex; gap: 8px; }
.slot {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 4px 6px;
  border-radius: 16px;
  border: 3px solid var(--line);
  background: var(--cream);
  color: var(--sub);
  cursor: pointer; font-family: var(--font);
  box-shadow: 0 4px 0 var(--line);
  transition: transform .08s, box-shadow .08s;
}
.slot:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.slot[disabled] { opacity: .55; cursor: default; box-shadow: 0 4px 0 var(--line); }
.slot.ready {
  background: linear-gradient(180deg, #fffaea, #ffdf93);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--line), 0 0 0 3px var(--accent);
}
.slot.aiming { animation: aim .8s ease-in-out infinite; }
@keyframes aim { 50% { filter: brightness(1.12); transform: translateY(-2px); } }
.slot-ic { display: block; background-repeat: no-repeat; border-radius: 10px; }
.slot-ic.empty {
  width: 44px; height: 44px;
  border: 3px dashed rgba(29,18,32,.24);
  background: repeating-linear-gradient(45deg, rgba(29,18,32,.05) 0 6px, transparent 6px 12px);
}
.slot-name { font-size: 10px; font-weight: 800; line-height: 1.25; text-align: center; }
.slot.wide { flex: 2 1 0; }

.skill-hint {
  margin: 6px 0 0; min-height: 15px;
  text-align: center; font-size: 12px; font-weight: 800; color: var(--gold-ink);
}
.skill-hint b { color: var(--ink); }

/* =========================================================
   ものがたり（アメコミ）
   ========================================================= */
#scr-story { background: #efe7f5; }
.cm-bar { background: linear-gradient(180deg, #d3b5ff, #b06cff); }
.cm-head { flex: 1; display: flex; flex-direction: column; line-height: 1.1; }
.cm-head b {
  font-family: var(--pop); font-size: 18px; color: #fff;
  -webkit-text-stroke: 6px var(--line); paint-order: stroke fill;
}
.cm-head small { font-size: 11px; font-weight: 800; color: var(--ink); }
.cm-foot { background: linear-gradient(180deg, #d3b5ff, #b06cff); gap: 10px; }
.cm-dots { flex: 1; display: flex; gap: 6px; justify-content: center; }
.cm-dots i {
  width: 9px; height: 9px; border-radius: 50%;
  border: 2px solid var(--line); background: #fff;
}
.cm-dots i.on { background: var(--gold); }

.cm-scroll {
  flex: 1; overflow-y: auto; touch-action: pan-y;
  padding: 12px; position: relative; z-index: 1;
}
.cm-page {
  max-width: 460px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 10px;
}
.cm-page.turn { animation: turn .4s cubic-bezier(.2,.9,.3,1) both; }
@keyframes turn {
  from { opacity: 0; transform: translateX(26px) rotate(1.5deg); }
}
.cm-page-img img { width: 100%; display: block; border: 4px solid var(--line); border-radius: 6px; }

.cm-panel {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  border: 4px solid var(--line);
  border-radius: 4px;
  box-shadow: 4px 4px 0 var(--line);
  background: #fff;
}
.cm-talk {
  position: relative; z-index: 3;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding: 9px;
}
.cm-space { display: block; flex: 0 0 auto; }
.cm-tone {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(29,18,32,.16) 1.4px, transparent 1.5px);
  background-size: 8px 8px; opacity: .5; pointer-events: none;
}
.cm-bg-sky {
  background:
    repeating-conic-gradient(from 0deg at 50% 42%, rgba(255,255,255,.75) 0deg 6deg, rgba(255,255,255,0) 6deg 12deg),
    linear-gradient(180deg, #8ddcff 0%, #d8f3ff 60%, #fff3c8 100%);
}
.cm-bg-empty {
  background:
    repeating-linear-gradient(115deg, rgba(122,106,134,.16) 0 3px, transparent 3px 12px),
    linear-gradient(180deg, #e9e3ef 0%, #d8d2e0 100%);
}
.cm-bg-night {
  background:
    repeating-conic-gradient(from 0deg at 62% 30%, rgba(176,108,255,.5) 0deg 5deg, rgba(0,0,0,0) 5deg 11deg),
    linear-gradient(180deg, #35205c 0%, #6a3fa8 100%);
}
.cm-bg-night .cm-tone { background-image: radial-gradient(rgba(255,255,255,.2) 1.4px, transparent 1.5px); }
.cm-bg-parade {
  background:
    repeating-conic-gradient(from 0deg at 50% 50%, rgba(255,255,255,.6) 0deg 5deg, rgba(255,255,255,0) 5deg 10deg),
    linear-gradient(135deg, #ffd83a 0%, #ff5fae 40%, #4bb4ff 100%);
}

.cm-art {
  position: absolute; z-index: 1;
  filter: drop-shadow(0 4px 4px rgba(29,18,32,.35));
  transform: translateX(-50%);
  pointer-events: none;
}
.cm-art.flip { transform: translateX(-50%) scaleX(-1); }

.cm-narr {
  align-self: stretch;
  background: #fff6cf; border: 3px solid var(--line);
  padding: 6px 10px; font-size: 12px; font-weight: 800; line-height: 1.5;
  box-shadow: 3px 3px 0 var(--line);
}
.cm-bal {
  position: relative;
  max-width: 82%;
  background: #fff; border: 3px solid var(--line);
  padding: 8px 12px; font-size: 12.5px; font-weight: 800; line-height: 1.5;
  border-radius: 18px;
  box-shadow: 3px 3px 0 var(--line);
}
.cm-bal.cm-left { align-self: flex-start; }
.cm-bal.cm-right { align-self: flex-end; }
.cm-bal b {
  display: block; font-size: 10px; color: var(--gold-ink); margin-bottom: 2px; letter-spacing: .04em;
}
.cm-bal.cm-say::after {
  content: ''; position: absolute; bottom: -14px;
  border: 8px solid transparent; border-top-color: var(--line); border-bottom: 0;
}
.cm-bal.cm-say.cm-left::after { left: 22px; }
.cm-bal.cm-say.cm-right::after { right: 22px; }
/* さけびのフキダシ。とがった形に切ってから、影で黒フチを足している */
.cm-bal.cm-shout {
  background: #fff;
  border: 0; border-radius: 0; box-shadow: none;
  clip-path: polygon(0% 12%, 5% 0%, 22% 8%, 38% 0%, 55% 8%, 72% 0%, 88% 9%, 100% 2%,
                     96% 22%, 100% 44%, 94% 62%, 100% 82%, 86% 92%, 70% 86%, 52% 100%,
                     34% 88%, 16% 96%, 4% 84%, 0% 62%, 6% 40%);
  filter:
    drop-shadow(2.5px 0 0 #1d1220) drop-shadow(-2.5px 0 0 #1d1220)
    drop-shadow(0 2.5px 0 #1d1220) drop-shadow(0 -2.5px 0 #1d1220);
  padding: 18px 22px;
  font-family: var(--pop); font-size: 13px; letter-spacing: .02em; line-height: 1.45;
}
.cm-bal.cm-think { border-radius: 40% 46% 42% 48%; }
.cm-sfx {
  position: absolute; z-index: 2;
  font-family: var(--pop); font-size: clamp(20px, 6.4vw, 28px); line-height: 1;
  -webkit-text-stroke: 7px var(--line); paint-order: stroke fill;
  text-shadow: 0 4px 0 var(--line);
  white-space: nowrap;
  transform-origin: left center;
}

/* =========================================================
   モーダル・トースト
   ========================================================= */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: 18px;
  background: rgba(29, 18, 32, .5);
  opacity: 0; transition: opacity .2s;
  overflow-y: auto; touch-action: pan-y;
}
.modal.show { opacity: 1; }
.modal-card {
  width: 100%; max-width: 380px;
  background: var(--paper);
  border: 4px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 8px 0 var(--line), 0 18px 26px rgba(29,18,32,.3);
  padding: 20px 18px calc(18px + var(--safe-b));
  text-align: center;
  overflow: hidden;
  transform: scale(.9); transition: transform .22s cubic-bezier(.2,1.2,.4,1);
}
.modal.show .modal-card { transform: scale(1); }
.mod-title {
  margin: 0 0 12px; font-family: var(--pop); font-size: 22px;
  color: var(--gold); -webkit-text-stroke: 7px var(--line); paint-order: stroke fill;
}
.mod-sub { margin: 8px 0; font-size: 12.5px; color: var(--sub); line-height: 1.6; font-weight: 700; }
.mod-sub b { color: var(--ink); }
.mod-sub .hb { width: 34px; height: 34px; vertical-align: middle; margin-right: 6px; }
.mod-btns { display: flex; flex-direction: column; align-items: center; gap: 9px; margin-top: 16px; }
.mod-btns .btn { width: 100%; max-width: 300px; }

.res-stars { display: flex; justify-content: center; gap: 6px; margin: 4px 0; }
.res-stars i {
  font-style: normal; font-size: 40px; line-height: 1;
  color: #e4dbe9; text-shadow: 0 3px 0 rgba(29,18,32,.2);
}
.res-stars i.on { color: var(--gold); text-shadow: 0 3px 0 var(--line); animation: star .5s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes star { from { transform: scale(0) rotate(-60deg); opacity: 0; } }
.res-score { margin: 10px 0 0; font-size: 12px; letter-spacing: .1em; color: var(--sub); font-weight: 800; }
.res-score b { display: block; font-family: var(--pop); font-size: 30px; color: var(--ink); letter-spacing: 0; }
.res.lose .mod-title { color: #d9d0e0; }

.howto { text-align: left; margin: 0; padding-left: 20px; font-size: 12.5px; line-height: 1.75; color: #5d4f6b; font-weight: 700; }
.howto li { margin-bottom: 8px; }
.howto b { color: var(--ink); }
.howto-pieces { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.howto-pieces figure { margin: 0; width: 66px; }
.howto-pieces i { display: block; width: 44px; height: 44px; margin: 0 auto;
  background-size: contain; background-repeat: no-repeat; background-position: center; }
.howto-pieces figcaption { font-size: 9px; color: var(--sub); line-height: 1.2; margin-top: 2px; font-weight: 800; }

.toast {
  position: fixed; z-index: 60; left: 50%; top: calc(14px + var(--safe-t));
  transform: translate(-50%, -20px);
  display: flex; align-items: center; gap: 10px;
  max-width: min(92vw, 340px);
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: 16px; padding: 10px 16px 10px 12px;
  box-shadow: 0 5px 0 var(--line), 0 12px 18px rgba(29,18,32,.24);
  font-size: 13px; text-align: left; font-weight: 700;
  opacity: 0; transition: opacity .22s, transform .22s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast i {
  display: block; flex: 0 0 auto;
  background-repeat: no-repeat; border-radius: 8px;
  background-color: var(--cream); border: 2px solid var(--line);
}
.toast b { color: var(--gold-ink); }
.toast small { color: var(--sub); font-size: 11px; }

/* ---------- 横に広い画面 ---------- */
@media (min-width: 760px) {
  .char-list { max-width: 700px; margin: 0 auto; }
  .park-wrap .pk-svg { max-width: 560px; margin: 0 auto; }
  .skill-slots, .gauge, .hud-missions { max-width: 560px; margin-left: auto; margin-right: auto; }
  .skill-hint { max-width: 560px; margin-left: auto; margin-right: auto; }
}
