/* =====================================================================
   ITパスナビ  ―  プチDXLab デザイントークン準拠
   ===================================================================== */
:root {
  --blue: #2F6A99; --blue-dark: #255779;
  --bg: #E6EDF4; --card: #ffffff; --line: #ADB8C4;
  --text: #1D2833; --muted: #5A6A78;
  --sun: #E8A64A; --sun-dark: #cf922f;
  --success: #3E9B6B; --warn: #B87A26; --error: #D2605E;
  --cat-s: #2a78d6;   /* ストラテジ */
  --cat-m: #1baf7a;   /* マネジメント */
  --cat-t: #eda100;   /* テクノロジ */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }  /* display指定のある要素でもhidden属性を効かせる */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", sans-serif;
  font-size: 16px; color: var(--text); background: var(--bg);
  min-height: 100dvh;
}
button { font-family: inherit; cursor: pointer; }

main { max-width: 560px; margin: 0 auto; }
.view { padding: 12px 14px 24px; }

/* ① 白ヘッダー（固定） */
.app-topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 8px 16px;
  background: #fff; border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 4px rgba(29, 40, 51, .06);
}
.brand-icon { width: 34px; height: 34px; flex: none; display: block; }
.brand-name {
  font-family: "Zen Maru Gothic", "Noto Sans JP", sans-serif;
  font-weight: 700; font-size: 19px; color: var(--text); letter-spacing: .01em;
}
.demo-badge {
  margin-left: auto; font-size: 12px; font-weight: 700; color: var(--warn);
  border: 1px solid var(--warn); border-radius: 999px; padding: 2px 10px;
}

/* ② 青の塗りカード（学習メニュー） */
.menu-card {
  background: var(--blue); color: #fff;
  border-radius: 16px; padding: 13px 16px 15px; margin: 0 0 12px;
  box-shadow: 0 4px 14px rgba(29, 40, 51, .18);
}
.menu-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.menu-label { font-weight: 800; font-size: 16px; letter-spacing: .02em; }
.menu-count { font-weight: 700; font-size: 13px; white-space: nowrap; }
.cat-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  -webkit-appearance: none; appearance: none;
  border: none; border-radius: 999px; padding: 9px 14px;
  font-size: 14px; font-weight: 600;
  background: rgba(255, 255, 255, .22); color: #fff;
}
.chip.is-on { background: #fff; color: var(--blue); }
.chip:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, .6); }

/* モード選択カード */
.mode-card {
  display: flex; align-items: center; gap: 14px; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 16px; margin-bottom: 10px; text-align: left;
  box-shadow: 0 1px 3px rgba(29, 40, 51, .07);
  transition: box-shadow .18s ease;
}
.mode-card:hover { box-shadow: 0 3px 10px rgba(29, 40, 51, .12); }
.mode-icon { font-size: 26px; flex: none; }
.mode-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.mode-name { font-size: 17px; font-weight: 700; color: var(--text); }
.mode-desc { font-size: 13px; color: var(--muted); }
.mode-arrow { font-size: 24px; color: var(--muted); flex: none; }

/* サブヘッダー（戻る＋タイトル） */
.subbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-height: 36px; }
.btn-back {
  -webkit-appearance: none; appearance: none;
  border: none; background: none; color: var(--blue);
  font-size: 15px; font-weight: 700; padding: 8px 6px 8px 0;
}
.subbar-title { font-size: 16px; font-weight: 800; flex: 1; text-align: center; }
.subbar-info { font-size: 14px; font-weight: 700; color: var(--muted); min-width: 52px; text-align: right; }

/* カテゴリタグ（左帯の代わりに小さな色タグ） */
.cat-tag {
  display: inline-block; font-size: 12px; font-weight: 700; color: #fff;
  border-radius: 999px; padding: 3px 12px; background: var(--muted);
}
.cat-tag[data-cat="ストラテジ"] { background: var(--cat-s); }
.cat-tag[data-cat="マネジメント"] { background: var(--cat-m); }
.cat-tag[data-cat="テクノロジ"] { background: var(--cat-t); }

/* 用語カード（フラッシュカード） */
.flash-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  min-height: 300px; padding: 24px 20px; margin-bottom: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  text-align: center; box-shadow: 0 1px 3px rgba(29, 40, 51, .07);
}
.flash-card:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(47, 106, 153, .35); }
.flash-word { font-size: 26px; font-weight: 800; line-height: 1.4; overflow-wrap: anywhere; }
.flash-hint { font-size: 13px; color: var(--muted); }
.flash-desc { font-size: 16px; line-height: 1.8; text-align: left; color: var(--text); }
.flash-controls { display: flex; gap: 8px; }
.flash-controls .btn-pill { flex: 1; }

