﻿/* =====================
   共通設定
   ===================== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Rounded Mplus 1c", sans-serif;
  background: #333;
  /* PCでの外側の背景色 */
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
}

/* ゲーム全体のコンテナ：PCでは768px固定、スマホでは全画面 */
#gameWrapper {
  width: 100%;
  max-width: 768px;
  height: 100vh;
  height: 100dvh;
  background: #fef6e4;
  position: relative;
  overflow: hidden;
  /* 基本ははみ出し禁止 */
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  touch-action: none;
  /* 基本はブラウザのスクロール等を無効化 */
}

.hidden {
  display: none !important;
}

/* タブレット・スマホ向けの微調整 */
@media (max-width: 768px) {
  #player {
    width: 90px;
    /* 70pxから拡大 */
    height: 90px;
    /* 70pxから拡大 */
  }
}

#score,
#timer {
  font-size: 18px;
}

.char-list {
  gap: 10px;
}

.char-btn {
  width: 85%;
  /* 横幅を少し広げてタップしやすく */
  max-width: 280px;
  margin-bottom: 20px;
  /* キャラ同士の間隔 */
}

#characterSelect h1 {
  font-size: 26px;
  margin-bottom: 15px;
}

/* =====================
   各画面の基本設定
   ===================== */
#titleScreen,
#characterSelect,
#gameScreen,
#endScreen {
  position: absolute;
  /* 親要素(#gameWrapper)を基準にする */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* =====================
   スタート（タイトル）画面
   ===================== */
#titleScreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(#ffffff, #fef6e4);
  text-align: center;
}

.main-visual {
  width: 100%;
  max-width: 500px;
  margin-bottom: 20px;
}

.title-img {
  width: 100%;
  height: auto;
  border-radius: 25px;
  border: 6px solid #fff;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.main-title-text {
  font-size: 28px;
  color: #ff8fab;
  margin: 15px 0 5px;
  text-shadow: 2px 2px 0 #fff;
}

.sub-title-text {
  font-size: 16px;
  color: #ff9f1c;
  margin: 0;
  font-weight: bold;
}

.big-start-btn {
  padding: 12px 35px;
  font-size: 20px;
  background: #ff8fab;
  color: #fff;
  border: none;
  border-radius: 50px;
  box-shadow: 0 5px 0 #fb6f92;
  cursor: pointer;
}

.big-start-btn:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 #ffc2d1;
}

/* =====================
   キャラクター選択画面
   ===================== */
#characterSelect {
  z-index: 100;
  background-color: #fef6e4;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  /* 縦スクロールを許可 */
  -webkit-overflow-scrolling: touch;
  /* iOSでの慣性スクロール */
  display: block;
  text-align: center;
  padding: 40px 10px 150px;
  touch-action: pan-y;
  /* JavaScriptの干渉を防ぎつつ縦スクロールのみ許可 */
}

#characterSelect h1 {
  font-size: 32px;
  color: #ff8fab;
  margin-bottom: 20px;
}

/* 説明画面のリメイク */
.explanation-container {
  background: rgba(255, 255, 255, 0.9);
  margin: 10px 15px 20px;
  padding: 15px;
  border-radius: 25px;
  border: 4px solid #ff8fab;
}

.explanation-container h2 {
  font-size: 18px;
  color: #ff8fab;
  margin: 0 0 10px;
}

.rules-grid,
.item-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 5px;
  margin-bottom: 15px;
}

.rule-item,
.item-desc {
  text-align: center;
}

.rule-icon,
.item-desc span {
  font-size: 24px;
  display: block;
  margin-bottom: 5px;
}

.rule-item p,
.item-desc p {
  font-size: 11px;
  margin: 0;
  font-weight: bold;
  color: #664433;
  line-height: 1.2;
}


/* --- あそびかたセクションのデザイン --- */
.how-to-play {
  background: rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  margin: 0 15px 25px;
  padding: 15px;
  border: 2px dashed #ff8fab;
}

.how-to-play h2 {
  font-size: 20px;
  color: #ff8fab;
  margin-top: 0;
  margin-bottom: 10px;
  background: #fff;
  display: inline-block;
  padding: 0 15px;
  border-radius: 10px;
}

.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.rule-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.rule-icon {
  font-size: 24px;
  margin-bottom: 5px;
}

