/* ===================================
   どうぶつのなまえ — スタイル
   =================================== */

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

:root {
  --pink:     #FFB3C6;
  --pink-lt:  #FFEEF3;
  --mint:     #B5EAD7;
  --mint-lt:  #E8FAF3;
  --yellow:   #FFF3B0;
  --yellow-lt:#FFFBEC;
  --lavender: #C7B8EA;
  --lav-lt:   #F0ECFC;
  --peach:    #FFD9B3;
  --peach-lt: #FFF2E3;
  --sky:      #B5D8F0;
  --sky-lt:   #EAF5FD;
  --text:     #3D3250;
  --white:    #FFFFFF;
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: linear-gradient(135deg, #FFEEF3 0%, #F0ECFC 40%, #E8FAF3 75%, #EAF5FD 100%);
  min-height: 100vh;
  padding: 1rem;
  overflow-x: hidden;
  color: var(--text);
}

/* ===================================
   背景のキラキラ
   =================================== */
.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.star {
  position: absolute;
  font-size: 1.2rem;
  animation: twinkle 3s ease-in-out infinite;
  opacity: 0.4;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50%       { opacity: 0.7; transform: scale(1.3); }
}

/* ===================================
   アプリ全体
   =================================== */
.app {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ===================================
   ヘッダー
   =================================== */
.header {
  text-align: center;
  margin-bottom: 1.2rem;
  position: relative;
  padding-top: 0.2rem;
}

.header h1 {
  font-size: clamp(1.2rem, 5vw, 1.7rem);
  font-weight: 900;
  color: var(--text);
  line-height: 1.4;
}

.back-btn {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  background: var(--white);
  border: 2px solid var(--lavender);
  color: var(--text);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(140,100,200,0.1);
  transition: transform 0.15s;
}
.back-btn:hover { transform: translateY(-50%) translateX(-2px); }

/* ===================================
   タブ
   =================================== */
.tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--white);
  padding: 0.4rem;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(140,100,200,0.12);
  margin-bottom: 1.2rem;
}

.tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.65rem 0.5rem;
  border-radius: 999px;
  font-size: clamp(0.75rem, 3vw, 0.95rem);
  font-weight: 700;
  color: #7E7597;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Noto Sans JP', sans-serif;
  white-space: nowrap;
}

.tab--active {
  background: linear-gradient(135deg, #C084FC, #F472B6);
  color: var(--white);
  box-shadow: 0 3px 10px rgba(192,132,252,0.35);
}

/* ===================================
   モード切り替え
   =================================== */
.mode { display: none; }
.mode--active { display: block; animation: fadeIn 0.35s ease; }

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

.mode-hint {
  text-align: center;
  color: #7E7597;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

/* ===================================
   ずかんグリッド
   =================================== */
.zukan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.8rem;
}

.zukan-card {
  background: var(--white);
  border-radius: 20px;
  padding: 1rem 0.5rem;
  text-align: center;
  box-shadow: 0 4px 14px rgba(140,100,200,0.1);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 3px solid transparent;
}

.zukan-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(140,100,200,0.18);
  border-color: var(--lavender);
}

.zukan-card:active { transform: scale(0.95); }

.zukan-emoji {
  font-size: clamp(2.5rem, 8vw, 3.2rem);
  display: block;
  margin-bottom: 0.3rem;
  line-height: 1;
}

.zukan-name {
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--text);
}

/* ===================================
   スコアバー（クイズ）
   =================================== */
