/* =============================================
   style.css - メインスタイル（モバイルファースト）
   白基調のクリーンデザイン
   ============================================= */

/* --- CSS変数 --- */
:root {
  --primary: #5B6AF0;
  --primary-light: #8B95F7;
  --primary-pale: #EEF0FF;
  --secondary: #34C7A5;
  --secondary-pale: #E8F8F3;
  --danger: #F06565;
  --danger-pale: #FEF0F0;
  --warning: #F5A623;
  --warning-pale: #FFF5E5;
  --accent: #E8585A;
  --bg-body: #F7F8FC;
  --bg-white: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-surface: #F0F1F6;
  --text-primary: #2D3142;
  --text-secondary: #8E92A4;
  --text-tertiary: #BFC2CF;
  --border: #E8EAF0;
  --shadow-sm: 0 1px 3px rgba(45, 49, 66, 0.06);
  --shadow-md: 0 4px 12px rgba(45, 49, 66, 0.08);
  --shadow-lg: 0 8px 24px rgba(45, 49, 66, 0.1);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 50px;
  --font-display: 'M PLUS Rounded 1c', sans-serif;
  --font-body: 'Noto Sans JP', sans-serif;
}

/* --- リセット & ベース --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-body);
  font-family: var(--font-body);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 20px;
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
  padding-left: max(20px, env(safe-area-inset-left, 20px));
  padding-right: max(20px, env(safe-area-inset-right, 20px));
  position: relative;
}

/* --- ボタン共通 --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  padding: 14px 32px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  -webkit-user-select: none;
  user-select: none;
  box-shadow: 0 2px 8px rgba(91, 106, 240, 0.25);
  letter-spacing: 0.02em;
}

.btn-primary:hover {
  background: var(--primary-light);
  box-shadow: 0 4px 16px rgba(91, 106, 240, 0.3);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-white);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 12px 28px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, transform 0.1s, background 0.2s;
  -webkit-user-select: none;
  user-select: none;
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-pale);
}

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

/* --- スプラッシュ画面 --- */
.splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  position: relative;
  overflow: hidden;
  background: var(--bg-white);
  margin: 0 -20px;
  padding: 0 20px;
}

.splash__particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.splash__particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0.15;
  animation: floatParticle 6s ease-in-out infinite;
}

.splash__particle:nth-child(1) {
  background: var(--primary);
  top: 20%;
  left: 10%;
  width: 80px;
  height: 80px;
  animation-delay: 0s;
  animation-duration: 8s;
}

.splash__particle:nth-child(2) {
  background: var(--secondary);
  top: 60%;
  left: 80%;
  width: 60px;
  height: 60px;
  animation-delay: 1s;
  animation-duration: 9s;
}

.splash__particle:nth-child(3) {
  background: var(--warning);
  top: 30%;
  left: 70%;
  width: 40px;
  height: 40px;
  animation-delay: 2s;
  animation-duration: 7s;
}

.splash__particle:nth-child(4) {
  background: var(--accent);
  top: 75%;
  left: 15%;
  width: 50px;
  height: 50px;
  animation-delay: 0.5s;
  animation-duration: 10s;
}

.splash__particle:nth-child(5) {
  background: var(--primary-light);
  top: 45%;
  left: 45%;
  width: 30px;
  height: 30px;
  animation-delay: 3s;
  animation-duration: 6s;
}

.splash__particle:nth-child(6) {
  background: var(--secondary);
  top: 10%;
  left: 55%;
  width: 45px;
  height: 45px;
  animation-delay: 1.5s;
  animation-duration: 8.5s;
}

.splash__particle:nth-child(7) {
  background: var(--warning);
  top: 85%;
  left: 60%;
  width: 35px;
  height: 35px;
  animation-delay: 2.5s;
  animation-duration: 7.5s;
}

.splash__particle:nth-child(8) {
  background: var(--primary);
  top: 50%;
  left: 85%;
  width: 55px;
  height: 55px;
  animation-delay: 4s;
  animation-duration: 9.5s;
}

