/* ===== Global ===== */
.juken-local-preview-banner {
  margin-bottom: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: 0.5rem;
  border: 1px solid #f59e0b;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.8125rem;
  line-height: 1.45;
}

html{scroll-behavior:smooth}
/* タブクリック時のスクロールを防ぐ */
.subject-tab:focus {
  outline: none;
}
/* キーボード操作時のフォーカスインジケーター */
.subject-tab:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.7);
  outline-offset: 2px;
  border-radius: 0.5rem;
}

/* タッチ操作最適化 */
* {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  -webkit-touch-callout: none;
}

button, a, [role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}
/* フォーカスインジケーターの強化 */
button:focus-visible, 
a:focus-visible, 
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.8);
  outline-offset: 2px;
  border-radius: 0.25rem;
}
/* メインタブのフォーカス */
.main-tab:focus-visible {
  outline: 3px solid rgba(234, 88, 12, 0.8);
  outline-offset: 2px;
  border-radius: 0.5rem;
}
.brand-gradient{background:linear-gradient(135deg,#2563eb,#7c3aed)}
.card{background:#fff;border:2px solid rgb(226 232 240);border-radius:1rem;transition:all .3s ease;box-shadow:0 2px 8px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.1);cursor:pointer}
.card:hover{transform:translateY(-6px) scale(1.02);box-shadow:0 12px 32px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.15);border-color:rgb(203 213 225)}
.card:active{transform:translateY(-4px) scale(1.01)}

/* 教科別カードスタイル */
.card.math{background:linear-gradient(135deg, #eff6ff, #dbeafe);border-color:#3b82f6;box-shadow:0 4px 16px rgba(59, 130, 246, 0.15), 0 2px 6px rgba(59, 130, 246, 0.1)}
.card.math:hover{box-shadow:0 12px 32px rgba(59, 130, 246, 0.25), 0 6px 16px rgba(59, 130, 246, 0.15);border-color:#2563eb}

.card.soc{background:linear-gradient(135deg, #fff7ed, #fed7aa);border-color:#ea580c;box-shadow:0 4px 16px rgba(234, 88, 12, 0.15), 0 2px 6px rgba(234, 88, 12, 0.1)}
.card.soc:hover{box-shadow:0 12px 32px rgba(234, 88, 12, 0.25), 0 6px 16px rgba(234, 88, 12, 0.15);border-color:#c2410c}

.card.sci{background:linear-gradient(135deg, #f0fdf4, #bbf7d0);border-color:#16a34a;box-shadow:0 4px 16px rgba(22, 163, 74, 0.15), 0 2px 6px rgba(22, 163, 74, 0.1)}
.card.sci:hover{box-shadow:0 12px 32px rgba(22, 163, 74, 0.25), 0 6px 16px rgba(22, 163, 74, 0.15);border-color:#15803d}

.card.jpn{background:linear-gradient(135deg, #fef2f2, #fecaca);border-color:#dc2626;box-shadow:0 4px 16px rgba(220, 38, 38, 0.15), 0 2px 6px rgba(220, 38, 38, 0.1)}
.card.jpn:hover{box-shadow:0 12px 32px rgba(220, 38, 38, 0.25), 0 6px 16px rgba(220, 38, 38, 0.15);border-color:#b91c1c}

.card.eng{background:linear-gradient(135deg, #f8fafc, #e2e8f0);border-color:#64748b;box-shadow:0 4px 16px rgba(100, 116, 139, 0.15), 0 2px 6px rgba(100, 116, 139, 0.1)}
.card.eng:hover{box-shadow:0 12px 32px rgba(100, 116, 139, 0.25), 0 6px 16px rgba(100, 116, 139, 0.15);border-color:#475569}

/* おすすめレッスンカードの特別スタイル（シンプル・テーマカラー対応） */
.card.recommended-card{
  background:#ffffff;
  border-left-width: 4px;
  border-top-width: 2px;
  border-right-width: 2px;
  border-bottom-width: 2px;
  border-color: rgb(226 232 240);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.1);
}

/* 理科のおすすめカード（緑系） */
.card.recommended-card.recommended-sci{
  border-left-color: #16a34a;
  background: linear-gradient(to right, #f0fdf4 0%, #ffffff 10%);
}

.card.recommended-card.recommended-sci:hover{
  border-left-color: #15803d;
  box-shadow: 0 12px 32px rgba(22, 163, 74, 0.15), 0 4px 12px rgba(22, 163, 74, 0.1);
  transform: translateY(-6px) scale(1.02);
}

/* 社会のおすすめカード（オレンジ系） */
.card.recommended-card.recommended-soc{
  border-left-color: #ea580c;
  background: linear-gradient(to right, #fff7ed 0%, #ffffff 10%);
}

.card.recommended-card.recommended-soc:hover{
  border-left-color: #c2410c;
  box-shadow: 0 12px 32px rgba(234, 88, 12, 0.15), 0 4px 12px rgba(234, 88, 12, 0.1);
  transform: translateY(-6px) scale(1.02);
}

/* シンプルなバッジスタイル（レインボー装飾なし） */
.badge.recommend-simple{
  padding: 0.25rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* ===== ルートマップ風レイアウト ===== */
.route-map-section {
  margin-bottom: 0.5rem;
  padding: 0.375rem 0.375rem 0.375rem 0.5rem; /* 左側のパディングを少し増やす */
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden; /* 横スクロールを親要素内に閉じ込める */
  touch-action: pan-y; /* 縦方向のスクロールは許可、横方向は子要素で制御 */
}

/* PC版で中央配置（縦並び） */
@media (min-width: 1024px) {
  /* おすすめ学習時のlessonListを中央配置 */
  #homeView:not(.math-full-width) #lessonList {
    display: block !important;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
  }
  
  .route-map-section {
    max-width: 100%;
    margin-bottom: 0.375rem;
    padding: 0.25rem 0.25rem 0.25rem 0.5rem; /* 左側のパディングを追加 */
  }
}

.route-map-section-sci {
  border-left: 3px solid #16a34a;
  background: linear-gradient(to right, rgba(240, 253, 244, 0.5), rgba(255, 255, 255, 0.8));
  position: relative;
  overflow: hidden;
}

/* 理科っぽい背景パターン（フラスコ・分子構造など） */
.route-map-section-sci::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    /* ビーカー */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2316a34a' opacity='0.08' d='M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm0-4H7v-2h7v2zm0-4H7V7h7v2z'/%3E%3C/svg%3E"),
    /* フラスコ */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2316a34a' opacity='0.08' d='M19.5 3.5L18 2l-1.5 1.5L15 2l-1.5 1.5L12 2l-1.5 1.5L9 2 7.5 3.5 6 2v14H3v3c0 1.66 1.34 3 3 3h12c1.66 0 3-1.34 3-3V2l-1.5 1.5zM19 19c0 .55-.45 1-1 1s-1-.45-1-1v-3H8V5h11v14z'/%3E%3C/svg%3E"),
    /* 分子構造（原子） */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle fill='%2316a34a' opacity='0.08' cx='12' cy='12' r='3'/%3E%3Cline stroke='%2316a34a' stroke-opacity='0.08' stroke-width='1.5' x1='12' y1='9' x2='12' y2='6'/%3E%3Cline stroke='%2316a34a' stroke-opacity='0.08' stroke-width='1.5' x1='12' y1='15' x2='12' y2='18'/%3E%3Cline stroke='%2316a34a' stroke-opacity='0.08' stroke-width='1.5' x1='15' y1='12' x2='18' y2='12'/%3E%3Cline stroke='%2316a34a' stroke-opacity='0.08' stroke-width='1.5' x1='9' y1='12' x2='6' y2='12'/%3E%3C/svg%3E"),
    /* 星（天体） */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2316a34a' opacity='0.08' d='M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E"),
    radial-gradient(circle at 20% 30%, rgba(22, 163, 74, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(34, 197, 94, 0.03) 0%, transparent 50%);
  background-size: 
    50px 50px,
    45px 45px,
    40px 40px,
    35px 35px,
    200px 200px,
    180px 180px;
  background-position: 
    10% 15%,
    70% 50%,
    45% 75%,
    85% 30%,
    0% 0%,
    100% 100%;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 0;
}

.route-map-section-sci > * {
  position: relative;
  z-index: 1;
}

/* セクションラベル（うっすらと表示） */
.route-map-section-label {
  position: absolute;
  top: 0.5rem;
  left: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.15);
  pointer-events: none;
  z-index: 2;
  letter-spacing: 0.05em;
  text-transform: none;
}

.route-map-section-sci .route-map-section-label {
  color: rgba(22, 163, 74, 0.2);
}

.route-map-section-soc .route-map-section-label {
  color: rgba(234, 88, 12, 0.2);
}

.route-map-section-review .route-map-section-label {
  color: rgba(139, 92, 246, 0.2);
}

/* モバイルでの調整 */
@media (max-width: 375px) {
  .route-map-section-label {
    font-size: 0.6875rem;
    top: 0.375rem;
    left: 0.5rem;
  }
}

.route-map-section-soc {
  border-left: 3px solid #ea580c;
  background: linear-gradient(to right, rgba(255, 247, 237, 0.5), rgba(255, 255, 255, 0.8));
  position: relative;
  overflow: hidden;
}

/* 社会っぽい背景パターン（地図・建物など） */
.route-map-section-soc::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    /* 地図アイコン */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ea580c' opacity='0.08' d='M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM15 19l-6-2.11V5l6 2.11V19z'/%3E%3C/svg%3E"),
    /* 建物アイコン */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ea580c' opacity='0.08' d='M12 7V3H2v18h20V7H12zM6 19H4v-2h2v2zm0-4H4v-2h2v2zm0-4H4V9h2v2zm0-4H4V5h2v2zm4 12H8v-2h2v2zm0-4H8v-2h2v2zm0-4H8V9h2v2zm0-4H8V5h2v2zm10 12h-8v-2h2v-2h-2v-2h2v-2h-2V9h8v10zm-2-8h-2v2h2v-2zm0 4h-2v2h2v-2z'/%3E%3C/svg%3E"),
    /* 地球儀アイコン */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ea580c' opacity='0.08' d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.94-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z'/%3E%3C/svg%3E"),
    /* 時計（歴史） */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ea580c' opacity='0.08' d='M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z'/%3E%3C/svg%3E"),
    radial-gradient(circle at 15% 40%, rgba(234, 88, 12, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 85% 60%, rgba(249, 115, 22, 0.03) 0%, transparent 50%);
  background-size: 
    50px 50px,
    45px 45px,
    42px 42px,
    38px 38px,
    200px 200px,
    180px 180px;
  background-position: 
    12% 20%,
    65% 50%,
    80% 70%,
    35% 35%,
    0% 0%,
    100% 100%;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 0;
}

.route-map-section-soc > * {
  position: relative;
  z-index: 1;
}

/* おさらいレッスン専用セクション */
.route-map-section-review {
  border-left: 3px solid #8b5cf6;
  background: linear-gradient(to right, rgba(245, 243, 255, 0.5), rgba(255, 255, 255, 0.8));
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
}

/* おさらいっぽい背景パターン（時計・リフレッシュなど） */
.route-map-section-review::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    /* 時計アイコン */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%238b5cf6' opacity='0.08' d='M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z'/%3E%3C/svg%3E"),
    /* リフレッシュアイコン */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%238b5cf6' opacity='0.08' d='M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z'/%3E%3C/svg%3E"),
    radial-gradient(circle at 25% 35%, rgba(139, 92, 246, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 75% 65%, rgba(167, 139, 250, 0.03) 0%, transparent 50%);
  background-size: 
    45px 45px,
    42px 42px,
    200px 200px,
    180px 180px;
  background-position: 
    15% 25%,
    70% 55%,
    0% 0%,
    100% 100%;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 0;
}

.route-map-section-review > * {
  position: relative;
  z-index: 1;
}

/* おさらいレッスン用グリッド */
.review-lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  padding: 0.5rem 0;
}

@media (max-width: 375px) {
  .review-lessons-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0.375rem 0;
  }
}

/* おさらいレッスンカード */
.review-lesson-card-wrapper {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.review-lesson-card-wrapper:hover {
  transform: translateY(-2px);
}

.review-lesson-card {
  background: white;
  border: 1.5px solid #8b5cf6;
  border-radius: 8px;
  padding: 0.75rem;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.1);
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.review-lesson-card:hover {
  border-color: #7c3aed;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.2);
}

.review-lesson-card.completed {
  background: linear-gradient(135deg, #f5f3ff, #ffffff);
}

.review-lesson-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.375rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.review-lesson-meta {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.review-lesson-badge {
  display: inline-block;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.review-lesson-button {
  width: 100%;
  padding: 0.5rem;
  border: none;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: auto;
}

.review-lesson-button.review {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
}

.review-lesson-button.review:hover {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.review-lesson-button.locked {
  background: #e2e8f0;
  color: #94a3b8;
  cursor: not-allowed;
}

@media (max-width: 375px) {
  .review-lessons-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  
  .review-lesson-card {
    padding: 0.625rem;
    border-radius: 6px;
  }
  
  .review-lesson-title {
    font-size: 0.8125rem;
    margin-bottom: 0.25rem;
  }
  
  .review-lesson-meta {
    font-size: 0.6875rem;
    margin-bottom: 0.375rem;
  }
  
  .review-lesson-badge {
    font-size: 0.625rem;
    padding: 0.1875rem 0.375rem;
    margin-bottom: 0.375rem;
  }
  
  .review-lesson-button {
    padding: 0.4375rem;
    font-size: 0.75rem;
    border-radius: 4px;
  }
}

/* 旧スタイル（互換性のため残す） */
.route-map-card.review {
  border-color: #8b5cf6;
  background: linear-gradient(135deg, #f5f3ff, #ffffff);
}

.route-map-card.review:hover {
  border-color: #7c3aed;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.15);
}

.route-map-card-badge.review-badge {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  font-weight: 700;
}

.route-map-card-button.review {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
}

.route-map-card-button.review:hover {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.route-map-section-header {
  margin-bottom: 0.375rem;
  padding-bottom: 0.25rem;
  border-bottom: 1.5px solid rgba(226, 232, 240, 0.6);
}

.route-map-section-title {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: #1e293b;
}

.route-map-section-icon {
  font-size: 1rem;
}

.route-map-section-name {
  font-size: 0.9375rem;
}

.route-map-section-sci .route-map-section-title {
  color: #15803d;
}

.route-map-section-soc .route-map-section-title {
  color: #c2410c;
}

.route-map-container {
  margin-bottom: 0;
  overflow-x: hidden; /* 横スクロールを親要素内に閉じ込める */
  width: 100%;
  box-sizing: border-box;
  touch-action: pan-y; /* 縦方向のスクロールは許可、横方向は子要素で制御 */
}

/* PC版で中央配置 */
@media (min-width: 1024px) {
  /* おすすめ学習時のlessonListを中央配置（gridをblockに変更） */
  #homeView:not(.math-full-width) #lessonList {
    display: block !important;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
  }
}

.route-map-track {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem 0.125rem 0.75rem; /* 左側のパディングを増やす */
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  touch-action: pan-x; /* 横方向のスワイプ操作を有効化 */
  cursor: grab; /* スワイプ可能であることを示す */
}

/* おさらいトラック（1つだけなので中央配置、スクロール不要） */
.route-map-track.review-track {
  justify-content: center;
  padding: 0.125rem 0.5rem; /* 左右のパディングを統一 */
  overflow-x: hidden; /* スクロール不要 */
  cursor: default; /* スワイプ不要 */
}

/* スマホではメインカードのみ表示（理科・社会） */
@media (max-width: 640px) {
  .route-map-section-sci,
  .route-map-section-soc,
  .route-map-section-review {
    overflow: visible;
  }

  .route-map-track:not(.review-track) {
    justify-content: center;
    overflow-x: hidden;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .route-map-track:not(.review-track) .route-map-arrow {
    display: none;
  }

  .route-map-track:not(.review-track) .route-map-item:not([data-current-lesson="true"]) {
    display: none;
  }

  .route-map-item:hover,
  .route-map-item.position-0:hover {
    transform: none !important;
  }
}

.route-map-track:active {
  cursor: grabbing; /* スワイプ中であることを示す */
}

.route-map-track::-webkit-scrollbar {
  display: none;
}

/* 接続線 */
.route-map-track::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, 
    rgba(148, 163, 184, 0.3) 0%,
    rgba(148, 163, 184, 0.5) 50%,
    rgba(148, 163, 184, 0.3) 100%
  );
  z-index: 0;
  transform: translateY(-50%);
}

.route-map-item {
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
  cursor: pointer;
}

/* サイズ階層 */
.route-map-item.position--2,
.route-map-item.position-2,
.route-map-item.position-3 {
  transform: scale(1);
  opacity: 1;
}

.route-map-item.position--1,
.route-map-item.position-1 {
  transform: scale(1);
  opacity: 1;
}

.route-map-item.position-0 {
  transform: scale(1);
  opacity: 1;
  z-index: 2;
}

/* ルートマップカード */
.route-map-card {
  background: white;
  border-radius: 6px;
  padding: 0.375rem;
  border: 1.5px solid;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  width: 140px;
  height: 132px;
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto auto auto auto 1fr auto;
  row-gap: 0.14rem;
  position: relative;
  overflow: hidden;
}

.route-map-item.position-0 .route-map-card {
  padding: 0.5rem;
  width: 170px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  border-width: 2.5px;
  height: 160px;
}

.route-map-item.position-0 .route-map-card.main-recommend-card {
  padding: 0.75rem;
  width: 300px;
  height: 210px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.route-map-item.position-0 .route-map-card.main-recommend-card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.95) 0 2px,
    rgba(255, 255, 255, 0) 2px 10px
  );
  z-index: 0;
}

.route-map-item.position-0 .route-map-card.main-recommend-card > * {
  position: relative;
  z-index: 1;
}

/* メインカードより一段小さいサブカード（一覧の高さをバッジ種別でぶらさない） */
.route-map-item:not([data-current-lesson='true']) .route-map-card {
  padding: 0.375rem;
  width: 150px;
  height: 142px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  border-width: 2px;
  overflow: hidden;
}

.route-map-item:not([data-current-lesson='true']) .route-map-card .route-map-card-title {
  font-size: 0.765rem;
  line-height: 1.14;
  min-height: 2.2em;
}

.route-map-item:not([data-current-lesson='true']) .route-map-card .route-map-card-meta {
  font-size: 0.665rem;
  margin-bottom: 0.06rem;
}

.route-map-item:not([data-current-lesson='true']) .route-map-card .route-map-card-badge {
  flex-shrink: 0;
  height: 1.25rem;
  min-height: 1.25rem;
  padding: 0.1rem 0.3rem;
  margin-bottom: 0.125rem;
  margin-top: 0;
  font-size: 0.575rem;
  box-sizing: border-box;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-map-item:not([data-current-lesson='true']) .route-map-card .route-map-card-button {
  padding: 0.25rem 0.45rem;
  font-size: 0.6875rem;
  margin-top: 0.1rem;
}

/* 理科のカード */
.route-map-card.sci {
  border-color: #16a34a;
  background: linear-gradient(135deg, #f0fdf4, #ffffff);
}

.route-map-item.position-0 .route-map-card.sci {
  border-color: #15803d;
  background: linear-gradient(135deg, #dcfce7, #ffffff);
  box-shadow: 0 8px 24px rgba(22, 163, 74, 0.2);
}

/* 社会のカード */
.route-map-card.soc {
  border-color: #ea580c;
  background: linear-gradient(135deg, #fff7ed, #ffffff);
}

.route-map-item.position-0 .route-map-card.soc {
  border-color: #c2410c;
  background: linear-gradient(135deg, #fed7aa, #ffffff);
  box-shadow: 0 8px 24px rgba(234, 88, 12, 0.2);
}

/* 完了済みのスタイル */
.route-map-card.completed {
  opacity: 0.6;
  filter: grayscale(0.5);
}

.route-map-item.position-0 .route-map-card.completed {
  opacity: 0.8;
  filter: grayscale(0.3);
}

/* おすすめルート：未購入レッスン（非アクティブ表記・クリックは購入案内へ） */
.route-map-card.route-map-card--inactive {
  opacity: 0.55;
  filter: grayscale(0.45);
  border-style: dashed;
}

.route-map-item.route-map-item--inactive:hover {
  transform: none !important;
}

.route-map-item.route-map-item--inactive:hover .route-map-card {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.route-map-card-badge--inactive {
  background: #e5e7eb !important;
  color: #4b5563 !important;
  font-weight: 600;
}

.route-map-card-badge--trial {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  font-weight: 700;
  border: 1px solid #f59e0b;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.25);
  animation: juken-trial-badge-pulse 2.4s ease-in-out infinite;
}

.route-map-card-badge__trial-icon {
  margin-right: 0.12rem;
}

@keyframes juken-trial-badge-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.25);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.35);
  }
}

.route-map-item--trial .route-map-card {
  border-width: 2px;
  border-style: solid;
  border-color: #0ea5e9;
  background: linear-gradient(145deg, #f0f9ff 0%, #fffbeb 48%, #ffffff 100%);
  box-shadow:
    0 0 0 2px rgba(14, 165, 233, 0.18),
    0 8px 22px rgba(14, 165, 233, 0.16);
}

.route-map-item--trial:hover .route-map-card {
  box-shadow:
    0 0 0 3px rgba(14, 165, 233, 0.28),
    0 12px 28px rgba(14, 165, 233, 0.22);
}

.route-map-card__trial-ribbon {
  position: absolute;
  top: 0.28rem;
  right: -1.35rem;
  z-index: 2;
  transform: rotate(36deg);
  background: linear-gradient(90deg, #0284c7, #0ea5e9);
  color: #fff;
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0.12rem 1.4rem;
  line-height: 1.2;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}

.route-map-card-button--trial {
  background: linear-gradient(135deg, #0284c7, #0ea5e9) !important;
  color: #fff !important;
  border: none;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35);
}

.route-map-card-button--trial:hover {
  filter: brightness(1.06);
}

.route-map-card-button.locked {
  background: #9ca3af !important;
  color: #f9fafb;
  border: none;
}

/* ホバー効果 */
.route-map-item:hover {
  transform: scale(1.05) !important;
  z-index: 3 !important;
}

.route-map-item.position-0:hover {
  transform: scale(1.08) !important;
}

.route-map-item:hover .route-map-card {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

/* カード外のインジケーター（▼） */
.route-map-card-indicator {
  text-align: center;
  font-size: 0.875rem;
  color: #3b82f6;
  margin-bottom: 0.0625rem;
  line-height: 1;
  width: 100%;
}

.route-map-item.position-0 .route-map-card-indicator {
  font-size: 1rem;
  margin-bottom: 0.125rem;
}

.route-map-item.position--1 .route-map-card-indicator,
.route-map-item.position-1 .route-map-card-indicator {
  font-size: 0.875rem;
  margin-bottom: 0.125rem;
}

.route-map-item.position--2 .route-map-card-indicator,
.route-map-item.position-2 .route-map-card-indicator,
.route-map-item.position-3 .route-map-card-indicator {
  font-size: 0.875rem;
  margin-bottom: 0.125rem;
}

.route-map-card-title {
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.0625rem;
  line-height: 1.15;
  color: #1f2937;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 1.75em;
}

.route-map-lesson-icon {
  margin-right: 0.25rem;
  font-size: 1.1em;
  line-height: 1;
  vertical-align: -0.08em;
}

.route-map-item.position-0 .route-map-card-title {
  font-size: 0.8125rem;
  font-weight: 700;
  margin-bottom: 0.125rem;
}

.route-map-item.position-0 .route-map-card.main-recommend-card .route-map-card-title {
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
  min-height: 2.3em;
}

.route-map-card-meta {
  font-size: 0.65rem;
  color: #6b7280;
  margin-bottom: 0.0625rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-map-card-overview {
  font-size: 0.64rem;
  line-height: 1.35;
  color: #374151;
  background: rgba(255, 255, 255, 0.82);
  border-radius: 4px;
  padding: 0.2rem 0.3rem;
  margin: 0.2rem 0 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


.route-map-item.position-0 .route-map-card-meta {
  font-size: 0.6875rem;
  margin-bottom: 0.0625rem;
}

.route-map-item.position-0 .route-map-card.main-recommend-card .route-map-card-meta {
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}

.route-map-item.position-0 .route-map-card.main-recommend-card .route-map-card-overview {
  font-size: 0.78rem;
  line-height: 1.5;
  padding: 0.35rem 0.45rem;
  margin: 0.25rem 0 0.35rem;
  -webkit-line-clamp: 3;
}

.route-map-card-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.25rem;
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 600;
  margin-bottom: 0.125rem;
}

.route-map-item.position-0 .route-map-card-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.35rem;
  margin-bottom: 0.125rem;
}

.route-map-card-badge.completed {
  background: #d1fae5;
  color: #065f46;
}

.route-map-card-badge.pending {
  background: #fee2e2;
  color: #991b1b;
}

.route-map-card-button {
  width: 100%;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 0.125rem;
  align-self: stretch;
}

.route-map-item.position-0 .route-map-card-button {
  padding: 0.3125rem 0.5625rem;
  font-size: 0.71875rem;
  font-weight: 700;
  margin-top: 0.125rem;
}

.route-map-item.position-0 .route-map-card.main-recommend-card .route-map-card-button {
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem;
}

.route-map-card-button.sci {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: white;
}

.route-map-card-button.sci:hover {
  background: linear-gradient(135deg, #15803d, #166534);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.route-map-card-button.soc {
  background: linear-gradient(135deg, #ea580c, #c2410c);
  color: white;
}

.route-map-card-button.soc:hover {
  background: linear-gradient(135deg, #c2410c, #9a3412);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.3);
}

/* 矢印（接続線の代わり） */
.route-map-arrow {
  display: flex;
  align-items: center;
  color: #94a3b8;
  font-size: 1rem;
  flex-shrink: 0;
}

.route-map-item.position-0 ~ .route-map-arrow {
  color: #3b82f6;
  font-size: 1.125rem;
}

/* 375px幅での最適化 */
@media (max-width: 375px) {
  .route-map-section {
    margin-bottom: 0.375rem;
    padding: 0.375rem;
  }
  
  .route-map-container {
    margin-bottom: 0.25rem;
  }
  
  .route-map-track {
    gap: 0.125rem;
    padding: 0.25rem 0.5rem 0.25rem 0.75rem; /* 左側のパディングを追加 */
  }
  
  .route-map-card {
    width: 110px;
    padding: 0.25rem;
    border-radius: 6px;
  }
  
  .route-map-item.position-0 .route-map-card {
    width: 140px;
    padding: 0.375rem;
  }
  
  .route-map-item:not([data-current-lesson='true']) .route-map-card {
    width: 126px;
    height: 120px;
    padding: 0.3rem;
  }

  .route-map-item:not([data-current-lesson='true']) .route-map-card .route-map-card-title {
    font-size: 0.64rem;
    min-height: 2.05em;
  }

  .route-map-item:not([data-current-lesson='true']) .route-map-card .route-map-card-meta {
    font-size: 0.58rem;
  }

  .route-map-item:not([data-current-lesson='true']) .route-map-card .route-map-card-button {
    padding: 0.22rem 0.38rem;
    font-size: 0.615rem;
  }

  .route-map-card-indicator {
    font-size: 0.75rem;
    margin-bottom: 0.125rem;
  }
  
  .route-map-item.position-0 .route-map-card-indicator {
    font-size: 0.875rem;
    margin-bottom: 0.125rem;
  }
  
  .route-map-card-title {
    font-size: 0.65rem;
    margin-bottom: 0.125rem;
  }
  
  .route-map-item.position-0 .route-map-card-title {
    font-size: 0.75rem;
    margin-bottom: 0.125rem;
  }
  
  .route-map-card-meta {
    font-size: 0.6rem;
    margin-bottom: 0.125rem;
  }
  
  .route-map-item.position-0 .route-map-card-meta {
    font-size: 0.65rem;
    margin-bottom: 0.125rem;
  }
  
  .route-map-card-badge {
    font-size: 0.55rem;
    padding: 0.1rem 0.25rem;
    margin-bottom: 0.125rem;
  }
  
  .route-map-item.position-0 .route-map-card-badge {
    font-size: 0.6rem;
    padding: 0.15rem 0.3rem;
    margin-bottom: 0.125rem;
  }
  
  .route-map-card-button {
    padding: 0.2rem 0.4rem;
    font-size: 0.625rem;
    margin-top: 0.125rem;
  }
  
  .route-map-item.position-0 .route-map-card-button {
    padding: 0.3rem 0.5rem;
    font-size: 0.6875rem;
    margin-top: 0.125rem;
  }
  
  .route-map-card-badge {
    padding: 0.15rem 0.3rem;
    font-size: 0.6rem;
    margin-bottom: 0.25rem;
  }
  
  .route-map-item.position-0 .route-map-card-badge {
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
  }
  
  .route-map-card-button {
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
    margin-top: 0.25rem;
  }
  
  .route-map-item.position-0 .route-map-card-button {
    padding: 0.4rem 0.625rem;
    font-size: 0.75rem;
  }

  .route-map-item.position-0 .route-map-card.main-recommend-card {
    width: 220px;
    padding: 0.5rem;
  }

  .route-map-item.position-0 .route-map-card.main-recommend-card .route-map-card-title {
    font-size: 0.82rem;
  }

  .route-map-item.position-0 .route-map-card.main-recommend-card .route-map-card-meta {
    font-size: 0.68rem;
  }

  .route-map-item.position-0 .route-map-card.main-recommend-card .route-map-card-overview {
    font-size: 0.66rem;
    line-height: 1.45;
  }

  .route-map-item.position-0 .route-map-card.main-recommend-card .route-map-card-button {
    font-size: 0.7rem;
  }

  .route-map-item:not([data-current-lesson='true']) .route-map-card .route-map-card-badge {
    height: 1.125rem;
    min-height: 1.125rem;
    padding: 0.08rem 0.22rem;
    font-size: 0.52rem;
  }
  
  .route-map-arrow {
    font-size: 1rem;
  }
}


/* 完了した教材のスタイル */
.card.completed{opacity:0.7;filter:grayscale(0.4);position:relative;border-color:#10b981;border-width:3px}
.card.completed::before{content:'';position:absolute;top:0;right:0;width:0;height:0;border-style:solid;border-width:0 2.5rem 2.5rem 0;border-color:transparent #10b981 transparent transparent;z-index:1;filter:drop-shadow(0 2px 4px rgba(16, 185, 129, 0.3))}
.card.completed:hover{opacity:0.85;filter:grayscale(0.2);transform:translateY(-4px) scale(1.01)}

.badge{display:inline-flex;align-items:center;padding:.25rem .5rem;border-radius:9999px;font-size:.75rem}
.badge.lock{background:#fee2e2;color:#991b1b}
.badge.open{background:#dcfce7;color:#166534}
.badge.complete{background:#10b981;color:#fff;font-weight:600}
.badge.recommend{background:linear-gradient(135deg, #fbbf24, #f59e0b);color:#fff;font-weight:600;box-shadow:0 2px 4px rgba(251, 191, 36, 0.3)}
.badge.enhanced-recommend-badge{
  background:#f59e0b;
  color:#ffffff;
  font-weight:700;
  border:2px solid #d97706;
  animation: recommendPulse 2s ease-in-out infinite;
  box-shadow:0 4px 12px rgba(245, 158, 11, 0.4), 0 0 20px rgba(245, 158, 11, 0.2);
}

@keyframes recommendPulse {
  0%, 100% { 
    transform: scale(1);
    box-shadow:0 4px 12px rgba(245, 158, 11, 0.4), 0 0 20px rgba(245, 158, 11, 0.2);
  }
  50% { 
    transform: scale(1.05);
    box-shadow:0 6px 16px rgba(245, 158, 11, 0.5), 0 0 30px rgba(245, 158, 11, 0.3);
  }
}

/* 進捗バー */
.progress-bar{width:100%;height:6px;background:#e5e7eb;border-radius:3px;overflow:hidden}
.progress-fill{height:100%;background:linear-gradient(90deg, #10b981, #34d399);border-radius:3px;transition:width 0.3s ease}
.section-gap{margin-top:0.5rem}
.lesson-area{min-height:clamp(360px,60vh,720px)}

/* ===== 連続学習日数表示 ===== */
.streak-info {
  white-space: nowrap;
  animation: pulse 2s ease-in-out infinite;
}

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

/* ===== 統計ページアニメーション ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stats-section {
  animation-fill-mode: forwards;
}

.hover\:scale-102:hover {
  transform: scale(1.02);
}

/* ===== 背景テーマ ===== */
/* デフォルトテーマ（既存） */
body.theme-default {
  background: linear-gradient(135deg, #fefce8, #fff7ed, #fdf2f8);
}

body.theme-default .bg-decoration {
  background: 
    radial-gradient(circle at 20% 30%, rgba(251, 191, 36, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(239, 68, 68, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 60% 80%, rgba(251, 146, 60, 0.12) 0%, transparent 50%);
}

/* ./images/back の全面背景（インラインで url 指定）。報酬差し替え時も同クラス */
.bg-decoration.juken-home-bg-custom {
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  z-index: 0;
}
/* 背面画像が見えるよう body のソリッド／グラデを抑える */
body.juken-home-bg-active.theme-default,
body.juken-home-bg-active.theme-spring,
body.juken-home-bg-active.theme-summer,
body.juken-home-bg-active.theme-autumn,
body.juken-home-bg-active.theme-winter {
  background: #fff9f0;
}
body.juken-home-bg-active.theme-night,
body.juken-home-bg-active.theme-starry {
  background: transparent;
}

/* 春テーマ 🌸 */
body.theme-spring {
  background: linear-gradient(135deg, #fdf2f8, #fce7f3, #f3e8ff);
}

body.theme-spring .bg-decoration {
  background: 
    radial-gradient(circle at 20% 30%, rgba(251, 113, 133, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(244, 114, 182, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 60% 80%, rgba(196, 181, 253, 0.15) 0%, transparent 50%);
}

/* 夏テーマ ☀️ */
body.theme-summer {
  background: linear-gradient(135deg, #eff6ff, #dbeafe, #cffafe);
}

body.theme-summer .bg-decoration {
  background: 
    radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(14, 165, 233, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 60% 80%, rgba(20, 184, 166, 0.15) 0%, transparent 50%);
}

/* 秋テーマ 🍂 */
body.theme-autumn {
  background: linear-gradient(135deg, #fff7ed, #fed7aa, #fef3c7);
}

body.theme-autumn .bg-decoration {
  background: 
    radial-gradient(circle at 20% 30%, rgba(251, 146, 60, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(245, 158, 11, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 60% 80%, rgba(251, 191, 36, 0.15) 0%, transparent 50%);
}

/* 冬テーマ ❄️ */
body.theme-winter {
  background: linear-gradient(135deg, #f8fafc, #e0e7ff, #e0e7ff);
}

body.theme-winter .bg-decoration {
  background: 
    radial-gradient(circle at 20% 30%, rgba(148, 163, 184, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 60% 80%, rgba(79, 70, 229, 0.15) 0%, transparent 50%);
}

/* 夜テーマ 🌙 */
body.theme-night {
  background: linear-gradient(135deg, #1e1b4b, #312e81, #1e293b);
  color: #e2e8f0;
}

body.theme-night .bg-decoration {
  background: 
    radial-gradient(circle at 20% 30%, rgba(99, 102, 241, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.25) 0%, transparent 50%),
    radial-gradient(circle at 60% 80%, rgba(71, 85, 105, 0.25) 0%, transparent 50%);
}

body.theme-night .text-slate-800 {
  color: #e2e8f0;
}

body.theme-night .card {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(148, 163, 184, 0.3);
}

/* 星空テーマ ⭐ */
body.theme-starry {
  background: linear-gradient(135deg, #0f172a, #1e1b4b, #000000);
  color: #f1f5f9;
}

body.theme-starry .bg-decoration {
  background: 
    radial-gradient(circle at 20% 30%, rgba(99, 102, 241, 0.4) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.35) 0%, transparent 50%),
    radial-gradient(circle at 60% 80%, rgba(59, 130, 246, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 50px 50px;
}

body.theme-starry .text-slate-800 {
  color: #f1f5f9;
}

body.theme-starry .card {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(148, 163, 184, 0.4);
}

/* ===== 2カラムレイアウトの単元別表示 ===== */
.math-two-column {
  display: flex;
  gap: 2rem;
  min-height: calc(100vh - 400px);
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 2rem;
  align-items: start;
}

/* 算数表示時のメインコンテナの制約を解除 */
#homeView.math-full-width {
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
}

/* 算数表示時のmainコンテナの制約も解除 */
#app.math-full-width {
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
}

/* Tailwindのmax-w-7xlクラスを強制的に無効化 */
#app.math-full-width.max-w-7xl {
  max-width: none !important;
}

/* 算数表示時のlessonListも全幅にする */
#homeView.math-full-width #lessonList {
  max-width: none !important;
  width: 100% !important;
}

.units-column {
  background: #f8fafc;
  border-radius: 16px;
  padding: 1.25rem;
  border: 1px solid rgba(226, 232, 240, 0.6);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  height: calc(100vh - 400px);
  max-height: calc(100vh - 400px);
  overflow-y: auto;
  flex: 0 0 400px; /* 固定幅を400pxに拡大 */
}

.lessons-column {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid rgba(226, 232, 240, 0.6);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  min-height: calc(100vh - 400px);
  height: fit-content;
  flex: 1; /* 残りの幅をすべて使用 */
  min-width: 0; /* flexアイテムの最小幅を0に設定 */
}

/* 単元が1件だけ（学年チップ下の理科／おぼえる等）：ヘッダー・タブと重複する左カラムを隠す */
.math-two-column.single-unit-mode {
  gap: 0;
}

.math-two-column.single-unit-mode .units-column {
  display: none !important;
}

.math-two-column.single-unit-mode .lessons-column {
  flex: 1 1 100%;
  width: 100%;
  max-width: none;
}

.units-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 1rem 0;
  padding-bottom: 0.625rem;
  border-bottom: 2px solid #e2e8f0;
}

.unit-item {
  background: #fff;
  border-radius: 12px;
  padding: 0.875rem;
  margin-bottom: 0.625rem;
  border: 1px solid rgba(226, 232, 240, 0.6);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.unit-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: rgba(59, 130, 246, 0.3);
}

.unit-item.selected {
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border-color: #3b82f6;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.2);
  transform: translateY(-2px);
}

.unit-item-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.unit-item-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  flex-shrink: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.unit-item.selected .unit-item-icon {
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
  transform: scale(1.05);
}

.unit-item-info {
  flex: 1;
  min-width: 0;
}

.unit-item-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
}

.unit-item.selected .unit-item-title {
  color: #1e40af;
}

.unit-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: #64748b;
}

.unit-item-count {
  font-weight: 500;
}

.unit-item-progress {
  font-weight: 600;
  color: #3b82f6;
}

.unit-item-progress-bar {
  width: 100%;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
}

.unit-item-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.unit-item-coming-soon {
  font-size: 0.75rem;
  color: #94a3b8;
  font-style: italic;
  margin-top: 0.25rem;
}

.unit-item.no-lessons {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.unit-item.no-lessons .unit-item-icon {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  box-shadow: 0 2px 6px rgba(148, 163, 184, 0.3);
}

.unit-item.no-lessons .unit-item-title {
  color: #64748b;
}

.lessons-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  text-align: center;
  color: #64748b;
}

.placeholder-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.placeholder-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #374151;
  margin: 0 0 0.5rem 0;
}

.placeholder-text {
  font-size: 1rem;
  color: #6b7280;
  margin: 0;
  max-width: 300px;
}

.lessons-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e2e8f0;
}

.lessons-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.lessons-count {
  background: rgba(59, 130, 246, 0.1);
  color: #1e40af;
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ===== シンプルなリスト表示 ===== */
.lessons-list-container {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(226, 232, 240, 0.6);
}

.lesson-list-item {
  display: flex;
  flex-direction: column;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  transition: background-color 0.2s ease;
  gap: 0.5rem;
  min-height: auto;
}

.lesson-list-item:last-child {
  border-bottom: none;
}

.lesson-list-item:hover {
  background-color: #f9fafb;
}

.lesson-list-item.completed {
  background-color: #f0f9ff;
}

.lesson-list-item.locked {
  opacity: 0.65;
  background-color: #f9fafb;
  position: relative;
}

.lesson-list-item--trial {
  border-left: 4px solid #0ea5e9;
  background: linear-gradient(90deg, rgba(224, 242, 254, 0.65), rgba(255, 255, 255, 0.95) 42%);
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.14);
}

.lesson-trial-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 0.14rem 0.45rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #92400e;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #fbbf24;
  white-space: nowrap;
}

.lesson-list-item .lesson-action-btn--trial {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: #fff;
  border-color: #0284c7;
  font-weight: 700;
}

.lesson-list-item .lesson-action-btn--trial:hover {
  filter: brightness(1.05);
}

.lesson-list-item.locked::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(0, 0, 0, 0.03) 10px,
    rgba(0, 0, 0, 0.03) 20px
  );
  pointer-events: none;
  border-radius: 8px;
}

.lesson-row-first {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.lesson-row-second {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-left: calc(2.25rem + 0.75rem); /* 番号の幅 + gap */
  font-size: 0.8125rem;
}

.lesson-list-item .lesson-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 1.75rem;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  flex-shrink: 0;
}

.lesson-list-item .lesson-grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.5rem;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border-radius: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  white-space: nowrap;
}

.lesson-list-item .lesson-title {
  flex: 1;
  font-weight: 500;
  color: #1f2937;
  font-size: 0.9375rem;
  line-height: 1.4;
  min-width: 0;
}

.lesson-list-item .lesson-title.locked-title {
  color: #9ca3af;
}

.lesson-list-item .lesson-duration {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  background: #fef3c7;
  color: #92400e;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 500;
  flex-shrink: 0;
  white-space: nowrap;
}

.lesson-list-item .lesson-progress {
  font-weight: 500;
  color: #374151;
  font-size: 0.875rem;
  min-width: 3rem;
  text-align: center;
  flex-shrink: 0;
}

.lesson-list-item .lesson-status {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  flex-shrink: 0;
  white-space: nowrap;
}

.lesson-list-item .lesson-status.completed {
  background: #d1fae5;
  color: #065f46;
}

.lesson-list-item .lesson-status.pending {
  background: #fee2e2;
  color: #991b1b;
}

.lesson-list-item .lesson-score {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  background: linear-gradient(135deg, #ea580c, #f97316);
  color: white;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}

.lesson-list-item .lesson-date {
  color: #6b7280;
  font-size: 0.75rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.lesson-list-item .lesson-action-btn {
  padding: 0.5rem 1.25rem;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  min-height: 36px;
  white-space: nowrap;
}

.lesson-list-item .lesson-action-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.lesson-list-item .lesson-action-btn.locked-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.lesson-list-item .lesson-action-btn.locked-btn:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.lesson-list-item .lesson-lock-status {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 5px;
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}

.lesson-list-item.pair-row .lesson-row-first {
  align-items: flex-start;
}

.lesson-list-item .lesson-series-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #0f766e;
  background: #ccfbf1;
  border: 1px solid #99f6e4;
  flex-shrink: 0;
}

.lesson-list-item .lesson-pair-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: flex-start;
  gap: 0.5rem;
  flex-shrink: 0;
}

.lesson-list-item .lesson-pair-actions.single-mode {
  gap: 0;
  margin-left: 0;
  /* 2ボタン構成と同じ「右側ブロック幅」になるよう最低幅を確保
     (1ボタンだと縮んで右列寄りになるのを防ぐ) */
  min-width: calc(12.4rem + 0.5rem);
  justify-content: flex-start;
}

.lesson-list-item .lesson-pair-actions.single-mode .lesson-mode-action {
  width: 100%;
}

.lesson-list-item .lesson-pair-actions.single-mode .lesson-action-btn {
  width: 100%;
}

.lesson-list-item .lesson-mode-action {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.22rem;
}

.lesson-list-item .lesson-pair-actions .lesson-action-btn {
  min-width: 6.2rem;
  padding: 0.45rem 0.9rem;
}

.lesson-list-item .lesson-mode-score {
  font-size: 0.72rem;
  line-height: 1.1;
  text-align: center;
  color: #475569;
  font-weight: 600;
  min-height: 0.8rem;
}

.lesson-list-item .lesson-action-btn.disabled-btn {
  background: #e5e7eb;
  color: #6b7280;
  cursor: not-allowed;
  box-shadow: none;
}

.lesson-list-item .lesson-action-btn.disabled-btn:hover {
  transform: none;
  box-shadow: none;
  background: #e5e7eb;
}

.lesson-list-item .lesson-action-btn.progress-indicator {
  position: relative;
  padding-left: 1.45rem;
}

.lesson-list-item .lesson-action-btn.progress-indicator::before {
  content: '';
  position: absolute;
  left: 0.56rem;
  top: 50%;
  width: 0.56rem;
  height: 0.56rem;
  border-radius: 999px;
  transform: translateY(-50%);
  box-sizing: border-box;
}

.lesson-list-item .lesson-action-btn.progress-not-started::before {
  border: 2px solid rgba(255, 255, 255, 0.7);
  background: transparent;
}

.lesson-list-item .lesson-action-btn.progress-not-started {
  background: linear-gradient(135deg, #7dd3fc, #38bdf8);
}

.lesson-list-item .lesson-action-btn.progress-in-progress {
  background: linear-gradient(90deg, #7dd3fc 0 50%, #2563eb 50% 100%);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2) inset, 0 6px 14px rgba(37, 99, 235, 0.28);
}

.lesson-list-item .lesson-action-btn.progress-in-progress::before {
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: conic-gradient(#facc15 0 55%, rgba(255, 255, 255, 0.2) 55% 100%);
}

.lesson-list-item .lesson-action-btn.progress-completed {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.lesson-list-item .lesson-action-btn.progress-completed::before {
  background: #22c55e;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.35);
}

/* ===== 全問正解（correct === total）の視覚効果 ===== */
.lesson-list-item .lesson-action-btn.all-correct {
  animation: allCorrectBurst 900ms ease-out both;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25), 0 10px 28px rgba(34, 197, 94, 0.18);
}

.lesson-list-item .lesson-action-btn.all-correct::after {
  content: '✓';
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%) scale(0.85);
  opacity: 0;
  font-weight: 900;
  color: #16a34a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
  animation: allCorrectCheckIn 900ms ease-out both;
  pointer-events: none;
}

@keyframes allCorrectBurst {
  0% { filter: brightness(1); transform: translateY(0); }
  35% { filter: brightness(1.08); transform: translateY(-1px) scale(1.03); }
  100% { filter: brightness(1); transform: translateY(0) scale(1); }
}

@keyframes allCorrectCheckIn {
  0% { opacity: 0; transform: translateY(-50%) scale(0.7); }
  45% { opacity: 1; transform: translateY(-50%) scale(1); }
  100% { opacity: 0; transform: translateY(-50%) scale(1.05); }
}

@media (prefers-reduced-motion: reduce) {
  .lesson-list-item .lesson-action-btn.all-correct {
    animation: none;
  }
  .lesson-list-item .lesson-action-btn.all-correct::after {
    animation: none;
    opacity: 1;
  }
}

.lesson-list-item .lesson-action-btn.progress-not-started:hover {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
}

.lesson-list-item .lesson-action-btn.progress-in-progress:hover {
  background: linear-gradient(90deg, #38bdf8 0 50%, #1d4ed8 50% 100%);
}

.lesson-list-item .lesson-action-btn.progress-completed:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

/* ===== リスト表示のレスポンシブ対応 ===== */
@media (max-width: 768px) {
  .lesson-list-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 1.25rem 1rem;
  }
  
  .lesson-list-item .lesson-number {
    align-self: flex-start;
    width: 2rem;
    height: 1.5rem;
    font-size: 0.75rem;
  }
  
  .lesson-list-item .lesson-title {
    order: -1;
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
  }
  
  .lesson-list-item .lesson-duration,
  .lesson-list-item .lesson-progress,
  .lesson-list-item .lesson-status {
    font-size: 0.875rem;
  }
  
  .lesson-list-item .lesson-action-btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
  }

  .lesson-list-item.pair-row .lesson-row-first {
    flex-wrap: wrap;
  }

  .lesson-list-item.pair-row .lesson-pair-actions {
    margin-left: 0;
    width: 100%;
  }

  .lesson-list-item.pair-row .lesson-mode-action {
    width: calc(50% - 0.25rem);
  }

  .lesson-list-item.pair-row .lesson-pair-actions .lesson-action-btn {
    width: 100%;
    min-width: 0;
    font-size: 0.9rem;
    padding: 0.65rem 0.5rem;
  }

  .lesson-list-item .lesson-mode-score {
    font-size: 0.68rem;
  }
}

/* ===== モバイル用カードレイアウト ===== */
.lessons-cards-mobile {
  display: none;
  gap: 1rem;
}

.mobile-lesson-card {
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.6);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease;
}

.mobile-lesson-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.mobile-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.mobile-lesson-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 1.5rem;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.mobile-lesson-title {
  flex: 1;
  font-size: 1rem;
  font-weight: 500;
  color: #1f2937;
  margin: 0;
  line-height: 1.4;
}

.mobile-status-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
}

.mobile-status-badge.completed {
  background: #d1fae5;
  color: #065f46;
}

.mobile-status-badge.pending {
  background: #fee2e2;
  color: #991b1b;
}

.mobile-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: #6b7280;
}

.mobile-action-btn {
  width: 100%;
  padding: 0.75rem;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-action-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
}

/* ===== レスポンシブ対応 ===== */
@media (max-width: 1024px) {
  .lessons-table-container {
    display: none;
  }
  
  .lessons-cards-mobile {
    display: flex;
    flex-direction: column;
  }
}

@media (min-width: 1025px) {
  .lessons-table-container {
    display: block;
  }
  
  .lessons-cards-mobile {
    display: none;
  }
}

/* 古いカードレイアウトのスタイルを削除 - テーブルレイアウトで置き換え済み */

/* ===== 2カラムレイアウトのレスポンシブ ===== */
@media (max-width: 1024px) {
  .math-two-column {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .units-column {
    flex: none;
    height: auto;
    max-height: 350px;
  }
  
  .lessons-column {
    min-height: 400px;
  }
  
  #homeView.math-full-width {
    padding: 0 1rem !important;
  }
}

@media (max-width: 768px) {
  .math-two-column {
    flex-direction: column;
    gap: 1rem;
  }

  .math-two-column.single-unit-mode {
    gap: 0;
  }
  
  /* 単元一覧を"箱スクロール"にせず全幅で展開 */
  .units-column {
    flex: none;
    height: auto;
    max-height: none;
    overflow: visible;
    padding: 1rem;
  }
  
  .lessons-column {
    padding: 1rem;
    min-height: 320px;
  }
  
  #homeView.math-full-width {
    padding: 0 0.5rem !important;
  }

  /* ===== Mobile: 単元一覧をアイコン帯に縮約 ===== */
  /* 2カラムは縦積みでOK（既に指定があればそのまま） */
  .math-two-column { flex-direction: column; gap: .75rem; }

  /* 左カラム（単元）の箱制約を外し、帯として横スクロール */
  .units-column {
    height: auto;
    max-height: none;
    overflow: visible;
    padding: .5rem 0 0;
    background: transparent;
    box-shadow: none;
    border: 0;
  }
  /* lesson側は画面を広く使う */
  .lessons-column { padding: .75rem 0 1rem; min-height: 55vh; }

  /* アイコン帯：#unitsContainer に compact-units が付く前提 */
  #unitsContainer.compact-units {
    display: flex;
    gap: .5rem;
    justify-content: center;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding: .25rem .5rem .5rem;
  }
  /* アイコン→短テキストの"ピル"へ */
  #unitsContainer.compact-units .unit-item {
    height: 40px;
    padding: 0 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    max-width: 140px;           /* 4〜8文字程度を想定 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0,0,0,.06);
    background: #fff;
  }
  /* 短縮テキストを表示、他の情報は隠す */
  #unitsContainer.compact-units .unit-item-short { display: inline; font-size: 0.95rem; }
  #unitsContainer.compact-units .unit-item-icon { display: none !important; }
  #unitsContainer.compact-units .unit-item-info,
  #unitsContainer.compact-units .unit-item-title,
  #unitsContainer.compact-units .unit-item-meta,
  #unitsContainer.compact-units .unit-item-progress,
  #unitsContainer.compact-units .unit-item-progress-bar,
  #unitsContainer.compact-units .unit-item-coming-soon { display: none !important; }
  /* 選択中が分かるように枠線 */
  #unitsContainer.compact-units .unit-item.selected {
    outline: 2px solid var(--primary, #6366f1);
    outline-offset: 0;
  }

  /* ===== Mobile: レッスン側が細くならないよう全幅化 ===== */
  /* 親と主要ラッパーの幅制限を解除 */
  .math-two-column,
  .lessons-column,
  #lessonsContainer,
  .lesson-list {
    width: 100% !important;
    max-width: none !important;
  }

  /* もしページ全体に最大幅コンテナがある場合（例: .content, .container 等） */
  #homeView.math-full-width .content,
  #homeView.math-full-width .container,
  #homeView.math-full-width .content-inner {
    max-width: none !important;
    padding-left: .5rem;
    padding-right: .5rem;
  }

  /* 各レッスンカード/行の固定幅を解除して横いっぱいに */
  .lesson-card,
  .lesson-list-item,
  .unit-lessons .lesson-item {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* レッスン側の内側余白だけ少し保持（好みに応じて調整） */
  .lessons-column { padding: .75rem .25rem 1rem; }
}

/* 通常表示では短縮テキストは非表示（帯モードで出す） */
.unit-item-short { display: none; }

/* ===== Mobile: レッスンカードの情報を1→2→ボタンの順に整列 ===== */
@media (max-width: 768px) {
  /* 1) 余白を少しだけタイトに */
  .lessons-header { margin-bottom: 0.75rem; padding-bottom: 0.5rem; }
  .lessons-list-container { border-radius: 14px; }
  .lesson-list-item { 
    padding: 0.625rem 0.875rem; 
    gap: 0.375rem;
  }

  /* 2) 1行目: 番号 + タイトル + ボタン */
  .lesson-row-first {
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  
  .lesson-number { 
    width: 2rem; 
    height: 1.5rem; 
    font-size: 0.75rem; 
  }
  
  .lesson-title { 
    font-size: 0.9375rem; 
    line-height: 1.3;
    flex: 1;
    min-width: 150px;
  }

  /* 3) 2行目: メタ情報（時間、ステータス、スコア） */
  .lesson-row-second {
    margin-left: calc(2rem + 0.5rem);
    gap: 0.375rem;
    font-size: 0.75rem;
  }
  
  .lesson-duration { 
    padding: 0.15rem 0.5rem; 
    font-size: 0.7rem;
  }
  
  .lesson-status { 
    padding: 0.15rem 0.5rem; 
    font-size: 0.7rem;
  }

  /* 4) スコア情報のモバイル表示調整 */
  .lesson-score,
  .lesson-date {
    font-size: 0.7rem !important;
  }

  /* 5) ボタンはコンパクトに */
  .lesson-action-btn {
    padding: 0.5rem 1rem; 
    font-size: 0.875rem;
    min-height: 32px;
  }
  
  /* 375px以下での追加調整 */
  @media (max-width: 375px) {
    .lesson-list-item {
      padding: 0.5rem 0.75rem;
      gap: 0.375rem;
    }
    
    .lesson-title {
      font-size: 0.8125rem;
      line-height: 1.3;
      min-width: 0;
    }
    
    .lesson-number {
      width: 1.625rem;
      height: 1.25rem;
      font-size: 0.65rem;
    }
    
    .lesson-row-first {
      gap: 0.5rem;
    }
    
    .lesson-row-second {
      margin-left: calc(1.625rem + 0.5rem);
      gap: 0.25rem;
      font-size: 0.65rem;
    }
    
    .lesson-action-btn {
      padding: 0.375rem 0.875rem;
      font-size: 0.75rem;
      min-height: 32px;
      font-weight: 600;
    }
    
    .lesson-duration,
    .lesson-status {
      font-size: 0.65rem;
      padding: 0.15rem 0.4rem;
    }
    
    .lesson-grade-badge {
      font-size: 0.65rem;
      padding: 0.15rem 0.4rem;
    }
  }
}

/* ===== Tabs ===== */
.tabbar{display:flex;flex-wrap:wrap;gap:.5rem 1rem;align-items:center;border-bottom:1px solid rgb(226 232 240);padding-bottom:.4rem}
.tabs{display:flex;gap:.5rem}
.tab{padding:.5rem .875rem;border-radius:.5rem .5rem 0 0;border:1px solid transparent;border-bottom:2px solid transparent;background:#fff;color:rgb(71 85 105);transition:background .15s ease, box-shadow .2s ease}
.tab:hover{background:rgb(248 250 252)}
.tab[aria-selected="true"],.tab.active{color:#1e40af;background:#eef2ff;border-color:#4f46e5;box-shadow:0 2px 8px rgba(37,99,235,.15);font-weight:700}
.tab:focus-visible{outline:3px solid rgba(79,70,229,.7);outline-offset:2px}
.subtabs{display:flex;gap:.25rem .5rem;flex-wrap:wrap}
.subtab{padding:.375rem .75rem;border-radius:9999px;border:1px solid rgb(226 232 240);background:#fff;color:rgb(71 85 105);font-size:.9rem}
.subtab[aria-selected="true"]{color:#1e3a8a;background:#e0e7ff;border-color:#4f46e5;font-weight:700}

/* ===== メインタブ（2つのタブ） ===== */
.main-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  justify-content: center;
  padding: 0.25rem 0;
}

.main-tab {
  padding: 0.625rem 1.5rem;
  border-radius: 0.75rem;
  border: 3px solid;
  background: #ffffff;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  position: relative;
  min-width: 120px;
  scroll-margin: 0;
  scroll-padding: 0;
}

.main-tab:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.main-tab.active {
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15), 0 0 20px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.main-tab[data-main-tab="recommended"] {
  border-color: #f59e0b;
  color: #f59e0b;
}

.main-tab[data-main-tab="recommended"].active {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
}

.main-tab[data-main-tab="list"] {
  border-color: #6366f1;
  color: #6366f1;
}

.main-tab[data-main-tab="list"].active {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}

/* ===== おすすめ：ルート / キャラ表示の切替（本番UI非表示・開発用スタイル温存） ===== */
.recommended-top-layout-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.75rem;
}
.recommended-top-layout-picker.hidden {
  display: none !important;
}
.recommended-top-layout-picker__label {
  font-weight: 600;
  color: rgb(71 85 105);
}
.recommended-layout-segment {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.125rem;
  padding: 0.25rem;
  border-radius: 0.75rem;
  border: 1px solid rgb(226 232 240);
  background: rgb(248 250 252);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.recommended-layout-btn {
  border: none;
  background: transparent;
  color: rgb(71 85 105);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.5rem 0.875rem;
  border-radius: 0.625rem;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
  white-space: nowrap;
}
.recommended-layout-btn:hover {
  background: rgba(255, 255, 255, 0.95);
  color: rgb(30 41 59);
}
.recommended-layout-btn:focus-visible {
  outline: 3px solid rgba(245 158 11, 0.75);
  outline-offset: 2px;
}
.recommended-layout-btn.active {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.35);
}

#lessonList.recommended-avatar-list-mode {
  display: block !important;
  max-width: min(1180px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.recommended-avatar-root {
  width: 100%;
  grid-column: 1 / -1;
  box-sizing: border-box;
}
.recommended-avatar-row {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: stretch;
}
@media (min-width: 1024px) {
  .recommended-avatar-row {
    flex-direction: row;
    align-items: flex-end;
    gap: clamp(1rem, 2vw, 2rem);
  }
}
.recommended-avatar-column--student,
.recommended-avatar-column--guide {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  flex-shrink: 0;
}
.recommended-avatar-column--student {
  align-items: stretch;
  justify-content: flex-start;
}
.recommended-avatar-column--guide {
  align-items: center;
}
@media (min-width: 1024px) {
  .recommended-avatar-column--student,
  .recommended-avatar-column--guide {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    max-width: none;
  }
  /* 左プロフィール：ややコンパクトに（中央列は固定比率を優先） */
  .recommended-avatar-column--student {
    flex: 0 1 clamp(17rem, 22vw, 22rem);
    min-width: min(22rem, 92vw);
    max-width: 22rem;
  }
}
.recommended-avatar-column--cards {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  min-width: 0;
}
@media (min-width: 1024px) {
  .recommended-avatar-column--cards {
    flex: 0 0 33.333%;
    max-width: 33.333%;
    min-width: 0;
  }
}

.recommended-avatar-row--stack-cards-first .recommended-avatar-column--cards {
  order: 1;
}
.recommended-avatar-row--stack-cards-first .recommended-avatar-column--student {
  order: 2;
}
.recommended-avatar-row--stack-cards-first .recommended-avatar-column--guide {
  order: 3;
}
@media (min-width: 1024px) {
  .recommended-avatar-row--stack-cards-first .recommended-avatar-column--student {
    order: 1;
  }
  .recommended-avatar-row--stack-cards-first .recommended-avatar-column--cards {
    order: 2;
  }
  .recommended-avatar-row--stack-cards-first .recommended-avatar-column--guide {
    order: 3;
  }
}

.recommended-avatar-figure {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.recommended-avatar-char-img {
  display: block;
  margin: 0 auto;
  width: auto;
  height: clamp(168px, 36vmin, 260px);
  max-width: min(300px, 78vw);
  object-fit: contain;
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.1));
}
@media (min-width: 1024px) {
  .recommended-avatar-char-img--left {
    height: clamp(280px, 44vmin, 440px);
    max-width: min(400px, 36vw);
  }
  .recommended-avatar-char-img--right {
    height: clamp(300px, 46vmin, 480px);
    max-width: min(440px, 36vw);
  }
}
.recommended-avatar-char-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 4.5rem;
  font-size: 2.75rem;
  line-height: 1;
  padding: 0.5rem 0.625rem;
  border-radius: 1rem;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.18);
}
.recommended-avatar-figure--student .recommended-avatar-char-fallback {
  background: linear-gradient(180deg, #fffbeb, #fef3c7);
  border: 2px solid rgb(251 191 36);
}
.recommended-avatar-figure--guide .recommended-avatar-char-fallback {
  background: linear-gradient(180deg, #faf5ff, #ede9fe);
  border: 2px solid rgb(167 139 250);
}
.recommended-avatar-char-img.recommended-avatar-char-img--broken {
  display: none !important;
}
.recommended-avatar-figure:has(.recommended-avatar-char-img--broken) .recommended-avatar-char-fallback {
  display: flex;
}
.recommended-avatar-shadow {
  display: block;
  width: min(10rem, 90%);
  height: 0.5rem;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: radial-gradient(
    ellipse at center,
    rgba(71, 85, 105, 0.35) 0%,
    rgba(71, 85, 105, 0) 72%
  );
}

/* ----- キャラTOP：左上集中の統計パネル（ゲージ付き） ----- */
.recommended-avatar-stats-panel {
  width: 100%;
  max-width: 15rem;
  margin: 0 0 0.55rem;
  padding: 0.65rem 0.7rem;
  box-sizing: border-box;
  border-radius: 4px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.9));
  box-shadow: 0 14px 28px -16px rgba(15, 23, 42, 0.35);
}
.recommended-avatar-stats-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.recommended-avatar-stats-panel__eyebrow {
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: rgb(100 116 139);
}
.recommended-avatar-stats-panel__focus {
  font-size: 1rem;
  font-weight: 800;
  color: rgb(2 132 199);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.recommended-avatar-stats-panel__list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}
.recommended-avatar-stats-panel__item {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}
.recommended-avatar-stats-panel__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.45rem;
}
.recommended-avatar-stats-panel__meta dt {
  margin: 0;
  font-size: 0.64rem;
  font-weight: 700;
  color: rgb(71 85 105);
}
.recommended-avatar-stats-panel__meta dd {
  margin: 0;
  font-size: 0.64rem;
  font-weight: 700;
  color: rgb(15 23 42);
  font-variant-numeric: tabular-nums;
}
.recommended-avatar-stats-panel__gauge {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgb(226 232 240);
  overflow: hidden;
}
.recommended-avatar-stats-panel__gauge-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #3b82f6 55%, #7c3aed 100%);
}

/* スマホTOP：プロフィール要約バー（詳細はモーダル） */
.recommended-avatar-profile-summary {
  display: none;
  width: 100%;
  max-width: 21rem;
  margin: 0 auto 0.5rem;
  padding: 0.45rem 0.55rem 0.45rem 0.45rem;
  align-items: center;
  gap: 0.5rem;
  border: 2px solid rgba(15, 23, 42, 0.1);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.98);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 8px 22px -12px rgba(15, 23, 42, 0.35);
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.recommended-avatar-profile-summary:hover {
  border-color: rgba(124, 58, 237, 0.35);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 10px 26px -10px rgba(91, 33, 182, 0.22);
}
.recommended-avatar-profile-summary:active {
  transform: scale(0.99);
}
.recommended-avatar-profile-summary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #a78bfa;
}
.recommended-avatar-profile-summary__avatar-wrap {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.65rem;
  padding: 2px;
  background: linear-gradient(145deg, #fde68a, #fca5a5 45%, #93c5fd);
}
.recommended-avatar-profile-summary__avatar {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: calc(0.65rem - 2px);
  object-fit: cover;
  object-position: center 18%;
  background: #fff;
}
.recommended-avatar-profile-summary__text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}
.recommended-avatar-profile-summary__name {
  font-size: 0.875rem;
  font-weight: 800;
  color: rgb(15 23 42);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recommended-avatar-profile-summary__meta {
  font-size: 0.6875rem;
  font-weight: 600;
  color: rgb(100 116 139);
  line-height: 1.25;
}
.recommended-avatar-profile-summary__cta {
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  color: rgb(109 40 217);
  white-space: nowrap;
}

@media (max-width: 639px) {
  .recommended-avatar-profile-summary {
    display: flex;
  }
  .recommended-avatar-profile-card--desktop-only {
    display: none !important;
  }
  .recommended-avatar-column--student {
    margin-top: 0.15rem;
  }
}

@media (min-width: 640px) {
  .recommended-avatar-profile-summary {
    display: none !important;
  }
}

.recommended-avatar-profile-card--in-modal {
  min-height: 0;
  max-width: none;
  margin: 0;
  border: none;
  box-shadow: none;
  padding: 0.25rem 0 0.5rem;
}
.personal-space-modal__body .recommended-avatar-profile-card--in-modal .recommended-avatar-profile-card__avatar-ring {
  max-width: 11rem;
  height: clamp(8.5rem, 32vw, 11rem);
}

/* ----- キャラTOP左：モック型プロフィール＋学習ステータス ----- */
.recommended-avatar-profile-card {
  width: 100%;
  max-width: 21rem;
  margin: 0 auto 0.75rem;
  padding: 1rem 0.9rem 0.85rem;
  box-sizing: border-box;
  border-radius: 1.15rem;
  border: 2px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.98);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 16px 36px -18px rgba(15, 23, 42, 0.42),
    0 6px 16px rgba(15, 23, 42, 0.1),
    0 0 0 1px rgba(15, 23, 42, 0.04);
  min-height: min(62vh, 38rem);
}
.recommended-avatar-profile-card__hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 0.75rem;
}
/* 上半身バストアップ：縦長フレーム＋ cover で脚元を落とす */
.recommended-avatar-profile-card__avatar-ring {
  width: 100%;
  max-width: 13rem;
  height: clamp(10rem, 26vmin, 13rem);
  border-radius: 1.2rem;
  padding: 4px;
  background: linear-gradient(145deg, #fde68a, #fca5a5 45%, #93c5fd);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
  margin-bottom: 0.55rem;
  overflow: hidden;
  flex-shrink: 0;
}
.recommended-avatar-profile-card__avatar {
  width: 100%;
  height: 100%;
  border-radius: calc(1.2rem - 4px);
  object-fit: cover;
  object-position: center 18%;
  display: block;
  background: #fff;
  transform: scale(1.06);
  transform-origin: center 22%;
}
.recommended-avatar-profile-card__avatar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  margin: -0.1rem 0 0.5rem;
}
.recommended-avatar-profile-card__avatar-swap {
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(255, 255, 255, 0.92);
  color: rgb(51 65 85);
  border-radius: 999px;
  padding: 0.24rem 0.72rem;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}
.recommended-avatar-profile-card__avatar-swap:hover {
  border-color: rgb(99, 102, 241);
  color: rgb(67, 56, 202);
}
.recommended-avatar-profile-card__name-row {
  display: flex;
  justify-content: center;
  margin-bottom: 0.45rem;
  width: 100%;
}
.recommended-avatar-profile-card__name-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  max-width: 100%;
  margin: 0;
  padding: 0.42rem 0.85rem 0.42rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.95));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 4px 14px -8px rgba(15, 23, 42, 0.28);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.recommended-avatar-profile-card__name-chip:hover {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 6px 18px -10px rgba(99, 102, 241, 0.35);
}
.recommended-avatar-profile-card__name-chip:active {
  transform: scale(0.98);
}
.recommended-avatar-profile-card__name-chip:focus-visible {
  outline: 2px solid rgb(99 102 241);
  outline-offset: 2px;
}
.recommended-avatar-profile-card__name {
  font-size: 1.12rem;
  font-weight: 800;
  color: rgb(15 23 42);
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 11rem;
}
.recommended-avatar-profile-card__edit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  color: rgb(79 70 229);
}
.recommended-avatar-profile-card__edit-icon svg {
  width: 0.8rem;
  height: 0.8rem;
  display: block;
}

/* アバター表示名編集モーダル */
.avatar-display-name-modal__panel {
  background: #fff;
  box-shadow:
    0 22px 50px -24px rgba(15, 23, 42, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.6) inset;
}
.avatar-display-name-modal__head {
  background: linear-gradient(125deg, #7c3aed 0%, #6366f1 42%, #38bdf8 100%);
}
.avatar-display-name-modal__preview {
  display: flex;
  justify-content: center;
  margin-bottom: 0.85rem;
}
.avatar-display-name-modal__preview-ring {
  display: block;
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 1rem;
  padding: 3px;
  background: linear-gradient(145deg, #fde68a, #fca5a5 45%, #93c5fd);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}
.avatar-display-name-modal__preview-img {
  width: 100%;
  height: 100%;
  border-radius: calc(1rem - 3px);
  object-fit: cover;
  object-position: center 18%;
  display: block;
  background: #fff;
}
.avatar-display-name-modal__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: rgb(71 85 105);
  margin-bottom: 0.35rem;
  letter-spacing: 0.01em;
}
.avatar-display-name-modal__input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.72rem 0.9rem;
  font-size: 1rem;
  font-weight: 700;
  color: rgb(15 23 42);
  border: 2px solid rgb(226 232 240);
  border-radius: 0.85rem;
  background: rgb(248 250 252);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.avatar-display-name-modal__input::placeholder {
  color: rgb(148 163 184);
  font-weight: 600;
}
.avatar-display-name-modal__input:hover {
  border-color: rgb(203 213 225);
  background: #fff;
}
.avatar-display-name-modal__input:focus {
  outline: none;
  border-color: rgb(99 102 241);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.avatar-display-name-modal__input--error {
  border-color: rgb(248 113 113);
  background: rgb(254 242 242);
}
.avatar-display-name-modal__input--error:focus {
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2);
}
.avatar-display-name-modal__meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.4rem;
  min-height: 1.1rem;
}
.avatar-display-name-modal__counter {
  margin: 0 0 0 auto;
  font-size: 0.6875rem;
  font-weight: 600;
  color: rgb(100 116 139);
  white-space: nowrap;
}
.avatar-display-name-modal__counter--warn {
  color: rgb(217 119 6);
}
.avatar-display-name-modal__error {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  color: rgb(220 38 38);
}
.avatar-display-name-modal__error.hidden {
  display: none;
}
.avatar-display-name-modal__actions {
  gap: 0.5rem;
}
.avatar-display-name-modal__btn {
  padding: 0.65rem 0.75rem;
  border-radius: 0.85rem;
  font-size: 0.875rem;
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease;
}
.avatar-display-name-modal__btn:active {
  transform: scale(0.98);
}
.avatar-display-name-modal__btn--ghost {
  background: rgb(241 245 249);
  color: rgb(51 65 85);
}
.avatar-display-name-modal__btn--ghost:hover {
  background: rgb(226 232 240);
}
.avatar-display-name-modal__btn--primary {
  color: #fff;
  background: linear-gradient(90deg, #7c3aed, #6366f1);
  box-shadow: 0 4px 14px -6px rgba(99, 102, 241, 0.55);
}
.avatar-display-name-modal__btn--primary:hover {
  filter: brightness(1.05);
}
.avatar-display-name-modal__btn--primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  filter: none;
}
.recommended-avatar-profile-card__level-block {
  width: 100%;
}
.recommended-avatar-profile-card__level-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: rgb(30 41 59);
  text-align: left;
  margin-bottom: 0.28rem;
}
.recommended-avatar-profile-card__xp-bar {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgb(224 242 254);
  overflow: hidden;
}
.recommended-avatar-profile-card__xp-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7dd3fc, #38bdf8 55%, #0ea5e9);
  transition: width 0.35s ease;
}
.recommended-avatar-profile-card__xp-caption {
  margin: 0.28rem 0 0;
  font-size: 0.72rem;
  color: rgb(71 85 105);
  text-align: left;
  line-height: 1.35;
}
.recommended-avatar-profile-card__xp-caption strong {
  font-weight: 800;
  color: rgb(15 23 42);
}
.recommended-avatar-profile-card__status {
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(226 232 240, 0.95);
}
.recommended-avatar-profile-card__status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}
.recommended-avatar-profile-card__status-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: rgb(51 65 85);
}
.recommended-avatar-profile-card__help {
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: 1px solid rgb(203 213 225);
  border-radius: 999px;
  background: rgb(248 250 252);
  font-size: 0.7rem;
  font-weight: 800;
  color: rgb(100 116 139);
  cursor: pointer;
  line-height: 1;
}
.recommended-avatar-profile-card__help:hover {
  background: rgb(241 245 249);
  color: rgb(51 65 85);
}

/* 学習ステータス「？」説明モーダル（コンパクト・小6向けコピー用） */
.personal-space-help-modal__panel {
  background: #fff;
  box-shadow:
    0 22px 50px -24px rgba(15, 23, 42, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.6) inset;
}
.personal-space-help-modal__head {
  background: linear-gradient(125deg, #7c3aed 0%, #6366f1 42%, #38bdf8 100%);
}
.personal-space-help-modal__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.personal-space-help-modal__list li {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  line-height: 1.45;
}
.personal-space-help-modal__bullet {
  flex-shrink: 0;
  width: 1.35rem;
  text-align: center;
}
.personal-space-help-modal__ok {
  background: linear-gradient(90deg, #7c3aed, #6366f1);
}
.personal-space-help-modal__ok:hover {
  filter: brightness(1.05);
}

.recommended-avatar-profile-card__rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}
.recommended-avatar-profile-card__row {
  margin: 0;
  padding: 0;
}
.recommended-avatar-profile-card__row-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.22rem;
}
.recommended-avatar-profile-card__row-icon {
  font-size: 0.95rem;
  line-height: 1;
}
.recommended-avatar-profile-card__row-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: rgb(100 116 139);
}
.recommended-avatar-profile-card__row-value {
  font-size: 0.8125rem;
  font-weight: 800;
  color: rgb(67 56 202);
  font-variant-numeric: tabular-nums;
}
.recommended-avatar-profile-card__row--textonly {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.35rem;
}
.recommended-avatar-profile-card__row-gauge {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgb(226 232 240);
  overflow: hidden;
}
.recommended-avatar-profile-card__row-gauge-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #3b82f6 55%, #6366f1 100%);
}
.recommended-avatar-profile-card__cheer {
  margin-top: 0.55rem;
  padding: 0.5rem 0.55rem;
  border-radius: 0.65rem;
  background: linear-gradient(165deg, rgba(254 252 232, 0.98), rgba(254 243 199, 0.92));
  border: 1px solid rgba(251 191 36, 0.35);
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
}
.recommended-avatar-profile-card__cheer-icon {
  flex-shrink: 0;
  font-size: 1.1rem;
  line-height: 1;
}
.recommended-avatar-profile-card__cheer-text {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.45;
  color: rgb(120 53 15);
}
@media (min-width: 1024px) {
  .recommended-avatar-profile-card {
    max-width: 20rem;
    padding: 1.05rem 0.9rem 0.9rem;
    min-height: min(64vh, 40rem);
  }
  .recommended-avatar-profile-card__avatar-ring {
    max-width: 13.5rem;
    height: clamp(10.5rem, 24vmin, 13.5rem);
  }
}

/* キャラTOP中央：理科左・社会右 */
.recommended-avatar-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  width: 100%;
  min-width: 0;
}
@media (min-width: 640px) {
  .recommended-avatar-cards-grid {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
}
.recommended-avatar-cards-slot {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.recommended-avatar-cards-slot .recommended-avatar-card {
  flex: 1 1 auto;
}
.recommended-avatar-cards-slot--empty {
  display: none;
}
@media (min-width: 640px) {
  .recommended-avatar-cards-slot--empty {
    display: flex;
    visibility: hidden;
    pointer-events: none;
    min-height: 1px;
  }
}

/* キャラTOP中央列・一番下：おさらいレッスン（横長1枚・内側カードなし） */
.route-map-section-review--avatar-center {
  width: 100%;
  max-width: 100%;
  margin: 1rem 0 0;
  align-self: stretch;
  min-height: 0;
  padding-bottom: 0.12rem;
}

.route-map-section-review--avatar-center::before {
  opacity: 0.14;
  background-size:
    26px 26px,
    26px 26px,
    130px 130px,
    130px 130px;
  background-position:
    8% 52%,
    90% 48%,
    0% 0%,
    100% 100%;
}

.route-map-section-review--avatar-center .route-map-section-label {
  top: 0.35rem;
  left: 0.55rem;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgb(100 116 139);
  text-shadow: none;
}

.route-map-review-strip {
  margin: 1.35rem 0.35rem 0.15rem;
  padding: 0.5rem 0.65rem 0.55rem;
  border-radius: 0.55rem;
  box-sizing: border-box;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

/* キャラTOP中央：おさらい帯はメイン2カードより一段トーンを落とす */
.route-map-section-review--avatar-center .route-map-review-strip {
  margin-top: 1.1rem;
  padding: 0.48rem 0.7rem 0.58rem;
  background: rgba(248 250 252, 0.88);
  border: 1px solid rgba(148 163 184, 0.45);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75) inset;
}
.route-map-section-review--avatar-center .route-map-review-strip:hover {
  background: rgba(241 245 249, 0.95);
}

.route-map-review-strip:hover {
  background: rgba(255, 255, 255, 0.42);
}

.route-map-review-strip--inactive {
  cursor: not-allowed;
  opacity: 0.9;
}

.route-map-review-reason-chip {
  display: inline-block;
  max-width: 100%;
  margin-bottom: 0.28rem;
  padding: 0.14rem 0.5rem;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: rgb(91 33 182);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(139, 92, 246, 0.38);
  border-radius: 999px;
}

.route-map-section-review--avatar-center .route-map-review-reason-chip {
  font-size: 0.6rem;
  color: rgb(79 70 229);
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(129 140 248, 0.35);
}

.route-map-review-title {
  font-size: 0.875rem;
  font-weight: 800;
  color: rgb(30 27 75);
  line-height: 1.35;
  margin: 0 0 0.12rem;
}

.route-map-section-review--avatar-center .route-map-review-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: rgb(51 65 85);
}

.route-map-review-meta {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgb(71 85 105);
  margin: 0 0 0.32rem;
  line-height: 1.35;
}

.route-map-section-review--avatar-center .route-map-review-meta {
  font-size: 0.6875rem;
  font-weight: 500;
  color: rgb(100 116 139);
  margin-bottom: 0.42rem;
}

.route-map-review-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.route-map-section-review--avatar-center .route-map-review-actions {
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem 0.15rem;
  margin-top: 0.08rem;
}

.route-map-review-mini-badge {
  margin-right: auto;
  padding: 0.12rem 0.42rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  border-radius: 0.35rem;
}

/* キャラTOP：ラベル「おさらい」は Ghost／Outline（主役は再学習ボタン） */
.route-map-review-mini-badge--outline {
  margin-right: 0;
  color: rgb(91 33 182);
  background: transparent;
  border: 1.5px solid rgba(124, 58, 237, 0.55);
  box-shadow: none;
}

.route-map-section-review--avatar-center .route-map-review-mini-badge--outline {
  align-self: center;
  margin-right: 0;
}

.route-map-review-cta {
  flex-shrink: 0;
  padding: 0.28rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 0.45rem;
  border: none;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    opacity 0.12s ease;
}

.route-map-section-review--avatar-center .route-map-review-cta {
  align-self: center;
  width: 100%;
  max-width: 16rem;
  min-height: 2.75rem;
  padding: 0.42rem 1.1rem;
  font-size: 0.8125rem;
  border-radius: 0.5rem;
}

/* 「開始」：Outline（メイン教材のはじめると差別化） */
.route-map-review-cta--primary {
  color: rgb(91 33 182);
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid rgb(124 58 237);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.route-map-review-cta--primary:hover {
  transform: translateY(-1px);
  background: rgba(245 243 255, 0.98);
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.18);
}

/* 「再学習」：Filled（帯内の主CTA） */
.route-map-review-cta--again {
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  border: none;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.2) inset,
    0 4px 14px rgba(91, 33, 182, 0.35);
}

.route-map-review-cta--again:hover {
  transform: translateY(-1px);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.22) inset,
    0 6px 18px rgba(91, 33, 182, 0.4);
}

.route-map-review-cta--locked {
  color: rgb(100 116 139);
  background: rgb(226 232 240);
  cursor: not-allowed;
}

.route-map-section-review--avatar-center .route-map-review-cta--locked {
  align-self: center;
  width: 100%;
  max-width: 16rem;
  min-height: 2.75rem;
  padding: 0.42rem 1.1rem;
  font-size: 0.8125rem;
  border-radius: 0.5rem;
  border: 1px solid rgb(203 213 225);
}

.recommended-avatar-review-empty {
  width: 100%;
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.85rem;
  box-sizing: border-box;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: rgb(71 85 105);
  background: rgba(255, 255, 255, 0.92);
  border: 2px dashed rgb(203 213 225);
  border-radius: 0.75rem;
  text-align: center;
}
.recommended-avatar-review-empty--center {
  max-width: 100%;
}

.recommended-avatar-bubble-wrap {
  margin-bottom: 0.625rem;
  width: 100%;
  display: flex;
  justify-content: center;
}
.recommended-avatar-speech {
  margin: 0;
  padding: 0.6rem 0.85rem;
  max-width: 15rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: rgb(51 65 85);
  background: #ffffff;
  border: 2px solid rgb(203 213 225);
  border-radius: 0.75rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  position: relative;
}
.recommended-avatar-speech::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #ffffff;
  filter: drop-shadow(0 2px 0 rgb(203 213 225));
}
.recommended-avatar-speech__lead {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  color: rgb(124 58 237);
  margin-bottom: 0.25rem;
}
.recommended-avatar-speech__em {
  font-weight: 800;
  color: rgb(14 165 233);
}

.recommended-avatar-card {
  background: #ffffff;
  border-radius: 0.75rem;
  padding: 0.65rem 0.7rem;
  border: 2px solid rgb(148 163 184 / 0.45);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 12px 28px -14px rgba(15, 23, 42, 0.48),
    0 5px 14px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(15, 23, 42, 0.05);
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
  position: relative;
  overflow: hidden;
}
.recommended-avatar-card--rich {
  border-radius: 1rem;
  padding: 0.75rem 0.8rem;
}
.recommended-avatar-card::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, #22d3ee, #3b82f6 55%, #6366f1);
  opacity: 0.92;
}
.recommended-avatar-card:hover {
  transform: translateY(-5px);
  border-color: rgb(148 163 184);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.96) inset,
    0 16px 30px -14px rgba(15, 23, 42, 0.5),
    0 8px 14px rgba(15, 23, 42, 0.11);
}
.recommended-avatar-card--inactive {
  opacity: 0.78;
}
/* 理科：モック寄せのグリーン（#4CAF50 系） */
.recommended-avatar-card--sci {
  border-color: #66bb6a;
}
.recommended-avatar-card--sci::before {
  background: linear-gradient(90deg, #81c784, #4caf50 55%, #43a047);
}
/* 社会：既存のオレンジトーンを維持 */
.recommended-avatar-card--soc {
  border-color: rgb(234 88 12);
}
.recommended-avatar-card--soc::before {
  background: linear-gradient(90deg, #fb923c, #ea580c 65%, #c2410c);
}
.recommended-avatar-card--review.recommended-avatar-card--sci,
.recommended-avatar-card--review.recommended-avatar-card--soc {
  border-color: rgb(99 102 241);
}
.recommended-avatar-card--review.recommended-avatar-card--sci::before,
.recommended-avatar-card--review.recommended-avatar-card--soc::before {
  background: linear-gradient(90deg, #818cf8, #6366f1 65%, #4f46e5);
}

.recommended-avatar-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.recommended-avatar-card__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.38rem;
  border-radius: 999px;
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.recommended-avatar-card--sci .recommended-avatar-card__badge {
  background: rgba(76, 175, 80, 0.18);
  color: #2e7d32;
  border: 1px solid rgba(76, 175, 80, 0.45);
}
.recommended-avatar-card--soc .recommended-avatar-card__badge {
  background: rgba(251 146 60 / 0.2);
  color: #c2410c;
  border: 1px solid rgba(234 88 12 / 0.35);
}
.recommended-avatar-card__icon-circle {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}
.recommended-avatar-card--sci .recommended-avatar-card__icon-circle {
  background: linear-gradient(145deg, #e8f5e9, #c8e6c9);
  border: 1px solid rgba(76, 175, 80, 0.35);
}
.recommended-avatar-card--soc .recommended-avatar-card__icon-circle {
  background: linear-gradient(145deg, #fff7ed, #ffedd5);
  border: 1px solid rgba(251 146 60 / 0.45);
}
.recommended-avatar-card__icon-emoji {
  font-size: 1.15rem;
  line-height: 1;
}
.recommended-avatar-card__grade-meta {
  margin: 0 0 0.5rem;
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgb(148 163 184);
}
.recommended-avatar-card__thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 0.65rem;
  margin-bottom: 0.45rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.recommended-avatar-card__thumb-img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.recommended-avatar-card__thumb--has-img .recommended-avatar-card__thumb-icon {
  visibility: hidden;
}
.recommended-avatar-card__thumb--sci {
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.55), transparent 45%),
    linear-gradient(145deg, #e8f5e9 0%, #a5d6a7 55%, #81c784 100%);
  border: 1px solid rgba(76, 175, 80, 0.28);
}
.recommended-avatar-card__thumb--soc {
  background:
    radial-gradient(circle at 75% 25%, rgba(255, 255, 255, 0.5), transparent 48%),
    linear-gradient(145deg, #fff7ed 0%, #fdba74 55%, #fb923c 100%);
  border: 1px solid rgba(251 146 60 / 0.35);
}
.recommended-avatar-card__thumb-icon {
  font-size: clamp(2.35rem, 13vmin, 3.35rem);
  line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(15, 23, 42, 0.15));
}
.recommended-avatar-card__progress {
  position: relative;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgb(226 232 240);
  overflow: hidden;
  margin-bottom: 0.55rem;
}
.recommended-avatar-card__progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.35s ease;
}
.recommended-avatar-card__progress-fill--sci {
  background: linear-gradient(90deg, #81c784, #4caf50);
}
.recommended-avatar-card__progress-fill--soc {
  background: linear-gradient(90deg, #fb923c, #ea580c);
}
.recommended-avatar-card__head {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  padding-top: 0.05rem;
}
.recommended-avatar-card__icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  line-height: 1;
}
.recommended-avatar-card__title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.3;
  color: rgb(30 41 59);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.recommended-avatar-card--rich .recommended-avatar-card__title {
  font-size: clamp(0.98rem, 2.6vw, 1.2rem);
  font-weight: 800;
  line-height: 1.32;
  letter-spacing: -0.03em;
  color: rgb(15 23 42);
  -webkit-line-clamp: 4;
}
@media (min-width: 1024px) {
  .recommended-avatar-column--cards .recommended-avatar-card--rich .recommended-avatar-card__title {
    font-size: clamp(0.92rem, 1.55vw, 1.08rem);
  }
  .recommended-avatar-column--cards .recommended-avatar-card__grade-meta {
    font-size: 0.54rem;
  }
  .recommended-avatar-column--cards .recommended-avatar-card__overview {
    font-size: 0.62rem;
    line-height: 1.4;
  }
  .recommended-avatar-column--cards .recommended-avatar-card__meta {
    font-size: 0.6rem;
  }
  .recommended-avatar-column--cards .recommended-avatar-card--rich {
    padding: 0.62rem 0.65rem;
  }
  .recommended-avatar-column--cards .recommended-avatar-card__cta {
    font-size: 0.82rem;
    padding: 0.48rem 0.62rem;
  }
  .recommended-avatar-column--cards .recommended-avatar-card__head {
    gap: 0.45rem;
    margin-bottom: 0.35rem;
  }
  .recommended-avatar-column--cards .recommended-avatar-card__icon {
    font-size: 0.95rem;
  }
}
.recommended-avatar-card__meta {
  margin-top: 0.2rem;
  font-size: 0.68rem;
  color: rgb(100 116 139);
}
.recommended-avatar-card__overview {
  margin: 0 0 0.4rem;
  font-size: 0.64rem;
  line-height: 1.35;
  color: rgb(71 85 105);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.recommended-avatar-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.28rem 0.42rem;
  border-radius: 0.45rem;
  margin-bottom: 0.45rem;
  background: rgb(224 242 254);
  color: rgb(3 105 161);
}
.recommended-avatar-status--trial {
  background: linear-gradient(135deg, rgb(254 243 199), rgb(253 230 138));
  color: rgb(146 64 14);
  border: 1px solid rgb(251 191 36);
  font-weight: 700;
}

.recommended-avatar-card--trial {
  border-color: #0ea5e9 !important;
  box-shadow:
    0 0 0 2px rgba(14, 165, 233, 0.22),
    0 16px 30px -14px rgba(14, 165, 233, 0.28),
    0 8px 14px rgba(15, 23, 42, 0.11);
}

.recommended-avatar-card--trial::before {
  background: linear-gradient(90deg, #38bdf8, #0ea5e9 55%, #0284c7) !important;
  height: 4px;
}

.recommended-avatar-card__trial-ribbon {
  position: absolute;
  top: 0.42rem;
  right: 0.42rem;
  z-index: 3;
  padding: 0.16rem 0.46rem;
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
  pointer-events: none;
}

.recommended-avatar-card__cta--trial {
  background: linear-gradient(135deg, #0284c7, #0ea5e9) !important;
  box-shadow: 0 3px 10px rgba(14, 165, 233, 0.35);
}

.recommended-avatar-status--locked {
  background: rgb(241 245 249);
  color: rgb(100 116 139);
}
.recommended-avatar-status--review {
  background: rgb(237 233 254);
  color: rgb(91 33 182);
}
.recommended-avatar-status__icon {
  flex-shrink: 0;
}

.recommended-avatar-card__cta {
  width: 100%;
  border: none;
  border-radius: 0.55rem;
  padding: 0.52rem 0.68rem;
  font-size: 0.84rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition: filter 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.recommended-avatar-card__cta:hover {
  filter: brightness(1.06);
}
.recommended-avatar-card__cta-arrow {
  font-weight: 900;
  font-size: 1.05em;
  line-height: 1;
  opacity: 0.95;
}
/* 理科ボタン：モックのグリーン */
.recommended-avatar-card__cta--sci {
  background: linear-gradient(135deg, #66bb6a, #4caf50 55%, #43a047);
}
/* 社会ボタン：現状のオレンジグラデを維持 */
.recommended-avatar-card__cta--soc {
  background: linear-gradient(135deg, #ea580c, #c2410c);
}
.recommended-avatar-card--inactive .recommended-avatar-card__cta--sci,
.recommended-avatar-card--inactive .recommended-avatar-card__cta--soc {
  background: rgb(148 163 184);
}

/* スマホ：おすすめ学習カードの縦幅を約2/3に（ファーストビューで2枚目まで見えやすく） */
@media (max-width: 639px) {
  .recommended-avatar-row--stack-cards-first {
    gap: 0.85rem;
  }
  .recommended-avatar-column--cards {
    gap: 0.55rem;
  }
  .recommended-avatar-cards-grid {
    gap: 0.55rem;
  }
  .recommended-avatar-card--rich {
    padding: 0.45rem 0.5rem 0.48rem;
    border-radius: 0.65rem;
  }
  .recommended-avatar-card__top {
    margin-bottom: 0.28rem;
    gap: 0.35rem;
  }
  .recommended-avatar-card__badge {
    padding: 0.1rem 0.32rem;
    font-size: 0.52rem;
  }
  .recommended-avatar-card__icon-circle {
    width: 1.75rem;
    height: 1.75rem;
  }
  .recommended-avatar-card__icon-emoji {
    font-size: 0.9rem;
  }
  .recommended-avatar-card--rich .recommended-avatar-card__title,
  .recommended-avatar-card__title {
    font-size: 0.8125rem;
    line-height: 1.28;
    -webkit-line-clamp: 2;
  }
  .recommended-avatar-card__grade-meta {
    margin: 0 0 0.22rem;
    font-size: 0.52rem;
  }
  /* 16:9 サムネの高さ × 2/3 ≒ 8:3 */
  .recommended-avatar-card__thumb {
    aspect-ratio: 8 / 3;
    margin-bottom: 0.28rem;
    border-radius: 0.45rem;
  }
  .recommended-avatar-card__thumb-icon {
    font-size: clamp(1.5rem, 8vmin, 2rem);
  }
  .recommended-avatar-status {
    margin-bottom: 0.28rem;
    padding: 0.18rem 0.32rem;
    font-size: 0.58rem;
  }
  .recommended-avatar-card__progress {
    height: 5px;
    margin-bottom: 0.32rem;
  }
  .recommended-avatar-card__cta {
    padding: 0.36rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 0.45rem;
  }
  .recommended-avatar-card__cta-arrow {
    font-size: 1em;
  }

  /* スマホ：学習リスト（理科・社会）の単元行をコンパクトに */
  #homeView.math-full-width .lessons-column {
    padding: 0.35rem 0.12rem 0.5rem;
    min-height: 0;
  }

  #homeView.math-full-width .lessons-header {
    margin-bottom: 0.4rem;
    padding-bottom: 0.35rem;
  }

  #homeView.math-full-width .lessons-title {
    font-size: 0.9375rem;
  }

  #homeView.math-full-width .lessons-list-container {
    border-radius: 10px;
  }

  #homeView.math-full-width .lesson-list-item,
  #homeView.math-full-width .lesson-list-item.pair-row {
    padding: 0.38rem 0.5rem;
    gap: 0.22rem;
  }

  #homeView.math-full-width .lesson-list-item.pair-row .lesson-row-first {
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.35rem;
  }

  #homeView.math-full-width .lesson-list-item .lesson-number {
    width: 1.65rem;
    height: 1.2rem;
    font-size: 0.65rem;
    border-radius: 4px;
  }

  #homeView.math-full-width .lesson-list-item .lesson-grade-badge {
    padding: 0.08rem 0.28rem;
    font-size: 0.58rem;
  }

  #homeView.math-full-width .lesson-list-item .lesson-title {
    order: 0;
    margin-bottom: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.28;
    min-width: 0;
    flex: 1 1 calc(100% - 8.5rem);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  #homeView.math-full-width .lesson-list-item .lesson-pair-actions {
    gap: 0.28rem;
    margin-left: auto;
    flex-shrink: 0;
  }

  #homeView.math-full-width .lesson-list-item .lesson-pair-actions.single-mode {
    min-width: 0;
    width: auto;
  }

  #homeView.math-full-width .lesson-list-item.pair-row .lesson-pair-actions {
    margin-left: 0;
    width: 100%;
    justify-content: stretch;
  }

  #homeView.math-full-width .lesson-list-item.pair-row .lesson-mode-action {
    width: calc(50% - 0.14rem);
    min-width: 0;
    flex: 1 1 0;
  }

  #homeView.math-full-width .lesson-list-item .lesson-pair-actions .lesson-action-btn,
  #homeView.math-full-width .lesson-list-item .lesson-action-btn {
    min-width: 0;
    padding: 0.28rem 0.42rem;
    font-size: 0.7rem;
    min-height: 26px;
  }

  #homeView.math-full-width .lesson-list-item .lesson-action-btn.progress-indicator {
    padding-left: 1.15rem;
  }

  #homeView.math-full-width .lesson-list-item .lesson-action-btn.progress-indicator::before {
    width: 0.45rem;
    height: 0.45rem;
    left: 0.38rem;
  }

  #homeView.math-full-width .lesson-list-item .lesson-mode-score {
    font-size: 0.56rem;
    min-height: 0.55rem;
    line-height: 1;
  }

  #homeView.math-full-width #unitsContainer.compact-units .unit-item {
    height: 34px;
    padding: 0 10px;
    min-width: 48px;
  }

  #homeView.math-full-width #unitsContainer.compact-units .unit-item-short {
    font-size: 0.8rem;
  }
}

.recommended-avatar-empty {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.9rem;
  color: rgb(71 85 105);
  background: rgb(248 250 252);
  border-radius: 0.75rem;
  border: 1px dashed rgb(203 213 225);
}
.recommended-avatar-progress-hint {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: rgb(100 116 139);
  text-align: center;
}
.recommended-avatar-progress-hint strong {
  color: rgb(234 88 12);
}

/* ===== メイン画面遷移（横スライド） ===== */
.app-view-stack {
  position: relative;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.app-view-panel {
  width: 100%;
  min-width: 0;
  will-change: transform, opacity;
}

.app-view-panel.is-view-exiting {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 0;
  pointer-events: none;
}

.app-view-panel.is-view-entering {
  position: relative;
  z-index: 1;
}

.app-view-panel.view-enter-forward {
  animation: viewEnterForward 0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.app-view-panel.view-enter-back {
  animation: viewEnterBack 0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.app-view-panel.view-exit-forward {
  animation: viewExitForward 0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.app-view-panel.view-exit-back {
  animation: viewExitBack 0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes viewEnterForward {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes viewEnterBack {
  from {
    opacity: 0;
    transform: translateX(-28px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes viewExitForward {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-24px);
  }
}

@keyframes viewExitBack {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-view-panel.view-enter-forward,
  .app-view-panel.view-enter-back,
  .app-view-panel.view-exit-forward,
  .app-view-panel.view-exit-back {
    animation: viewEnterFade 0.2s ease forwards;
  }

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

/* ===== サブタブコンテナ ===== */
.sub-tabs-container {
  animation: fadeIn 0.3s ease;
  scroll-margin: 0;
  scroll-padding: 0;
}

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

/* ===== 教科別タブ（サブタブ：4つのタブ） ===== */
.subject-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.375rem;
  justify-content: center;
  overflow-x: auto;
  padding: 0.25rem 0;
  -webkit-overflow-scrolling: touch;
}

.subject-tab {
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  border: 3px solid;
  background: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  position: relative;
}

.subject-tab:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.subject-tab.active {
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15), 0 0 20px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

/* 教科別タブの色（任天堂風：白背景＋ビビッドカラーボーダー、既存色を踏襲） */
.subject-tab[data-subject="recommended"]{
  border-color:#f59e0b;
  color:#f59e0b;
}
.subject-tab[data-subject="recommended"].active{
  background:#f59e0b;
  border-color:#f59e0b;
  color:#fff;
}

.subject-tab[data-subject="math"]{
  border-color:#3b82f6;
  color:#3b82f6;
}
.subject-tab[data-subject="math"].active{
  background:#3b82f6;
  border-color:#3b82f6;
  color:#fff;
}

.subject-tab[data-subject="soc"]{
  border-color:#ea580c;
  color:#ea580c;
}
.subject-tab[data-subject="soc"].active{
  background:#ea580c;
  border-color:#ea580c;
  color:#fff;
}

.subject-tab[data-subject="sci"]{
  border-color:#16a34a;
  color:#16a34a;
}
.subject-tab[data-subject="sci"].active{
  background:#16a34a;
  border-color:#16a34a;
  color:#fff;
}

.subject-tab[data-subject="jpn"]{
  border-color:#dc2626;
  color:#dc2626;
}
.subject-tab[data-subject="jpn"].active{
  background:#dc2626;
  border-color:#dc2626;
  color:#fff;
}

.subject-tab[data-subject="eng"]{
  border-color:#64748b;
  color:#64748b;
}
.subject-tab[data-subject="eng"].active{
  background:#64748b;
  border-color:#64748b;
  color:#fff;
}

/* 新しい教科タブの色（既存色を踏襲） */
.subject-tab[data-subject="science_drill"]{
  border-color:#16a34a;
  color:#16a34a;
}
.subject-tab[data-subject="science_drill"].active{
  background:#16a34a;
  border-color:#16a34a;
  color:#fff;
}

.subject-tab[data-subject="social_drill"]{
  border-color:#ea580c;
  color:#ea580c;
}
.subject-tab[data-subject="social_drill"].active{
  background:#ea580c;
  border-color:#ea580c;
  color:#fff;
}

/* ===== Recommendation ===== */
.reco{display:grid;gap:.75rem}
@media (min-width:640px){ .reco{grid-template-columns:repeat(3,minmax(0,1fr))} }

/* ===== レスポンシブ対応 ===== */
@media (max-width: 640px) {
  .subject-tabs {
    gap: .35rem;
    padding: .35rem 0;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
  }
  /* おすすめタブを1行目に配置（全幅） */
  .subject-tab[data-subject="recommended"] {
    flex-basis: 100%;
    width: 100%;
    padding: .625rem .875rem;
    font-size: .8rem;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  /* 他のタブを2行目に配置（1行に4つ並べる） */
  .subject-tab:not([data-subject="recommended"]) {
    flex: 1 1 calc(25% - 0.375rem);
    min-width: calc(25% - 0.375rem);
    max-width: calc(25% - 0.375rem);
    padding: .5rem .25rem;
    font-size: .68rem;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    text-align: center;
    line-height: 1.15;
    border-width: 2px;
  }
}

/* 375px以下でのタブ最適化（テキスト収納対策） */
@media (max-width: 375px) {
  .subject-tabs {
    gap: 0.12rem;
    padding: 0.25rem 0;
    flex-wrap: wrap;
    overflow-x: visible;
    justify-content: center;
  }
  
  /* おすすめタブを1行目に配置（全幅） */
  .subject-tab[data-subject="recommended"] {
    flex-basis: 100%;
    width: 100%;
    padding: 0.55rem 0.7rem;
    font-size: 0.75rem;
    min-height: 40px;
    margin-bottom: 0.25rem;
  }
  
  /* 他のタブを2行目に配置（4列固定） */
  .subject-tab:not([data-subject="recommended"]) {
    flex: 1 1 calc(50% - 0.12rem);
    min-width: calc(50% - 0.12rem);
    max-width: calc(50% - 0.12rem);
    padding: 0.42rem 0.18rem;
    font-size: 0.62rem;
    min-height: 40px;
    white-space: normal;
    letter-spacing: -0.02em;
    line-height: 1.15;
    border-width: 1.5px;
  }
  
  /* 「わかる」系タブ（短いテキスト） */
  .subject-tab[data-subject="sci"],
  .subject-tab[data-subject="soc"] {
    padding: 0.42rem 0.2rem;
    font-size: 0.64rem;
  }
  
  /* 「おぼえる」系タブ（長いテキスト） - より小さく */
  .subject-tab[data-subject="science_drill"],
  .subject-tab[data-subject="social_drill"] {
    padding: 0.42rem 0.14rem;
    font-size: 0.6rem;
    letter-spacing: -0.03em;
    line-height: 1.1;
  }
  
  /* 絵文字のサイズを調整（フォントサイズに合わせて） */
  .subject-tab[data-subject="science_drill"]::before,
  .subject-tab[data-subject="social_drill"]::before {
    font-size: 0.7em;
  }
  
  /* 全体の下限サイズを揃える */
  .subject-tab {
    font-size: 0.62rem;
  }
}


/* ===== 学年バナー（4/1の購入促進） ===== */
.grade-banner {
  display:none; align-items:center; justify-content:space-between;
  gap:.75rem; background:#f0fdf4; border:1px solid #86efac;
  color:#065f46; padding:.75rem; border-radius:12px; margin:.75rem 0;
}
.grade-banner.show { display:flex; }
.grade-banner .actions { display:flex; gap:.5rem; }
/* キャラTOP・学習リスト：新年度購入促しサブバナーを出さない */
.grade-banner.grade-banner--suppressed-for-avatar-top {
  display: none !important;
}

/* 学習リスト：ニャビー横長帯を出さない */
#homeView.home-view--learning-list #homeNyabyHeroBanner {
  display: none !important;
  margin: 0 !important;
  min-height: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  visibility: hidden !important;
}

/* ===== ヘッダー：学年チップ ===== */
.header-grade-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.125rem;
  padding: 0.2rem 0.42rem;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.2;
  border-radius: 0.375rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
@media (min-width: 640px) {
  .header-grade-chip {
    min-width: 2.5rem;
    padding: 0.3rem 0.55rem;
    font-size: 0.8125rem;
    border-radius: 0.5rem;
  }
}
.header-grade-chip:hover {
  background: #fff;
  border-color: #cbd5e1;
  color: #475569;
}
.header-grade-chip:active {
  transform: scale(0.97);
}
.header-grade-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #fb923c;
}
.header-grade-chip--active {
  background: linear-gradient(135deg, #f97316, #fb923c);
  color: #fff !important;
  border-color: #ea580c;
  box-shadow: 0 1px 4px rgba(234, 88, 12, 0.35);
}
.header-grade-chip--active:hover {
  background: linear-gradient(135deg, #ea580c, #f97316);
  color: #fff !important;
  border-color: #c2410c;
}

/* PC：セグメントタブ */
.header-grade-segment {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
}
.header-grade-segment__label {
  font-size: 0.5625rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  color: #94a3b8;
  white-space: nowrap;
}
.header-grade-segment__tabs {
  display: inline-flex;
  align-items: stretch;
  gap: 0.125rem;
  padding: 0.125rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
}
.header-grade-segment__tabs .header-grade-chip {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.header-grade-segment__tabs .header-grade-chip:hover {
  background: #fff;
  border-color: #e2e8f0;
  color: #334155;
}
.header-grade-segment__tabs .header-grade-chip--active {
  border-color: #ea580c;
}

/* PC/タブレット：選択中学年のみ赤字（白文字はオレンジ背景で視認性が低い） */
@media (min-width: 640px) {
  .header-grade-segment__tabs .header-grade-chip--active,
  .header-grade-segment__tabs .header-grade-chip--active:hover {
    background: #fff;
    color: #dc2626 !important;
    border-color: #dc2626;
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.18), 0 1px 4px rgba(220, 38, 38, 0.12);
  }
}

/* スマホ：学年ドロップダウンボタン */
.header-grade-chip--menu {
  gap: 0.2rem;
  min-height: 2.75rem;
  min-width: 0;
  padding: 0.35rem 0.5rem 0.35rem 0.45rem;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.header-grade-chip--menu.header-grade-chip--active {
  box-shadow: 0 1px 4px rgba(234, 88, 12, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.header-grade-chip__prefix {
  font-size: 0.5625rem;
  font-weight: 700;
  line-height: 1;
  opacity: 0.92;
  letter-spacing: 0.02em;
}
.header-grade-chip__prefix::after {
  content: '：';
}
.header-grade-chip__value {
  font-size: 0.8125rem;
  font-weight: 800;
  line-height: 1.1;
}
.header-grade-chip__chevron {
  font-size: 0.5rem;
  line-height: 1;
  margin-left: 0.05rem;
  opacity: 0.9;
  transition: transform 0.15s ease;
}
.header-grade-chip--menu[aria-expanded="true"] .header-grade-chip__chevron {
  transform: rotate(180deg);
}
.header-grade-chip--menu .header-grade-chip__chevron {
  color: inherit;
}
@keyframes headerGradeHintPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.45); }
  50% { box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.2); }
}
.header-grade-chip--hint-pulse {
  animation: headerGradeHintPulse 1.2s ease-in-out 2;
}
@media (prefers-reduced-motion: reduce) {
  .header-grade-chip--hint-pulse {
    animation: none;
  }
}

/* スマホ：初回ツールチップ */
.header-grade-hint {
  position: fixed;
  z-index: 9992;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.55rem 0.65rem;
  max-width: 16rem;
  background: #1e293b;
  color: #f8fafc;
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
  pointer-events: auto;
}
.header-grade-hint.hidden {
  display: none !important;
}
.header-grade-hint::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 1.25rem;
  width: 10px;
  height: 10px;
  background: #1e293b;
  transform: rotate(45deg);
}
.header-grade-hint__text {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.45;
}
.header-grade-hint__dismiss {
  align-self: flex-end;
  padding: 0.2rem 0.55rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #1e293b;
  background: #fbbf24;
  border: none;
  border-radius: 0.35rem;
  cursor: pointer;
}
.header-grade-hint__dismiss:hover {
  background: #f59e0b;
}

/*
 * ヘッダー学年の表示切替: 本ファイルの `.hidden { display: none !important }` があると、
 * Tailwind の `hidden` と `sm:flex` を併用した要素は sm 以上でも常に非表示のままになる。
 * 学年タブはこの専用クラスで制御する（640px = Tailwind の sm に合わせる）。
 */
.header-grade-chips-desktop {
  display: none !important;
}
@media (min-width: 640px) {
  .header-grade-chips-desktop {
    display: flex !important;
  }
}
.header-grade-mobile-only {
  position: relative;
}
@media (min-width: 640px) {
  .header-grade-mobile-only {
    display: none !important;
  }
}

/*
 * Tailwind の `hidden sm:inline` / `hidden sm:block` は HTML 上に `hidden` が付くため、
 * 本ファイルの `.hidden { display: none !important }` と衝突して sm 以上でも常に非表示になる。
 * `hidden` クラス名を使わない専用クラスで sm 以上の表示だけ切り替える。
 */
.rsp-hide-sm-show-inline {
  display: none !important;
}
@media (min-width: 640px) {
  .rsp-hide-sm-show-inline {
    display: inline !important;
  }
}
.rsp-hide-sm-show-block {
  display: none !important;
}
@media (min-width: 640px) {
  .rsp-hide-sm-show-block {
    display: block !important;
  }
}

/* スマホ：学年1ボタン＋ドロップダウン（JS で body 直下へ移動し fixed 配置。ヘッダー overflow を越える） */
.header-grade-popover {
  position: fixed;
  min-width: 7.5rem;
  padding: 0.35rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
  z-index: 9990;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.header-grade-popover.hidden {
  display: none !important;
}
.header-grade-popover__opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.65rem;
  font-size: 0.875rem;
  font-weight: 700;
  border: none;
  border-radius: 0.375rem;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.header-grade-popover__opt:hover,
.header-grade-popover__opt:focus-visible {
  background: #fff7ed;
  color: #c2410c;
  outline: none;
  box-shadow: 0 0 0 2px #fb923c;
}
.header-grade-popover__opt[aria-selected="true"] {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  color: #9a3412;
}

/* ===== 購入モーダル ===== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.hidden { display: none; }
.modal-overlay:not(.hidden) {
  pointer-events: auto;
}

.modal-container {
  background: white; border-radius: 16px; box-shadow: 0 20px 40px rgba(0,0,0,0.15);
  max-width: 900px; width: 100%; max-height: 90vh; overflow: hidden;
  transform: scale(1); transition: transform 0.2s ease;
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.5rem; border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #fef7ed, #fed7aa);
}
.modal-title {
  font-size: 1.25rem; font-weight: 700; color: #9a3412; margin: 0;
}
.modal-close-btn {
  background: none; border: none; font-size: 1.5rem; cursor: pointer;
  color: #6b7280; hover-color: #374151; padding: 0.25rem;
  line-height: 1; transition: color 0.2s;
}
.modal-close-btn:hover { color: #374151; }

.modal-body {
  padding: 1.5rem; max-height: 60vh; overflow-y: auto;
}
.modal-intro {
  text-align: center; margin-bottom: 1.5rem;
  color: #6b7280; font-size: 0.95rem;
}

/* 購入モーダル：開発用（#modalPackGrid 外 — innerHTML で消えない） */
.modal-dev-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px dashed #f59e0b;
  background: #fffbeb;
}
.modal-dev-tools[hidden] {
  display: none !important;
}
.modal-dev-tools-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #b45309;
  letter-spacing: 0.02em;
}
.modal-dev-tools .modal-dev-tools-btn {
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
}

.modal-pack-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem; margin-bottom: 1rem;
}

.modal-pack-card {
  position: relative;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.modal-pack-card:hover {
  border-color: #c7d2fe !important;
  box-shadow: 0 10px 30px -10px rgba(67, 56, 202, 0.15) !important;
}
.modal-pack-card.purchased {
  background: linear-gradient(180deg, #f0fdf4, #ecfdf5) !important;
  border-color: #6ee7b7 !important;
  box-shadow: 0 4px 20px -8px rgba(5, 150, 105, 0.25) !important;
}

.modal-pack-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem;
}
.modal-pack-title {
  font-weight: 700; font-size: 1.1rem; color: #1f2937;
}
.modal-pack-status {
  font-size: 0.7rem; padding: 0.35rem 0.65rem; border-radius: 999px;
  font-weight: 700; letter-spacing: 0.02em;
}
.modal-pack-status.purchased {
  background: #d1fae5; color: #065f46;
}
.modal-pack-status.unpurchased {
  background: #fef3c7; color: #92400e;
}

.modal-pack-content {
  margin-bottom: 1rem;
}
.modal-pack-subjects {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem;
}
.modal-subject-card {
  background: rgba(255, 255, 255, 0.95); border-radius: 12px; padding: 0.75rem 0.85rem;
  border: 1px solid #e2e8f0;
}
.modal-subject-title {
  font-weight: 600; color: #374151; margin-bottom: 0.5rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.modal-subject-topics {
  font-size: 0.85rem; color: #6b7280; line-height: 1.4;
}

.modal-pack-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: stretch;
  flex-direction: column;
}
@media (min-width: 640px) {
  .modal-pack-actions {
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
  }
}

/* 購入モーダル内：購入ボタンを明確な「ボタン」として強調 */
.purchase-modal-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 0 1.35rem;
  border-radius: 0.75rem;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: #fff !important;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 45%, #7c3aed 100%);
  border: none;
  box-shadow:
    0 4px 0 0 rgba(67, 56, 202, 0.35),
    0 12px 28px -10px rgba(79, 70, 229, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
@media (min-width: 640px) {
  .purchase-modal-cta {
    width: auto;
    min-width: 11rem;
  }
}
.purchase-modal-cta:hover:not(:disabled) {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow:
    0 5px 0 0 rgba(67, 56, 202, 0.4),
    0 16px 32px -10px rgba(79, 70, 229, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.purchase-modal-cta:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow:
    0 2px 0 0 rgba(67, 56, 202, 0.45),
    0 8px 20px -10px rgba(79, 70, 229, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.purchase-modal-cta:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px #fff,
    0 0 0 6px #6366f1,
    0 12px 28px -10px rgba(79, 70, 229, 0.55);
}

.purchase-modal-cta--blocked {
  background: linear-gradient(135deg, #94a3b8 0%, #cbd5e1 100%);
  color: #f8fafc !important;
  box-shadow:
    0 3px 0 0 rgba(100, 116, 139, 0.35),
    0 8px 20px -12px rgba(71, 85, 105, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  cursor: not-allowed;
  opacity: 0.92;
}

/* 購入済みパックの「学習開始」：輪郭でボタン感を維持 */
.purchase-modal-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 0 1.25rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: #4338ca !important;
  background: #fff;
  border: 2px solid #c7d2fe;
  box-shadow: 0 2px 8px rgba(67, 56, 202, 0.08);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
@media (min-width: 640px) {
  .purchase-modal-open {
    width: auto;
    min-width: 10rem;
  }
}
.purchase-modal-open:hover {
  background: #eef2ff;
  border-color: #818cf8;
  box-shadow: 0 4px 14px rgba(67, 56, 202, 0.12);
}
.purchase-modal-open:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px #818cf8;
}

.modal-footer {
  padding: 1rem 1.5rem; border-top: 1px solid #e5e7eb;
  background: #f9fafb; text-align: center;
}

/* ===== ホーム：スマホ向け PWA 推奨バナー ===== */
.home-pwa-recommend-banner {
  margin-bottom: 0.75rem;
}
.home-pwa-recommend-banner.hidden {
  display: none !important;
}
.home-pwa-recommend-banner__inner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.75rem 0.7rem 0.85rem;
  border-radius: 1rem;
  border: 1px solid rgba(37, 99, 235, 0.22);
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.98), rgba(224, 242, 254, 0.95));
  box-shadow: 0 6px 18px -12px rgba(37, 99, 235, 0.45);
}
.home-pwa-recommend-banner__icon {
  flex-shrink: 0;
  font-size: 1.35rem;
  line-height: 1;
}
.home-pwa-recommend-banner__text {
  flex: 1 1 auto;
  min-width: 0;
}
.home-pwa-recommend-banner__title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 800;
  color: rgb(30 58 138);
  line-height: 1.3;
}
.home-pwa-recommend-banner__desc {
  margin: 0.12rem 0 0;
  font-size: 0.6875rem;
  font-weight: 600;
  color: rgb(71 85 105);
  line-height: 1.35;
}
.home-pwa-recommend-banner__cta {
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  padding: 0.45rem 0.72rem;
  font-size: 0.6875rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(90deg, #2563eb, #4f46e5);
  box-shadow: 0 3px 10px -4px rgba(37, 99, 235, 0.55);
  cursor: pointer;
  white-space: nowrap;
}
.home-pwa-recommend-banner__cta:active {
  transform: scale(0.98);
}
.home-pwa-recommend-banner__dismiss {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: rgb(100 116 139);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.home-pwa-recommend-banner__dismiss:hover {
  background: #fff;
  color: rgb(51 65 85);
}

@media (min-width: 769px) {
  .home-pwa-recommend-banner {
    display: none !important;
  }
}

.install-modal-manual {
  text-align: left;
  margin-bottom: 1.25rem;
}
.install-modal-manual.hidden {
  display: none;
}
.install-modal-manual-steps {
  margin: 0 0 0.75rem;
  padding-left: 1.15rem;
  font-size: 0.875rem;
  color: #334155;
  line-height: 1.55;
}
.install-modal-manual-steps li {
  margin-bottom: 0.45rem;
}
.install-modal-manual-steps li:last-child {
  margin-bottom: 0;
}
.install-modal-manual-icon {
  font-size: 0.95em;
}
.install-modal-manual-note {
  margin: 0;
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.45;
}

/* ===== アプリ共通メッセージモーダル ===== */
.app-message-modal {
  position: relative;
}
.app-message-modal__head {
  position: relative;
  background: linear-gradient(to right, rgb(239 246 255), rgba(255, 255, 255, 0.9));
  border-color: rgb(226 232 240);
}
.app-message-modal__head--info {
  background: linear-gradient(to right, rgb(239 246 255), rgba(255, 255, 255, 0.95));
}
.app-message-modal__head--success {
  background: linear-gradient(to right, rgb(236 253 245), rgba(255, 255, 255, 0.95));
  border-color: rgb(167 243 208);
}
.app-message-modal__head--warning {
  background: linear-gradient(to right, rgb(255 251 235), rgba(255, 255, 255, 0.95));
  border-color: rgb(253 230 138);
}
.app-message-modal__head--error {
  background: linear-gradient(to right, rgb(255 241 242), rgba(255, 255, 255, 0.95));
  border-color: rgb(254 202 202);
}
.app-message-modal__close {
  position: absolute;
}
#appChoiceModalActions .app-choice-btn {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 700;
  text-align: left;
  border: 1px solid rgb(226 232 240);
  background: #fff;
  color: rgb(30 41 59);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
#appChoiceModalActions .app-choice-btn:hover {
  border-color: rgb(99 102 241);
  background: rgb(238 242 255);
}
#appChoiceModalActions .app-choice-btn--primary {
  border-color: rgb(99 102 241);
  background: linear-gradient(90deg, #4f46e5, #6366f1);
  color: #fff;
  text-align: center;
}
#appChoiceModalActions .app-choice-btn--primary:hover {
  filter: brightness(1.05);
}

/* ===== PWAインストールモーダル ===== */
.install-modal-container {
  max-width: 420px;
  width: 100%;
  margin: 1rem;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.install-modal-content {
  padding: 2rem;
  text-align: center;
}

.install-modal-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: iconBounce 0.6s ease-out;
}

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

.install-modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.75rem;
}

.install-modal-description {
  font-size: 0.95rem;
  color: #6b7280;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.install-modal-features {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border-radius: 12px;
}

.install-feature-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.feature-icon {
  font-size: 1.5rem;
}

.feature-text {
  font-size: 0.85rem;
  color: #475569;
  font-weight: 500;
}

.install-modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.install-btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
}

.install-btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.install-btn-primary:active {
  transform: translateY(0);
}

.install-btn-secondary {
  background: white;
  color: #6b7280;
  border: 2px solid #e5e7eb;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 44px;
}

.install-btn-secondary:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  color: #374151;
}

.install-btn-icon {
  font-size: 1.2rem;
}

/* ===== PWAインストール完了モーダル ===== */
.install-complete-modal-container {
  max-width: 400px;
  width: 100%;
  margin: 1rem;
  animation: modalSlideIn 0.3s ease-out;
}

.install-complete-modal-content {
  padding: 2.5rem 2rem;
  text-align: center;
}

.install-complete-icon {
  font-size: 5rem;
  margin-bottom: 1rem;
  animation: iconBounce 0.6s ease-out 0.2s both;
}

.install-complete-modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.75rem;
}

.install-complete-modal-description {
  font-size: 0.95rem;
  color: #6b7280;
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* モバイル対応 */
@media (max-width: 640px) {
  .install-modal-container,
  .install-complete-modal-container {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }
  
  .install-modal-content,
  .install-complete-modal-content {
    padding: 1.5rem 1.25rem;
  }
  
  .install-modal-icon,
  .install-complete-icon {
    font-size: 3rem;
  }
  
  .install-modal-title,
  .install-complete-modal-title {
    font-size: 1.25rem;
  }
  
  .install-modal-features {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  
  .install-feature-item {
    flex-direction: row;
    justify-content: center;
  }
}

/* レスポンシブ対応 */
@media (max-width: 640px) {
  .modal-container { margin: 0.5rem; }
  .modal-pack-grid { grid-template-columns: 1fr; }
  .modal-pack-subjects { grid-template-columns: 1fr; }
}

/* ===== 購入フロー関連モーダル ===== */

.purchase-flow-overlay:not(.hidden) {
  align-items: center;
  justify-content: center;
}

.purchase-flow-animate {
  animation: purchaseFlowModalIn 0.22s ease-out;
  transform-origin: center center;
}

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

.purchase-flow-shell.modal-container {
  max-width: 56rem;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.2);
}

/* 購入確認モーダル */
.purchase-confirm-modal {
  max-width: 32rem;
}
.purchase-confirm-modal.modal-container {
  max-width: 32rem;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.2);
}

.purchase-confirm-content {
  text-align: center;
}

.purchase-item-info {
  display: flex; align-items: center; gap: 1rem;
  background: #f8fafc; padding: 1rem; border-radius: 12px;
  margin-bottom: 1.5rem;
}

.purchase-item-icon {
  font-size: 2.5rem; flex-shrink: 0;
}

.purchase-item-details {
  text-align: left; flex: 1;
}

.purchase-item-title {
  font-size: 1.2rem; font-weight: 700; color: #1f2937; margin: 0 0 0.5rem 0;
}

.purchase-item-description {
  color: #6b7280; font-size: 0.9rem; margin: 0 0 0.75rem 0;
}

.purchase-price {
  display: flex; align-items: baseline; gap: 0.25rem;
}

.price-label {
  color: #374151; font-size: 0.9rem;
}

.price-amount {
  font-size: 1.25rem; font-weight: 700; color: #dc2626;
}

.price-note {
  color: #6b7280; font-size: 0.8rem;
}

.purchase-confirm-message p {
  font-size: 1.1rem; color: #374151; margin-bottom: 0.5rem;
}

.purchase-confirm-message small {
  color: #9ca3af; font-size: 0.8rem;
}

/* 購入処理中モーダル */
.purchase-processing-modal {
  max-width: 400px;
}

.processing-content {
  text-align: center; padding: 2rem 1rem;
}

.processing-spinner {
  width: 52px; height: 52px;
  border: 3px solid #e0e7ff; border-top-color: #4f46e5;
  border-radius: 50%; animation: spin 0.85s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.processing-title {
  font-size: 1.2rem; font-weight: 600; color: #374151; margin: 0 0 0.5rem 0;
}

.processing-message {
  color: #6b7280; margin: 0;
}

/* 購入完了モーダル */
.purchase-complete-modal {
  max-width: 32rem;
}
.purchase-complete-modal.modal-container {
  max-width: 32rem;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.2);
}

.purchase-processing-modal.modal-container {
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.2);
}

.purchase-complete-content {
  text-align: center;
}

.success-icon {
  font-size: 1.5rem; margin-bottom: 0;
  animation: bounceIn 0.5s ease-out;
}

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

.completed-item-title {
  font-size: 1.3rem; font-weight: 700; color: #1f2937; margin: 0 0 1rem 0;
}

.completion-message {
  font-size: 1.1rem; color: #374151; margin-bottom: 1.5rem; line-height: 1.5;
}

.purchase-benefits {
  background: #f0fdf4; border: 1px solid #86efac; border-radius: 12px;
  padding: 1rem; text-align: left; margin-bottom: 1rem;
}

.purchase-benefits h4 {
  font-size: 1rem; font-weight: 600; color: #166534; margin: 0 0 0.75rem 0;
}

.purchase-benefits ul {
  margin: 0; padding-left: 1.25rem; color: #166534;
}

.purchase-benefits li {
  margin-bottom: 0.5rem; line-height: 1.4;
}

/* モーダルフッターの調整 */
.purchase-confirm-modal .modal-footer,
.purchase-complete-modal .modal-footer {
  display: flex; gap: 0.75rem; justify-content: center;
}

.purchase-confirm-modal .modal-footer button,
.purchase-complete-modal .modal-footer button {
  min-width: 120px;
}

/* チェックポイント関連スタイル */
.lesson-checkpoint-badge {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 0.5rem;
  animation: checkpointPulse 2s infinite;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

@keyframes checkpointPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.05);
  }
}

.lesson-checkpoint-info {
  color: #8b5cf6;
  font-size: 0.85rem;
  font-weight: 600;
  margin-right: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.lesson-checkpoint-info::before {
  content: '📌';
  font-size: 0.9rem;
}

.lesson-list-item.has-checkpoint {
  border-left: 3px solid #8b5cf6;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.05), transparent);
  position: relative;
}

.lesson-list-item.has-checkpoint::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #8b5cf6, #7c3aed);
  animation: checkpointGlow 2s infinite;
}

@keyframes checkpointGlow {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.6);
  }
}

/* レスポンシブ対応 */
@media (max-width: 640px) {
  .purchase-item-info {
    flex-direction: column; text-align: center;
  }
  
  .purchase-item-details {
    text-align: center;
  }
  
  .purchase-benefits {
    text-align: left;
  }
  
  .modal-footer {
    flex-direction: column;
  }
  
  .modal-footer button {
    width: 100%;
  }
}

/* ===== Firebase認証ボックス（モダン版） ===== */
.auth-container {
  background: white; border-radius: 16px; padding: 2rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.06); margin-bottom: 1.5rem;
  border: 1px solid #f1f5f9; max-width: 420px; margin-left: auto; margin-right: auto;
  backdrop-filter: blur(10px); position: relative; overflow: hidden;
}

.auth-container::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #06b6d4);
}

.auth-header {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-bottom: 2rem;
  padding-right: 2.5rem;
  padding-left: 2.5rem;
}

/* ログインモーダル：閉じる×を常に最前面＆十分なタップ領域（親の ::before / overlay 干渉を避ける） */
#closeAuthBox.auth-close-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 20;
  pointer-events: auto;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #64748b;
  border-radius: 8px;
}

#closeAuthBox.auth-close-btn:hover {
  color: #1e293b;
  background: rgba(0, 0, 0, 0.06);
}

