/* ==========================================================
   学年と教科からさがす（トップページ）＋ 教科×学年の表
   前回までの grade-matrix.css と丸ごと入れ替えてください。
   ========================================================== */

/* ---------- サイトの色（ヘッダーメニュー・サイドバーのアイコンと同じ） ---------- */
.finder,
.gm-table {
  --c-rank:   #5679c2;   /* ランキング（青） */
  --c-grade:  #c55380;   /* 学年（ピンク） */
  --c-grade-text: #a8406b;
  --c-kyouka: #72b053;   /* 教科・テーマ（緑） */
  --c-purpose:#cc8c2d;   /* 目的（オレンジ） */
}
/* まとまりごとの色：--g＝アイコン・線／--g-text＝数字の文字／--g-tint＝マウスを乗せた背景 */
.gm-g-kokugo { --g: #cc8e37; --g-text: #9a5f12; --g-tint: #fbf1e1; }  /* 国語（オレンジ） */
.gm-g-sansu  { --g: #658bce; --g-text: #3f68b3; --g-tint: #ecf1fa; }  /* 算数（青） */
.gm-g-chiiku { --g: #81b04e; --g-text: #467520; --g-tint: #eef6e6; }  /* 知育・その他（緑） */

/* ---------- 見出しの行（左：見出し／右：件数）＋ 2色の下線 ---------- */
#recommend.finder .finder__head {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px 16px;
  margin: 0 0 14px;
  padding: 0 0 10px;
  border-bottom: 1px solid #e6e6e6;     /* 下線（うすいグレー） */
}
#recommend.finder .finder__head::after {
  content: "";                          /* 下線の左はしにヘッダーメニューの4色 */
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 72px;
  height: 3px;
  background: linear-gradient(to right,
    var(--c-rank) 0 25%, var(--c-grade) 25% 50%,
    var(--c-kyouka) 50% 75%, var(--c-purpose) 75% 100%);
}

#recommend.finder .finder__title {
  display: block;                       /* サイト共通の h2 の指定を打ち消す */
  position: static;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  font-size: 1.3rem;
  font-weight: bold;
  line-height: 1.4;
  color: #333;
}
#recommend.finder .finder__title::before,
#recommend.finder .finder__title::after {
  content: none;
}

#recommend.finder .finder__lead {
  margin: 0;
  padding: 0;
  text-align: right;
  font-size: .9rem;
  font-weight: normal;
  line-height: 1.5;
  color: #555;
}
#recommend.finder .finder__lead strong {
  font-size: 1.15em;
  font-weight: bold;
  color: var(--c-grade-text);           /* ロゴのピンク */
}
#recommend.finder .finder__date {
  display: block;                       /* 日付は件数の下に小さく */
  font-size: .75rem;
  color: #999;
}

/* ---------- 表の下の2つの文（左：注記／右：お礼） ---------- */
#recommend.finder .finder__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 24px;
  margin: 10px 0 0;
  padding: 0;
}
#recommend.finder .finder__foot p {
  margin: 0;
  padding: 0;
  font-size: 12px;
  line-height: 1.7;
  color: #999;
}
#recommend.finder .finder__foot .nb {
  display: inline-block;                /* 文の途中で折り返さない */
}

/* ---------- 表 ---------- */
#recommend.finder .gm-wrap,
#recommend.finder .gm-table {
  margin: 0;                            /* サイト共通の表の余白を打ち消す */
}
.gm-wrap {
  overflow-x: auto;
}
.gm-table {
  width: 100%;
  table-layout: fixed;                  /* 学年の列をすべて同じ幅にする */
  border-collapse: collapse;
  margin: 0;
  font-size: 15px;
  background: #fff;
}
.gm-table col.gm-c-badge {
  width: 34px;                          /* 国・算・知のアイコンの列 */
}
.gm-table col.gm-c-subj {
  width: 5.2em;                         /* 教科名の列の幅 */
}
.gm-table th,
.gm-table td {
  height: 40px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid #ececec;
  background: #fff;
  text-align: center;
  vertical-align: middle;
}

