/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
  --color-bg-dark: #121212;
  --color-gold: #ffd700;
  --color-gold-dark: #d4af37;
  --color-red: #e63946;
  --color-red-dark: #b70918;
  --color-white: #ffffff;
  --color-black: #1a1a1a;
  
  --font-title: 'Zen Maru Gothic', sans-serif;
  --font-body: 'Zen Maru Gothic', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: #0b0b0b;
  color: var(--color-white);
  font-family: var(--font-body);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ==========================================================================
   VERTICAL LAYOUT WRAPPER (上下30px余白)
   ========================================================================== */
.game-wrapper {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 30px 0; /* Vertical 30px margins */
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-container {
  width: 100%;
  height: 100%; /* 古いブラウザ用のフォールバック */
  aspect-ratio: 9 / 16;
  max-width: 480px;
  max-width: min(480px, calc((100vh - 60px) * 9 / 16));
  max-width: min(480px, calc((100dvh - 60px) * 9 / 16));
  max-height: 100%;
  background-color: var(--color-bg-dark);
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 0 2px #333;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   紅白幕 (Kohaku Maku - Wind Blowing Animation)
   ========================================================================== */
.kohaku-maku {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 80px;
  z-index: 100;
  pointer-events: none;
}

/* Opening screen background */
#screen-title {
  background: url('opening_background.png') center/cover no-repeat;
}

.kohaku-maku svg {
  width: 100%;
  height: 100%;
}

.curtain-stripe {
  transform-origin: top center;
  animation: wind-wave 4s ease-in-out infinite;
}

.curtain-stripe.red { fill: #e63946; }
.curtain-stripe.white { fill: #fff; }

.curtain-stripe:nth-child(even) {
  animation-delay: -2s;
}

.curtain-stripe:nth-child(3n) {
  animation-delay: -0.7s;
}

.curtain-stripe:nth-child(3n+1) {
  animation-delay: -1.3s;
}

@keyframes wind-wave {
  0%, 100% {
    transform: skewX(0deg) scaleY(1);
  }
  25% {
    transform: skewX(3deg) scaleY(0.98);
  }
  50% {
    transform: skewX(-2deg) scaleY(1.02);
  }
  75% {
    transform: skewX(2deg) scaleY(0.97);
  }
}

/* ==========================================================================
   SCREENS & TRANSTIONS
   ========================================================================== */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform: scale(0.96);
  padding: 90px 24px 30px 24px; /* Account for Kohaku Maku */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 10;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* ==========================================================================
   BUTTONS & UI ELEMENTS
   ========================================================================== */
.btn {
  border: none;
  border-radius: 12px;
  padding: clamp(6px, 2vw, 8px) clamp(10px, 3vw, 14px);
  font-family: var(--font-title);
  font-size: clamp(0.6rem, 2.5vw, 0.8rem);
  font-weight: bold;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-red) 0%, var(--color-red-dark) 100%);
  color: var(--color-white);
  border: 2px solid var(--color-gold);
}

.btn-primary:active {
  transform: scale(0.95);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
  background: linear-gradient(135deg, #333 0%, #1a1a1a 100%);
  color: var(--color-white);
  border: 2px solid #555;
}

.btn-secondary:active {
  transform: scale(0.95);
}

.btn-back {
  background: #333;
  color: #fff;
  font-size: 0.9rem;
  padding: 10px 20px;
}

.btn-jp {
  font-size: clamp(0.7rem, 3.5vw, 0.9rem); /* 半分のサイズに縮小 */
  letter-spacing: 2px;
}

.btn-en {
  font-size: clamp(0.4rem, 2vw, 0.5rem); /* 半分のサイズに縮小 */
  opacity: 0.7;
  margin-top: 2px;
}

/* ==========================================================================
   1. TITLE SCREEN
   ========================================================================== */
#screen-title {
  justify-content: space-around;
  text-align: center;
}

.logo-area {
  margin-top: 20px;
}

.subtitle {
  font-family: var(--font-title);
  font-size: clamp(0.5rem, 2.5vw, 0.7rem); /* 半分のサイズに縮小 */
  color: var(--color-gold);
  letter-spacing: 4px;
  margin-bottom: 8px;
  animation: shine 2s infinite alternate;
}

.main-title {
  font-family: var(--font-title);
  font-weight: 900;
  font-size: clamp(0.8rem, 4vw, 1.1rem); /* ご要望通りさらに半分のサイズに縮小 */
  line-height: 1.3;
  color: var(--color-white);
  text-shadow: 0 4px 10px rgba(0,0,0,0.7), 0 0 15px rgba(230, 57, 70, 0.5);
}

.main-title .highlight {
  color: var(--color-gold);
  text-shadow: 0 4px 10px rgba(0,0,0,0.7), 0 0 15px rgba(255, 215, 0, 0.5);
}

.title-mochi-icon {
  margin-top: 25px;
  animation: float-bob 3s ease-in-out infinite;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

/* Title styling */
.main-title {
  font-size: 2.5rem;
  color: #fff;
  text-shadow: 3px 3px 6px rgba(0,0,0,0.9);
}

/* Play screen background */
#screen-game {
  background: url('プレイ背景02.jpg') center/cover no-repeat;
}

.high-score-board {
  background: rgba(0, 0, 0, 0.4); /* dark semi‑transparent background */
  border: 1px solid var(--color-gold);
  padding: 10px;
  border-radius: 8px;
  font-size: 0.95rem;
  color: #eee; /* light text for contrast */
}

.high-score-board strong {
  color: var(--color-gold);
  font-size: 1.2rem;
  margin-left: 5px;
}

@keyframes float-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ==========================================================================
   2. STAGE SELECT SCREEN
   ========================================================================== */
#screen-stage-select {
  justify-content: flex-start;
  gap: 20px;
}

