/* ==========================================================================
   itmoshi — 資格学習 / 刷題ステーション
   Visual language: 温暖清新 (warm & clean), Japanese education product feel.
   - High-brightness, low-saturation palette on warm off-white.
   - Rounded friendly headings (Zen Maru Gothic) + readable body (Zen Kaku).
   - Soft neutral shadows, generous radii, comfortable spacing.
   ========================================================================== */

:root {
  /* Backgrounds (clean white — note 風) */
  --bg: #ffffff;
  --bg-deep: #eef1f4;
  --bg-card: #ffffff;
  --bg-soft: #f6f8fa;
  --bg-highlight: #eef4fc;

  /* Text (slate ink) */
  --text: #1e293b;
  --text-soft: #475569;
  --text-muted: #6b7785;
  --text-faint: #9aa3af;

  /* Borders (cool light grey) */
  --line: #e7eaee;
  --line-strong: #d4dae1;
  --line-soft: #f0f2f5;

  /* Brand — classic blue (primary buttons / nav / 主基调) */
  --brand: #2563eb;
  --brand-bright: #3b82f6;
  --brand-deep: #1d4ed8;
  --brand-soft: #e3edfd;
  --brand-faint: #eff5fc;

  /* Energy — 単一のブルーアクセント（要所のみ） */
  --energy: #3b82f6;
  --energy-bright: #60a5fa;
  --energy-deep: #2563eb;
  --energy-soft: #dbe7fd;
  --energy-faint: #eff4fe;

  /* Success / mastery (calm green — 達成・正解のアクセント。青と調和する落ち着いた緑) */
  --green: #3fa06a;
  --green-bright: #57bd83;
  --green-deep: #2f7d50;
  --green-soft: #d9efe1;
  --green-faint: #eef8f1;

  /* Review needed (warm amber — 「温かみ」のアクセント) */
  --yellow: #d99a37;
  --yellow-deep: #b87d1f;
  --yellow-soft: #f7e6c4;
  --yellow-faint: #fdf6e9;

  /* Incorrect (muted red — 青・緑と同じ彩度帯に揃えた柔らかい赤) */
  --red: #d9655b;
  --red-deep: #c14a40;
  --red-soft: #f4d8d4;
  --red-faint: #fcf0ee;

  --highlight: var(--brand-faint);
  --blue: #2563eb;
  --blue-soft: #e3edfd;

  /* Soft brand-tinted shadows (清潔感・浮き上がるが派手でない) */
  --shadow-sm: 0 1px 2px rgba(37, 99, 235, 0.05);
  --shadow: 0 2px 8px rgba(37, 99, 235, 0.06), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 6px 18px rgba(37, 99, 235, 0.07), 0 2px 6px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 16px 38px rgba(30, 41, 59, 0.10), 0 4px 10px rgba(37, 99, 235, 0.05);
  --shadow-energy: 0 10px 24px rgba(59, 130, 246, 0.18);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;

  --font-round: 'Noto Sans JP', system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Segoe UI", sans-serif;
  --font-body: 'Noto Sans JP', system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  font-size: 16px;
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ==========================================================================
   Top Nav
   ========================================================================== */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 249, 246, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topnav-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.topnav-brand {
  font-family: var(--font-round);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}
.topnav-brand .brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--brand-bright), var(--brand-deep));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.32);
}
.topnav-brand b { color: var(--brand-deep); font-weight: 700; }
.brand-logo {
  display: block;
  width: 138px;
  height: 40px;
  object-fit: contain;
}
.topnav-links { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topnav a.nav-link, .topnav button.nav-link {
  font-family: var(--font-round);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 15px;
  border-radius: 999px;
  transition: all 0.15s;
  position: relative;
  border: none;
  background: none;
  cursor: pointer;
}
.topnav a.nav-link:hover, .topnav button.nav-link:hover {
  color: var(--text);
  background: var(--bg-soft);
}
.topnav a.nav-link.active {
  color: var(--brand-deep);
  background: var(--brand-soft);
  font-weight: 700;
}
.nav-badge {
  position: absolute;
  top: 1px;
  right: 4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--energy);
  color: #fff;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.lang-toggle {
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  background: var(--bg-card);
  transition: all 0.15s;
}
.lang-toggle:hover { background: var(--bg-soft); border-color: var(--brand); color: var(--brand-deep); }

@media (max-width: 640px) {
  /* 1行レイアウト: ロゴ左 + 認証ボタン右 */
  .topnav-inner {
    padding: 7px 14px;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: flex-start;
  }
  .topnav-brand {
    flex: 1 1 auto;
    justify-content: flex-start;
  }
  .brand-logo {
    width: 110px;
    height: 32px;
  }
  .topnav-links {
    display: none;
  }
  .topnav-links::-webkit-scrollbar { display: none; }
  .topnav a.nav-link,
  .topnav button.nav-link {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 6px 12px;
    font-size: 13px;
  }
  .lang-toggle {
    padding: 5px 10px;
    font-size: 11px;
  }
  #auth-ctl,
  #logout-btn {
    order: unset;
    flex: 0 0 auto;
  }
}

/* ==========================================================================
   Container & Typography
   ========================================================================== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 24px 96px;
}
.container-narrow {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 22px 96px;
}
.container-wide {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

/* friendly section header: small color label + heading */
.section-head { margin: 48px 0 20px; }
.section-head:first-of-type { margin-top: 8px; }
.section-label {
  font-family: var(--font-round);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--brand-deep);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  white-space: nowrap;
}
.section-label::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 3px;
  background: var(--brand);
}
.section-title {
  font-family: var(--font-round);
  font-size: 25px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--text);
}
.section-title .sub {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 10px;
}

.eyebrow {
  font-family: var(--font-round);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--brand-deep);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: '';
  width: 22px; height: 3px;
  background: var(--brand);
  border-radius: 2px;
}

h1.page-title {
  font-family: var(--font-round);
  font-weight: 700;
  font-size: 40px;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 14px;
}
h1.page-title em {
  font-style: normal;
  color: var(--brand);
}
.page-subtitle {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text-soft);
  margin-bottom: 18px;
}

h2 {
  font-family: var(--font-round);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-top: 44px;
  margin-bottom: 14px;
}
h3 {
  font-family: var(--font-round);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.5;
  color: var(--text);
  margin: 22px 0 10px;
}
p { color: var(--text-soft); }
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--brand-deep);
}

/* ==========================================================================
   Cards & Grids
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}
.card-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .card-grid-3, .card-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) {
  .card-grid-2, .card-grid-3, .card-grid-4 { grid-template-columns: 1fr; }
  h1.page-title { font-size: 26px; }
  .page-subtitle { font-size: 15px; }
  .section-title { font-size: 20px; }
  .container { padding: 20px 14px 80px; }
  .container-narrow { padding: 18px 14px 80px; }
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-round);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1.5px solid var(--brand);
  background: var(--brand);
  color: white;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.22);
}
.btn:hover {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.28);
}
.btn:active { transform: translateY(0); }
.btn.secondary {
  background: var(--bg-card);
  color: var(--brand-deep);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.btn.secondary:hover {
  background: var(--brand-faint);
  border-color: var(--brand);
  color: var(--brand-deep);
}
.btn.energy {
  background: var(--energy);
  border-color: var(--energy);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.26);
}
.btn.energy:hover { background: var(--energy-deep); border-color: var(--energy-deep); }
.btn.ghost {
  background: transparent;
  color: var(--text-soft);
  border-color: var(--line-strong);
  box-shadow: none;
}
.btn.ghost:hover { background: var(--bg-soft); color: var(--text); }
.btn.large { padding: 15px 30px; font-size: 16px; }
.btn.block { display: flex; width: 100%; }

/* ==========================================================================
   Home — Hero
   ========================================================================== */
.hero {
  padding: 26px 0 30px;
  margin-bottom: 8px;
}

/* Today action card (big CTA + streak) */
.today-band {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}
@media (max-width: 720px) { .today-band { grid-template-columns: 1fr; } }