/* 学年の見出し（上の行）：学年の色（ピンク）の線 */
.gm-table thead th,
.gm-table thead td {
  height: 42px;
  border-bottom: 2px solid var(--c-grade);
  font-size: 14px;
  font-weight: bold;
  color: #333;
}

/* 左上のすみ：操作の案内 */
.gm-table thead td.gm-corner {
  padding-left: 6px;                    /* 国・算・知のアイコンと頭をそろえる */
  text-align: left;
  font-size: 11px;
  font-weight: normal;
  line-height: 1.35;
  color: #999;
}

/* 国・算・知のアイコン（サイドバーと同じ形） */
.gm-table td.gm-group {
  text-align: center;
  vertical-align: middle;
}
.gm-table .gm-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: var(--g);
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  line-height: 1;
}

/* 教科名（左の列） */
.gm-table tbody th {
  padding-left: 4px;
  text-align: left;
  font-size: 14px;
  font-weight: bold;
  color: #333;
  white-space: nowrap;
}

/* 国語・算数・その他のまとまりの区切り */
.gm-table tbody + tbody > tr:first-child > th,
.gm-table tbody + tbody > tr:first-child > td {
  border-top: 2px solid #e6e6e6;
}

/* 学年名・教科名のリンク：細い点線の下線（学年はピンク、教科はまとまりの色） */
.gm-table a.gm-grade,
.gm-table a.gm-col {
  color: inherit;
  text-decoration: underline dotted;
  text-underline-offset: 4px;
}
.gm-table a.gm-grade {
  text-decoration-color: var(--c-grade);
}
.gm-table a.gm-col {
  text-decoration-color: var(--g);
}

/* 数字：マス全体を押せるようにする */
.gm-table a.gm-num {
  display: block;
  line-height: 40px;
  color: var(--g-text);                 /* 数字はまとまりの色 */
  font-weight: normal;
  text-decoration: none;
}
.gm-table a.gm-num.gm-many {
  font-weight: bold;                    /* 件数が多いマス（$manyAt 以上）：太字 */
}

/* PC：マウスを乗せたときだけ強調（スマホでは押した後に色が残らないように） */
@media (hover: hover) {
  .gm-table td.gm-has:hover {
    background: var(--g-tint);
  }
  .gm-table a.gm-num:hover {
    text-decoration: underline;
  }
  .gm-table a.gm-grade:hover {
    color: var(--c-grade-text);
    text-decoration-style: solid;
  }
  .gm-table a.gm-col:hover {
    color: var(--g-text);
    text-decoration-style: solid;
  }
}
.gm-table td.gm-has:active {
  background: var(--g-tint);            /* 押した瞬間の反応（スマホ向け） */
}
.gm-table a:focus-visible {
  outline: 2px solid #3a5bd9;
  outline-offset: -2px;
}

/* スマホ用の短い表示（PCでは隠す） */
.gm-table .gm-short {
  display: none;
}

/* ---------- スマホ ---------- */
@media (max-width: 600px) {
  #recommend.finder .finder__head {
    flex-direction: column;
    align-items: flex-start;
  }
  #recommend.finder .finder__title {
    font-size: 1.1rem;
  }
  #recommend.finder .finder__lead {
    text-align: left;
  }
  #recommend.finder .finder__date {
    display: inline;
    margin-left: .3em;
  }
  #recommend.finder .finder__foot {
    flex-direction: column;
  }
  #recommend.finder .finder__foot p {
    font-size: 11px;
  }
  .gm-table {
    font-size: 14px;
  }
  .gm-table col.gm-c-badge {
    width: 24px;
  }
  .gm-table col.gm-c-subj {
    width: 4.4em;
  }
  .gm-table .gm-badge {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    font-size: 11px;
  }
  .gm-table thead td.gm-corner {
    padding-left: 3px;
  }
  .gm-table tbody th {
    padding-left: 2px;
  }
  .gm-table tbody th {
    font-size: 13px;
  }
  .gm-table thead th {
    font-size: 12px;
    line-height: 1.25;
  }
  .gm-table .gm-long {
    display: none;
  }
  .gm-table .gm-short {
    display: inline;
  }
}

.gm-table a.gm-num {
  font-weight: 500;   /* ふつうの数字を少しだけ太く */
}