:root {
  --mypage-header-offset: 72px; /* DevTools で計測した ヘッダーの実際の高さ に書き換えてください */
  --accent-primary:#2563eb;
  --text-muted:#6b7280;
  --color-law:        #1e3a8a; /* 法令（青） */
  --color-physics:    #047857; /* 物理・科学（緑） */
  --color-safety:     #b45309; /* 性質と火災予防（橙） */

}

/* mypage.css 内に一ヶ所だけ .site-main を定義し直すイメージ */
.site-main {
  box-sizing: border-box;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  margin-top: var(--mypage-header-offset);
  padding: 1rem;
}

/* 大画面（例：601px 以上）ではもっと余裕を */
@media (min-width: 601px) {
  :root {
    --mypage-header-offset: 100px;
  }
}


html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }

.progress { display:flex; align-items:center; gap:.5rem; }


.progress span {
  flex-shrink: 0;
  min-width: 48px;
}

.progress-bar {
  flex: 1;
  background: #e0e0e0;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  width: 100%;
}

.progress-bar .fill {
  background: #556cd6;
  height: 100%;
  width: 0%;
  min-width: 2px;
  transition: width 0.3s ease;
}

.hidden {
  display: none !important;
}


/* 基本：バーの高さを少し出しておく */
.cat-bar .cat-fill { height: 0.75rem; min-width: 2px; } 



/* モバイル向け調整 */
@media (max-width: 768px) {
  body {
    font-size: 0.9rem;
  }
  .dashboard h3 {
    font-size: 1.1rem;
  }
  .dashboard p {
    font-size: 0.9rem;
  }
  /* タブのボタンを縦並びに */
  .chart-switch {
    flex-direction: column;
  }
  .chart-switch button {
    font-size: 0.9rem;
    padding: 0.4rem;
  }

  /* 分野別リストのバー高さ */
  .cat-bar .cat-fill {
    height: 0.8rem;
  }
  /* 小章のテキストを詰める */
  .category-progress ul li {
    margin-bottom: 0.3rem;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 0.8rem;
  }
  .dashboard h3 {
    font-size: 1rem;
  }
  .chart-switch button {
    font-size: 0.8rem;
  }
  /* 分野別リスト全体のマージンを縮める */
  .category-progress {
    padding-left: 0.5rem;
  }
  .category-progress ul li {
    margin-bottom: 0.2rem;
  }
  /* ボタンやリンクのタップ領域を確保 */
  .dashboard button,
  .chart-switch button {
    padding: 0.6rem;
  }
}

.chart-container {
  position: relative;
  height: 260px;           /* PC */
  max-width: 100%;
}

@media (max-width: 768px) {
  .chart-container { height: 220px; }  /* タブレット */
}
@media (max-width: 480px) {
  .chart-container { height: 200px; }  /* スマホ */
}

#progressChart {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ───────────────────────────────────── */
/* 分野別進捗 タブ切り替えスタイル       */
/* ───────────────────────────────────── */
.chart-switch {
  display: inline-flex;                   /* 横並び */
  gap: 1rem;                              /* タブ間の余白 */
  border-bottom: 2px solid var(--text-muted);
  margin-bottom: 1rem;                    /* 下のグラフとの余白 */
}

.chart-switch .tab {
  padding: 0.5em 1em;                     /* クリック領域を確保 */
  background: none;
  border: none;
  border-bottom: 4px solid transparent;   /* 下線のため透明ボーダー */
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.chart-switch .tab:hover {
  color: var(--accent-primary);
}

.chart-switch .tab.active {
  color: var(--accent-primary);           /* アクティブタブをアクセント色に */
  font-weight: 600;
  border-bottom-color: var(--accent-primary);
}

/* ───────────────────────────────────── */
/* 切り替わるコンテンツ表示制御          */
/* ───────────────────────────────────── */


/* 数字表示 
.progress-percent {
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: #444;
} */


.streak-info {
  font-size: 0.95rem;
  margin-top: 4px;
  color: #444;
}

.progress-percent {
  font-size: 0.85rem;
  margin-left: 4px;
  color: #555;
}

/* 進捗バーのトラック部分 */
.cat-bar {
  width: 100%;
  height: 0.75rem;            /* お好みで調整 */
  background-color: #e0e0e0;  /* トラックは薄いグレー */
  border-radius: 0.375rem;
  overflow: visible;
  margin: 0.25rem 0;
  position: relative;
}

/* ホバー時に吹き出しを表示 */
.cat-bar:hover::after {
  content: attr(data-percent);
  position: absolute;
  top: -1.6rem;       /* バーの上に出す */
  left: calc(var(--pct) * 1%); /* 任意で調節 */
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 0.2rem 0.4rem;
  border-radius: 0.3rem;
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 10;
}

/* ────────────────────── */
/* 進捗リストのインデント＆マーカーをリセット */
/* ────────────────────── */
#category-list,
#category-list ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ────────────────────── */
/* 全階層の li を flex 化して水平中央揃え */
/* ────────────────────── */
#category-list li {
  display: flex;
  align-items: center;
  white-space: nowrap;
  gap: 0.5rem;
}

/* ────────────────────── */
/* バー部分を flex アイテム化し幅を使い切る */
/* ────────────────────── */
#category-list li .cat-bar {
  flex: 1 1 auto;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ────────────────────── */
/* フィル要素を親バーにフィットさせる */
/* ────────────────────── */
#category-list li .cat-fill {
  height: 100%;
}

.category-toggle {
  /* ヘッダーボタンをフレックスに */
  display: flex;
  align-items: center;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem 0;
}
.category-toggle .cat-label {
  flex-shrink: 0;
  margin-right: 0.5rem;
}
.category-toggle[aria-expanded="false"] .cat-fill {
  /* 閉じているときは色をちょっと淡くする例 */
  opacity: 0.6;
}
.category-panel {
  padding-left: 1.5rem;  /* 階層インデント */
  margin-bottom: 1rem;
  list-style: none;
}
.category-panel li {
  display: flex;
  align-items: center;
  margin: 0.3rem 0;
}
.category-panel .cat-label.small {
  font-size: 0.9rem;
  margin-right: 0.5rem;
}


/* ベース */
.btn {
  display:inline-flex; align-items:center; justify-content:center;
  gap:.5rem; padding:.6rem 1rem; border-radius:.6rem;
  font-weight:600; line-height:1; border:1px solid transparent;
  cursor:pointer; transition:transform .02s ease, background-color .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }

/* Primary（青・白文字） */
.btn--primary {
  background:#2563eb; color:#fff; border-color:#2563eb;

}
.btn--primary:hover { background:#1d4ed8; border-color:#1d4ed8; }

/* Secondary（白背景・枠線） */
.btn--secondary {
  background:#fff; color:#111; border-color:#d1d5db;
}
.btn--secondary:hover{
  background:#f9fafb; border-color:#cbd5e1;
}

/* タブの見た目（軽く） */
.tab {
    padding:.4rem .8rem; 
    border-radius:.5rem; 
    border:1px solid transparent; 
} 
  
@media (prefers-reduced-motion:no-preference){ 
  .tab {transition:background .15s; }
}
.tab.active { background:#eef2ff; border-color:#c7d2fe; }
.tab-content { display:none; }
.tab-content.active { display:block; }