@keyframes floatParticle {
  0%, 100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.1;
  }
  25% {
    transform: translate(15px, -20px) scale(1.1);
    opacity: 0.2;
  }
  50% {
    transform: translate(-10px, -35px) scale(0.9);
    opacity: 0.15;
  }
  75% {
    transform: translate(20px, -15px) scale(1.05);
    opacity: 0.18;
  }
}

.splash__content {
  position: relative;
  z-index: 1;
}

.splash__title {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.splash__subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 48px;
  font-weight: 400;
}

.splash__start-btn {
  font-size: 1.1rem;
  padding: 16px 56px;
  border-radius: var(--radius-full);
}

/* --- ホーム画面 --- */
.home {
  padding-top: 24px;
  padding-bottom: 32px;
}

.home__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 8px;
}

.home__level-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-pale);
  border-radius: var(--radius-full);
  padding: 6px 16px;
}

.home__level-number {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1rem;
  color: var(--primary);
}

.home__level-title {
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 500;
}

.home__stats-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.home__score {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.home__score-value {
  font-weight: 700;
  color: var(--text-primary);
}

.home__streak {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.home__streak-icon {
  font-size: 1rem;
}

.home__streak-value {
  font-weight: 700;
  color: var(--accent);
}

.home__section-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

/* デイリーチャレンジカード */
.home__daily-card {
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-white);
  box-shadow: var(--shadow-md);
  transition: transform 0.2s, box-shadow 0.2s;
}

.home__daily-card:active {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.home__daily-card--played {
  opacity: 0.5;
  pointer-events: none;
}

.home__daily-emoji {
  font-size: 2rem;
}

.home__daily-info {
  flex: 1;
}

.home__daily-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.home__daily-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.home__daily-score {
  font-size: 0.82rem;
  color: var(--primary);
  font-weight: 700;
  margin-top: 4px;
}

/* カテゴリグリッド */
.home__category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.home__category-card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  cursor: pointer;
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.home__category-card:active {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.home__category-emoji {
  font-size: 1.8rem;
  line-height: 1;
}

.home__category-name {
  font-weight: 700;
  font-size: 0.9rem;
}

.home__category-stars {
  display: flex;
  gap: 2px;
  font-size: 0.75rem;
}

.home__category-star {
  color: var(--warning);
}

.home__category-star--empty {
  color: var(--text-tertiary);
}

.home__category-plays {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* フッターボタン群 */
.home__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding-top: 8px;
}

.home__stats-btn {
  flex: 1 1 calc(50% - 5px);
  min-width: 140px;
}

/* --- クイズ画面 --- */
.quiz {
  padding-top: 20px;
  padding-bottom: 24px;
}

.quiz__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.quiz__category {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.quiz__category-emoji {
  font-size: 1.1rem;
}

.quiz__progress {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 700;
}

.quiz__score {
  font-size: 0.82rem;
  color: var(--primary);
  font-weight: 700;
}

/* タイマー */
.quiz__timer-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}

.quiz__timer {
  position: relative;
  width: 100px;
  height: 100px;
}

.quiz__timer-svg {
  width: 100px;
  height: 100px;
  transform: rotate(-90deg);
}

.quiz__timer-bg {
  fill: none;
  stroke: var(--bg-surface);
  stroke-width: 6;
}

.quiz__timer-progress {
  fill: none;
  stroke: var(--primary);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.9s linear, stroke 0.3s;
}

.quiz__timer-progress--warning {
  stroke: var(--danger);
}

.quiz__timer-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text-primary);
}

.quiz__timer-text--warning {
  color: var(--danger);
}

/* 問題テキスト */
.quiz__question {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.8;
  margin-bottom: 28px;
  padding: 0 4px;
  min-height: 3.6em;
  color: var(--text-primary);
}

/* 選択肢 */
.quiz__choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.quiz__choice-btn {
  display: flex;
  align-items: center;
  width: 100%;
  background: var(--bg-white);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.92rem;
  font-family: var(--font-body);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  -webkit-user-select: none;
  user-select: none;
}

.quiz__choice-btn:hover {
  border-color: var(--primary-light);
  background: var(--primary-pale);
}

.quiz__choice-btn:active {
  transform: scale(0.98);
}

.quiz__choice-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.quiz__choice-btn:disabled:hover {
  border-color: var(--border);
  background: var(--bg-white);
}

.quiz__choice-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.8rem;
  margin-right: 12px;
  flex-shrink: 0;
}