.action-card {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transition: transform 0.18s, box-shadow 0.18s;
}
.action-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.action-card::after {
  content: '';
  position: absolute;
  right: -40px; bottom: -50px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.action-card .ac-label {
  font-family: var(--font-round);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0.9;
  display: flex; align-items: center; gap: 8px;
}
.action-card .ac-count {
  font-family: var(--font-round);
  font-size: 46px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}
.action-card .ac-count .unit { font-size: 20px; margin-left: 6px; font-weight: 500; opacity: 0.92; }
.action-card .ac-cta {
  align-self: flex-start;
  background: #fff;
  color: var(--brand-deep);
  font-family: var(--font-round);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}
.action-card.is-empty {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--line);
}
.action-card.is-empty .ac-label { color: var(--brand-deep); opacity: 1; }
.action-card.is-empty .ac-count { color: var(--text); }
.action-card.is-empty::after { display: none; }
.action-card.is-empty .ac-cta { background: var(--brand); color: #fff; }

.streak-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
.streak-card .sc-flame { font-size: 30px; line-height: 1; }
.streak-card .sc-num {
  font-family: var(--font-round);
  font-size: 40px;
  font-weight: 700;
  color: var(--energy-deep);
  line-height: 1;
  letter-spacing: -0.02em;
}
.streak-card .sc-num .unit { font-size: 17px; color: var(--text-muted); font-weight: 500; margin-left: 4px; }
.streak-card .sc-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.streak-card .sc-dots { display: flex; gap: 5px; margin-top: 8px; }
.streak-card .sc-dot { width: 13px; height: 13px; border-radius: 4px; background: var(--bg-deep); }
.streak-card .sc-dot.on { background: var(--energy); }

.mini-stats {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.mini-stat {
  flex: 1;
  min-width: 130px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}
.mini-stat .ms-num { font-family: var(--font-round); font-size: 24px; font-weight: 700; color: var(--text); }
.mini-stat .ms-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.mini-stat.wrong .ms-num { color: var(--red); }
.mini-stat.mastered .ms-num { color: var(--green-deep); }

/* ==========================================================================
   Search + quick bar
   ========================================================================== */
.search-wrap { position: relative; margin-bottom: 14px; }
.search-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 16px;
  padding: 15px 18px 15px 48px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text);
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.search-input::placeholder { color: var(--text-faint); }
.search-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.search-icon {
  position: absolute;
  left: 18px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 18px;
  pointer-events: none;
}

/* horizontal recent rail */
.rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.rail::-webkit-scrollbar { height: 6px; }
.rail::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
.rail-card {
  scroll-snap-align: start;
  flex: 0 0 auto;
  width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  transition: all 0.18s;
  box-shadow: var(--shadow-sm);
}
.rail-card:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.rail-card .rc-code { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--brand-deep); letter-spacing: 0.04em; }
.rail-card .rc-name { font-family: var(--font-round); font-weight: 700; font-size: 14px; margin: 4px 0 10px; color: var(--text); line-height: 1.4; }
.rail-card .rc-foot { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-muted); }
.rail-card .rc-date { font-size: 11px; color: var(--text-faint); }

/* ==========================================================================
   Categories
   ========================================================================== */
.category-section {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.category-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.category-header:hover { background: var(--bg-soft); }
.category-chevron {
  font-size: 13px;
  color: var(--text-faint);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.category-section.open .category-chevron { transform: rotate(90deg); }
.cat-dot {
  width: 12px; height: 12px; border-radius: 5px; flex-shrink: 0;
  background: var(--brand);
}
.category-title {
  font-family: var(--font-round);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text);
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.category-count {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 500;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 999px;
}
.category-due-badge {
  font-family: var(--font-round);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--energy);
  padding: 3px 10px;
  border-radius: 999px;
}
.category-body {
  padding: 0 22px 22px;
  display: none;
}
.category-section.open .category-body { display: block; }
.category-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0 0 16px;
}

/* ==========================================================================
   Exam Cards
   ========================================================================== */
.exam-card {
  display: flex;
  flex-direction: column;
  height: 100%;                 /* グリッドセルを満たし、同じ行のカード高さを揃える */
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  text-decoration: none;
  color: inherit;
  transition: all 0.18s ease;
  position: relative;
}
.exam-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.exam-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.exam-card-code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--brand-deep);
  background: var(--brand-soft);
  padding: 3px 9px;
  border-radius: 7px;
  display: inline-block;
  max-width: 100%;
  /* 長いスラッグ（AWS-CERTIFIED-…）でも折り返してカードの min-content 幅を膨らませない */
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.fav-star {
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
  color: var(--line-strong);
  cursor: pointer;
  background: none;
  border: none;
  padding: 2px;
  transition: transform 0.15s, color 0.15s;
}
.fav-star:hover { transform: scale(1.18); color: var(--yellow); }
.fav-star.on { color: var(--yellow); }
.exam-card-name {
  font-family: var(--font-round);
  font-weight: 700;
  font-size: 15px;
  margin: 12px 0 14px;
  line-height: 1.5;
  color: var(--text);
  /* タイトルを常に2行分の高さに固定（1行でも2行分確保、長い名前は省略）→ カード高さが揃う */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 3em;   /* line-height 1.5 × 2行 */
}
.exam-card-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ring { flex-shrink: 0; }
.ring-text { font-family: var(--font-round); font-size: 11px; font-weight: 700; fill: var(--text); }
.exam-card-progress-meta { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.exam-card-progress-meta b { font-family: var(--font-round); color: var(--text); }
.exam-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px dashed var(--line-strong);
  font-weight: 500;
  margin-top: auto;   /* 下端のメタ行をカード最下部に揃える（高さの余りはここで吸収） */
}
.exam-card-meta .m-due { color: var(--energy-deep); font-weight: 700; }
.exam-card-meta .m-mastered { color: var(--green-deep); font-weight: 700; }
.exam-card-recent { font-size: 11px; color: var(--text-faint); margin-top: 8px; }

/* action row under exam card (study / practice / wrong) */
.exam-card-wrap { display: flex; flex-direction: column; gap: 8px; height: 100%; }
.exam-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.exam-action {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-family: var(--font-round);
  font-size: 12px;
  font-weight: 700;
  padding: 9px 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: 1px solid var(--line-strong);
  color: var(--text-soft);
  background: var(--bg-card);
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.exam-action.practice { color: var(--brand-deep); border-color: var(--brand-soft); background: var(--brand-faint); }
.exam-action.practice:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.exam-action.study:hover { background: var(--bg-soft); border-color: var(--text-muted); color: var(--text); }
.exam-action.wrong { color: var(--red); border-color: var(--red-soft); background: var(--red-faint); }
.exam-action.wrong:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* ==========================================================================
   出題設定 (practice start screen)
   ========================================================================== */
.start-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.start-head .sh-code {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 700;
  color: var(--brand-deep); background: var(--brand-soft);
  padding: 4px 11px; border-radius: 8px;
  white-space: nowrap;
}
.start-head h1 { font-family: var(--font-round); font-size: 27px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; line-height: 1.3; }
.start-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 26px; }

.mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 640px) { .mode-grid { grid-template-columns: 1fr; } }
.mode-card {
  text-align: left;
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 22px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: all 0.18s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.mode-card:hover { border-color: var(--brand); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.mode-card.disabled { opacity: 0.5; pointer-events: none; }
.mode-card.feature { border-color: var(--brand-soft); background: var(--brand-faint); }
.mode-card .mc-icon {
  width: 44px; height: 44px;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft);
  color: var(--brand-deep);
  margin-bottom: 4px;
}
.mode-card.srs .mc-icon { background: var(--blue-soft); color: var(--blue); }
/* 誤答復習・模擬試験のアイコンも通常学習と同じブルーに統一（赤・琥珀は廃止） */
.mode-card.random .mc-icon { background: var(--bg-deep); }
.mode-card .mc-title { font-family: var(--font-round); font-size: 17px; font-weight: 700; color: var(--text); }
.mode-card .mc-desc { font-size: 13px; color: var(--text-muted); line-height: 1.65; }
.mode-card .mc-count {
  margin-top: auto;
  font-family: var(--font-round);
  font-size: 13px; font-weight: 700;
  color: var(--brand-deep);
}
.mode-card .mc-count.warn { color: var(--energy-deep); }
.mode-card .mc-count.muted { color: var(--text-faint); font-weight: 500; }

/* 会員限定モード（無料ユーザーの SRS復習 / 誤答復習 / 模擬試験） */
.mode-card.member-locked { background: var(--bg-soft); border-style: dashed; box-shadow: none; }
.mode-card.member-locked:hover { border-color: var(--yellow); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.mode-card.member-locked .mc-icon { filter: grayscale(0.5); opacity: 0.78; }
.mode-card.member-locked .mc-title { color: var(--text-muted); }
.mode-card .mc-member {
  position: absolute; top: 16px; right: 16px;
  font-family: var(--font-round); font-size: 11px; font-weight: 700;
  color: var(--yellow); background: var(--yellow-faint);
  border: 1px solid var(--yellow-soft); border-radius: 999px; padding: 3px 10px;
}
.mode-card .mc-count.member { color: var(--yellow); }

/* mock count chooser — 最下部にインライン1行で配置（他カードの mc-count と同じ高さ感に） */
.mock-config { margin-top: auto; padding: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mock-config .mc-label { font-size: 12px; font-weight: 700; color: var(--text-muted); font-family: var(--font-round); flex-shrink: 0; }
.chip-row { display: flex; gap: 7px; flex-wrap: wrap; }
.count-chip {
  font-family: var(--font-round);
  font-size: 12px; font-weight: 700;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: var(--bg-card);
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.count-chip:hover { border-color: var(--brand); }
.count-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ==========================================================================
   Quiz Page
   ========================================================================== */
.quiz-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.quiz-exit {
  font-family: var(--font-round);
  font-size: 13px; font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg-card);
  transition: all 0.15s;
  white-space: nowrap;
}
.quiz-exit:hover { background: var(--bg-soft); color: var(--text); }
.quiz-exam-title { font-family: var(--font-round); font-weight: 700; font-size: 15px; color: var(--text); flex: 1; }
.quiz-mode-badge {
  font-family: var(--font-round);
  font-size: 11px; font-weight: 700;
  padding: 4px 11px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-deep);
}
.quiz-mode-badge.wrong { background: var(--red-soft); color: var(--red); }
.quiz-mode-badge.mock { background: var(--yellow-soft); color: var(--yellow); }
.quiz-mode-badge.srs { background: var(--energy-soft); color: var(--energy-deep); }

/* 通常学習 順序ナビ（題号ジャンプ＋←/→）。ボタン類は .rm-navbtn/.rm-counter/.rm-jump を流用 */
.quiz-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }

/* dots progress for the session */
.qdots { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.qdot { width: 9px; height: 9px; border-radius: 50%; background: var(--bg-deep); transition: all 0.2s; }
.qdot.done-ok { background: var(--green); }
.qdot.done-ng { background: var(--red); }
.qdot.current { background: var(--brand); transform: scale(1.35); box-shadow: 0 0 0 3px var(--brand-soft); }

.progress-bar {
  height: 7px;
  background: var(--line-soft);
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-bright) 100%);
  transition: width 0.4s ease;
  border-radius: 999px;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

.timer-pill {
  font-family: var(--font-mono);
  font-size: 13px; font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text-soft);
}
.timer-pill.warn { background: var(--energy-faint); color: var(--energy-deep); border-color: var(--energy-soft); }

.quiz-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 30px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
@media (max-width: 640px) {
  .quiz-card { padding: 18px 14px; }
  .quiz-option { padding: 13px 14px; gap: 12px; font-size: 15px; }
  .quiz-option-id { width: 28px; height: 28px; font-size: 14px; }
}
.quiz-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-round);
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.quiz-meta .qm-domain { color: var(--brand-deep); background: var(--brand-faint); padding: 3px 10px; border-radius: 999px; }
.quiz-meta .qm-topic { color: var(--text-muted); }
.quiz-meta-spacer { flex: 1; }

/* stem lang controls */
.stem-langbar { display: flex; gap: 6px; margin-bottom: 12px; }
.stem-langbtn {
  font-family: var(--font-round);
  font-size: 12px; font-weight: 700;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.stem-langbtn:hover { border-color: var(--brand); color: var(--brand-deep); }
.stem-langbtn.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.quiz-stem {
  font-size: 19px;
  line-height: 1.65;
  margin-bottom: 22px;
  font-weight: 500;
  color: var(--text);
}
@media (max-width: 640px) { .quiz-stem { font-size: 16px; line-height: 1.6; margin-bottom: 18px; } }
/* 题干を段落に分けて表示。行高を詰めた分、段間距は margin で維持して段落の区切りを保つ。 */
.quiz-stem p { margin: 0 0 0.7em; }
.quiz-stem p:last-child { margin-bottom: 0; }
.quiz-stem .stem-secondary {
  display: block;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-strong);
  font-size: 16px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.6;
}
.quiz-stem-img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin: 12px 0;
  display: block;
}

.quiz-multi-hint {
  margin: 4px 0 16px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  background: var(--brand-faint);
  border: 1px solid var(--brand-soft);
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-deep);
}

.quiz-options { display: flex; flex-direction: column; gap: 11px; }
.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 18px 20px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 16px;
  line-height: 1.7;
}
.quiz-option:hover { border-color: var(--brand); background: var(--brand-faint); }
.quiz-option.selected { border-color: var(--brand); background: var(--brand-faint); }
.quiz-option.correct { border-color: var(--green); background: var(--green-faint); }
.quiz-option.incorrect { border-color: var(--red); background: var(--red-faint); }
.quiz-option.correct.missed {
  border-style: dashed;
  border-color: var(--yellow);
  background: var(--yellow-faint);
}
.quiz-option-id {
  font-family: var(--font-round);
  font-weight: 700;
  font-size: 16px;
  color: var(--brand-deep);
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--brand-soft);
  display: flex; align-items: center; justify-content: center;
}
.quiz-option.correct .quiz-option-id { color: #fff; background: var(--green); }
.quiz-option.incorrect .quiz-option-id { color: #fff; background: var(--red); }
.quiz-option.correct.missed .quiz-option-id { color: var(--yellow); background: var(--yellow-soft); }
.quiz-option-text { flex: 1; min-width: 0; color: var(--text); overflow-wrap: anywhere; word-break: break-word; }
.quiz-option-tag {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 11px;
  border-radius: 999px;
  font-family: var(--font-round);
  font-size: 12px;
  font-weight: 700;
}
.quiz-option-tag.tag-correct   { color: var(--green-deep); background: var(--green-soft); }
.quiz-option-tag.tag-incorrect { color: var(--red);   background: var(--red-soft); }
.quiz-option-tag.tag-missed    { color: var(--yellow); background: var(--yellow-soft); }
.quiz-option-explain {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-strong);
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  display: none;
}
.quiz-option.show-explain .quiz-option-explain { display: block; }

/* verdict banner */
.quiz-verdict {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-round);
  font-size: 21px;
  font-weight: 700;
}
.quiz-verdict.ok { color: var(--green-deep); background: var(--green-faint); border: 1.5px solid var(--green); }
.quiz-verdict.ng { color: var(--red);   background: var(--red-faint);   border: 1.5px solid var(--red); }
.quiz-verdict-sub { font-size: 13px; font-weight: 500; color: var(--text-muted); }

.quiz-explanation {
  margin-top: 24px;
  padding: 22px;
  background: var(--bg-soft);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  display: none;
}
.quiz-explanation.show { display: block; animation: fadeUp 0.3s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.quiz-explanation h4 {
  font-family: var(--font-round);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--brand-deep);
}
.quiz-explanation p { margin-bottom: 10px; font-size: 15px; color: var(--text-soft); line-height: 1.85; }
.quiz-explanation a { color: var(--brand-deep); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--brand-soft); }
.quiz-explanation a:hover { border-bottom-color: var(--brand); }

/* collapsible reference block */
.collapsible { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.collapsible-toggle {
  font-family: var(--font-round);
  font-size: 13px; font-weight: 700;
  color: var(--text-soft);
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0;
}
.collapsible-toggle .chev { transition: transform 0.2s; font-size: 11px; color: var(--text-faint); }
.collapsible.open .collapsible-toggle .chev { transform: rotate(90deg); }
.collapsible-body { display: none; padding-top: 10px; }
.collapsible.open .collapsible-body { display: block; }

.quiz-actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.quiz-submit-btn { font-family: var(--font-round); }
.quiz-submit-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.quiz-submit-btn:disabled:hover { background: var(--brand); border-color: var(--brand); transform: none; }

/* quality rating */
.quality-prompt {
  font-family: var(--font-round);
  font-size: 13px; font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.quality-rating { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
@media (max-width: 600px) { .quality-rating { grid-template-columns: repeat(2, 1fr); } }
.quality-btn {
  padding: 14px 8px;
  text-align: center;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  font-family: var(--font-round);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-soft);
  transition: all 0.15s;
  min-height: 48px;
}
.quality-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.quality-btn.q-0 { border-color: var(--red-soft); color: var(--red); }
.quality-btn.q-0:hover { background: var(--red-faint); border-color: var(--red); }
.quality-btn.q-1 { border-color: var(--yellow-soft); color: var(--yellow); }
.quality-btn.q-1:hover { background: var(--yellow-faint); border-color: var(--yellow); }
.quality-btn.q-2 { border-color: var(--brand-soft); color: var(--brand-deep); }
.quality-btn.q-2:hover { background: var(--brand-faint); border-color: var(--brand); }
.quality-btn.q-3 { border-color: var(--green-soft); color: var(--green-deep); }
.quality-btn.q-3:hover { background: var(--green-faint); border-color: var(--green); }
.quality-btn.chosen { animation: pop 0.32s ease; color: #fff; }
.quality-btn.q-0.chosen { background: var(--red); border-color: var(--red); }
.quality-btn.q-1.chosen { background: var(--yellow); border-color: var(--yellow); }
.quality-btn.q-2.chosen { background: var(--brand); border-color: var(--brand); }
.quality-btn.q-3.chosen { background: var(--green); border-color: var(--green); }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.09); } 100% { transform: scale(1); } }

