/* 休薬情報データベース検索サイト — デジタル庁デザインシステムの基準 (コントラスト・フォーカス・タップ領域) に準拠 */
:root {
  --bg: #f3f8f5;        /* ごく淡いミントグリーン */
  --surface: #ffffff;   /* カード・ボタン・入力欄 (背景より一段明るく) */
  --subtle: #e8f1eb;    /* 表の見出し・引用・目次 */
  --text: #1a1a1c;
  --muted: #555a63;
  --border: #c9cbd1;
  --link: #0031d8;
  --focus: #ffd43d;
  --focus-ring: #1a1a1c;
  --primary: #0031d8;
  --on-primary: #ffffff;
  --high: #b3001b;      /* 周術期高リスク */
  --low: #8a4b00;       /* 周術期低リスク */
  --high-badge: #c4293f; --high-fill: #fdf0f2; --high-line: #eba8b2;   /* 一覧バッジ (淡め) */
  --low-badge: #99560a;  --low-fill: #fdf4e7;  --low-line: #e2bd8a;
  --ct: #00597a;        /* 造影CT */
  --ok: #1d6b2f;        /* 継続可 */
  --chip-on: #0031d8;
  --note-bg: #fff6d6;
  --note-border: #c78a00;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --surface: #1d1f24;
    --subtle: #262930;
    --text: #ececef;
    --muted: #b4b8c0;
    --border: #474b54;
    --link: #8fb0ff;
    --focus: #ffd43d;
    --focus-ring: #ffd43d;
    --primary: #8fb0ff;
    --on-primary: #0b0c0e;
    --high: #ff8a99;
    --low: #f3b45c;
    --high-badge: #ff9aa7; --high-fill: #3a1d22; --high-line: #7a3a44;
    --low-badge: #f3b45c;  --low-fill: #33260f;  --low-line: #6e5122;
    --ct: #6fd0f2;
    --ok: #7fd690;
    --chip-on: #8fb0ff;
    --note-bg: #2c2612;
    --note-border: #c78a00;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}
.wrap { max-width: 64rem; margin: 0 auto; padding: 0 16px; }
a { color: var(--link); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; box-shadow: 0 0 0 6px var(--focus); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ext { font-size: .8em; margin-left: .15em; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 8px; top: 8px; background: var(--bg); padding: 8px 12px; z-index: 10; }

.site-header { border-bottom: 1px solid var(--border); padding: 20px 0 12px; }
.site-title { font-size: 1.5rem; font-weight: 700; color: var(--text); text-decoration: none; }
.site-title .en { font-size: .95rem; font-weight: 500; color: var(--muted); margin-left: .4em; }
.site-lead { margin: 4px 0 0; color: var(--muted); }
main { padding: 20px 16px 40px; outline: none; }
main:focus, main:focus-visible { outline: none; box-shadow: none; }  /* 画面遷移時のプログラム的フォーカス用 */

.search label { display: block; font-weight: 700; margin-bottom: 6px; }
.search input {
  width: 100%; min-height: 48px; padding: 8px 14px; font-size: 1.05rem;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--text); border-radius: var(--radius);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.chip {
  min-height: 44px; padding: 6px 14px; font: inherit; font-size: .95rem; cursor: pointer;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px;
}
.chip[aria-pressed="true"] { color: var(--on-primary); background: var(--chip-on); border-color: var(--chip-on); }
.status { color: var(--muted); margin: 8px 0; min-height: 1.7em; }
.link-btn { font: inherit; color: var(--link); background: none; border: none; padding: 4px 2px; min-height: 44px;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.card {
  display: block; height: 100%; padding: 12px 14px; min-height: 44px;
  color: var(--text); text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.card:hover { border-color: var(--primary); }
.card .name { font-weight: 700; font-size: 1.05rem; }
.card .cat { color: var(--muted); font-size: .85rem; }
.card .hit { color: var(--muted); font-size: .85rem; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.badge { display: inline-block; padding: 1px 8px; font-size: .85rem; font-weight: 700;
  border: 2px solid currentColor; border-radius: 4px; }
.badge.high { color: var(--high-badge); background: var(--high-fill); border: 1px solid var(--high-line); }
.badge.low { color: var(--low-badge); background: var(--low-fill); border: 1px solid var(--low-line); }
.badge.ct { color: var(--ct); }
.badge.ok { color: var(--ok); }

/* 詳細 */
.back { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 8px; }
.detail h1 { font-size: 1.6rem; margin: 0; line-height: 1.4; }
.detail .cat { color: var(--muted); margin: 2px 0 12px; }
.alias { color: var(--muted); font-size: .9rem; margin: 0 0 12px; }
.big { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); margin: 12px 0 16px; }
.big .box { border: 2px solid currentColor; border-radius: var(--radius); padding: 10px 14px; }
.big .box .k { font-size: .85rem; font-weight: 700; }
.big .box .v { font-size: 1.6rem; font-weight: 700; line-height: 1.3; color: var(--text); }
.big .box.high { color: var(--high); } .big .box.low { color: var(--low); }
.big .box.ct { color: var(--ct); } .big .box.ok { color: var(--ok); }
.note { background: var(--note-bg); border-left: 4px solid var(--note-border); padding: 10px 14px; margin: 10px 0; border-radius: 4px; }
/* 作者の解釈 (原典の記述ではない) — 補足 (黄) と色を分ける */
.interp { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--muted); padding: 10px 14px; margin: 10px 0; border-radius: 4px; }
.tags { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.tags strong { color: var(--text); }
.interp-ref { font-size: .9rem; margin: 2px 0 0; }
.detail h2 { font-size: 1.2rem; margin: 26px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.hint { color: var(--muted); font-size: .9rem; margin: 4px 0 8px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { border-bottom: 1px solid var(--border); padding: 8px; text-align: left; vertical-align: top; }
th { background: var(--subtle); white-space: nowrap; }
td.num { white-space: nowrap; font-weight: 700; }
.deriv { display: inline-block; font-size: .8rem; padding: 0 6px; border: 1px solid var(--border); border-radius: 4px; white-space: nowrap; }
details { margin-top: 6px; }
summary { cursor: pointer; color: var(--link); min-height: 32px; }
blockquote { margin: 6px 0; padding: 6px 12px; border-left: 3px solid var(--border); color: var(--text); background: var(--subtle); }
.tr { color: var(--muted); font-size: .9rem; }
.loc { color: var(--muted); font-size: .85rem; }
.refs { padding-left: 1.2em; }
.refs li { margin-bottom: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; }
.btn {
  min-height: 44px; padding: 8px 16px; font: inherit; cursor: pointer;
  color: var(--on-primary); background: var(--primary); border: 1px solid var(--primary); border-radius: var(--radius);
}
.btn.secondary { color: var(--primary); background: transparent; }

.site-footer { border-top: 1px solid var(--border); padding: 16px 0 32px; color: var(--muted); font-size: .9rem; }
.site-footer .warn { color: var(--text); }