.quiz__choice-text {
  flex: 1;
}

/* 正解・不正解 */
.quiz__choice-btn.correct {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
}

.quiz__choice-btn.correct .quiz__choice-label {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.quiz__choice-btn.wrong {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.quiz__choice-btn.wrong .quiz__choice-label {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* ストリーク */
.quiz__streak {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  min-height: 1.5em;
  margin-bottom: 8px;
}

.quiz__streak-value {
  color: var(--accent);
}

/* 解説 */
.quiz__explanation {
  background: var(--primary-pale);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-top: 16px;
  font-size: 0.88rem;
  line-height: 1.8;
  color: var(--text-primary);
  border-left: 3px solid var(--primary);
}

.quiz__explanation-label {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* 次の問題ボタン */
.quiz__next-btn {
  width: 100%;
  margin-top: 16px;
}

/* --- 結果画面 --- */
.result {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 48px;
  padding-bottom: 40px;
  text-align: center;
}

.result__category {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.result__category-emoji {
  font-size: 1.4rem;
  margin-right: 4px;
}

.result__score-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.result__score {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1.1;
  margin-bottom: 8px;
}

.result__score-suffix {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.result__stars {
  display: flex;
  gap: 8px;
  margin: 20px 0;
}

.result__star {
  font-size: 2.5rem;
  display: inline-block;
}

.result__star--empty {
  opacity: 0.15;
}

.result__perfect {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  margin-bottom: 16px;
  letter-spacing: 2px;
}

.result__stats {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 24px 0 36px;
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 340px;
}

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

.result__stat-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-primary);
}

.result__stat-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.result__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 300px;
}

.result__actions .btn-primary,
.result__actions .btn-secondary {
  width: 100%;
}

/* --- 統計画面 --- */
.stats {
  padding-top: 24px;
  padding-bottom: 32px;
}

.stats__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.stats__back-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.stats__title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 900;
}

.stats__level-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}

.stats__level-number {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--primary);
}

.stats__level-title {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.stats__overview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}

.stats__overview-item {
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stats__overview-value {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text-primary);
}

.stats__overview-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.stats__category-section-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.stats__category-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.stats__category-item {
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.stats__category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.stats__category-name {
  font-weight: 700;
  font-size: 0.88rem;
}

.stats__category-accuracy-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 700;
}

.stats__category-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--bg-surface);
  border-radius: 4px;
  overflow: hidden;
}

.stats__category-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.6s ease-out;
  min-width: 0;
}

.stats__footer {
  display: flex;
  justify-content: center;
}

.stats__back-bottom-btn {
  width: 100%;
}

/* --- 広告バナー --- */
.ad-banner {
  margin: 20px 0;
}

.ad-placeholder {
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.82rem;
}

.ad-banner-wrapper {
  margin: 16px 0;
}

/* --- 深掘りエリア --- */
.quiz__deep-dive {
  margin-top: 12px;
}

.quiz__deep-dive-btn {
  width: 100%;
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.quiz__deep-dive-text {
  background: var(--secondary-pale);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.85rem;
  line-height: 1.8;
  color: var(--text-primary);
  border-left: 3px solid var(--secondary);
}

/* --- 復習モードホーム --- */
.review-home {
  padding-top: 24px;
  padding-bottom: 32px;
}

.review-home__desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.8;
  margin-bottom: 24px;
}

.review-home__empty {
  text-align: center;
  padding: 48px 20px;
}

.review-home__empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.review-home__empty-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.8;
}

.review-home__start-btn {
  width: 100%;
  margin-bottom: 24px;
}