.sim-badge { background: var(--yellow); color: #fff; border-radius: 999px; padding: 3px 10px; font-family: var(--font-round); font-size: 11px; font-weight: 700; }
.visual-tag { background: var(--brand); color: #fff; border-radius: 999px; padding: 3px 10px; font-family: var(--font-round); font-size: 11px; font-weight: 700; }

/* ===== HOTSPOT (mobile-first card rows) ===== */
.vh-row {
  padding: 16px 18px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
  margin-bottom: 12px;
  transition: border-color 0.15s;
}
.vh-row.answered-ok { border-color: var(--green); background: var(--green-faint); }
.vh-row.answered-ng { border-color: var(--red); background: var(--red-faint); }
.vh-num {
  font-family: var(--font-round); font-size: 11px; font-weight: 700;
  color: var(--text-faint); margin-bottom: 6px;
}
.vh-stmt { font-size: 16px; line-height: 1.7; margin-bottom: 14px; color: var(--text); }
.vh-opts { display: flex; gap: 10px; flex-wrap: wrap; }
.vh-opt {
  flex: 1 1 150px;
  min-width: 0;
  min-height: 48px;
  padding: 12px 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-soft);
  cursor: pointer;
  font-family: var(--font-round);
  font-size: 15px;
  font-weight: 700;
  transition: all 0.15s;
  /* 長い URL など空白を含まない文字列でも枠内で折り返す（はみ出し/見切れ防止）。 */
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: center;
  line-height: 1.4;
}
.vh-opt:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-faint); }
.vh-opt.selected { background: var(--brand); color: #fff; border-color: var(--brand); }
.vh-opt.correct { background: var(--green); color: #fff; border-color: var(--green); }
.vh-opt.incorrect { background: var(--red); color: #fff; border-color: var(--red); }
.vh-opt:disabled { cursor: default; }

/* ===== DRAG & DROP (tap to order + undo) ===== */
.vd-wrap { margin: 8px 0; }
.vd-label {
  font-family: var(--font-round);
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  color: var(--text-muted); margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.vd-undo {
  font-family: var(--font-round);
  font-size: 12px; font-weight: 700;
  color: var(--text-muted);
  background: none; border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 4px 12px; cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.vd-undo:hover:not(:disabled) { border-color: var(--energy); color: var(--energy-deep); }
.vd-undo:disabled { opacity: 0.4; cursor: not-allowed; }
.vd-answer {
  display: flex; flex-direction: column; gap: 8px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 56px;
  background: var(--bg-soft);
  margin-bottom: 18px;
}
.vd-answer.empty::before {
  content: '下の選択肢を順番にタップ';
  color: var(--text-faint);
  font-size: 13px;
  align-self: center;
  padding: 8px 0;
}
.vd-pool { display: flex; flex-direction: column; gap: 9px; }
.vd-chip {
  text-align: left;
  padding: 14px 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  line-height: 1.5;
  min-height: 48px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.vd-chip:hover:not(.used) { border-color: var(--brand); background: var(--brand-faint); }
.vd-chip.used { opacity: 0.35; cursor: default; }
.vd-chip.placed { background: var(--brand-faint); border-color: var(--brand-soft); }
.vd-chip .vd-order {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-family: var(--font-round);
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.vd-key { margin-top: 4px; margin-bottom: 16px; }
.vd-correct {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--green-faint);
  border: 1px solid var(--green-soft);
  color: var(--green-deep);
  margin-bottom: 7px;
  font-size: 14px;
  display: flex; align-items: center; gap: 10px;
}
.vd-correct .vd-order { background: var(--green); }

/* ===== SIMULATION ===== */
.sim-key { margin: 8px 0 0; }
.sim-ans-text {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--yellow-faint);
  border: 1px solid var(--yellow-soft);
  color: var(--text);
  font-size: 15px;
  line-height: 1.85;
}
.sim-reason { margin-top: 10px; font-size: 14px; color: var(--text-muted); line-height: 1.75; }
.answer-uncertain-note { margin-top: 10px; padding: 8px 12px; font-size: 13.5px; line-height: 1.7;
  color: #8a5a00; background: #fff7e6; border: 1px solid #ffd591; border-radius: 8px; }

/* session complete */
.complete-card { text-align: center; padding: 54px 30px; }
.complete-emoji { font-size: 58px; margin-bottom: 6px; }
.complete-title { font-family: var(--font-round); font-size: 26px; font-weight: 700; color: var(--text); margin: 4px 0 26px; }
.complete-stats { display: flex; gap: 28px; justify-content: center; margin: 0 0 30px; flex-wrap: wrap; }
.complete-stat .cs-num { font-family: var(--font-round); font-size: 38px; font-weight: 700; line-height: 1; }
.complete-stat .cs-label { font-family: var(--font-round); font-size: 12px; color: var(--text-muted); font-weight: 700; margin-top: 6px; }

/* ==========================================================================
   PDF reader
   ========================================================================== */
.pdf-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.pdf-exam-name { font-family: var(--font-round); font-weight: 700; font-size: 16px; color: var(--text); flex: 1; }
.pdf-readtime {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 600;
  color: var(--text-soft);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 5px 12px; border-radius: 999px;
}
.pdf-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.pdf-tab {
  padding: 8px 16px;
  font-family: var(--font-round);
  font-size: 13px; font-weight: 700;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.pdf-tab:hover { border-color: var(--brand); color: var(--brand-deep); }
.pdf-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pdf-pagebar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.pdf-pagebtn {
  font-family: var(--font-round);
  font-size: 14px; font-weight: 700;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--bg-card);
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.pdf-pagebtn:hover:not(:disabled) { background: var(--brand); color: #fff; border-color: var(--brand); }
.pdf-pagebtn:disabled { opacity: 0.4; cursor: not-allowed; }
.pdf-pageinput {
  width: 56px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 14px; font-weight: 600;
  padding: 7px 4px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
}
.pdf-pageinput:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.pdf-pagetotal { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }
.pdf-pagebar-spacer { flex: 1; }
.pdf-frame {
  width: 100%;
  height: calc(100vh - 240px);
  min-height: 460px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Stats — heatmap, weak domains
   ========================================================================== */
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.metric-label { font-family: var(--font-round); font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.metric-value { font-family: var(--font-round); font-weight: 700; font-size: 34px; line-height: 1.1; color: var(--brand-deep); letter-spacing: -0.02em; }
.metric-value .unit { font-size: 14px; color: var(--text-muted); font-weight: 500; margin-left: 4px; }
#stats-overview .metric-card:nth-child(2) .metric-value { color: var(--energy-deep); }
#stats-overview .metric-card:nth-child(3) .metric-value { color: var(--green-deep); }

.heatmap {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.heat-cell {
  width: 100%;
  aspect-ratio: 1;
  min-width: 11px;
  border-radius: 3px;
  background: var(--bg-deep);
}
.heat-cell.l1 { background: #cfe0fb; }
.heat-cell.l2 { background: #93b4f7; }
.heat-cell.l3 { background: var(--brand-bright); }
.heat-cell.l4 { background: var(--brand-deep); }
.heat-legend { display: flex; align-items: center; gap: 6px; justify-content: flex-end; margin-top: 10px; font-size: 12px; color: var(--text-muted); }
.heat-legend .heat-cell { width: 12px; aspect-ratio: 1; }

.weak-list { display: flex; flex-direction: column; gap: 12px; }
.weak-row {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}
.weak-row-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.weak-name { font-family: var(--font-round); font-weight: 700; font-size: 15px; color: var(--text); }
.weak-pct { font-family: var(--font-round); font-weight: 700; font-size: 15px; }
.weak-bar { height: 9px; background: var(--bg-deep); border-radius: 999px; overflow: hidden; }
.weak-bar-fill { height: 100%; border-radius: 999px; transition: width 0.5s; }

table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}
table.data th {
  background: var(--bg-soft);
  color: var(--text);
  font-family: var(--font-round);
  font-weight: 700;
  font-size: 12px;
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
table.data td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-soft);
  vertical-align: middle;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--bg-soft); }

/* ==========================================================================
   Loading / Empty
   ========================================================================== */
.loading-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 70px 24px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-muted);
  min-height: 220px;
}
.loading-spinner {
  width: 42px; height: 42px;
  border: 3px solid var(--brand-soft);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 13px; font-weight: 600; color: var(--text-soft); }
@media (prefers-reduced-motion: reduce) { .loading-spinner { animation-duration: 1.6s; } }

.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}
.empty-state-icon {
  font-size: 40px;
  margin-bottom: 14px;
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 78px; height: 78px;
  background: var(--brand-faint);
  border-radius: 50%;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  margin-top: 70px;
  padding: 30px 24px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.footer b { color: var(--brand-deep); font-family: var(--font-round); }
.footer-links { display:flex; flex-wrap:wrap; justify-content:center; gap:8px 0; margin-bottom:10px; }
.footer-links a { color: var(--text-muted); text-decoration:none; padding:0 14px; border-right:1px solid var(--line); white-space:nowrap; }
.footer-links a:last-child { border-right:0; }
.footer-links a:hover { color: var(--brand-deep); }
.footer-copy { color: var(--text-muted); }

/* 法務・案内ページ（contact/terms/privacy/特商法） */
.legal { max-width: 760px; margin: 0 auto; padding: 10px 4px 40px; }
.legal h1 { font-family: var(--font-round); margin-bottom: 6px; }
.legal .legal-lead { color: var(--text-muted); font-size: 14px; margin-bottom: 26px; }
.legal h2 { font-size: 16px; margin: 28px 0 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.legal p, .legal li { font-size: 14px; line-height: 1.85; color: var(--text); }
.legal ul, .legal ol { padding-left: 1.3em; }
.legal .legal-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.legal .legal-table th, .legal .legal-table td { text-align: left; vertical-align: top; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.legal .legal-table th { width: 34%; color: var(--text-muted); font-weight: 600; background: var(--surface, transparent); white-space: nowrap; }
.legal .legal-updated { margin-top: 30px; font-size: 12px; color: var(--text-muted); }
.legal .field { margin-bottom: 14px; }
.legal .field label { display:block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.legal .field input, .legal .field textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 14px; background: var(--surface, #fff); }
.legal .field textarea { min-height: 160px; resize: vertical; }
.legal .form-msg { font-size: 14px; margin-top: 12px; }
.legal .form-msg.ok { color: #166534; }
.legal .form-msg.ng { color: #b91c1c; }

/* ==========================================================================
   v3 — Auth / Catalog / MyLearn / Account / Activation / Marquee
   ========================================================================== */

/* ---- nav login pill ---- */
.topnav a.nav-link.nav-login {
  border: 1.5px solid var(--brand);
  color: var(--brand-deep);
  font-weight: 700;
}
.topnav a.nav-link.nav-login:hover { background: var(--brand); color: #fff; }

/* ---- Home hero CTAs + logo marquee ---- */
.home-ctas { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 8px; }

/* ---- Home hero: trust stats + popular certs + reassurance ---- */
.hero-stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 22px 0 4px; }
.hero-stat {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 20px; box-shadow: var(--shadow-sm);
}
.hero-stat .hs-num {
  font-family: var(--font-round); font-weight: 700; font-size: 27px; line-height: 1;
  letter-spacing: -0.02em; color: var(--brand-deep);
}
.hero-stat .hs-num .unit { font-size: 15px; font-weight: 700; color: var(--brand); margin-left: 2px; }
.hero-stat .hs-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.hero-stat.alt .hs-num { color: var(--brand-deep); }
.hero-stat.alt2 .hs-num { color: var(--text); }

.hero-trust {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin: 16px 0 2px; font-size: 12.5px; font-weight: 600; color: var(--text-muted);
}
.hero-trust .ht-item { display: inline-flex; align-items: center; gap: 6px; }
.hero-trust .ic { color: var(--brand); }

.pop-certs { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin: 22px 0 2px; }
.pop-certs .pc-label {
  font-family: var(--font-round); font-size: 12px; font-weight: 700;
  color: var(--text-muted); margin-right: 2px; white-space: nowrap;
}
.pop-cert {
  font-family: var(--font-round); font-size: 13px; font-weight: 700;
  color: var(--text-soft); text-decoration: none;
  background: var(--bg-card); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 7px 15px; transition: all 0.15s; white-space: nowrap;
}
.pop-cert:hover { border-color: var(--brand); color: var(--brand-deep); background: var(--brand-faint); transform: translateY(-1px); }
.pop-cert .pc-code { font-family: var(--font-mono); font-size: 11px; color: var(--brand-deep); margin-right: 5px; }

/* ---- 3-step cards: leading icon chip ---- */
.step-ic {
  width: 42px; height: 42px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand-deep); margin-bottom: 10px;
}
.logo-marquee {
  margin: 36px 0 32px;
  overflow: hidden;
  width: 100%;
  min-height: 58px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16%, #000 84%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 16%, #000 84%, transparent 100%);
}
.marquee-track {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 18px;
  width: max-content;
  animation: marquee 96s linear infinite;
  will-change: transform;
}
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .marquee-track { animation-duration: 160s; } }
.logo-chip {
  flex: 0 0 auto;
  font-family: var(--font-round);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.01em;
  color: var(--text-faint);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 110px;
  height: 58px;
  padding: 0 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  filter: grayscale(1);
}
.marquee-label { text-align: center; font-size: 12px; color: var(--text-faint); margin-top: 12px; font-weight: 600; }

/* ---- Catalog: vendor sidebar + main ---- */
.catalog-layout { display: grid; grid-template-columns: 240px 1fr; gap: 26px; align-items: start; }
@media (max-width: 820px) { .catalog-layout { grid-template-columns: 1fr; } }
/* 1fr トラックの既定 min-width:auto を 0 にして、中のカードグリッドがトラック幅を超えて
   右へはみ出す（横スクロール）のを防ぐ。 */
#catalog-main { min-width: 0; }
/* カタログのカードは固定 3 列ではなく、入る分だけ並べて溢れたら下へ折り返す（レスポンシブ）。 */
.vendor-section .card-grid-3 { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.catalog-side {
  position: sticky; top: 78px;
  display: flex; flex-direction: column; gap: 3px;
  max-height: calc(100vh - 100px); overflow-y: auto;
}
@media (max-width: 820px) {
  .catalog-side { position: static; flex-direction: row; overflow-x: auto; max-height: none; padding-bottom: 8px; gap: 8px; }
}
.vendor-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 12px;
  text-decoration: none; color: var(--text-soft);
  font-family: var(--font-round); font-weight: 700; font-size: 14px;
  transition: all 0.15s; white-space: nowrap; border: 1px solid transparent;
}
.vendor-link:hover { background: var(--bg-soft); }
.vendor-link.active { background: var(--brand-soft); color: var(--brand-deep); }
.vendor-rank {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 7px;
  background: var(--bg-deep); color: var(--text-muted);
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.vendor-link.active .vendor-rank { background: var(--brand); color: #fff; }
.vendor-link-name { flex: 1; }
.vendor-num { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.vendor-section { margin-bottom: 40px; scroll-margin-top: 80px; }
.vendor-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.vendor-mark {
  font-family: var(--font-round); font-weight: 700; font-size: 14px;
  color: var(--text-muted); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 12px;
  filter: grayscale(1);
}
.vendor-head h2 { margin: 0; font-size: 21px; }
.vendor-count { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); white-space: nowrap; }
.act-dot { color: var(--green); font-size: 9px; vertical-align: middle; }

/* ---- big action (PDF) ---- */
.big-action {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-card); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 18px 22px;
  text-decoration: none; color: inherit; transition: all 0.18s;
  box-shadow: var(--shadow-sm);
}
.big-action:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.big-action.disabled { opacity: 0.55; pointer-events: none; }
.big-action .ba-icon { font-size: 26px; flex: 0 0 auto; width: 50px; height: 50px; border-radius: 14px; background: var(--brand-soft); display: flex; align-items: center; justify-content: center; }
.big-action .ba-text { flex: 1; display: flex; flex-direction: column; }
.big-action .ba-text b { font-family: var(--font-round); font-size: 16px; color: var(--text); }
.big-action .ba-text small { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.big-action .ba-arrow { font-size: 20px; color: var(--brand); }

/* ---- access banner (paywall state) ---- */
.access-banner {
  margin-top: 14px; padding: 13px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; line-height: 1.6;
}
.access-banner.ok { background: var(--green-faint); border: 1px solid var(--green-soft); color: var(--green-deep); font-weight: 700; }
.access-banner.free { background: var(--yellow-faint); border: 1px solid var(--yellow-soft); color: var(--text-soft); }
.access-banner a { color: var(--brand-deep); font-weight: 700; text-decoration: none; border-bottom: 1px solid var(--brand-soft); white-space: nowrap; }

.fav-star.big { font-size: 26px; margin-left: auto; }

/* 「購入済みの試験」行（デスクトップ=横並び、モバイル=縦積み@640px） */
.owned-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg-card); text-decoration: none; color: inherit;
}
.owned-row.expired { opacity: 0.55; }
.owned-row-main { min-width: 0; }
.owned-row-name { font-family: var(--font-round); font-weight: 700; }
.owned-row-code { font-size: 12px; color: var(--text-muted); }
.owned-row-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.owned-row-exp { font-size: 12px; color: var(--text-muted); }

/* ---- Purchase card (講座購入パネル) — brand hero, full-width banner ---- */
.buy-card {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 34px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  border-radius: var(--radius-lg);
  padding: 26px 34px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.buy-card::after {
  content: ''; position: absolute; right: -40px; top: 50%; transform: translateY(-50%);
  width: 240px; height: 240px; border-radius: 50%; background: rgba(255, 255, 255, 0.08);
}
.buy-main { flex: 1 1 440px; min-width: 0; position: relative; z-index: 1; }
.buy-action {
  flex: 0 0 auto; min-width: 240px;
  display: flex; flex-direction: column; gap: 12px;
  position: relative; z-index: 1;
}
.buy-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-round); font-weight: 700; font-size: 12px; letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.16); border-radius: 999px; padding: 5px 13px;
}
.buy-price-row { display: flex; align-items: baseline; gap: 6px; margin: 14px 0 2px; flex-wrap: wrap; }
.buy-price { font-family: var(--font-round); font-weight: 800; font-size: 42px; letter-spacing: -0.02em; line-height: 1; }
.buy-price-soon { font-family: var(--font-round); font-weight: 800; font-size: 24px; opacity: 0.92; line-height: 1; }
.buy-price-tax { font-size: 13px; opacity: 0.85; font-weight: 600; margin-left: 4px; }
.buy-benefits { display: flex; flex-wrap: wrap; gap: 9px 24px; margin: 16px 0 0; }
.buy-benefit { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; line-height: 1.4; }
.buy-benefit .ic { opacity: 0.95; flex-shrink: 0; }
.buy-benefit b { font-weight: 800; }
.buy-note { margin-top: 14px; font-size: 12px; line-height: 1.6; opacity: 0.82; }
.buy-cta { width: 100%; background: #fff; color: var(--brand-deep); border-color: #fff; }
.buy-cta:hover:not(:disabled) { background: var(--bg-soft); border-color: var(--bg-soft); color: var(--brand-deep); }
.buy-cta:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: 0 2px 8px rgba(15,23,42,0.22); }
.buy-foot-note { font-size: 12px; opacity: 0.85; text-align: center; line-height: 1.6; }
.buy-foot-note a { color: #fff; font-weight: 700; text-decoration: underline; }

@media (max-width: 640px) {
  .buy-card { gap: 22px; padding: 24px 22px; }
  .buy-action { min-width: 100%; }
}

/* ---- 汎用モーダル（PDF版选择 / 購入感謝 など） ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; transition: opacity 0.18s ease;
}
.modal-overlay.show { opacity: 1; }
.modal-card {
  position: relative; width: 100%; max-width: 420px;
  background: var(--bg-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 26px 26px 22px;
  transform: translateY(8px) scale(0.98); transition: transform 0.18s ease;
}
.modal-overlay.show .modal-card { transform: none; }
.modal-close {
  position: absolute; top: 12px; right: 14px;
  width: 32px; height: 32px; border: none; background: transparent;
  font-size: 24px; line-height: 1; color: var(--text-faint); cursor: pointer;
  border-radius: 8px; transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--bg-soft); color: var(--text); }
.modal-title { font-family: var(--font-round); font-weight: 800; font-size: 19px; color: var(--text); padding-right: 28px; }
.modal-body { margin-top: 12px; font-size: 14px; color: var(--text-soft); line-height: 1.7; }
.modal-actions { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }

/* ---- お知らせ（站内信）一覧 ---- */
.notice-list { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; }
.notice-item {
  border: 1px solid var(--border, #e5e7eb); border-radius: var(--radius, 12px);
  padding: 12px 14px; background: var(--bg-soft);
}
.notice-item.unread { border-left: 3px solid var(--energy); background: var(--bg-card); }
.notice-title { font-weight: 700; color: var(--text); font-size: 14px; }
.notice-body { margin-top: 4px; font-size: 13px; color: var(--text-soft); line-height: 1.7; white-space: pre-wrap; }
.notice-time { margin-top: 6px; font-size: 11px; color: var(--text-faint); }

/* ---- PDF paywall ---- */
.pdf-paywall { display: none; align-items: center; justify-content: center; margin-bottom: 12px; }
.pdf-paywall .pw-inner {
  display: flex; align-items: center; gap: 16px; width: 100%;
  background: var(--yellow-faint); border: 1px solid var(--yellow-soft);
  border-radius: var(--radius); padding: 16px 20px;
}
.pdf-paywall .pw-lock { font-size: 26px; }
.pdf-paywall b { font-family: var(--font-round); font-size: 15px; display: block; }
.pdf-paywall small { color: var(--text-muted); font-size: 13px; }
.pdf-paywall .btn { margin-left: auto; white-space: nowrap; }

/* ---- Account / Activation ---- */
.act-form { display: flex; gap: 10px; flex-wrap: wrap; }
.act-form .search-input { flex: 1; min-width: 220px; }
.act-form .btn { flex: 0 0 auto; }
.act-msg { margin-top: 12px; font-size: 14px; font-weight: 600; min-height: 20px; }
.act-msg.ok { color: var(--green-deep); }
.act-msg.ng { color: var(--red); }
.act-list { display: flex; flex-direction: column; gap: 10px; }
.act-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow-sm);
}
.act-row.expired { opacity: 0.6; }
.act-row-name b { font-family: var(--font-round); font-size: 15px; display: block; color: var(--text); }
.act-row-name small { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.act-status { font-family: var(--font-round); font-weight: 700; font-size: 13px; color: var(--brand-deep); white-space: nowrap; }
.act-row.expired .act-status { color: var(--red); }

/* ---- Auth pages ---- */
.auth-wrap { max-width: 420px; margin: 0 auto; padding: 56px 22px 80px; }
.auth-brand { text-align: center; margin-bottom: 30px; }
.auth-brand-logo {
  display: block;
  width: min(230px, 74vw);
  height: 68px;
  object-fit: contain;
  margin: 0 auto 14px;
}
.auth-brand .brand-mark {
  width: 52px; height: 52px; border-radius: 16px; font-size: 26px;
  background: linear-gradient(140deg, var(--brand-bright), var(--brand-deep));
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: 0 6px 16px rgba(15,23,42,0.32); margin-bottom: 14px;
}
.auth-brand h1 { font-family: var(--font-round); font-size: 24px; font-weight: 700; }
.auth-brand p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.auth-card { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 30px; box-shadow: var(--shadow); }
.auth-field { margin-bottom: 16px; }
.auth-field label { display: block; font-family: var(--font-round); font-weight: 700; font-size: 13px; color: var(--text-soft); margin-bottom: 7px; }
.auth-field input {
  width: 100%; font-family: var(--font-body); font-size: 16px;
  padding: 13px 16px; border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text);
}
.auth-field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.auth-msg { min-height: 20px; font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.auth-msg.ng { color: var(--red); }
.auth-foot { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text-muted); }
.auth-foot a { color: var(--brand-deep); font-weight: 700; text-decoration: none; }
.auth-note { text-align: center; font-size: 12px; color: var(--text-faint); margin-top: 18px; line-height: 1.6; }

/* ==========================================================================
   オンライン通読モード (read-through)  — reuses existing tokens/components
   ========================================================================== */
.rm-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.rm-exam-name { font-family: var(--font-round); font-weight: 700; font-size: 16px; color: var(--text); flex: 1; min-width: 0; }
.rm-progress {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 600;
  color: var(--text-soft);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 5px 12px; border-radius: 999px; white-space: nowrap;
}
.rm-progress.ok { background: var(--green-faint); border-color: var(--green-soft); color: var(--green-deep); font-weight: 700; }

/* intro/access banner spacing on readmode reuses .access-banner */
.rm-intro { margin: 12px 0 20px; }

/* sticky read-mode language bar */
.rm-langbar { position: sticky; top: 64px; z-index: 20; display: flex; gap: 6px; padding: 10px 0; margin-bottom: 6px; background: rgba(250,249,246,0.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
@media (max-width: 640px) { .rm-langbar { top: 48px; } }

/* chapter heading between domains — reuses .section-head look */
.rm-chapter { margin: 34px 0 14px; }
.rm-chapter:first-of-type { margin-top: 10px; }

/* per-question number label above each card */
.rm-qnum {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-round); font-weight: 700; font-size: 13px;
  color: var(--brand-deep); margin: 0 2px 8px;
}
.rm-qnum .rm-qid { font-family: var(--font-mono); font-weight: 600; font-size: 11px; color: var(--text-faint); }

.rm-q { margin-bottom: 18px; }

/* the "正解: X" line under MCQ options */
.rm-answer {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 16px; padding: 12px 16px;
  background: var(--green-faint); border: 1px solid var(--green-soft);
  border-radius: var(--radius-sm);
}
.rm-answer-label { font-family: var(--font-round); font-weight: 700; font-size: 13px; color: var(--green-deep); }
.rm-answer-key {
  font-family: var(--font-round); font-weight: 700; font-size: 15px; letter-spacing: 0.06em;
  color: #fff; background: var(--green); padding: 3px 12px; border-radius: 999px;
}
.rm-vote {
  font-family: var(--font-round); font-size: 12px; font-weight: 700;
  color: var(--text-muted); background: var(--bg-card);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px;
  margin-left: auto;
}

/* read-only hotspot rows: non-interactive option pills */
.vh-opt.static { cursor: default; }
.vh-opt.static:hover { border-color: var(--line-strong); background: var(--bg-card); }
.vh-opt.static.correct:hover { border-color: var(--green); background: var(--green); }

/* explanation always open in read-through */
.rm-q .quiz-explanation { display: block; margin-top: 20px; }

/* ---- 3-entry hero on mylearn ---- */
.entry-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 6px; }
@media (max-width: 760px) { .entry-grid { grid-template-columns: 1fr; } }
.entry-card {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--bg-card); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 20px 20px 18px;
  text-decoration: none; color: inherit; transition: all 0.18s; position: relative;
  box-shadow: var(--shadow-sm);
}
.entry-card:hover { border-color: var(--brand); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.entry-card.feature { border-color: var(--brand-soft); background: var(--brand-faint); }
.entry-card.locked { background: var(--bg-soft); }
.entry-card.locked:hover { transform: none; border-color: var(--yellow-soft); box-shadow: var(--shadow-sm); }
.entry-icon {
  width: 44px; height: 44px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: var(--brand-soft); margin-bottom: 4px;
}
.entry-card.practice .entry-icon { background: var(--energy-soft); }
.entry-card.locked .entry-icon { background: var(--yellow-soft); }
.entry-title { font-family: var(--font-round); font-size: 17px; font-weight: 700; color: var(--text); }
.entry-desc { font-size: 13px; color: var(--text-muted); line-height: 1.65; flex: 1; }
.entry-foot {
  font-family: var(--font-round); font-size: 12px; font-weight: 700;
  margin-top: 8px; display: inline-flex; align-items: center; gap: 6px;
}
.entry-foot.free { color: var(--brand-deep); }
.entry-foot.member { color: var(--yellow); }
.entry-foot.go { color: var(--brand-deep); }
.entry-tag {
  position: absolute; top: 14px; right: 14px;
  font-family: var(--font-round); font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  padding: 3px 9px; border-radius: 999px;
}
.entry-tag.free { color: var(--brand-deep); background: var(--brand-soft); }
.entry-tag.member { color: var(--yellow); background: var(--yellow-soft); }

/* ---- membership wall / paywall block (readmode end + PDF download) ---- */
.rm-paywall {
  text-align: center;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  border-radius: var(--radius-lg); padding: 40px 30px 34px;
  color: #fff; box-shadow: var(--shadow-md); position: relative; overflow: hidden;
  margin-top: 8px;
}
.rm-paywall::after {
  content: ''; position: absolute; right: -50px; bottom: -60px;
  width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,0.08);
}
.rm-paywall .pw-lock { font-size: 44px; line-height: 1; margin-bottom: 10px; }
.rm-paywall .pw-title { font-family: var(--font-round); font-size: 24px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.01em; }
.rm-paywall .pw-sub { font-size: 15px; line-height: 1.7; opacity: 0.92; max-width: 460px; margin: 0 auto 22px; }
.rm-benefits {
  display: flex; flex-direction: column; gap: 10px; text-align: left;
  max-width: 380px; margin: 0 auto 24px; position: relative; z-index: 1;
}
.rm-benefit {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.12); border-radius: var(--radius-sm); padding: 12px 16px;
  font-family: var(--font-round); font-weight: 700; font-size: 14px;
}
.rm-benefit .rb-ico { font-size: 18px; }
.rm-paywall .pw-ctas { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; position: relative; z-index: 1; }
.rm-paywall .btn.on-brand { background: #fff; color: var(--brand-deep); border-color: #fff; }
.rm-paywall .btn.on-brand:hover { background: var(--bg-soft); border-color: var(--bg-soft); }
.rm-paywall .btn.on-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,0.6); box-shadow: none; }
.rm-paywall .btn.on-ghost:hover { background: rgba(255,255,255,0.12); border-color: #fff; }

/* fixes/hardening for read-through reuse */
.vd-correct .vd-order {
  width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-round); font-size: 13px; font-weight: 700; color: #fff;
}
.quiz-option-tag { white-space: nowrap; }
.visual-tag, .sim-badge { white-space: nowrap; }
.rm-qnum span:first-child { white-space: nowrap; }
.rm-qnum .rm-qid { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* mylearn: 2-up entry grid + equal-height mode cards */
.entry-grid.two { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 760px) { .entry-grid.two { grid-template-columns: 1fr; } }
.mode-card { height: 100%; }

/* ==========================================================================
   通読モード v2 — ページ送り + 目次サイドバー
   ========================================================================== */
.rm-wrap { max-width: 1160px; margin: 0 auto; padding: 20px 24px 80px; }
.rm-appbar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.rm-appbar .quiz-exit { margin: 0; }
.rm-exam-name { font-family: var(--font-round); font-weight: 700; font-size: 15px; color: var(--text-soft); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rm-layout { display: grid; grid-template-columns: 256px minmax(0, 1fr); gap: 26px; align-items: start; }

/* --- sidebar TOC --- */
.rm-sidebar {
  position: sticky; top: 80px; align-self: start;
  max-height: calc(100vh - 100px); overflow-y: auto;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 6px;
}
.rm-toc-head {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-round); font-weight: 700; font-size: 14px; color: var(--text);
  padding: 12px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px;
}
.rm-toc-prog { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--text-faint); }
.rm-toc-list { display: flex; flex-direction: column; gap: 2px; }
.rm-toc-chap { border-radius: var(--radius-sm); }
.rm-toc-chap-head {
  display: flex; align-items: center; gap: 7px; width: 100%;
  background: none; border: none; cursor: pointer; text-align: left; font-family: var(--font-round);
  font-weight: 700; font-size: 11.5px; letter-spacing: 0.01em; color: var(--brand-deep);
  padding: 11px 10px 9px; border-radius: var(--radius-sm); transition: background 0.12s;
}
.rm-toc-chap-head:hover { background: var(--bg-soft); }
.rm-toc-chev { font-size: 10px; color: var(--text-faint); transition: transform 0.16s ease; flex-shrink: 0; }
.rm-toc-chap.open .rm-toc-chev { transform: rotate(90deg); }
.rm-toc-chap-name { flex: 1; min-width: 0; }
.rm-toc-chap-count {
  flex-shrink: 0; font-family: var(--font-mono); font-weight: 600; font-size: 10px; color: var(--text-faint);
  background: var(--bg-soft); border-radius: 999px; padding: 1px 7px;
}
.rm-toc-chap-body { display: none; padding-bottom: 4px; }
.rm-toc-chap.open .rm-toc-chap-body { display: block; }
.rm-toc-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  background: none; border: none; cursor: pointer; text-align: left;
  padding: 8px 10px; border-radius: var(--radius-sm); transition: background 0.12s; font-family: inherit;
}
.rm-toc-item:hover { background: var(--bg-soft); }
.rm-toc-item.active { background: var(--brand-faint); }
.rm-toc-item.active .rm-toc-num { background: var(--brand); color: #fff; }
.rm-toc-item.active .rm-toc-label { color: var(--brand-deep); font-weight: 700; }
.rm-toc-num {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-round); font-size: 12px; font-weight: 700;
  background: var(--bg-soft); color: var(--text-muted);
}
.rm-toc-label { flex: 1; min-width: 0; font-size: 13px; color: var(--text-soft); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-toc-item.locked { opacity: 0.62; }
.rm-toc-item.locked .rm-toc-num { background: var(--yellow-soft); }
.rm-toc-lock { font-size: 11px; flex-shrink: 0; }
.rm-toc-more {
  width: 100%; text-align: left; cursor: pointer; font-family: var(--font-round);
  font-size: 12.5px; font-weight: 700; color: var(--yellow);
  background: var(--yellow-soft); border: none; border-radius: var(--radius-sm);
  padding: 11px 12px; margin: 8px 2px 4px; transition: filter 0.12s;
}
.rm-toc-more:hover { filter: brightness(0.97); }

/* --- main column --- */
.rm-main { min-width: 0; }
.rm-toolbar {
  position: sticky; top: 64px; z-index: 20;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 14px;
  background: rgba(250,249,246,0.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.rm-iconbtn, .rm-navbtn {
  font-family: var(--font-round); font-weight: 700; font-size: 13px; cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text-soft); padding: 7px 12px; transition: all 0.12s;
}
.rm-iconbtn:hover, .rm-navbtn:hover { border-color: var(--brand); color: var(--brand-deep); }
.rm-drawer-btn { display: none; }
.rm-nav-group { display: flex; align-items: center; gap: 8px; }
.rm-navbtn { width: 38px; height: 36px; padding: 0; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.rm-navbtn:disabled { opacity: 0.35; cursor: default; border-color: var(--line); color: var(--text-faint); }
.rm-counter { font-family: var(--font-round); font-weight: 700; font-size: 13px; color: var(--text); min-width: 92px; text-align: center; }
.rm-jump {
  font-family: var(--font-round); font-size: 13px; color: var(--text-soft); cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 7px 10px; max-width: 150px;
}
.rm-langbar-mini { display: flex; gap: 4px; margin-left: auto; background: var(--bg-soft); border-radius: 999px; padding: 3px; }
.rm-langbar-mini .stem-langbtn { padding: 5px 12px; font-size: 12px; }

.rm-intro { margin: 0 0 14px; }
.rm-stage { min-height: 200px; }
.rm-stage .rm-q { margin-bottom: 0; }

.rm-footnav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.rm-foot-next { margin-left: auto; }
.rm-foot-spacer { flex: 0 0 auto; }
.rm-foot-end { font-family: var(--font-round); font-size: 13px; color: var(--text-faint); margin-left: auto; }

.rm-overlay { display: none; }

@media (max-width: 900px) {
  .rm-layout { grid-template-columns: 1fr; }
  .rm-drawer-btn { display: inline-block; }
  .rm-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    width: 280px; max-height: 100vh; border-radius: 0;
    transform: translateX(-100%); transition: transform 0.22s ease;
  }
  .rm-sidebar.open { transform: translateX(0); }
  .rm-overlay.show { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(20,20,20,0.4); }
  .rm-langbar-mini { margin-left: 0; }
}
@media (max-width: 560px) {
  .rm-wrap { padding: 16px 14px 64px; }
  .rm-counter { min-width: 72px; font-size: 12px; }
  .rm-jump { max-width: 110px; }
}

/* === Unified line icons (redesign) === */
.ic { display:inline-block; vertical-align:-0.18em; flex-shrink:0; }
.ic-chip { display:inline-flex; align-items:center; justify-content:center; border-radius:12px; background:var(--brand-soft); color:var(--brand-deep); }
.ic-chip.blue   { background:var(--blue-soft); color:var(--blue); }
.ic-chip.red    { background:var(--red-soft);  color:var(--red); }
.ic-chip.amber  { background:var(--yellow-soft); color:var(--yellow); }
.ic-chip.green  { background:var(--green-soft); color:var(--green-deep); }

/* ==========================================================================
   Mobile — bottom tab nav + sticky quiz submit (iPhone 通勤族向け)
   ========================================================================== */
.bottom-nav { display: none; }

@media (max-width: 640px) {
  /* 下部固定タブバー（メルカリ / PayPay 等の和製アプリ標準 pattern） */
  .bottom-nav {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav a {
    flex: 1; min-height: 56px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    text-decoration: none; color: var(--text-faint);
    font-family: var(--font-round); font-size: 10.5px; font-weight: 700;
    position: relative; transition: color 0.15s;
  }
  .bottom-nav a .ic { color: currentColor; }
  .bottom-nav a.active { color: var(--brand-deep); }
  .bottom-nav a .bn-badge {
    position: absolute; top: 6px; left: 50%; margin-left: 6px;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 999px; background: var(--energy); color: #fff;
    font-family: var(--font-body); font-size: 9px; font-weight: 700;
    line-height: 16px; text-align: center; box-shadow: 0 0 0 2px #fff;
  }
  /* 下部バーの高さぶん本文に余白を確保（被り防止） */
  body.has-bottom-nav { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }

  /* 上部ナビの 2〜3 行折返しを避け、モバイルではタブバーへ集約 */
  body.has-bottom-nav .topnav-links { display: none; }

  /* quiz: 回答ボタンを下部 sticky に（長い設問でもスクロール不要） */
  .quiz-actions.sticky-mobile {
    position: sticky;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 30;
    margin-top: 18px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
  }
  .quiz-actions.sticky-mobile .btn { flex: 1; }

  /* ------------------------------------------------------------------
     2026-06 モバイル整体調整（高+中優先度）
     タッチ目標 ≥44px / topnav 重複登出除去 / タイポ・余白の収め直し
     ------------------------------------------------------------------ */

  /* A. タッチ目標 44px（アイコンは原寸のまま、padding/min で当たり判定を拡張） */
  #notices-bell {
    min-width: 44px; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .fav-star {
    min-width: 44px; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    margin: -8px; /* 視覚位置は保ちつつ当たり判定だけ広げる */
  }
  .fav-star.big { margin: -9px 0 -9px auto; } /* big は右寄せ維持 */
  .quiz-exit { min-height: 44px; }
  .count-chip { min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; }
  .rm-navbtn { width: 44px; height: 44px; }
  .pdf-pagebtn { width: 44px; height: 44px; }
  .pdf-pageinput { min-height: 44px; }
  .stem-langbtn { min-height: 40px; display: inline-flex; align-items: center; }

  /* B. topnav の重複登出を除去（登出は account ページ内 #acc-logout に集約） */
  #logout-btn { display: none; }

  /* D. 試験詳細タイトルを縮小（長い英名でも3行以内） */
  .start-head h1 { font-size: 22px; line-height: 1.3; }
  .start-head h1 {
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* F. カード余白・アクセスバナーの収め直し */
  .entry-card { padding: 15px 16px 14px; }
  .mode-card { padding: 16px 16px; }
  .access-banner { padding: 10px 14px; font-size: 13px; }

  /* E. 「購入済み」行：名前を1行目に全幅、権限/期限を2行目へ（長い試験名でも崩れない） */
  .owned-row { flex-direction: column; align-items: stretch; gap: 8px; min-height: 64px; justify-content: center; }
  .owned-row-name { font-size: 15px; line-height: 1.4; }

  /* G. account / login・register の余白調整 */
  .auth-wrap { padding: 28px 18px 64px; }
  .auth-field { margin-bottom: 12px; }
  .act-form { flex-direction: column; align-items: stretch; }
  .act-form .search-input { min-width: 0; }
  .act-form .btn { width: 100%; }
}