.rule-item p {
  font-size: 11px;
  margin: 0;
  line-height: 1.3;
  color: #664433;
  font-weight: bold;
}

.exit-guide {
  text-align: center;
  font-size: 14px;
  color: #886655;
  margin-bottom: 20px;
}

#modeSelect {
  display: inline-flex;
  justify-content: center;
  gap: 12px;
  background: #fff;
  padding: 8px;
  border-radius: 50px;
  border: 4px solid #ffc2d1;
  margin-bottom: 30px;
}

.mode {
  padding: 10px 25px;
  font-size: 18px;
  border-radius: 40px;
  border: none;
  background: transparent;
  color: #ff8fab;
  cursor: pointer;
  transition: 0.3s;
}

.mode.active {
  background: #ff8fab;
  color: #fff;
  box-shadow: 0 4px 0 #fb6f92;
  font-weight: bold;
}

.char-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  margin-bottom: 50px;
}

.char-btn {
  width: 220px;
  background: #fff;
  border: 6px solid #ffd166;
  border-radius: 40px;
  padding: 15px;
  box-shadow: 0 10px 0 #ffd166;
  margin-bottom: 10px;
  cursor: pointer;
}

.char-btn:hover {
  transform: translateY(-5px) rotate(2deg);
}

.img-wrapper {
  background: #fff9e6;
  border-radius: 30px;
  margin-bottom: 15px;
  border: 3px dashed #ffcc66;
  padding: 10px;
}

.char-btn img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.1));
}

.char-name {
  display: inline-block;
  background: #ffcc66;
  color: #fff;
  padding: 4px 15px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 18px;
  margin-bottom: 10px;
}

.char-desc {
  font-size: 14px;
  color: #886655;
  line-height: 1.4;
  text-align: left;
}

.ability {
  color: #ff8fab;
  font-weight: bold;
  font-size: 12px;
  background: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
  margin-bottom: 5px;
}

/* =====================
   ゲーム画面
   ===================== */
#gameScreen {
  background: radial-gradient(circle at center, #00152a 0%, #000000 100%);
  transition: background 0.5s ease;
  padding-top: var(--hud-h, 70px);
  margin-top: 8px;
}

/* 接地感：地面グラデーション */
#gameScreen::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0));
  pointer-events: none;
  z-index: 1;
}

#starryBackground {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.bg-star {
  position: absolute;
  background: white;
  border-radius: 50%;
  opacity: 0;
  animation: twinkle var(--duration) infinite ease-in-out;
}

@keyframes twinkle {

  0%,
  100% {
    opacity: 0.2;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 768px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(env(safe-area-inset-top) + 8px) 15px 10px;
  background: rgba(16, 24, 40, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10001;
}

#hud-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* スコアとタイマーの間隔 */
}

#score,
#timer {
  padding: 6px 12px;
  background: #fff;
  border-radius: 12px;
  font-weight: 900;
  font-size: clamp(14px, 3.2vw, 18px);
  color: #333;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.1);
  border: 2px solid #ff8fab;
}

#score {
  border: 3px solid #ffcc66;
  color: #333;
}

#timer {
  border-color: #8ecae6;
}

#dailyChallengeStatus {
  position: absolute;
  bottom: 12px;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 12px;
  color: #666;
  opacity: 0.9;
  text-shadow: 1px 1px 0 #fff;
}

#feverTimerUI {
  position: absolute;
  top: 60px;
  right: 16px;
  padding: 6px 10px;
  border-radius: 10px;
  background: #fff6cc;
  border: 2px solid #ff8fab;
  font-weight: 900;
  font-size: 14px;
  color: #333;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.1);
  z-index: 101;
}

/* --- CSS修正：playerのサイズ --- */
#player {
  position: absolute;
  bottom: 24px;
  width: 100px;
  /* 80pxから拡大 */
  height: 100px;
  /* 80pxから拡大 */
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  z-index: 100;
}

/* 接地感：プレイヤー影 */
#player::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 64px;
  height: 16px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 50%;
  transform: translateX(-50%);
  filter: blur(6px);
  pointer-events: none;
  z-index: -1;
}


/* =====================
   星・演出
   ===================== */
.star {
  position: absolute;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  will-change: transform, top, left;
}

.star.normal {
  background-image: url("images/star.png");
}

.star.hit {
  background-image: url("images/star_hit.png");
}