@media (min-width: 768px) {
  #authBox.auth-container--modal-desktop {
    max-width: 560px !important;
    width: min(96vw, 560px);
    padding: 2rem 2.5rem;
  }
}

.auth-title {
  font-size: 1.5rem; font-weight: 700; color: #1e293b; margin-bottom: 0.5rem;
}

.auth-subtitle {
  color: #64748b; font-size: 0.875rem; margin: 0;
}

.auth-form {
  margin-bottom: 1.5rem;
}

.input-group {
  margin-bottom: 1.25rem;
}

.input-label {
  display: block; font-size: 0.875rem; font-weight: 500; color: #374151;
  margin-bottom: 0.5rem;
}

.auth-input {
  width: 100%; padding: 0.875rem 1rem; border: 2px solid #e2e8f0;
  border-radius: 12px; font-size: 0.9rem; transition: all 0.2s;
  background: #fafafa; box-sizing: border-box;
}

.auth-input:focus {
  outline: none; border-color: #3b82f6; background: white;
  box-shadow: 0 0 0 4px rgba(59,130,246,0.1);
  transform: translateY(-1px);
}

.auth-input:invalid:not(:placeholder-shown) {
  border-color: #ef4444; background: #fef2f2;
}

.password-input-wrapper {
  position: relative;
}

