/* Layout: 上部に校名バーと絞り込み欄。本文はセクションごとのリンクカード格子。
   1タップで目的のツールへ。よく使う「授業関係」を最上段に、大きめのカードで。 */
:root {
  --bg: #eef2f6;          /* わずかに青みのある地色 */
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --ink: #15223a;
  --ink-2: #4c5a73;
  --ink-3: #7f8ba3;
  --line: #d6dde8;
  --accent: #0d5fa8;      /* 校章系の濃い青 */
  --accent-ink: #ffffff;
  --accent-soft: #e3eef9;
  --warn: #b25e00;
  --warn-soft: #fff1dd;
  --focus: #ffb547;
  --shadow: 0 1px 2px rgba(21,34,58,.06), 0 6px 18px -8px rgba(21,34,58,.14);
  --font-display: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic UI", "Meiryo", "Noto Sans JP", system-ui, sans-serif;
  --font-body: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic UI", "Meiryo", "Noto Sans JP", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1623; --surface: #182236; --surface-2: #1f2b42;
    --ink: #e8edf5; --ink-2: #b4bfd1; --ink-3: #7f8ba3; --line: #2b3a55;
    --accent: #6fb1f2; --accent-ink: #0b1a2c; --accent-soft: #1b3350;
    --warn: #ffb866; --warn-soft: #3a2a12; --focus: #ffd08a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 20px -10px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1623; --surface: #182236; --surface-2: #1f2b42;
  --ink: #e8edf5; --ink-2: #b4bfd1; --ink-3: #7f8ba3; --line: #2b3a55;
  --accent: #6fb1f2; --accent-ink: #0b1a2c; --accent-soft: #1b3350;
  --warn: #ffb866; --warn-soft: #3a2a12; --focus: #ffd08a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 20px -10px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---- header ---- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 8px; flex: none;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: .02em;
}
.brand-text { line-height: 1.25; min-width: 0; }
.brand-text .school { font-size: 11px; color: var(--ink-3); letter-spacing: .06em; }
.brand-text .title { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.search { margin-left: auto; position: relative; flex: 1 1 220px; max-width: 360px; }
.search svg { position: absolute; left: 11px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; }
.search input {
  width: 100%; height: 38px; padding: 0 12px 0 34px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2); color: var(--ink); font: inherit; font-size: 14px;
}
.search input::placeholder { color: var(--ink-3); }

/* ---- body ---- */
.page { max-width: 1120px; margin: 0 auto; padding: 24px 20px 48px; }
.sections { display: flex; flex-direction: column; gap: 32px; }
.section-head {
  display: flex; align-items: baseline; gap: 12px; margin: 0 0 12px;
}
.section-head h2 {
  margin: 0; font-family: var(--font-display); font-weight: 700;
  font-size: 18px; letter-spacing: .01em; text-wrap: balance;
}
.section-head .count { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.section-note {
  margin: 0 0 12px; font-size: 13.5px; color: var(--ink-2);
}
.section-note a { color: var(--accent); }

.grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.grid.primary { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

/* カード = リンクそのもの。1タップ領域を広く */
.card {
  position: relative; min-width: 0;
  display: grid; grid-template-columns: 40px 1fr; column-gap: 12px; align-items: start;
  padding: 14px 14px 14px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  text-decoration: none; color: var(--ink);
  transition: border-color .15s, box-shadow .15s, translate .15s;
}
.card:hover { border-color: var(--accent); box-shadow: var(--shadow); translate: 0 -1px; }
.card .icon {
  width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.card .icon svg { width: 22px; height: 22px; }
.card .body { min-width: 0; }
.card .name { font-weight: 700; font-size: 15px; line-height: 1.35; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card .name .ext { width: 12px; height: 12px; color: var(--ink-3); flex: none; }
.card .desc { margin-top: 3px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 11.5px; letter-spacing: .02em; line-height: 1.6;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

/* カード下部の補助リンク（UniTextアプリ等）: カード外に小さく */
.card-group { display: grid; gap: 6px; align-content: start; min-width: 0; }
.sublinks { display: flex; gap: 12px; flex-wrap: wrap; padding: 0 4px; font-size: 13px; }
.sublinks a { color: var(--accent); text-decoration: none; }
.sublinks a:hover { text-decoration: underline; }

/* 案内文のみのカード（JetBrains / 電子図書館） */
.note {
  grid-column: 1 / -1;
  padding: 14px 16px; border-radius: 10px;
  background: var(--surface-2); border: 1px dashed var(--line);
  font-size: 14px; color: var(--ink-2);
}
.note strong { color: var(--ink); }
.note a { color: var(--accent); }

.empty { display: none; padding: 32px 0; color: var(--ink-3); text-align: center; }
.sections.no-results .empty { display: block; }

footer {
  max-width: 1120px; margin: 0 auto; padding: 24px 20px 40px;
  border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-3); display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between;
}

@media (max-width: 560px) {
  .topbar-inner { padding: 10px 16px; }
  .page, footer { padding-left: 16px; padding-right: 16px; }
  .search { max-width: none; flex-basis: 100%; }
  .brand-text .title { font-size: 16px; }
  .grid, .grid.primary { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  .card:hover { translate: none; }
}

.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--accent); text-decoration: none; margin: 0 0 14px; }
.back:hover { text-decoration: underline; }
.back svg { width: 14px; height: 14px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 6px; }
.page-head h1 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: .01em; }
.lead { margin: 0 0 20px; font-size: 14px; color: var(--ink-2); max-width: 60ch; }
.card .meta { margin-top: 6px; font-size: 12px; color: var(--ink-3); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* ---- 注意書き（学外アクセス・BASIC認証） ---- */
.notice {
  display: grid; grid-template-columns: 40px 1fr; column-gap: 14px; align-items: start;
  margin: 0 0 24px; padding: 16px 18px 14px 14px;
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  border-radius: 10px; color: var(--ink);
}
.notice-icon {
  width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center;
  background: var(--surface); color: var(--warn);
}
.notice-icon svg { width: 22px; height: 22px; }
.notice-body { min-width: 0; }
.notice-body h2 { margin: 6px 0 6px; font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.notice-body p { margin: 0 0 10px; font-size: 14px; line-height: 1.65; color: var(--ink-2); }
.notice-foot { font-size: 13px; color: var(--warn); }
.cred {
  display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 12px;
  padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
.cred > div { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.cred dt { margin: 0; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.cred dd { margin: 0; min-width: 0; }
.cred code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "BIZ UDGothic", monospace;
  font-size: 15px; font-weight: 700; letter-spacing: .03em; color: var(--ink);
  user-select: all; -webkit-user-select: all; overflow-wrap: anywhere;
}
@media (max-width: 560px) {
  .notice { grid-template-columns: 1fr; padding: 14px; }
  .notice-icon { display: none; }
  .cred { flex-direction: column; }
}
