/* ==========================================================================
   🎓 英語試験対策スタジオ — 4試験完全対応
   ========================================================================== */

:root {
  --ee-toefl: #1e40af;
  --ee-toeic: #ea580c;
  --ee-ielts: #7c3aed;
  --ee-eiken: #dc2626;
  --ee-daigaku: #0ea5e9;
  --ee-rikei: #10b981;
  --ee-bg: #0a0e1a;
  --ee-panel: rgba(255,255,255,0.03);
  --ee-panel-border: rgba(255,255,255,0.08);
  --ee-text: #e4e4e7;
  --ee-text-dim: #9ca3af;
  --ee-text-muted: #6b7280;
  --ee-primary: #6366f1;
  --ee-accent: #ec4899;
  --ee-success: #34d399;
  --ee-warning: #fbbf24;
  --ee-danger: #f87171;
}

body {
  background: var(--ee-bg);
  color: var(--ee-text);
  font-family: -apple-system, 'Hiragino Sans', 'Yu Gothic', system-ui, sans-serif;
  margin: 0;
}

/* ========== Header ========== */
.ee-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10,14,26,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ee-panel-border);
  padding: 1rem 1.5rem 0;
}
.ee-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; max-width: 1200px; margin: 0 auto;
}
.ee-brand { display: flex; align-items: center; gap: 0.75rem; }
.ee-logo { font-size: 2rem; }
.ee-title { font-size: 1.4rem; font-weight: 900; margin: 0; line-height: 1.2; }
.ee-title-accent {
  background: linear-gradient(135deg, var(--ee-toefl), var(--ee-ielts), var(--ee-toeic), var(--ee-eiken));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-left: 0.3rem;
}
.ee-subtitle { font-size: 0.82rem; color: var(--ee-text-dim); margin: 0.2rem 0 0; }
.ee-header-actions { display: flex; align-items: center; gap: 0.5rem; }
.ee-mode-badge {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(251,191,36,0.18);
  color: var(--ee-warning);
  border: 1px solid rgba(251,191,36,0.4);
}
.ee-mode-badge.live {
  background: rgba(52,211,153,0.18);
  color: var(--ee-success);
  border-color: rgba(52,211,153,0.4);
}
.ee-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--ee-panel-border);
  color: var(--ee-text);
  text-decoration: none;
  transition: all 0.2s;
  font-size: 1.1rem;
}
.ee-icon-btn:hover { background: rgba(99,102,241,0.2); border-color: var(--ee-primary); }
.ee-trust-bar {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem;
  max-width: 1200px; margin: 0.8rem auto 0;
  padding-bottom: 0.8rem;
  font-size: 0.78rem; color: var(--ee-text-dim);
}
.ee-trust-item { white-space: nowrap; }

/* ========== Main ========== */
.ee-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}
.ee-section {
  background: var(--ee-panel);
  border: 1px solid var(--ee-panel-border);
  border-radius: 18px;
  padding: 2rem 1.5rem;
  margin-bottom: 1.5rem;
}
.ee-section-head { margin-bottom: 1.5rem; text-align: center; }
.ee-eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--ee-primary);
  background: rgba(99,102,241,0.15);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.6rem;
}
.ee-section-head h2 { font-size: 1.5rem; font-weight: 900; margin: 0 0 0.4rem; }
.ee-section-desc { color: var(--ee-text-dim); margin: 0; font-size: 0.92rem; }

/* ========== 試験選択カード ========== */
.exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.exam-card {
  background: rgba(255,255,255,0.04);
  border: 2px solid var(--ee-panel-border);
  border-radius: 16px;
  padding: 1.5rem 1.2rem;
  cursor: pointer;
  text-align: left;
  color: var(--ee-text);
  font-family: inherit;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}
.exam-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 4px;
}
.exam-toefl::before { background: var(--ee-toefl); }
.exam-toeic::before { background: var(--ee-toeic); }
.exam-ielts::before { background: var(--ee-ielts); }
.exam-eiken::before { background: var(--ee-eiken); }
.exam-daigaku::before { background: var(--ee-daigaku); }
.exam-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 12px 32px rgba(0,0,0,0.3);
}
.exam-toefl:hover { border-color: var(--ee-toefl); box-shadow: 0 12px 32px rgba(30,64,175,0.4); }
.exam-toeic:hover { border-color: var(--ee-toeic); box-shadow: 0 12px 32px rgba(234,88,12,0.4); }
.exam-ielts:hover { border-color: var(--ee-ielts); box-shadow: 0 12px 32px rgba(124,58,237,0.4); }
.exam-eiken:hover { border-color: var(--ee-eiken); box-shadow: 0 12px 32px rgba(220,38,38,0.4); }
.exam-daigaku:hover { border-color: var(--ee-daigaku); box-shadow: 0 12px 32px rgba(14,165,233,0.4); }
.exam-card-flag { font-size: 2.5rem; margin-bottom: 0.6rem; }
.exam-card-name { font-size: 1.3rem; font-weight: 900; margin-bottom: 0.4rem; }
.exam-card-tagline { font-size: 0.9rem; color: var(--ee-text-dim); margin-bottom: 1rem; line-height: 1.5; }
.exam-card-spec {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  margin-bottom: 0.8rem;
}
.exam-card-spec span {
  font-size: 0.74rem;
  background: rgba(0,0,0,0.3);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  color: var(--ee-text-dim);
}
.exam-card-target { font-size: 0.82rem; color: var(--ee-warning); }

