/* ===========================
   FP2合格ナビ - Responsive CSS
   =========================== */

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

:root {
  --primary: #1565c0;
  --primary-dark: #0d47a1;
  --primary-light: #e3f2fd;
  --success: #2e7d32;
  --danger: #c62828;
  --warning: #e65100;
  --text: #212121;
  --text-sub: #616161;
  --border: #e0e0e0;
  --bg: #f5f5f5;
  --white: #ffffff;
  --card-shadow: 0 2px 8px rgba(0,0,0,0.1);
  --header-h: 56px;
  --bnav-h: 64px;
  /* Field colors */
  --c-life: #1e88e5;
  --c-risk: #43a047;
  --c-asset: #fb8c00;
  --c-tax: #8e24aa;
  --c-estate: #e53935;
  --c-inherit: #6d4c41;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  padding-top: var(--header-h);
  padding-bottom: var(--bnav-h);
  min-height: 100vh;
}

/* --- Header --- */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--primary);
  color: var(--white);
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 16px;
  gap: 8px;
}
.header-title {
  font-size: 1.1rem;
  font-weight: 700;
  flex: 1;
  text-align: center;
  letter-spacing: 0.02em;
}
.back-btn {
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}
.back-btn:hover { background: rgba(255,255,255,0.15); }
.back-btn.hidden { visibility: hidden; }
.header-spacer { width: 40px; flex-shrink: 0; }

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bnav-h);
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}
.bnav-item {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-sub);
  transition: color 0.2s;
  padding: 4px 0;
  gap: 2px;
  -webkit-tap-highlight-color: transparent;
}
.bnav-item.active { color: var(--primary); }
.bnav-icon { font-size: 1.3rem; line-height: 1; }
.bnav-label { font-size: 0.65rem; font-weight: 500; }

/* --- Main Content Area --- */
.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
  min-height: calc(100vh - var(--header-h) - var(--bnav-h));
}

/* --- Cards --- */
.card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  margin-bottom: 12px;
}
.card-header {
  padding: 14px 16px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body { padding: 16px; }

/* --- Field Cards (Home & Study) --- */
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.field-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  border: 2px solid transparent;
}
.field-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.15); }
.field-card:active { transform: scale(0.97); }
.field-card-header {
  padding: 12px 14px;
  color: var(--white);
  font-weight: 700;
  font-size: 0.85rem;
}
.field-card-icon { font-size: 1.4rem; display: block; margin-bottom: 4px; }
.field-card-body { padding: 10px 14px 12px; }
.field-card-desc { font-size: 0.75rem; color: var(--text-sub); margin-bottom: 8px; }

/* Field colors */
.field-life .field-card-header, .field-life .card-header { background: var(--c-life); }
.field-risk .field-card-header, .field-risk .card-header { background: var(--c-risk); }
.field-asset .field-card-header, .field-asset .card-header { background: var(--c-asset); }
.field-tax .field-card-header, .field-tax .card-header { background: var(--c-tax); }
.field-estate .field-card-header, .field-estate .card-header { background: var(--c-estate); }
.field-inherit .field-card-header, .field-inherit .card-header { background: var(--c-inherit); }
.field-all .field-card-header, .field-all .card-header { background: var(--primary); }