.password-toggle {
  position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 0.25rem;
  border-radius: 6px; transition: background-color 0.2s; font-size: 1rem;
}

.password-toggle:hover {
  background: #f1f5f9;
}

.input-error {
  color: #dc2626; /* より濃い赤でコントラスト比を改善 */
  font-size: 0.75rem; 
  margin-top: 0.25rem;
  display: flex; 
  align-items: center; 
  gap: 0.25rem;
  font-weight: 500; /* 読みやすさを向上 */
}

.input-error::before {
  content: "⚠️"; font-size: 0.875rem;
}

.auth-btn {
  width: 100%; padding: 0.875rem 1rem; border-radius: 12px; font-size: 0.9rem;
  font-weight: 600; border: none; cursor: pointer; transition: all 0.2s;
  margin-bottom: 0.75rem; position: relative; overflow: hidden;
}

.btn-content {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
}

.btn-spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.auth-btn:disabled {
  opacity: 0.6; cursor: not-allowed;
}

.auth-btn-primary {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: white;
}
.auth-btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  transform: translateY(-2px); box-shadow: 0 8px 25px rgba(59,130,246,0.3);
}

.auth-btn-google {
  background: linear-gradient(135deg, #db4437, #c23321); color: white;
}
.auth-btn-google:hover:not(:disabled) {
  background: linear-gradient(135deg, #c23321, #a52714);
  transform: translateY(-2px); box-shadow: 0 8px 25px rgba(219,68,55,0.3);
}

.google-icon {
  font-size: 1.1rem;
}

.auth-btn-secondary {
  background: linear-gradient(135deg, #6b7280, #4b5563); color: white;
}
.auth-btn-secondary:hover:not(:disabled) {
  background: linear-gradient(135deg, #4b5563, #374151);
  transform: translateY(-2px); box-shadow: 0 8px 25px rgba(107,114,128,0.3);
}

.auth-divider {
  text-align: center; margin: 1.5rem 0; position: relative;
}

.auth-divider::before {
  content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 1px;
  background: #e2e8f0;
}

.auth-divider span {
  background: white; padding: 0 1rem; color: #64748b; font-size: 0.875rem;
  position: relative;
}

.auth-toggle {
  text-align: center; margin: 1.5rem 0;
}

.auth-toggle p {
  color: #64748b; font-size: 0.875rem; margin-bottom: 0.5rem;
}

.auth-links {
  text-align: center; margin: 1rem 0;
}

.link-btn {
  background: none; border: none; color: #3b82f6; cursor: pointer;
  font-size: 0.875rem; text-decoration: underline; transition: color 0.2s;
}

.link-btn:hover {
  color: #1d4ed8;
}

.auth-status {
  text-align: center; color: #374151; font-size: 0.9rem;
  margin-top: 1rem; padding: 0.75rem; border-radius: 12px;
  background: #f8fafc; border: 1px solid #e2e8f0;
}

.hidden {
  display: none !important;
}

/* ===== メール確認画面 ===== */
.verification-header {
  text-align: center; margin-bottom: 2rem;
}

.verification-icon {
  font-size: 3rem; margin-bottom: 1rem;
}

.verification-title {
  font-size: 1.5rem; font-weight: 700; color: #1e293b; margin-bottom: 0.5rem;
}

.verification-subtitle {
  color: #64748b; font-size: 0.9rem; margin: 0;
}

.verification-content {
  margin-bottom: 2rem;
}

.verification-step {
  display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem;
}

.step-number {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: white;
  width: 2rem; height: 2rem; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-weight: 700;
  font-size: 0.875rem; flex-shrink: 0;
}

.step-content p {
  margin: 0; color: #374151; line-height: 1.5;
}

.verification-status {
  background: #f8fafc; padding: 1.5rem; border-radius: 12px;
  border: 1px solid #e2e8f0; margin-bottom: 2rem;
}

.verification-progress {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem;
}

.progress-dot {
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  background: #e2e8f0; display: flex; align-items: center;
  justify-content: center; font-size: 1.2rem; color: #64748b;
}

.progress-dot.active {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: white;
}

.progress-dot.completed {
  background: linear-gradient(135deg, #10b981, #059669); color: white;
}

.progress-line {
  height: 2px; width: 3rem; background: #e2e8f0; margin: 0 0.5rem;
}

.progress-line.completed {
  background: linear-gradient(90deg, #10b981, #059669);
}

.verification-status-text {
  text-align: center; margin: 0; color: #374151; font-size: 0.9rem;
}

.verification-actions {
  display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 2rem;
}

.verification-help {
  margin-top: 2rem;
}

.help-section {
  border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden;
}

.help-section summary {
  background: #f8fafc; padding: 1rem; cursor: pointer;
  font-weight: 600; color: #374151; list-style: none;
}

.help-section summary::-webkit-details-marker {
  display: none;
}

.help-content {
  padding: 1rem; background: white;
}

.help-content ul {
  margin: 0; padding-left: 1.5rem; color: #64748b;
}

.help-content li {
  margin-bottom: 0.5rem; line-height: 1.5;
}

/* レスポンシブ対応 */
@media (max-width: 640px) {
  .verification-step {
    gap: 0.75rem;
  }
  
  .step-number {
    width: 1.75rem; height: 1.75rem; font-size: 0.8rem;
  }
  
  .progress-dot {
    width: 2rem; height: 2rem; font-size: 1rem;
  }
  
  .progress-line {
    width: 2rem;
  }
}

/* レスポンシブ対応 */
@media (max-width: 640px) {
  .auth-container {
    margin: 0 0 1.5rem 0; padding: 1rem;
  }
  
  .auth-btn {
    width: 100%; margin-right: 0;
  }
  
  /* メインタブのモバイル最適化（はみ出し防止） */
  .main-tabs {
    gap: 0.375rem;
    padding: 0.25rem 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  
  .main-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    min-width: 0;
    flex: 1 1 0;
    max-width: 50%;
  }
  
  /* サブタブのモバイル最適化 */
  .subject-tabs {
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    justify-content: center;
  }
  
  .subject-tab {
    padding: 0.4375rem 0.875rem;
    font-size: 0.75rem;
  }

  /* おすすめ学習のルートマップを画面内に収める */
  #homeView #lessonList {
    max-width: 100%;
  }
  .route-map-section {
    max-width: 100%;
  }
  .route-map-track {
    max-width: 100%;
  }
}

/* 375px幅での最適化 */
@media (max-width: 375px) {
  .main-tabs {
    gap: 0.25rem;
    padding: 0.25rem 0.375rem;
  }
  
  .main-tab {
    padding: 0.4375rem 0.875rem;
    font-size: 0.8rem;
    min-width: 90px;
  }
  
  .subject-tabs {
    gap: 0.25rem;
    padding: 0.25rem 0.375rem;
    justify-content: center;
  }
  
  .subject-tab {
    padding: 0.375rem 0.75rem;
    font-size: 0.7rem;
  }
}

/* ===== 375px幅専用最適化（iPhone SE等の小さいスマホ向け） ===== */
@media (max-width: 375px) {
  /* ヘッダー最適化 */
  header {
    padding: 0 0.5rem;
  }
  
  header .max-w-7xl {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  
  header h-16 {
    height: 3.5rem;
  }
  
  /* ロゴサイズ調整 */
  header a .h-8 {
    height: 1.75rem;
    width: 1.75rem;
    font-size: 0.875rem;
  }
  
  header .text-xl {
    font-size: 1rem;
  }
  
  /* ヘッダーボタンサイズ調整 */
  header nav button {
    padding: 0.5rem 0.625rem;
    font-size: 0.75rem;
    min-height: 36px;
    min-width: 36px;
  }
  
  header nav .text-sm {
    font-size: 0.75rem;
  }
  
  /* メインコンテナのパディング調整 */
  #app {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  
  /* カード形式のレッスン最適化 */
  .card {
    padding: 0.875rem;
  }
  
  .card h3 {
    font-size: 0.9375rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
  }
  
  .card .text-sm {
    font-size: 0.8125rem;
  }
  
  .card .text-xs {
    font-size: 0.75rem;
  }
  
  /* カード内のボタン */
  .card .inline-block,
  .card button {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    min-height: 36px;
  }
  
  /* タブ最適化（375px向けの詳細調整は下記の専用メディアクエリで定義） */
  
  /* カード最適化 */
  .card {
    padding: 0.875rem;
    border-radius: 0.75rem;
  }
  
  /* レッスンカードのタイトル */
  .card h3,
  .card .text-lg {
    font-size: 0.9375rem;
  }
  
  .card .text-sm {
    font-size: 0.8125rem;
  }
  
  /* バッジサイズ調整 */
  .badge {
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
  }
  
  /* 認証フォーム最適化 */
  .auth-container {
    padding: 1.25rem 0.875rem;
    margin: 0.5rem 0.5rem 1rem;
  }
  
  .auth-title {
    font-size: 1.25rem;
  }
  
  .auth-subtitle {
    font-size: 0.8125rem;
  }
  
  .auth-input {
    padding: 0.75rem 0.875rem;
    font-size: 0.875rem;
  }
  
  .auth-btn {
    padding: 0.75rem 0.875rem;
    font-size: 0.875rem;
  }
  
  /* モーダル最適化 */
  .modal-container {
    margin: 0.5rem;
    max-height: 95vh;
  }
  
  .modal-header {
    padding: 1rem;
  }
  
  .modal-title {
    font-size: 1.125rem;
  }
  
  .modal-body {
    padding: 1rem;
    max-height: 70vh;
  }
  
  .modal-footer {
    padding: 0.75rem 1rem;
  }
  
  /* メニューパネル最適化 */
  #menuPanel .fixed {
    width: 85vw;
    max-width: 320px;
  }
  
  .menu-item {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }
  
  /* レッスンビュー最適化 */
  #lessonView .flex {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  
  #lessonView h2 {
    font-size: 1.25rem;
  }
  
  #lessonView button,
  #lessonView a {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }
  
  /* グリッドレイアウト調整 */
  .grid {
    gap: 0.75rem;
  }
  
  /* ヒーロー画像エリア */
  .h-32 {
    height: 6rem;
  }
  
  .h-40 {
    height: 8rem;
  }
  
  /* フッター */
  footer {
    padding: 0.75rem 0.5rem;
  }
  
  footer .text-sm {
    font-size: 0.75rem;
  }
  
  /* ボタン全般の最適化 */
  .btn,
  button:not(.auth-btn):not(.menu-item):not(.modal-close-btn) {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    min-height: 44px;
  }
  
  /* テキストサイズ調整 */
  .text-2xl {
    font-size: 1.25rem;
  }
  
  .text-xl {
    font-size: 1.125rem;
  }
  
  .text-lg {
    font-size: 1rem;
  }
  
  /* レッスンリストアイテム */
  .lesson-list-item {
    padding: 0.5rem 0.75rem;
  }
  
  .lesson-list-item .lesson-title {
    font-size: 0.875rem;
  }
  
  .lesson-list-item .lesson-action-btn {
    padding: 0.5rem 0.875rem;
    font-size: 0.75rem;
    min-height: 36px;
  }
  
  /* 進捗バー */
  .progress-bar {
    height: 4px;
  }
  
  /* 購入モーダルのパックグリッド */
  .modal-pack-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .modal-pack-card {
    padding: 0.875rem;
  }
  
  /* 統計モーダル */
  #statsModal .modal-container,
  #streakModal .modal-container,
  #accountModal .modal-container {
    margin: 0.5rem;
    max-height: 95vh;
  }
  
  /* テーマモーダル */
  #themeModal .modal-container {
    margin: 0.5rem;
  }
  
  #themeList {
    grid-template-columns: 2;
    gap: 0.75rem;
  }
  
  /* 開発用ボタン（右下固定） */
  #devPurchaseSection {
    bottom: 10px;
    right: 10px;
    padding: 10px;
    font-size: 0.75rem;
  }
  
  #devPurchaseSection button {
    padding: 8px 12px;
    font-size: 0.75rem;
  }
  
  /* タッチターゲットの最小サイズ確保 */
  button, a, [role="button"], .card {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* 入力フィールドの最適化 */
  input, textarea, select {
    font-size: 16px; /* iOSでズームを防ぐ */
  }
  
  /* スクロール最適化 */
  * {
    -webkit-overflow-scrolling: touch;
  }
  
  /* テキスト選択の最適化 */
  .card, .lesson-list-item {
    user-select: none;
    -webkit-user-select: none;
  }
  
  /* ヒーロー画像内のテキスト */
  #subjectMessage {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
  }
}