/* ========== CEFR 換算表 ========== */
.ee-section-converter {
  background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(236,72,153,0.04));
  border-color: rgba(99,102,241,0.2);
}
.cefr-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  background: rgba(0,0,0,0.3);
  padding: 0.5rem;
}
.cefr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 600px;
}
.cefr-table th {
  text-align: left;
  padding: 0.7rem 0.8rem;
  font-weight: 700;
  color: var(--ee-text-dim);
  border-bottom: 2px solid var(--ee-panel-border);
  font-size: 0.78rem;
}
.cefr-table td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--ee-panel-border);
}
.cefr-table tr:last-child td { border-bottom: none; }
.cefr-table tr:hover { background: rgba(99,102,241,0.06); }
.cefr-c2 { color: #fbbf24; font-weight: 900; }
.cefr-c1 { color: #f59e0b; font-weight: 900; }
.cefr-b2 { color: #34d399; font-weight: 800; }
.cefr-b1 { color: #60a5fa; font-weight: 800; }
.cefr-a2 { color: #a78bfa; font-weight: 700; }
.cefr-a1 { color: #9ca3af; font-weight: 700; }
.cefr-note {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  background: rgba(251,191,36,0.08);
  border-left: 3px solid var(--ee-warning);
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--ee-text-dim);
}

/* ========== 英検 級選択 ========== */
.grade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}
.grade-card {
  background: rgba(255,255,255,0.04);
  border: 2px solid var(--ee-panel-border);
  border-radius: 12px;
  padding: 1.2rem 1rem;
  cursor: pointer;
  text-align: left;
  color: var(--ee-text);
  font-family: inherit;
  transition: all 0.2s;
  position: relative;
}
.grade-card:hover {
  background: rgba(220,38,38,0.1);
  border-color: var(--ee-eiken);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(220,38,38,0.3);
}
.grade-card-name {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--ee-eiken);
  margin-bottom: 0.3rem;
}
.grade-card-cefr {
  display: inline-block;
  background: rgba(99,102,241,0.18);
  color: var(--ee-primary);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.6rem;
}
.grade-card-target { font-size: 0.82rem; color: var(--ee-text-dim); line-height: 1.5; }
.grade-card-secondary {
  position: absolute; top: 0.6rem; right: 0.6rem;
  font-size: 0.65rem; padding: 0.1rem 0.4rem;
  background: rgba(167,139,250,0.18); color: #a78bfa;
  border-radius: 3px; font-weight: 700;
}

/* ========== 試験詳細 ========== */
.exam-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.exam-meta-card {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--ee-panel-border);
  border-radius: 12px;
  padding: 1rem;
}
.exam-meta-label {
  font-size: 0.78rem;
  color: var(--ee-text-dim);
  margin-bottom: 0.4rem;
  font-weight: 700;
}
.exam-meta-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--ee-panel-border);
  border-radius: 8px;
  color: var(--ee-text);
  font-family: inherit;
  font-size: 1rem;
  box-sizing: border-box;
}
.exam-meta-input:focus { outline: none; border-color: var(--ee-primary); }
.exam-meta-hint {
  font-size: 0.74rem;
  color: var(--ee-text-muted);
  margin-top: 0.3rem;
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}
.section-card {
  background: rgba(255,255,255,0.04);
  border: 2px solid var(--ee-panel-border);
  border-radius: 12px;
  padding: 1.2rem 1rem;
  cursor: pointer;
  text-align: left;
  color: var(--ee-text);
  font-family: inherit;
  transition: all 0.2s;
}
.section-card:hover {
  background: rgba(99,102,241,0.1);
  border-color: var(--ee-primary);
  transform: translateY(-2px);
}
.section-card.selected {
  background: rgba(99,102,241,0.18);
  border-color: var(--ee-primary);
}
.section-card-icon { font-size: 1.6rem; margin-bottom: 0.4rem; }
.section-card-name { font-weight: 900; font-size: 1rem; margin-bottom: 0.3rem; }
.section-card-spec {
  font-size: 0.75rem;
  color: var(--ee-warning);
  margin-bottom: 0.4rem;
}
.section-card-desc {
  font-size: 0.78rem;
  color: var(--ee-text-dim);
  line-height: 1.5;
}

/* ========== Buttons & CTA ========== */
.ee-cta-row {
  display: flex; gap: 0.7rem; flex-wrap: wrap;
  justify-content: center;
  margin-top: 1.5rem;
}
.ee-btn {
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  border: none;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.4rem;
  transition: all 0.2s;
}
.ee-btn-primary {
  background: linear-gradient(135deg, var(--ee-primary), var(--ee-accent));
  color: white;
}
.ee-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(99,102,241,0.4); }
.ee-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.ee-btn-secondary {
  background: rgba(99,102,241,0.18);
  color: var(--ee-text);
  border: 1px solid rgba(99,102,241,0.4);
}
.ee-btn-secondary:hover { background: rgba(99,102,241,0.3); }
.ee-btn-ghost {
  background: transparent;
  color: var(--ee-text-dim);
  border: 1px solid var(--ee-panel-border);
}
.ee-btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--ee-text); }
.ee-btn-lg {
  padding: 1rem 2rem;
  font-size: 1.05rem;
}

