/* ============================================================
   英検マスター PWA スタイル
   ニュートラルな学習ツール風（白＋インディゴ）
   ============================================================ */

:root {
  --bg: #FAF9F5;
  --card: #FFFFFF;
  --border: #E2E6F0;
  --text: #222222;
  --text-sub: #6B7280;
  --accent: #2F5C9E;        /* 面（塗り）用。濃いブルーなので上には白文字(--on-accent) */
  --on-accent: #fff;        /* 面の上の文字・アイコン色 */
  --on-accent-dim: rgba(255, 255, 255, 0.85);  /* 面上の補助文字（ブランドの「英検」等） */
  --on-accent-line: rgba(255, 255, 255, 0.3);  /* 面上の区切り線 */
  --on-accent-press: rgba(255, 255, 255, 0.2); /* 面上アイコンの押下ハイライト */
  --on-accent-muted: #FFD2DA;                  /* ミュート時アイコン色 */
  --accent-soft: #E7ECF7;   /* チップ等の淡い面（白カードの上で見える薄ブルー） */
  --accent-dark: #264C84;   /* 塗りボタンの押下色（濃いブルー・白文字） */
  --accent-ink: #2F5C9E;    /* 文字・アイコン・線用（白/淡面の上で4.5:1以上の濃ブルー） */
  --danger: #D6455D;
  /* テスト別カラー（文字・線でのせる用。ダークでは明るめに差し替える） */
  --c-tango: #4263EB;
  --c-review: #F59E0B;
  --c-mastered: #1F8A4D;
  --c-fullrange: #8B5CF6;
  --c-mock: #E0457B;
  --radius: 14px;
}

/* ダークモード（設定でON）。WCAG AA（小4.5:1／大3:1）を満たすよう地・面・文字・アクセントを調整。
   重要情報(--text)は約13:1、補助情報(--text-sub)は約7:1で階層を保つ。 */
[data-theme="dark"] {
  --bg: #0F1420;
  --card: #1A2030;
  --border: #2C3548;
  --text: #EAEDF4;
  --text-sub: #A7B0C2;
  --accent-soft: #1E2A45;
  --accent-ink: #8AB0FF;  /* 暗い地の上で読みやすい明るめブルー */
  --danger: #FF8A97;      /* 暗い地の上で約7:1 */
  --c-tango: #8AA4FF;
  --c-review: #F5B942;
  --c-mastered: #5FD391;
  --c-fullrange: #B79BF7;
  --c-mock: #FF7CA6;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Noto Sans JP", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── ヘッダー ── */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  padding: 12px 12px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--accent);
  border-bottom: 1px solid var(--accent-dark);
}

/* ヘッダー左：ブランドロゴ（暫定） */
.brand-logo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  /* iOSはviewportのuser-scalable=noを無視するため、ロゴだけダブルタップ拡大を止める（7連打の隠し操作用） */
  touch-action: manipulation; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

/* ヘッダーのブランド表示：Wordrapp（主）＋ 英検（小さめの説明） */
.brand-name { display: flex; align-items: baseline; gap: 5px; margin-left: 8px; flex-shrink: 0; }
.brand-name-main { font-size: 21px; font-weight: 900; color: var(--on-accent); letter-spacing: 0.01em; }
.brand-name-sub { font-size: 13px; font-weight: 800; color: var(--on-accent-dim); }

/* 家＋5アイコンを等間隔の1グループにし、ロゴ右の余白に中央寄せ
   （中央寄せの左スペースが自動的にロゴとの広めの余白になる） */
.header-nav { flex: 1; display: flex; justify-content: flex-end; gap: 4px; }

.icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  border-radius: 10px;
  color: var(--on-accent);
  cursor: pointer;
}

/* アイコン間の薄い区切り縦線（gap 4px のちょうど中央に置く） */
.header-nav .icon-btn + .icon-btn::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 16px;
  background: var(--on-accent-line);
}

.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:active, .icon-btn.active { background: var(--on-accent-press); color: var(--on-accent); }
.icon-btn.muted { color: var(--on-accent-muted); }

/* ── アイコン機能ラベル（一瞬表示するトースト） ── */
.icon-toast {
  position: fixed;
  top: 0;
  left: 0;
  background: var(--text);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity 0.12s ease;
}

.icon-toast.show { opacity: 0.95; }

/* ── レイアウト ── */
.main {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

/* ── フッター（下部ナビ） ── */
.footer-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.footer-inner {
  display: flex;
  width: 100%;
  max-width: 560px;
}

.footer-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 2px 7px;
  background: none;
  border: none;
  color: var(--text-sub);
  font-family: inherit;
  cursor: pointer;
}

.footer-tab svg { width: 22px; height: 22px; }
.footer-tab span { font-size: 10px; line-height: 1; font-weight: 600; }
.footer-tab.active { color: var(--accent-ink); }
.footer-tab:active { background: var(--accent-soft); }

