/* =========================================================
   ゲピミニパズル / style.css
   トンマナ：アメコミ。太い黒の主線、黒ベタの影、ハーフトーン、原色。
   ボタンの文字はすべて袋文字。指で押しやすい大きさを最優先。
   ========================================================= */
:root {
  --k: #111111;              /* 主線と影のベタ */
  --line: #111111;
  --ink: #1b1320;
  --sub: #5b4d66;
  --paper: #ffffff;
  --cream: #fff6e0;

  --red: #ff4d6d;
  --orange: #ff9a20;
  --gold: #ffd83a;
  --gold-ink: #b86e00;
  --green: #3ddb8e;
  --blue: #4bb4ff;
  --purple: #b06cff;
  --pink: #ff5fae;

  /* 袋文字（8方向に黒をずらして重ねる） */
  --fk2: 2px 0 0 var(--k), -2px 0 0 var(--k), 0 2px 0 var(--k), 0 -2px 0 var(--k),
         2px 2px 0 var(--k), -2px -2px 0 var(--k), 2px -2px 0 var(--k), -2px 2px 0 var(--k);
  --fk3: 3px 0 0 var(--k), -3px 0 0 var(--k), 0 3px 0 var(--k), 0 -3px 0 var(--k),
         3px 3px 0 var(--k), -3px -3px 0 var(--k), 3px -3px 0 var(--k), -3px 3px 0 var(--k),
         2px 3px 0 var(--k), -2px 3px 0 var(--k), 3px -2px 0 var(--k), -3px -2px 0 var(--k);
  --tone: radial-gradient(rgba(17,17,17,.14) 1.3px, transparent 1.4px);
  --tone-w: radial-gradient(rgba(255,255,255,.5) 1.3px, transparent 1.4px);

  --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: "Dela Gothic One", "Arial Black", "Hiragino Kaku Gothic ProN", Impact, sans-serif;
  --en: "Bangers", "Dela Gothic One", Impact, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--k);
  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;
  touch-action: manipulation;          /* ダブルタップでの拡大をしない */
}
/* 中身がスクロールする所も、はしで引っぱっても画面ごと動かない */
.modal, .char-scroll { overscroll-behavior: contain; }

#app { position: fixed; inset: 0; overflow: hidden; }

.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(120% 55% at 12% 0%, rgba(255,216,58,.6) 0%, transparent 58%),
    radial-gradient(110% 50% at 92% 6%, rgba(75,180,255,.5) 0%, transparent 58%),
    radial-gradient(120% 60% at 50% 110%, rgba(255,95,174,.4) 0%, transparent 60%),
    #fff4dc;
}
.screen::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: var(--tone);
  background-size: 8px 8px;
  opacity: .6;
}
[hidden] { display: none !important; }

/* 画面に入ったとき、上の帯は上から、下の帯は下から */
.screen.enter .bar:not(.bar-bottom), .screen.enter .hud { animation: barDrop .5s cubic-bezier(.2,1.3,.4,1) both; }
.screen.enter .bar-bottom, .screen.enter .navbar, .screen.enter .skill-bar { animation: barRise .5s cubic-bezier(.2,1.3,.4,1) .06s both; }
@keyframes barDrop { from { transform: translateY(-115%); } }
@keyframes barRise { from { transform: translateY(115%); } }

/* ---------- スプライト（キャラの動き 4×2） ---------- */
.spr { background-repeat: no-repeat; aspect-ratio: 256 / 320; }

/* =========================================================
   ボタン（すべて袋文字）
   ========================================================= */