.star.rainbow {
  background-image: url("images/star_rainbow.png");
  animation: rainbowSpin 1.4s linear infinite;
}

.star.big {
  filter: drop-shadow(0 0 15px #fff) drop-shadow(0 0 30px #ff0);
  z-index: 10;
  border-radius: 50%;
  animation: big-pulse 1s infinite alternate ease-in-out;
}

@keyframes big-pulse {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.15);
  }
}

@keyframes rainbowSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* =====================
   演出レイヤー
   ===================== */
#comboPop {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  /* 最前面に */
  pointer-events: none;
  /* タッチの邪魔をしない */
  text-align: center;
  opacity: 0;
  transition: none;
  /* JSで制御するためリセット */
}

#comboPop .combo-num {
  display: block;
  font-size: 80px;
  font-weight: 900;
  color: #ff8fab;
  text-shadow: 4px 4px 0 #fff, -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff;
}

#comboPop .combo-label {
  display: block;
  font-size: 24px;
  font-weight: bold;
  color: #ff9f1c;
  text-shadow: 2px 2px 0 #fff;
}

#comboPop.show {
  animation: comboAnim 0.5s ease-out forwards;
}

@keyframes comboAnim {
  0% {
    opacity: 0;
    transform: translate(-50%, -20%) scale(0.5);
  }

  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.5);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -80%) scale(1.2);
  }
}

.combo-num {
  font-size: 80px;
  color: #fff;
  text-shadow: 0 0 15px #ff00ff, 0 0 5px #000;
  display: block;
}

@keyframes comboCenterPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.5);
  }

  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -60%) scale(1);
  }
}

/* --- 修正：スターダスト（飛び散って流れる）演出 --- */
.dust {
  position: absolute;
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  pointer-events: none;
  z-index: 50;
  box-shadow: 0 0 10px #fff;
  /* アニメーション：飛び散ってから下に流れる */
  animation: dust-anim 1.2s ease-out forwards;
}

@keyframes dust-anim {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }

  /* JS側で指定された方向に飛び出しつつ、重力で下に落ちる */
  20% {
    transform: translate(var(--dx), var(--dy)) scale(1.2);
    opacity: 1;
  }

  100% {
    transform: translate(calc(var(--dx) * 1.5), calc(var(--dy) + 300px)) scale(0);
    opacity: 0;
  }
}

/* メッセージを表示するコンテナ（重なり防止用） */
#messageContainer {
  position: absolute;
  top: 20%;
  /* 画面の上の方に配置 */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  /* 新しいメッセージを上に重ねる */
  align-items: center;
  gap: 10px;
  z-index: 2000;
  pointer-events: none;
}

.bonus-msg {
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 24px;
  white-space: nowrap;
  animation: messageAnim 1.2s ease-out forwards;
}

@keyframes messageAnim {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }

  20% {
    opacity: 1;
    transform: translateY(0);
  }

  80% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}

@keyframes bonusFade {
  0% {
    opacity: 0;
    transform: translate(-50%, 20px) scale(0.8);
  }

  20% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.1);
  }

  80% {
    opacity: 1;
    transform: translate(-50%, -10px) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -40px) scale(0.8);
  }
}

/* =====================
   スクリーンシェイク演出 (新規追加)
   ===================== */
/* 衝突時にJSで対象要素（例: #gameScreen）に付与するクラス */
.shake {
  animation: screenShake 0.5s cubic-bezier(.36, .07, .19, .97) both;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  perspective: 1000px;
}

@keyframes screenShake {

  10%,
  90% {
    transform: translate3d(-2px, 0, 0);
  }

  20%,
  80% {
    transform: translate3d(4px, 0, 0);
  }

  30%,
  50%,
  70% {
    transform: translate3d(-6px, 0, 0);
  }

  40%,
  60% {
    transform: translate3d(6px, 0, 0);
  }
}

/* 20コンボ覚醒シェイク演出 - 段階演出 (#gameWrapper 用) */
#gameWrapper.shake-weak {
  animation: shakeWeak 0.6s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shakeWeak {
  10%, 90% { transform: translate3d(-1px, -1px, 0); }
  20%, 80% { transform: translate3d(2px, 1px, 0); }
  30%, 50%, 70% { transform: translate3d(-2px, -1px, 0); }
  40%, 60% { transform: translate3d(2px, 1px, 0); }
}

