/* ================================
   CSS Variables
================================ */
:root {
  --primary: #6C63FF;
  --primary-dark: #5a52d5;
  --secondary: #FF6584;
  --accent: #43C59E;
  --accent-dark: #35a07f;
  --warning: #FFA94D;
  --danger: #FF6B6B;
  --success: #51CF66;
  --bg: #F0F2FF;
  --card-bg: #FFFFFF;
  --text: #2D3748;
  --text-light: #718096;
  --shadow: 0 4px 20px rgba(108, 99, 255, 0.15);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 20px;
  --radius-sm: 12px;
  --transition: 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  --beginner: #22C55E;
  --beginner-dark: #16a34a;
}

/* ================================
   Base Reset
================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ================================
   Header
================================ */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, #8B5CF6 100%);
  color: white;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(108, 99, 255, 0.4);
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 900;
  font-size: 1.3rem;
}

.logo-icon { font-size: 1.4rem; }

.header-stats { display: flex; gap: 0.6rem; align-items: center; }

.stat-badge {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  backdrop-filter: blur(8px);
}

.stat-badge .fa-fire { color: #FFD43B; }
.stat-badge .fa-star { color: #FFD43B; }

/* ================================
   Main / Screens
================================ */
.main {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.screen { display: none; }
.screen.active { display: block; animation: fadeIn 0.4s ease; }

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

/* ================================
   Home Screen
================================ */
.home-hero {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
}

.hero-emoji {
  font-size: 4rem;
  margin-bottom: 0.5rem;
  animation: bounce 2s infinite;
}

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

.hero-title {
  font-size: 2.4rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.3rem;
}

.hero-subtitle {
  color: var(--text-light);
  font-size: 1.1rem;
}

/* Mode Cards */
.mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.mode-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-align: center;
  border: 2px solid transparent;
}

.mode-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(108, 99, 255, 0.25);
  border-color: var(--primary);
}

.mode-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

.mode-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.mode-desc {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 1rem;
  line-height: 1.5;
}

/* 1年生モードカード */
.mode-card-new {
  position: relative;
  border: 2px solid #BBF7D0;
}

.mode-badge {
  position: absolute;
  top: -10px;
  right: 12px;
  background: linear-gradient(135deg, #22C55E, #16a34a);
  color: white;
  font-size: 0.7rem;
  font-weight: 900;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 8px rgba(34,197,94,0.4);
}

.btn-beginner {
  background: linear-gradient(135deg, var(--beginner), #34d399);
  color: white;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.4);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
  border: none;
  transition: transform var(--transition), box-shadow 0.2s;
}

.btn:hover { transform: scale(1.05); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #8B5CF6);
  color: white;
  box-shadow: 0 4px 14px rgba(108, 99, 255, 0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary), #ff8fa3);
  color: white;
  box-shadow: 0 4px 14px rgba(255, 101, 132, 0.4);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #34d399);
  color: white;
  box-shadow: 0 4px 14px rgba(67, 197, 158, 0.4);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover { background: var(--primary); color: white; }

/* Home Stats */
.home-stats {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.stats-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 500px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
  text-align: center;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--primary);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.2rem;
}

/* ================================
   Settings Screen
================================ */
.settings-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.settings-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

#settingsDanSection {
  margin-bottom: 1rem;
}

/* Toggle Switch */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #D1D5DB;
  border-radius: 26px;
  cursor: pointer;
  transition: background 0.25s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.25s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }

.toggle-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

/* Time Slider */
.slider-wrap { padding-top: 0.25rem; }

.time-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--primary) 50%, #D1D5DB 50%);
  outline: none;
  margin-bottom: 0.4rem;
}

.time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(108,99,255,0.4);
}

.time-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(108,99,255,0.4);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Start Big Button */
.btn-start-big {
  display: block;
  width: 100%;
  padding: 1rem;
  font-size: 1.2rem;
  border-radius: var(--radius);
  margin-top: 0.5rem;
  text-align: center;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 900;
  cursor: pointer;
  border: none;
  transition: transform var(--transition), box-shadow 0.2s;
}