.screen-title {
  font-family: var(--font-title);
  color: var(--color-gold);
  text-align: center;
  font-size: 1.5rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  margin-bottom: 10px;
}

.stage-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: 60vh;
  padding-right: 4px;
}

.stage-card {
  background: rgba(255,255,255,0.05);
  border: 2px solid #333;
  border-radius: 12px;
  padding: 14px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stage-card.active {
  border-color: var(--color-gold);
  background: rgba(255, 215, 0, 0.08);
}

.stage-card h3 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.stage-desc {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-bottom: 8px;
}

.stage-meta {
  font-size: 0.75rem;
  color: var(--color-gold-dark);
}

.stage-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.65rem;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--color-red);
  color: white;
  font-weight: bold;
}

.stage-badge.spring { background: #ff7f7f; }
.stage-badge.autumn { background: #ff9f43; }
.stage-badge.golden { background: #f1c40f; color: #111; }

.stage-card.locked {
  opacity: 0.6;
  cursor: not-allowed;
}

.lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #ffd700;
  font-weight: bold;
}

/* ==========================================================================
   3. SHOP SCREEN
   ========================================================================== */
#screen-shop {
  justify-content: flex-start;
  gap: 15px;
}

.shop-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 5px;
}

.coin-display {
  background: #222;
  border: 2px solid var(--color-gold);
  padding: 6px 14px;
  border-radius: 20px;
  font-family: var(--font-title);
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.shop-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 55vh;
  padding-right: 4px;
}

.shop-item {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.03);
  border: 1px solid #444;
  border-radius: 12px;
  padding: 10px;
  gap: 12px;
  transition: all 0.2s ease;
  cursor: pointer; /* make shop items clickable */
}

.shop-item.equipped {
  border-color: var(--color-gold);
  background: rgba(255, 215, 0, 0.05);
}

.item-visual {
  width: 50px;
  height: 50px;
  background: #333;
  border-radius: 8px;
  position: relative;
}

/* Kine shop item previews using CSS drawings */
.item-visual::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 12px;
  background: #a67c52;
  top: 15px;
  left: 10px;
  border-radius: 3px;
  transform: rotate(-15deg);
}
.item-visual::before {
  content: '';
  position: absolute;
  width: 4px;
  height: 35px;
  background: #deaf7c;
  top: 8px;
  left: 23px;
  transform: rotate(-15deg);
}

