/* ============================================================
 * ミニゲームのスタイル
 * ============================================================ */

/* ゲームは画面いっぱいに開く（スマホ） */
.modal--game .modal__panel { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-height: none; max-width: 640px; padding-top: 12px; }
.modal--game .modal__body { flex: 1 1 auto; min-height: 0; }
.modal--game .modal__foot { display: none; }
.game-root { height: 100%; }
.game-root > * { min-height: 100%; }

.game-hud { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; }
.game-hud > div { padding: 6px 4px; text-align: center; background: var(--ink); color: var(--white); }
.game-hud dt { font-size: 12px; line-height: 1.3; opacity: .92; }
.game-hud dd { margin: 0; font-family: var(--font-dot); font-size: 16px; line-height: 1.2; white-space: nowrap; }
.game-hud dd b { font-weight: 400; font-size: 24px; color: var(--on-dark-gold); }
.game-foot { justify-content: center; margin-top: 8px; }

/* ---------- A. かめりあー絵合わせ ---------- */
.mem { display: flex; flex-direction: column; gap: 8px; }
.mem__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 4px 0; }
.mem-card {
  appearance: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  position: relative; display: block; width: 100%; aspect-ratio: 1 / 1;
  background: transparent; perspective: 700px;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.mem-card__inner { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .26s ease-out; }
.mem-card.is-up .mem-card__inner { transform: rotateY(180deg); }
.mem-card__back, .mem-card__face {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  display: grid; place-items: center;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.mem-card__back {
  background: var(--ink) url(../assets/crest/crest-cat-128.png) center / 62% no-repeat;
  box-shadow: inset 0 0 0 3px var(--ink), inset 0 0 0 5px var(--card-back-line);
}
.mem-card__face { transform: rotateY(180deg); background: var(--white); box-shadow: inset 0 0 0 3px var(--ink); }
.mem-card__face img { display: block; width: 78%; height: 78%; object-fit: contain; }
.mem-card.is-matched { cursor: default; }
.mem-card.is-matched .mem-card__face { background: var(--gold-pale); box-shadow: inset 0 0 0 3px var(--gold-deep); }
.mem-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- B. 30秒のほしあつめ ---------- */
.sc-setup { display: grid; gap: 16px; }
.sc-setup .seg { margin-top: 0; }
.sc-setup__label { font-family: var(--font-dot); font-size: 16px; }
.sc-setup__best { display: flex; align-items: center; gap: 6px; font-family: var(--font-dot); font-size: 16px; --icon-accent: var(--gold); }
.sc-setup__best b { font-weight: 400; font-size: 24px; color: var(--gold-deep); }
.sc { display: flex; flex-direction: column; gap: 8px; }
.sc-hud { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; align-items: stretch; }
.sc-hud__item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 4px; margin: 0; padding: 6px 10px; background: var(--ink); color: var(--white); }
.sc-hud__item span { width: 100%; font-size: 12px; line-height: 1.3; opacity: .92; }
.sc-hud__item small { font-family: var(--font-dot); font-size: 14px; }
.sc-hud__num { font-family: var(--font-dot); font-weight: 400; font-size: 38px; line-height: 1; color: var(--on-dark-gold); }
.sc-hud__num--sm { font-size: 30px; }
.sc-hud__num.is-low { color: var(--alert-on-dark); }
.sc-hud .btn { align-self: center; }
/* 星が出るのは、この枠の中だけ。残り時間・集めた数・やめるボタンとは重ならない。 */
.sc-field {
  position: relative; height: clamp(250px, 46vh, 430px); overflow: hidden;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  background-color: var(--night);
  background-image:
    radial-gradient(circle at 12% 22%, rgba(255, 255, 255, .7) 1px, transparent 1.6px),
    radial-gradient(circle at 78% 14%, rgba(255, 255, 255, .5) 1px, transparent 1.6px),
    radial-gradient(circle at 40% 70%, rgba(255, 255, 255, .45) 1px, transparent 1.6px),
    radial-gradient(circle at 90% 82%, rgba(255, 255, 255, .6) 1px, transparent 1.6px),
    linear-gradient(180deg, var(--night-deep), var(--night-glow));
  box-shadow: 0 -2px 0 0 var(--ink), 0 2px 0 0 var(--ink), -2px 0 0 0 var(--ink), 2px 0 0 0 var(--ink);
  margin: 2px;
}
.sc-field:focus-visible { outline-offset: 4px; }
.sc-star {
  appearance: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  position: absolute; left: 0; top: 0; display: grid; place-items: center;
  background: transparent; color: var(--star); will-change: transform;
  -webkit-tap-highlight-color: transparent;
}
.sc-star.is-fading { opacity: .45; }
.sc-star:focus-visible { outline: 3px solid var(--white); outline-offset: -6px; }

/* ---------- 結果の画面 ---------- */
.game-result { display: grid; gap: 10px; justify-items: center; align-content: center; padding: 8px 0 4px; text-align: center; }
.game-result__art { width: 128px; height: 128px; }
.game-result__sd { width: 140px; height: 140px; object-fit: contain; }
.game-result__title { font-family: var(--font-dot); font-weight: 400; font-size: 28px; line-height: 1.3; }
.game-result__title:focus { outline: none; }
.game-result__score { font-family: var(--font-dot); font-size: 22px; line-height: 1; }
.game-result__score b { font-weight: 400; font-size: 68px; color: var(--gold-deep); }
.game-result__text { font-size: 15px; }
.game-result__stats { display: flex; gap: 22px; margin: 0; }
.game-result__stats dt { font-size: 12px; color: var(--ink-soft); }
.game-result__stats dd { margin: 0; font-family: var(--font-dot); font-size: 26px; line-height: 1.2; }
.game-result__best { display: flex; align-items: center; gap: 6px; font-family: var(--font-dot); font-size: 17px; color: var(--camellia-deep); --icon-accent: var(--gold); }
.game-result__actions { display: grid; gap: 8px; width: 100%; margin-top: 6px; }

@media (min-width: 480px) {
  .mem__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 920px) {
  .modal--game .modal__panel { height: auto; max-height: 92vh; }
  .game-root > * { min-height: 0; }
}

/* ---------- C. ぴったり10秒の魔法 ---------- */
.ts { display: grid; gap: 12px; align-content: start; text-align: center; }
.ts > * + * { margin-top: 0; }
.ts-stage {
  position: relative; display: grid; justify-items: center; align-content: center; gap: 8px;
  /* 「はじめる」と「とめる」が同じ位置に出るように、高さをそろえておく */
  min-height: 252px; padding: 16px 12px 12px; background: var(--ink); color: var(--white);
}
.ts-wand { position: absolute; right: 10px; top: 10px; width: 48px; height: 48px; background: var(--gold-pale); box-shadow: 0 0 0 2px var(--white); }
.ts-pix { width: 96px; height: 96px; }
.ts-bubble { position: relative; max-width: 100%; padding: 8px 12px; font-size: 14px; line-height: 1.6; text-align: left; background: var(--white); color: var(--ink); }
.ts-bubble::before { content: ''; position: absolute; left: 50%; top: -6px; width: 6px; height: 6px; margin-left: -3px; background: var(--white); }
.ts-clock { display: flex; align-items: center; justify-content: center; gap: 4px; font-family: var(--font-dot); font-size: 28px; line-height: 1; color: var(--on-dark-gold); }
.ts-clock span { width: 30px; height: 40px; display: grid; place-items: center; background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .4); }
.ts-clock i { font-style: normal; }
.ts-rule { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; }
.btn--xl { min-height: 84px; padding: 14px 18px; font-size: 24px; gap: 12px; width: calc(100% - var(--px) * 2); }
.ts-best { display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 2px 6px; font-size: 13px; line-height: 1.6; color: var(--ink-soft); }
.ts-best b { font-family: var(--font-dot); font-weight: 400; font-size: 18px; color: var(--ink); }
.ts-react { display: flex; align-items: flex-end; justify-content: center; gap: 8px; min-height: 120px; }
.ts-react__sd { width: 120px; height: 120px; object-fit: contain; }
.ts-title { font-family: var(--font-dot); font-weight: 400; font-size: 26px; line-height: 1.2; }
.ts--result.is-success .ts-title { color: var(--camellia-deep); }
.ts-time { font-family: var(--font-dot); font-size: 20px; line-height: 1; }
.ts-time b { font-weight: 400; font-size: 60px; color: var(--blue-deep); }
.ts-diff { font-size: 15px; line-height: 1.5; }
.ts-diff b { font-family: var(--font-dot); font-weight: 400; font-size: 20px; }
.ts-judge { justify-content: center; }
.ts-text { font-size: 14px; line-height: 1.6; }
.ts-mission {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; text-align: left; font-size: 14px; line-height: 1.6;
  background: var(--purple-pale); color: var(--purple-deep); box-shadow: inset 0 0 0 2px var(--purple);
}
.ts-mission .px-icon { margin-top: 4px; }
.ts-mission b { font-family: var(--font-dot); font-weight: 400; font-size: 16px; }
.game-card__art--magic img { position: absolute; width: 46px; height: 46px; }
.game-card__art--magic img:first-child { left: 4px; bottom: 4px; }
.game-card__art--magic img:last-child { right: 4px; top: 4px; background: var(--gold-pale); box-shadow: 0 0 0 2px var(--white); }