/* ── 設定画面 ── */
.settings-group { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2px 14px; margin-bottom: 4px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 2px; border-top: 1px solid var(--border); }
.settings-group .settings-row:first-child { border-top: none; }
.settings-label { font-size: 14.5px; color: var(--text); display: flex; flex-direction: column; }
.settings-label small { font-size: 11px; color: var(--text-sub); font-weight: 400; margin-top: 2px; }
.settings-select { font-family: inherit; font-size: 14px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; min-width: 96px; }
.settings-note { font-size: 12px; color: var(--text-sub); padding: 8px 2px 12px; }
.settings-reset { display: block; width: 100%; text-align: left; font-family: inherit; font-size: 14px; color: var(--danger); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; }
.settings-reset:active { background: var(--accent-soft); }

/* トグルスイッチ */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: background 0.15s; cursor: pointer; }
.switch-slider::before { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.switch input:checked + .switch-slider { background: var(--accent-ink); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

.hidden { display: none !important; }

/* ── 検索ボックス ── */
.search-box {
  display: flex;
  gap: 8px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  transition: border-color 0.15s;
}

.search-box:focus-within { border-color: var(--accent-ink); }

#searchInput {
  flex: 1;
  border: none;
  outline: none;
  background: none;
  font-size: 17px;
  padding: 8px 10px;
  font-family: inherit;
  color: var(--text);
}

#searchInput::placeholder { color: var(--text-sub); opacity: 1; }

.clear-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--text-sub);
  cursor: pointer;
}

.clear-btn svg { width: 16px; height: 16px; }
.clear-btn:active { color: var(--text); }

#searchBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}

#searchBtn svg { width: 20px; height: 20px; }
#searchBtn:active { background: var(--accent-dark); }

/* ── 入力候補 ── */
.suggest-box {
  list-style: none;
  margin-top: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(31, 37, 51, 0.07);
}

.suggest-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  cursor: pointer;
}

.suggest-item + .suggest-item { border-top: 1px solid var(--border); }
.suggest-item:active { background: var(--accent-soft); }

.suggest-word { font-size: 16px; font-weight: 700; }
.suggest-word .match { color: var(--accent-ink); }

.suggest-ja {
  font-size: 12.5px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── ホーム：級切替セグメント（横1行・等幅／易→難） ── */
.level-switch { display: flex; gap: 6px; margin-bottom: 0; }

/* ホーム上部：現在の級＝大きく表示＋タップでカスタムドロップダウン切替 */
.home-level { position: relative; display: inline-block; margin: 6px 0 0; }
.home-level-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 2px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.home-level-current { font-size: 30px; font-weight: 800; color: var(--accent-ink); }
.home-level-chev { width: 24px; height: 24px; color: var(--accent-ink); transition: transform 0.15s; flex-shrink: 0; }
.home-level-btn[aria-expanded="true"] .home-level-chev { transform: rotate(180deg); }

.home-level-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  min-width: 168px;
  list-style: none;
  background: var(--card);          /* 白（ライト時）。テーマ追従 */
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(31, 37, 51, 0.12);
  overflow: hidden;
}
.home-level-opt {
  display: flex;
  align-items: center;
  min-height: 48px;                 /* タッチ領域44px以上 */
  padding: 0 18px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}
.home-level-opt + .home-level-opt { border-top: 1px solid var(--border); } /* 薄い区切り線 */
.home-level-opt:active { background: var(--accent-soft); }
.home-level-opt.sel { color: var(--accent-ink); background: var(--accent-soft); } /* 選択中＝色で表示（チェックなし） */

/* 級名と「テストを選ぶ」セクションの間を広めに取る */
.home-level + .group-title { margin-top: 44px; }
.level-pill {
  flex: 1;
  padding: 9px 4px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-sub);
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
}
.level-pill.active { background: var(--accent); border-color: var(--accent-ink); color: var(--on-accent); }

/* ── ホーム：5つの色分けテストブロック ── */
.home-menu { display: flex; flex-direction: column; gap: 12px; }

.menu-block {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 20px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 5px solid var(--block-color);
  border-radius: 12px;
  box-shadow: 0 1.5px 4px rgba(31, 37, 51, 0.08);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.menu-block:active { background: var(--bg); box-shadow: none; transform: translateY(1px); }
.menu-icon { flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--block-color); }
.menu-icon svg { width: 28px; height: 28px; }
.menu-label { flex: 1; font-size: 16.5px; font-weight: 700; color: var(--text); }
.menu-count { flex-shrink: 0; font-size: 17px; font-weight: 800; color: var(--block-color); font-variant-numeric: tabular-nums; line-height: 1; }
.menu-count-unit { font-size: 11px; font-weight: 700; color: var(--text-sub); margin-left: 1px; }
.menu-chevron { display: flex; color: var(--text-sub); }
.menu-chevron svg { width: 20px; height: 20px; }

/* ── ホーム本体のコンテナ ── */
.home-actions { margin-top: 0; }
/* 最初の小見出しはヘッダー直下なので上余白を詰める */
.home-actions > .group-title:first-child { margin-top: 12px; }
/* 「学習する級」と「テストを選ぶ」の間は広めに取り、別グループだと明確に伝える（近接） */
.level-switch + .group-title { margin-top: 50px; }

/* ── フローチャート型ホーム（旧・未使用） ── */

.home-flow { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }

/* 出題元とそのテストは「近接」でグループに見せる（枠で囲まず、ペアを密に） */
.flow-pair { display: flex; flex-direction: column; gap: 6px; }