.shop-item[data-kine="hinoki"] .item-visual::after { background: #e8cbb5; }
.shop-item[data-kine="hinoki"] .item-visual::before { background: #f2e2d5; }
.shop-item[data-kine="kozuchi"] .item-visual::after { background: #ff4d4d; border: 1.5px solid var(--color-gold); border-radius: 6px; height: 18px; top: 12px;}
.shop-item[data-kine="dorayaki"] .item-visual::after { background: #b5651d; border-radius: 50%; height: 20px; top: 15px; }

.item-info {
  flex: 1;
}

.item-info h3 {
  font-size: 0.95rem;
  font-family: var(--font-title);
}

.item-info p {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 2px;
  line-height: 1.2;
}

.price {
  font-size: 0.75rem;
  color: var(--color-gold);
  font-weight: bold;
  display: block;
  margin-top: 4px;
}

.btn-shop-action {
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: 8px;
  width: auto;
  min-width: 80px;
  cursor: pointer; /* ensure buttons show hand cursor */
}

/* ==========================================================================
   4. GAME PLAY SCREEN
   ========================================================================== */
#screen-game {
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.game-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.25;
  transition: background 0.5s ease;
}

/* Dynamic Themes for backgrounds */
.bg-newyear {
  background: radial-gradient(circle at bottom, #b70918 0%, #1a0003 100%);
  background-image: 
    /* 金色の日の出の光芒 */
    radial-gradient(circle at 50% 100%, rgba(255, 215, 0, 0.45) 0%, transparent 60%),
    /* 中央の赤い日の出 */
    radial-gradient(circle at 50% 100%, #e63946 0%, #b70918 25%, transparent 26%),
    /* 金粉のラメ背景 */
    radial-gradient(rgba(255, 215, 0, 0.25) 1.5px, transparent 0),
    radial-gradient(rgba(255, 215, 0, 0.15) 2.5px, transparent 0);
  background-size: 100% 100%, 100% 100%, 40px 40px, 60px 60px;
  background-position: 0 0, 0 0, 0 0, 20px 30px;
}

.bg-spring {
  background: radial-gradient(circle at bottom, #4a1c32 0%, #121212 100%);
  background-image: radial-gradient(circle at bottom, rgba(255,182,193,0.25) 0%, transparent 70%);
}

.bg-autumn {
  background: radial-gradient(circle at bottom, #4d2800 0%, #121212 100%);
  background-image: radial-gradient(circle at bottom, rgba(255,159,67,0.2) 0%, transparent 70%);
}

.bg-golden {
  background: radial-gradient(circle at bottom, #2a2000 0%, #000 100%);
  background-image: radial-gradient(circle at bottom, rgba(255,215,0,0.2) 0%, transparent 70%);
}

/* HUD styles */
.game-hud {
  position: relative;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  padding: 10px;
  margin-top: 70px; /* Leave space for Kohaku Maku */
}

.hud-left, .hud-right {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 48%;
}

.hud-label {
  font-size: 0.65rem;
  opacity: 0.7;
  letter-spacing: 1px;
}

.hud-value {
  font-family: var(--font-title);
  font-size: 1.2rem;
  color: var(--color-gold);
}

.combo-container .hud-value {
  color: #ff4d4d;
}

/* Temperature Gauge */
.gauge-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gauge-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
}

.gauge-container-outer {
  height: 10px;
  background: #333;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.gauge-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff7b00 0%, #ff0055 100%);
  border-radius: 5px;
  transition: width 0.1s ease;
}

/* Target line on temperature gauge (perfect zone) */
.gauge-target-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 80%;
  width: 4px;
  background: var(--color-gold);
  box-shadow: 0 0 5px var(--color-gold);
}

/* Combo popup overlay */
.combo-splash {
  position: absolute;
  left: 50%;
  top: 25%;
  transform: translate(-50%, -50%) scale(0.5);
  font-family: var(--font-title);
  color: var(--color-gold);
  font-size: 2.5rem;
  text-shadow: 0 4px 10px rgba(0,0,0,0.8);
  pointer-events: none;
  opacity: 0;
  z-index: 25;
  transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.combo-splash.pop {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Intro Countdown */
.intro-countdown {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-title);
  font-size: 5rem;
  font-weight: 900;
  color: var(--color-gold);
  text-shadow: 0 4px 10px rgba(0,0,0,0.8), 0 0 20px rgba(255, 0, 0, 0.8);
  z-index: 100;
  pointer-events: none;
}

@keyframes pop-in {
  0% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  80% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
}

/* Rhythm Lane (Traditional music note display helper) */
.rhythm-lane {
  position: relative;
  z-index: 15;
  height: 60px; /* 1.5倍 (40px -> 60px) */
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  margin: 10px 0;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.lane-target {
  position: absolute;
  left: 20%;
  top: 50%;
  width: 54px; /* 1.5倍 (36px -> 54px) */
  height: 54px;
  border: 3px solid var(--color-gold);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
  transform: translate(-50%, -50%);
}

.lane-notes {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.note-node {
  position: absolute;
  top: 50%;
  width: 39px; /* 1.5倍 (26px -> 39px) */
  height: 39px;
  background: radial-gradient(circle, #e63946 0%, #b70918 100%);
  border: 2px solid white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* お邪魔ノーツ（叩いてはいけないノーツ）のスタイル */
.note-node.note-obstacle {
  background: radial-gradient(circle, #7209b7 0%, #3f0712 100%) !important;
  border-color: #ffd700 !important;
  box-shadow: 0 0 8px #7209b7, 0 2px 4px rgba(0,0,0,0.3) !important;
}

.note-node.note-obstacle::after {
  content: '✖';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 1.125rem; /* 1.5倍 (0.75rem -> 1.125rem) */
  font-weight: bold;
}

/* Rhythm Pulse Ring (Alternative centering indicator) */
.rhythm-pulse-container {
  position: absolute;
  left: 50%;
  top: 55%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 5;
}

.rhythm-ring {
  width: 180px;
  height: 180px;
  border: 3px solid rgba(255, 215, 0, 0.4);
  border-radius: 50%;
  transform: scale(1.5);
  opacity: 0;
}

.rhythm-ring.pulse-anim {
  animation: ring-shrink 0.6s linear forwards;
}

@keyframes ring-shrink {
  0% {
    transform: scale(1.8);
    opacity: 0.8;
    border-color: rgba(255, 215, 0, 0.6);
  }
  90% {
    border-color: var(--color-gold);
  }
  100% {
    transform: scale(1.0);
    opacity: 0;
    border-color: var(--color-white);
  }
}

/* ==========================================================================
   PLAYFIELD (臼・お餅・返し手)
   ========================================================================== */
.playfield {
  position: relative;
  flex: 1;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 90px; /* Elevated for tap area space */
}

/* Usu container placement */
.usu-container {
  position: absolute;
  left: 50%;
  bottom: 9.3%; /* responsive bottom */
  transform: translateX(-50%);
  z-index: 8;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));
  width: 33.3%;
  max-width: 160px;
}
.usu-svg {
  width: 100%;
  height: auto;
  display: block;
}

.usu-container.bounce {
  animation: usu-squish 0.15s cubic-bezier(0.25, 0.8, 0.25, 1) alternate 2;
}

@keyframes usu-squish {
  0% { transform: translateX(-50%) scale(1); }
  100% { transform: translateX(-50%) scale(1.05, 0.9); }
}

/* Mochi placement */
.mochi-container {
  position: absolute;
  left: 50%;
  bottom: 26%; /* 確実に上に上がるようさらに大きく（+3.5%）引き上げ */
  transform: translateX(-50%) scale(1);
  z-index: 9;
  transform-origin: bottom center;
  transition: transform 0.05s ease;
  width: 20.8%;
  max-width: 100px;
}
.mochi-svg {
  width: 100%;
  height: auto;
  display: block;
}

.mochi-path {
  transition: fill 0.5s ease;
}

/* Mochi physical squish */
.mochi-container.squish {
  animation: mochi-impact 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes mochi-impact {
  0% { transform: translateX(-50%) scale(1, 1); }
  25% { transform: translateX(-50%) scale(1.25, 0.55); }
  60% { transform: translateX(-50%) scale(0.9, 1.15); }
  100% { transform: translateX(-50%) scale(1, 1); }
}



/* Player Character styling */
.player-character {
  position: absolute;
  right: 4.1%;
  bottom: 12.8%;
  z-index: 10;
  pointer-events: none;
  transition: transform 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  width: 40.6%;
  max-width: 195px;
}

.player-img {
  width: 100%;
  height: auto;
  transform-origin: bottom center;
  animation: bob-rhythm-player 0.8s ease-in-out infinite alternate;
  display: block;
}

@keyframes bob-rhythm-player {
  0% { transform: translateY(0) rotate(0); }
  100% { transform: translateY(3px) rotate(-1deg); }
}

/* Kaishite Character styling */
.kaishite-character {
  position: absolute;
  left: 13.5%;
  bottom: 14%;
  z-index: 11;
  pointer-events: none;
  transform: scaleX(-1); /* 左側から右の臼へ向くように反転 */
  transition: transform 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  animation: bob-rhythm 0.8s ease-in-out infinite alternate; /* 本体揺れ */
  width: 25%;
  max-width: 120px;
  aspect-ratio: 2 / 3;
  background: url('返し手3.png') center no-repeat; /* 位置調整 */
  background-size: 100% 100%; /* 全体表示 */
}
.kaishite-svg {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0; /* SVG is hidden because we use the background image */
}

.kaishite-body {
  display: none; /* 本体非表示 */
}

@keyframes bob-rhythm {
  0% { transform: translateY(0) rotate(0); }
  100% { transform: translateY(3px) rotate(-1deg); }
}

/* Hand extension animation for rhythm or danger */
.kaishite-arm-group {
  transform-origin: 90px 90px;
  transform: rotate(0deg);
  transition: transform 0.15s ease;
}

/* Hand inserted into Mortar */
.kaishite-character.insert-hand .kaishite-arm-group {
    transform: rotate(35deg) translate(25px, 10px);
}

/* Dangerous Hand rest */
.kaishite-character.danger-hand .kaishite-arm-group {
  transform: translate(35px, 15px);
}

.speech-bubble {
  display: none; /* 吹き出し非表示 */
}

.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 15px; /* 吹き出しのしっぽを左側に */
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: white transparent;
  display: block;
  width: 0;
}

.speech-bubble.show {
  opacity: 1;
  transform: scale(1);
}

/* ==========================================================================
   EFFECT LAYER PARTICLES
   ========================================================================== */
.effect-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 15;
}

.particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: explode 0.5s ease-out forwards;
}

@keyframes explode {
  0% {
    transform: translate(-50%, -50%) scale(1) translate(0, 0);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.1) translate(var(--dx), var(--dy));
    opacity: 0;
  }
}


/* Rhythm Judgement Indicator */
.judge-display {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%) scale(0.7);
  font-family: var(--font-title);
  font-size: 1.6rem;
  pointer-events: none;
  z-index: 30;
  opacity: 0;
  text-shadow: 0 3px 6px rgba(0,0,0,0.8);
  transition: all 0.1s ease-out;
}

.judge-display.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

.judge-perfect { color: var(--color-gold); }
.judge-safe { color: #52b788; }
.judge-miss { color: #e63946; }
/* Tap Active Trigger Area at bottom */
.tap-active-area {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 25%; /* 画面下部25% */
  background: rgba(255, 255, 255, 0.2); /* 白 20% 不透明度 */
  border-top: 2px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200; /* 前面に配置 */
  cursor: pointer;
}

.tap-hint {
  font-family: var(--font-title);
  font-size: 1.1rem;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.8);
  animation: pulse-light 1.5s infinite;
}

@keyframes pulse-light {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; color: var(--color-gold); }
}

/* ==========================================================================
   5. BONUS SCREEN (お餅丸め)
   ========================================================================== */
#screen-bonus {
  text-align: center;
  justify-content: space-around;
}

.bonus-intro h2 {
  font-family: var(--font-title);
  font-size: 1.6rem;
  color: var(--color-gold);
  margin-top: 10px;
}

.badge-bonus {
  background: var(--color-red);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  display: inline-block;
}

.bonus-play-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.roll-track {
  width: 396px;
  height: 396px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.roll-progress-svg {
  position: absolute;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.track-bg {
  fill: none;
  stroke: #222;
  stroke-width: 10;
}

.track-fill {
  fill: none;
  stroke: var(--color-gold);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 534; /* 2 * PI * 85 */
  stroke-dashoffset: 534;
  transition: stroke-dashoffset 0.1s linear;
}

.bonus-mochi {
  width: 110px;
  height: 110px;
  background: #fff;
  border-radius: 40% 50% 45% 40%; /* Starts uneven */
  box-shadow: inset -5px -5px 15px rgba(0,0,0,0.1), 0 8px 16px rgba(0,0,0,0.2);
  transition: border-radius 0.2s ease, transform 0.1s ease;
}

.swipe-guide {
  position: absolute;
  font-size: 2rem;
  animation: circle-guide 2.5s infinite linear;
  pointer-events: none;
  opacity: 0.8;
}

@keyframes circle-guide {
  0% { transform: rotate(0deg) translate(85px) rotate(0deg); }
  100% { transform: rotate(360deg) translate(85px) rotate(-360deg); }
}

.bonus-stats {
  font-family: var(--font-title);
  display: flex;
  gap: 20px;
}

.bonus-timer {
  color: var(--color-red);
}

.bonus-percent {
  color: var(--color-gold);
}

/* ==========================================================================
   6. RESULT SCREEN
   ========================================================================== */
#screen-result {
  justify-content: space-around;
  text-align: center;
}

.result-title {
  font-family: var(--font-title);
  font-size: 1.8rem;
  color: var(--color-gold);
  text-shadow: 0 4px 8px rgba(0,0,0,0.6);
}

.result-card {
  background: rgba(255,255,255,0.04);
  border: 2px solid var(--color-gold-dark);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.result-mochi-preview {
  width: 120px;
  height: 80px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-mochi-preview svg {
  width: 100%;
  height: 100%;
}

.result-details {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding: 15px 0;
}

.result-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
}

.res-label {
  opacity: 0.8;
}

.res-val {
  font-weight: bold;
}

.res-val.highlight {
  color: #52b788;
}

.res-val.gold {
  color: var(--color-gold);
}

.result-rank {
  font-family: var(--font-title);
  font-size: 1.2rem;
  color: var(--color-gold);
  background: rgba(255,215,0,0.1);
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--color-gold);
}
