/* ===========================
   なでしこの迷路冒険 - スタイル
   =========================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --pink: #FF69B4;
  --light-pink: #FFB6C1;
  --deep-pink: #FF1493;
  --lavender: #E6CCFF;
  --mint: #98FFD6;
  --yellow: #FFE66D;
  --orange: #FFB347;
  --sky: #87CEEB;
  --white: #FFFFFF;
  --bg-gradient: linear-gradient(135deg, #FFE4F0 0%, #E8F4FF 50%, #E4FFE8 100%);
}

body {
  font-family: 'Arial', 'Hiragino Kaku Gothic Pro', 'Meiryo', sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(circle at 20% 20%, rgba(255,182,193,0.3) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(200,230,255,0.3) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(200,255,220,0.2) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ===========================
   タイトル画面
   =========================== */

#title-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  gap: 20px;
}

.title-logo {
  text-align: center;
  animation: float 3s ease-in-out infinite;
}

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

.title-logo h1 {
  font-size: clamp(2rem, 6vw, 4rem);
  background: linear-gradient(135deg, #FF69B4, #FF1493, #FF69B4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(2px 2px 4px rgba(255,20,147,0.3));
  font-weight: 900;
  letter-spacing: 4px;
}

.title-logo h2 {
  font-size: clamp(1rem, 3vw, 1.5rem);
  color: #FF8C69;
  letter-spacing: 3px;
  margin-top: 5px;
}

.title-character {
  display: flex;
  justify-content: center;
  gap: 30px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.title-scene {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(10px);
  border-radius: 30px;
  padding: 30px 40px;
  border: 3px solid rgba(255,182,193,0.5);
  box-shadow: 0 10px 40px rgba(255,105,180,0.2);
  text-align: center;
}

.title-desc {
  text-align: center;
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  color: #666;
  line-height: 1.8;
  background: rgba(255,255,255,0.8);
  padding: 15px 25px;
  border-radius: 15px;
  max-width: 500px;
}

.btn-start {
  background: linear-gradient(135deg, #FF69B4, #FF1493);
  color: white;
  border: none;
  padding: 18px 50px;
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  border-radius: 50px;
  cursor: pointer;
  font-weight: bold;
  letter-spacing: 3px;
  box-shadow: 0 8px 25px rgba(255,20,147,0.4);
  transition: all 0.3s ease;
  animation: pulse-btn 2s ease-in-out infinite;
}

@keyframes pulse-btn {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 25px rgba(255,20,147,0.4); }
  50% { transform: scale(1.05); box-shadow: 0 12px 35px rgba(255,20,147,0.6); }
}

.btn-start:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 35px rgba(255,20,147,0.6);
}

/* ===========================
   ゲーム画面
   =========================== */

#game-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 100vh;
  padding: 10px;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 900px;
  padding: 10px 20px;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  margin-bottom: 10px;
  border: 2px solid rgba(255,182,193,0.4);
  box-shadow: 0 4px 15px rgba(255,105,180,0.15);
  flex-wrap: wrap;
  gap: 8px;
}

.game-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mini-character {
  width: 50px;
  height: 50px;
}

.player-info h3 {
  font-size: 1rem;
  color: #FF69B4;
  font-weight: bold;
}

.player-info p {
  font-size: 0.8rem;
  color: #888;
}

.game-stats {
  display: flex;
  gap: 15px;
  align-items: center;
}

.stat-box {
  text-align: center;
  background: rgba(255,230,240,0.8);
  padding: 6px 12px;
  border-radius: 12px;
  border: 2px solid rgba(255,105,180,0.3);
}

.stat-box .stat-label {
  font-size: 0.7rem;
  color: #FF69B4;
  font-weight: bold;
}

.stat-box .stat-value {
  font-size: 1rem;
  color: #333;
  font-weight: bold;
}

.btn-menu {
  background: linear-gradient(135deg, #FF69B4, #FF8C69);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: bold;
  transition: all 0.3s;
}

.btn-menu:hover {
  transform: scale(1.05);
}

/* ===========================
   3D 迷路ビュー
   =========================== */

#maze-container {
  position: relative;
  width: 100%;
  max-width: 900px;
  aspect-ratio: 16 / 9;
  background: #1a0a2e;
  border-radius: 20px;
  overflow: hidden;
  border: 3px solid rgba(255,182,193,0.5);
  box-shadow: 0 15px 50px rgba(0,0,0,0.3), inset 0 0 60px rgba(100,0,80,0.3);
  cursor: grab;
}

#maze-container:active {
  cursor: grabbing;
}