.score-bar {
  display: flex;
  justify-content: center;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.score-item {
  background: var(--white);
  border-radius: 16px;
  padding: 0.55rem 0.9rem;
  text-align: center;
  box-shadow: 0 3px 12px rgba(140,100,200,0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  min-width: 78px;
}

.score-icon { font-size: 1.3rem; }
.score-label { font-size: 0.68rem; color: #9B8BB0; font-weight: 700; }
.score-num { font-size: 1.5rem; font-weight: 900; color: var(--text); line-height: 1; }

/* ===================================
   クイズカード
   =================================== */
.quiz-card, .cry-card {
  background: var(--white);
  border-radius: 28px;
  padding: 1.8rem 1.3rem;
  box-shadow: 0 8px 32px rgba(140,100,200,0.13);
  text-align: center;
}

.quiz-q, .cry-q {
  font-size: 1.05rem;
  font-weight: 700;
  color: #7E7597;
  margin-bottom: 1rem;
}

.quiz-animal {
  font-size: clamp(5rem, 20vw, 7rem);
  line-height: 1;
  margin: 0.5rem 0 1.4rem;
  animation: bounce 1.2s ease-in-out infinite;
}

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

.quiz-choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.choice-btn {
  background: var(--lav-lt);
  border: 2.5px solid var(--lavender);
  border-radius: 16px;
  padding: 0.9rem 0.5rem;
  font-size: clamp(1rem, 4vw, 1.2rem);
  font-weight: 900;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Noto Sans JP', sans-serif;
}

.choice-btn:hover {
  background: var(--lavender);
  color: var(--white);
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(140,100,200,0.25);
}

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

.choice-btn.correct {
  background: var(--mint-lt);
  border-color: #10B981;
  color: #059669;
  animation: pop 0.35s ease;
}

.choice-btn.wrong {
  background: #FEE2E2;
  border-color: #F87171;
  color: #DC2626;
  animation: shake 0.35s ease;
}

.choice-btn.disabled {
  pointer-events: none;
  opacity: 0.55;
}

@keyframes pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

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

.feedback {
  font-size: 1.25rem;
  font-weight: 900;
  min-height: 2rem;
  transition: opacity 0.3s;
}

.feedback.correct { color: #059669; }
.feedback.wrong   { color: #DC2626; }

/* ===================================
   なきごえモード
   =================================== */
.cry-bubble {
  background: var(--yellow-lt);
  border: 3px dashed #F59E0B;
  border-radius: 28px;
  padding: 1.6rem 1rem;
  font-size: clamp(1.4rem, 6vw, 2rem);
  font-weight: 900;
  color: #D97706;
  margin: 0.3rem 0 1rem;
  letter-spacing: 0.08em;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.speak-btn {
  background: linear-gradient(135deg, #7DD3FC, #A5F3FC);
  color: var(--text);
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(125,211,252,0.4);
  transition: all 0.2s;
  font-family: 'Noto Sans JP', sans-serif;
  margin-bottom: 1rem;
}

.speak-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(125,211,252,0.5);
}

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

.cry-nav {
  margin-top: 0.8rem;
}

.nav-btn {
  background: linear-gradient(135deg, #C084FC, #F472B6);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 0.8rem 2rem;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(192,132,252,0.4);
  transition: all 0.2s;
  font-family: 'Noto Sans JP', sans-serif;
}

.nav-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(192,132,252,0.5);
}

.nav-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ===================================
   スタート / 結果画面
   =================================== */
.start-card,
.result-card {
  background: var(--white);
  border-radius: 28px;
  padding: 2.2rem 1.8rem;
  text-align: center;
  box-shadow: 0 12px 40px rgba(140,100,200,0.18);
  max-width: 380px;
  margin: 0 auto;
}

.start-emoji,
.result-emoji {
  font-size: 4rem;
  margin-bottom: 0.8rem;
  display: block;
  animation: float 2.5s ease-in-out infinite;
}

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

.start-card h2,
.result-card h2 {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 0.8rem;
}

.start-card p,
.result-card p {
  color: #7E7597;
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 1.4rem;
}

.result-score {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text);
  background: var(--yellow);
  border-radius: 16px;
  padding: 0.7rem 1.2rem;
  margin-bottom: 1.4rem;
}

.result-score span { color: #9333EA; font-size: 1.9rem; }

.start-btn {
  background: linear-gradient(135deg, #C084FC, #F472B6);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 0.85rem 2.3rem;
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(192,132,252,0.4);
  transition: all 0.2s;
  font-family: 'Noto Sans JP', sans-serif;
}

.start-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(192,132,252,0.45);
}

.start-btn:active { transform: scale(0.96); }

.hidden { display: none !important; }

/* ===================================
   詳細モーダル
   =================================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(61, 50, 80, 0.45);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  animation: fadeIn 0.25s ease;
}

.modal-card {
  background: var(--white);
  border-radius: 28px;
  padding: 2rem 1.8rem 1.8rem;
  text-align: center;
  box-shadow: 0 16px 48px rgba(140,100,200,0.25);
  max-width: 360px;
  width: 100%;
  position: relative;
  animation: popIn 0.35s cubic-bezier(0.22, 1.4, 0.36, 1);
}

@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: var(--lav-lt);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s;
}
.modal-close:hover { transform: rotate(90deg); background: var(--lavender); color: var(--white); }

.modal-emoji {
  font-size: 5rem;
  display: block;
  margin-bottom: 0.5rem;
  animation: float 2.5s ease-in-out infinite;
}

.modal-card h2 {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.modal-romaji {
  font-size: 0.95rem;
  color: #9B8BB0;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.8rem;
}

.modal-cry {
  background: var(--peach-lt);
  border: 2px dashed var(--peach);
  border-radius: 16px;
  padding: 0.7rem 1rem;
  font-size: 1.2rem;
  font-weight: 900;
  color: #D97706;
  margin: 0.5rem 0 0.8rem;
  letter-spacing: 0.08em;
}

.modal-fact {
  color: #5D5270;
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 1rem;
  background: var(--mint-lt);
  border-radius: 14px;
  padding: 0.7rem 0.9rem;
}

/* ===================================
   紙吹雪
   =================================== */
.confetti {
  position: fixed;
  top: -10px;
  font-size: 1.5rem;
  animation: fall linear forwards;
  pointer-events: none;
  z-index: 200;
}

@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ===================================
   レスポンシブ
   =================================== */
@media (max-width: 420px) {
  .tabs { padding: 0.3rem; gap: 0.25rem; }
  .tab { padding: 0.55rem 0.3rem; font-size: 0.78rem; }
  .score-item { min-width: 68px; padding: 0.5rem 0.6rem; }
  .score-num { font-size: 1.3rem; }
  .zukan-grid { grid-template-columns: repeat(auto-fill, minmax(95px, 1fr)); gap: 0.6rem; }
}
