/* 北摂まなびガイド - 自作Web学習アプリ スタイルシート
 * ブランドカラー: 濃紺 (#0f172a / #1e3a8a)、エメラルドグリーン (#10b981)、ゴールド (#f59e0b)
 */

@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@400;700;800;900&family=Outfit:wght@600;800&display=swap');

:root {
  --primary-navy: #1e3a8a;
  --primary-dark: #0f172a;
  --accent-emerald: #10b981;
  --accent-emerald-dark: #059669;
  --accent-orange: #f97316;
  --accent-gold: #f59e0b;
  --accent-gold-light: #fef3c7;
  --accent-silver: #94a3b8;
  --accent-bronze: #d97706;
  --bg-soft: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 6px 16px rgba(30, 58, 138, 0.08);
  --shadow-lg: 0 12px 32px rgba(30, 58, 138, 0.12);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'M PLUS Rounded 1c', 'Outfit', sans-serif;
  background-color: var(--bg-soft);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ヘッダー */
.app-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #0369a1 100%);
  color: #ffffff;
  padding: 12px 20px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.header-back-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.16);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  color: #ffffff;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  cursor: pointer;
}

.header-back-home-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  color: #ffffff;
}

.header-back-home-btn .back-icon {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  transition: transform 0.2s ease;
}

.header-back-home-btn:hover .back-icon {
  transform: translateX(-3px);
}