#maze-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ===========================
   ミニマップ
   =========================== */

#minimap-container {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0,0,0,0.7);
  border-radius: 10px;
  padding: 5px;
  border: 2px solid rgba(255,182,193,0.5);
}

#minimap-canvas {
  display: block;
  border-radius: 6px;
}

/* ===========================
   コントロール
   =========================== */

#controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
  max-width: 900px;
}

.controls-hint {
  font-size: 0.8rem;
  color: #FF69B4;
  text-align: center;
  background: rgba(255,255,255,0.7);
  padding: 5px 15px;
  border-radius: 10px;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 60px);
  grid-template-rows: repeat(3, 60px);
  gap: 4px;
  background: rgba(255,255,255,0.7);
  padding: 10px;
  border-radius: 20px;
  border: 2px solid rgba(255,182,193,0.4);
}

.dpad-btn {
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 12px;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.dpad-btn:not(.dpad-empty) {
  background: linear-gradient(135deg, #FF69B4, #FF1493);
  color: white;
  box-shadow: 0 4px 10px rgba(255,20,147,0.3);
}

.dpad-btn:not(.dpad-empty):active {
  transform: scale(0.9);
  box-shadow: 0 2px 5px rgba(255,20,147,0.3);
}

.dpad-empty {
  background: transparent;
  cursor: default;
}

/* ===========================
   扉・クイズモーダル
   =========================== */

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  background: white;
  border-radius: 30px;
  padding: 30px;
  max-width: 550px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(255,20,147,0.3);
  border: 4px solid #FFB6C1;
  animation: slideUp 0.3s ease;
  position: relative;
  overflow: hidden;
}

.modal-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: linear-gradient(90deg, #FF69B4, #FFB347, #87CEEB, #98FFD6, #FF69B4);
  background-size: 200% 100%;
  animation: rainbow 2s linear infinite;
}

@keyframes rainbow {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-door-icon {
  font-size: 3rem;
  margin-bottom: 10px;
  animation: swing 1s ease-in-out;
}

@keyframes swing {
  0% { transform: rotate(-20deg); }
  30% { transform: rotate(15deg); }
  60% { transform: rotate(-10deg); }
  80% { transform: rotate(5deg); }
  100% { transform: rotate(0); }
}

.modal-box h2 {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  color: #FF1493;
  margin-bottom: 15px;
  font-weight: bold;
}

.quiz-question {
  background: linear-gradient(135deg, #FFF0F5, #F0F8FF);
  border-radius: 20px;
  padding: 20px;
  margin: 15px 0;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: #333;
  line-height: 1.7;
  border: 2px solid rgba(255,182,193,0.5);
  font-weight: bold;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 15px 0;
}

.quiz-option-btn {
  padding: 14px 10px;
  border: 3px solid #FFB6C1;
  border-radius: 15px;
  background: white;
  font-size: clamp(0.9rem, 2vw, 1rem);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: bold;
  color: #555;
  line-height: 1.3;
}

.quiz-option-btn:hover {
  background: linear-gradient(135deg, #FFE4F0, #E8F4FF);
  border-color: #FF69B4;
  transform: scale(1.02);
  color: #FF1493;
}

.quiz-option-btn.correct {
  background: linear-gradient(135deg, #98FFD6, #7FFFD4);
  border-color: #2ECC71;
  color: #2ECC71;
  animation: bounce 0.5s ease;
}

.quiz-option-btn.wrong {
  background: linear-gradient(135deg, #FFB6C1, #FF9999);
  border-color: #FF4444;
  color: #FF4444;
  animation: shake 0.5s ease;
}

@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.quiz-progress {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}

.progress-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #DDD;
  transition: all 0.3s;
}

.progress-dot.done {
  background: #2ECC71;
  transform: scale(1.2);
}

.progress-dot.current {
  background: #FF69B4;
  animation: pulse-dot 1s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.4); }
}

.progress-dot.failed {
  background: #FF4444;
}

.modal-result {
  margin-top: 15px;
  padding: 15px;
  border-radius: 15px;
  font-size: 1rem;
  font-weight: bold;
}

.modal-result.success {
  background: linear-gradient(135deg, #98FFD6, #7FFFD4);
  color: #2ECC71;
  border: 2px solid #2ECC71;
}

.modal-result.fail {
  background: linear-gradient(135deg, #FFB6C1, #FF9999);
  color: #FF4444;
  border: 2px solid #FF4444;
}

.btn-continue {
  margin-top: 15px;
  background: linear-gradient(135deg, #FF69B4, #FF1493);
  color: white;
  border: none;
  padding: 14px 35px;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(255,20,147,0.3);
  transition: all 0.3s;
}

.btn-continue:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(255,20,147,0.4);
}

/* ===========================
   ボス戦モーダル
   =========================== */

.boss-modal-box {
  border-color: #FF4500;
  box-shadow: 0 20px 60px rgba(255,69,0,0.4);
}

.boss-modal-box::before {
  background: linear-gradient(90deg, #FF4500, #FFD700, #FF4500);
  animation: bossBanner 1s linear infinite;
}

@keyframes bossBanner {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.boss-modal-box h2 {
  color: #FF4500;
}

.boss-modal-box .quiz-question {
  background: linear-gradient(135deg, #FFF5E4, #FFF0F0);
  border-color: rgba(255,69,0,0.3);
}

.boss-modal-box .quiz-option-btn {
  border-color: #FFAB7B;
}

.boss-modal-box .quiz-option-btn:hover {
  background: linear-gradient(135deg, #FFE8D0, #FFE0E0);
  border-color: #FF4500;
  color: #FF4500;
}

/* ===========================
   ゴール・クリア画面
   =========================== */

#clear-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  gap: 15px;
  text-align: center;
}

.clear-fireworks {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.firework {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: firework-anim 1.5s ease-out forwards;
}

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

.clear-box {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,0.9);
  border-radius: 30px;
  padding: 35px 40px;
  max-width: 500px;
  width: 100%;
  border: 4px solid #FFD700;
  box-shadow: 0 20px 60px rgba(255,215,0,0.4);
  animation: celebrate 0.5s ease;
}

@keyframes celebrate {
  0% { transform: scale(0.5) rotate(-10deg); opacity: 0; }
  60% { transform: scale(1.1) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.clear-box h1 {
  font-size: clamp(2rem, 6vw, 3.5rem);
  background: linear-gradient(135deg, #FF69B4, #FFD700, #FF69B4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 900;
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

.clear-box p {
  font-size: 1.1rem;
  color: #555;
  margin: 10px 0;
  line-height: 1.6;
}

.clear-stats {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 15px 0;
  flex-wrap: wrap;
}

.clear-stat {
  background: linear-gradient(135deg, #FFE4F0, #E8F4FF);
  padding: 10px 20px;
  border-radius: 15px;
  border: 2px solid rgba(255,182,193,0.5);
  text-align: center;
}

.clear-stat .label {
  font-size: 0.8rem;
  color: #FF69B4;
  font-weight: bold;
}

.clear-stat .value {
  font-size: 1.3rem;
  color: #333;
  font-weight: bold;
}

.btn-retry {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: white;
  border: none;
  padding: 16px 45px;
  border-radius: 50px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(255,165,0,0.4);
  transition: all 0.3s;
  letter-spacing: 2px;
}

.btn-retry:hover {
  transform: scale(1.05);
}

/* ===========================
   パーティクル・装飾
   =========================== */

.flower-particle {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  font-size: 1.5rem;
  animation: fall-flower linear forwards;
  opacity: 0.7;
}

@keyframes fall-flower {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 0.7; }
  100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

/* ===========================
   メッセージ表示
   =========================== */

.floating-message {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.95);
  border-radius: 20px;
  padding: 12px 25px;
  font-size: 1.1rem;
  font-weight: bold;
  color: #FF1493;
  border: 3px solid #FFB6C1;
  box-shadow: 0 5px 20px rgba(255,20,147,0.3);
  z-index: 500;
  animation: messageShow 2s ease forwards;
  pointer-events: none;
}

@keyframes messageShow {
  0% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  20% { opacity: 1; transform: translateX(-50%) translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* ===========================
   レスポンシブ
   =========================== */

@media (max-width: 600px) {
  .dpad-btn {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }
  .dpad {
    grid-template-columns: repeat(3, 50px);
    grid-template-rows: repeat(3, 50px);
  }
  .game-header {
    padding: 8px 12px;
  }
  .modal-box {
    padding: 20px;
  }
  .quiz-options {
    grid-template-columns: 1fr;
  }
}

/* ===========================
   キャラクターアニメーション
   =========================== */

.nadeshiko-walk {
  animation: walkBounce 0.4s ease-in-out;
}

@keyframes walkBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.05); }
}

.nadeshiko-happy {
  animation: happyDance 0.6s ease;
}

@keyframes happyDance {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-10deg) scale(1.1); }
  75% { transform: rotate(10deg) scale(1.1); }
}

/* Loading/transition */
.screen-transition {
  animation: screenFade 0.5s ease;
}

@keyframes screenFade {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}