/* ===== 購入ボタン無効化スタイル ===== */
.btn-primary.disabled,
.btn-primary:disabled {
  background: #9ca3af !important; 
  color: #6b7280 !important;
  cursor: not-allowed !important; 
  transform: none !important;
  box-shadow: none !important; 
  opacity: 0.7;
  border: 1px solid #d1d5db;
}

.btn-primary.disabled:hover,
.btn-primary:disabled:hover {
  background: #9ca3af !important;
  transform: none !important;
  box-shadow: none !important;
}

.btn-secondary.disabled,
.btn-secondary:disabled {
  background: #d1d5db !important; 
  color: #9ca3af !important;
  cursor: not-allowed !important; 
  transform: none !important;
  box-shadow: none !important; 
  opacity: 0.7;
  border: 1px solid #e5e7eb;
}

.btn-secondary.disabled:hover,
.btn-secondary:disabled:hover {
  background: #d1d5db !important;
  transform: none !important;
  box-shadow: none !important;
}

/* ヘッダー購入ボタンの無効化スタイル */
button[disabled].cursor-not-allowed {
  pointer-events: none;
}

/* パックカード内の無効化ボタン */
.pack-actions .btn-primary.disabled,
.pack-actions .btn-primary:disabled {
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
}

.modal-pack-actions .btn-primary.disabled,
.modal-pack-actions .btn-primary:disabled {
  font-size: 0.875rem;
}