.header-back-home-btn .back-text-short {
  display: none;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.logo-badge {
  background: var(--accent-gold);
  color: #1e3a8a;
  font-weight: 900;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}

.app-title {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.header-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

/* Google同期ヘッダーボタン＆バッジ */
.header-btn-google {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #cbd5e1;
}

.header-btn-google:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.header-google-user-badge {
  display: none;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  color: #1d4ed8;
  padding: 3px 10px 3px 4px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.header-google-user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #3b82f6;
}

/* モード切り替えスイッチ */
.mode-toggle-wrap {
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.35);
  border-radius: 999px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.mode-toggle-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.mode-toggle-btn.active {
  background: #ffffff;
  color: #1e3a8a;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* メインコンテナ */
.main-wrapper {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 16px 40px;
  width: 100%;
  flex: 1;
}

/* アドバンスモード専用ナビゲーションバー */
.advanced-subnav {
  display: none;
  background: #ffffff;
  border: 2px solid #818cf8;
  border-radius: var(--radius-md);
  padding: 6px;
  margin-bottom: 20px;
  gap: 6px;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.advanced-subnav.active {
  display: flex;
}

.adv-tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-weight: 800;
  font-size: 13.5px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.adv-tab-btn:hover {
  background: #f1f5f9;
  color: #1e3a8a;
}

.adv-tab-btn.active {
  background: #e0e7ff;
  color: #4338ca;
  font-weight: 900;
}

/* 相棒キャラクターサマリーカード */
.companion-bar {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  border: 2px solid #bbf7d0;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.companion-avatar-wrap {
  width: 84px;
  height: 84px;
  min-width: 84px;
  background: #ffffff;
  border-radius: 50%;
  padding: 6px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
  border: 3px solid var(--accent-emerald);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.companion-avatar-wrap:hover {
  transform: scale(1.08) rotate(3deg);
}

.companion-info {
  flex: 1;
}

.companion-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.companion-name {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--primary-dark);
}

.companion-title-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
}

.companion-speech {
  font-size: 13.5px;
  color: #334155;
  background: #ffffff;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent-emerald);
  margin-top: 6px;
  box-shadow: var(--shadow-sm);
  display: inline-block;
  font-weight: 700;
}

.companion-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 140px;
}

.exp-bar-wrap {
  width: 100%;
  background: #e2e8f0;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
}

.exp-bar-fill {
  background: linear-gradient(90deg, #10b981, #059669);
  height: 100%;
  width: 0%;
  transition: width 0.5s ease;
}

.exp-text {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.change-char-btn {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.change-char-btn:hover {
  background: #dbeafe;
}

/* バッジ獲得ルール告知バナー */
.badge-rules-banner {
  background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 100%);
  border: 1.5px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.badge-rules-list {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.badge-rule-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
}

.badge-icon-sm {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 14px;
}

/* ナビゲーションタブ（学年選択） */
.grade-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 20px;
  scrollbar-width: thin;
}

.grade-tab-btn {
  background: #ffffff;
  border: 2px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 800;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.grade-tab-btn:hover {
  border-color: #93c5fd;
  color: var(--primary-navy);
}

.grade-tab-btn.active {
  background: var(--primary-navy);
  border-color: var(--primary-navy);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.25);
  transform: translateY(-2px);
}

.grade-tab-btn.mock-tab {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  border-color: #7c3aed;
  color: #ffffff;
}

.grade-tab-btn.mock-tab.active {
  background: linear-gradient(135deg, #6d28d9, #4338ca);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}

/* 教科＆単元カードエリア */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.subject-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
  padding: 20px;
  transition: all 0.25s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.subject-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: #93c5fd;
}

.subject-card.japanese { border-top: 6px solid #ef4444; }
.subject-card.math { border-top: 6px solid #3b82f6; }
.subject-card.science, .subject-card.life { border-top: 6px solid #10b981; }
.subject-card.society, .subject-card.social { border-top: 6px solid #f59e0b; }
.subject-card.mock { border-top: 6px solid #8b5cf6; }

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

.subject-badge {
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  color: #ffffff;
}

.badge-ja { background: #ef4444; }
.badge-ma { background: #3b82f6; }
.badge-sc { background: #10b981; }
.badge-so { background: #f59e0b; }
.badge-mo { background: #8b5cf6; }

.unit-earned-badge {
  font-size: 20px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.unit-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--primary-dark);
  line-height: 1.5;
}

.unit-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.start-unit-btn {
  background: linear-gradient(135deg, var(--accent-emerald) 0%, var(--accent-emerald-dark) 100%);
  color: #ffffff;
  border: none;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.start-unit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* クイズ実行画面 */
.quiz-screen {
  display: none;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 30px;
}

.quiz-screen.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.quiz-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}

.quiz-progress-text {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary-navy);
}

.quiz-combo-badge {
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #b45309;
  font-weight: 800;
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 999px;
  animation: pulse 1.5s infinite;
}

.quiz-progress-track {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 24px;
}

.quiz-progress-fill {
  background: linear-gradient(90deg, #3b82f6, #10b981);
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}

.quiz-question-box {
  background: #f8fafc;
  border-left: 6px solid var(--primary-navy);
  padding: 20px 22px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.quiz-question-text {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.6;
  color: var(--primary-dark);
  white-space: pre-line;
}

.quiz-choices-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.choice-btn {
  background: #ffffff;
  border: 2px solid #cbd5e1;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.choice-btn:hover:not(:disabled) {
  border-color: #3b82f6;
  background: #eff6ff;
  transform: translateX(4px);
}

.choice-letter {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
}

.choice-btn.correct {
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
  color: #065f46 !important;
}

.choice-btn.correct .choice-letter {
  background: #10b981;
  color: #ffffff;
}

.choice-btn.wrong {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #991b1b !important;
}

.choice-btn.wrong .choice-letter {
  background: #ef4444;
  color: #ffffff;
}

/* クイズ結果・解説フィードバック */
.quiz-feedback-box {
  display: none;
  padding: 20px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  animation: slideUp 0.3s ease;
}

.quiz-feedback-box.active {
  display: block;
}

.quiz-feedback-box.correct {
  background: #ecfdf5;
  border: 2px solid #a7f3d0;
}

.quiz-feedback-box.wrong {
  background: #fff1f2;
  border: 2px solid #fecdd3;
}

.feedback-header {
  font-size: 1.15rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.feedback-text {
  font-size: 14px;
  color: #334155;
  line-height: 1.6;
}

.next-q-btn {
  background: var(--primary-navy);
  color: #ffffff;
  border: none;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.next-q-btn:hover {
  background: #1e40af;
  transform: translateY(-2px);
}

/* 結果・バッジ判定画面 */
.result-screen {
  display: none;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
  padding: 36px 28px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

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

.badge-grand-reveal {
  margin-bottom: 24px;
}

.awarded-badge-icon {
  font-size: 84px;
  display: inline-block;
  animation: bounceIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 8px 24px rgba(245, 158, 11, 0.35));
}

.awarded-badge-name {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--primary-dark);
  margin-top: 8px;
}

.awarded-badge-criteria {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 4px;
}

.score-display-box {
  background: #f8fafc;
  border-radius: var(--radius-md);
  padding: 18px;
  max-width: 380px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.score-item-val {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--primary-navy);
}

.score-item-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
}

.companion-reaction-card {
  background: #eff6ff;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 480px;
  margin: 0 auto 28px;
  border: 1px solid #bfdbfe;
  text-align: left;
}

.comp-reaction-avatar {
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: 50%;
  background: #ffffff;
  padding: 4px;
  box-shadow: var(--shadow-sm);
}

.comp-reaction-quote {
  font-size: 14px;
  font-weight: 700;
  color: #1e3a8a;
  line-height: 1.5;
}

/* =========================================================================
 * アドバンスモード用コンポーネント (学習計画・日誌・分析・弱点特訓)
 * ========================================================================= */
.advanced-container {
  display: none;
  animation: fadeIn 0.3s ease;
}

.advanced-container.active {
  display: block;
}

.adv-dashboard-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.adv-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  border-bottom: 1.5px solid #f1f5f9;
  padding-bottom: 12px;
}

.adv-card-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--primary-navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 学習計画 (Plan) */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.plan-item-box {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 16px;
}

.plan-item-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.plan-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  font-weight: 700;
  outline: none;
  transition: border-color 0.2s;
}

.plan-input:focus {
  border-color: #3b82f6;
}

.week-schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.day-box {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  text-align: center;
}

.day-name {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
}

.day-subj-select {
  width: 100%;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  margin-top: 4px;
  padding: 2px;
}

/* 学習日誌 (Diary) */
.diary-editor-box {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.diary-textarea {
  width: 100%;
  height: 90px;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 10px;
  font-family: inherit;
  font-size: 13.5px;
  resize: vertical;
  outline: none;
  margin-bottom: 10px;
}

.diary-textarea:focus {
  border-color: #3b82f6;
}

.diary-save-btn {
  background: var(--primary-navy);
  color: #ffffff;
  border: none;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.diary-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.diary-item-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.diary-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.diary-item-content {
  font-size: 13.5px;
  color: #1e293b;
  margin-bottom: 10px;
  line-height: 1.5;
}

.diary-comp-comment {
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 12.5px;
  color: #1d4ed8;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 学習分析 (Analytics) */
.analytics-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.analytics-stat-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.analytics-stat-val {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--primary-navy);
}

.analytics-stat-label {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-muted);
}

.subject-mastery-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.mastery-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 800;
}

.mastery-track {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.mastery-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s ease;
}

/* 弱点特訓 (Weakness Training) */
.weakness-list-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.weakness-item {
  background: #fef2f2;
  border: 1.5px solid #fecdd3;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.weakness-q-text {
  font-size: 13px;
  font-weight: 700;
  color: #991b1b;
  flex: 1;
}

.weakness-start-btn {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
}

/* =========================================================================
 * AI北摂まなびチューター チャットUI
 * ========================================================================= */
.tutor-chat-container {
  display: flex;
  flex-direction: column;
  height: 520px;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.tutor-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f8fafc;
}

.tutor-msg-row {
  display: flex;
  gap: 10px;
  max-width: 85%;
}

.tutor-msg-row.ai {
  align-self: flex-start;
}

.tutor-msg-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.tutor-msg-avatar {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #818cf8;
  padding: 2px;
}

.tutor-msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.6;
}

.tutor-msg-row.ai .tutor-msg-bubble {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  color: #1e293b;
  border-top-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.tutor-msg-row.user .tutor-msg-bubble {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #ffffff;
  border-top-right-radius: 4px;
}

.tutor-quick-chips {
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tutor-chip-btn {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.tutor-chip-btn:hover {
  background: #dbeafe;
  border-color: #3b82f6;
}

.tutor-chat-input-row {
  display: flex;
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid #cbd5e1;
  gap: 8px;
}

.tutor-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 999px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

.tutor-input:focus {
  border-color: #3b82f6;
}

.tutor-send-btn {
  background: var(--primary-navy);
  color: #ffffff;
  border: none;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.2s;
}

.tutor-send-btn:hover {
  background: #1e40af;
}

/* =========================================================================
 * Google同期＆セーブ管理モーダル
 * ========================================================================= */
.sync-modal-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.sync-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.sync-card-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sync-btn {
  width: 100%;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 13.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  transition: all 0.2s;
}

.sync-btn-google {
  background: #ffffff;
  color: #1e293b;
  border: 1.5px solid #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.sync-btn-google:hover {
  background: #f1f5f9;
}

.sync-btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
}

.sync-btn-secondary {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1.5px solid #bfdbfe;
}

/* モーダル */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  position: relative;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  border-bottom: 1.5px solid #f1f5f9;
  padding-bottom: 12px;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--primary-dark);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
}

.companion-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.companion-choice-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #ffffff;
}

.companion-choice-card:hover {
  transform: translateY(-3px);
  border-color: #3b82f6;
  box-shadow: var(--shadow-md);
}

.companion-choice-card.selected {
  border-color: var(--accent-emerald);
  background: #f0fdf4;
  box-shadow: 0 0 0 2px var(--accent-emerald);
}

.char-card-avatar {
  width: 72px;
  height: 72px;
  margin-bottom: 8px;
}

.char-card-name {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--primary-dark);
}

.char-card-area {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.char-card-desc {
  font-size: 12px;
  color: #334155;
  margin-bottom: 8px;
  line-height: 1.4;
}

.char-select-btn {
  background: var(--primary-navy);
  color: #ffffff;
  border: none;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  width: 100%;
}

/* バッジ図鑑 */
.badge-collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.badge-item-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.badge-item-card.unlocked {
  background: #ffffff;
  border-color: #fde68a;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.15);
}

.badge-item-icon {
  font-size: 42px;
  margin-bottom: 6px;
  filter: grayscale(100%) opacity(0.35);
}

.badge-item-card.unlocked .badge-item-icon {
  filter: none;
  animation: shine 2s infinite;
}

.badge-item-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
}

.badge-item-card.unlocked .badge-item-title {
  color: var(--primary-dark);
}

.badge-item-rank {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
}

.rank-gold { background: #fef3c7; color: #b45309; }
.rank-silver { background: #f1f5f9; color: #475569; }
.rank-bronze { background: #ffedd5; color: #9a3412; }

/* アニメーション */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

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

@keyframes shine {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.4)); }
  50% { filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.8)); }
}

/* レスポンシブ */
@media (max-width: 640px) {
  .companion-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .companion-stats {
    align-items: flex-start;
    width: 100%;
  }
  .subject-grid {
    grid-template-columns: 1fr;
  }
  .week-schedule-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .header-back-home-btn {
    padding: 5px 10px;
    font-size: 11.5px;
  }
  .header-back-home-btn .back-text-full {
    display: none;
  }
  .header-back-home-btn .back-text-short {
    display: inline;
  }
}

/* ========================================================
   月間インタラクティブ学習カレンダー（スキマ資格ガイド同等高機能）
   ======================================================== */
.study-calendar-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.calendar-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  border-bottom: 1.5px solid #f1f5f9;
  padding-bottom: 14px;
  flex-wrap: wrap;
  gap: 12px;
}

.calendar-month-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--primary-navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.calendar-nav-btn {
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  color: #334155;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.calendar-nav-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.calendar-nav-btn.add-event-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 12px rgba(37,99,235,0.25);
}

.calendar-nav-btn.add-event-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-weekday {
  text-align: center;
  font-size: 12px;
  font-weight: 900;
  color: #64748b;
  padding: 8px 0;
  background: #f8fafc;
  border-radius: 6px;
}

.cal-weekday.sun { color: #ef4444; }
.cal-weekday.sat { color: #3b82f6; }

.cal-day-cell {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  min-height: 74px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.cal-day-cell:hover {
  border-color: #3b82f6;
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.04);
}

.cal-day-cell.other-month {
  opacity: 0.35;
  background: #f8fafc;
  cursor: default;
}

.cal-day-cell.is-today {
  border: 2.5px solid #2563eb !important;
  background: #eff6ff !important;
}

.cal-day-cell.is-selected {
  border-color: #059669 !important;
  background: #ecfdf5 !important;
  box-shadow: 0 0 0 2px rgba(5,150,105,0.25);
}

.cal-day-cell.has-event {
  background: #fffbeb !important;
  border-color: #fde68a !important;
}

.cal-day-cell.has-exam {
  background: #fef2f2 !important;
  border-color: #fca5a5 !important;
}

.cal-day-num {
  font-size: 13px;
  font-weight: 900;
  color: #1e293b;
  margin-bottom: 2px;
}

.cal-study-pill {
  background: #10b981;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 9999px;
  line-height: 1;
  margin-top: 3px;
  white-space: nowrap;
}

.cal-study-time {
  font-size: 9.5px;
  font-weight: 700;
  color: #047857;
  margin-top: 2px;
}

.cal-event-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.cal-event-badge.exam {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  border: 1px solid #f87171;
  animation: pulseExamBadge 2s infinite ease-in-out;
}

@keyframes pulseExamBadge {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); box-shadow: 0 0 6px rgba(239, 68, 68, 0.6); }
  100% { transform: scale(1); }
}

.cal-event-badge.mock {
  background: #f59e0b;
  color: #fff;
  border: 1px solid #d97706;
}

.cal-event-badge.goal {
  background: #3b82f6;
  color: #fff;
  border: 1px solid #2563eb;
}

.cal-event-badge.memo {
  background: #8b5cf6;
  color: #fff;
  border: 1px solid #7c3aed;
}

.cal-selected-detail-card {
  margin-top: 20px;
  padding: 20px 22px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.cal-type-btn {
  padding: 8px 10px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.cal-type-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.cal-type-btn.active {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.cal-quick-tag {
  font-size: 11.5px;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
  padding: 4px 10px;
  border-radius: 9999px;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  transition: all 0.15s ease;
}

.cal-quick-tag:hover {
  background: #e0f2fe;
  color: #0284c7;
  border-color: #38bdf8;
}

/* =========================================================================
 * AIチューター Google Gemini API 連携スタイル
 * ========================================================================= */
.tutor-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tutor-api-status-badge {
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tutor-api-status-badge.active {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.tutor-api-status-badge.inactive {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.tutor-api-config-btn {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #334155;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.tutor-api-config-btn:hover {
  background: #f8fafc;
  border-color: #6366f1;
  color: #4f46e5;
  box-shadow: 0 2px 6px rgba(99,102,241,0.15);
}

.tutor-api-banner {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  border: 1.5px solid #c4b5fd;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.tutor-api-banner-text {
  font-size: 12.5px;
  color: #5b21b6;
  line-height: 1.5;
}

.tutor-api-banner-btn {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(79,70,229,0.25);
  transition: all 0.2s ease;
}

.tutor-api-banner-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(79,70,229,0.35);
}

/* AIチューター 思考中アニメーション */
.tutor-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.tutor-typing-dot {
  width: 7px;
  height: 7px;
  background: #818cf8;
  border-radius: 50%;
  animation: tutorTypingBounce 1.4s infinite ease-in-out both;
}

.tutor-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.tutor-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.tutor-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes tutorTypingBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* =========================================================================
 * ドラッグ移動可能なAI学習チューター ポップアップウィンドウ (スキマ資格ガイド同等)
 * ========================================================================= */
.tutor-floating-window {
  position: fixed;
  z-index: 9999;
  width: 440px;
  max-width: calc(100vw - 20px);
  height: 620px;
  max-height: calc(100vh - 36px);
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.35), 0 0 0 1.5px rgba(99, 102, 241, 0.4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: tutorPopupFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.tutor-floating-header {
  flex-shrink: 0;
  padding: 12px 14px;
  background: linear-gradient(135deg, #1e3a8a 0%, #312e81 50%, #4338ca 100%);
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: grab;
  user-select: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.tutor-floating-header:active {
  cursor: grabbing;
}

.tutor-header-avatar {
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  backdrop-filter: blur(4px);
}

.tutor-floating-title {
  font-size: 13.5px;
  font-weight: 900;
  color: #ffffff;
  margin: 0;
  line-height: 1.2;
}

.tutor-drag-hint {
  font-size: 10px;
  color: #c7d2fe;
  margin: 2px 0 0 0;
  display: flex;
  align-items: center;
  gap: 3px;
}

.tutor-floating-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tutor-control-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tutor-control-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.tutor-control-btn.close:hover {
  background: #ef4444;
  color: #ffffff;
}

.tutor-floating-body {
  flex: 1;
  min-height: 0; /* 重要: flexアイテムが溢れずに縮むための指定 */
  display: flex;
  flex-direction: column;
  background: #ffffff;
  overflow: hidden;
}

/* ポップアップ内チャットメッセージ領域：親の残余領域を埋めて自律スクロール */
#popupChatMessages.tutor-chat-messages {
  flex: 1;
  min-height: 0;
  height: auto !important;
  overflow-y: auto;
  padding: 12px 14px;
  gap: 12px;
  background: #f8fafc;
}

/* 常時フローティングトリガーボタン (画面右下) */
.floating-tutor-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9990;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  border: none;
  border-radius: 50px;
  padding: 10px 18px 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.4), 0 2px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-tutor-trigger:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.5), 0 4px 10px rgba(0, 0, 0, 0.15);
}

.floating-tutor-trigger-icon {
  font-size: 18px;
  animation: tutorPulse 2s infinite ease-in-out;
}

@keyframes tutorPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15) rotate(5deg); }
}

/* アプリフッター */
.app-footer {
  margin-top: auto;
  background: #0f172a;
  color: #94a3b8;
  padding: 32px 20px 24px;
  border-top: 1px solid #1e293b;
}

.footer-container {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #38bdf8;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.2s ease;
  width: fit-content;
}

.footer-back-link:hover {
  color: #7dd3fc;
  text-decoration: underline;
  transform: translateX(-3px);
}

.footer-desc {
  font-size: 12px;
  line-height: 1.7;
  color: #64748b;
  max-width: 720px;
}

.footer-bottom {
  border-top: 1px solid #1e293b;
  padding-top: 16px;
}

.footer-copy {
  font-size: 11.5px;
  color: #64748b;
}