/* ========== Runner (問題実施画面) ========== */
.ee-runner-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap; gap: 1rem;
}
.ee-timer {
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 1.4rem;
  font-weight: 900;
  background: rgba(99,102,241,0.18);
  color: var(--ee-primary);
  padding: 0.5rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(99,102,241,0.4);
}
.ee-timer-warn {
  background: rgba(248,113,113,0.18);
  color: var(--ee-danger);
  border-color: rgba(248,113,113,0.4);
  animation: pulse 1s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.ee-question-box {
  background: rgba(0,0,0,0.3);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  min-height: 300px;
}
.ee-loading {
  text-align: center;
  color: var(--ee-text-dim);
  padding: 4rem 2rem;
  font-size: 1rem;
}
.ee-error {
  background: rgba(248,113,113,0.12);
  border: 1px solid rgba(248,113,113,0.3);
  border-radius: 8px;
  padding: 1rem;
  color: var(--ee-text);
}
.ee-passage {
  background: rgba(255,255,255,0.04);
  border-left: 4px solid var(--ee-primary);
  padding: 1rem 1.2rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
  line-height: 1.8;
}
.ee-passage h3 { margin: 0 0 0.6rem; font-size: 1rem; color: var(--ee-primary); }
.ee-passage.ee-audio { border-left-color: var(--ee-toeic); }
.ee-passage.ee-audio h3 { color: var(--ee-toeic); }

/* 🎯 試験問題 下線部マーク (実 模試風・2026-05-21 塾長指示)
   AI 出力の <u>(1) ...</u> を escapeTextWithMath で <u class="exam-underline"> に変換し、
   実 underline + 番号 (1) を視覚的にハイライト。SAT/大学入試/英検の長文に共通する表記。 */
.exam-underline {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--ee-primary);
  text-underline-offset: 3px;  /* 4px → 3px: 行間 1.8 で descender との衝突回避 (UX review 2026-05-21) */
  /* 番号 (1) (2) は inline で自然に表示・微 highlight で見やすく
     色を ee-primary (#6366f1 indigo) と統一 (UX review: indigo underline + indigo highlight) */
  background: linear-gradient(transparent 60%, rgba(99,102,241,0.18) 60%);
  padding: 0 2px;
  /* 印刷 / PDF 出力でも highlight を保持 (Chrome / Safari の Print to PDF 対応) */
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
/* 解説 / 質問 stem 内でも underline を維持 (例: 「下線部 (1) の意味は?」) */
.ee-question u, .ee-question .exam-underline { color: inherit; }
.ee-note { font-size: 0.78rem; color: var(--ee-text-muted); margin-top: 0.6rem; }
.ee-tts-btn {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(234,88,12,0.18);
  border: 1px solid rgba(234,88,12,0.4);
  border-radius: 8px;
  color: var(--ee-toeic);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
}
.ee-tts-btn:hover { background: rgba(234,88,12,0.3); }
.ee-question {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--ee-panel-border);
  border-radius: 10px;
  padding: 1.2rem;
  margin-bottom: 1rem;
}
.ee-question-num {
  display: inline-block;
  background: var(--ee-primary);
  color: white;
  font-weight: 900;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.78rem;
  margin-bottom: 0.6rem;
}
.ee-question-stem {
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 1rem;
}
.ee-choices { display: flex; flex-direction: column; gap: 0.5rem; }
.ee-choice {
  display: flex; align-items: center; gap: 0.7rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--ee-panel-border);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  cursor: pointer;
  transition: all 0.15s;
}
.ee-choice:hover { background: rgba(99,102,241,0.1); border-color: var(--ee-primary); }
.ee-choice input { accent-color: var(--ee-primary); }
.ee-choice-letter {
  font-weight: 900;
  color: var(--ee-primary);
  min-width: 24px;
}
.ee-choice-text { flex: 1; font-size: 0.92rem; }

/* 🀄 漢文 返り点 (一二三・上中下・甲乙丙・レ点) を小さく右下配置 (塾長指示 2026-05-18)
   通常の CJK 文字と同サイズで並ぶと判別困難なため、subscript 風に縮小し色も区別 */
.kaeriten {
  display: inline-block;
  font-size: 0.62em;
  vertical-align: -0.25em;
  margin: 0 0.05em;
  color: #fbbf24;
  font-weight: 700;
  line-height: 1;
}
.ee-text-input, .ee-textarea {
  width: 100%; box-sizing: border-box;
  padding: 0.7rem;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--ee-panel-border);
  border-radius: 8px;
  color: var(--ee-text);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
}
.ee-text-input:focus, .ee-textarea:focus { outline: none; border-color: var(--ee-primary); }
.ee-mic-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(220,38,38,0.18);
  border: 1px solid rgba(220,38,38,0.4);
  border-radius: 8px;
  color: var(--ee-eiken);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
}
.ee-mic-btn:hover { background: rgba(220,38,38,0.3); }
.ee-mic-btn.recording {
  animation: pulse 1.2s infinite;
  background: rgba(220,38,38,0.5);
}

.ee-runner-actions {
  display: flex; gap: 0.7rem; flex-wrap: wrap;
  justify-content: flex-end;
}

/* ========== Result ========== */
.result-hero-inner {
  background: rgba(0,0,0,0.3);
  border: 2px solid;
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  margin-bottom: 1.5rem;
}
.result-hero-flag { font-size: 3rem; }
.result-hero-exam { font-size: 1.1rem; color: var(--ee-text-dim); font-weight: 700; margin-bottom: 0.3rem; }
.result-hero-score { margin: 0.8rem 0; }
.result-hero-num {
  font-size: 4rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.result-hero-unit { font-size: 1rem; color: var(--ee-text-dim); margin-left: 0.4rem; }
.result-hero-cefr { font-size: 1rem; color: var(--ee-text); margin-bottom: 0.4rem; }
.result-hero-cefr strong {
  display: inline-block;
  background: linear-gradient(135deg, var(--ee-primary), var(--ee-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 1.4rem;
}
.result-hero-section { font-size: 0.92rem; color: var(--ee-text-dim); margin-bottom: 0.4rem; }
.result-hero-target {
  font-size: 0.95rem; color: var(--ee-warning);
  background: rgba(251,191,36,0.1);
  padding: 0.5rem;
  border-radius: 6px;
  margin: 0.6rem 0;
}
.result-hero-bar {
  width: 100%; height: 12px;
  background: rgba(0,0,0,0.5);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 1rem;
}
.result-hero-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s;
}

.result-converter h3 { font-size: 1rem; color: var(--ee-text); margin: 0 0 0.8rem; }
.result-converter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}
.conv-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--ee-panel-border);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}
.conv-flag { font-size: 1.6rem; }
.conv-name { font-size: 0.78rem; color: var(--ee-text-dim); margin: 0.3rem 0; }
.conv-score { font-size: 1.2rem; font-weight: 900; color: var(--ee-text); }