/* --- Progress Bar --- */
.progress-wrap { background: #e0e0e0; border-radius: 100px; height: 8px; overflow: hidden; }
.progress-bar {
  height: 100%;
  border-radius: 100px;
  transition: width 0.5s ease;
  background: var(--primary);
}
.progress-text { font-size: 0.75rem; color: var(--text-sub); margin-top: 4px; text-align: right; }
.field-life .progress-bar { background: var(--c-life); }
.field-risk .progress-bar { background: var(--c-risk); }
.field-asset .progress-bar { background: var(--c-asset); }
.field-tax .progress-bar { background: var(--c-tax); }
.field-estate .progress-bar { background: var(--c-estate); }
.field-inherit .progress-bar { background: var(--c-inherit); }

/* --- Home Page --- */
.home-hero {
  background: linear-gradient(135deg, var(--primary), #1e88e5);
  color: var(--white);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  text-align: center;
  box-shadow: var(--card-shadow);
}
.home-hero h2 { font-size: 1.2rem; margin-bottom: 6px; }
.home-hero p { font-size: 0.85rem; opacity: 0.9; margin-bottom: 12px; }
.overall-score {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}
.overall-score span { font-size: 1rem; font-weight: 400; }

.section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  margin-top: 16px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.qa-btn {
  background: var(--white);
  border: 2px solid var(--primary);
  color: var(--primary);
  border-radius: 10px;
  padding: 14px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.qa-btn:hover { background: var(--primary); color: var(--white); }
.qa-btn:active { transform: scale(0.96); }
.qa-btn .qa-icon { font-size: 1.3rem; display: block; margin-bottom: 4px; }

/* --- Study Page --- */
.topic-list { list-style: none; }
.topic-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  gap: 12px;
  background: var(--white);
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.topic-item:last-child { border-bottom: none; }
.topic-item:hover { background: var(--primary-light); }
.topic-item:active { background: #bbdefb; }
.topic-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topic-item.done .topic-num { background: #c8e6c9; color: var(--success); }
.topic-title { flex: 1; font-size: 0.95rem; font-weight: 500; }
.topic-check { color: var(--success); font-size: 1.1rem; }

/* --- Study Content Page --- */
.study-content { }
.content-section {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  margin-bottom: 14px;
  overflow: hidden;
}
.content-section-title {
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  background: #fafafa;
}
.content-section-body { padding: 14px 16px; }
.content-text { font-size: 0.9rem; line-height: 1.8; color: var(--text); margin-bottom: 10px; }
.content-text:last-child { margin-bottom: 0; }

.key-points { list-style: none; }
.key-points li {
  font-size: 0.88rem;
  padding: 6px 0 6px 22px;
  border-bottom: 1px solid #f5f5f5;
  position: relative;
  line-height: 1.6;
}
.key-points li:last-child { border-bottom: none; }
.key-points li::before {
  content: '▶';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-size: 0.7rem;
  top: 10px;
}

.numbers-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.numbers-table th {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
  font-size: 0.8rem;
}
.numbers-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.numbers-table tr:last-child td { border-bottom: none; }
.numbers-table .num-val { font-weight: 700; color: var(--primary-dark); white-space: nowrap; }

.important-box {
  background: #fff8e1;
  border-left: 4px solid #ffa000;
  padding: 12px 14px;
  border-radius: 0 8px 8px 0;
  font-size: 0.88rem;
  line-height: 1.7;
  margin-bottom: 10px;
}
.important-box strong { color: #e65100; }

.mark-done-btn {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.mark-done-btn:hover { background: var(--primary-dark); }
.mark-done-btn.done { background: var(--success); }

/* --- Quiz Page --- */
.quiz-field-select {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.quiz-field-btn {
  border: none;
  border-radius: 10px;
  padding: 16px 12px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--white);
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.quiz-field-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.quiz-field-btn:active { transform: scale(0.97); }
.quiz-field-btn.f-life { background: var(--c-life); }
.quiz-field-btn.f-risk { background: var(--c-risk); }
.quiz-field-btn.f-asset { background: var(--c-asset); }
.quiz-field-btn.f-tax { background: var(--c-tax); }
.quiz-field-btn.f-estate { background: var(--c-estate); }
.quiz-field-btn.f-inherit { background: var(--c-inherit); }
.quiz-field-btn.f-all { background: var(--primary); grid-column: span 2; }
.quiz-field-btn .btn-icon { font-size: 1.4rem; display: block; margin-bottom: 6px; }
.quiz-field-btn .btn-count { font-size: 0.75rem; opacity: 0.85; margin-top: 4px; }

/* Quiz Card */
.quiz-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 20px;
  margin-bottom: 14px;
}
.quiz-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.quiz-num-badge {
  font-size: 0.75rem;
  background: var(--primary-light);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 700;
}
.quiz-field-badge {
  font-size: 0.72rem;
  color: var(--white);
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 600;
}
.quiz-question {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.7;
  margin-bottom: 16px;
}
.quiz-answer-area {
  background: var(--primary-light);
  border-radius: 8px;
  overflow: hidden;
}
.show-answer-btn {
  width: 100%;
  padding: 13px;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.answer-content {
  padding: 14px 16px;
  border-top: 1px solid #bbdefb;
  display: none;
}
.answer-content.visible { display: block; }
.answer-label { font-size: 0.75rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 6px; text-transform: uppercase; }
.answer-text { font-size: 0.95rem; line-height: 1.7; font-weight: 600; color: var(--primary-dark); margin-bottom: 10px; }
.answer-explain { font-size: 0.85rem; color: var(--text-sub); line-height: 1.7; }

.quiz-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.quiz-ok-btn, .quiz-retry-btn {
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.2s;
}
.quiz-ok-btn { background: var(--success); color: var(--white); }
.quiz-retry-btn { background: #ffecb3; color: #e65100; }
.quiz-ok-btn:hover, .quiz-retry-btn:hover { opacity: 0.85; }

.quiz-nav-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}
.quiz-nav-btn {
  padding: 10px 24px;
  border: 2px solid var(--primary);
  background: var(--white);
  color: var(--primary);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.quiz-nav-btn:hover { background: var(--primary-light); }

.quiz-progress-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
}
.quiz-progress-row .progress-wrap { flex: 1; }

/* --- Exam Page --- */
.exam-start-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 24px;
  text-align: center;
}
.exam-start-card h2 { font-size: 1.2rem; margin-bottom: 8px; }
.exam-start-card p { font-size: 0.88rem; color: var(--text-sub); line-height: 1.7; margin-bottom: 16px; }
.exam-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.exam-info-item {
  background: var(--primary-light);
  border-radius: 8px;
  padding: 12px 8px;
  text-align: center;
}
.exam-info-num { font-size: 1.4rem; font-weight: 700; color: var(--primary-dark); }
.exam-info-label { font-size: 0.72rem; color: var(--text-sub); }

.start-exam-btn {
  width: 100%;
  padding: 16px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s;
}
.start-exam-btn:hover { background: var(--primary-dark); }

/* Exam Timer */
.exam-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--white);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  box-shadow: var(--card-shadow);
}
.exam-timer {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-dark);
}
.exam-timer.urgent { color: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.5} }
.exam-q-counter { font-size: 0.85rem; color: var(--text-sub); }

/* Exam Question */
.exam-question-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 20px;
  margin-bottom: 14px;
}
.exam-q-num { font-size: 0.75rem; color: var(--text-sub); margin-bottom: 8px; }
.exam-q-text { font-size: 0.95rem; line-height: 1.7; margin-bottom: 16px; font-weight: 500; }
.exam-options { list-style: none; }
.exam-option {
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.5;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.exam-option:hover { border-color: var(--primary); background: var(--primary-light); }
.exam-option.selected { border-color: var(--primary); background: var(--primary-light); }
.exam-option.correct { border-color: var(--success); background: #e8f5e9; }
.exam-option.wrong { border-color: var(--danger); background: #ffebee; }
.option-letter {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-sub);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.exam-option.selected .option-letter { background: var(--primary); color: var(--white); }
.exam-option.correct .option-letter { background: var(--success); color: var(--white); }
.exam-option.wrong .option-letter { background: var(--danger); color: var(--white); }

.exam-nav-row {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}
.exam-nav-btn {
  flex: 1;
  padding: 13px;
  border: 2px solid var(--primary);
  background: var(--white);
  color: var(--primary);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.exam-nav-btn.primary { background: var(--primary); color: var(--white); }
.exam-nav-btn:hover { background: var(--primary-light); }
.exam-nav-btn.primary:hover { background: var(--primary-dark); }
.exam-submit-btn {
  width: 100%;
  padding: 14px;
  background: #e53935;
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  -webkit-tap-highlight-color: transparent;
}
.exam-submit-btn:hover { background: #c62828; }

/* Exam dot nav */
.exam-dot-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px;
  background: var(--white);
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  margin-bottom: 14px;
}
.dot {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: none;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--border);
  color: var(--text-sub);
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.dot.answered { background: var(--primary); color: var(--white); }
.dot.current { outline: 2px solid var(--primary-dark); outline-offset: 1px; }

/* Exam Result */
.result-hero {
  background: linear-gradient(135deg, var(--primary), #1e88e5);
  color: var(--white);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  margin-bottom: 14px;
  box-shadow: var(--card-shadow);
}
.result-score-big { font-size: 3rem; font-weight: 700; line-height: 1; }
.result-score-big span { font-size: 1.2rem; }
.result-label { font-size: 0.85rem; opacity: 0.85; margin-top: 6px; }
.result-pass {
  margin-top: 10px;
  display: inline-block;
  padding: 4px 16px;
  border-radius: 100px;
  font-weight: 700;
  font-size: 1rem;
}
.result-pass.pass { background: #c8e6c9; color: var(--success); }
.result-pass.fail { background: #ffcdd2; color: var(--danger); }

.result-field-list { list-style: none; }
.result-field-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.result-field-item:last-child { border-bottom: none; }
.result-field-name { flex: 1; font-size: 0.88rem; font-weight: 500; }
.result-field-score { font-size: 0.9rem; font-weight: 700; white-space: nowrap; }
.result-field-bar { flex: 2; }

/* --- Progress Page --- */
.progress-overview {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 20px;
  margin-bottom: 14px;
  text-align: center;
}
.progress-circle-wrap { margin: 10px auto 12px; position: relative; width: 120px; height: 120px; }
.progress-ring { transform: rotate(-90deg); }
.progress-ring-circle {
  fill: none;
  stroke: var(--border);
  stroke-width: 10;
}
.progress-ring-bar {
  fill: none;
  stroke: var(--primary);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 345;
  stroke-dashoffset: 345;
  transition: stroke-dashoffset 1s ease;
}
.progress-circle-text {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.progress-circle-pct { font-size: 1.6rem; font-weight: 700; color: var(--primary-dark); }
.progress-circle-label { font-size: 0.7rem; color: var(--text-sub); }

.exam-history { list-style: none; }
.exam-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.exam-history-item:last-child { border-bottom: none; }
.exam-history-date { color: var(--text-sub); }
.exam-history-score { font-weight: 700; }
.exam-history-score.pass { color: var(--success); }
.exam-history-score.fail { color: var(--danger); }

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: calc(var(--bnav-h) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #323232;
  color: var(--white);
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 0.88rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 200;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --- Utility --- */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.bold { font-weight: 700; }
.text-sub { color: var(--text-sub); font-size: 0.85rem; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
}

/* --- Desktop Layout --- */
@media (min-width: 768px) {
  :root { --header-h: 64px; --bnav-h: 0px; }
  body { padding-bottom: 0; }
  .bottom-nav { display: none; }
  .header-inner { max-width: 900px; margin: 0 auto; padding: 0 24px; }
  .header { display: flex; align-items: center; }
  .header-title { text-align: left; }

  /* Desktop top nav embedded in header */
  .header-inner { justify-content: flex-start; gap: 0; }
  .header-title { margin-right: 32px; min-width: 140px; }
  .desktop-nav {
    display: flex;
    gap: 4px;
  }
  .desk-nav-btn {
    background: rgba(255,255,255,0.12);
    border: none;
    color: rgba(255,255,255,0.8);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    -webkit-tap-highlight-color: transparent;
  }
  .desk-nav-btn:hover { background: rgba(255,255,255,0.2); color: var(--white); }
  .desk-nav-btn.active { background: var(--white); color: var(--primary); }
  .header-spacer { display: none; }
  .back-btn { display: flex; }

  .main { padding: 24px; }
  .field-grid { grid-template-columns: repeat(3, 1fr); }
  .quiz-field-select { grid-template-columns: repeat(3, 1fr); }
  .quiz-field-btn.f-all { grid-column: span 3; }
  .quick-actions { grid-template-columns: repeat(4, 1fr); }
  .exam-dot-nav .dot { width: 32px; height: 32px; font-size: 0.75rem; }
}

/* --- Quest Mod Styles --- */
.quest-hero {
  background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%) !important;
  padding: 24px 16px !important;
}
.user-status {
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
}
.level-badge {
  background: #ffb300;
  color: #fff;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 900;
  border: 4px solid rgba(255,255,255,0.3);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.user-info { flex: 1; }
.user-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 6px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.xp-bar-wrap {
  background: rgba(255,255,255,0.2);
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 4px;
}
.xp-bar {
  background: #ffeb3b;
  height: 100%;
  transition: width 0.3s ease;
}
.xp-text {
  font-size: 0.7rem;
  opacity: 0.8;
  font-weight: 600;
}

.qa-btn.quest {
  border: 2px solid transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(to right, #6a11cb, #2575fc) border-box;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.qa-btn.quest:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(37, 117, 252, 0.2);
}

/* Level Up Overlay */
.levelup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}
.levelup-content {
  background: #fff;
  width: 85%;
  max-width: 320px;
  padding: 40px 24px;
  border-radius: 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.levelup-icon { font-size: 4rem; margin-bottom: 10px; }

/* Confetti */
.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  top: -10px;
  z-index: 1001;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(100vh) rotate(720deg); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Glossary Styles */
.glossary-term {
  border-bottom: 2px dotted #1e88e5;
  cursor: help;
  font-weight: bold;
  color: #1565c0;
  -webkit-tap-highlight-color: transparent;
}

/* Dynamic Tooltip */
.floating-tooltip {
  position: fixed;
  background: #333;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.5;
  z-index: 2000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  max-width: 280px;
  pointer-events: none;
  animation: tooltip-in 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.floating-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: var(--arrow-x, 50%);
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: #333;
}

@keyframes tooltip-in {
  from { opacity: 0; transform: translateY(10px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (min-width: 1024px) {
  .field-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Quiz Star & Progress */
.quiz-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.quiz-star-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #ccc;
  padding: 0 4px;
  transition: transform 0.2s, color 0.2s;
  line-height: 1;
}
.quiz-star-btn.active {
  color: #ffb300;
  transform: scale(1.1);
}
.quiz-star-btn:active {
  transform: scale(0.9);
}

/* Exam Review Styles */
.dot.wrong {
  background-color: #ffebee !important;
  color: #d32f2f !important;
  border-color: #ef9a9a !important;
}
.exam-option.correct {
  background-color: #e8f5e9 !important;
  border-color: #81c784 !important;
  color: #2e7d32 !important;
}
.exam-option.wrong {
  background-color: #ffebee !important;
  border-color: #ef9a9a !important;
  color: #c62828 !important;
}
.review-filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #d32f2f;
  font-weight: bold;
  cursor: pointer;
  background: #fff1f1;
  padding: 4px 10px;
  border-radius: 20px;
}
.review-filter-toggle input {
  cursor: pointer;
}

/* Toast Show */
.toast.show {
  visibility: visible;
  animation: fadein 0.5s, fadeout 0.5s 1.5s;
}
@keyframes fadein { from {bottom: 0; opacity: 0;} to {bottom: 30px; opacity: 1;} }
@keyframes fadeout { from {bottom: 30px; opacity: 1;} to {bottom: 0; opacity: 0;} }

