/* 教科書ナビ
   見た目のもと：大学の学務システムのシラバス画面（薄い青の見出しの表）と、時間割。
   主の色は紺、価格だけ朱。ロゴとトップの見出しは教科書体（Klee One）、ほかは BIZ UDPゴシック。
   大胆にするのはトップの時間割だけ。ほかは静かに保つ。 */
:root {
  --bg: #ffffff;
  --ink: #23272f;
  --muted: #5b6270;
  --accent: #1d3461;
  --accent-ink: #ffffff;
  --head: #e8eef7;
  --line: #cfd8e6;
  --soft: #f3f6fb;
  --price: #c03a1c;
  --link: #1d3461;
  --surface: #ffffff;
  --accent-soft: #e8eef7;
  --t1: #eef3fa;
  --t2: #d7e1f0;
  --t3: #b9cae4;
  --radius: 4px;
  --sans: "BIZ UDPGothic", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  --kyokasho: "Klee One", "UD Digi Kyokasho NK-B", "UD デジタル 教科書体 NK-B", var(--sans);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131722;
    --ink: #e4e7ee;
    --muted: #9aa3b5;
    --accent: #a8bde4;
    --accent-ink: #0f1830;
    --head: #1f2738;
    --line: #313b50;
    --soft: #192030;
    --price: #f08f73;
    --link: #b4c7ea;
    --surface: #161b27;
    --accent-soft: #1f2738;
    --t1: #1c2537;
    --t2: #263452;
    --t3: #34497a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.85;
  font-variant-numeric: tabular-nums;
}
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--price); outline-offset: 2px; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* ヘッダー：紺の帯にロゴ */
.top { background: var(--accent); color: var(--accent-ink); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 24px; padding-top: 10px; padding-bottom: 10px; }
.logo { display: flex; align-items: baseline; gap: 12px; color: inherit; text-decoration: none; }
.logo-main { font-family: var(--kyokasho); font-weight: 600; font-size: 26px; letter-spacing: .06em; line-height: 1.3; }
.logo-sub { font-size: 12px; opacity: .8; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 14px; }
.nav a { color: inherit; text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a:hover { border-bottom-color: currentColor; }

main { padding-top: 4px; padding-bottom: 64px; }
h1 { font-size: clamp(23px, 4.2vw, 30px); line-height: 1.45; margin: 24px 0 6px; font-weight: 700; }
h2 { font-size: 20px; line-height: 1.5; margin: 48px 0 12px; font-weight: 700; color: var(--accent); }
h3 { font-size: 16px; margin: 20px 0 8px; }
.lead { margin-top: 0; color: var(--muted); }
small, .small { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }

.crumbs { font-size: 13px; color: var(--muted); margin-top: 14px; overflow-wrap: anywhere; }
.crumbs a { color: var(--muted); }
.crumbs .sep { margin: 0 6px; }

/* トップの見出しと検索 */
.hero { padding: 20px 0 4px; max-width: 680px; }
.hero h1 { font-family: var(--kyokasho); font-weight: 600; font-size: clamp(30px, 6.4vw, 44px); line-height: 1.35; letter-spacing: .02em; margin: 16px 0 10px; }
.search { position: relative; margin: 22px 0 4px; }
.search label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.search input {
  width: 100%; font: inherit; font-size: 18px; padding: 13px 16px; border-radius: var(--radius);
  border: 2px solid var(--accent); background: var(--surface); color: var(--ink); outline: none;
}
.search input:focus { box-shadow: 0 0 0 4px var(--t2); }
#results { list-style: none; margin: 6px 0 0; padding: 0; }
#results:not(:empty) { border: 1px solid var(--line); border-radius: var(--radius); }
#results li { border-bottom: 1px solid var(--line); }
#results li:last-child { border-bottom: 0; }
#results a { display: block; padding: 9px 14px; text-decoration: none; color: var(--ink); }
#results a:hover { background: var(--soft); }
#results a b { color: var(--link); }
#results .none { padding: 10px 14px; color: var(--muted); }

/* 時間割から探す（このサイトでいちばん目立たせるところ） */
.tt { margin-top: 44px; }
.tt h2 { margin-top: 0; }
.tt-controls { display: flex; flex-wrap: wrap; gap: 10px 16px; margin: 14px 0 12px; }
.seg { display: inline-flex; border: 1.5px solid var(--accent); border-radius: var(--radius); overflow: hidden; }
.seg button { font: inherit; font-size: 14px; padding: 6px 14px; border: 0; background: var(--surface); color: var(--accent); cursor: pointer; }
.seg button + button { border-left: 1.5px solid var(--accent); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
table.tt-grid { border-collapse: separate; border-spacing: 4px; width: 100%; max-width: 720px; margin-left: -4px; table-layout: fixed; }
.tt-grid thead th { font-size: 14px; font-weight: 700; color: var(--accent); padding: 2px 0 4px; text-align: center; }
.tt-grid thead th:first-child { width: 3.2em; }
.tt-grid tbody th { font-size: 18px; font-weight: 700; color: var(--accent); text-align: center; white-space: nowrap; }
.tt-grid tbody th small { font-size: 11px; margin-left: 1px; color: var(--muted); font-weight: 400; }
.tt-grid td { padding: 0; height: 56px; }
.tt-grid td.empty { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--soft) 6px 7px); border-radius: var(--radius); }
.tt-grid button {
  width: 100%; height: 100%; font: inherit; font-size: 18px; font-weight: 700; color: var(--accent);
  border: 0; border-radius: var(--radius); cursor: pointer;
}
.tt-grid .l1 { background: var(--t1); }
.tt-grid .l2 { background: var(--t2); }
.tt-grid .l3 { background: var(--t3); }
.tt-grid button:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.tt-grid button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.tt-list h3 { margin-top: 20px; color: var(--accent); }
.tt-list h3:focus { outline: none; }
@media (prefers-reduced-motion: no-preference) {
  .tt-list .tablewrap { animation: open .18s ease-out; }
  @keyframes open { from { opacity: 0; transform: translateY(-4px); } }
}

