* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #5fb4f5;
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", "Meiryo", system-ui, sans-serif;
  color: #222;
  /* スマホでのスクロール・拡大・長押しメニューを防ぐ */
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#stage, #stage canvas {
  touch-action: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hidden { display: none !important; }

#flash {
  position: fixed;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}

/* 音ボタン */
.icon-btn {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 30;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: rgba(30, 30, 60, 0.55);
  font-size: 26px;
  cursor: pointer;
}

/* HUD */
#hud {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 10;
  color: #fff;
  text-shadow: 0 3px 0 #233, 0 0 8px rgba(0, 0, 0, 0.4);
}
#timerWrap { font-size: 64px; font-weight: 900; line-height: 1; }
#timerWrap small { font-size: 22px; margin-left: 4px; }
#timerWrap.hurry { color: #ffe14d; animation: pulse 0.5s infinite; }
#powerWrap { width: min(80vw, 420px); text-align: center; font-weight: 800; }
#powerLabel { font-size: 20px; }
#powerBar {
  height: 18px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.35);
  border: 3px solid #fff;
  overflow: hidden;
  margin: 4px 0;
}
#powerFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffd23f, #ff7a3c, #ff3c8a);
  transition: width 0.1s linear;
}
#revs { font-size: 18px; }

/* 中央メッセージ */
#msg {
  position: fixed;
  top: 32%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: clamp(30px, 9vw, 64px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 4px 0 #e8323c, 0 0 14px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 12;
  opacity: 0;
  white-space: pre-line;
}
#msg.show { animation: pop 0.9s ease-out forwards; }
#msg.stay { opacity: 1; animation: popin 0.25s ease-out; }

#banner {
  position: fixed;
  top: 24%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: clamp(22px, 6.5vw, 40px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 3px 0 #2c3e8f, 0 0 10px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 12;
  opacity: 0;
}
#banner.show { animation: slide 1.1s ease-out forwards; }
#banner.goal { color: #fff07a; font-size: clamp(32px, 10vw, 68px); text-shadow: 0 4px 0 #2a8fa0, 0 0 20px #8fe3ea; }

#distance {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 0;
  right: 0;
  text-align: center;
  font-size: clamp(20px, 6.2vw, 40px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 3px 0 #233, 0 0 10px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 10;
}

#skipHint {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  text-align: center;
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  opacity: 0.8;
  pointer-events: none;
  z-index: 10;
}

/* 仮想スティック */
#stick {
  position: fixed;
  left: 50%;
  bottom: calc(max(24px, env(safe-area-inset-bottom)) + 10px);
  width: min(56vw, 240px);
  height: min(56vw, 240px);
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0 40%, rgba(255, 255, 255, 0.35) 41% 100%);
  border: 4px solid rgba(255, 255, 255, 0.9);
  z-index: 10;
  pointer-events: none;
}
#stickRing {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 6px dashed rgba(255, 230, 80, 0.9);
  animation: spinring 1.2s linear infinite;
}
#stick.active #stickRing { border-color: rgba(255, 120, 60, 0.95); animation-duration: 0.4s; }
#knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 38%;
  height: 38%;
  margin: -19% 0 0 -19%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #ffb84d 60%, #ff7a3c);
  border: 3px solid #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
#stickHint {
  position: absolute;
  bottom: 100%;
  left: -50%;
  right: -50%;
  margin-bottom: 18px;
  text-align: center;
  color: #fff;
  font-weight: 900;
  font-size: 22px;
  text-shadow: 0 3px 0 #e8323c;
  animation: pulse 0.8s infinite;
}

/* タイミングゲージ */
#gauge {
  position: fixed;
  left: 50%;
  bottom: calc(max(30px, env(safe-area-inset-bottom)) + 30px);
  transform: translateX(-50%);
  width: min(88vw, 520px);
  z-index: 10;
  pointer-events: none;
  text-align: center;
}
#gaugeHelp {
  color: #fff;
  font-weight: 900;
  font-size: 26px;
  margin-bottom: 10px;
  text-shadow: 0 3px 0 #e8323c;
}
#gaugeBar {
  position: relative;
  height: 54px;
  border-radius: 27px;
  background: #3a3a5a;
  border: 4px solid #fff;
  overflow: hidden;
}
#gaugeBar .zone { position: absolute; top: 0; bottom: 0; }
#gaugeBar .good { left: 25%; right: 25%; background: #4bbf73; }
#gaugeBar .great { left: 37%; right: 37%; background: #ffc83d; }
#gaugeBar .perfect { left: 44%; right: 44%; background: #ff3c8a; }
#gaugeBar .perfect::after {
  content: "★";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 24px;
}
#gaugeMarker {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 10px;
  margin-left: -5px;
  left: 0;
  background: #fff;
  border: 2px solid #222;
  border-radius: 5px;
}
#gauge.holding #gaugeBar { box-shadow: 0 0 0 6px rgba(255, 220, 80, 0.7); }