/* 全ボタン共通：影で立体感＋右端にシェブロンで「タップできる」と統一表示 */
.flow-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
  padding: 16px 38px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  box-shadow: 0 1.5px 4px rgba(31, 37, 51, 0.10);
  cursor: pointer;
  font-family: inherit;
}

.flow-btn:active { box-shadow: none; transform: translateY(1px); background: var(--accent-soft); }

.flow-node-title { font-size: 16px; font-weight: 700; }
.flow-node-sub { font-size: 12px; color: var(--text-sub); }

.flow-chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-sub);
  display: flex;
}
.flow-chevron svg { width: 18px; height: 18px; }

/* 変動する数字は常にアクセント色＋太字で「ライブな値」と分かるようにする */
.flow-count {
  display: inline-block;
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 14px;
}
/* 変化した瞬間は拡大して点滅 */
.flow-count-flash { animation: count-flash 0.7s ease; }
@keyframes count-flash {
  0% { transform: scale(1); }
  35% { transform: scale(1.45); }
  100% { transform: scale(1); }
}

/* 覚えた単語の進捗バー（1623に向かって伸びる） */
.flow-progress {
  width: 100%;
  height: 5px;
  margin-top: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.flow-progress-fill {
  display: block;
  height: 100%;
  background: #1F8A4D;
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* テスト系ボタンは淡いアクセント色で「出題アクション」と区別 */
.flow-btn.action { background: var(--accent-soft); border-color: var(--accent-ink); color: var(--accent-ink); }
.flow-btn.action .flow-node-sub { color: var(--accent-ink); opacity: 0.85; }
.flow-btn.action .flow-chevron { color: var(--accent-ink); }
.flow-btn.action:active { background: #E2E9FD; }

/* 実力テストは流れの外なので少し間を空ける */
.flow-btn.mock { margin-top: 22px; }

/* 矢印（大きくアクセント色）＋「何が流れるか」のラベル */
.flow-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px 0;
  color: var(--accent-ink);
}
.flow-arrow svg { width: 30px; height: 30px; }
.flow-arrow-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 1px;
}

.home-help-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  margin: 28px auto 4px; /* 主導線の下に余白を取り、中央配置。幅は内容分だけ＝空白部分は非タップ */
  padding: 6px 4px;
  background: none;
  border: none;
  color: var(--text-sub); /* 最下部の補助リンク＝控えめに */
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.home-help-link svg { width: 15px; height: 15px; flex-shrink: 0; }
.home-help-link span { text-decoration: underline; }

/* ── 使い方画面 ── */
.help { color: var(--text); }
.help b { font-weight: 700; }

/* ページ見出し「使い方」はページ全体の見出し。区切り線＋余白で本文から切り離し、
   直下のリード文だけの見出しに見えないようにする（階層を明確化） */
#viewHelp .view-head,
#viewLegal .view-head {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* 導入文：太めの本文色で「このアプリは何か」を最初に強く伝える（強弱） */
.help-lead { font-size: 14.5px; line-height: 1.8; color: var(--text); margin-bottom: 4px; }

/* ── 共通：セクション見出し＆パネル（使い方・学習記録・設定で統一して使う） ── */
/* グループ見出し：色アクセントバー付き・本文色で「ここから新しいグループ」と強く示す（強弱・反復） */
.group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.02em;
  margin: 30px 0 10px;
}
.group-title::before {
  content: "";
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: var(--accent-ink);
}
/* 画面の最初に来る見出しは上の余白を詰める（ページ見出し直下） */
#settingsBody > .group-title:first-child { margin-top: 8px; }
/* 使い方画面はセクション間の余白を広めに取る */
#viewHelp .group-title { margin-top: 46px; }

/* セクションの中身は1枚のパネルにまとめ、枠線でグループ境界を明確化（近接・整列） */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2px 16px;
}
/* 見出しの直後のパネルは間隔を見出し側に任せて密着（近接） */
.group-title + .dash-section { margin-top: 0; }