/* ピル型ボタン */
.btn-pill {
  -webkit-appearance: none; appearance: none;
  border-radius: 999px; min-height: 46px; padding: 11px 18px;
  font-size: 15px; font-weight: 600; border: 1px solid transparent;
  transition: background .18s ease;
}
.btn-pill:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(47, 106, 153, .35); }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-ghost { background: var(--card); color: var(--blue); border-color: var(--line); }
.btn-wide { width: 100%; margin-top: 10px; }

/* 過去問 */
.quiz-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 16px; margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(29, 40, 51, .07);
}
.quiz-question { font-size: 17px; font-weight: 700; line-height: 1.7; margin-top: 10px; }
.quiz-choices { display: flex; flex-direction: column; gap: 8px; }
.choice-btn {
  -webkit-appearance: none; appearance: none;
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; font-size: 15px; line-height: 1.6; color: var(--text);
  min-height: 48px;
}
.choice-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(47, 106, 153, .35); }
.choice-num {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--muted); font-size: 13px; font-weight: 700;
}
.choice-btn.is-correct { border-color: var(--success); background: #ECF6F0; }
.choice-btn.is-correct .choice-num { background: var(--success); color: #fff; }
.choice-btn.is-wrong { border-color: var(--error); background: #FAEEEE; }
.choice-btn.is-wrong .choice-num { background: var(--error); color: #fff; }
.choice-btn:disabled { cursor: default; opacity: 1; }
.choice-btn.is-dim { opacity: .55; }

.quiz-result { margin-top: 14px; animation: fadein .2s ease; }
.quiz-judge { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 10px; }
.quiz-judge.ok { color: var(--success); }
.quiz-judge.ng { color: var(--error); }
.quiz-expl {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; font-size: 15px; line-height: 1.8;
}
.quiz-expl-label { font-size: 13px; font-weight: 800; color: var(--blue); margin-bottom: 6px; }

.quiz-done { animation: fadein .2s ease; }
.done-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px 20px; text-align: center; box-shadow: 0 1px 3px rgba(29, 40, 51, .07);
}
.done-title { font-size: 15px; font-weight: 700; color: var(--muted); }
.done-score { font-size: 34px; font-weight: 800; color: var(--blue); margin: 8px 0 2px; }
.done-rate { font-size: 14px; color: var(--muted); margin-bottom: 12px; }

/* 成績 */
.stats-total-card {
  background: var(--blue); color: #fff; border-radius: 16px;
  padding: 20px 16px; text-align: center; margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(29, 40, 51, .18);
}
.stats-total-label { font-size: 13px; font-weight: 700; opacity: .9; }
.stats-total-rate { font-size: 40px; font-weight: 800; line-height: 1.3; }
.stats-total-count { font-size: 13px; opacity: .9; }
.stats-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(29, 40, 51, .07);
}
.stats-card-title { font-size: 14px; font-weight: 800; color: var(--blue); margin-bottom: 12px; }
.cat-row { margin-bottom: 12px; }
.cat-row:last-child { margin-bottom: 0; }
.cat-row-head { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 5px; }
.cat-row-name { font-weight: 700; }
.cat-row-val { color: var(--muted); font-size: 13px; }
.cat-bar { height: 10px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.cat-bar > span { display: block; height: 100%; border-radius: 999px; transition: width .25s ease; }

.recent-list { list-style: none; }
.recent-list li {
  display: flex; align-items: baseline; gap: 8px;
  padding: 9px 0; border-bottom: 1px solid #E4E9EF; font-size: 14px;
}
.recent-list li:last-child { border-bottom: none; }
.recent-mark { flex: none; font-weight: 800; }
.recent-mark.ok { color: var(--success); }
.recent-mark.ng { color: var(--error); }
.recent-q { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-date { flex: none; font-size: 12px; color: var(--muted); }
.recent-empty { color: var(--muted); font-size: 14px; padding: 6px 0; }

/* ローディング・トースト */
.loading {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(230, 237, 244, .65);
  display: flex; align-items: center; justify-content: center;
}
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid rgba(47, 106, 153, .25); border-top-color: var(--blue);
  animation: spin .8s linear infinite;
}
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 60; background: var(--text); color: #fff;
  border-radius: 999px; padding: 11px 20px; font-size: 14px; font-weight: 600;
  box-shadow: 0 4px 14px rgba(29, 40, 51, .3);
  max-width: 90vw; text-align: center;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