/* パネル（タイトル・結果） */
.panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 480px);
  max-height: 92vh;
  overflow-y: auto;
  padding: 22px 20px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  border: 5px solid #fff;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.15), 0 20px 40px rgba(0, 0, 0, 0.25);
  text-align: center;
  z-index: 20;
  animation: popin 0.3s ease-out;
}
.lead { font-size: 18px; font-weight: 800; margin: 6px 0 10px; }
.lead b { color: #1aa3b0; }
.howto { text-align: left; font-size: 15px; line-height: 1.5; padding-left: 1.4em; margin: 8px 0; }
.pc-only { font-size: 13px; color: #555; margin: 4px 0 8px; }
@media (pointer: coarse) { .pc-only { display: none; } }
.big-btn {
  display: block;
  width: 100%;
  min-height: 72px;
  margin: 10px 0 6px;
  border: none;
  border-radius: 36px;
  background: linear-gradient(#ff9a3c, #ff5a3c);
  color: #fff;
  font-size: 28px;
  font-weight: 900;
  font-family: inherit;
  box-shadow: 0 6px 0 #b8381f;
  cursor: pointer;
}
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #b8381f; }
.sub-btn {
  min-height: 48px;
  padding: 0 24px;
  border-radius: 24px;
  border: 3px solid #3d6ee8;
  background: #fff;
  color: #3d6ee8;
  font-size: 17px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
}
.best { font-weight: 800; color: #3d6ee8; margin: 6px 0; font-size: 15px; }
.note { font-size: 12px; color: #666; margin: 8px 0 0; line-height: 1.5; }
.note a { color: #666; }

.res-label { margin: 0; font-weight: 800; color: #666; }
#resDist { margin: 0; font-size: clamp(26px, 8vw, 44px); word-break: break-all; font-weight: 900; color: #ff5a3c; line-height: 1.15; }
#resTitle { margin: 6px 0; font-size: 22px; font-weight: 900; color: #2c3e8f; }
#resGoal { margin: 4px 0 8px; font-weight: 800; color: #1aa3b0; }
#resStats {
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 14px;
  justify-content: center;
  margin: 8px 0;
  font-size: 15px;
}
#resStats dt { color: #666; text-align: right; }
#resStats dd { margin: 0; font-weight: 800; text-align: left; }

@keyframes pop {
  0% { opacity: 0; transform: scale(0.4); }
  15% { opacity: 1; transform: scale(1.15); }
  25% { transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.05) translateY(-10px); }
}
@keyframes popin { from { transform: translate(-50%, -50%) scale(0.85); opacity: 0; } }
#msg.stay { animation-name: msgin; }
@keyframes msgin { from { transform: scale(0.6); opacity: 0; } }
@keyframes slide {
  0% { opacity: 0; transform: translateX(40px); }
  15% { opacity: 1; transform: translateX(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-16px); }
}
@keyframes pulse { 50% { transform: scale(1.08); } }
@keyframes spinring { to { transform: rotate(360deg); } }

/* ===== ドーパミン系の演出（軽さ優先：transform と opacity だけを動かす） ===== */

/* 集中線：円錐グラデーション1枚。動きはカクカク（steps）にしてマンガっぽく、描き直しを減らす */
#speedLines {
  position: fixed;
  inset: -40%;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0) 0deg 5deg, rgba(255, 255, 255, 0.7) 5deg 5.6deg, rgba(255, 255, 255, 0) 5.6deg 9deg);
  -webkit-mask-image: radial-gradient(circle, transparent 22%, #000 48%);
  mask-image: radial-gradient(circle, transparent 22%, #000 48%);
  will-change: transform, opacity;
  animation: lines 0.5s steps(4) infinite;
}
@keyframes lines {
  0% { transform: rotate(0deg) scale(1); }
  100% { transform: rotate(8deg) scale(1.04); }
}

/* FEVER：画面のふちが光って脈打つ */
#fever {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(255, 60, 138, 0.55) 80%, rgba(255, 210, 63, 0.75) 100%);
  will-change: opacity;
}
#fever.on { animation: feverpulse 0.42s ease-in-out infinite alternate; }
@keyframes feverpulse { from { opacity: 0.35; } to { opacity: 0.95; } }
@media (prefers-reduced-motion: reduce) {
  #fever.on { animation: none; opacity: 0.4; }
}

/* 飛び出す文字 */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 14; overflow: hidden; }
.pop {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  font-weight: 900;
  font-size: 30px;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 3px 0 #ff5a3c, 0 0 10px rgba(0, 0, 0, 0.35);
  will-change: transform, opacity;
}
.pop.t1 { color: #fff7a8; }
.pop.t2 { color: #ffd23f; font-size: 36px; }
.pop.t3 { color: #ff8ad8; font-size: 42px; text-shadow: 0 3px 0 #7a1fd6, 0 0 14px #ff3c8a; }
.pop.lv { font-size: 26px; color: #fff07a; text-shadow: 0 3px 0 #2c3e8f, 0 0 12px #ffd23f; }
.pop.combo { font-size: 34px; color: #8fe3ea; text-shadow: 0 3px 0 #2c3e8f, 0 0 12px #3d6ee8; }
.pop.boom { font-size: 72px; color: #fff07a; text-shadow: 0 5px 0 #e8323c, 0 0 24px #ff7a3c; }

/* ハンコ文字 */
#stamp {
  position: fixed;
  left: 50%;
  top: 42%;
  z-index: 15;
  pointer-events: none;
  opacity: 0;
  font-weight: 900;
  font-size: clamp(44px, 14vw, 96px);
  white-space: nowrap;
  color: #fff;
  -webkit-text-stroke: 3px #2c3e8f;
  text-shadow: 0 6px 0 #2c3e8f, 0 0 26px rgba(255, 255, 255, 0.6);
  will-change: transform, opacity;
}
#stamp.fever { color: #ffd23f; -webkit-text-stroke-color: #e8323c; text-shadow: 0 6px 0 #e8323c, 0 0 30px #ff3c8a; }
#stamp.perfect { color: #fff07a; -webkit-text-stroke-color: #ff3c8a; text-shadow: 0 6px 0 #b8177a, 0 0 34px #ffd23f; }
#stamp.great { color: #ffc83d; }
#stamp.count { font-size: clamp(90px, 30vw, 180px); top: 46%; color: #fff07a; -webkit-text-stroke-color: #e8323c; text-shadow: 0 8px 0 #e8323c; }
#stamp.goal { color: #8fe3ea; -webkit-text-stroke-color: #1a5f8f; text-shadow: 0 6px 0 #1a5f8f, 0 0 34px #8fe3ea; font-size: clamp(36px, 11vw, 80px); }

/* パワーゲージの段階（レベルが上がるほど光る） */
#powerBar.lv2 { box-shadow: 0 0 8px #ffd23f; }
#powerBar.lv3 { box-shadow: 0 0 12px #ff7a3c; }
#powerBar.lv4 { box-shadow: 0 0 16px #ff3c8a; }
#powerBar.lv5 { box-shadow: 0 0 22px #ff3c8a, 0 0 6px #fff; border-color: #fff07a; }
#powerLabel { display: inline-block; }
#powerWrap { position: relative; }

/* ゲージ：★に近づくと光る */
#gaugeBar.hot { box-shadow: 0 0 0 5px #fff07a, 0 0 22px #ff3c8a; }

/* 結果：ランクのハンコ・天王星までの進み具合・もう一回ボタン */
.res-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
#resRank {
  flex: none;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 5px solid #e8323c;
  color: #e8323c;
  font-size: 30px;
  font-weight: 900;
  transform: rotate(-12deg);
  opacity: 0;
}
#resRank.rank-SS, #resRank.rank-S { border-color: #ff3c8a; color: #ff3c8a; box-shadow: 0 0 18px #ffd23f; }
#resRank.rank-A { border-color: #ff7a3c; color: #ff7a3c; }
#resRank.rank-B { border-color: #3d6ee8; color: #3d6ee8; }
#resRank.rank-C, #resRank.rank-D { border-color: #888; color: #888; }
#goalProg {
  position: relative;
  height: 22px;
  margin: 2px 8px 8px;
  border-radius: 11px;
  background: #e3e8f5;
  overflow: hidden;
}
#goalFill {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, #3d6ee8, #8fe3ea);
  transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#goalProg.clear #goalFill { background: linear-gradient(90deg, #ff3c8a, #ffd23f, #4bbf73, #3d6ee8); }
#goalPct { position: relative; font-size: 13px; font-weight: 900; color: #2c3e8f; line-height: 22px; }
#retryBtn.ready { animation: retry 0.9s ease-in-out infinite; }
@keyframes retry {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); box-shadow: 0 6px 0 #b8381f, 0 0 24px #ffb84d; }
}

#resKm { margin: 0 0 4px; font-size: 14px; font-weight: 800; color: #6b5a8a; }
#stamp.tier { color: #fff; -webkit-text-stroke-color: #6a1bd8; text-shadow: 0 6px 0 #6a1bd8, 0 0 34px #3dd6ff; font-size: clamp(44px, 14vw, 100px); }
#stamp.tier3 { color: #ffe14a; -webkit-text-stroke-color: #e8323c; text-shadow: 0 6px 0 #e8323c, 0 0 40px #ff9a3c; }
#stamp.tier4 { color: #bff6ff; -webkit-text-stroke-color: #0a3fd8; text-shadow: 0 6px 0 #0a3fd8, 0 0 50px #3dd6ff, 0 0 90px #fff; }
#stamp.tier5 { color: #fff; -webkit-text-stroke-color: #ff2fa0; text-shadow: 0 6px 0 #6a1bd8, 0 0 60px #ff2fa0, 0 0 100px #3dd6ff; font-size: clamp(34px, 11vw, 78px); }

/* 縦画面：演出文字はキャラより上の帯に置き、主役（画面中央）と指・ゲージ（下）を隠さない */
@media (max-aspect-ratio: 4/5) {
  #msg { top: 25%; font-size: clamp(26px, 8vw, 52px); }
  #banner { top: 20.5%; font-size: clamp(20px, 6vw, 34px); }
  #stamp { top: 26%; }
  #stamp.count { top: 27%; font-size: clamp(70px, 22vw, 130px); }
}

#resHint { margin: 2px 0 6px; padding: 6px 10px; border-radius: 10px; background: #fff6d8; color: #6b4a00; font-size: 14px; font-weight: 800; }
#resHint::before { content: '💡 次へのヒント：'; }

/* 動きを減らす設定：点滅・拡縮・回転するアニメーションを止め、出る／消えるだけにする */
@media (prefers-reduced-motion: reduce) {
  #timerWrap.hurry, #retryBtn.ready, #speedLines, #gaugeBar.hot, #stickRing, #stickHint { animation: none !important; }
  #msg.show { animation: fadeonly 0.9s ease-out forwards; }
  #banner.show { animation: fadeonly 1.1s ease-out forwards; }
  #msg.stay { animation: none; }
}
@keyframes fadeonly { 0% { opacity: 0; } 15% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }

#envError { margin: 10px 0 0; padding: 8px 10px; border-radius: 10px; background: #ffe3e3; color: #8a1020; font-size: 14px; font-weight: 800; text-align: left; line-height: 1.5; }

/* 横画面：演出文字は上の帯に小さめに（主役の頭にかからないように） */
@media (min-aspect-ratio: 4/5) {
  #msg { top: 24%; font-size: clamp(24px, 4vw, 42px); line-height: 1.1; }
  #banner { top: 19.5%; font-size: clamp(20px, 3vw, 30px); }
  #stamp { top: 30%; }
}

/* ===== 3連チャレンジ：お題カード（キャラにかからないよう画面下の、スティックがあった場所に出す） ===== */
#qte {
  position: fixed;
  left: 50%;
  bottom: calc(max(24px, env(safe-area-inset-bottom)) + 14px);
  transform: translateX(-50%);
  width: min(86vw, 360px);
  z-index: 11;
  pointer-events: none;
  text-align: center;
}
#qtePips { display: flex; justify-content: center; gap: 12px; margin-bottom: 10px; }
#qtePips i {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(30, 30, 60, 0.45); border: 4px solid #fff;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
}
#qtePips i.now { background: #ffd23f; animation: pulse 0.5s infinite; }
#qtePips i.ok { background: #4bbf73; }
#qtePips i.ok::after { content: '✓'; display: block; color: #fff; font-weight: 900; font-size: 16px; line-height: 18px; }
#qtePips i.ng { background: #8a8aa0; }
#qteCard {
  position: relative;
  padding: 12px 14px 14px;
  border-radius: 26px;
  background: #fff;
  border: 6px solid #2b2140;
  box-shadow: 0 8px 0 #2b2140;
  color: #2b2140;
}
#qteIcon { font-size: clamp(48px, 15vw, 72px); line-height: 1.1; }
#qteLabel {
  font-size: clamp(26px, 8vw, 38px);
  font-weight: 900;
  line-height: 1.15;
  color: #ff5a3c;
  paint-order: stroke fill;
  -webkit-text-stroke: 7px #2b2140;
  text-shadow: 0 4px 0 #2b2140;
  letter-spacing: 0.02em;
}
#qteTime { height: 14px; margin-top: 10px; border-radius: 7px; background: #e3e8f5; overflow: hidden; border: 3px solid #2b2140; }
#qteFill { height: 100%; background: linear-gradient(90deg, #4bbf73, #ffd23f); transform-origin: left center; }
#qteCard.late #qteFill { background: #ff3c5a; }
#qteCard.intro { background: #ffd23f; }
#qteCard.intro #qteLabel { font-size: clamp(22px, 6.6vw, 30px); color: #fff; }
#qteCard.intro #qteTime, #qteCard.hit #qteTime, #qteCard.miss #qteTime { visibility: hidden; }
#qteCard.in { animation: qtein 0.22s cubic-bezier(0.2, 1.6, 0.4, 1); }
#qteCard.hit { background: #8ff0b0; animation: qtehit 0.3s ease-out; }
#qteCard.hit #qteLabel { color: #fff07a; }
#qteCard.miss { background: #d8d8e4; }
#qteCard.miss #qteLabel { color: #fff; }
#qteCard.nudge { animation: qtenudge 0.3s; }
#qteCard.k-up #qteIcon, #qteCard.k-down #qteIcon, #qteCard.k-left #qteIcon, #qteCard.k-right #qteIcon { color: #3d6ee8; }
@keyframes qtein { from { transform: scale(0.5); } }
@keyframes qtehit { 50% { transform: scale(1.12) rotate(-3deg); } }
@keyframes qtenudge { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.pop.qok { font-size: 40px; color: #fff07a; paint-order: stroke fill; -webkit-text-stroke: 7px #2b2140; text-shadow: 0 4px 0 #2b2140; }

/* ===== 文字の仕上げ：太い濃色のふち＋厚みのある影で、明るい背景でも宇宙でも読める ===== */
#msg, #banner, #stamp, .pop, #timerWrap, #gaugeHelp, #stickHint, #distance {
  paint-order: stroke fill;
  -webkit-text-stroke: 6px #2b2140;
  letter-spacing: 0.02em;
}
#msg { -webkit-text-stroke-width: 9px; text-shadow: 0 6px 0 #2b2140, 0 0 18px rgba(0, 0, 0, 0.25); color: #fff07a; }
#banner { text-shadow: 0 4px 0 #2b2140; }
#stamp { -webkit-text-stroke-width: 12px; }
#timerWrap { -webkit-text-stroke-width: 8px; text-shadow: 0 5px 0 #2b2140; }
#distance { text-shadow: 0 4px 0 #2b2140; }
#gaugeHelp, #stickHint { text-shadow: 0 4px 0 #2b2140; color: #fff07a; }
.pop { -webkit-text-stroke-width: 6px; }

@media (prefers-reduced-motion: reduce) {
  #qtePips i.now, #qteCard.in, #qteCard.hit, #qteCard.nudge { animation: none !important; }
}
#qteIcon svg { height: clamp(56px, 16vw, 80px); width: auto; overflow: visible; }
#qteIcon .ring { fill: none; stroke: #ff5a3c; stroke-width: 7; }
#qteIcon .dot { fill: #ff5a3c; stroke: #2b2140; stroke-width: 6; }
#qteIcon .arrow { fill: #3d6ee8; stroke: #2b2140; stroke-width: 6; stroke-linejoin: round; }
#qteIcon .bolt { fill: #fff07a; stroke: #2b2140; stroke-width: 6; stroke-linejoin: round; }
#qteCard.hit .dot, #qteCard.hit .arrow { fill: #4bbf73; }
#qteCard.miss .dot, #qteCard.miss .arrow, #qteCard.miss .ring { fill: #9a9ab0; stroke: #6a6a80; }
#qteCard.miss .ring { fill: none; }
.k-tap .ring, .k-double .ring { animation: tapring 0.6s ease-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes tapring { from { transform: scale(0.6); opacity: 1; } to { transform: scale(1.15); opacity: 0; } }
.k-up .arrow { animation: nudgeup 0.5s ease-in-out infinite alternate; }
.k-down .arrow { animation: nudgeup 0.5s ease-in-out infinite alternate; }
.k-left .arrow, .k-right .arrow { animation: nudgeup 0.5s ease-in-out infinite alternate; }
@keyframes nudgeup { to { transform: translateY(-7px); } }
@media (prefers-reduced-motion: reduce) { .k-tap .ring, .k-double .ring, .k-up .arrow, .k-down .arrow, .k-left .arrow, .k-right .arrow { animation: none; } }

/* タイトルの遊び方：番号の丸と短い一行で、読まなくても流れが分かる */
.howto { list-style: none; padding: 0; margin: 10px 0; counter-reset: step; display: grid; gap: 8px; }
.howto li {
  counter-increment: step;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 16px; background: #fff6d8;
  font-size: 16px; font-weight: 800; text-align: left; line-height: 1.3;
}
.howto li::before {
  content: counter(step);
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: #ff7a3c; color: #fff; font-size: 20px; font-weight: 900;
  border: 3px solid #2b2140;
}
.howto li b { color: #e8323c; }
.howto li small { margin-left: auto; padding-left: 6px; font-size: 12px; color: #8a6a20; white-space: nowrap; }

/* 飛行中の距離：右上の音ボタンにかからないよう左右をあけ、長い桁でも1行に収める */
#distance { padding: 0 72px; font-size: clamp(18px, 5.4vw, 40px); white-space: nowrap; overflow: hidden; text-overflow: clip; }
/* 結果の点数：桁が多い時も読みやすい大きさで折り返す */
#resDist { font-size: clamp(24px, 7vw, 42px); }

/* 横長画面：お題カードはキャラの足元にかからないよう右下へ */
@media (min-aspect-ratio: 4/5) {
  #qte { left: auto; right: max(24px, 4vw); transform: none; width: min(34vw, 340px); }
}
#msg { -webkit-text-stroke-width: 7px; }
/* 縦画面：距離は音ボタンの下の段に置く */
@media (max-aspect-ratio: 4/5) {
  #distance { top: calc(max(10px, env(safe-area-inset-top)) + 66px); padding: 0 10px; font-size: clamp(18px, 6vw, 34px); }
}

/* =====================================================================
   文字の設計：「選ぶ」所と「作り込む」所を分ける
   - 選ぶ（読ませる文字）: 説明・結果の内訳・ボタン → 丸ゴシックで読みやすさ優先（--font-ui）
   - 作り込む（演出の文字）: 回転数・コンボ・ハンコ・掛け声・タイトル → 太く詰まった書体に
     光沢のグラデーション＋濃い縁＋立体の影を重ねる（--font-fx / --font-logo）
   外部フォントは読み込まず、各OSの標準フォントから太いものを選ぶ。
   ===================================================================== */
:root {
  --ink: #2b2140;
  --font-ui: "Hiragino Maru Gothic ProN", "BIZ UDPGothic", "Meiryo", "Noto Sans JP", system-ui, sans-serif;
  /* 数字・英字：細長く太い書体（iPhone/Mac=Futura Condensed ExtraBold、Windows=Impact） */
  --font-num: "Futura-CondensedExtraBold", "Futura Condensed ExtraBold", "AvenirNextCondensed-Heavy", "Avenir Next Condensed", Impact, "Arial Black", sans-serif;
  /* 日本語の演出：一番太いゴシック（iPhone/Mac=ヒラギノ角ゴ W9、Android=Noto Sans JP Black） */
  --font-jp: "Hiragino Sans", "Hiragino Kaku Gothic StdN", "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif;
  --font-fx: var(--font-num), var(--font-jp);
  /* 光沢グラデーション：上半分に明るい帯、境目はくっきり（ゲームのロゴ・数字らしい質感） */
  --gloss-gold: linear-gradient(180deg, #fffde0 0%, #fff27a 38%, #ffc21a 40%, #ff8a1f 78%, #ff5a1f 100%);
  --gloss-pink: linear-gradient(180deg, #ffe3f4 0%, #ff8ad8 38%, #ff3c8a 40%, #c8176e 100%);
  --gloss-cyan: linear-gradient(180deg, #f0ffff 0%, #9ff3ff 38%, #3dc6ff 40%, #1a6fe0 100%);
  --gloss-white: linear-gradient(180deg, #ffffff 0%, #ffffff 40%, #dfe8ff 42%, #b6c6f0 100%);
}
html, body { font-family: var(--font-ui); }

/* ---------- 演出の文字（共通の仕上げ） ---------- */
.pop, #stamp, #msg, #banner, #revs, #timerWrap, #distance {
  font-family: var(--font-fx);
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.01em;
  color: transparent !important;
  background-image: var(--gloss-gold);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-stroke: 0 !important;
  text-shadow: none !important;
  /* 縁（4方向）＋立体の厚み（右下へずらした濃い影）。transform と一緒に動くので重ねても軽い */
  filter: drop-shadow(2px 0 0 var(--ink)) drop-shadow(-2px 0 0 var(--ink)) drop-shadow(0 2px 0 var(--ink)) drop-shadow(0 -2px 0 var(--ink)) drop-shadow(2px 4px 0 var(--ink));
  padding: 0 0.12em; /* 斜体の右端が切れないように */
}
#msg, #banner { font-family: var(--font-jp); }
#stamp { filter: drop-shadow(3px 0 0 var(--ink)) drop-shadow(-3px 0 0 var(--ink)) drop-shadow(0 3px 0 var(--ink)) drop-shadow(0 -3px 0 var(--ink)) drop-shadow(4px 7px 0 var(--ink)) drop-shadow(0 0 18px rgba(255, 220, 120, 0.6)); }
#banner { background-image: var(--gloss-white); }
#distance { background-image: var(--gloss-white); }
#timerWrap small, #revs small { font-size: 0.5em; margin-left: 0.15em; }

/* 種類ごとの色 */
.pop.t2, .pop.lv, .pop.unit { background-image: var(--gloss-gold); }
.pop.t3, .pop.unit.u3 { background-image: var(--gloss-pink); }
.pop.combo, .pop.unit.u2 { background-image: var(--gloss-cyan); }
.pop.boom { background-image: var(--gloss-gold); font-size: 80px; }
.pop.qok { background-image: var(--gloss-gold); }
#stamp.perfect, #stamp.fever, #stamp.tier3, #stamp.tier5 { background-image: var(--gloss-pink); }
#stamp.great, #stamp.count, #stamp.tier { background-image: var(--gloss-gold); }
#stamp.goal, #stamp.tier4 { background-image: var(--gloss-cyan); }
#banner.goal { background-image: var(--gloss-cyan); }
#timerWrap.hurry { background-image: var(--gloss-pink); }

/* 回転数（見かけの数）：パワーゲージの下で一番目立つ数字にする */
#revs { font-size: clamp(26px, 8vw, 40px); line-height: 1.1; white-space: nowrap; display: inline-block; }
.pop.unit { font-size: 24px; font-family: var(--font-jp); }
.pop.t1, .pop.t2, .pop.t3 { font-size: 30px; }

/* ---------- タイトル画面：ロゴは場面の上に浮かせ、説明はその下のカードへ ---------- */
#title.panel {
  background: none; border: none; box-shadow: none; padding: 0;
  width: min(94vw, 480px); max-height: 100vh; overflow: visible;
}
.title-card {
  padding: 16px 18px 14px; border-radius: 28px;
  background: rgba(255, 255, 255, 0.95); border: 5px solid var(--ink);
  box-shadow: 0 8px 0 var(--ink), 0 20px 40px rgba(0, 0, 0, 0.25);
}
.title-card .lead { margin-top: 0; }

#logo {
  position: relative;
  margin: 0 0 14px;
  padding: 0;
  font-size: clamp(64px, 21vw, 112px);
  line-height: 1;
  text-align: center;
  color: inherit; text-shadow: none; -webkit-text-stroke: 0; letter-spacing: 0;
  transform: perspective(700px) rotateX(12deg) rotate(-5deg);
  animation: logoin 0.7s cubic-bezier(0.2, 1.5, 0.4, 1) both, logofloat 2.6s ease-in-out 0.7s infinite;
}
@keyframes logoin { from { transform: perspective(700px) rotateX(70deg) rotate(-5deg) scale(0.4); opacity: 0; } }
@keyframes logofloat { 50% { transform: perspective(700px) rotateX(12deg) rotate(-3deg) translateY(-6px); } }

/* 背後の放射光（ゆっくり回る） */
.lg-burst {
  position: absolute; left: 50%; top: 58%; width: 150%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(rgba(255, 245, 160, 0.75) 0deg 9deg, rgba(255, 245, 160, 0) 9deg 22deg);
  -webkit-mask-image: radial-gradient(circle, #000 18%, transparent 62%);
  mask-image: radial-gradient(circle, #000 18%, transparent 62%);
  animation: burst 14s linear infinite;
  z-index: -1;
  pointer-events: none;
}
@keyframes burst { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* 立体文字の部品：
   ::before = 濃い太縁＋奥へ伸びる厚み（影を何枚も重ねて押し出す）
   ::after  = 光沢グラデーションの表面＋白いふち＋流れる光 */
.lt { position: relative; display: inline-block; color: transparent; font-family: var(--font-jp); font-weight: 900; }
.lt::before, .lt::after { content: attr(data-t); position: absolute; left: 0; top: 0; white-space: nowrap; }
.lt::before {
  color: var(--ext, #6a1b3c);
  -webkit-text-stroke: 0.2em var(--ink);
  text-shadow:
    0.02em 0.02em 0 var(--ext, #6a1b3c), 0.04em 0.04em 0 var(--ext, #6a1b3c), 0.06em 0.06em 0 var(--ext, #6a1b3c),
    0.08em 0.08em 0 var(--ext, #6a1b3c), 0.1em 0.1em 0 var(--ink), 0.11em 0.12em 0 var(--ink),
    0.12em 0.16em 0.12em rgba(0, 0, 0, 0.35);
}
.lt::after {
  color: transparent;
  background: linear-gradient(110deg, transparent 38%, rgba(255, 255, 255, 0.95) 46%, transparent 54%) no-repeat, var(--face, var(--gloss-gold));
  background-size: 250% 100%, 100% 100%;
  background-position: 150% 0, 0 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-stroke: 0.035em #fff;
  animation: shine 3.2s ease-in-out 1s infinite;
}
@keyframes shine { 0% { background-position: 150% 0, 0 0; } 40%, 100% { background-position: -60% 0, 0 0; } }

/* 1段目「超絶怒涛の」：斜めのリボンに白文字 */
.lg-top {
  display: inline-block;
  position: relative;
  margin-bottom: 0.08em;
  padding: 0.06em 0.45em 0.1em;
  font-size: 0.34em;
  background: linear-gradient(180deg, #ff5a5a, #d81f3a);
  border: 0.09em solid var(--ink);
  border-radius: 0.25em;
  box-shadow: 0.08em 0.14em 0 var(--ink);
  transform: skewX(-12deg) rotate(-3deg);
}
.lg-top .lt { --face: var(--gloss-white); --ext: #8a0f2a; letter-spacing: 0.06em; }
.lg-top .lt::before { -webkit-text-stroke-width: 0.16em; }

/* 2段目「Gスイング！」 */
.lg-main { display: block; white-space: nowrap; }
.lg-g { position: relative; display: inline-block; margin-right: 0.02em; }
.lt.g { font-family: var(--font-num); font-style: italic; font-size: 1.45em; --face: var(--gloss-pink); --ext: #5a0a3a; padding: 0 0.06em; }
.lt.sw { font-size: 0.82em; --face: var(--gloss-gold); --ext: #8a3a00; letter-spacing: -0.04em; }
.lt.ex { font-size: 0.9em; --face: var(--gloss-pink); --ext: #5a0a3a; transform: rotate(10deg); }
/* G の後ろで回る矢印の輪（回転＝スイングの印） */
.lg-ring {
  position: absolute; left: 50%; top: 52%; width: 1.5em; height: 1.5em;
  transform: translate(-50%, -50%);
  overflow: visible;
  animation: ringspin 2.4s linear infinite;
  z-index: -1;
}
.lg-ring circle { fill: rgba(255, 240, 120, 0.25); stroke: #fff07a; stroke-width: 7; stroke-dasharray: 46 32; }
.lg-ring path { fill: #fff07a; stroke: var(--ink); stroke-width: 2; }
@keyframes ringspin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* 横長画面：ロゴを左、説明カードを右に並べる */
@media (min-aspect-ratio: 5/4) {
  #title.panel { width: min(94vw, 1040px); display: flex; align-items: center; gap: 28px; }
  #logo { flex: 1 1 52%; font-size: clamp(70px, 9vw, 130px); margin: 0; }
  .title-card { flex: 1 1 48%; max-height: 92vh; overflow-y: auto; }
}

@media (prefers-reduced-motion: reduce) {
  #logo, .lg-burst, .lg-ring, .lt::after { animation: none !important; }
}
#logo { font-size: clamp(52px, 16.5vw, 104px); }
.title-card { background: #fffdf6; position: relative; z-index: 1; }
.lg-burst { width: 125%; }
.lg-ring { width: 1.95em; height: 1.95em; }
/* ハンコ文字は画面幅に収める（長い日本語でもはみ出さない大きさ） */
#stamp { font-size: clamp(38px, 11.5vw, 92px); }
#stamp.count { font-size: clamp(80px, 26vw, 170px); }
/* 結果の点数：演出の文字として作り込む（ゲームの主役の数字） */
#resDist {
  font-family: var(--font-num), var(--font-jp);
  font-style: italic;
  font-size: clamp(26px, 7.4vw, 46px);
  color: transparent;
  background-image: var(--gloss-gold);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(2px 0 0 var(--ink)) drop-shadow(-2px 0 0 var(--ink)) drop-shadow(0 2px 0 var(--ink)) drop-shadow(0 -2px 0 var(--ink)) drop-shadow(2px 4px 0 var(--ink));
  padding: 0 0.15em;
}
#resRank { font-family: var(--font-num); font-style: italic; }
#resDist { font-size: clamp(22px, 6.3vw, 44px); }

/* v1.3: keep the new logo, frame play clearly, reserve spectacle for a hit. */
#hud { padding: 8px 76px 8px 14px; align-items: stretch; gap: 4px; }
#timerWrap { position: absolute; top: 8px; left: 16px; font-size: 38px; }
#powerWrap { width: min(100%, 380px); margin: 0 auto; padding-left: 48px; }
#powerLabel { font-size: 14px; }
#powerBar { height: 15px; border-width: 2px; margin: 4px 0 5px; }
#revs { font-size: clamp(22px, 6.4vw, 32px); }
#msg, #banner { font-size: clamp(22px, 6vw, 34px); top: 20%; }
#stamp.count { top: 28%; font-size: clamp(72px, 22vw, 126px); }
.pop.t1, .pop.t2, .pop.t3, .pop.lv, .pop.unit { font-size: clamp(21px, 5.6vw, 30px); }
.pop.combo { font-size: clamp(24px, 6.4vw, 36px); }
.pop.boom { font-size: clamp(38px, 10vw, 62px); }
#fever { opacity: 0; }
#fever.on { animation: visual-fever 1.2s ease-in-out infinite alternate; }
@keyframes visual-fever { from { opacity: .12; } to { opacity: .28; } }
@media (prefers-reduced-motion: reduce) { #fever.on { animation: none; opacity: .12; } }
#distance { font-size: clamp(19px, 5.5vw, 32px); }
#qteCard { box-shadow: 0 7px 0 #2b2140, 0 12px 24px #19255322; }
#qteCard.hit { background: radial-gradient(circle at 35% 10%, #efffff, #9dfcc5 70%); }
#qteCard.miss { background: #eef0f8; }
#qteLabel { font-size: clamp(23px, 6.6vw, 32px); }
@media (min-aspect-ratio: 6/5) {
  #hud { max-width: 480px; right: auto; width: 45vw; }
  #stick { left: auto; right: max(24px, env(safe-area-inset-right)); width: min(32vh, 210px); height: min(32vh, 210px); transform: none; }
  #msg, #banner { top: 18%; }
  #qte { bottom: 24px; width: min(32vw, 300px); }
}

.impact-burst { position: fixed; pointer-events: none; width: 0; height: 0; z-index: 1; }
.impact-ring, .impact-ray { position: absolute; display: block; opacity: 0; pointer-events: none; }
.impact-ring { width: 160px; height: 160px; border: 5px solid currentColor; border-radius: 50%; box-shadow: 0 0 0 2px #fff, 0 0 18px currentColor; }
.impact-ring:nth-child(2) { border-width: 2px; border-style: dashed; box-shadow: none; }
.impact-ray { width: 5px; height: 34px; border-radius: 50%; background: linear-gradient(#fff, currentColor); transform-origin: center; }

/* Reward card: one record, one trophy, then an optional compact breakdown. */
#result.panel { width: min(92vw, 460px); padding: 22px 22px 16px; border: 3px solid #e5edff; border-radius: 28px; color: #e8edff; background: radial-gradient(ellipse at 50% 8%, #344879, transparent 50%), linear-gradient(150deg, #1c2445, #10172d); box-shadow: 0 8px 0 #080d20, 0 0 0 8px #8ad9ff12, 0 22px 60px #0008; max-height: calc(100dvh - 34px); overflow-y: auto; touch-action: pan-y; }
#result * { touch-action: pan-y; }
#result .res-label { color: #b9c9ef; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; }
.res-trophy { width: 82px; height: 82px; position: relative; margin: 12px auto 9px; }
.trophy-core { display: block; position: absolute; inset: 8px; border-radius: 50%; background: radial-gradient(circle at 29% 24%, #fff 0 10%, #dcefff 36%, #73aacd 69%, #3b577d); box-shadow: inset -8px -8px 0 #29487433, 0 0 28px #82dcff55; }
.trophy-core::before, .trophy-core::after { content: ''; position: absolute; border-radius: 50%; background: #6b94b233; box-shadow: inset 2px 3px 0 #51759922; }
.trophy-core::before { width: 17px; height: 17px; left: 12px; top: 13px; }
.trophy-core::after { width: 11px; height: 11px; right: 15px; bottom: 14px; }
.trophy-orbit { position: absolute; inset: -6px; border: 2px solid #87ebff; border-radius: 50%; transform: rotate(-24deg) scaleY(.44); box-shadow: 0 0 15px #76d7fa55; z-index: 1; }
.trophy-spark { position: absolute; right: -12px; top: -10px; width: 26px; height: 30px; background: #fff0a0; clip-path: polygon(50% 0, 62% 36%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 36%); }
#result[data-rank='S'] .trophy-core, #result[data-rank='SS'] .trophy-core { background: radial-gradient(circle at 30% 24%, #fff, #8bffff 40%, #30bbb7 72%, #18768b); }
#result .res-row { display: block; min-width: 0; }
#resRank { position: absolute; left: 24px; top: 48px; width: 64px; height: 64px; font-size: 43px; line-height: 58px; border-width: 3px; color: #ffdf75; border-color: #ffdf75; background: #202a4f; box-shadow: 0 0 20px #ffe99320; }
#resDist { display: flex; align-items: baseline; justify-content: center; gap: 6px; width: 100%; min-width: 0; min-height: 48px; white-space: nowrap; word-break: normal; overflow-wrap: normal; font-family: var(--font-num); line-height: 1.15; color: #fff1a5; background: none; -webkit-text-fill-color: currentColor; -webkit-text-stroke: 0; text-shadow: 0 3px 0 #5e381c; filter: none; }
#resScoreValue { display: inline-block; min-width: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.score-unit { flex: none; font-size: 15px; color: #a8badc; text-shadow: none; }
#resKm { color: #abbddb; font-size: 12px; margin: 0 0 9px; min-height: 16px; }
#resTitle { color: #fff; font-size: clamp(20px, 5.5vw, 26px); margin: 5px 0 10px; }
#resGoal { color: #b6d4e9; font-size: 12px; line-height: 1.5; margin: 5px 0 8px; }
#goalProg { background: #080f27; height: 22px; border: 1px solid #5478a7; }
#goalFill { background: linear-gradient(90deg, #328cdb, #71ebf1); }
#goalPct { color: #fff; font-size: 11px; text-shadow: 0 1px 2px #06162b; }
#resHint { margin: 12px 0 6px; padding: 10px 12px; background: #a9d2ff13; border: 1px solid #94b8e329; color: #d5e5ff; font-size: 12px; line-height: 1.6; font-weight: 600; }
#resDetails { margin: 10px 0; color: #b7c8e5; font-size: 12px; text-align: left; }
#resDetails summary { cursor: pointer; padding: 8px; border-radius: 10px; background: #080f232e; font-size: 12px; color: #b7c8e5; }
#resStats { grid-template-columns: 1fr 1fr; justify-content: stretch; gap: 7px 10px; margin: 12px 2px; font-size: 12px; }
#resStats dt { color: #a6bbdc; text-align: left; }
#resStats dd { color: #f1f4ff; text-align: right; }
#resBest { color: #99b5d5; font-size: 11px; overflow-wrap: anywhere; text-align: center; }
#result .big-btn { min-height: 56px; border: 2px solid #fff3a2; border-radius: 18px; font-size: 24px; background: linear-gradient(#ffdb76, #ff9d43); color: #542d2a; text-shadow: 0 1px #ffe9b5; box-shadow: 0 5px 0 #945231; margin-top: 14px; }
#result .sub-btn { min-height: 36px; padding: 0 18px; border-width: 1px; background: transparent; color: #aebedf; border-color: #7385ab; font-size: 13px; margin-top: 8px; }
@media (max-height: 650px) {
  #result.panel { padding: 15px 18px 12px; }
  .res-trophy { width: 64px; height: 64px; margin: 7px auto; }
  #resRank { top: 36px; width: 56px; height: 56px; font-size: 36px; line-height: 50px; }
  #resTitle { margin: 3px 0 6px; }
  #resHint { margin-top: 7px; padding: 7px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  #msg.show { animation: fadeonly .9s ease-out forwards !important; }
  #banner.show { animation: fadeonly 1.1s ease-out forwards !important; }
  #retryBtn.ready, #timerWrap.hurry { animation: none !important; }
}

/* v1.4 案9：結果は「大きなランクのハンコ → 点数 → 称号 → 内訳 → もう一回」の順に読ませる */
#result.panel { position: relative; }
#result .res-trophy { position: absolute; right: 18px; top: 14px; width: 54px; height: 54px; margin: 0; }
#result .res-row { display: flex; flex-direction: column; align-items: center; gap: 4px; }
#resRank {
  position: relative; left: auto; top: auto;
  width: clamp(96px, 30vw, 128px); height: clamp(96px, 30vw, 128px);
  margin: 6px auto 2px; border-width: 6px; border-radius: 50%;
  font-size: clamp(62px, 20vw, 86px); line-height: clamp(84px, 27vw, 114px);
  font-family: var(--font-num); font-style: italic; text-align: center;
  transform: rotate(-12deg);
  box-shadow: 0 0 0 4px #10172d, 0 0 0 7px currentColor, 0 0 34px currentColor;
}
#resRank.rank-SS, #resRank.rank-S { color: #ff5fb0; border-color: #ff5fb0; background: radial-gradient(circle at 35% 30%, #4a2350, #241238); }
#resRank.rank-A { color: #ffb347; border-color: #ffb347; background: radial-gradient(circle at 35% 30%, #4a3520, #2a1c12); }
#resRank.rank-B { color: #6fb6ff; border-color: #6fb6ff; background: radial-gradient(circle at 35% 30%, #20365a, #121d34); }
#resRank.rank-C, #resRank.rank-D { color: #c9d2e6; border-color: #c9d2e6; background: #202a4f; }
#resRank.rank-SS { font-size: clamp(48px, 15vw, 66px); }
@media (max-height: 650px) {
  #resRank { width: 84px; height: 84px; font-size: 56px; line-height: 72px; border-width: 5px; }
  #result .res-trophy { width: 42px; height: 42px; }
}
#resRank::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 4px solid currentColor; opacity: 0; pointer-events: none; }
#resRank.stamped::after { animation: rankring 0.6s 0.24s ease-out both; }
@keyframes rankring { from { transform: scale(0.9); opacity: 0.9; } to { transform: scale(1.9); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #resRank.stamped::after { animation: none; } }

/* v1.4 案8：回し方の見本。指の絵がスティックのまわりを回る（説明より体験で教える） */
#stickGuide { position: absolute; inset: -8%; pointer-events: none; }
#stickGuide .guide-arc { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#stickGuide .guide-arc path { fill: none; stroke: #fff07a; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 9 7; filter: drop-shadow(0 2px 0 #2b2140); }
#stickGuide .guide-arc path.tip { fill: #fff07a; stroke: #2b2140; stroke-width: 2; stroke-dasharray: none; }
#stickGuide .guide-orbit { position: absolute; inset: 0; animation: guideorbit 1.25s linear infinite; }
#stickGuide .guide-finger { position: absolute; left: 50%; top: 2%; width: 26%; height: 26%; transform: translate(-50%, -10%) rotate(-20deg); fill: #fff; stroke: #2b2140; stroke-width: 4; stroke-linejoin: round; filter: drop-shadow(0 3px 0 #2b2140); }
@keyframes guideorbit { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #stickGuide .guide-orbit { animation: none; } }

/* v1.4 案6：飛行中の「次の目印まで」。読ませる文字なので丸ゴシック、バーだけ光らせる */
#nextMark {
  position: fixed; left: 0; right: 0; margin: 0 auto; /* 中央寄せは transform を使わない（弾む演出と両立） */
  top: calc(max(14px, env(safe-area-inset-top)) + clamp(40px, 7vw, 54px));
  width: min(90vw, 440px); padding: 6px 10px 8px; border-radius: 14px;
  background: rgba(16, 23, 45, 0.55); border: 2px solid rgba(255, 255, 255, 0.5);
  color: #fff; font-family: var(--font-ui); font-weight: 800; font-size: clamp(12px, 3.4vw, 16px);
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none; z-index: 10;
}
#nextBar { margin-top: 5px; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.22); overflow: hidden; }
#nextFill { display: block; height: 100%; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, #6ff2ff, #fff07a); }
#nextMark.goal { border-color: #fff07a; box-shadow: 0 0 16px rgba(255, 240, 122, 0.6); }
#nextMark.goal #nextFill { background: linear-gradient(90deg, #8fe3ea, #ff8ad8, #fff07a); }
@media (max-aspect-ratio: 4/5) {
  #nextMark { top: calc(max(10px, env(safe-area-inset-top)) + 66px + clamp(34px, 8vw, 44px)); }
}

/* v1.4 案10：手の熱。たまり始めると赤く、すべる状態では燃えるように脈打つ */
#powerWrap.heat #powerBar { border-color: #ffb36b; box-shadow: 0 0 12px #ff7a3c; }
#powerWrap.slip #powerBar { border-color: #ff3c3c; box-shadow: 0 0 18px #ff3c3c, 0 0 4px #fff; animation: heatpulse 0.35s ease-in-out infinite alternate; }
#powerWrap.slip #powerLabel::after { content: ' 手がアツい!!'; color: #ff6b6b; }
@keyframes heatpulse { to { box-shadow: 0 0 28px #ff3c3c, 0 0 8px #fff; } }
#gauge.slip #gaugeBar { box-shadow: 0 0 0 4px #ff3c3c, 0 0 18px #ff3c3c; }
#gauge.slip #gaugeHelp { color: #ffb3b3; }
@media (prefers-reduced-motion: reduce) { #powerWrap.slip #powerBar { animation: none; } }

/* v1.4 案7：回転数は競技場の電光掲示板へ移した（HUDはパワーと残り秒数だけ） */
#revs { display: none; }
/* 掛け声・段階名は掲示板と重ならない帯へ */
@media (max-aspect-ratio: 4/5) {
  #msg { top: 14%; }
  #banner { top: 13%; }
}
@media (min-aspect-ratio: 4/5) {
  #msg { top: 31%; }
  #banner { top: 29%; }
}
/* 飛行中の通過表示は「次の目印まで」の枠の下に出す */
body.flying #banner { top: calc(max(10px, env(safe-area-inset-top)) + 160px); }
@media (min-aspect-ratio: 4/5) { body.flying #banner { top: auto; bottom: calc(max(20px, env(safe-area-inset-bottom)) + 48px); } }

/* 横向きのスマホなど背の低い画面：ランクと点数を横に並べて、「もう一回！」を画面内に残す */
@media (max-height: 480px) {
  #result.panel { padding: 10px 16px 10px; }
  #result .res-trophy { display: none; }
  #result .res-row { flex-direction: row; flex-wrap: nowrap; justify-content: center; gap: 12px; }
  #resGoal { display: none; }
  #resRank { width: 60px; height: 60px; font-size: 38px; line-height: 50px; border-width: 4px; margin: 0; flex: none; }
  #resDist { flex: 1 1 auto; width: auto; min-width: 0; min-height: 0; }
  #resKm { margin-bottom: 4px; }
  #resTitle { margin: 2px 0 4px; font-size: 18px; }
  #resGoal { margin: 2px 0 4px; }
  #resHint { margin: 6px 0 4px; padding: 6px 10px; }
  #resDetails { margin: 4px 0; }
  #result .big-btn { margin-top: 6px; min-height: 46px; }
}

/* v1.5 案4：手のアツさの目盛り。端まで届くと手がすべり、★が速くなる */
#heatMeter { display: flex; align-items: center; gap: 6px; margin: 2px auto 0; width: 100%; font-size: 11px; font-weight: 900; color: #fff; text-shadow: 0 1px 0 var(--ink), 1px 0 0 var(--ink), -1px 0 0 var(--ink), 0 -1px 0 var(--ink); }
#heatLabel { flex: none; }
#heatBar { position: relative; flex: 1; height: 8px; border-radius: 4px; border: 2px solid var(--ink); background: rgba(255, 255, 255, 0.55); overflow: hidden; }
#heatFill { height: 100%; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, #ffd23f, #ff7a3c 60%, #ff3c3c); }
#heatLine { position: absolute; right: 0; top: 0; bottom: 0; width: 4px; background: #ff3c3c; }
#powerWrap.heat #heatLabel, #powerWrap.slip #heatLabel { color: #ffd0b0; }
#powerWrap.slip #heatBar { border-color: #ff3c3c; box-shadow: 0 0 10px #ff3c3c; }

/* v1.5 案5：ボタンはタイトルの立体文字と同じ「濃い縁＋ずらした影」で作る */
.big-btn {
  border: 4px solid var(--ink); border-radius: 22px;
  background: linear-gradient(180deg, #ffd35a 0%, #ffa23c 45%, #ff6a3c 100%);
  color: #fff; font-family: var(--font-jp); font-weight: 900; letter-spacing: 0.04em;
  text-shadow: 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink), 2px 3px 0 var(--ink);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.55), 0 6px 0 var(--ink);
}
.big-btn:active { transform: translateY(4px); box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.55), 0 2px 0 var(--ink); }
#result .big-btn {
  min-height: 60px; border: 4px solid var(--ink); border-radius: 20px; font-size: 26px;
  background: linear-gradient(180deg, #ffd35a 0%, #ffa23c 45%, #ff6a3c 100%); color: #fff;
  text-shadow: 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink), 2px 3px 0 var(--ink);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.55), 0 6px 0 var(--ink), 0 0 0 3px #fff;
}
#result .big-btn:active { transform: translateY(4px); box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.55), 0 2px 0 var(--ink), 0 0 0 3px #fff; }
#result .sub-btn { min-height: 38px; padding: 0 20px; border: 3px solid var(--ink); border-radius: 19px; background: #fff; color: var(--ink); font-weight: 900; font-size: 14px; box-shadow: 0 3px 0 var(--ink); margin-top: 12px; }
#result .sub-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

/* 結果カードもタイトルカードと同じ太い縁で囲む（暗い宇宙でも縁が見えるよう白い線を足す） */
#result.panel { border: 4px solid #fff; box-shadow: 0 0 0 4px var(--ink), 0 10px 0 4px var(--ink), 0 22px 50px #0008; }
/* 称号はロゴ1段目と同じ斜めのリボン */
#resTitle {
  display: table; margin: 8px auto 10px; padding: 0.12em 0.7em 0.16em;
  font-family: var(--font-jp); font-weight: 900; color: #fff;
  background: linear-gradient(180deg, #ff5a5a, #d81f3a); border: 3px solid var(--ink); border-radius: 8px;
  box-shadow: 3px 5px 0 var(--ink); transform: skewX(-10deg) rotate(-2deg);
  text-shadow: 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink);
}

/* v1.5 案3：もう一回の動機。自己ベストとの差と、次のランクまでを札で見せる */
#resChase { display: flex; flex-direction: column; gap: 6px; align-items: center; margin: 2px 0 6px; }
#resChase.hidden { display: flex !important; visibility: hidden; }
#resChase p {
  margin: 0; padding: 4px 12px; border: 3px solid var(--ink); border-radius: 12px; box-shadow: 0 3px 0 var(--ink);
  font-family: var(--font-jp); font-weight: 900; font-size: clamp(12px, 3.5vw, 15px); line-height: 1.35;
  color: var(--ink); max-width: 100%; overflow-wrap: anywhere;
}
#chaseBest { background: linear-gradient(180deg, #fffde0, #ffe27a); }
#resChase[data-best='new'] #chaseBest { background: linear-gradient(180deg, #ffe3f4, #ff8ad8); }
#chaseRank { background: linear-gradient(180deg, #f0ffff, #9ff3ff); }
#resChase.enter p { animation: chasein 0.42s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
#resChase.enter p + p { animation-delay: 0.12s; }
@keyframes chasein { from { transform: translateY(10px) scale(0.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #resChase.enter p { animation: none; } }
@media (max-height: 650px) { #resChase { gap: 4px; } #resChase p { padding: 2px 10px; font-size: 12px; } }
@media (max-height: 480px) {
  #resChase { flex-direction: row; justify-content: center; flex-wrap: wrap; margin: 0 0 4px; }
  #resTitle { margin: 2px auto 4px; }
}
/* 背の低い画面では、次の目標の札と重なる情報（天王星までの1行・進み具合のバー）を省いて「もう一回！」を画面内に残す */
@media (max-height: 650px) {
  #resGoal { display: none; }
  #resTitle { font-size: 18px; margin: 4px auto 6px; }
  #resKm { margin-bottom: 4px; }
  #result .big-btn { min-height: 50px; margin-top: 8px; font-size: 22px; }
  #result .sub-btn { margin-top: 10px; min-height: 34px; }
}
@media (max-height: 480px) {
  #goalProg { display: none; }
  #resTitle { font-size: 15px; margin: 0 auto 4px; }
  #resHint { font-size: 11px; line-height: 1.4; }
  #result .big-btn { min-height: 44px; margin-top: 4px; }
  #result .sub-btn { margin-top: 8px; min-height: 30px; }
}

/* v2.0 ①②③④：ばらばらの位置に出る番号を1から順に押す。ボタンはタイトルと同じ「濃い縁＋ずらした影」 */
#padArea {
  position: fixed; left: 5%; right: 5%; top: 40%; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 92px);
  z-index: 6; pointer-events: none;
}
.pad-btn {
  position: absolute; width: clamp(64px, 19vw, 92px); height: clamp(64px, 19vw, 92px); transform: translate(-50%, -50%);
  border: 4px solid var(--ink); border-radius: 50%; padding: 0; cursor: pointer; pointer-events: auto; touch-action: none;
  background: radial-gradient(circle at 35% 28%, #fffde0 0 18%, #ffe27a 42%, #ffb23c 78%, #ff8a1f);
  box-shadow: inset 0 -5px 0 rgba(180, 70, 0, 0.35), 0 6px 0 var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.pad-btn b {
  display: block; font-family: var(--font-num); font-style: italic; font-weight: 900; line-height: 1;
  font-size: clamp(36px, 11vw, 54px); color: #fff;
  text-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink), 2px 2px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 3px 5px 0 var(--ink);
}
.pad-btn:active { transform: translate(-50%, calc(-50% + 4px)); box-shadow: inset 0 -5px 0 rgba(180, 70, 0, 0.35), 0 2px 0 var(--ink); }
.pad-btn.in { animation: padin 0.24s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.pad-btn.done { background: radial-gradient(circle at 35% 28%, #f0fff4 0 18%, #9dfcc5 50%, #3fbf73); transform: translate(-50%, calc(-50% + 4px)); box-shadow: 0 2px 0 var(--ink); }
.pad-btn.done b { font-size: 0; }
.pad-btn.done b::after { content: '✓'; font-size: clamp(30px, 9vw, 44px); font-style: normal; }
.pad-btn.ng { background: radial-gradient(circle at 35% 28%, #fff0f0 0 18%, #ff8a8a 50%, #e8323c); animation: padng 0.32s ease-in-out; }
@keyframes padin { from { transform: translate(-50%, -50%) scale(0.2); opacity: 0; } }
@keyframes padng { 25% { transform: translate(-60%, -50%) rotate(-8deg); } 75% { transform: translate(-40%, -50%) rotate(8deg); } }
/* 進み具合のカード（セット数・残り時間）は画面のいちばん下。親指とボタンの邪魔をしない */
#qte { top: auto; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 8px); width: min(88vw, 380px); }
#qteCard { padding: 8px 14px 10px; }
#qteCard #qtePips { margin: 0 0 4px; }
#qteLabel { font-size: clamp(17px, 5vw, 22px); }
#qteCard.intro #qteLabel { font-size: clamp(18px, 5.4vw, 24px); }
#qteTime { margin-top: 6px; height: 12px; }
@media (min-aspect-ratio: 6/5) {
  #padArea { left: 52%; right: 4%; top: 16%; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 96px); }
  #qte { left: auto; right: 4vw; transform: none; width: min(40vw, 360px); }
  .pad-btn { width: clamp(60px, 11vh, 92px); height: clamp(60px, 11vh, 92px); }
}
@media (prefers-reduced-motion: reduce) { .pad-btn.in, .pad-btn.ng { animation: none; } }

/* v2.0 経験値とレベル（結果カード） */
#resXp { margin: 4px 0 6px; }
#xpGain { margin: 0 0 3px; font-family: var(--font-jp); font-weight: 900; font-size: clamp(13px, 3.8vw, 16px); color: #fff07a; text-shadow: 0 2px 0 var(--ink); }
#xpBar { position: relative; height: 16px; border: 3px solid var(--ink); border-radius: 9px; background: #0a1230; overflow: hidden; box-shadow: 0 0 0 2px #fff; }
#xpFill { height: 100%; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, #3dc6ff, #9ff3ff); transition: transform 0.6s ease-out; }
#xpLv { position: absolute; inset: 0; font-family: var(--font-num); font-style: italic; font-weight: 900; font-size: 12px; line-height: 10px; color: #fff; text-shadow: 0 1px 0 var(--ink), 1px 0 0 var(--ink), -1px 0 0 var(--ink); }
#lvUp { display: inline-block; margin: 6px 0 0; padding: 3px 10px; border: 3px solid var(--ink); border-radius: 10px; background: var(--gloss-pink); color: #fff; font-weight: 900; font-size: clamp(12px, 3.4vw, 14px); box-shadow: 0 3px 0 var(--ink); text-shadow: 0 1px 0 var(--ink), 1px 0 0 var(--ink), -1px 0 0 var(--ink); }
#lvUp.hidden { display: none; }
@media (prefers-reduced-motion: reduce) { #xpFill { transition: none; } }

/* ショップへのボタン（結果・タイトル）。買えるスキルの数を赤い丸で知らせる */
.res-actions { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 12px; }
#result .res-actions .sub-btn { margin-top: 0; }
.shop-btn {
  position: relative; min-height: 42px; padding: 0 18px; border: 3px solid var(--ink); border-radius: 21px; cursor: pointer;
  background: linear-gradient(180deg, #f0ffff 0%, #9ff3ff 45%, #3dc6ff 100%); color: var(--ink);
  font-family: var(--font-jp); font-weight: 900; font-size: 15px; box-shadow: 0 4px 0 var(--ink);
}
.shop-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.shop-btn span { position: absolute; right: -8px; top: -10px; min-width: 22px; height: 22px; padding: 0 5px; border: 2px solid var(--ink); border-radius: 11px; background: #ff3c5a; color: #fff; font-size: 12px; line-height: 18px; }
.shop-btn span.hidden { display: none; }
#titleShopBtn { display: block; margin: 4px auto 6px; }
#titleShopBtn.hidden { display: none; }

/* スキルショップ：タイトルと同じ白いカード＋濃い太縁。系統ごとに色と印 */
#shop.panel {
  width: min(94vw, 480px); max-height: calc(100dvh - 24px); padding: 12px 12px 10px; display: flex; flex-direction: column;
  background: #fffaf0; border: 5px solid var(--ink); border-radius: 26px; box-shadow: 0 8px 0 var(--ink), 0 20px 40px rgba(0, 0, 0, 0.3); color: var(--ink);
}
#shop.panel.hidden { display: none; }
.shop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.shop-title {
  margin: 0; padding: 0.1em 0.6em 0.14em; font-family: var(--font-jp); font-weight: 900; font-size: clamp(17px, 5vw, 21px); color: #fff;
  background: linear-gradient(180deg, #ff5a5a, #d81f3a); border: 3px solid var(--ink); border-radius: 8px; box-shadow: 3px 4px 0 var(--ink);
  transform: skewX(-10deg) rotate(-2deg); text-shadow: 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink);
}
#shopWallet { margin: 0; display: flex; align-items: center; gap: 6px; }
#shopWallet b { padding: 3px 10px; border: 3px solid var(--ink); border-radius: 12px; background: linear-gradient(180deg, #fffde0, #ffe27a); font-size: clamp(13px, 3.8vw, 15px); white-space: nowrap; }
#shopWallet span { font-family: var(--font-num); font-style: italic; font-weight: 900; font-size: 18px; }
#shopList { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 2px 4px 6px; touch-action: pan-y; }
#shopList h3 { margin: 10px 0 5px; font-size: 13px; font-weight: 900; letter-spacing: 0.08em; }
#shopList h3::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 2px solid var(--ink); border-radius: 3px; background: var(--c); vertical-align: -1px; }
.cat-power { --c: #ff5a5a; --g: '力'; }
.cat-spin { --c: #3dc6ff; --g: '回'; }
.cat-ease { --c: #4bbf73; --g: '楽'; }
.cat-auto { --c: #a77bff; --g: '自'; }
.cat-idle { --c: #ffc21a; --g: '弟'; }
.sk {
  position: relative; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 8px; margin: 0 0 7px; padding: 7px 8px;
  border: 3px solid var(--ink); border-radius: 14px; background: #fff; box-shadow: 0 3px 0 var(--ink);
}
.sk > i { width: 34px; height: 34px; border: 3px solid var(--ink); border-radius: 50%; background: var(--c); display: flex; align-items: center; justify-content: center; }
.sk > i::after { content: var(--g); color: #fff; font-style: normal; font-weight: 900; font-size: 16px; text-shadow: 0 1px 0 var(--ink), 1px 0 0 var(--ink), -1px 0 0 var(--ink), 0 -1px 0 var(--ink); }
.sk-body { min-width: 0; text-align: left; line-height: 1.25; }
.sk-body b { font-size: clamp(14px, 4vw, 16px); font-weight: 900; }
.sk-body small { margin-left: 6px; font-size: 11px; font-weight: 800; color: #6a5c80; }
.sk-body span { display: block; font-size: clamp(11px, 3.2vw, 12px); color: #4a3d5c; }
.sk-buy {
  min-width: 74px; min-height: 36px; padding: 0 10px; border: 3px solid var(--ink); border-radius: 18px; cursor: pointer;
  font-family: var(--font-num); font-weight: 900; font-size: 15px; color: #8a8aa0; background: #e9e9f2; box-shadow: 0 3px 0 var(--ink);
}
.sk-buy:disabled { cursor: default; }
.sk-buy.can { color: #fff; background: linear-gradient(180deg, #ffd35a, #ff8a1f); text-shadow: 0 1px 0 var(--ink), 1px 0 0 var(--ink), -1px 0 0 var(--ink), 0 -1px 0 var(--ink); }
.sk-buy.can:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.sk.can { border-color: var(--ink); box-shadow: 0 3px 0 var(--ink), 0 0 0 3px #ffe27a; }
.sk.maxed { opacity: 0.7; }
.sk.locked { border-style: dashed; background: #f0eef6; box-shadow: none; }
.sk.locked > i { background: #b8b4c8; }
.sk.locked > i::after { content: '?'; }
.sk em {
  position: absolute; left: -6px; top: -11px; padding: 1px 8px; border: 2px solid var(--ink); border-radius: 8px; transform: rotate(-6deg);
  background: var(--gloss-pink); color: #fff; font-style: normal; font-weight: 900; font-size: 11px; text-shadow: 0 1px 0 var(--ink);
}
.shop-foot { display: flex; align-items: center; gap: 10px; padding-top: 8px; }
.shop-foot .big-btn { flex: 1; min-height: 52px; margin: 0; font-size: 22px; }
.shop-foot .sub-btn { min-height: 44px; margin: 0; padding: 0 16px; border: 3px solid var(--ink); background: #fff; color: var(--ink); font-weight: 900; box-shadow: 0 3px 0 var(--ink); }
/* 見出しは1行。右上の音ボタンと重ならないよう、その分を空ける */
.shop-head { padding-right: 52px; justify-content: flex-start; flex-wrap: wrap; row-gap: 6px; }
.shop-title { white-space: nowrap; font-size: clamp(15px, 4.4vw, 20px); }
@media (min-width: 600px) { .shop-head { padding-right: 0; justify-content: space-between; } }
@media (max-width: 360px) {
  .sk { grid-template-columns: 32px 1fr auto; gap: 6px; padding: 6px; }
  .sk > i { width: 30px; height: 30px; }
  .sk-buy { min-width: 60px; padding: 0 6px; font-size: 13px; }
  .sk-body small { display: block; margin: 0; }
}
/* 育成モードの結果カード：次の目標の札と経験値バーが伸びしろを示すので、遠すぎる「天王星まで」の1行は出さない。
   背の低い画面ではヒントも省き、「もう一回！」とショップを画面内に残す */
#resGoal { display: none; }
@media (max-height: 700px) {
  #resHint { display: none; }
  #resTitle { margin: 2px auto 6px; }
  #resXp { margin: 2px 0 4px; }
}
@media (max-height: 480px) {
  #chaseRank { display: none; }
  #lvUp { margin-top: 3px; padding: 1px 8px; font-size: 11px; }
  #xpGain { display: inline; margin-right: 6px; }
  .res-actions { margin-top: 6px; }
  .shop-btn { min-height: 34px; font-size: 13px; }
}
@media (max-height: 650px) {
  #result .res-label, #resKm, #resDetails { display: none; }
  #resRank { width: 66px; height: 66px; font-size: 44px; line-height: 54px; border-width: 4px; }
  #resDist { min-height: 0; }
}
.shop-btn, .res-actions .sub-btn { white-space: nowrap; }
@media (max-width: 360px) { .res-actions { gap: 8px; } .shop-btn, .res-actions .sub-btn { padding: 0 12px; font-size: 13px; } }
/* 結果の3ボタン（ショップ・シェア・タイトルへ）がスマホ縦の枠からはみ出さないように。
   #result .sub-btn の指定が強いので、同じ強さで上書きする。それでも入らない幅では2段に折り返す */
#result .res-actions { flex-wrap: wrap; }
@media (max-width: 440px) { #result .res-actions { gap: 6px; } #result .res-actions .shop-btn, #result .res-actions .sub-btn { padding: 0 10px; font-size: 13px; } }
@media (max-width: 360px) { #result .res-actions .shop-btn, #result .res-actions .sub-btn { padding: 0 8px; font-size: 12px; } }

/* v2.0 段階4：オート進行ボタン・弟子の表示・エンディング・やり直し */
#shopWallet small { font-size: 11px; font-weight: 800; color: #6a3fd0; white-space: nowrap; }
.reset-btn { display: block; margin: 4px auto 0; padding: 4px 12px; border: 0; background: none; color: #6a5c80; font: inherit; font-size: 12px; text-decoration: underline; cursor: pointer; }
#ending.panel {
  width: min(92vw, 440px); padding: 22px 18px 18px; text-align: center; z-index: 30;
  background: #fffaf0; border: 5px solid var(--ink); border-radius: 26px; box-shadow: 0 8px 0 var(--ink), 0 20px 40px rgba(0, 0, 0, 0.35); color: var(--ink);
}
#ending.panel.hidden { display: none; }
.end-label { margin: 0; font-family: var(--font-num); font-style: italic; font-weight: 900; letter-spacing: 0.2em; font-size: 13px; color: #d81f3a; }
.end-title {
  margin: 6px 0 10px; font-family: var(--font-jp); font-weight: 900; font-size: clamp(30px, 9vw, 40px); color: #fff;
  text-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink), 3px 3px 0 var(--ink), -3px -3px 0 var(--ink), 3px -3px 0 var(--ink), -3px 3px 0 var(--ink);
  background: linear-gradient(180deg, #ffd84a, #ff7a1a); -webkit-background-clip: text; background-clip: text;
  -webkit-text-stroke: 0; paint-order: stroke fill;
}
.end-body { margin: 6px 0; font-size: clamp(13px, 3.8vw, 15px); font-weight: 800; line-height: 1.6; }
#endThrows { margin: 10px 0; padding: 6px 10px; border: 3px solid var(--ink); border-radius: 12px; background: #ffe27a; font-weight: 900; font-size: clamp(13px, 3.8vw, 15px); }
@media (max-height: 460px) {
  #ending.panel { padding: 10px 14px 12px; max-height: calc(100dvh - 12px); overflow-y: auto; }
  .end-title { margin: 2px 0 4px; font-size: 26px; }
  .end-body { margin: 2px 0; font-size: 12px; line-height: 1.4; }
  #endThrows { margin: 4px 0; padding: 3px 8px; font-size: 12px; }
  #ending .big-btn { margin-top: 4px; }
}

/* タイトル画面の右下にバージョン表示（タイトルが出ている間だけ） */
#verTag { display: none; position: fixed; right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); margin: 0; padding: 3px 9px; font-size: 12px; font-weight: 800; letter-spacing: .04em; color: #fff; background: rgba(32, 30, 56, .72); border-radius: 999px; pointer-events: none; z-index: 31; }
#title:not(.hidden) ~ #verTag { display: block; }

/* v2.1：ショップ上部の「今の効果」一覧と、パワー1あたりの値段 */
#shopBuffs { list-style: none; margin: 0 0 6px; padding: 6px; display: flex; flex-wrap: wrap; gap: 4px; border: 3px solid var(--ink); border-radius: 12px; background: #f1ecff; }
#shopBuffs li { padding: 2px 8px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; font-size: 12px; line-height: 1.3; }
#shopBuffs b { font-weight: 900; }
#shopBuffs small { margin-left: 4px; font-size: 10.5px; font-weight: 700; color: #6a5c80; }
.sk-body .per { display: block; font-style: normal; font-size: 10.5px; font-weight: 800; color: #b23a3a; }
#resBonus { margin: 2px 0 6px; font-family: var(--font-jp); font-size: clamp(12px, 3.6vw, 14px); font-weight: 800; color: #cfe0ff; }
#resBonus b { font-family: var(--font-num); font-style: italic; font-size: 1.5em; color: #fff07a; }
#resBonus[data-q='top'] b { color: #ffd23f; text-shadow: 0 0 10px #ffb30088; }
#resBonus[data-q='low'] b { color: #ff9b9b; }
#resBonus small { display: block; font-size: 11px; color: #a6bbdc; }
#resStats .mult { color: #ffd23f; }

/* ---------- v2.2 結果カード：飛距離が主役。後から出る行も場所を先に取り、ボタンがずれない ---------- */
#result .res-head { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 8px 0 4px; min-height: 84px; }
#result .res-head #resRank { flex: none; margin: 0; width: 76px; height: 76px; font-size: 50px; line-height: 64px; border-width: 5px; }
#result .res-head #resRank.rank-SS { font-size: 38px; }
#result .res-main { flex: 1 1 auto; min-width: 0; text-align: left; }
#result .res-main #resDist { justify-content: flex-start; min-height: 0; }
#result .res-main .score-unit { font-size: 18px; color: #fff1a5; }
#result .res-main #resTitle { margin: 2px 0 0; font-size: clamp(13px, 3.8vw, 16px); color: #cfe0ff; }
#result #resBonus { margin: 0 0 6px; }
.res-slot { visibility: hidden; min-height: 26px; margin: 0; }
.res-slot.on { visibility: visible; }
#resBadge { display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 900; color: #b9c9ef; }
#resBadge[data-best='new'], #resBadge[data-best='first'] { color: #ffe36e; }
#resBadge[data-best='new'].on { animation: badgepop .5s ease-out; }
@keyframes badgepop { from { transform: scale(1.4); } to { transform: scale(1); } }

/* 道のり：目印の点（通過で光る）・ランクの旗・今回の位置（▼）・自己ベスト（★） */
#road { position: relative; height: 54px; margin: 2px 4px 0; --you: 0%; }
#road .road-line { position: absolute; left: 0; right: 0; top: 30px; height: 6px; border-radius: 3px; background: #0a1230; box-shadow: inset 0 0 0 1px #3d5584; overflow: hidden; }
#roadFill { width: 0; height: 100%; background: linear-gradient(90deg, #328cdb, #71ebf1); }
#road.go #roadFill { width: var(--you); transition: width 1.3s cubic-bezier(.2, .7, .3, 1); }
#road .dot { position: absolute; top: 29px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: #2a3a66; box-shadow: 0 0 0 2px #10172d; }
#road .dot.passed { background: #9ff3ff; }
#road .dot.goal { top: 26px; width: 14px; height: 14px; margin-left: -7px; background: #2f6f78; box-shadow: 0 0 0 2px #10172d, 0 0 0 4px #8fe3ea55; }
#road .dot.goal.passed { background: #8fe3ea; box-shadow: 0 0 0 2px #10172d, 0 0 12px #8fe3ea; }
#road .flag { position: absolute; top: 6px; transform: translateX(-50%); padding: 0 3px; border-radius: 5px; font: italic 900 11px/16px var(--font-num); color: #6f7fa6; background: #1a2446; border: 1px solid #34466f; }
#road .flag.got { color: #10172d; background: #ffd23f; border-color: #ffd23f; }
#road .flag[data-rank='A'] { transform: translateX(-20%); }
#road .flag[data-rank='B'] { transform: translateX(-80%); }
#road .flag.next { color: #ffd23f; border-color: #ffd23f; animation: flagpulse 1.2s ease-in-out infinite; }
@keyframes flagpulse { 50% { box-shadow: 0 0 10px #ffd23f; } }
#roadYou { position: absolute; top: 38px; left: 0; width: 0; height: 0; margin-left: -7px; border: 7px solid transparent; border-bottom: 10px solid #ff7a3c; border-top: 0; filter: drop-shadow(0 0 4px #ff7a3c); }
#road.go #roadYou { left: var(--you); transition: left 1.3s cubic-bezier(.2, .7, .3, 1); }
#roadBest { position: absolute; top: 37px; margin-left: -6px; width: 12px; height: 12px; background: #fff07a; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
#roadBest[hidden] { display: none; }
#roadNext { font-size: 12px; color: #b6d4e9; }
#roadNext b { color: #fff; }
#roadNext .nr { margin-left: 8px; color: #ffd23f; font-weight: 800; }
#resXp #lvUp.res-slot { display: inline-block; visibility: hidden; min-height: 0; }
#resXp #lvUp.res-slot.on { visibility: visible; }
#result.counting #retryBtn, #result.counting .res-actions { pointer-events: none; opacity: .55; }
@media (prefers-reduced-motion: reduce) { #road.go #roadFill, #road.go #roadYou { transition: none; } #road .flag.next, #resBadge.on { animation: none; } }
@media (max-height: 480px) {
  #result .res-head { min-height: 0; margin: 2px 0; }
  #result .res-head #resRank { width: 56px; height: 56px; font-size: 36px; line-height: 46px; }
  #road { height: 46px; }
}

/* v2.2 手のアツさ：限界をこえている間は画面のふちが赤く脈打つ（飛距離が落ちている合図） */
body.overheat::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 13; box-shadow: inset 0 0 60px 18px #ff3c3caa; animation: overheat .45s ease-in-out infinite alternate; }
@keyframes overheat { from { opacity: .55; } to { opacity: 1; } }
#powerWrap.slip #heatLabel { color: #fff; background: #ff3c3c; border-radius: 6px; padding: 0 5px; }
#powerWrap.slip #powerLabel::after { content: ''; }
#resBonus .hot { margin-left: 10px; color: #ffb3b3; }
#resBonus .spin { margin-left: 10px; color: #9ff3ff; }
#xpGain .xp-sub { margin-left: 8px; font-size: 0.8em; color: #cfe8ff; }
#resBonus .hot b { color: #ff6b6b; font-size: 1.2em; }

/* v2.2 シェア */
.share-btn { white-space: nowrap; }
#ending .share-big { margin-top: 14px; }
#ending #endContinue { margin-top: 10px; }
#sharePanel { width: min(88vw, 380px); padding: 14px 14px 12px; background: #fffdf6; box-shadow: 0 0 0 100vmax #0009, 0 10px 30px #0008; text-align: center; z-index: 40; max-height: calc(100dvh - 24px); overflow-y: auto; }
#shareImg { display: block; width: 100%; max-width: 340px; margin: 0 auto 12px; border-radius: 14px; box-shadow: 0 6px 20px #0006; }
#sharePanel .share-actions { display: flex; justify-content: center; gap: 10px; margin-bottom: 10px; }
.sns { width: 42px; height: 42px; padding: 0; border: 2px solid var(--ink); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.sns:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.sns svg { width: 22px; height: 22px; }
.sns-x { background: #000; }
.sns-insta { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285aeb 90%); }
.sns-line { background: #06c755; }
.sns-save { background: #fff; }
.share-x { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--ink); color: #fff; font-size: 22px; font-weight: 900; line-height: 1; cursor: pointer; z-index: 1; }
#sharePanel .share-actions { margin-bottom: 0; }

/* 全自動の入り切り：右上（音ボタンがあった場所）にいつでも出す */
.auto-top {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 30;
  min-height: 44px;
  padding: 0 16px;
  border: 3px solid #fff;
  border-radius: 22px;
  background: rgba(30, 30, 60, 0.7);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}
.auto-top.hidden { display: none; }
.auto-top.on { background: #7a4be0; box-shadow: 0 0 14px rgba(167, 123, 255, 0.8); }

.share-note { margin: 10px 4px 0; font-size: 12px; font-weight: 800; color: #6a4fa0; line-height: 1.5; }
.share-note.hidden { display: none; }

/* 隠しランクSSS：金にかがやくハンコ */
#resRank.rank-SSS { color: #fff07a; border-color: #ffd23f; background: radial-gradient(circle at 35% 30%, #6a3a10, #2a1238); box-shadow: 0 0 22px #ffd23f, 0 0 40px #ff5fb0; font-size: clamp(40px, 12vw, 56px); }
#result .res-head #resRank.rank-SSS { font-size: 30px; }
#result[data-rank='SSS'] .trophy-core { background: radial-gradient(circle at 30% 24%, #fff, #fff07a 40%, #ffb21a 72%, #b8560c); }

/* v2.5 エンディングの到達画像（PART 1〜3）とエンドロール */
#ending.panel { max-height: calc(100dvh - 16px); overflow-y: auto; }
.end-art { margin: 8px auto 4px; width: 100%; aspect-ratio: 1080 / 1350; max-height: 54dvh; border: 4px solid var(--ink); border-radius: 16px; overflow: hidden; background: radial-gradient(circle at 50% 35%, #2a2f66, #0b1030); }
.end-art img { display: block; width: 100%; height: 100%; object-fit: contain; }
#ending:not(.art-ready) .end-art img { visibility: hidden; }
#ending[data-stage="ss"] .end-label, #ending[data-stage="sss"] .end-label { color: #c8176e; }
#ending .end-roll { margin-top: 10px; }
#credits {
  position: fixed; inset: 0; z-index: 40; overflow: hidden; color: #fff; text-align: center;
  background: radial-gradient(ellipse at 50% 30%, #2b1f5e 0%, #0a0c26 60%, #04050f 100%);
  font-family: var(--font-jp); touch-action: none; user-select: none; -webkit-user-select: none;
}
#credits.hidden { display: none; }
#credits::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.7;
  background-image: radial-gradient(1.5px 1.5px at 20% 30%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 70% 20%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 40% 80%, #cfe0ff 50%, transparent 51%), radial-gradient(1px 1px at 85% 65%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 10% 90%, #ffd6f0 50%, transparent 51%), radial-gradient(1.5px 1.5px at 60% 50%, #fff 50%, transparent 51%);
  background-size: 180px 220px;
}
#creditsRoll { position: absolute; left: 0; right: 0; top: 0; padding: 0 24px 40px; will-change: transform; }
#credits.static #creditsRoll { position: static; height: calc(100dvh - 190px); overflow-y: auto; padding-top: 24px; touch-action: pan-y; }
.cr-thanks { margin: 0 0 30vh; font-size: clamp(30px, 9vw, 44px); font-weight: 900; line-height: 1.35; letter-spacing: 0.04em;
  background: linear-gradient(180deg, #fffde0, #ffd84a 45%, #ff8a1f); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #2b2140) drop-shadow(0 0 18px rgba(255, 200, 120, 0.45)); }
.cr-logo { margin: 0 0 22vh; font-weight: 900; font-size: 18px; color: #ffd6f0; line-height: 1.3; }
.cr-logo b { font-size: clamp(36px, 11vw, 52px); color: #fff; text-shadow: 0 3px 0 #ff3c8a, 0 0 20px rgba(255, 95, 176, 0.6); }
.cr-sec { margin: 0 0 15vh; }
.cr-role { margin: 0 0 10px; font-size: 13px; font-weight: 800; letter-spacing: 0.18em; color: #9fd8ff; }
.cr-name { margin: 4px 0; font-size: clamp(18px, 5.4vw, 24px); font-weight: 900; }
.cr-you { font-size: clamp(22px, 6.6vw, 30px); color: #fff07a; line-height: 1.4; }
.cr-copy { margin: 0; font-size: 12px; color: #b9c9ef; }
.credits-skip { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 2; padding: 6px 14px; border: 2px solid rgba(255, 255, 255, 0.6); border-radius: 999px; background: rgba(0, 0, 0, 0.35); color: #fff; font: inherit; font-size: 13px; font-weight: 800; }
.credits-skip.hidden { display: none; }
#creditsEnd { position: absolute; left: 0; right: 0; bottom: max(28px, env(safe-area-inset-bottom)); padding: 0 24px; animation: crIn 0.8s ease-out both; }
#creditsEnd.hidden { display: none; }
#credits.static #creditsEnd { position: static; padding-top: 12px; }
.credits-the-end { margin: 0; font-family: var(--font-num); font-style: italic; font-weight: 900; font-size: clamp(40px, 12vw, 56px); color: #fff; text-shadow: 0 4px 0 #ff3c8a; }
.credits-the-end span { font-size: 0.6em; color: #9fd8ff; }
.credits-more { margin: 4px 0 16px; font-weight: 800; color: #ffd6f0; }
@keyframes crIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* v2.5 回転数の桁ごとの出来事：名前の札・漫画の集中線・一瞬の反転 */
#spinEvent {
  position: fixed; left: 50%; top: 22%; z-index: 13; pointer-events: none; opacity: 0;
  transform: translate(-50%, 0); padding: 5px 16px; border: 3px solid var(--ink); border-radius: 999px;
  background: linear-gradient(180deg, #fff6a8, #ffc93a); color: var(--ink); white-space: nowrap;
  font-family: var(--font-jp); font-weight: 900; font-size: clamp(15px, 4.4vw, 20px); box-shadow: 0 3px 0 var(--ink);
}
#spinEvent.show { animation: spinEv 0.9s ease-out forwards; }
@keyframes spinEv {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.7); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1.08); }
  25% { transform: translate(-50%, 0) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -10px) scale(1); }
}
.manga-lines {
  position: fixed; inset: -20%; pointer-events: none; opacity: 0; transition: opacity 0.2s;
  background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255, 255, 255, 0.55) 0deg 1.2deg, transparent 1.2deg 7deg);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent 30%, #000 62%); mask-image: radial-gradient(circle at 50% 50%, transparent 30%, #000 62%);
}
.manga-lines.on { opacity: 0.7; animation: mangaSpin 0.35s steps(3) infinite; }
@keyframes mangaSpin { to { transform: rotate(7deg); } }
#stage.invert canvas { filter: invert(1) hue-rotate(180deg); }
body.flying .manga-lines { display: none; }
@media (prefers-reduced-motion: reduce) { .manga-lines.on { animation: none; } }
/* 2026-10-31 見やすさ点検（iPhone SE 縦）：「最初からやり直す」の押せる高さが23pxしかなかった。見た目と位置は変えず、上下の余白で押せる高さを44pxにする（負のmarginで下の文の位置を保つ）。 */
.reset-btn { padding: 11px 12px 19px; margin: -7px auto -15px; }