/* ===== レッスン画面の全幅表示 ===== */
#lessonView .lesson-area {
  margin-left: calc(-1 * (1rem + 1.5rem));
  margin-right: calc(-1 * (1rem + 1.5rem));
  width: calc(100% + 2 * (1rem + 1.5rem));
}

@media (min-width: 640px) {
  #lessonView .lesson-area {
    margin-left: calc(-1 * (1.5rem + 2rem));
    margin-right: calc(-1 * (1.5rem + 2rem));
    width: calc(100% + 2 * (1.5rem + 2rem));
  }
}

@media (min-width: 1024px) {
  #lessonView .lesson-area {
    margin-left: calc(-1 * (1.5rem + 2.5rem));
    margin-right: calc(-1 * (1.5rem + 2.5rem));
    width: calc(100% + 2 * (1.5rem + 2.5rem));
  }
}
.reco-item{border:1px dashed rgb(203 213 225);border-radius:.875rem;background:#fff;padding:1rem}
.reco-item.highlight{border-style:solid;border-color:#4f46e5}

/* motion配慮 */
@media (prefers-reduced-motion: reduce){
  .card,.tab,.subtab{transition:none !important;transform:none !important;box-shadow:none !important}
}

/* トーストメッセージアニメーション */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

 / *   P a c k   p r i c e   d i s p l a y   * / 
 . p a c k - p r i c e   {   
     f o n t - s i z e :   1 . 2 5 r e m ;   
     f o n t - w e i g h t :   7 0 0 ;   
     c o l o r :   # 0 5 9 6 6 9 ;   
     m a r g i n :   0 . 5 r e m   0 ;   
 } 
 
 
/* ===== ���K���b�X���V�X�e�� ===== */

/* ���K���b�X���ꗗ�\�� */
.review-lesson-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.review-lesson-header {
  background: linear-gradient(135deg, #f0f9ff, #dbeafe);
  border: 1px solid #3b82f6;
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.review-lesson-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.review-icon {
  font-size: 2rem;
}

.review-lesson-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.review-badge {
  background: #3b82f6;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 600;
}

.review-count {
  background: #f59e0b;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 600;
}

.review-date {
  color: #6b7280;
  font-size: 0.875rem;
}

.review-lesson-description {
  color: #4b5563;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.review-lesson-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* ���K����� */
.review-question-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.review-question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 12px;
}

.review-progress {
  flex: 1;
  max-width: 300px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.875rem;
  color: #6b7280;
  text-align: center;
}

.review-stats {
  display: flex;
  gap: 1rem;
}

.correct-count {
  color: #059669;
  font-weight: 600;
  font-size: 0.875rem;
}

.wrong-count {
  color: #dc2626;
  font-weight: 600;
  font-size: 0.875rem;
}

.question-content {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.question-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.choices-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.choice-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.choice-btn:hover:not(:disabled) {
  border-color: #3b82f6;
  background: #f0f9ff;
}

.choice-btn:disabled {
  cursor: not-allowed;
}

.choice-label {
  background: #f3f4f6;
  color: #374151;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

.choice-text {
  flex: 1;
  color: #374151;
  line-height: 1.5;
}

/* �񓚌��ʕ\�� */
.answer-result {
  margin-top: 2rem;
  padding: 1.5rem;
  border-radius: 12px;
  text-align: center;
}

.answer-result.correct {
  background: #ecfdf5;
  border: 1px solid #10b981;
}

.answer-result.incorrect {
  background: #fef2f2;
  border: 1px solid #ef4444;
}

.result-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.result-text {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.answer-result.correct .result-text {
  color: #059669;
}

.answer-result.incorrect .result-text {
  color: #dc2626;
}

.correct-answer {
  color: #374151;
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.next-question-btn {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.next-question-btn:hover {
  background: #2563eb;
}

/* ���K������� */
.review-complete-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem 1rem;
  text-align: center;
}

.complete-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.complete-title {
  font-size: 2rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 2rem;
}

.review-results {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.score-display {
  margin-bottom: 2rem;
}

.score-number {
  font-size: 3rem;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 0.5rem;
}

.score-label {
  color: #6b7280;
  font-size: 1rem;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.result-item {
  text-align: center;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 8px;
}

.result-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.25rem;
}

.result-label {
  color: #6b7280;
  font-size: 0.875rem;
}

.perfect-score-message {
  background: #ecfdf5;
  border: 1px solid #10b981;
  border-radius: 8px;
  padding: 1.5rem;
  color: #059669;
}

.retry-message {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 1.5rem;
  color: #92400e;
}

.review-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
/* ���K���b�X���V�X�e�� */
.review-lesson-container { max-width: 800px; margin: 0 auto; padding: 2rem 1rem; }
.review-lesson-header { background: linear-gradient(135deg, #f0f9ff, #dbeafe); border: 1px solid #3b82f6; border-radius: 16px; padding: 2rem; margin-bottom: 2rem; }
.review-lesson-title { font-size: 1.75rem; font-weight: 700; color: #1e40af; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.review-icon { font-size: 2rem; }
.review-lesson-meta { display: flex; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.review-badge { background: #3b82f6; color: white; padding: 0.25rem 0.75rem; border-radius: 12px; font-size: 0.875rem; font-weight: 600; }
.review-count { background: #f59e0b; color: white; padding: 0.25rem 0.75rem; border-radius: 12px; font-size: 0.875rem; font-weight: 600; }
.review-date { color: #6b7280; font-size: 0.875rem; }
.review-lesson-description { color: #4b5563; margin-bottom: 1.5rem; line-height: 1.6; }
.review-lesson-actions { display: flex; gap: 1rem; justify-content: flex-end; }
.review-questions-preview { background: white; border: 1px solid #e5e7eb; border-radius: 12px; padding: 1.5rem; }
.preview-title { font-size: 1.25rem; font-weight: 600; color: #374151; margin-bottom: 1rem; }
.questions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.question-preview-card { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 1rem; }
.question-number { font-weight: 600; color: #3b82f6; font-size: 0.875rem; margin-bottom: 0.5rem; }
.review-question-container { max-width: 800px; margin: 0 auto; padding: 2rem 1rem; }
.review-question-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; padding: 1rem; background: #f8fafc; border-radius: 12px; }
.review-progress { flex: 1; max-width: 300px; }
.progress-bar { width: 100%; height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin-bottom: 0.5rem; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #3b82f6, #1d4ed8); border-radius: 4px; transition: width 0.3s ease; }
.progress-text { font-size: 0.875rem; color: #6b7280; text-align: center; }
.review-stats { display: flex; gap: 1rem; }
.correct-count { color: #059669; font-weight: 600; font-size: 0.875rem; }
.wrong-count { color: #dc2626; font-weight: 600; font-size: 0.875rem; }
.choice-btn { display: flex; align-items: center; gap: 1rem; padding: 1rem; background: white; border: 2px solid #e5e7eb; border-radius: 12px; text-align: left; cursor: pointer; transition: all 0.2s ease; width: 100%; }
.choice-btn:hover:not(:disabled) { border-color: #3b82f6; background: #f0f9ff; }
.choice-btn:disabled { cursor: not-allowed; }
.choice-label { background: #f3f4f6; color: #374151; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0; }
.choice-text { flex: 1; color: #374151; line-height: 1.5; }
.answer-result { margin-top: 2rem; padding: 1.5rem; border-radius: 12px; text-align: center; }
.answer-result.correct { background: #ecfdf5; border: 1px solid #10b981; }
.answer-result.incorrect { background: #fef2f2; border: 1px solid #ef4444; }
.result-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.result-text { font-size: 1.25rem; font-weight: 600; margin-bottom: 1rem; }
.answer-result.correct .result-text { color: #059669; }
.answer-result.incorrect .result-text { color: #dc2626; }
.correct-answer { color: #374151; margin-bottom: 1.5rem; font-weight: 500; }
.next-question-btn { background: #3b82f6; color: white; border: none; padding: 0.75rem 2rem; border-radius: 8px; font-weight: 600; cursor: pointer; transition: background 0.2s ease; }
.next-question-btn:hover { background: #2563eb; }
.review-complete-container { max-width: 600px; margin: 0 auto; padding: 2rem 1rem; text-align: center; }
.complete-icon { font-size: 4rem; margin-bottom: 1rem; }
.complete-title { font-size: 2rem; font-weight: 700; color: #1f2937; margin-bottom: 2rem; }
.review-results { background: white; border: 1px solid #e5e7eb; border-radius: 16px; padding: 2rem; margin-bottom: 2rem; }
.score-display { margin-bottom: 2rem; }
.score-number { font-size: 3rem; font-weight: 700; color: #3b82f6; margin-bottom: 0.5rem; }
.score-label { color: #6b7280; font-size: 1rem; }
.results-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.result-item { text-align: center; padding: 1rem; background: #f8fafc; border-radius: 8px; }
.result-value { font-size: 1.5rem; font-weight: 700; color: #1f2937; margin-bottom: 0.25rem; }
.result-label { color: #6b7280; font-size: 0.875rem; }
.perfect-score-message { background: #ecfdf5; border: 1px solid #10b981; border-radius: 8px; padding: 1.5rem; color: #059669; }
.retry-message { background: #fef3c7; border: 1px solid #f59e0b; border-radius: 8px; padding: 1.5rem; color: #92400e; }
.review-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
/* 復習レチE��ンシスチE�� */
.review-lesson-container { max-width: 800px; margin: 0 auto; padding: 2rem 1rem; }
.review-lesson-header { background: linear-gradient(135deg, #f0f9ff, #dbeafe); border: 1px solid #3b82f6; border-radius: 16px; padding: 2rem; margin-bottom: 2rem; }
.review-lesson-title { font-size: 1.75rem; font-weight: 700; color: #1e40af; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.review-icon { font-size: 2rem; }
.review-lesson-meta { display: flex; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.review-badge { background: #3b82f6; color: white; padding: 0.25rem 0.75rem; border-radius: 12px; font-size: 0.875rem; font-weight: 600; }
.review-count { background: #f59e0b; color: white; padding: 0.25rem 0.75rem; border-radius: 12px; font-size: 0.875rem; font-weight: 600; }
.review-date { color: #6b7280; font-size: 0.875rem; }
.review-lesson-description { color: #4b5563; margin-bottom: 1.5rem; line-height: 1.6; }
.review-lesson-actions { display: flex; gap: 1rem; justify-content: flex-end; }
.review-questions-preview { background: white; border: 1px solid #e5e7eb; border-radius: 12px; padding: 1.5rem; }
.preview-title { font-size: 1.25rem; font-weight: 600; color: #374151; margin-bottom: 1rem; }
.questions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.question-preview-card { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 1rem; }
.question-number { font-weight: 600; color: #3b82f6; font-size: 0.875rem; margin-bottom: 0.5rem; }
.review-question-container { max-width: 800px; margin: 0 auto; padding: 2rem 1rem; }
.review-question-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; padding: 1rem; background: #f8fafc; border-radius: 12px; }
.review-progress { flex: 1; max-width: 300px; }
.progress-bar { width: 100%; height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin-bottom: 0.5rem; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #3b82f6, #1d4ed8); border-radius: 4px; transition: width 0.3s ease; }
.progress-text { font-size: 0.875rem; color: #6b7280; text-align: center; }
.review-stats { display: flex; gap: 1rem; }
.correct-count { color: #059669; font-weight: 600; font-size: 0.875rem; }
.wrong-count { color: #dc2626; font-weight: 600; font-size: 0.875rem; }
.choice-btn { display: flex; align-items: center; gap: 1rem; padding: 1rem; background: white; border: 2px solid #e5e7eb; border-radius: 12px; text-align: left; cursor: pointer; transition: all 0.2s ease; width: 100%; }
.choice-btn:hover:not(:disabled) { border-color: #3b82f6; background: #f0f9ff; }
.choice-btn:disabled { cursor: not-allowed; }
.choice-label { background: #f3f4f6; color: #374151; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0; }
.choice-text { flex: 1; color: #374151; line-height: 1.5; }
.answer-result { margin-top: 2rem; padding: 1.5rem; border-radius: 12px; text-align: center; }
.answer-result.correct { background: #ecfdf5; border: 1px solid #10b981; }
.answer-result.incorrect { background: #fef2f2; border: 1px solid #ef4444; }
.result-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.result-text { font-size: 1.25rem; font-weight: 600; margin-bottom: 1rem; }
.answer-result.correct .result-text { color: #059669; }
.answer-result.incorrect .result-text { color: #dc2626; }
.correct-answer { color: #374151; margin-bottom: 1.5rem; font-weight: 500; }
.next-question-btn { background: #3b82f6; color: white; border: none; padding: 0.75rem 2rem; border-radius: 8px; font-weight: 600; cursor: pointer; transition: background 0.2s ease; }
.next-question-btn:hover { background: #2563eb; }
.review-complete-container { max-width: 600px; margin: 0 auto; padding: 2rem 1rem; text-align: center; }
.complete-icon { font-size: 4rem; margin-bottom: 1rem; }
.complete-title { font-size: 2rem; font-weight: 700; color: #1f2937; margin-bottom: 2rem; }
.review-results { background: white; border: 1px solid #e5e7eb; border-radius: 16px; padding: 2rem; margin-bottom: 2rem; }
.score-display { margin-bottom: 2rem; }
.score-number { font-size: 3rem; font-weight: 700; color: #3b82f6; margin-bottom: 0.5rem; }
.score-label { color: #6b7280; font-size: 1rem; }
.results-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.result-item { text-align: center; padding: 1rem; background: #f8fafc; border-radius: 8px; }
.result-value { font-size: 1.5rem; font-weight: 700; color: #1f2937; margin-bottom: 0.25rem; }
.result-label { color: #6b7280; font-size: 0.875rem; }
.perfect-score-message { background: #ecfdf5; border: 1px solid #10b981; border-radius: 8px; padding: 1.5rem; color: #059669; }
.retry-message { background: #fef3c7; border: 1px solid #f59e0b; border-radius: 8px; padding: 1.5rem; color: #92400e; }
.review-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
/* 復習ダチE��ュボ�EチE*/
.review-dashboard { max-width: 1200px; margin: 0 auto; padding: 2rem 1rem; }
.review-dashboard-header { text-align: center; margin-bottom: 3rem; }
.dashboard-title { font-size: 2.5rem; font-weight: 700; color: #1f2937; margin-bottom: 1rem; display: flex; align-items: center; justify-content: center; gap: 1rem; }
.dashboard-icon { font-size: 3rem; }
.dashboard-subtitle { font-size: 1.125rem; color: #6b7280; max-width: 600px; margin: 0 auto; }

/* セクション共送E*/
.section-header { margin-bottom: 2rem; }
.section-title { font-size: 1.75rem; font-weight: 600; color: #374151; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.75rem; }
.section-icon { font-size: 1.5rem; }
.count-badge { background: #3b82f6; color: white; padding: 0.25rem 0.75rem; border-radius: 999px; font-size: 0.875rem; font-weight: 600; }
.section-description { color: #6b7280; font-size: 1rem; }

/* 復習レチE��ン一覧 */
.review-lessons-section { margin-bottom: 3rem; }
.review-lessons-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 1.5rem; }
.review-lesson-card { background: white; border: 1px solid #e5e7eb; border-radius: 16px; padding: 1.5rem; cursor: pointer; transition: all 0.2s ease; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.review-lesson-card:hover { border-color: #3b82f6; box-shadow: 0 4px 12px rgba(59,130,246,0.15); transform: translateY(-2px); }
.lesson-card-header { margin-bottom: 1rem; }
.lesson-card-title { font-size: 1.25rem; font-weight: 600; color: #1f2937; margin-bottom: 0.5rem; }
.lesson-card-meta { display: flex; gap: 1rem; }
.question-count { background: #f59e0b; color: white; padding: 0.25rem 0.5rem; border-radius: 6px; font-size: 0.75rem; font-weight: 600; }
.created-date { color: #6b7280; font-size: 0.875rem; }
.lesson-card-content { margin-bottom: 1.5rem; }
.lesson-card-description { color: #4b5563; margin-bottom: 0.75rem; }
.lesson-card-preview { background: #f8fafc; border-radius: 8px; padding: 0.75rem; }
.preview-text { color: #6b7280; font-size: 0.875rem; font-style: italic; }
.lesson-card-actions { display: flex; justify-content: flex-end; }
.lesson-start-btn { background: #3b82f6; color: white; border: none; padding: 0.75rem 1.5rem; border-radius: 8px; font-weight: 600; cursor: pointer; transition: background 0.2s ease; }
.lesson-start-btn:hover { background: #2563eb; }

/* 間違ぁE��題セクション */
.wrong-questions-section { margin-bottom: 3rem; }
.wrong-questions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.wrong-question-card { background: white; border: 1px solid #fbbf24; border-radius: 12px; padding: 1.25rem; }
.wrong-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.wrong-card-title { font-size: 1rem; font-weight: 600; color: #1f2937; }
.wrong-count-badge { background: #dc2626; color: white; padding: 0.25rem 0.5rem; border-radius: 6px; font-size: 0.75rem; font-weight: 600; }
.wrong-card-progress { margin-bottom: 1rem; }
.progress-label { font-size: 0.875rem; color: #6b7280; margin-bottom: 0.5rem; }
.progress-bar-wrapper { display: flex; align-items: center; gap: 0.75rem; }
.progress-bar-bg { flex: 1; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, #f59e0b, #d97706); border-radius: 3px; transition: width 0.3s ease; }
.progress-text { font-size: 0.75rem; color: #6b7280; font-weight: 600; }
.wrong-card-details { margin-bottom: 1rem; }
.detail-item { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.detail-label { font-size: 0.875rem; color: #6b7280; }
.detail-value { font-size: 0.875rem; color: #1f2937; font-weight: 600; }
.wrong-card-action { }
.generate-review-btn { background: #f59e0b; color: white; border: none; padding: 0.75rem 1rem; border-radius: 8px; font-weight: 600; cursor: pointer; transition: background 0.2s ease; width: 100%; }
.generate-review-btn:hover { background: #d97706; }

/* 空の状慁E*/
.empty-state { text-align: center; padding: 4rem 2rem; background: white; border-radius: 16px; margin-bottom: 3rem; }
.empty-icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-title { font-size: 2rem; font-weight: 700; color: #1f2937; margin-bottom: 1rem; }
.empty-description { color: #6b7280; font-size: 1.125rem; margin-bottom: 2rem; line-height: 1.6; }
.empty-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* シスチE��惁E�� */
.review-system-info { }
.info-card { background: linear-gradient(135deg, #f0f9ff, #dbeafe); border: 1px solid #3b82f6; border-radius: 16px; padding: 2rem; }
.info-title { font-size: 1.25rem; font-weight: 600; color: #1e40af; margin-bottom: 1rem; }
.info-list { color: #1e40af; margin-bottom: 1.5rem; }
.info-list li { margin-bottom: 0.5rem; }
.debug-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.debug-btn { background: #6b7280; color: white; border: none; padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.875rem; cursor: pointer; transition: background 0.2s ease; }
.debug-btn:hover { background: #4b5563; }

/* レスポンシブ対忁E*/
@media (max-width: 768px) {
  .dashboard-title { font-size: 2rem; flex-direction: column; gap: 0.5rem; }
  .dashboard-icon { font-size: 2.5rem; }
  .review-lessons-grid { grid-template-columns: 1fr; }
  .wrong-questions-grid { grid-template-columns: 1fr; }
  .empty-actions { flex-direction: column; }
  .debug-actions { flex-direction: column; }
}
/* �G���[�t�H�[���o�b�N */
.error-fallback { text-align: center; padding: 4rem 2rem; background: white; border-radius: 16px; margin: 2rem auto; max-width: 600px; border: 1px solid #f87171; }
.error-icon { font-size: 4rem; margin-bottom: 1rem; }
.error-title { font-size: 1.5rem; font-weight: 700; color: #dc2626; margin-bottom: 1rem; }
.error-description { color: #6b7280; margin-bottom: 2rem; line-height: 1.6; }
.error-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
/* ���K���b�X���ʒm�_�C�A���O */
.review-notification-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.review-notification-overlay.show {
  opacity: 1;
  visibility: visible;
}

.review-notification-dialog {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s ease;
}

.review-notification-overlay.show .review-notification-dialog {
  transform: scale(1) translateY(0);
}

.review-notification-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.review-notification-icon {
  font-size: 2rem;
}

.review-notification-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
}

.review-notification-content {
  margin-bottom: 2rem;
  line-height: 1.6;
  color: #4b5563;
}

.review-notification-content p {
  margin: 0.5rem 0;
}

.review-notification-content strong {
  color: #1f2937;
  font-weight: 600;
}

.review-notification-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.review-notification-actions .btn-secondary,
.review-notification-actions .btn-primary {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.review-notification-actions .btn-secondary {
  background: #f3f4f6;
  color: #6b7280;
}

.review-notification-actions .btn-secondary:hover {
  background: #e5e7eb;
  color: #4b5563;
}

.review-notification-actions .btn-primary {
  background: #3b82f6;
  color: white;
}

.review-notification-actions .btn-primary:hover {
  background: #2563eb;
}
/* ���K���b�X���p�o�b�W */
.badge.review {
  background: linear-gradient(135deg, #8b5cf6, #a855f7);
  color: white;
  font-weight: 600;
}

/* ���K���b�X���J�[�h */
.card.review {
  border: 2px solid #8b5cf6;
  background: linear-gradient(135deg, #faf5ff, #f3e8ff);
  position: relative;
  overflow: hidden;
}

.card.review::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #8b5cf6, #a855f7, #c084fc);
}

.card.review:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.15);
}
/* LP�v�f��������\�� */
.pack-card, .pack-grid, #packGrid, #lpGrid, .btn-primary[data-act="buy"], .btn-secondary[data-act="open"] {
  display: none !important;
}

/* �A�v���r���[�������\�� */
#homeView {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* ���ȃ^�u�������\�� */
.subject-tabs, .subject-tab {
  display: flex !important;
  visibility: visible !important;
}

/* 375px最終上書き: 教科4タブを2x2で全文字表示 */
@media (max-width: 375px) {
  .subject-tabs {
    gap: 0.12rem !important;
    padding: 0.25rem 0 !important;
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    justify-content: center !important;
  }

  .subject-tab[data-subject="recommended"] {
    flex-basis: 100% !important;
    width: 100% !important;
    margin-bottom: 0.25rem !important;
  }

  .subject-tab:not([data-subject="recommended"]) {
    flex: 1 1 calc(50% - 0.12rem) !important;
    min-width: calc(50% - 0.12rem) !important;
    max-width: calc(50% - 0.12rem) !important;
    padding: 0.42rem 0.12rem !important;
    min-height: 40px !important;
    border-width: 1.5px !important;
    white-space: normal !important;
    line-height: 1.15 !important;
    letter-spacing: -0.02em !important;
    font-size: 0.62rem !important;
    text-align: center !important;
    justify-content: center !important;
    align-items: center !important;
  }
}

 
 /* ���K���b�X���J�[�h�̃N���b�N�̈���P */
.review-lesson-card {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.review-lesson-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ログイン状態での表示切替用 */
.guest-only { 
  display: block; 
}

.auth-only { 
  display: none; 
}

.is-auth .guest-only { 
  display: none !important; 
}

.is-auth .auth-only { 
  display: block !important; 
}

/* ログインフォームの非表示 */
.is-auth #authBox,
.is-auth .login-card,
.is-auth .auth-container {
  display: none !important;
}

/* 認証済み時のメインコンテンツ表示 */
.is-auth #homeView,
.is-auth .main-content {
  display: block !important;
}

.review-lesson-card * {
  pointer-events: none;
}

.review-lesson-card [data-action] {
  pointer-events: auto;
}

/* 学習統計モーダル等：用語ルビ（data/term-ruby.json） */
.stats-dialog-ruby ruby {
  ruby-position: over;
}
.stats-dialog-ruby ruby rt {
  font-size: 0.62em;
  font-weight: normal;
  letter-spacing: 0.02em;
}

/* アクティビティLvアップお祝いオーバーレイ */
.juken-levelup-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity 0.38s ease;
  pointer-events: auto;
}

.juken-levelup-overlay--visible {
  opacity: 1;
}

.juken-levelup-overlay--leaving {
  opacity: 0;
  pointer-events: none;
}

.juken-levelup-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.juken-levelup-confetti-piece {
  position: absolute;
  top: -12%;
  font-size: 1.4rem;
  line-height: 1;
  opacity: 0;
  animation: juken-levelup-fall 2.15s ease-out forwards;
  will-change: transform, opacity;
}

@keyframes juken-levelup-fall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 0;
  }
  14% {
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--drift, 0px), 115vh, 0) rotate(680deg);
    opacity: 0;
  }
}

.juken-levelup-modal {
  position: relative;
  z-index: 2;
  max-width: 22rem;
  width: 100%;
  padding: 1.65rem 1.45rem 1.25rem;
  text-align: center;
  border-radius: 1.25rem;
  background: linear-gradient(165deg, #ffffff 0%, #fffbeb 42%, #fde68a 100%);
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.22),
    0 0 0 3px rgba(251, 191, 36, 0.45);
  transform: scale(0.82) translateY(14px);
  opacity: 0;
  animation: juken-levelup-modal-in 0.52s cubic-bezier(0.34, 1.45, 0.64, 1) forwards;
}

@keyframes juken-levelup-modal-in {
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.juken-levelup-eyebrow {
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
  font-weight: 800;
  color: #b45309;
  letter-spacing: 0.08em;
}

.juken-levelup-level {
  margin: 0;
  font-size: 2.85rem;
  font-weight: 900;
  line-height: 1;
  color: #1e1b4b;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.55);
}

.juken-levelup-sub {
  margin: 0.72rem 0 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: #451a03;
  line-height: 1.45;
}

.juken-levelup-unlocks {
  margin: 0.9rem 0 0;
  padding: 0.5rem 0.72rem;
  list-style: none;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  color: #422006;
  background: rgba(255, 255, 255, 0.58);
  border-radius: 0.65rem;
  border: 1px solid rgba(245, 158, 11, 0.38);
}

.juken-levelup-unlocks li {
  margin: 0.2rem 0;
}

.juken-levelup-dismiss-hint {
  margin: 1rem 0 0;
  font-size: 0.68rem;
  font-weight: 500;
  color: #78716c;
}

@media (prefers-reduced-motion: reduce) {
  .juken-levelup-modal {
    animation: none;
    transform: none;
    opacity: 1;
  }

  .juken-levelup-confetti-piece {
    animation: none;
    display: none;
  }

  .juken-levelup-overlay {
    transition: opacity 0.2s ease;
  }
}