/* 基本の流れ：番号バッジ（強）＋見出し（中）＋説明（弱）の3段階（強弱・整列） */
.help-steps { list-style: none; display: flex; flex-direction: column; gap: 14px; padding: 16px 0; }
.help-step { display: flex; align-items: flex-start; gap: 12px; }
.help-step-no {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 14px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.help-step-body { font-size: 13px; color: var(--text-sub); line-height: 1.6; padding-top: 2px; }
.help-step-body b { display: block; color: var(--text); font-size: 14px; font-weight: 700; margin-bottom: 1px; }

/* 5つのテスト：パネル内の区切り行（入れ子カードを避ける）。アイコン色はホームと揃える（反復） */
.help-test { padding: 14px 0; }
.help-test + .help-test { border-top: 1px solid var(--border); }
.help-test-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.help-test-head svg { width: 22px; height: 22px; color: var(--hc); flex-shrink: 0; }
.help-test-name { font-size: 15px; font-weight: 700; color: var(--text); }
.help-test .intro-list li { margin: 5px 0; font-size: 12.5px; color: var(--text-sub); line-height: 1.6; }

/* おすすめの進め方：パネル内に手順を区切り線で整列（近接・整列） */
.help-route-line { font-size: 13px; color: var(--text); padding: 12px 0; line-height: 1.6; }
.help-route-line + .help-route-line { border-top: 1px solid var(--border); }
.help-route-line b { font-weight: 700; }

/* その他の機能：アイコン＋ラベル＋説明を左揃えで整列（整列・反復） */
.help-feature-list { list-style: none; }
.help-feature-list li { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; }
.help-feature-list li + li { border-top: 1px solid var(--border); }
.help-feat-icon { flex-shrink: 0; display: flex; color: var(--accent-ink); padding-top: 1px; }
.help-feat-icon svg { width: 20px; height: 20px; }
.help-feat-text { font-size: 13px; color: var(--text-sub); line-height: 1.65; }
.help-feat-text b { color: var(--text); font-weight: 700; margin-right: 5px; }

/* よくある質問（使い方画面） */
.help-faq-q { font-size: 13.5px; font-weight: 700; color: var(--text); padding: 12px 0 8px; line-height: 1.6; }
.help-faq-a { padding-bottom: 12px; }
.help-faq-a p { font-size: 13px; color: var(--text-sub); line-height: 1.7; }
.help-faq-a p + p { margin-top: 8px; }

.help .primary-btn { margin-top: 30px; }

/* ── プライバシーポリシー画面 ── */
/* セクション間は「使い方」よりやや詰める（項目が多く縦に長いため） */
#viewLegal .group-title { margin-top: 38px; }

/* パネル内の各項目：小見出し（強）＋本文（弱）。項目どうしは1pxで区切る（整列・反復） */
.legal-item { padding: 14px 0; }
.legal-item + .legal-item { border-top: 1px solid var(--border); }
.legal-item h4 { font-size: 13.5px; font-weight: 700; color: var(--text); line-height: 1.6; margin-bottom: 6px; }
.legal-item p { font-size: 13px; color: var(--text-sub); line-height: 1.7; }
.legal-item p + p { margin-top: 8px; }
.legal-item .intro-list { margin-bottom: 8px; }
.legal-item .intro-list li { font-size: 13px; color: var(--text-sub); line-height: 1.7; }

/* 連絡先＝この画面で唯一「行動できる情報」なので本文より強く見せる（強弱） */
.legal-contact {
  display: block;
  padding: 6px 0 2px;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-ink);
  word-break: break-all;
}

/* 制定日・運営者＝事実の記載。中央寄せの控えめな注記で本文と区別する */
.legal-meta { margin-top: 22px; font-size: 12px; line-height: 1.9; color: var(--text-sub); text-align: center; }

/* 商標などの控えめな注記（使い方・設定の末尾） */
.legal-note { margin-top: 22px; font-size: 11px; line-height: 1.7; color: var(--text-sub); text-align: center; }

/* ── ローディング ── */
.loading { text-align: center; padding: 48px 0; color: var(--text-sub); }

.spinner {
  width: 32px;
  height: 32px;
  margin: 0 auto 12px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent-ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── エラー ── */
.error-box {
  margin-top: 20px;
  padding: 14px 16px;
  background: #FDF1F3;
  border: 1px solid #F2C7CF;
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 14px;
}

/* ── 結果カード ── */
.result { margin-top: 20px; }

.back-bar {
  display: inline-flex;
  align-items: center;
  margin-bottom: 12px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--accent-ink);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.back-bar:active { background: var(--accent-soft); }

/* 詳細画面の末尾に置く戻るボタン。解説が長いと上まで戻るのが手間なので、
   読み終わった位置でそのまま戻れるように同じボタンを横幅いっぱいで繰り返す */
.back-bar-bottom {
  display: flex;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  margin: 16px 0 0;
}

/* 検索バー（虫眼鏡から開いた状態）の戻るボタンは検索ボックスの下に余白を取る */
#searchBackBtn { margin-top: 12px; margin-bottom: 0; }

.entry-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.entry-card { position: relative; }

/* 見出し語は中央寄せで横幅を使い切る。上部はしおり・✓ボタンの行ぶん空けて重ならないように */
.entry-head { text-align: center; padding: 34px 0 0; }

.headword { font-size: 30px; font-weight: 700; line-height: 1.2; white-space: nowrap; }

/* 発音記号＋音声ボタンを中央に横並び（元の位置） */
.pron-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.pron { font-size: 14px; color: var(--text-sub); }

/* ── 音声ボタン ── */
.speak-btn {
  position: relative; /* タップ範囲拡大用 */
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink); /* 濃いアクセント色で目立たせる */
  cursor: pointer;
}
/* 見た目の大きさはそのまま、タップできる範囲だけ広げる（透明な余白） */
.speak-btn::before { content: ""; position: absolute; inset: -15px; border-radius: 50%; }

.speak-btn svg { width: 16px; height: 16px; }
.speak-btn:active { background: var(--accent); border-color: var(--accent-dark); color: var(--on-accent); }

.example-row { display: flex; align-items: flex-start; gap: 8px; }
.example-row .example-en { flex: 1; }
.example-row .speak-btn { width: 28px; height: 28px; }
.example-row .speak-btn svg { width: 14px; height: 14px; }

/* カード右上の操作ボタン（しおり＝学習中、✓＝覚えた。状態は排他） */
.card-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
}