.result-feedback h3 {
  font-size: 1.05rem;
  color: var(--ee-text);
  margin: 1.2rem 0 0.6rem;
  border-bottom: 1px solid var(--ee-panel-border);
  padding-bottom: 0.4rem;
}
.result-feedback ul { padding-left: 1.5rem; line-height: 1.7; }
.result-feedback li { margin-bottom: 0.3rem; }
.result-q {
  background: rgba(255,255,255,0.04);
  border-left: 4px solid;
  border-radius: 6px;
  padding: 1rem 1.2rem;
  margin-bottom: 0.8rem;
  font-size: 0.9rem;
  line-height: 1.6;
}
.result-q.correct { border-left-color: var(--ee-success); }
.result-q.wrong { border-left-color: var(--ee-danger); }
.result-q.open { border-left-color: var(--ee-primary); }
.result-q-head { font-weight: 800; margin-bottom: 0.5rem; }
.result-q-stem { color: var(--ee-text-dim); margin-bottom: 0.5rem; }
.result-q-user, .result-q-correct, .result-q-model { margin-bottom: 0.4rem; }
.result-q-correct { color: var(--ee-success); }
.result-q-model { color: var(--ee-warning); }
.result-q-exp {
  margin-top: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: rgba(0,0,0,0.4);
  border-radius: 4px;
  color: var(--ee-text-dim);
  font-size: 0.85rem;
}

.result-plan h3 { font-size: 1.05rem; margin: 1.5rem 0 0.6rem; }
.plan-text {
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 10px;
  padding: 1.2rem;
  line-height: 1.8;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

/* ========== History ========== */
.ee-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}
.ee-history-card {
  background: rgba(0,0,0,0.3);
  border-radius: 10px;
  padding: 1rem;
  border: 1px solid var(--ee-panel-border);
}
.ee-history-date {
  font-size: 0.74rem;
  color: var(--ee-text-muted);
  margin-bottom: 0.3rem;
}
.ee-history-exam { font-weight: 800; margin-bottom: 0.4rem; }
.ee-history-score {
  font-size: 1.4rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--ee-primary);
}

/* ========== Vocabulary ========== */
.vocab-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--ee-panel-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1rem 0;
  text-align: center;
}
.vocab-word {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 0.6rem;
  color: var(--ee-text);
}
.vocab-meaning {
  font-size: 1rem;
  color: var(--ee-text-dim);
  margin-bottom: 0.6rem;
  display: none;
}
.vocab-card.revealed .vocab-meaning { display: block; }
.vocab-example {
  font-size: 0.88rem;
  color: var(--ee-text-muted);
  font-style: italic;
  display: none;
}
.vocab-card.revealed .vocab-example { display: block; }
.vocab-actions { display: flex; gap: 0.5rem; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }

/* ========== Strategy ========== */
.strategy-list {
  list-style: none; padding: 0;
}
.strategy-list li {
  background: rgba(0,0,0,0.3);
  border-left: 3px solid var(--ee-warning);
  border-radius: 4px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ========== CTA Section (Final) ========== */
.ee-section-cta {
  background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(236,72,153,0.08));
  border: 1px solid rgba(99,102,241,0.3);
  text-align: center;
  padding: 3rem 1.5rem;
}
.ee-cta-card { max-width: 720px; margin: 0 auto; }
.ee-cta-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  background: rgba(251,191,36,0.18);
  color: var(--ee-warning);
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}
.ee-cta-title {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--ee-primary), var(--ee-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1rem;
}
.ee-cta-sub {
  color: var(--ee-text);
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
}
.ee-cta-actions {
  display: flex; gap: 0.7rem; flex-wrap: wrap; justify-content: center;
}

/* ========== Footer ========== */
.ee-footer {
  border-top: 1px solid var(--ee-panel-border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--ee-text-muted);
  font-size: 0.78rem;
  line-height: 1.7;
  max-width: 1200px;
  margin: 0 auto;
}
.ee-disclaimer {
  font-size: 0.7rem;
  color: var(--ee-text-muted);
  margin-top: 1rem;
  line-height: 1.7;
  text-align: left;
}

/* ========== 📰 News Reading Section ========== */
.ee-section-news { border-color: rgba(14,165,233,0.18); }
.news-feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.8rem;
  margin: 1.2rem 0;
}
.news-feed-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 1rem 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.news-feed-card:hover {
  border-color: var(--ee-daigaku);
  background: rgba(14,165,233,0.08);
  transform: translateY(-2px);
}
.news-feed-emoji { font-size: 1.8rem; margin-bottom: 0.4rem; }
.news-feed-name { font-weight: 800; font-size: 0.95rem; margin-bottom: 0.3rem; }
.news-feed-tag { font-size: 0.72rem; color: var(--ee-text-dim); }

.news-articles {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 1.2rem;
  margin-top: 1rem;
}
.news-articles-head { font-size: 0.92rem; color: var(--ee-text-dim); margin-bottom: 1rem; }
.news-articles-list { display: flex; flex-direction: column; gap: 0.7rem; }
.news-article-card {
  text-align: left;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--ee-text);
}
.news-article-card:hover { border-color: var(--ee-daigaku); background: rgba(14,165,233,0.05); }
.news-article-title { font-weight: 800; font-size: 1rem; margin-bottom: 0.4rem; line-height: 1.45; }
.news-article-summary { font-size: 0.85rem; color: var(--ee-text-dim); line-height: 1.5; margin-bottom: 0.5rem; }
.news-article-meta { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--ee-text-muted); }
.news-article-go { color: var(--ee-daigaku); font-weight: 700; }