#gameWrapper.shake-mid {
  animation: shakeMid 0.6s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shakeMid {
  10%, 90% { transform: translate3d(-2px, -2px, 0); }
  20%, 80% { transform: translate3d(4px, 2px, 0); }
  30%, 50%, 70% { transform: translate3d(-5px, -2px, 0); }
  40%, 60% { transform: translate3d(5px, 2px, 0); }
}

#gameWrapper.shake-strong {
  animation: shakeStrong 0.6s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shakeStrong {
  10%, 90% { transform: translate3d(-3px, -2px, 0); }
  20%, 80% { transform: translate3d(5px, 3px, 0); }
  30%, 50%, 70% { transform: translate3d(-7px, -3px, 0); }
  40%, 60% { transform: translate3d(7px, 4px, 0); }
}

/* フラッシュ演出 */
#gameWrapper.flash-weak {
  animation: flashWeak 0.15s ease-out;
}

@keyframes flashWeak {
  0% { background: rgba(255, 255, 255, 0.1); }
  100% { background: rgba(255, 255, 255, 0); }
}

#gameWrapper.flash-strong {
  animation: flashStrong 0.18s ease-out;
}

@keyframes flashStrong {
  0% { background: rgba(255, 215, 0, 0.3); }
  100% { background: rgba(255, 215, 0, 0); }
}

/* FEVER 突入フラッシュ演出（競合しない命名：flash-fever / feverFlash） */
#gameWrapper.flash-fever {
  animation: feverFlash 0.2s ease-out;
}

@keyframes feverFlash {
  0% {
    box-shadow: inset 0 0 80px rgba(255, 215, 0, 0.7);
    background: linear-gradient(180deg, rgba(255,240,200,0.35), rgba(255,255,255,0.0));
    filter: brightness(1.25);
  }
  100% {
    box-shadow: inset 0 0 80px rgba(255, 215, 0, 0);
    background: transparent;
    filter: brightness(1);
  }
}

/* =====================
   フィーバー演出
   ===================== */
#gameScreen.fever {
  background: radial-gradient(circle at center, #2b0035 0%, #000000 100%);
}

#gameScreen.fever #starryBackground {
  filter: hue-rotate(180deg) brightness(2);
}

/* Subtle rainbow / aurora tone for FEVER applied to the star layer itself */
#starryBackground.fever-bg {
  filter: hue-rotate(140deg) saturate(1.4) brightness(1.25);
  transition: filter 0.5s ease, box-shadow 0.5s ease;
  box-shadow: inset 0 0 40px rgba(150,80,200,0.08);
}

#gameScreen.fever #hud {
  border-bottom: 4px solid #ffd700;
  background: rgba(255, 215, 0, 0.2);
}

/* コンボモード（青〜紫系の背景） */
#gameScreen.combo-mode {
  background: radial-gradient(circle at center, #003366 0%, #000000 100%);
}

/* フィーバーモード（既存：さらに派手な紫） */
#gameScreen.fever {
  background: radial-gradient(circle at center, #2b0035 0%, #000000 100%);
}

/* --- 特別演出：新記録ラベル --- */
#newRecordLabel {
  position: relative;
  /* もしくは absolute */
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(45deg, #ff0055, #ffdd00);
  color: white;
  padding: 8px 25px;
  border-radius: 50px;
  font-size: 24px;
  font-weight: 900;
  margin-bottom: -20px;
  z-index: 10;
  border: 4px solid white;
  animation: popScale 0.4s infinite alternate;
}

@keyframes popScale {
  from {
    transform: translateX(-50%) scale(0.9);
  }

  to {
    transform: translateX(-50%) scale(1.1);
  }
}

/* --- 特別演出：紙吹雪 --- */
.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  z-index: 2500;
  animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-50px) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* =====================
   リザルト（終了）画面
   ===================== */
/* --- リザルト画面リメイク --- */
#endScreen {
  background: radial-gradient(#fff9e6, #fef6e4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.result-card {
  background: white;
  width: 92%;
  max-width: 400px;
  border-radius: 30px;
  padding: 20px 15px;
  border: 6px solid #ffc2d1;
  box-shadow: 0 10px 0 #ffdae3;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.result-title {
  font-size: 28px;
  color: #ff8fab;
  margin: 0 0 10px;
  text-shadow: 2px 2px 0 #fff;
}