.btn {
  --bg: var(--gold);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--pop); font-weight: 400; font-size: 17px; letter-spacing: .04em; line-height: 1.1;
  color: #fff;
  text-shadow: var(--fk2), 0 4px 0 var(--k);
  background-color: var(--bg);
  background-image: var(--tone-w), linear-gradient(180deg, rgba(255,255,255,.45) 0%, rgba(255,255,255,0) 48%);
  background-size: 6px 6px, 100% 100%;
  border: 4px solid var(--k);
  border-radius: 16px;
  padding: 12px 22px 13px;
  min-height: 54px;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--k);
  transition: transform .07s, box-shadow .07s, filter .12s;
  touch-action: manipulation;
}
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--k); }
.btn:disabled { --bg: #b9b2bf; filter: saturate(.3); cursor: default; opacity: .75; }
.btn:disabled:active { transform: none; box-shadow: 0 6px 0 var(--k); }
.btn-primary { --bg: #ffc21a; }
.btn-ghost { --bg: var(--blue); }
.btn-red { --bg: var(--red); }
.btn-green { --bg: #2fcf82; }
.btn-purple { --bg: var(--purple); }
.btn-orange { --bg: var(--orange); }
.btn-gray { --bg: #9d95a6; }
.btn-lg { font-size: 21px; padding: 15px 30px 16px; min-height: 64px; width: 100%; max-width: 340px; border-radius: 20px; }
.btn-sm { font-size: 14px; padding: 7px 14px 8px; min-height: 42px; border-radius: 12px; box-shadow: 0 4px 0 var(--k); }
.btn-icon {
  width: 48px; height: 48px; min-height: 48px; padding: 0;
  font-family: var(--en); font-size: 26px; border-radius: 14px;
}

/* ---------- 見出しバー ---------- */
.bar {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: calc(9px + var(--safe-t)) 12px 10px;
  background: linear-gradient(180deg, #ffe066, #ffbd1f);
  border-bottom: 5px solid var(--k);
  box-shadow: 0 5px 0 rgba(17,17,17,.25);
  flex: 0 0 auto;
}
.bar::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: var(--tone-w);
  background-size: 7px 7px; opacity: .7;
}
.bar > * { position: relative; }
.bar h2 {
  flex: 1; margin: 0; text-align: center;
  font-family: var(--pop); font-weight: 400; font-size: 19px; letter-spacing: .04em;
  color: #fff; text-shadow: var(--fk3), 0 4px 0 var(--k);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar-pad { width: 48px; }
.bar-bottom {
  border-bottom: 0; border-top: 5px solid var(--k); box-shadow: none;
  padding-bottom: calc(12px + var(--safe-b));
  justify-content: center;
}

/* ---------- 左上のプロフィール ---------- */
.profile {
  display: flex; align-items: center; gap: 8px; flex: 0 0 auto;
  padding: 4px 12px 4px 4px;
  background: var(--paper);
  border: 4px solid var(--k);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--k);
  cursor: pointer; font-family: var(--font);
  transition: transform .07s, box-shadow .07s;
}
.profile:active { transform: translateY(4px); box-shadow: 0 0 0 var(--k); }
.profile-face {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid var(--k); background: #fff;
  object-fit: contain; padding: 6px; flex: 0 0 auto;   /* 丸の中に顔ぜんぶを収める（四すみが丸で切れないだけの余白） */
}
.profile-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.profile-text b { font-family: var(--pop); font-weight: 400; font-size: 14px; color: #fff; text-shadow: var(--fk2); }
.profile-text small { font-size: 9px; color: var(--gold-ink); font-weight: 900; margin-top: 2px; }

.counters { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; flex: 0 0 auto; }
.cnt {
  display: flex; align-items: baseline; gap: 3px;
  padding: 1px 10px 2px 8px;
  border: 3px solid var(--k); border-radius: 999px;
  box-shadow: 0 3px 0 var(--k);
  font-family: var(--pop); color: #fff; text-shadow: var(--fk2);
  line-height: 1.2;
}
.cnt i { font-style: normal; font-size: 13px; }
.cnt b { font-weight: 400; font-size: 15px; }
.cnt small { font-size: 10px; }
.cnt-heart { background: var(--red); }
.cnt-star { background: #ffc21a; }

/* =========================================================
   いつも動いている背景
   ========================================================= */
.amb { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.amb i { position: absolute; display: block; }

/* 集中線がゆっくり回る（小さく描いて拡大するので、重くならない） */
.amb .rays {
  left: 50%; top: 40%;
  width: 70vmax; height: 70vmax; margin: -35vmax 0 0 -35vmax;
  background: repeating-conic-gradient(rgba(255,255,255,.34) 0deg 8deg, rgba(255,255,255,0) 8deg 18deg);
  border-radius: 50%;
  animation: rays 48s linear infinite;
  opacity: .85;
}
@keyframes rays { from { transform: scale(2.3) rotate(0deg); } to { transform: scale(2.3) rotate(360deg); } }

/* 流れ星 */
.amb .shoot {
  left: 0; top: var(--y);
  width: 150px; height: 28px;
  opacity: 0;
  animation: shoot var(--d) linear var(--delay) infinite;
}
.amb .shoot::before {
  content: ''; position: absolute; left: 0; right: 20px; top: 11px; height: 6px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0), #fff 85%);
  box-shadow: 0 3px 0 rgba(17,17,17,.3);
}
.amb .shoot::after {
  content: ''; position: absolute; right: 0; top: 0; width: 28px; height: 28px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M20 2l5 12 13 1-10 8 4 13-12-7-12 7 4-13L2 15l13-1z' fill='%23ffe24a' stroke='%23111' stroke-width='3.5' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  animation: twirl 1s linear infinite;
}
@keyframes shoot {
  0%   { transform: translate(-40vw, 0) rotate(17deg); opacity: 0; }
  3%   { opacity: 1; }
  24%  { transform: translate(115vw, 46vw) rotate(17deg); opacity: 1; }
  25%, 100% { transform: translate(115vw, 46vw) rotate(17deg); opacity: 0; }
}
@keyframes twirl { to { transform: rotate(360deg); } }

/* 小さな星。ゆっくり またたいて、ふわっと上がる（パズルの盤の後ろ） */
.amb .twk {
  left: var(--x); top: var(--y);
  width: 15px; height: 15px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M20 2l5 12 13 1-10 8 4 13-12-7-12 7 4-13L2 15l13-1z' fill='%23fff3a8' stroke='%23111' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  opacity: 0;
  animation: twk var(--d) ease-in-out var(--delay) infinite;
  will-change: transform, opacity;
}
@keyframes twk {
  0%, 100% { opacity: 0; transform: translateY(6px) scale(.6) rotate(0deg); }
  50% { opacity: .85; transform: translateY(-10px) scale(1) rotate(18deg); }
}

/* ふうせん */
.amb .bal {
  left: var(--x); bottom: -90px;
  width: 34px; height: 42px;
  border-radius: 50% 50% 46% 46%;
  background: var(--c);
  border: 3px solid var(--k);
  box-shadow: inset -6px -7px 0 rgba(0,0,0,.14), inset 5px 5px 0 rgba(255,255,255,.4);
  animation: balUp var(--d) linear var(--delay) infinite;
}
.amb .bal::after {
  content: ''; position: absolute; left: 50%; top: 100%;
  width: 2px; height: 30px; margin-left: -1px; background: var(--k);
}
@keyframes balUp {
  0%   { transform: translate(0, 0) rotate(-4deg); }
  50%  { transform: translate(14px, -60vh) rotate(4deg); }
  100% { transform: translate(-6px, -125vh) rotate(-4deg); }
}

/* 紙ふぶき */
.amb .conf {
  left: var(--x); top: -30px;
  width: 11px; height: 16px;
  background: var(--c);
  border: 2px solid var(--k);
  animation: confall var(--d) linear var(--delay) infinite;
}
@keyframes confall {
  0%   { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(40px, 112vh) rotate(760deg); }
}

/* =========================================================
   画面きりかえの帯
   ========================================================= */
.wipe { position: fixed; inset: 0; z-index: 90; pointer-events: none; overflow: hidden; }
.wipe i {
  position: absolute; top: -20%; bottom: -20%; left: 0;
  width: 70vw;
  border-left: 7px solid var(--k); border-right: 7px solid var(--k);
  background-image: var(--tone);
  background-size: 9px 9px;
  transform: translateX(-190vw) skewX(-16deg);
}
.wipe i:nth-child(1) { background-color: #ffc21a; }
.wipe i:nth-child(2) { background-color: var(--red); width: 60vw; }
.wipe i:nth-child(3) { background-color: var(--blue); width: 80vw; }
.wipe.go i { animation: wipe .56s cubic-bezier(.55,.05,.35,1) both; }
.wipe.go i:nth-child(2) { animation-delay: .04s; }
.wipe.go i:nth-child(3) { animation-delay: .08s; }
@keyframes wipe {
  0%   { transform: translateX(-190vw) skewX(-16deg); }
  45%  { transform: translateX(-10vw) skewX(-16deg); }
  55%  { transform: translateX(-5vw) skewX(-16deg); }
  100% { transform: translateX(160vw) skewX(-16deg); }
}

/* =========================================================
   読込中
   ========================================================= */
#scr-load {
  background:
    radial-gradient(120% 60% at 50% 0%, #ffe480 0%, transparent 58%),
    linear-gradient(180deg, #ffd257 0%, #ff9a20 55%, #ff5fae 100%);
}
.load-bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.load-inner {
  position: relative; z-index: 1;
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; padding: 0 28px calc(20px + var(--safe-b));
  text-align: center;
}
/* 読込中：3人の顔が、右の画面外から ぴょんぴょん はねながら入ってくる */
#scr-load { overflow: hidden; }
.load-faces { display: flex; justify-content: center; align-items: flex-end; gap: 4px; margin: 0 0 8px; padding-top: 30px; }
.lf { display: block; width: min(25vw, 108px); animation: lfIn 1.4s cubic-bezier(.22,.8,.32,1) both; }
.lf:nth-child(2) { animation-delay: .2s; }
.lf:nth-child(3) { animation-delay: .4s; }
.lf img {
  display: block; width: 100%; height: auto;
  filter: drop-shadow(0 6px 0 rgba(17,17,17,.22));
  transform-origin: 50% 100%;
  animation: lfHop .56s ease-in-out infinite;
}
.lf:nth-child(2) img { animation-delay: -.19s; }
.lf:nth-child(3) img { animation-delay: -.38s; }
@keyframes lfIn { from { transform: translateX(110vw); } }
@keyframes lfHop {
  0%, 100% { transform: translateY(0) scale(1.1, .9); }
  40%, 60% { transform: translateY(-28px) scale(.95, 1.05); }
}
.load-logo {
  width: min(82vw, 380px); height: auto; margin: 2px 0 8px;
  filter: drop-shadow(5px 5px 0 var(--k));
  animation: logoBreath 3.6s ease-in-out infinite;
}
.load-title {
  margin: 2px 0 6px;
  font-family: var(--pop); font-size: clamp(28px, 9vw, 42px); line-height: 1;
  color: #ffe24a;
  text-shadow: var(--fk3), 0 7px 0 var(--k);
  white-space: nowrap;
}
.load-bar {
  position: relative; width: min(78vw, 320px); height: 26px;
  background: #fff; border: 4px solid var(--k); border-radius: 999px;
  overflow: hidden; box-shadow: 0 5px 0 var(--k);
}
.load-bar span {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  background: linear-gradient(90deg, #ff4d6d, #ffd83a 55%, #3ddb8e);
  border-right: 4px solid var(--k);
  transition: width .2s ease-out;
}
.load-bar span::after {
  content: ''; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,.35) 0 8px, transparent 8px 16px);
  animation: stripe .6s linear infinite;
}
@keyframes stripe { to { background-position: 22px 0; } }
.load-pct { margin: 0; font-family: var(--en); font-size: 22px; color: #fff; text-shadow: var(--fk2); letter-spacing: .06em; }
.load-pct b { font-weight: 400; font-size: 30px; }
.load-tip {
  margin: 6px 0 0; max-width: 340px;
  font-size: 13px; font-weight: 800; line-height: 1.6; color: var(--ink);
  /* 日本語は どこでも折りかえせてしまい、2〜3文字だけ次の行に落ちる。
     読点・句点と 空白でだけ折りかえし、2行の長さをそろえる。
     それでも入りきらないときだけ、途中で折る（3行にはしない） */
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: balance;
  /* コツが1行でも2行でも、箱の高さは変えない */
  min-height: calc(3.2em + 26px);
  display: grid; place-items: center;
  align-content: center;
  background: #fff;
  border: 4px solid var(--k); border-radius: 16px;
  box-shadow: 5px 5px 0 var(--k);
  padding: 9px 14px;
}
/* 1文＝1行（main.js の showTip が、文ごとに span で出す） */
.load-tip span { display: block; }

/* =========================================================
   タイトル
   ========================================================= */
.title-bg {
  position: absolute; inset: 0; overflow: hidden;
  background-size: cover; background-position: center top;
}
.title-bg .pk-svg { width: 100%; height: 100%; display: block; }
.title-bg.art .pk-svg { display: none; }
/* 絵の下半分は何もない地面なので、絵ごと下へずらす。
   上にできたすき間は、絵のいちばん上の空の色でうめて、つなぎ目をぼかす */
.title-bg.art { background-position: center 18vh; background-color: #9db2c7; }
.title-bg.art::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0;
  height: calc(18vh + 36px);
  background: linear-gradient(180deg, #9db2c7 0%, #9db2c7 calc(100% - 36px), rgba(157,178,199,0) 100%);
}
.title-bg::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,244,220,0) 0%, rgba(255,244,220,0) 68%, rgba(255,244,220,.6) 86%, #fff4dc 100%);
}
/* タイトルのミュートボタン（右上） */
.btn-mute {
  position: absolute; z-index: 3;
  top: calc(12px + var(--safe-t)); right: 12px;
  width: 52px; height: 52px; padding: 0;
  display: grid; place-items: center;
}
.btn-mute .mute-off { display: none; }
.btn-mute.off .mute-on { display: none; }
.btn-mute.off .mute-off { display: inline; }
.btn-mute.off { filter: saturate(.3); }
.title-inner {
  position: relative; z-index: 1;
  flex: 1;
  /* ロゴは上下のまんなか。PRESS START とメニューは、そのすぐ下 */
  display: grid; grid-template-rows: 1fr auto 1fr; justify-items: center;
  grid-template-columns: minmax(0, 1fr);   /* ロゴの絵が広くても、列が画面より広がって右へずれないように */
  padding: calc(28px + var(--safe-t)) 0 calc(44px + var(--safe-b));
  text-align: center;
}
.logo { grid-row: 2; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.logo.drop { animation: logoDrop 1s cubic-bezier(.3,1.4,.5,1) .12s both; }
@keyframes logoDrop {
  0%   { transform: translateY(-110vh) rotate(-12deg) scale(.9); }
  60%  { transform: translateY(14px) rotate(3deg) scale(1.04); }
  80%  { transform: translateY(-6px) rotate(-1deg); }
  100% { transform: none; }
}
.logo-img { display: none; width: min(96vw, 560px); height: auto; }
.logo.art .logo-img { display: block; filter: drop-shadow(6px 6px 0 var(--k)); animation: logoBreath 3.6s ease-in-out 1.3s infinite; }
/* ロゴは、ゆっくり ふくらんだり しぼんだり */
@keyframes logoBreath { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.logo.art .logo-main { display: none; }
.logo-main {
  font-family: var(--pop); font-weight: 400;
  font-size: clamp(46px, 15vw, 84px); line-height: .98;
  color: #ffe24a;
  -webkit-text-stroke: 3px var(--k);
  text-shadow: var(--fk3), 5px 8px 0 var(--k);
  transform: rotate(-5deg);
  letter-spacing: .02em;
}
.logo-main br + * { color: #fff; }
@keyframes subPop { from { transform: rotate(-3deg) scale(0); } }

.title-foot { grid-row: 3; align-self: start; margin-top: 16px; min-height: 128px; width: 100%; padding: 0 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.press {
  background: none; border: 0; padding: 12px 24px; cursor: pointer;
  font-family: var(--en); font-size: clamp(44px, 13vw, 66px); letter-spacing: .06em; line-height: 1;
  color: #ffe24a;
  text-shadow: var(--fk3), 5px 7px 0 var(--k);
  transform: rotate(-3deg);
  animation: pressBlink 1.3s ease-in-out infinite;
  touch-action: manipulation;
}
@keyframes pressBlink { 0%, 55%, 100% { opacity: 1; } 75% { opacity: .15; } }
.press.hit { animation: pressHit .08s steps(2) 8; color: #fff; }
@keyframes pressHit { 50% { opacity: 0; } }
.title-menu { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.title-menu.pop .btn { animation: menuIn .45s cubic-bezier(.2,1.4,.4,1) both; }
.title-menu.pop .btn:nth-child(2) { animation-delay: .08s; }
@keyframes menuIn { from { transform: translateY(40px) scale(.6); opacity: 0; } }
.title-note {
  position: absolute; left: 0; right: 0; bottom: calc(16px + var(--safe-b));
  margin: 0; min-height: 16px;
  font-size: 12px; font-weight: 900; color: var(--ink);
}

/* =========================================================
   キャラクター選択（えらぶだけ。スキルはプロフィールで見る）
   ========================================================= */
.char-scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y;
  position: relative; z-index: 1;
  display: flex;
}
.char-wrap { margin: auto; width: 100%; max-width: 620px; padding: max(64px, 11vh) 14px 20px; }
.char-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.char-note {
  margin: 20px 0 0; text-align: center;
  font-size: 12px; font-weight: 900; color: var(--ink);
}
.char-card {
  position: relative;
  display: block; aspect-ratio: 5 / 11; padding: 0;
  max-height: calc(100vh - 230px); margin: 0 auto; width: 100%;
  background-color: var(--accent);
  background-image:
    repeating-conic-gradient(from 0deg at 50% 38%, rgba(255,255,255,.38) 0deg 9deg, rgba(255,255,255,0) 9deg 18deg),
    var(--tone-w),
    linear-gradient(180deg, rgba(255,255,255,.3) 0%, rgba(0,0,0,.1) 100%);
  background-size: 100% 100%, 7px 7px, 100% 100%;
  border: 5px solid var(--k); border-radius: 20px;
  box-shadow: 6px 6px 0 var(--k);
  cursor: pointer; font-family: var(--font);
  opacity: .7; transform: scale(.94);
  transition: opacity .15s, transform .2s cubic-bezier(.2,1.4,.4,1), box-shadow .2s;
  touch-action: manipulation;
}
.char-card.on { opacity: 1; transform: translateY(-8px) scale(1.03) rotate(-1.5deg); box-shadow: 8px 12px 0 var(--k); }
/* 絵は札の高さに合わせて大きく。はばは札からはみ出したぶん切れる */
/* 絵の入れもの。左右は札のはばで切り、上は札の外まであけておく（頭が枠からとび出す） */
.char-art {
  position: absolute; left: -10%; right: -10%; top: -30%; bottom: 34px;
  pointer-events: none;
  /* 頭のあたり（上46%）は札より左右に少し広く、体は札のはばで切る。
     入れものは左右に10%ずつ広げてあるので、札のふちは 8.33% / 91.67% */
  clip-path: polygon(0 0, 100% 0, 100% 46%, 91.67% 52%, 91.67% 100%, 8.33% 100%, 8.33% 52%, 0 46%);
}
/* 絵の高さ ＝（札の高さ − 下の帯）× 1.2。入れものの高さから逆算している */
.char-pose {
  position: absolute; left: 50%; bottom: 0;
  height: calc(92.3% - 9px); width: auto; max-width: none;
  transform: translateX(-50%);
  filter: drop-shadow(0 4px 0 rgba(17,17,17,.25));
}
/* シーアルは頭（吹き出し）が横に長く、札のはばで顔が切れるので、ひとまわり小さく */
.char-card[data-char="gepicrm"] .char-pose { height: calc((92.3% - 9px) * .84); }
.char-info {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  padding: 5px 2px 7px;
  background: var(--accent2); border-top: 4px solid var(--k);
  border-radius: 0 0 15px 15px;
}
.char-name {
  margin-top: 0;
  font-family: var(--pop); font-weight: 400; font-size: clamp(17px, 5vw, 24px); line-height: 1.1;
  color: #fff; text-shadow: var(--fk3), 0 4px 0 var(--k);
  white-space: nowrap;
}
.char-type {
  display: inline-block; margin-top: 4px;
  font-family: var(--pop); font-size: 11px; line-height: 1.3; white-space: nowrap;
  color: var(--k); background: #fff;
  border: 3px solid var(--k); border-radius: 999px;
  padding: 1px 10px 2px;
}
.char-check {
  position: absolute; top: -12px; right: -10px; z-index: 3;
  width: 34px; height: 34px; border-radius: 50%;
  background: #ffc21a; border: 4px solid var(--k);
  display: grid; place-items: center;
  opacity: 0; transform: scale(.4); transition: .18s cubic-bezier(.2,1.6,.4,1);
}
.char-card.on .char-check { opacity: 1; transform: scale(1); }

.skill-ic {
  flex: 0 0 auto; display: block;
  border-radius: 12px; background-color: #fff;
  border: 3px solid var(--k);
  background-repeat: no-repeat;
}
.skill-from { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 10px; }
.skill-from span { font-size: 11px; color: var(--sub); margin-left: 3px; font-weight: 900; }
.pdot { width: 24px; height: 24px; background-size: contain; background-repeat: no-repeat; display: block; }

/* プロフィールのモーダル */
.prof-head {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 14px 16px; margin: -20px -18px 14px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  border-bottom: 5px solid var(--k);
  border-radius: 17px 17px 0 0;
  text-align: left;
}
.prof-head > div:last-child {
  flex: 0 1 auto; min-width: 0;
  display: flex; flex-direction: column; align-items: flex-start;
}
/* 名前の左の顔 */
.prof-face {
  width: 76px; height: 76px; flex: 0 0 auto; padding: 11px;
  background: #fff; border: 4px solid var(--k); border-radius: 50%;
  box-shadow: 3px 3px 0 var(--k); object-fit: contain;
}
.prof-head .char-type { margin: 0 0 6px; font-size: 15px; padding: 2px 14px 3px; }
.prof-head b {
  font-family: var(--pop); font-weight: 400; font-size: clamp(34px, 11vw, 44px); line-height: 1.05; display: block;
  color: #fff; text-shadow: var(--fk3), 0 4px 0 var(--k);
}
.prof-label {
  margin: 0 0 8px;
  font-family: var(--pop); font-size: 16px; letter-spacing: .08em;
  color: #fff; text-shadow: var(--fk2), 0 3px 0 var(--k);
}
.prof-skills { display: flex; justify-content: center; gap: 16px; }
.sk-btn {
  width: 76px; height: 76px; padding: 0;
  background-color: #fff;
  border: 4px solid var(--k); border-radius: 18px;
  box-shadow: 0 6px 0 var(--k), inset 0 0 0 3px var(--accent);
  cursor: pointer;
  transition: transform .07s, box-shadow .07s;
  touch-action: manipulation;
}
.sk-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--k), inset 0 0 0 3px var(--accent); }
.prof-hint { margin: 12px 0 0; font-size: 11px; font-weight: 900; color: var(--sub); }

/* スキルの説明ポップアップ */
.sk-pop {
  position: fixed; inset: 0; z-index: 65;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(17,17,17,.45);
}
.pop-card {
  width: min(86vw, 330px);
  display: flex; flex-direction: column; align-items: center;
  background-color: #fff;
  background-image: var(--tone);
  background-size: 9px 9px;
  border: 5px solid var(--k); border-radius: 20px;
  border-top: 12px solid var(--accent, var(--gold));
  box-shadow: 8px 8px 0 var(--k);
  padding: 16px 18px 20px;
  text-align: center;
}
.sk-pop.show .pop-card { animation: popIn .36s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes popIn { from { transform: scale(.5) rotate(-4deg); opacity: 0; } }
.pop-ic { margin-top: -44px; box-shadow: 0 4px 0 var(--k); }
.pop-title {
  margin: 10px 0 6px;
  font-family: var(--pop); font-weight: 400; font-size: 22px; line-height: 1.2;
  color: #ffe24a; text-shadow: var(--fk3), 3px 4px 0 var(--k);
}
.pop-desc { margin: 0; font-size: 14px; line-height: 1.7; font-weight: 800; color: var(--ink); }
.pop-desc b { color: var(--red); }
/* ホームのハート・星の説明で使う、記号だけのアイコン */
.info-ic {
  width: 64px; height: 64px;
  display: grid; place-items: center;
  font-size: 38px; font-style: normal; line-height: 1;
  text-shadow: var(--fk2);
}
.counters .cnt { cursor: pointer; touch-action: manipulation; }
.counters .cnt:active { transform: translateY(2px); }
.pop-card .btn { margin-top: 16px; min-width: 160px; }

/* =========================================================
   遊園地ホーム
   ========================================================= */
.park-bar { gap: 8px; }
.park-title { font-size: 17px !important; }
.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%, #bfe9ff 34%, #a9d97a 78%, #7bb44a 100%);
}
.park-wrap .amb { z-index: 2; }
/* 縦長の画面では、マップの絵が下にそろって上があく。
   そこは同じ絵を画面いっぱいに広げてぼかしたもので うめる */
.park-wrap::before {
  content: ''; position: absolute; inset: -24px; z-index: 0;
  background: url('../assets/park-map.webp') center top / cover no-repeat;
  filter: blur(9px) saturate(1.15) brightness(.97);
}
.pk-svg { width: 100%; height: 100%; display: block; position: relative; z-index: 1; }
/* ぜんぶクリアしたら、マップの上に Thank you for Playing */
.park-thanks {
  position: absolute; left: 0; right: 0; top: 10px; z-index: 3; margin: 0;
  text-align: center; pointer-events: none;
  font-family: var(--en); font-size: clamp(30px, 9.5vw, 46px); letter-spacing: .04em; line-height: 1;
  color: #ffe24a; text-shadow: var(--fk3), 4px 6px 0 var(--k);
  transform: rotate(-4deg);
  animation: thanksBob 2.4s ease-in-out infinite;
}
@keyframes thanksBob { 50% { transform: rotate(-4deg) translateY(-5px) scale(1.03); } }

/* ぜんぶクリアしたときの1枚画面 */
.ending {
  position: fixed; inset: 0; z-index: 85;
  background: var(--k); cursor: pointer;
  animation: endingIn .7s ease both;
}
.ending.out { animation: endingOut .42s ease both; }
@keyframes endingIn { from { opacity: 0; } }
@keyframes endingOut { to { opacity: 0; } }
.ending-art {
  position: absolute; inset: 0;
  background: url('../assets/title-bg.webp') center 30% / cover no-repeat;   /* 絵ができるまでの代わり */
  animation: endingZoom 8s ease-out both;
}
.ending-art.art { background-image: url('../assets/ending.webp'); background-position: center top; }
@keyframes endingZoom { from { transform: scale(1.08); } }
.ending-text {
  position: absolute; left: 0; right: 0; bottom: calc(40px + var(--safe-b));
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
}
.ending-text p { margin: 0; }
.ending-title {
  font-family: var(--en); font-size: clamp(56px, 18vw, 96px); line-height: .95; letter-spacing: .03em;
  color: #ffe24a; text-shadow: var(--fk3), 5px 8px 0 var(--k);
  transform: rotate(-5deg);
  animation: endingPop .7s cubic-bezier(.2,1.5,.4,1) .35s both;
}
@keyframes endingPop { from { transform: rotate(-5deg) scale(.2); opacity: 0; } }
.ending-sub {
  font-family: var(--pop); font-size: 16px; color: #fff; text-shadow: var(--fk2), 0 3px 0 var(--k);
  animation: endingIn .5s ease .9s both;
}
.ending-tap {
  margin-top: 10px !important;
  font-family: var(--en); font-size: 22px; letter-spacing: .12em; color: #fff; text-shadow: var(--fk2);
  animation: pressBlink 1.3s ease-in-out 1.2s infinite both;
}

.pk-attr { cursor: pointer; }
.pk-attr .pk-hit { pointer-events: all; }
.pk-attr:active { filter: brightness(1.12); }
.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-art { transform-box: fill-box; transform-origin: 50% 100%; }
.pk-art.done { animation: pkAlive 2.8s ease-in-out infinite; }
@keyframes pkAlive {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.035) translateY(-1px); }
}
.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); } }

/* ---------- 下のアイコンメニュー ---------- */
.navbar {
  position: relative; z-index: 3;
  flex: 0 0 auto;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  padding: 8px max(8px, calc((100% - 560px) / 2)) calc(8px + var(--safe-b));
  background-color: #fff;
  background-image: var(--tone);
  background-size: 8px 8px;
  border-top: 5px solid var(--k);
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: 0; padding: 0; cursor: pointer;
  touch-action: manipulation;
}
.nav-ic {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  background-color: var(--c);
  background-image: var(--tone-w);
  background-size: 6px 6px;
  border: 4px solid var(--k); border-radius: 16px;
  box-shadow: 0 5px 0 var(--k);
  transition: transform .07s, box-shadow .07s;
}
.nav-ic svg { width: 30px; height: 30px; }
.nav-btn b {
  font-family: var(--pop); font-weight: 400; font-size: 11px; white-space: nowrap;
  color: #fff; text-shadow: var(--fk2);
}
.nav-btn:active .nav-ic { transform: translateY(5px); box-shadow: 0 0 0 var(--k); }
.nav-play .nav-ic {
  width: 74px; height: 74px; border-radius: 50%;
  margin-top: -34px;
  border-width: 5px;
  box-shadow: 0 6px 0 var(--k);
  animation: playPulse 1.6s ease-in-out infinite;
}
.nav-play .nav-ic svg { width: 40px; height: 40px; margin-left: 4px; }
.nav-play b { font-size: 13px; }
@keyframes playPulse { 50% { transform: scale(1.08) rotate(-4deg); } }

/* =========================================================
   アトラクションのシート／ステージの札
   ========================================================= */
.atr-art {
  height: 120px; margin: -6px -4px 4px;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #cdf0ff, #e9ffe4);
  border: 4px solid var(--k); border-radius: 16px;
  box-shadow: 4px 4px 0 var(--k);
  overflow: hidden;
}
.pk-solo-svg { width: 100%; height: 100%; }
/* ステージえらびは、スマホでも1画面に収める */
.atr .mod-title { margin-bottom: 10px; }
.atr .st-list { gap: 6px; }
.atr .st-chip { padding: 7px 14px; }
.atr .mod-btns { margin-top: 12px; gap: 8px; }
.atr-sub { margin: 4px 0 10px; font-size: 12px; line-height: 1.6; color: var(--sub); font-weight: 800; }

.atr-bar {
  position: relative; height: 24px; margin: 0 0 12px;
  background: #efe6f5; border: 4px solid var(--k); 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 .5s cubic-bezier(.2,.9,.3,1);
}
.atr-bar em {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-style: normal; font-family: var(--pop); font-size: 11px; letter-spacing: .06em;
  color: #fff; text-shadow: var(--fk2);
}

.st-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.st-chip {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 14px;
  background: var(--paper);
  border: 4px solid var(--k); border-radius: 14px;
  box-shadow: 0 5px 0 var(--k);
  font-family: var(--font); cursor: pointer; text-align: left;
  transition: transform .07s, box-shadow .07s;
}
.st-chip:active { transform: translateY(5px); box-shadow: 0 0 0 var(--k); }
.st-chip b { font-family: var(--pop); font-weight: 400; font-size: 15px; flex: 0 0 auto; color: #fff; text-shadow: var(--fk2); }
.st-chip span { flex: 1; font-size: 12px; font-weight: 900; color: var(--sub); }
.st-chip i { font-style: normal; font-size: 15px; color: #ffc21a; letter-spacing: -1px; text-shadow: var(--fk2); }
.st-chip.done { background: #fff4c7; }
.st-chip.next { background: linear-gradient(180deg, #ffe066, #ffc21a); animation: nextpulse 1.4s ease-in-out infinite; }
.st-chip.next span { color: var(--ink); }
@keyframes nextpulse { 50% { transform: translateY(-3px) rotate(-.6deg); box-shadow: 0 8px 0 var(--k); } }
.st-chip.locked { background: #d8d5dc; filter: grayscale(1); opacity: .7; cursor: default; }
.st-chip.locked b, .st-chip.locked i { color: #eee; }
.st-chip.locked:active { transform: none; box-shadow: 0 5px 0 var(--k); }

.res-build {
  height: 120px; margin: 6px 0 10px;
  background: linear-gradient(180deg, #cdf0ff, #e9ffe4);
  border: 4px solid var(--k); border-radius: 14px; overflow: hidden;
  box-shadow: 4px 4px 0 var(--k);
}

/* =========================================================
   ゲーム
   ========================================================= */
#scr-game { background: linear-gradient(180deg, #fff4dc 0%, #ffe9f3 55%, #e3f3ff 100%); }
#scr-game::before { content: none; }

.hud {
  position: relative; z-index: 2;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 5px 8px;
  padding: calc(8px + var(--safe-t)) 10px 8px;
  background: linear-gradient(180deg, #ffe066, #ffbd1f);
  border-bottom: 5px solid var(--k);
  box-shadow: 0 5px 0 rgba(17,17,17,.28);
}
.hud-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; background-size: cover; background-position: center; }
/* 網点は ゆっくり ななめに流れつづける（止まって見えないように）。
   動かすのは transform だけ。網目1つぶん（7px）で1周するので、つなぎ目は見えない */
.hud-bg::after {
  content: ''; position: absolute; inset: -8px;
  background-image: var(--tone-w);
  background-size: 7px 7px;
  animation: toneDrift 9s linear infinite;
  will-change: transform;
}
@keyframes toneDrift { to { transform: translate3d(7px, 7px, 0); } }
.hud > *:not(.hud-bg):not(.bar-fx):not(.hud-skyline) { position: relative; z-index: 1; }

/* 上の帯を、遊園地のシルエットが ゆっくり横に流れる。
   絵は横につながる1枚（assets/hud-skyline.webp）。2枚ぶんの幅を用意して、
   ちょうど1枚ぶんずらすと つなぎ目が見えない。動かすのは transform だけ */
.hud-skyline {
  position: absolute; left: 0; bottom: 0; z-index: 0;
  width: 200%; height: 100%;
  background-repeat: repeat-x;
  background-position: left bottom;
  background-size: auto 100%;
  opacity: .5;
  pointer-events: none;
  display: none;
  animation: skylineFlow 46s linear infinite;
  will-change: transform;
}
.hud-skyline.art { display: block; }
@keyframes skylineFlow { to { transform: translate3d(-50%, 0, 0); } }

/* ---------- 上下の帯の中の演出（星がときどき降る・枠線がたまに光る） ----------
   帯の中だけで動かす。盤のうしろだと、盤にかくれて見えないため */
.bar-fx { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bstar {
  position: absolute; left: var(--x); top: -16px;
  width: 14px; height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M20 2l5 12 13 1-10 8 4 13-12-7-12 7 4-13L2 15l13-1z' fill='%23fff8c9' stroke='%23111' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  opacity: 0;
  animation: barStar var(--d) linear var(--delay) infinite;
  will-change: transform, opacity;
}
/* ななめに流れて、帯の下へぬけていく。流れるのは はじめの 14% だけ（＝2秒に1つくらい）*/
@keyframes barStar {
  0%   { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg); }
  2%   { opacity: .95; }
  11%  { opacity: .95; }
  14%  { opacity: 0; transform: translate3d(120px, 130px, 0) rotate(200deg); }
  100% { opacity: 0; transform: translate3d(120px, 130px, 0) rotate(200deg); }
}
/* 帯のふちを、明るいところが はしから はしへ すべっていく（点滅はしない） */
.hud::after, .skill-bar::after {
  content: ''; position: absolute; left: 0; width: 32%; height: 5px;
  z-index: 3; pointer-events: none;
  background: linear-gradient(90deg,
    rgba(255, 247, 194, 0), rgba(255, 247, 194, .85) 38%, #ffffff 50%, rgba(255, 247, 194, .85) 62%, rgba(255, 247, 194, 0));
  animation: edgeSweep 3.2s linear infinite;
  will-change: transform;
}
.hud::after { bottom: -5px; }
.skill-bar::after { top: -5px; animation-delay: -1.6s; }   /* 上下で ずらす */
@keyframes edgeSweep {
  0%       { transform: translate3d(-110%, 0, 0); }
  55%      { transform: translate3d(325%, 0, 0); }
  56%, 100% { transform: translate3d(325%, 0, 0); }
}

.btn-pause {
  grid-column: 1; grid-row: 1 / 3;
  width: 44px; height: 44px; min-height: 44px;
  font-family: var(--font); font-size: 14px; letter-spacing: -2px;
  --bg: var(--purple);
}

.hud-stage {
  grid-column: 2; grid-row: 1;
  justify-self: start;
  font-family: var(--pop); font-size: 13px; letter-spacing: .04em; line-height: 1.2;
  color: #fff; text-shadow: var(--fk2);
  background: var(--red);
  border: 3px solid var(--k); border-radius: 999px;
  padding: 2px 12px 3px;
  box-shadow: 0 3px 0 var(--k);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}

/* ノルマは下の段を右はしまで使う（数がふえても1段に収まるように）。スコアは上の段のステージ名の横へ */
.hud-goals {
  grid-column: 2 / 4; grid-row: 2;
  display: flex; flex-wrap: nowrap; align-items: center; gap: 5px;
  min-width: 0; height: 46px;
}
/* 見出し。ノルマがふえても折りかえさず、せまい画面では少し小さくなる */
.hud-goal-label {
  flex: 0 0 auto; white-space: nowrap;
  font-family: var(--pop); font-weight: 400;
  font-size: clamp(8px, 2.5vw, 11px); line-height: 1.15; letter-spacing: .02em;
  /* 後ろのシルエットに重なっても読めるよう、白ぬきに黒フチ */
  color: #fff; text-shadow: var(--fk2);
}
.hud-missions { display: flex; flex-wrap: nowrap; gap: 6px; min-width: 0; height: 100%; align-items: center; }

.hud-moves {
  grid-column: 3; grid-row: 1;
  text-align: center;
  background: #fff; border: 4px solid var(--k); border-radius: 14px;
  box-shadow: 3px 3px 0 var(--k);
  padding: 1px 8px 2px;
}
.hud-label { display: block; font-size: 9px; color: var(--ink); letter-spacing: .02em; white-space: nowrap; font-weight: 900; }
.hud-moves b { font-family: var(--pop); font-weight: 400; font-size: 26px; line-height: 1; color: #fff; text-shadow: var(--fk2), 0 3px 0 var(--k); }
.hud-moves.low { background: #ffe0e6; }
.hud-moves.low b { color: var(--red); animation: blink .7s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }

.hud-score { grid-column: 2; grid-row: 1; justify-self: end; margin-right: 8px; display: flex; align-items: baseline; justify-content: center; gap: 4px; white-space: nowrap; }
.hud-score i { font-style: normal; font-family: var(--en); font-size: 13px; letter-spacing: .06em; color: #fff; text-shadow: var(--fk2); }
.hud-score b { font-family: var(--pop); font-weight: 400; font-size: 15px; color: var(--ink); }

/* ---------- ミッションのチップ ---------- */
/* クリアノルマは、ひと目でわかるように大きめに */
.mchip {
  flex: 0 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 5px;
  background: var(--paper);
  border: 4px solid var(--k);
  border-radius: 999px; padding: 2px 12px 2px 3px;
  box-shadow: 0 4px 0 var(--k);
}
.mchip.done { background: #c9f7de; }
.mchip.done::after { content: '✓'; color: #0f9d5a; font-weight: 900; font-size: 18px; }
.mchip b { font-family: var(--pop); font-weight: 400; font-size: 22px; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
/* せまい画面（iPhone SE など）では、ノルマを少し小さくして1行に収める */
@media (max-width: 400px) {
  .mchip { padding: 2px 9px 2px 3px; gap: 4px; }
  .mchip b { font-size: 18px; }
  .mchip .mmax { font-size: 12px; }
  .mchip .gicon { width: 28px; height: 28px; }
  .mchip.done::after { font-size: 15px; }
}
.mchip .mmax { font-size: 14px; color: var(--sub); font-weight: 900; }
.gicon { width: 22px; height: 22px; display: block; background-size: contain; background-repeat: no-repeat; background-position: center; }
.gicon-score { font-style: normal; color: #ffc21a; font-size: 16px; text-align: center; line-height: 22px; text-shadow: var(--fk2); }
.mchip .gicon { width: 34px; height: 34px; }
.gicon-score svg { width: 100%; height: 100%; display: block; }

.board-wrap { position: relative; flex: 1 1 auto; min-height: 0; z-index: 1; contain: layout paint; overflow: hidden; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; transform: translateZ(0); z-index: 1; }
.board-wrap .amb { z-index: 0; }
.board-bg { position: absolute; inset: 0; z-index: 0; background-size: cover; background-position: center; }
.board-bg::after { content: ''; position: absolute; inset: 0; background: rgba(255, 250, 240, .22); }
/* 盤のまわりが ときどき ぼんやり光る。動かすのは濃さ（opacity）だけなので軽い */
.board-glow {
  position: absolute; z-index: 2; pointer-events: none;
  box-shadow: 0 0 22px 7px rgba(255, 216, 58, .75), 0 0 8px 2px rgba(255, 255, 255, .6);
  opacity: 0;
  animation: boardGlow 5.5s ease-in-out infinite;
  will-change: opacity;
}
@keyframes boardGlow { 0%, 72%, 100% { opacity: 0; } 84% { opacity: .85; } }

/* コンボの表記は、盤の下のほう（スキルとの間）に出す。まんなかに出すと、消えたコマが見えなくなるため */
.combo-pop {
  position: absolute; inset: auto 0 auto 0; bottom: 2%;
  z-index: 3; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 0;
  opacity: 0;
}
/* ギザギザの台は5連鎖から（.burst）。段階が上がるほど大きく */
.combo-pop::before {
  content: ''; position: absolute; left: 50%; top: 50%; z-index: -1;
  width: var(--burst-w, 300px); height: calc(var(--burst-w, 300px) * .67);
  transform: translate(-50%, -50%) rotate(-6deg);
  background: url(../assets/fx/fx-combo.webp) center/contain no-repeat;
  display: none;
}
.combo-pop.burst::before { display: block; opacity: .82; }
.combo-pop.show { animation: combo 1.05s cubic-bezier(.3,.8,.4,1) both; }
/* ピョンと上にはねて、小さくなりながら落ちて消える */
@keyframes combo {
  0%   { opacity: 0; transform: translateY(10px) scale(.35) rotate(-12deg); }
  16%  { opacity: 1; transform: translateY(-40px) scale(1.2) rotate(6deg); }
  30%  { transform: translateY(-52px) scale(1.04) rotate(-3deg); }
  46%  { transform: translateY(-30px) scale(.95) rotate(2deg); }
  60%  { transform: translateY(-38px) scale(.88) rotate(-1deg); }
  78%  { opacity: 1; transform: translateY(2px) scale(.74); }
  100% { opacity: 0; transform: translateY(52px) scale(.5); }
}
.combo-pop b {
  font-family: var(--pop); font-weight: 400; font-size: var(--num, 52px); line-height: .95;
  color: var(--num-c, #fff);
  -webkit-text-stroke: 3px var(--k);
  text-shadow: var(--fk3), 4px 7px 0 var(--k);
}
.combo-pop b i { font-style: normal; font-size: .44em; }
.combo-pop span {
  font-family: var(--pop); font-size: var(--word, 20px);
  color: var(--red);
  text-shadow: var(--fk3), 0 4px 0 var(--k);
}
/* 段階：2連鎖（とコンボ）→ 3 → 4 → 5 → 6連鎖以上 */
.combo-pop.lv1 { --num: 52px; --num-c: #fff;    --word: 20px; }
.combo-pop.lv2 { --num: 64px; --num-c: #ffe24a; --word: 22px; --burst-w: 300px; }
.combo-pop.lv3 { --num: 76px; --num-c: #ff9a20; --word: 24px; --burst-w: 350px; }
.combo-pop.lv4 { --num: 88px; --num-c: #ff5fae; --word: 26px; --burst-w: 320px; }
.combo-pop.lv5 { --num: 100px; --word: 28px; --burst-w: 360px; }
.combo-pop.lv5 b { animation: comboRainbow .45s steps(1) infinite, comboShake .12s linear infinite; }
@keyframes comboRainbow {
  0% { color: #ffe24a; } 25% { color: #ff5fae; } 50% { color: #4bdcff; } 75% { color: #7dff6a; }
}
@keyframes comboShake {
  0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-2px, 1px); } 75% { transform: translate(2px, -1px); }
}

/* ---------- スキルバー ---------- */
.skill-bar {
  position: relative; z-index: 2;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  gap: 0 8px;
  padding: 8px 10px calc(8px + var(--safe-b));
  background-color: #fff;
  border-top: 5px solid var(--k);
}
/* 下の帯の網点も同じように流す。はみ出しは clip-path で帯の中に切る
   （あいぼうは帯の外にはみ出して見せたいので、overflow: hidden は使えない） */
.skill-bar::before {
  content: ''; position: absolute; inset: -10px; z-index: 0; pointer-events: none;
  background-image: var(--tone);
  background-size: 8px 8px;
  clip-path: inset(10px);
  animation: toneDrift2 11s linear infinite;
  will-change: transform;
}
@keyframes toneDrift2 { to { transform: translate3d(8px, 8px, 0); } }
.skill-bar > * { position: relative; z-index: 1; }
.skill-bar > .bar-fx { position: absolute; z-index: 0; }
/* あいぼうの ふきだしは いちばん前（すぐ消えるので、盤やゲージに重なってよい） */
.buddy { z-index: 4; }
.skill-bar.flash { animation: barflash .6s ease; }
@keyframes barflash { 30% { background-color: #fff0a8; } }

/* ---------- 左下のあいぼう（スプライト） ---------- */
.buddy { grid-column: 1; grid-row: 1; position: relative; width: 100px; align-self: stretch; cursor: pointer; touch-action: manipulation; }
/* 左右反転（盤のほうを向く）。反転は transform の中で、ずらしのあとに書く。
   別の scale プロパティにすると、ずらしの向きまで反転して右へずれてしまう */
.buddy-spr { position: absolute; left: 50%; bottom: -8px; width: 118px; transform: translateX(-50%) scaleX(-1); }
/* 顔だけの絵のとき（正方形）。帯の上のふちから 少しはみ出す大きさにする。
   反転は transform の中で、ずらしのあとに書く（別の scale にすると ずれの向きまで変わる） */
.buddy.face .buddy-spr { aspect-ratio: 1 / 1; width: 116px; bottom: 2px; transform: translateX(-50%) scaleX(-1); }
/* よこ長のコミカルな ふきだし。しっぽは 左下へ ななめに出す */
.buddy-say {
  position: absolute; left: 78px; bottom: 86px; z-index: 3;
  padding: 7px 15px 8px;
  width: max-content;                      /* 入れものが細いので、中身の幅で ふくらませる */
  max-width: min(240px, calc(100vw - 110px));
  background: #fff; border: 4px solid var(--k); border-radius: 18px;
  font-family: var(--pop); font-size: 14px; line-height: 1.15;
  word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance;
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--k);
  opacity: 0; transform: scale(.4) translateY(8px);
  transform-origin: 10% 100%;
  transition: opacity .12s, transform .18s cubic-bezier(.2,1.6,.4,1);
}
/* しっぽは 白いふちどり(2px)で ぐるっと囲んだ黒い三角。ふきだしの黒線より前に出して、
   三角が上に のっているように見せる */
.buddy-say::after {
  content: ''; position: absolute; left: 8px; bottom: -22px; z-index: 2;
  width: 30px; height: 30px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path d='M26 4 L13 4 L3 25 Z' fill='%23111111' stroke='%23ffffff' stroke-width='4' stroke-linejoin='round' paint-order='stroke'/></svg>");
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.buddy-say.on { opacity: 1; transform: scale(1) translateY(0); }
.buddy-say { pointer-events: none; }
/* タップすると説明が出るところ */
.mchip, #skill-bar .gauge, #scr-game .hud-moves { cursor: pointer; touch-action: manipulation; }
.mchip:active, #skill-bar .gauge:active, #scr-game .hud-moves:active { transform: translateY(2px); }
.info-ic .gicon { width: 46px; height: 46px; }
/* スキルゲージの説明：コマ2つ ▶ スキル */
.gpairs { display: flex; flex-direction: column; gap: 6px; width: fit-content; margin: 10px auto; text-align: left; }
.gpair { display: flex; align-items: center; gap: 3px; }
.gpair .pdot { width: 30px; height: 30px; }
.gpair em { font-style: normal; font-size: 12px; color: var(--sub); margin: 0 4px; }
.gpair-sk { display: block; flex: 0 0 auto; background-repeat: no-repeat; background-color: #fff; border-radius: 8px; box-shadow: 0 0 0 2px var(--k); }
.pop-desc .gpair b { margin-left: 7px; font-size: 13px; color: var(--ink); line-height: 1.25; }
.pop-desc .gpair b small { display: block; font-size: 11px; font-weight: 400; color: var(--sub); }

/* ゲージ満タンのハート */
.heart-pop {
  position: absolute; right: 18%; bottom: 58%; z-index: 5;
  width: 130px; aspect-ratio: 1;
  background-repeat: no-repeat;
  pointer-events: none;
}

/* ---------- ゲージとスキル ---------- */
.skill-right { grid-column: 2; grid-row: 1; width: 100%; max-width: 260px; margin-left: auto; }
/* 「スキルゲージ」の文字はバーの外（左）。バーは残りのはばいっぱい。
   1行に収まるよう、文字は折りかえさず、画面が小さいときは少し小さくする */
.gauge-row {
  display: flex; align-items: center; flex-wrap: nowrap; gap: 6px;
  margin-bottom: 8px;
  cursor: pointer; touch-action: manipulation;
}
.gauge-cap {
  flex: 0 0 auto; white-space: nowrap;
  font-family: var(--pop); font-weight: 400;
  font-size: clamp(9px, 3vw, 12px); line-height: 1; letter-spacing: .02em;
  color: var(--ink);
}
.gauge-row.full .gauge-cap { color: var(--red); }
.gauge {
  position: relative; flex: 1 1 auto; min-width: 0;
  height: 22px; border-radius: 999px;
  background: #efe6f5;
  border: 4px solid var(--k);
  overflow: hidden;
  box-shadow: 0 3px 0 var(--k);
}
.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: repeating-linear-gradient(-45deg, rgba(255,255,255,.35) 0 7px, transparent 7px 14px);
}

.skill-slots { display: flex; gap: 6px; justify-content: flex-end; }
.slot {
  flex: 1 1 0; min-width: 0; max-width: 82px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 4px 6px;
  border-radius: 16px;
  border: 4px solid var(--k);
  background: #f1ebe0;
  cursor: pointer; font-family: var(--font);
  box-shadow: 0 5px 0 var(--k);
  transition: transform .07s, box-shadow .07s;
}
.slot:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--k); }
.slot[disabled] { opacity: .6; cursor: default; }
.slot[disabled]:active { transform: none; box-shadow: 0 5px 0 var(--k); }
/* あきのスロット。「スキル／スロット1」と2行で出す（タップすると説明） */
.slot.empty { background: #efe9e0; }
.slot.empty .slot-name { font-size: 9px; line-height: 1.1; color: var(--sub); text-shadow: none; }
/* 2行になるぶん、あきの四角は少し小さく（帯の高さ＝盤の大きさを変えないため） */
.slot.empty .slot-ic.empty { width: 36px; height: 36px; }
.slot.ready {
  background: linear-gradient(180deg, #fff7d1, #ffc93d);
  box-shadow: 0 5px 0 var(--k);
  animation: slotReady 1.2s ease-in-out infinite;
}
@keyframes slotReady { 50% { transform: translateY(-3px) rotate(-2deg); } }
.slot.aiming { animation: aim .5s ease-in-out infinite; background: linear-gradient(180deg, #ffe0e6, #ff7a93); }
@keyframes aim { 50% { transform: translateY(-4px) scale(1.04); } }
.slot-ic { display: block; background-repeat: no-repeat; border-radius: 10px; }
.slot-ic.empty {
  width: 44px; height: 44px;
  border: 3px dashed rgba(17,17,17,.3);
  background: repeating-linear-gradient(45deg, rgba(17,17,17,.06) 0 6px, transparent 6px 12px);
}
.slot-name { font-family: var(--pop); font-size: 10px; line-height: 1.25; text-align: center; color: #fff; text-shadow: var(--fk2); white-space: nowrap; }
.slot[disabled] .slot-name { color: #d7d0dd; }
.slot.wide { flex: 2 1 0; }

/* ヒントは1行・高さ固定。折りかえすと下の帯が伸びて、盤が縮んでコマが動いてしまう */
.skill-hint {
  grid-column: 1 / 3; grid-row: 2;
  margin: 6px 0 0; height: 18px; line-height: 18px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: center; font-size: 12px; font-weight: 900; color: var(--gold-ink);
}
.skill-hint b { color: var(--red); }

/* ---------- カットイン ---------- */
.cutin { position: absolute; inset: 0; z-index: 30; display: none; overflow: hidden; }
.cutin.show { display: block; }
.cutin::before {
  content: ''; position: absolute; inset: 0;
  background: rgba(17,17,17,.5);
  animation: cutDim .98s ease both;
}
@keyframes cutDim { 0% { opacity: 0; } 12%, 80% { opacity: 1; } 100% { opacity: 0; } }
.cutin-band {
  position: absolute; left: -12%; right: -12%; top: 50%;
  height: min(52vw, 300px); margin-top: calc(min(52vw, 300px) / -2);
  background-size: cover; background-position: center;
  border-top: 7px solid var(--k); border-bottom: 7px solid var(--k);
  transform: rotate(-8deg) scaleY(0);
  animation: cutBand .98s cubic-bezier(.2,.9,.3,1) both;
}
@keyframes cutBand {
  0%   { transform: rotate(-8deg) scaleY(0); }
  14%  { transform: rotate(-8deg) scaleY(1.12); }
  22%, 80% { transform: rotate(-8deg) scaleY(1); }
  100% { transform: rotate(-8deg) scaleY(0); }
}
.cutin-chara {
  position: absolute; left: 0; top: 50%;
  width: min(92vw, 540px); height: auto;
  filter: drop-shadow(6px 6px 0 var(--k));
  animation: cutChara .98s cubic-bezier(.2,.9,.3,1) both;
}
@keyframes cutChara {
  0%   { transform: translate(-115%, -52%) scale(.9); }
  18%  { transform: translate(-6%, -52%) scale(1.04); }
  28%  { transform: translate(-2%, -52%) scale(1); }
  78%  { transform: translate(4%, -54%) scale(1.02); opacity: 1; }
  100% { transform: translate(120%, -54%) scale(1); opacity: 0; }
}
.cutin-name {
  position: absolute; right: 5%; top: 62%; margin: 0;
  font-family: var(--pop); font-size: clamp(28px, 8.5vw, 48px); line-height: 1;
  color: #ffe24a;
  -webkit-text-stroke: 2px var(--k);
  text-shadow: var(--fk3), 5px 7px 0 var(--k);
  white-space: nowrap;
  animation: cutName .98s cubic-bezier(.2,1.2,.3,1) both;
}
@keyframes cutName {
  0%, 16% { transform: translateX(140%) rotate(-8deg) scale(1.4); opacity: 0; }
  32%  { transform: translateX(0) rotate(-8deg) scale(1); opacity: 1; }
  80%  { transform: translateX(-4%) rotate(-8deg) scale(1.04); opacity: 1; }
  100% { transform: translateX(-150%) rotate(-8deg); opacity: 0; }
}

/* =========================================================
   ものがたり（場面の絵 ＋ テキストエリア）
   ========================================================= */
#scr-story { background: #e9dcf6; }
.cm-bar { background: linear-gradient(180deg, #d3b5ff, #a45cff); }
.cm-head { flex: 1; display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.cm-head b { font-family: var(--pop); font-weight: 400; font-size: 19px; color: #fff; text-shadow: var(--fk3), 0 4px 0 var(--k); }
.cm-head small { font-size: 11px; font-weight: 900; color: #fff; text-shadow: var(--fk2); margin-top: 2px; }
.cm-foot { background: linear-gradient(180deg, #d3b5ff, #a45cff); gap: 10px; padding: 6px 10px calc(8px + var(--safe-b)); }
/* ものがたりの上下の帯とボタンは小さめ。そのぶん場面の絵を大きく */
#scr-story .cm-bar { padding: calc(6px + var(--safe-t)) 10px 7px; }
#scr-story .cm-head b { font-size: 17px; }
#btn-story-skip, #btn-story-prev { width: 40px; height: 40px; min-height: 40px; font-size: 22px; border-radius: 12px; box-shadow: 0 4px 0 var(--k); }
#story-next { min-height: 40px; padding: 6px 16px 7px; font-size: 15px; border-radius: 12px; box-shadow: 0 4px 0 var(--k); }
.cm-dots { flex: 1; display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; }
.cm-dots i { width: 11px; height: 11px; border-radius: 50%; border: 3px solid var(--k); background: #fff; }
.cm-dots i.on { background: #ffc21a; transform: scale(1.25); }

.st-stage {
  flex: 1; min-height: 0;
  width: 100%; max-width: 580px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px 10px 10px;   /* 場面の絵をいちばん大きく。まわりの余白はせまく */
  position: relative; z-index: 1;
  cursor: pointer; user-select: none; -webkit-user-select: none;
}
.st-pic { flex: 1 1 auto; min-height: 120px; container-type: size; display: grid; place-items: center; }
.st-frame {
  position: relative; overflow: hidden;
  width: min(100cqw, 100cqh); height: min(100cqw, 100cqh);
  border: 4px solid var(--k); border-radius: 8px;
  box-shadow: 6px 6px 0 var(--k);
  background: #fff;
}
.st-frame.in { animation: stIn .5s cubic-bezier(.2,1.2,.3,1) both; }
.st-frame.in-back { animation: stBack .35s ease-out both; }
@keyframes stIn { from { opacity: 0; transform: translateX(40px) rotate(3deg) scale(.94); } }
@keyframes stBack { from { opacity: 0; transform: translateX(-30px); } }
.st-img { width: 100%; height: 100%; object-fit: cover; display: block; animation: kenburns 9s ease-in-out infinite alternate; }
@keyframes kenburns { to { transform: scale(1.06) translate(-1%, -1%); } }

.st-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%); }
.st-bg-empty { background: repeating-linear-gradient(115deg, rgba(122,106,134,.16) 0 3px, transparent 3px 12px), linear-gradient(180deg, #e9e3ef 0%, #d8d2e0 100%); }
.st-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%); }
.st-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%); }
.st-cast { position: absolute; bottom: 2%; max-height: 78%; object-fit: contain; transform: translateX(-50%); pointer-events: none; }
.st-sfx {
  position: absolute; z-index: 2;
  font-family: var(--pop); font-size: clamp(28px, 9cqw, 42px); line-height: 1;
  /* 色の文字をフチの上にぬる。フチが上だと、ド・グ・パ の点や丸がつぶれて トン・クル・ハ に見える */
  -webkit-text-stroke: 2px var(--k); paint-order: stroke fill;
  text-shadow: var(--fk2), 3px 5px 0 var(--k);
  white-space: nowrap; pointer-events: none;
  transform: rotate(var(--r));
  animation: sfxPop .5s .2s cubic-bezier(.3,1.6,.5,1) both;
}
@keyframes sfxPop { from { opacity: 0; transform: rotate(var(--r)) scale(.3); } }

.st-box {
  flex: 0 0 auto; position: relative;
  /* 高さは3行ぶんで固定。行数で箱の高さが変わると、上の絵の大きさまで変わってしまう */
  min-height: 112px;
  background: #fff; border: 4px solid var(--k); border-radius: 16px;
  box-shadow: 5px 5px 0 var(--k);
  padding: 22px 14px 10px;
  margin-top: 22px;
}
.st-name {
  position: absolute; left: 10px; top: -19px;
  display: flex; align-items: center; gap: 5px;
  padding: 2px 13px 2px 2px;
  background: var(--c, var(--gold)); border: 3px solid var(--k); border-radius: 999px;
  box-shadow: 3px 3px 0 var(--k);
}
.st-name img { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 3px solid var(--k); object-fit: cover; }
.st-name b { font-family: var(--pop); font-weight: 400; font-size: 14px; color: #fff; letter-spacing: .04em; text-shadow: var(--fk2); }
.st-text { margin: 0; white-space: pre-line; font-size: 15px; font-weight: 900; line-height: 1.6; color: var(--ink); }
.st-more { position: absolute; right: 12px; bottom: 4px; font-style: normal; font-size: 12px; color: var(--red); animation: stMore .8s ease-in-out infinite; }
@keyframes stMore { 50% { transform: translateY(5px); } }
.st-box.st-narr { background: #fff3c2; padding-top: 12px; }
.st-box.st-narr .st-text { color: #5a4630; }
.st-box.st-shout .st-text { font-size: 16px; }
.st-box.st-think .st-text { color: #6a5a86; }
.st-box.shake { animation: stShake .38s ease-out; }
@keyframes stShake {
  20% { transform: translate(-6px, 2px) rotate(-1deg); } 40% { transform: translate(6px, -2px) rotate(1deg); }
  60% { transform: translate(-3px, 1px); } 80% { transform: translate(2px, 0); }
}
/* 背の低い画面（iPhone SE の Safari など）では、もう一段小さく */
@media (max-height: 620px) {
  #scr-story .cm-bar { padding-top: calc(4px + var(--safe-t)); padding-bottom: 5px; }
  #scr-story .cm-head small { display: none; }
  .cm-foot { padding-top: 5px; padding-bottom: calc(6px + var(--safe-b)); }
  #btn-story-skip, #btn-story-prev { width: 36px; height: 36px; min-height: 36px; font-size: 20px; }
  #story-next { min-height: 36px; font-size: 14px; }
  .st-stage { gap: 6px; padding: 6px 8px 8px; }
  .st-box { min-height: 96px; padding: 19px 12px 8px; margin-top: 19px; }
  .st-box.st-narr { padding-top: 9px; }
  .st-name { top: -17px; }
  .st-name img { width: 24px; height: 24px; }
  .st-name b { font-size: 13px; }
  .st-text { font-size: 14px; line-height: 1.5; }
  .st-box.st-shout .st-text { font-size: 15px; }
}

/* =========================================================
   モーダル（上からおりてくる）
   ========================================================= */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-start; justify-content: center;
  padding: calc(18px + var(--safe-t)) 14px calc(18px + var(--safe-b));
  background: rgba(17,17,17,0);
  transition: background .22s;
  overflow-y: auto; touch-action: pan-y;
}
.modal.show { background: rgba(17,17,17,.58); }
.modal-card {
  position: relative;
  width: 100%; max-width: 400px;
  margin: auto 0;
  background-color: var(--paper);
  background-image: var(--tone);
  background-size: 9px 9px;
  border: 5px solid var(--k);
  border-radius: 22px;
  box-shadow: 9px 9px 0 var(--k);
  padding: 20px 18px 20px;
  text-align: center;
}
.modal.show .modal-card { animation: menuDrop .55s cubic-bezier(.2,1.25,.4,1) both; }
/* あそびかたは、点々の模様なしの白一色 */
.modal-card.howto-card { background-color: #fff; background-image: none; }
.modal.hide .modal-card { animation: menuUp .24s ease-in both; }
@keyframes menuDrop {
  0%   { transform: translateY(-110vh) rotate(-5deg); }
  70%  { transform: translateY(10px) rotate(1deg); }
  100% { transform: none; }
}
@keyframes menuUp { to { transform: translateY(-110vh) rotate(4deg); } }

.mod-title {
  margin: 0 0 12px;
  font-family: var(--pop); font-weight: 400; font-size: 26px; line-height: 1.2;
  color: #ffe24a;
  text-shadow: var(--fk3), 4px 5px 0 var(--k);
}
.mod-sub { margin: 8px 0; font-size: 13px; color: var(--sub); line-height: 1.65; font-weight: 800; }
/* せってい画面の下のリンク（ポリシー・規約） */
.mod-links { margin: 12px 0 0; display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.mod-links a { font-size: 12px; font-weight: 800; color: var(--sub); text-decoration: underline; touch-action: manipulation; }
.mod-links a:active { color: var(--red); }
.mod-sub b { color: var(--red); }
.mod-btns { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 18px; }
.mod-btns .btn { width: 100%; max-width: 300px; }
.mod-btns.mod-row { flex-direction: row; justify-content: center; }
.mod-btns.mod-row .btn { flex: 1; max-width: 150px; }

.res-badge {
  margin: -8px -6px 0; min-height: 120px;
  display: grid; place-items: center;
  background: center / contain no-repeat;
}
/* クリアは、ギザギザの台なしで、黄色に黒フチの文字だけを大きく */
.res-badge.win .mod-title { margin: 0; color: #ffe24a; font-size: clamp(30px, 9vw, 42px); white-space: nowrap; }
.res-badge.win { min-height: 0; padding: 16px 0 8px; animation: badgePop .6s cubic-bezier(.2,1.5,.4,1) both; }
.res-badge.lose { background-image: url(../assets/fx/fx-fail.webp); padding-top: 26px; }
.res-badge .mod-title { margin: 0; color: #fff; font-size: 30px; transform: rotate(-4deg); }
@keyframes badgePop { from { transform: scale(0) rotate(-30deg); } }
.res-stars { display: flex; justify-content: center; gap: 8px; margin: 4px 0; }
.res-stars i { font-style: normal; font-size: 46px; line-height: 1; color: #ddd3e4; text-shadow: var(--fk2); }
.res-stars i.on { color: #ffc21a; text-shadow: var(--fk3), 0 5px 0 var(--k); animation: star .55s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes star { from { transform: scale(0) rotate(-90deg); opacity: 0; } }
.res-score { margin: 10px 0 0; font-family: var(--en); font-size: 18px; letter-spacing: .1em; color: #fff; text-shadow: var(--fk2); }
.res-score b { display: block; font-family: var(--pop); font-weight: 400; font-size: 32px; color: var(--ink); text-shadow: none; letter-spacing: 0; }

.howto { text-align: left; margin: 0; padding-left: 22px; font-size: 13px; line-height: 1.75; color: #4a3d57; font-weight: 800; }
.howto li { margin-bottom: 8px; }
.howto li::marker { font-family: var(--pop); color: var(--red); }
.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: 46px; height: 46px; 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: 900; }

.toast {
  position: fixed; z-index: 60; left: 50%; top: calc(14px + var(--safe-t));
  transform: translate(-50%, -30px) rotate(-2deg);
  display: flex; align-items: center; gap: 10px;
  max-width: min(96vw, 460px);
  background: #fff;
  border: 4px solid var(--k);
  border-radius: 16px; padding: 10px 14px 10px 12px;
  box-shadow: 6px 6px 0 var(--k);
  font-size: clamp(11px, 3.4vw, 13px); text-align: left; font-weight: 800;
  opacity: 0; transition: opacity .2s, transform .3s cubic-bezier(.2,1.5,.4,1);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0) rotate(-2deg); }
.toast i { display: block; flex: 0 0 auto; background-repeat: no-repeat; border-radius: 8px; background-color: var(--cream); border: 3px solid var(--k); }
.toast b { font-family: var(--pop); font-weight: 400; color: var(--red); }
.toast small { color: var(--sub); font-size: .85em; }
/* 1行ずつ。画面がせまいときは字が小さくなるので、折り返さなくても はみ出さない */
.toast .t-line, .toast small { display: block; white-space: nowrap; }

/* =========================================================
   チュートリアル
   ========================================================= */
.tut { position: fixed; inset: 0; z-index: 70; }
.tut.dim { background: rgba(17,17,17,.62); }
.tut-hole {
  position: absolute;
  border-radius: 18px;
  border: 5px dashed #ffe24a;
  box-shadow: 0 0 0 200vmax rgba(17,17,17,.62);
  transition: left .35s cubic-bezier(.2,.9,.3,1), top .35s cubic-bezier(.2,.9,.3,1), width .35s, height .35s;
  animation: holePulse 1s ease-in-out infinite;
  pointer-events: none;
}
@keyframes holePulse { 50% { border-color: #fff; } }
.tut-box {
  position: absolute; left: 0; right: 0; margin: 0 auto;
  width: min(92vw, 440px);
  display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 0 10px; align-items: end;
  background-color: #fff;
  background-image: var(--tone);
  background-size: 9px 9px;
  border: 5px solid var(--k); border-radius: 20px;
  box-shadow: 8px 8px 0 var(--k);
  padding: 12px 14px 12px 6px;
}
.tut-box.at-bottom { bottom: calc(20px + var(--safe-b)); }
.tut-box.at-top { top: calc(20px + var(--safe-t)); }
.tut-box.at-center { top: 0; bottom: 0; height: fit-content; margin: auto; }
.tut-box.pop { animation: tutPop .42s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes tutPop { from { transform: translateY(-30px) scale(.7) rotate(-3deg); opacity: 0; } }
.tut-buddy { width: 88px; margin-top: -40px; align-self: end; }
.tut-body { text-align: left; }
.tut-title {
  display: block; font-family: var(--pop); font-weight: 400; font-size: 19px; line-height: 1.25;
  color: #ffe24a; text-shadow: var(--fk2), 3px 3px 0 var(--k);
}
.tut-text { margin: 6px 0 8px; font-size: 13px; line-height: 1.65; font-weight: 800; color: var(--ink); }
.tut-text b { color: var(--red); }
.tut-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tut-count { font-family: var(--en); font-size: 17px; letter-spacing: .06em; color: #fff; text-shadow: var(--fk2); }

/* ---------- せまい画面 ---------- */
@media (max-width: 380px) {
  .park-title { display: none; }
  .nav-ic { width: 46px; height: 46px; }
  .nav-play .nav-ic { width: 66px; height: 66px; }
  .btn-lg { font-size: 19px; }
}

/* ---------- 横に広い画面（タブレット） ---------- */
@media (min-width: 760px) {
  .char-list { max-width: 720px; margin: 0 auto; }
  .park-wrap .pk-svg { max-width: 620px; margin: 0 auto; }
  .skill-right { max-width: 320px; }
  .buddy { width: 140px; }
  .buddy-spr { width: 160px; }
  .buddy-say { left: 120px; bottom: 100px; }
  .modal-card { max-width: 460px; }
  .nav-ic { width: 60px; height: 60px; }
  .nav-ic svg { width: 34px; height: 34px; }
  .nav-btn b { font-size: 13px; }
  .nav-play .nav-ic { width: 86px; height: 86px; }
  .st-box { min-height: 156px; }
  .st-text { font-size: 18px; }
  .hud { padding-left: max(10px, calc((100% - 760px) / 2)); padding-right: max(10px, calc((100% - 760px) / 2)); }
}

/* =========================================================
   パズル：背の低いスマホ（iPhone SE など）では上下の帯を小さくして、盤を大きく
   ========================================================= */
@media (max-height: 760px) {
  .hud { padding: calc(5px + var(--safe-t)) 8px 5px; gap: 4px 6px; }
  .btn-pause { width: 38px; height: 38px; min-height: 38px; }
  .hud-goals { height: 38px; gap: 4px; }
  .hud-missions { gap: 5px; }
  .mchip { padding: 1px 9px 1px 2px; gap: 4px; border-width: 3px; box-shadow: 0 3px 0 var(--k); }
  .mchip .gicon { width: 28px; height: 28px; }
  .mchip b { font-size: 18px; }
  .mchip .mmax { font-size: 12px; }
  .mchip.done::after { font-size: 15px; }
  .hud-moves { padding: 0 7px 1px; border-width: 3px; }
  .hud-moves b { font-size: 22px; }
  .hud-label { font-size: 8px; }

  .skill-bar { padding: 5px 8px calc(5px + var(--safe-b)); }
  .gauge-row { margin-bottom: 5px; gap: 5px; }
  .gauge { height: 18px; border-width: 3px; }
  .gauge-cap { font-size: clamp(9px, 2.8vw, 11px); }
  .slot.empty .slot-name { font-size: 8.5px; }
  .slot { padding: 4px 3px 3px; gap: 2px; border-width: 3px; border-radius: 13px; box-shadow: 0 4px 0 var(--k); }
  .slot-ic { zoom: .8; }
  /* ヒント（スキルでねらっている間だけ出る）は、自分の段を持たずにゲージの上に重ねる */
  .skill-hint {
    grid-column: auto; grid-row: auto;   /* グリッドの段を指定したままだと、その段が位置の基準になってしまう */
    position: absolute; z-index: 2; top: 5px; right: 8px;
    width: min(260px, calc(100% - 124px)); height: 18px; margin: 0; padding: 0 6px;
    line-height: 12px; font-size: 11px;
    background: #fff; border: 3px solid var(--k); border-radius: 999px;
  }
  .skill-hint:empty { display: none; }
}

/* 画面の絵や曲を読みこんでいる間（すぐ読めたときは出ない） */
.load-wait {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(20, 12, 32, .55);
  animation: storyWaitIn .2s ease both;
}
.load-wait i {
  width: 44px; height: 44px; border-radius: 50%;
  border: 6px solid rgba(255,255,255,.35); border-top-color: #ffd83a;
  animation: storyWaitSpin .8s linear infinite;
}
.load-wait b { font-family: var(--pop); font-weight: 400; font-size: 16px; color: #fff; text-shadow: var(--fk2); }
@keyframes storyWaitIn { from { opacity: 0; } }
@keyframes storyWaitSpin { to { transform: rotate(360deg); } }

/* 動きを減らす設定の端末では、網点を止める */
/* 「動きを減らす」設定のときも、完全には止めない。
   ゆっくり・小さくして、止まって見えないようにする */
@media (prefers-reduced-motion: reduce) {
  .hud-bg::after, .skill-bar::before { animation-duration: 26s; }
  .board-glow { animation-duration: 9s; }
  .amb .shoot { animation-duration: 20s; }
  .amb .twk { animation-duration: 9s; animation-name: twkSoft; }
  .bstar { animation-duration: 20s; }
  .hud-skyline { animation-duration: 120s; }
  .hud::after, .skill-bar::after { animation-duration: 7s; }
  /* 星は 動かさずに、明るさだけ ゆっくり変える */
  @keyframes twkSoft { 0%, 100% { opacity: 0; } 50% { opacity: .75; } }
}