.btn-start-big:hover { transform: scale(1.02); }
.btn-start-big:active { transform: scale(0.98); }

.btn-primary-start {
  background: linear-gradient(135deg, var(--primary), #8B5CF6);
  color: white;
  box-shadow: 0 4px 14px rgba(108,99,255,0.4);
}

.btn-secondary-start {
  background: linear-gradient(135deg, var(--secondary), #ff8fa3);
  color: white;
  box-shadow: 0 4px 14px rgba(255,101,132,0.4);
}

.btn-beginner-start {
  background: linear-gradient(135deg, var(--beginner), #34d399);
  color: white;
  box-shadow: 0 4px 14px rgba(34,197,94,0.4);
}

/* ================================
   Screen Header
================================ */
.screen-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.back-btn {
  background: var(--card-bg);
  border: none;
  border-radius: 50px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  transition: background 0.2s, transform 0.15s;
  font-family: 'Noto Sans JP', sans-serif;
  white-space: nowrap;
}

.back-btn:hover { background: var(--primary); color: white; transform: scale(1.05); }

.screen-title {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text);
}

/* ================================
   Practice Select Screen
================================ */
.dan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.dan-btn {
  background: var(--card-bg);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 1.2rem 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  text-align: center;
}

.dan-btn:hover,
.dan-btn.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(108,99,255,0.35);
}

.dan-btn-all {
  grid-column: span 3;
  background: linear-gradient(135deg, var(--primary), #8B5CF6);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(108, 99, 255, 0.4);
}

.dan-btn-all:hover,
.dan-btn-all.selected {
  background: linear-gradient(135deg, var(--primary-dark), #7c3aed);
  transform: scale(1.02);
  color: white;
  border-color: transparent;
}

/* 1年生モード：段ボタン（カラー個別） */
.dan-btn-beginner {
  background: var(--dan-bg, #EEF2FF);
  border-color: var(--dan-border, #C7D2FE);
  color: var(--dan-text, #4338CA);
}

.dan-btn-beginner.selected,
.dan-btn-beginner:hover {
  background: var(--dan-header, #6C63FF) !important;
  border-color: var(--dan-header, #6C63FF) !important;
  color: white !important;
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

/* ================================
   Quiz Screen
================================ */
.quiz-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  justify-content: flex-end;
}

.quiz-progress {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-light);
  white-space: nowrap;
}

.timer-bar-wrap {
  flex: 1;
  max-width: 160px;
  height: 8px;
  background: #E2E8F0;
  border-radius: 4px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--success), var(--warning));
  border-radius: 4px;
  transition: width 0.1s linear, background 0.5s;
}

.timer-bar.danger { background: var(--danger); }

.timer-text {
  font-size: 1rem;
  font-weight: 900;
  color: var(--primary);
  min-width: 24px;
  text-align: right;
}

/* Question Card */
.quiz-question-wrap {
  display: flex;
  justify-content: center;
  margin: 1rem 0 1.5rem;
}

.question-card {
  background: linear-gradient(135deg, var(--primary) 0%, #8B5CF6 100%);
  border-radius: var(--radius);
  padding: 1.5rem 2.5rem;
  box-shadow: 0 8px 32px rgba(108,99,255,0.4);
  animation: popIn 0.4s var(--transition);
  text-align: center;
  min-width: 240px;
}

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

/* 式 例: 2 × 2 */
.question-formula {
  font-size: 3rem;
  font-weight: 900;
  color: white;
  letter-spacing: 0.05em;
  line-height: 1.1;
}

/* よみかた 例: （ににんが…） */
.question-yomi {
  font-size: 1rem;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 0.25rem 0.9rem;
  margin: 0.4rem auto 0;
  display: inline-block;
  letter-spacing: 0.02em;
}

/* = ? */
.question-eq {
  font-size: 2rem;
  font-weight: 900;
  color: rgba(255,255,255,0.9);
  margin-top: 0.2rem;
}

/* Choices Grid */
.choices-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.choice-btn {
  background: var(--card-bg);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  font-size: 1.5rem;
  font-weight: 900;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  text-align: center;
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(108,99,255,0.35);
}

.choice-btn.correct {
  background: var(--success) !important;
  border-color: var(--success) !important;
  color: white !important;
  transform: scale(1.08) !important;
  box-shadow: 0 6px 20px rgba(81,207,102,0.5) !important;
}

.choice-btn.wrong {
  background: var(--danger) !important;
  border-color: var(--danger) !important;
  color: white !important;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.choice-btn:disabled { cursor: default; }

/* Quiz Footer */
.quiz-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  border-radius: 50px;
  padding: 0.6rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.streak-display, .score-display {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.streak-display .fa-fire { color: var(--warning); }
.score-display .fa-star  { color: #FFD43B; }

/* ================================
   Result Screen
================================ */
.result-wrap {
  text-align: center;
  padding: 1rem 0;
}

.result-emoji {
  font-size: 5rem;
  margin-bottom: 0.5rem;
  animation: tada 0.8s ease;
}

@keyframes tada {
  0%   { transform: scale(1); }
  10%  { transform: scale(0.9) rotate(-3deg); }
  20%  { transform: scale(1.1) rotate(3deg); }
  40%  { transform: scale(1.1) rotate(-3deg); }
  60%  { transform: scale(1.05) rotate(2deg); }
  80%  { transform: scale(1.02) rotate(-1deg); }
  100% { transform: scale(1) rotate(0); }
}

.result-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.result-score-big {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.5rem;
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.result-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.r-label { font-size: 0.8rem; color: var(--text-light); }
.r-value { font-size: 1.3rem; font-weight: 900; color: var(--primary); }

/* Wrong Answers */
.wrong-answers {
  background: #FFF5F5;
  border: 2px solid #FFE0E0;
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.wrong-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.wrong-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wrong-item {
  background: white;
  border: 1.5px solid #FECACA;
  border-radius: 10px;
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.wi-formula { font-weight: 700; color: var(--danger); }
.wi-ans { font-weight: 900; color: var(--text); font-size: 1rem; }
.wi-yomi { font-size: 0.8rem; color: var(--primary); background: #EEF2FF; border-radius: 8px; padding: 0.15rem 0.5rem; }

.result-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ================================
   Multiplication Table Screen
================================ */

/* タブ */
.table-mode-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab-btn {
  flex: 1;
  padding: 0.6rem 1rem;
  border-radius: 50px;
  border: 2px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 700;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.tab-btn.active {
  background: var(--primary);
  color: white;
}

.tab-btn:hover:not(.active) {
  background: #EEF0FF;
}

/* ヒントテキスト */
.table-hint {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* グリッドテーブル */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.kuku-grid-table {
  border-collapse: collapse;
  width: 100%;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.kuku-grid-table th,
.kuku-grid-table td {
  text-align: center;
  border: 1px solid rgba(0,0,0,0.06);
  min-width: 44px;
}

.kuku-grid-table thead th {
  color: white;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.5rem 0.3rem;
}

.kuku-grid-table td.row-header {
  color: white !important;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.5rem 0.3rem;
}

/* セル */
.kuku-cell {
  cursor: pointer;
  padding: 0.3rem 0.2rem;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}

.kuku-cell:hover {
  transform: scale(1.12);
  z-index: 2;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  border-radius: 6px;
}

.kuku-cell .cell-formula {
  display: block;
  font-size: 0.6rem;
  opacity: 0.6;
  line-height: 1;
  margin-bottom: 1px;
}

.kuku-cell .cell-answer {
  display: block;
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1.2;
}

.kuku-cell .cell-goro-icon {
  display: block;
  font-size: 0.55rem;
  line-height: 1;
}

/* 段ごと選択ボタン */
.dan-select-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.dan-select-btn {
  padding: 0.45rem 0.75rem;
  border-radius: 50px;
  border: 2px solid #D1D5DB;
  background: white;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
}

.dan-select-btn.active,
.dan-select-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* 段カードのタイトル */
.dan-cards-title {
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 1rem;
  text-align: center;
}

/* 段カードグリッド */
.dan-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

@media (min-width: 500px) {
  .dan-cards-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 650px) {
  .dan-cards-grid { grid-template-columns: repeat(5, 1fr); }
}

.dan-formula-card {
  border-radius: 14px;
  border: 2px solid;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow 0.2s;
  box-shadow: var(--shadow-sm);
}

.dan-formula-card:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.dfc-header {
  padding: 0.4rem;
  text-align: center;
}

.dfc-num {
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
}

.dfc-body {
  padding: 0.6rem 0.4rem;
  text-align: center;
}

.dfc-answer {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 0.3rem;
}

.dfc-yomi {
  font-size: 0.7rem;
  color: #6B7280;
  margin-bottom: 0.3rem;
  line-height: 1.3;
  min-height: 1.5em;
}

.dfc-goro {
  font-size: 0.7rem;
  color: #374151;
  background: rgba(0,0,0,0.05);
  border-radius: 6px;
  padding: 0.3rem 0.4rem;
  line-height: 1.4;
  text-align: left;
}

/* ================================
   語呂合わせモーダル
================================ */
.kuku-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.kuku-modal-overlay.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.kuku-modal {
  background: white;
  border-radius: 24px;
  padding: 2rem 2rem 1.5rem;
  max-width: 360px;
  width: 100%;
  text-align: center;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: popIn 0.3s var(--transition);
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: #F3F4F6;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 0.9rem;
  cursor: pointer;
  color: #6B7280;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover { background: #E5E7EB; }

.modal-formula {
  font-size: 2.2rem;
  font-weight: 900;
  margin-bottom: 0.3rem;
}

.modal-answer {
  font-size: 3rem;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.modal-yomi {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  background: #EEF2FF;
  border-radius: 10px;
  padding: 0.5rem 1rem;
  margin-bottom: 0.75rem;
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-goro {
  font-size: 0.95rem;
  color: var(--text);
  background: #FFFBEB;
  border: 1.5px solid #FDE68A;
  border-radius: 10px;
  padding: 0.6rem 1rem;
  margin-bottom: 1.25rem;
  line-height: 1.6;
  min-height: 2.5rem;
}

.modal-close-btn {
  width: 100%;
}

/* ================================
   Feedback Overlay
================================ */
.feedback-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  z-index: 1000;
  pointer-events: none;
  transition: transform 0.2s var(--transition);
}

.feedback-overlay.show {
  transform: translate(-50%, -50%) scale(1);
}

.feedback-overlay.hide {
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.2s ease-in;
}

.feedback-content {
  font-size: 4rem;
  font-weight: 900;
  text-align: center;
  padding: 1rem 2rem;
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.feedback-correct {
  background: rgba(81, 207, 102, 0.95);
  color: white;
  box-shadow: 0 8px 32px rgba(81,207,102,0.5);
}

.feedback-wrong {
  background: rgba(255, 107, 107, 0.95);
  color: white;
  box-shadow: 0 8px 32px rgba(255,107,107,0.5);
}

.feedback-timeout {
  background: rgba(255, 169, 77, 0.95);
  color: white;
  box-shadow: 0 8px 32px rgba(255,169,77,0.5);
}

/* ================================
   Responsive
================================ */
@media (max-width: 480px) {
  .hero-title { font-size: 1.8rem; }
  .question-text { font-size: 2.2rem; }
  .question-card { padding: 1.5rem 2rem; }
  .choice-btn { font-size: 1.2rem; padding: 0.9rem; }
  .mode-cards { grid-template-columns: 1fr; }
}