.final-score {
  font-size: 38px;
  font-weight: 900;
  color: #ff9f1c;
  margin-bottom: 15px;
  background: #fff9e6;
  padding: 10px 20px;
  border-radius: 20px;
  border: 3px dashed #ff9f1c;
  animation: scoreBounce 1s infinite alternate;
}

@keyframes scoreBounce {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.05);
  }
}

@keyframes celebrate {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.1);
  }
}

/* ランキングカード */
.ranking-flex-container {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-bottom: 20px;
}

.ranking-card {
  flex: 1;
  background: #fff;
  border-radius: 15px;
  padding: 10px;
  border: 3px solid #8ecae6;
  font-size: 11px;
}

.global-card {
  border-color: #ffb703;
}

.ranking-card h3 {
  font-size: 12px;
  margin: 0 0 8px;
  color: #555;
}

.ranking-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ranking-item {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed #eee;
  padding: 4px 0;
}

/* 順位の色付け */
.ranking-item:nth-child(1) {
  color: #d4af37;
  font-weight: bold;
}

/* 金 */
.ranking-item:nth-child(2) {
  color: #a9a9a9;
  font-weight: bold;
}

/* 銀 */
.ranking-item:nth-child(3) {
  color: #cd7f32;
  font-weight: bold;
}

/* 銅 */

/* 入力エリア */
#playerName {
  width: 100%;
  padding: 12px;
  border-radius: 15px;
  border: 3px solid #eee;
  text-align: center;
  font-size: 16px;
  margin-bottom: 10px;
  background: #fafafa;
}

.submit-btn {
  background: #ffd166;
  border: none;
  padding: 10px 20px;
  border-radius: 50px;
  font-weight: 900;
  color: #664d00;
  cursor: pointer;
  margin-bottom: 20px;
  box-shadow: 0 4px 0 #e6b800;
}

#itemTimers {
  display: flex;
  gap: 6px;
}

.item-ui {
  background: #fff;
  padding: 4px 8px;
  border-radius: 10px;
  font-weight: 900;
  font-size: clamp(11px, 2.8vw, 14px);
  display: flex;
  align-items: center;
  gap: 4px;
  border: 2px solid #4cc9f0;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
}

#shieldTimer {
  border-color: #4cc9f0;
  color: #4cc9f0;
}

#clearTimer {
  border-color: #4ade80;
}

.item-ui.low-time {
  animation: blink 0.5s infinite;
  color: red;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

/* リトライボタンのデザイン */
#retryBtn {
  position: absolute;
  top: calc(var(--hud-h, 70px) + 8px);
  right: 15px;
  z-index: 3000;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid #ff8fab;
  color: #ff8fab;
  border-radius: 20px;
  font-weight: bold;
  font-size: clamp(11px, 2.8vw, 12px);
}

#retryBtn:active {
  transform: translateY(2px);
  box-shadow: none;
}

/* ヒット時のフラッシュ（JSで一時的に付与） */
.flash-white {
  animation: flashAnim 0.2s ease-out;
}

@keyframes flashAnim {
  0% {
    background-color: rgba(255, 255, 255, 0.4);
  }

  100% {
    background-color: transparent;
  }
}

/* スコアが跳ねるアニメーション */
.score-bump {
  animation: bump 0.2s ease-out;
}

@keyframes bump {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.3);
    color: #ff8fab;
  }

  100% {
    transform: scale(1);
  }
}

/* ランキング全体を縦に並べる */
.ranking-scroll-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* スクロールさせる箱の設定 */
.scroll-box {
  max-height: 180px;
  /* 子供が飽きない、かつ画面に収まる高さ */
  overflow-y: auto;
  width: 90%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  -webkit-overflow-scrolling: touch;
  /* スマホでスイスイ動く設定 */
}

.ranking-section {
  width: 100%;
  margin: 5px 0;
}

.ranking-section h3 {
  font-size: 16px;
  margin: 10px 0 5px 0;
}

.game-screen.fever {
  box-shadow: inset 0 0 60px rgba(255,120,0,0.8);
  animation: feverPulse 0.8s infinite alternate;
}

@keyframes feverPulse {
  from { filter: brightness(1.1); }
  to { filter: brightness(1.4); }
}