.review-home__weak-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.review-home__weak-item {
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.review-home__weak-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.review-home__weak-name {
  font-weight: 700;
  font-size: 0.88rem;
}

.review-home__weak-accuracy {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 700;
}

.review-home__weak-accuracy--low {
  color: var(--danger);
}

.review-home__weak-info {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* --- ランキング画面 --- */
.ranking {
  padding-top: 24px;
  padding-bottom: 32px;
}

.ranking__my-rank {
  background: var(--primary-pale);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  margin-bottom: 20px;
}

.ranking__my-rank-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.ranking__my-rank-value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--primary);
}

.ranking__my-rank-total {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.ranking__tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  padding: 3px;
}

.ranking__tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: none;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: var(--font-body);
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: background 0.2s, color 0.2s;
}

.ranking__tab--active {
  background: var(--bg-white);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.ranking__content {
  min-height: 200px;
}

.ranking__empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.ranking__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ranking__row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.ranking__row:nth-child(-n+3) {
  background: var(--primary-pale);
}

.ranking__rank {
  width: 36px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1rem;
  text-align: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.ranking__row:nth-child(-n+3) .ranking__rank {
  font-size: 1.3rem;
}

.ranking__name {
  flex: 1;
  font-weight: 700;
  font-size: 0.88rem;
  margin-left: 8px;
}

.ranking__score-val {
  font-size: 0.82rem;
  color: var(--primary);
  font-weight: 700;
}

.ranking__cat-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.ranking__cat-btn {
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 0.78rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.ranking__cat-btn:hover {
  border-color: var(--primary);
  background: var(--primary-pale);
}

/* --- 設定画面 --- */
.settings {
  padding-top: 24px;
  padding-bottom: 32px;
}

.settings__section {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.settings__section--danger {
  border: 1px solid var(--danger-pale);
}

.settings__section-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.settings__section-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.6;
}

.settings__nick-row {
  display: flex;
  gap: 8px;
}

.settings__nick-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-body);
  outline: none;
  transition: border-color 0.2s;
}

.settings__nick-input:focus {
  border-color: var(--primary);
}

.settings__nick-save {
  padding: 10px 20px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.settings__premium-active {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.settings__premium-badge {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.settings__premium-price {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 12px;
}

.settings__premium-btn {
  width: 100%;
}

.settings__reset-btn {
  width: 100%;
}

/* --- ニックネームモーダル --- */
.nickname-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(45, 49, 66, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.nickname-modal {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.nickname-modal__title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.nickname-modal__desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.nickname-modal__input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-body);
  color: var(--text-primary);
  text-align: center;
  outline: none;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

.nickname-modal__input:focus {
  border-color: var(--primary);
}

.nickname-modal__submit {
  width: 100%;
  margin-bottom: 8px;
}

.nickname-modal__skip {
  width: 100%;
}

/* --- レベル一覧モーダル --- */
.level-modal {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  max-width: 380px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.level-modal__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: 20px;
}

.level-modal__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}

.level-modal__row {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.level-modal__row--current {
  background: var(--primary-pale);
  border: 1.5px solid var(--primary-light);
}

.level-modal__row--locked {
  opacity: 0.4;
}

.level-modal__lock {
  font-size: 1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.level-modal__info {
  flex: 1;
  margin-left: 8px;
}

.level-modal__row-title {
  font-weight: 700;
  font-size: 0.9rem;
}

.level-modal__row--locked .level-modal__row-title {
  font-style: italic;
  color: var(--text-tertiary);
}

.level-modal__row-level {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.level-modal__current-badge {
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.level-modal__close {
  width: 100%;
}

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

/* 大きめスマホ */
@media (min-width: 480px) {
  #app {
    padding: 0 24px;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .splash__title {
    font-size: 3.2rem;
  }

  .quiz__question {
    font-size: 1.2rem;
  }

  .result__score {
    font-size: 4rem;
  }

  .home__category-grid {
    gap: 14px;
  }
}

/* タブレット */
@media (min-width: 768px) {
  #app {
    max-width: 560px;
  }

  .home__category-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }

  .stats__overview {
    grid-template-columns: repeat(4, 1fr);
  }

  .splash__title {
    font-size: 3.6rem;
  }
}