.news-question {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(14,165,233,0.25);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1rem;
}
.news-q-head {
  display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px dashed rgba(255,255,255,0.1);
}
.news-q-feed { font-weight: 800; color: var(--ee-daigaku); }
.news-q-source a { color: var(--ee-primary); text-decoration: underline; }
.news-q-cta {
  background: rgba(14,165,233,0.08);
  border-left: 3px solid var(--ee-daigaku);
  padding: 0.7rem 1rem;
  margin: 1rem 0;
  font-size: 0.88rem;
}
.news-q-cta a { color: var(--ee-daigaku); text-decoration: underline; word-break: break-all; }
.news-q-explain {
  background: rgba(52,211,153,0.04);
  border: 1px solid rgba(52,211,153,0.18);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  margin-top: 0.8rem;
}
.news-q-explain summary { cursor: pointer; font-weight: 700; color: var(--ee-success); }
.news-q-explain-text { margin-top: 0.5rem; line-height: 1.7; font-size: 0.88rem; }

/* ========== 📚 Archive Section ========== */
.ee-section-archive { border-color: rgba(167,139,250,0.18); }
.archive-search-row {
  margin-bottom: 0.8rem;
}
.archive-search-input {
  width: 100%;
  font-size: 0.95rem;
  padding: 0.7rem 1rem;
}
.archive-cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid rgba(167,139,250,0.18);
  padding-bottom: 0.8rem;
}
.archive-cat-tab {
  background: rgba(167,139,250,0.06);
  border: 1px solid rgba(167,139,250,0.2);
  color: var(--ee-text-dim);
  padding: 0.5rem 1rem;
  border-radius: 22px;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
}
.archive-cat-tab:hover {
  background: rgba(167,139,250,0.12);
  color: var(--ee-text);
}
.archive-cat-tab.active {
  background: linear-gradient(135deg, #a78bfa, #ec4899);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 12px rgba(167,139,250,0.4);
}
.archive-filters {
  display: flex; flex-wrap: wrap; gap: 0.6rem;
  margin-bottom: 1rem;
}
.ee-select-inline, .ee-text-input-inline {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--ee-text);
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: inherit;
}
.ee-text-input-inline { width: 130px; }
.ee-btn-mini { padding: 0.35rem 0.7rem !important; font-size: 0.78rem !important; }
.archive-overview-head { font-size: 0.9rem; color: var(--ee-text-dim); margin-bottom: 0.8rem; }
.archive-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.7rem;
}
.archive-group-card {
  background: rgba(167,139,250,0.06);
  border: 1px solid rgba(167,139,250,0.25);
  border-radius: 10px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--ee-text);
  text-align: left;
}
.archive-group-card:hover { border-color: #a78bfa; background: rgba(167,139,250,0.12); transform: translateY(-2px); }
.arch-group-name { font-weight: 800; font-size: 0.95rem; margin-bottom: 0.5rem; }
.arch-group-count { font-size: 1.5rem; font-weight: 900; color: #a78bfa; }
.arch-group-parts { font-size: 0.75rem; color: var(--ee-text-muted); }
.arch-grade-tag {
  display: inline-block; padding: 0.1rem 0.4rem; font-size: 0.7rem;
  background: rgba(255,255,255,0.08); border-radius: 4px; color: var(--ee-text-dim);
}
.archive-list-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.92rem; margin-bottom: 1rem; gap: 0.8rem;
  padding: 0.8rem 1rem;
  background: linear-gradient(135deg, rgba(167,139,250,0.12), rgba(236,72,153,0.08));
  border: 1px solid rgba(167,139,250,0.3);
  border-radius: 12px;
}
.arch-list-head-title { display: flex; flex-direction: column; gap: 0.2rem; }
.arch-list-head-exam {
  font-size: 1.1rem; font-weight: 900;
  color: #c4b5fd;
}
.arch-list-head-count {
  font-size: 0.82rem; color: var(--ee-text-dim);
}
.archive-items { display: flex; flex-direction: column; gap: 0.7rem; }
.archive-item-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.arch-item-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; font-size: 0.78rem; }
.arch-year-tag { background: rgba(14,165,233,0.15); color: #0ea5e9; padding: 0.15rem 0.5rem; border-radius: 4px; font-weight: 700; }
.arch-univ-tag { background: rgba(167,139,250,0.15); color: #a78bfa; padding: 0.15rem 0.5rem; border-radius: 4px; font-weight: 700; }
.arch-item-part { background: rgba(255,255,255,0.06); padding: 0.15rem 0.5rem; border-radius: 4px; font-family: ui-monospace, monospace; }
.arch-item-q { color: var(--ee-text-muted); }
.arch-item-preview {
  font-size: 0.85rem; color: var(--ee-text-dim); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.ee-empty { color: var(--ee-text-dim); text-align: center; padding: 1.2rem; }

/* ========== 📊 Heatmap Section ========== */
.ee-section-heatmap { border-color: rgba(34,197,94,0.18); }
.heatmap-kpi-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.7rem; margin-bottom: 1rem;
}
.heatmap-kpi {
  background: rgba(34,197,94,0.06);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: 10px;
  padding: 0.8rem;
  text-align: center;
}
.hm-kpi-label { font-size: 0.72rem; color: var(--ee-text-dim); margin-bottom: 0.3rem; }
.hm-kpi-value { font-size: 1.5rem; font-weight: 900; color: var(--ee-success); }
.heatmap-rows { display: flex; flex-direction: column; gap: 0.4rem; max-height: 360px; overflow-y: auto; }
.heatmap-row { display: flex; align-items: center; gap: 0.7rem; }
.hm-row-label { flex: 1; font-size: 0.82rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-row-label code { font-size: 0.72rem; color: var(--ee-text-dim); padding: 0.05rem 0.3rem; background: rgba(255,255,255,0.05); border-radius: 3px; }
.hm-row-bar { flex: 2; min-width: 100px; background: rgba(255,255,255,0.05); border-radius: 4px; height: 8px; overflow: hidden; }
.hm-row-fill { height: 100%; transition: width 0.4s; }
.hm-row-pct { font-weight: 800; min-width: 80px; text-align: right; font-size: 0.85rem; }
.hm-row-n { color: var(--ee-text-muted); font-weight: 400; font-size: 0.72rem; }
.heatmap-recommend { margin-top: 1.5rem; }
.recommend-card {
  background: rgba(34,197,94,0.06);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
}
.recommend-head { font-weight: 900; color: var(--ee-success); margin-bottom: 0.7rem; font-size: 1.05rem; }
.recommend-target { font-size: 1rem; margin-bottom: 0.7rem; }
.recommend-reason { font-size: 0.9rem; line-height: 1.7; margin-bottom: 0.5rem; color: var(--ee-text); }
.recommend-tip { font-size: 0.88rem; color: var(--ee-text-dim); padding: 0.6rem 0.8rem; background: rgba(255,255,255,0.03); border-left: 3px solid var(--ee-success); border-radius: 4px; margin-top: 0.7rem; }

/* ========== 🎯 Curriculum Section ========== */
.ee-section-curriculum { border-color: rgba(251,191,36,0.2); }
.curriculum-form {
  background: rgba(251,191,36,0.04);
  border: 1px solid rgba(251,191,36,0.18);
  border-radius: 12px;
  padding: 1.2rem;
  margin-bottom: 1rem;
}
.cf-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.7rem; margin-bottom: 0.8rem; }
.cf-label { font-weight: 700; min-width: 110px; font-size: 0.88rem; color: var(--ee-text); }
.cf-hint { color: var(--ee-warning); font-weight: 800; font-size: 0.85rem; }
.curriculum-result { margin-top: 1rem; }
.cur-result-card {
  background: rgba(251,191,36,0.06);
  border: 1px solid rgba(251,191,36,0.3);
  border-radius: 14px;
  padding: 1.5rem;
}
.cur-head { margin-bottom: 1.2rem; padding-bottom: 1rem; border-bottom: 1px dashed rgba(255,255,255,0.1); }
.cur-head-title { font-size: 1.2rem; font-weight: 900; color: var(--ee-warning); margin-bottom: 0.4rem; }
.cur-head-meta { font-size: 0.95rem; color: var(--ee-text-dim); margin-bottom: 0.4rem; }
.cur-head-pred { font-size: 1rem; color: var(--ee-success); }
.cur-fallback-tag { display:inline-block; padding: 0.1rem 0.4rem; background: rgba(248,113,113,0.15); color: #f87171; border-radius: 4px; font-size: 0.7rem; margin-left: 0.5rem; }

.cur-phases { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.7rem; margin-bottom: 1.2rem; }
.cur-phase-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid;
  border-radius: 10px;
  padding: 0.9rem;
}
.cur-phase-name { font-weight: 900; font-size: 1.05rem; margin-bottom: 0.4rem; }
.cur-phase-weeks { font-size: 1.5rem; font-weight: 900; color: var(--ee-text); margin-bottom: 0.4rem; }
.cur-phase-obj { font-size: 0.82rem; color: var(--ee-text-dim); line-height: 1.5; }

.cur-principles { margin-bottom: 1.2rem; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; padding: 0.7rem 1rem; }
.cur-principles summary { cursor: pointer; font-weight: 800; font-size: 0.92rem; }
.cur-principles ul { margin: 0.5rem 0 0 1.2rem; padding: 0; }
.cur-principles li { margin-bottom: 0.4rem; line-height: 1.6; font-size: 0.88rem; }

.cur-roadmap-head { font-size: 0.95rem; font-weight: 800; margin: 1rem 0 0.7rem; color: var(--ee-text); }
.cur-roadmap { display: flex; flex-direction: column; gap: 0.7rem; max-height: 600px; overflow-y: auto; padding-right: 0.5rem; }
.cur-week-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  transition: all 0.2s;
}
.cur-week-card.done { background: rgba(34,197,94,0.06); border-color: rgba(34,197,94,0.3); opacity: 0.8; }
.cur-week-head { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.cur-week-check { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; font-weight: 800; }
.cur-week-check input { width: 18px; height: 18px; cursor: pointer; }
.cur-week-phase { padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.78rem; font-weight: 700; }
.cur-week-min { color: var(--ee-text-muted); font-size: 0.85rem; margin-left: auto; }
.cur-week-focus { font-size: 0.92rem; margin-bottom: 0.6rem; line-height: 1.5; }
.cur-week-tasks { list-style: none; padding: 0; margin: 0 0 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.cur-week-tasks li {
  background: rgba(0,0,0,0.15);
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  font-size: 0.82rem;
  line-height: 1.55;
}
.cur-task-cat { display: inline-block; padding: 0.05rem 0.4rem; background: rgba(167,139,250,0.18); color: #a78bfa; border-radius: 3px; font-size: 0.7rem; margin-right: 0.4rem; font-family: ui-monospace, monospace; }
.cur-task-min { float: right; color: var(--ee-text-muted); font-size: 0.78rem; }
.cur-task-detail { font-size: 0.78rem; color: var(--ee-text-dim); margin-top: 0.2rem; }
.cur-week-mile { background: rgba(34,197,94,0.08); border-left: 3px solid var(--ee-success); padding: 0.4rem 0.7rem; font-size: 0.85rem; border-radius: 4px; margin-top: 0.5rem; }

.cur-milestones { margin-top: 1rem; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; padding: 0.7rem 1rem; }
.cur-milestones summary { cursor: pointer; font-weight: 800; font-size: 0.92rem; }
.cur-milestones ul { margin: 0.5rem 0 0 1.2rem; padding: 0; }
.cur-milestones li { margin-bottom: 0.4rem; line-height: 1.6; font-size: 0.88rem; }

.cur-actions { margin-top: 1rem; display: flex; justify-content: flex-end; }

/* ========== ⚠️ Fallback Warning Box ========== */
.ee-warning-box {
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.4);
  border-left: 4px solid var(--ee-warning);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  color: var(--ee-text);
  margin-bottom: 1rem;
  line-height: 1.6;
}

/* ========== 🔬 Figure (理系 SVG 図表) ========== */
.ee-figure {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
}
.ee-figure h3 { font-size: 0.95rem; font-weight: 800; color: var(--ee-rikei); margin: 0 0 0.7rem; }
.ee-figure-svg {
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
}
.ee-figure-svg svg {
  max-width: 100%;
  height: auto;
  color: var(--ee-text);  /* SVG が currentColor を使う場合 */
}

/* ========== 🔬 理系試験カード ========== */
.exam-rikei::before { background: var(--ee-rikei); }
.exam-rikei:hover { border-color: var(--ee-rikei); box-shadow: 0 12px 32px rgba(16,185,129,0.4); }

/* ========== 📚 大学入試 文系カード (塾長指示 2026-05-14) ========== */
.exam-bunkei::before { background: linear-gradient(135deg,#f472b6,#a855f7); }
.exam-bunkei:hover { border-color: #a855f7; box-shadow: 0 12px 32px rgba(168,85,247,0.4); }

/* KaTeX のフォントサイズ調整 (UI に馴染ませる) */
.katex { font-size: 1em !important; color: inherit; }
.katex-display { margin: 0.7rem 0 !important; }

/* 🛟 auto-extracted choices ヒント (下線部番号選択問題) */
.ee-choices-hint {
  font-size: 0.85rem;
  color: var(--accent, #ffb84d);
  background: rgba(255, 184, 77, 0.1);
  border-left: 3px solid var(--accent, #ffb84d);
  padding: 0.4rem 0.7rem;
  margin: 0.5rem 0;
  border-radius: 6px;
}

/* ========== 🎯 ボタン式 4択 (Phase 8) ========== */
.ee-choices-btn {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin: 0.7rem 0;
}
.ee-choice-btn {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-align: left;
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  color: var(--ee-text);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
  min-height: 56px;
}
.ee-choice-btn:hover:not(:disabled) {
  background: rgba(99,102,241,0.08);
  border-color: rgba(99,102,241,0.5);
  transform: translateY(-1px);
}
.ee-choice-btn:active:not(:disabled) {
  transform: scale(0.98);
}
.ee-choice-btn .ee-choice-letter {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: var(--ee-text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.95rem;
  transition: all 0.18s;
}
.ee-choice-btn .ee-choice-text {
  flex: 1;
  line-height: 1.5;
}
.ee-choice-btn .ee-choice-icon {
  flex-shrink: 0;
  width: 28px;
  text-align: center;
  font-size: 1.2rem;
}
.ee-choice-btn.selected {
  background: rgba(99,102,241,0.15);
  border-color: var(--ee-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}
.ee-choice-btn.selected .ee-choice-letter {
  background: var(--ee-primary);
  color: #fff;
}
.ee-choice-btn.graded { cursor: not-allowed; opacity: 0.95; }
.ee-choice-btn.graded:disabled { transform: none; }
.ee-choice-btn.is-correct {
  background: rgba(34,197,94,0.18);
  border-color: var(--ee-success);
}
.ee-choice-btn.is-correct .ee-choice-letter {
  background: var(--ee-success);
  color: #042f17;
}
.ee-choice-btn.is-correct .ee-choice-icon::before { content: '✓'; color: var(--ee-success); font-weight: 900; }
.ee-choice-btn.is-wrong {
  background: rgba(248,113,113,0.18);
  border-color: var(--ee-danger);
}
.ee-choice-btn.is-wrong .ee-choice-letter {
  background: var(--ee-danger);
  color: #2a0a0a;
}
.ee-choice-btn.is-wrong .ee-choice-icon::before { content: '✗'; color: var(--ee-danger); font-weight: 900; }

/* 即時採点モード 解説ボックス */
.ee-instant-explain {
  margin-top: 0.7rem;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  border: 1px solid;
  font-size: 0.88rem;
  line-height: 1.7;
}
/* 🔧 2026-05-24 塾長指示「解答・解説が表示されない」bug fix:
   reveal 後の visual feedback 強化 (背景色 + fade-in animation) → ユーザが「動いた」と気付ける */
.ee-instant-explain.reveal {
  background: rgba(245,158,11,0.10);
  border-color: rgba(245,158,11,0.45);
  animation: ee-reveal-fade-in 0.5s ease-out;
}
.ee-reveal-essay {
  background: rgba(245,158,11,0.10);
  border: 1px solid rgba(245,158,11,0.45);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-top: 0.7rem;
  font-size: 0.88rem;
  line-height: 1.7;
  animation: ee-reveal-fade-in 0.5s ease-out;
}
@keyframes ee-reveal-fade-in {
  0% { opacity: 0; transform: translateY(-6px); }
  100% { opacity: 1; transform: translateY(0); }
}
.ee-instant-explain.correct {
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.4);
}
.ee-instant-explain.wrong {
  background: rgba(248,113,113,0.08);
  border-color: rgba(248,113,113,0.4);
}
.ee-instant-head {
  font-weight: 900;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.ee-instant-explain.correct .ee-instant-head { color: var(--ee-success); }
.ee-instant-explain.wrong .ee-instant-head { color: var(--ee-danger); }
.ee-instant-correct {
  font-size: 0.85rem;
  color: var(--ee-text-dim);
  font-weight: 700;
}
.ee-instant-body { color: var(--ee-text); }

/* 即時採点トグル */
.ee-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  margin: 0.3rem 0;
}
.ee-toggle-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.ee-toggle-slider {
  display: inline-block;
  position: relative;
  width: 40px;
  height: 22px;
  background: rgba(255,255,255,0.12);
  border-radius: 11px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.ee-toggle-slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.ee-toggle-label input:checked + .ee-toggle-slider {
  background: var(--ee-success);
}
.ee-toggle-label input:checked + .ee-toggle-slider::before {
  transform: translateX(18px);
}
.ee-toggle-text { font-size: 0.85rem; color: var(--ee-text); }

/* ========== Responsive ========== */
/* タブレット以下 */
@media (max-width: 768px) {
  .ee-header-inner { flex-wrap: wrap; gap: 0.6rem; }
  .ee-brand { flex: 1 1 auto; min-width: 0; }
  .ee-brand > div { flex: 1; min-width: 0; }
  .ee-title { word-break: keep-all; overflow-wrap: anywhere; }
  .ee-subtitle { word-break: keep-all; overflow-wrap: anywhere; line-height: 1.5; }
  .ee-header-actions { flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
}

/* モバイル */
@media (max-width: 640px) {
  .ee-header { padding: 0.7rem 1rem 0; }
  .ee-header-inner { gap: 0.5rem 0.7rem; }
  .ee-logo { font-size: 1.6rem; }
  .ee-title { font-size: 1.05rem; line-height: 1.25; }
  .ee-subtitle { font-size: 0.7rem; line-height: 1.4; }
  .ee-mode-badge { padding: 0.2rem 0.5rem; font-size: 0.7rem; }
  .ee-icon-btn { width: 32px; height: 32px; font-size: 1rem; }
  .ee-trust-bar { gap: 0.4rem 1rem; font-size: 0.72rem; }
  .ee-main { padding: 1.5rem 1rem 3rem; }
  .ee-section { padding: 1.5rem 1rem; }
  .ee-section-head h2 { font-size: 1.2rem; }
  .exam-card { padding: 1.2rem 1rem; }
  .exam-card-flag { font-size: 2rem; }
  .exam-card-name { font-size: 1.1rem; }
  .ee-cta-title { font-size: 1.5rem; }
  .result-hero-num { font-size: 3rem; }
  /* 設定 UI のレイアウト調整 */
  .exam-meta-grid { grid-template-columns: 1fr 1fr !important; }
  /* 4択ボタン: モバイルでも幅余裕 */
  .ee-choice-btn { padding: 0.8rem 0.7rem; font-size: 0.9rem; min-height: 52px; }
  .ee-choice-btn .ee-choice-letter { width: 28px; height: 28px; font-size: 0.85rem; }
}

/* 超狭幅 (375px 以下 = iPhone SE) */
@media (max-width: 380px) {
  .ee-title { font-size: 0.95rem; }
  .ee-subtitle { font-size: 0.65rem; }
  .ee-brand { gap: 0.5rem; }
  .ee-logo { font-size: 1.4rem; }
  .ee-header-actions { gap: 0.3rem; }
  .ee-mode-badge { font-size: 0.65rem; padding: 0.15rem 0.4rem; }
}

/* ========== 🖨 印刷モード (問題本文 / 採点結果のみ印刷・UI を隠す) ========== */
@media print {
  /* 🛡️ Safari は印刷時に背景を既定描画する → ダーク紺背景で黒文字が読めなくなるのを防ぐため
     用紙全体を白に強制 (2026-06-02 3視点 review M1・大学別/模試と統一) */
  html, body { background: #fff !important; }
  /* ヘッダ・ナビ・他セクションすべて非表示 */
  body * { visibility: hidden; }
  /* 問題演習中 (.ee-section-runner) と 採点結果 (.ee-section-result) を両方印刷対象に
     (2026-05-21 塾長指示「解答解説を PDF で保存」対応) */
  .ee-section-runner,
  .ee-section-runner *,
  .ee-section-result,
  .ee-section-result * { visibility: visible; }
  .ee-section-runner,
  .ee-section-result {
    position: absolute; left: 0; top: 0; width: 100%;
    background: white !important; color: #000 !important;
    padding: 1rem !important;
    border: none !important;
  }
  /* 印刷時に隠す: タイマー・操作ボタン・CTA 行・DL ボタン等 */
  .ee-timer,
  .ee-runner-actions,
  .ee-runner-head .ee-eyebrow,
  #cancelRunBtn,
  #submitAnswersBtn,
  #printRunnerBtn,
  #retryBtn, #newExamBtn, #backToTopBtn,
  #downloadExamResultBtn, #downloadExamResultPdfBtn,
  .ee-cta-row { display: none !important; }
  /* 問題本文・選択肢・passage は印刷向けに整形 */
  .ee-question-box,
  .result-q,
  .ee-passage,
  .result-score-hero,
  .result-converter,
  .result-feedback,
  .result-plan {
    background: white !important;
    color: #000 !important;
    border: 1px solid #888 !important;
    page-break-inside: avoid;
    margin-bottom: 1rem !important;
  }
  .ee-question-box *,
  .result-q *,
  .ee-passage *,
  .result-score-hero *,
  .result-converter *,
  .result-feedback *,
  .result-plan * {
    color: #000 !important;
    background: transparent !important;
  }
  /* 下線部 (.exam-underline) は印刷時も視認できる黒線で */
  .exam-underline {
    text-decoration: underline !important;
    text-decoration-color: #000 !important;
    text-decoration-thickness: 1.5px !important;
    background: transparent !important;
  }
  /* リスニング audio プレイヤー等は印刷不要 */
  audio, .ee-audio-controls { display: none !important; }
  /* 解答欄 (input/textarea) の現在の入力値は印刷に残す */
  input, textarea {
    border: 1px solid #888 !important;
    background: white !important;
    color: #000 !important;
  }
  /* リンクの URL を脚注で出さない */
  a[href]:after { content: ''; }
  /* ページ余白 */
  @page { margin: 1.5cm; }
}