.save-btn, .master-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text-sub);
  cursor: pointer;
}

.save-btn svg, .master-btn svg { width: 17px; height: 17px; }

.save-btn.saved {
  background: var(--accent-soft);
  border-color: var(--accent-ink);
  color: var(--accent-ink);
}

.save-btn.saved svg { fill: none; }

.master-btn.mastered {
  background: #E5F5EC;
  border-color: #1F8A4D;
  color: #1F8A4D;
}

.level-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
}

.level-easy { background: #E5F5EC; color: #1F8A4D; }
.level-mid { background: var(--accent-soft); color: var(--accent-ink); }
.level-hard { background: #F1ECFB; color: #6D3FC0; }
.level-none { background: #EEF0F4; color: var(--text-sub); }

/* 品詞・意味 */
.sense-block { margin-top: 18px; }

.pos-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12.5px;
  font-weight: 700;
}

.meaning-list { margin: 8px 0 0; padding-left: 0; list-style: none; }

.meaning-list li {
  position: relative;
  padding-left: 20px;
  font-size: 16px;
  margin-top: 4px;
}

.meaning-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* セクション共通 */
.section { margin-top: 22px; }

.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sub);
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.section-title svg { width: 15px; height: 15px; }

/* 類語・反意語チップ */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 14px;
  color: var(--accent-ink);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.chip:active { border-color: var(--accent-ink); }

.chip .chip-ja { font-size: 11.5px; font-weight: 400; color: var(--text-sub); }

.chip.chip-ant { background: #FBF0EC; color: #B05B3A; }

/* 例文 */
.example { padding: 12px 14px; background: var(--bg); border-radius: 10px; }
.example + .example { margin-top: 10px; }
.example-en { font-size: 15.5px; font-weight: 600; }
.example-en .hl { color: var(--accent-ink); }
.example-ja { font-size: 13.5px; color: var(--text-sub); margin-top: 2px; }

/* 覚え方のヒント */
.hook-box {
  margin-top: 22px;
  padding: 14px 16px;
  background: var(--accent-soft);
  border: 1px solid #CCD8F8;
  border-radius: 10px;
  font-size: 14px;
}

.hook-box .section-title { color: var(--accent-ink); margin-bottom: 4px; }

/* イメージフレーズ */
.image-phrase-box {
  margin-top: 14px;
  padding: 14px 16px;
  background: #F5F0FE;
  border: 1px solid #DCCEF7;
  border-radius: 10px;
  font-size: 14px;
}

.image-phrase-box .section-title { color: #7C5CBF; margin-bottom: 4px; }

/* ワンポイント */
.tip-box {
  margin-top: 22px;
  padding: 14px 16px;
  background: #FFF9EC;
  border: 1px solid #F0E2BC;
  border-radius: 10px;
  font-size: 14px;
}

.tip-box .section-title { color: #A07820; margin-bottom: 4px; }

/* ── リストビュー（学習中の単語・覚えた単語・履歴） ── */
.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-bottom: 6px;
}

/* 一覧ページはタイトル下に区切り線＋余白を入れ、ヘッダーと一覧を分ける（「使い方」と統一・近接） */
#viewWordbook .view-head,
#viewMastered .view-head,
#viewAllWords .view-head {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* タイトルは折り返さない。入りきらない時は件数バッジ等が次の行へ回る */
.view-head h2 { font-size: 19px; white-space: nowrap; }
.view-head > .count-badge { margin-left: auto; text-align: right; }
/* 単語一覧は件数を常にタイトルの“下の行”に表示（短くても折り返す。3画面で統一） */
#viewWordbook .view-head h2,
#viewMastered .view-head h2,
#viewAllWords .view-head h2 { flex-basis: 100%; }

/* 全単語ページの絞り込み入力 */
.allwords-filter {
  width: 100%;
  margin-bottom: 14px;
  padding: 11px 14px;
  font-size: 15px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-sizing: border-box;
}
.allwords-filter::placeholder { color: var(--text-sub); }
.allwords-filter:focus {
  outline: none;
  border-color: var(--accent);
}

.count-badge {
  padding: 2px 10px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
}
.count-badge:empty { display: none; } /* テスト開始画面など、進捗が空のときは丸ごと隠す */

.text-btn {
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
}

.view-note { font-size: 12.5px; color: var(--text-sub); margin-bottom: 14px; }

.word-list { list-style: none; }

.word-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px 16px;
  margin-top: 10px;
}

/* タップ行（シェブロン）と操作ボタンを別ゾーンに見せる縦の区切り線（ボタン左の余白に配置） */
.word-item-move, .word-item-del { position: relative; }
.word-item-move::before, .word-item-del::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 26px;
  background: var(--border);
}

.word-item-main { flex: 1; min-width: 0; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.word-item-text { flex: 1; min-width: 0; }
.word-item-chev { flex-shrink: 0; display: flex; color: var(--text-sub); }
.word-item-chev svg { width: 18px; height: 18px; }

.word-item-word { font-size: 16.5px; font-weight: 700; line-height: 1.3; }

.word-item-sub {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.word-item-del {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-sub);
  cursor: pointer;
}

.word-item-del svg { width: 17px; height: 17px; }
.word-item-del:active { color: var(--danger); background: #FDF1F3; }

.word-item-move {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text-sub);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.word-item-move svg { width: 14px; height: 14px; }
.word-item-move:active { border-color: var(--accent-ink); color: var(--accent-ink); }

.empty-note { text-align: center; color: var(--text-sub); font-size: 14px; padding: 40px 0; }

/* ── テスト ── */
.view-head-actions { display: flex; align-items: center; gap: 10px; }

.test-btn {
  padding: 6px 18px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.test-btn:active { background: var(--accent-dark); }
.test-btn:disabled { background: var(--border); cursor: default; }

.quiz-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 8px;
}

.quiz-sentence { font-size: 16.5px; font-weight: 600; line-height: 1.7; }

.quiz-choices { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }

.quiz-choice {
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.quiz-choice:disabled { cursor: default; }

.quiz-choice.correct {
  background: #E5F5EC;
  border-color: #1F8A4D;
  color: #1F8A4D;
}

.quiz-choice.incorrect {
  background: #FDF1F3;
  border-color: var(--danger);
  color: var(--danger);
}

.quiz-feedback {
  margin-top: 16px;
  padding: 12px 14px;
  background: #FDF1F3;
  border-radius: 10px;
  font-size: 14px;
  color: var(--danger);
}

.quiz-feedback.fb-ok { background: #E5F5EC; color: #1F8A4D; }

.primary-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 15.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.primary-btn:active { background: var(--accent-dark); }

/* アイコン＋テキストを1要素としてボタン中央に横並び配置 */
.btn-icon { display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-icon svg { width: 18px; height: 18px; flex-shrink: 0; }

.ghost-btn {
  background: var(--card);
  border: 1.5px solid var(--border);
  color: var(--text-sub);
}

.ghost-btn:active { background: var(--bg); }

.quiz-score {
  text-align: center;
  font-size: 44px;
  font-weight: 700;
  color: var(--accent-ink);
}

.quiz-score span { font-size: 22px; color: var(--text-sub); }

.quiz-result-note {
  text-align: center;
  font-size: 13.5px;
  color: var(--text-sub);
  margin: 28px 0 10px;
}

.quiz-result-actions { margin-top: 22px; }
.quiz-result-actions .primary-btn { min-height: 64px; display: flex; align-items: center; justify-content: center; }

/* ── テスト開始画面（使い方と同じテイスト：色アイコン＋ファクト＋見出し＋パネル） ── */
.test-intro { padding: 8px 0 0; }
.intro-hero { text-align: center; padding: 10px 0 0; }
.intro-hero-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px; height: 60px;
  border: 2px solid var(--hc);
  border-radius: 50%;
  color: var(--hc);
  background: var(--card);
}
.intro-hero-icon svg { width: 30px; height: 30px; }
.intro-name { font-size: 21px; font-weight: 800; color: var(--text); margin-top: 12px; }
/* 出題数・出題対象を等幅タイルで並べ、重要な数値を強調（強弱・整列） */
/* 出題数（変更可・セレクト）／出題対象（情報）を設定画面と同じ行様式で。出題対象は文字表示で“押せそう”に見せない */
.intro-meta { margin-top: 20px; }
.intro-target-val { font-size: 14.5px; font-weight: 700; color: var(--text); }
.intro-about { padding: 4px 16px; }
.intro-about .intro-list li { font-size: 13px; color: var(--text-sub); margin: 7px 0; }
.intro-empty { text-align: center; color: var(--text-sub); font-size: 14px; margin: 28px 0; }
.intro-list { margin: 0; padding: 0; list-style: none; }
.intro-list li { position: relative; padding-left: 18px; margin: 9px 0; }
.intro-list li::before {
  content: ""; position: absolute; left: 4px; top: 9px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}
.intro-list strong { color: var(--text); font-weight: 700; }

/* ── 高速認識ドリル（フラッシュカード） ── */
.card-drill {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 44px 20px 20px;
  margin-top: 8px;
}

.card-word {
  font-size: 34px;
  font-weight: 700;
  text-align: center;
  word-break: break-word;
  padding: 16px 0 6px;
}

/* 音声ボタンは見出し語の下に中央配置。見出し語の下端（g等の descender）と重ならないよう少し間隔を空ける */
.card-speak {
  position: relative; /* タップ範囲拡大用 */
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 10px auto 0;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink); /* 濃いアクセント色で目立たせる */
  cursor: pointer;
}
/* 見た目の大きさはそのまま、タップできる範囲だけ広げる */
.card-speak::before { content: ""; position: absolute; inset: -16px; border-radius: 50%; }

.card-speak svg { width: 18px; height: 18px; }
.card-speak:active { background: var(--accent); color: var(--on-accent); }

/* ── 高速接触モード ── */
.flash-start-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.flash-start-btn svg { width: 16px; height: 16px; }
.flash-start-btn:active { background: var(--accent-dark); }
#resultFlashBtn { margin: 12px 0 0; } /* 結果画面では間違えた単語リストの下に少し余白を取る */

.flash-top { margin-bottom: 12px; }
.flash-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 32px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 1.5px 4px rgba(31, 37, 51, 0.08);
}
/* 意味は最初から領域を確保し、不透明度だけで出し入れ＝表示してもカードの高さが変わらない */
.flash-meaning { margin-top: 16px; font-size: 21px; font-weight: 700; color: var(--text); text-align: center; opacity: 0; transition: opacity .15s; }
.flash-meaning.shown { opacity: 1; }
.flash-next { width: 100%; margin-top: 14px; min-height: 96px; display: flex; align-items: center; justify-content: center; font-size: 17px; }
.flash-controls { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }
.flash-auto { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--text-sub); cursor: pointer; }
.flash-interval { font-family: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); }

/* ── 聞き流しモード ── */
.listen-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px 20px;
  min-height: 240px;
  box-shadow: 0 1.5px 4px rgba(31, 37, 51, 0.08);
}
.listen-line { border-radius: 8px; padding: 2px 8px; transition: opacity 0.2s, background 0.2s; }
.lnhidden { opacity: 0; }
.listen-line.playing { background: var(--accent-soft); }
.listen-word { font-size: 30px; font-weight: 800; text-align: center; word-break: break-word; }
.listen-ja { font-size: 18px; font-weight: 700; color: var(--accent-ink); text-align: center; margin-top: 8px; }
.listen-ex { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.listen-ex-en { font-size: 15.5px; font-weight: 600; line-height: 1.6; }
.listen-ex-en .hl { color: var(--accent-ink); }
.listen-ex-ja { font-size: 13.5px; color: var(--text-sub); margin-top: 4px; line-height: 1.6; }
.listen-loading { text-align: center; color: var(--text-sub); font-size: 13px; margin-top: 14px; }
.listen-controls { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.listen-nav { display: flex; gap: 8px; width: 100%; }
.listen-nav-btn {
  flex: 1;
  min-height: 52px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}
.listen-nav-btn:active { background: var(--accent-soft); }
#listenStartBtn { margin-left: 8px; }
#viewAllWords .flash-start-btn { margin-bottom: 12px; }
.flash-done {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 164px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  padding: 8px 0;
  text-align: center;
}
.flash-done-main { font-size: 17px; font-weight: 800; color: var(--text); }
.flash-done-sub { font-size: 13px; color: var(--text-sub); margin-bottom: 6px; }
/* 親指で押しやすいよう、3つのボタンは画面下部へ寄せる */
.flash-done-actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.flash-done-actions .primary-btn { min-height: 64px; display: flex; align-items: center; justify-content: center; }

/* 「単語の詳細」＝詳細画面への明示的なリンク（見出し語の上に配置） */
.card-detail {
  display: block;
  width: max-content;
  margin: 0 auto 2px;
  padding: 6px 14px;
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
}
.card-detail:active { color: var(--text); }

.card-feedback {
  min-height: 22px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  margin: 18px 0 22px;
}

.card-feedback.fb-ok { color: #1F8A4D; }
.card-feedback.fb-ng { color: var(--danger); }
.card-feedback.big { font-size: 30px; }
.card-feedback.fb-ok.big { animation: card-pop 0.35s ease; }

@keyframes card-pop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.card-opts { display: flex; flex-direction: column; gap: 16px; }

/* 回答後に出る「次へ」ボタンは選択肢から少し離す。タップしやすいよう縦幅も広めに */
.card-next, #quizNextBtn { margin-top: 24px; min-height: 64px; display: flex; align-items: center; justify-content: center; }

.card-opt {
  padding: 24px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  font-size: 16.5px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  cursor: pointer;
  font-family: inherit;
}

.card-opt.correct { background: #E5F5EC; border-color: #1F8A4D; color: #1F8A4D; }
.card-opt.incorrect { background: #FDF1F3; border-color: var(--danger); color: var(--danger); }
.card-opt:disabled { cursor: default; }

.card-dunno {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  border: 1.5px solid #F2C7CF;
  border-radius: 12px;
  background: var(--card);
  color: var(--danger);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.card-dunno:active { background: #FDF1F3; }
.card-dunno:disabled { color: var(--border); border-color: var(--border); cursor: default; }

/* ── 学習記録（ダッシュボード） ── */
.dash-hero {
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px 18px;
  margin-top: 8px;
}

/* 数字を真ん中に固定し、（○日連続）は右側に置いても中央がずれないよう3カラムにする */
.dash-hero-main { display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; }
.dash-streak-main { grid-column: 2; white-space: nowrap; }

.dash-streak-num {
  font-size: 56px;
  font-weight: 700;
  color: var(--accent-ink);
  line-height: 1;
}

.dash-streak-unit {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-ink);
  margin-left: 4px;
}

.dash-streak-sub {
  grid-column: 3;
  justify-self: start;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-sub);
  margin-left: 8px;
}

.dash-streak-label {
  margin-top: 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-sub);
  letter-spacing: 0.08em;
}

/* テスト完了回数の一覧（ホームと同じ色分け） */
.dash-testlist { display: flex; flex-direction: column; gap: 8px; }
.dash-testrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--row-color);
  border-radius: 10px;
}
.dash-testrow-label { font-size: 14px; font-weight: 700; color: var(--text); }
.dash-testrow-count { font-size: 18px; font-weight: 800; color: var(--row-color); font-variant-numeric: tabular-nums; line-height: 1; }
.dash-testrow-unit { font-size: 11px; font-weight: 700; color: var(--text-sub); margin-left: 1px; }

.dash-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}

.dash-bar-track {
  height: 10px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.dash-bar {
  height: 100%;
  width: 0;
  background: var(--accent-ink);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.dash-bar-text {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-sub);
  text-align: right;
}

/* 「成長の記録」アコーディオン */
.dash-acc-toggle {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-top: 14px; padding: 9px 8px 2px;
  background: none; border: none; border-top: 1px solid var(--border);
  color: var(--accent-ink); font-size: 13px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.dash-acc-chev { width: 16px; height: 16px; transition: transform 0.2s ease; }
.dash-acc-toggle.open .dash-acc-chev { transform: rotate(180deg); }
.dash-acc-body { margin-top: 10px; }

.dash-chart { width: 100%; height: auto; display: block; }
.dash-chart .grid { stroke: var(--border); stroke-width: 1; }
.dash-chart .axis { fill: var(--text-sub); font-size: 8px; }
.dash-chart .line { fill: none; stroke: var(--chart-color, var(--accent-ink)); stroke-width: 2; stroke-linejoin: round; }
.dash-chart .dot { fill: var(--chart-color, var(--accent-ink)); }

.dash-empty { font-size: 13px; color: var(--text-sub); padding: 16px 0; text-align: center; }

/* ── 学習記録：3ブロック共通の統一アコーディオンカード（反復） ── */
.dash-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 12px;
  overflow: hidden;
}
.dash-card:first-child { margin-top: 8px; }
.dash-card-top { padding: 16px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.dash-card-top:active { background: var(--bg); }
.dash-card-top:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: -2px; }
.dash-card-row { display: flex; align-items: center; gap: 10px; }
.dash-card-title { font-size: 14px; font-weight: 800; color: var(--text); letter-spacing: 0.02em; }
.dash-card-figure { margin-left: auto; font-size: 14px; font-weight: 700; color: var(--text-sub); white-space: nowrap; }
.dash-card-figure b { font-size: 25px; font-weight: 800; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.dash-card-unit { font-size: 12px; font-weight: 700; color: var(--text-sub); margin-left: 1px; }
.dash-card-chev { display: flex; color: var(--text-sub); }
.dash-card-chev svg { width: 18px; height: 18px; transition: transform 0.2s ease; }
.dash-card-top.open .dash-card-chev svg { transform: rotate(180deg); }
.dash-card-extra { margin-top: 12px; }
.dash-card-body { padding: 4px 16px 16px; }
.dash-subhead { font-size: 12.5px; font-weight: 700; color: var(--text-sub); margin: 18px 0 8px; }
.dash-today {
  display: inline-block; font-size: 13px; font-weight: 700; font-family: inherit;
  padding: 8px 14px; border-radius: 999px;
}
.dash-today.done { color: var(--text-sub); background: var(--bg); cursor: default; }
.dash-today.cta { color: var(--on-accent); background: var(--accent); border: none; cursor: pointer; }
.dash-today.cta:active { background: var(--accent-dark); }

/* ── ダークモード：色付きの「淡い箱」を暗い地に合わせて再配色（WCAG AA：文字4.5:1以上） ── */
/* 正解・できた系（緑） */
[data-theme="dark"] .master-btn.mastered,
[data-theme="dark"] .level-easy,
[data-theme="dark"] .quiz-choice.correct,
[data-theme="dark"] .card-opt.correct,
[data-theme="dark"] .quiz-feedback.fb-ok { background: #14321F; border-color: #2F8B57; color: #6FDDA0; }
[data-theme="dark"] .card-feedback.fb-ok { color: #6FDDA0; }
/* 不正解・注意系（赤） */
[data-theme="dark"] .quiz-choice.incorrect,
[data-theme="dark"] .card-opt.incorrect,
[data-theme="dark"] .quiz-feedback,
[data-theme="dark"] .error-box { background: #391A22; border-color: #5C2A35; color: var(--danger); }
[data-theme="dark"] .card-dunno { border-color: #5C2A35; }
[data-theme="dark"] .card-dunno:active,
[data-theme="dark"] .word-item-del:active { background: #391A22; }
/* 級バッジ（紫・グレー）／反意語チップ（橙）／ワンポイント（黄）／ヒント枠線 */
[data-theme="dark"] .level-hard { background: #251A3B; color: #C3A9F6; }
[data-theme="dark"] .level-none { background: #232B3A; color: var(--text-sub); }
[data-theme="dark"] .chip.chip-ant { background: #3A241B; color: #F2B58F; }
[data-theme="dark"] .tip-box { background: #322912; border-color: #5A4A1E; }
[data-theme="dark"] .tip-box .section-title { color: #ECC766; }
[data-theme="dark"] .hook-box { border-color: #34406B; }
[data-theme="dark"] .image-phrase-box { background: #2A2340; border-color: #4A3D6B; }
[data-theme="dark"] .image-phrase-box .section-title { color: #C7B3F0; }
[data-theme="dark"] .flow-progress-fill { background: #2F8B57; }
/* トースト（ライトでは地=濃色だが、ダークでは --text が明色になり白文字が消えるため固定の暗色面に） */
[data-theme="dark"] .icon-toast { background: #323C52; color: var(--text); }