/* 表：シラバス画面の体裁（薄い青の見出し、罫は細く） */
.tablewrap { overflow-x: auto; }
table.classes, table.data { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); border: 1px solid var(--line); }
.classes th, .classes td, .data th, .data td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.classes thead th, .data thead th { font-size: 13px; font-weight: 700; color: var(--accent); white-space: nowrap; background: var(--head); }
.classes td:first-child { white-space: nowrap; }
.data td.num, .data th.num { text-align: right; white-space: nowrap; }
.data .nowrap { white-space: nowrap; }
.data td.rank { width: 2.8em; color: var(--muted); text-align: right; }
.data a { font-weight: 700; }
.src { font-size: 12px; margin-left: 6px; }

/* 書誌（本のページ） */
table.biblio { border-collapse: collapse; width: 100%; font-size: 14px; border: 1px solid var(--line); margin-top: 16px; }
.biblio th, .biblio td { text-align: left; vertical-align: top; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.biblio th { width: 6.5em; font-weight: 700; font-size: 13px; color: var(--accent); background: var(--head); white-space: nowrap; }

.list { padding-left: 1.3em; }
.list li { margin: 4px 0; }
.list.cols { columns: 2 260px; column-gap: 32px; }
.list.cols li { break-inside: avoid; }
.list .nobook { color: var(--muted); }

/* 授業ページの本 */
.book {
  display: flex; flex-wrap: wrap; gap: 10px 20px; justify-content: space-between; align-items: center;
  padding: 14px 16px; border: 1px solid var(--line); border-top: 0; margin: 0;
}
.lead + .book { border-top: 1px solid var(--line); margin-top: 18px; }
.book-main { flex: 1 1 320px; min-width: 0; }
.book-title { font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.book-title a { color: var(--ink); }
.book-meta { color: var(--muted); font-size: 14px; }
.book-isbn { color: var(--muted); font-size: 12px; }
.uses { margin-top: 2px; font-size: 13px; color: var(--accent); font-weight: 700; }
.buy { display: flex; flex-wrap: wrap; gap: 8px; }

/* ボタン */
.btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 96px;
  padding: 7px 14px; border-radius: var(--radius); border: 1.5px solid var(--accent); background: var(--surface); color: var(--accent);
  font: inherit; font-weight: 700; font-size: 14px; text-decoration: none; line-height: 1.35; cursor: pointer;
}
.btn small { font-size: 11px; color: var(--muted); font-weight: 400; }
.btn:hover { background: var(--soft); }
.btn.primary, .btn.wide, .stocklist .btn { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover, .btn.wide:hover, .stocklist .btn:hover { filter: brightness(1.15); }
.btn.wide { min-width: 220px; padding: 11px 20px; font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: default; }

.source { margin-top: 32px; font-size: 13px; color: var(--muted); }

/* 買う・売る、トップの買取の案内 */
.shop, .notice { border: 1px solid var(--line); border-radius: var(--radius); margin-top: 28px; background: var(--surface); overflow: hidden; }
.shop > h2, .notice > h2 { margin: 0; padding: 8px 16px; background: var(--head); color: var(--accent); font-size: 15px; }
.shop > :not(h2), .notice > :not(h2) { margin-left: 16px; margin-right: 16px; }
.shop > :last-child, .notice > :last-child { margin-bottom: 16px; }
.notice p { margin: 12px 16px; }
.stocklist { list-style: none; padding: 0; margin: 0; }
.stocklist li { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.stocklist b { font-size: 22px; color: var(--price); }
.sellbox { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.price { color: var(--price); font-weight: 700; font-size: 22px; }
.newbuy { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.newbuy a { margin-left: 10px; }

/* 運営について */
.operator { margin-top: 48px; padding: 16px 18px; background: var(--soft); border-radius: var(--radius); font-size: 14px; }
.operator p { margin: 4px 0; }

.foot { background: var(--soft); border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.foot .wrap { padding-top: 18px; padding-bottom: 28px; }
.foot p { margin: 6px 0; }

/* フォーム */
.cform { display: grid; gap: 12px; margin-top: 12px; max-width: 560px; }
.field { display: grid; gap: 4px; font-size: 14px; font-weight: 700; }
.field input, .field select, .field textarea, .sell input[type=search] {
  font: inherit; font-size: 16px; font-weight: 400; color: var(--ink); background: var(--surface); padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: var(--radius); width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus, .sell input[type=search]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--t2); }
.field small { margin-left: 4px; font-weight: 400; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 6px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.formmsg { min-height: 1.5em; color: var(--accent); font-weight: 700; margin: 0; }
.thanks { background: var(--soft); padding: 12px 14px; border-radius: var(--radius); }
.pick, .cart { list-style: none; padding: 0; margin: 8px 0; }
.pick button { width: 100%; text-align: left; font: inherit; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 0; padding: 8px 12px; margin: -1px 0 0; cursor: pointer; }
.pick button:hover { background: var(--soft); }
.cart li { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart .ct { flex: 1 1 260px; display: grid; }
.cart select { font: inherit; padding: 6px 8px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.cart .x { border: 0; background: none; color: var(--muted); font-size: 20px; cursor: pointer; }
.total { font-size: 16px; }
table.legal th { width: 30%; white-space: normal; }
.stocklist button { font-family: inherit; }
.waitform { margin-top: 12px; padding: 12px 0 0; border-top: 1px dashed var(--line); }
.waitform p { margin: 0 0 8px; }
.waitrow { display: flex; flex-wrap: wrap; gap: 8px; }
.waitrow input[type=email] { flex: 1 1 220px; font: inherit; font-size: 16px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }

@media (max-width: 560px) {
  .classes td:first-child { white-space: normal; }
  .btn { min-width: 84px; }
  .logo { flex-direction: column; gap: 0; }
  .data .hide-sm { display: none; }
  table.tt-grid { border-spacing: 3px; margin-left: -3px; }
  .tt-grid td { height: 46px; }
  .tt-grid button, .tt-grid tbody th { font-size: 16px; }
  .tt-grid thead th:first-child { width: 2.4em; }
  .tt-grid tbody th small { display: none; }
}
.stocklist li:last-child { border-bottom: 0; }
.formmsg:empty { display: none; }
