/* feed.superusers.app — 単一スタイルシート（ビルド工程なし）
   正本: docs/DESIGN.md。クラス名・構造はそこに書いた「マークアップ契約」と一致させること。
   目次: 1 トークン / 2 ベース / 3 レイアウト / 4 ヘッダー・フッター / 5 フィード / 6 タグ
         7 記事 / 8 本文(prose) / 9 フォーム・ボタン / 10 状態 / 11 管理画面 / 12 印刷 */

/* ───────── 1. トークン ───────── */
:root {
  --font-body: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", YuGothic,
    "Noto Sans JP", "Noto Sans CJK JP", Meiryo, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;

  --fs-xs: 0.75rem;     /* 12 等幅ラベル専用 */
  --fs-sm: 0.8125rem;   /* 13 メタ情報 */
  --fs-md: 0.9375rem;   /* 15 要約・UI */
  --fs-base: 1rem;      /* 16 */
  --fs-body: 1.0625rem; /* 17 記事本文 */
  --fs-lg: 1.1875rem;   /* 19 */
  --fs-xl: 1.375rem;    /* 22 */
  --fs-title: clamp(1.4375rem, 1.18rem + 1.3vw, 2rem); /* 23〜32 */

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;

  --gutter: clamp(16px, 5vw, 24px);
  --container: 68rem;
  --measure: 41rem;   /* 17px で全角 38 字前後 */
  --radius: 3px;
  --tap: 44px;

  /* ライト（製図用紙） */
  --bg: #f2f0ea;
  --surface: #e9e6dd;
  --sunken: #e4e0d6;
  --ink: #1b1a16;
  --ink-strong: #0b0a08;
  --ink-2: #403e37;
  --muted: #5f5c53;
  --line: rgba(27, 26, 22, 0.15);
  --line-strong: rgba(27, 26, 22, 0.34);
  --border: #7d796e;
  --accent: #d84315;        /* 図形・印（3:1 以上） */
  --accent-strong: #b23409; /* 文字・塗り（4.5:1 以上） */
  --on-accent: #fffdf8;
  --mark: #f6d9a8;
  --focus: #b23409;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1011;
    --surface: #17181b;
    --sunken: #1e2024;
    --ink: #e9e6e0;
    --ink-strong: #ffffff;
    --ink-2: #c6c2b9;
    --muted: #9c988e;
    --line: rgba(233, 230, 224, 0.14);
    --line-strong: rgba(233, 230, 224, 0.3);
    --border: #75726a;
    --accent: #ff5a2e;
    --accent-strong: #ff5a2e;
    --on-accent: #0f1011;
    --mark: #5a3d12;
    --focus: #ff5a2e;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1011;
  --surface: #17181b;
  --sunken: #1e2024;
  --ink: #e9e6e0;
  --ink-strong: #ffffff;
  --ink-2: #c6c2b9;
  --muted: #9c988e;
  --line: rgba(233, 230, 224, 0.14);
  --line-strong: rgba(233, 230, 224, 0.3);
  --border: #75726a;
  --accent: #ff5a2e;
  --accent-strong: #ff5a2e;
  --on-accent: #0f1011;
  --mark: #5a3d12;
  --focus: #ff5a2e;
  color-scheme: dark;
}

/* ───────── 2. ベース ───────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  scroll-padding-top: var(--s-5);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.7;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  line-break: strict;
  overflow-wrap: anywhere;
  text-autospace: normal;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote, pre, fieldset { margin: 0; }
ul, ol { padding: 0; }
h1, h2, h3, h4 {
  font-size: inherit;
  line-height: 1.45;
  color: var(--ink-strong);
  word-break: auto-phrase;
  text-wrap: pretty;
  text-spacing-trim: trim-start;
  font-feature-settings: "palt" 1;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
img, svg, video { max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: 0; }
button { cursor: pointer; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }
::selection { background: var(--accent-strong); color: var(--on-accent); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: var(--gutter); top: 0; z-index: 100;
  transform: translateY(-120%);
  padding: 10px 16px; min-height: var(--tap);
  display: inline-flex; align-items: center;
  background: var(--ink-strong); color: var(--bg);
  font-weight: 700; text-decoration: none; border-radius: 0 0 var(--radius) var(--radius);
}
.skip:focus { transform: none; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 16px; height: 16px; }

.mono, .label {
  font-family: var(--font-mono);
  font-feature-settings: normal;
}
.label {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}
.num { font-variant-numeric: tabular-nums; }

/* ───────── 3. レイアウト ───────── */
.wrap {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.main { flex: 1; padding-block: var(--s-5) var(--s-8); }
.main:focus { outline: none; }
@media (max-width: 559.98px) { .main { padding-top: var(--s-4); } }
.narrow { max-width: var(--measure); margin-inline: auto; }

.layout { display: grid; gap: var(--s-4); min-width: 0; }
.layout > * { min-width: 0; }
.layout > .page-head { padding-bottom: 0; } /* 1 カラムのあいだは .layout の gap だけで空ける */
@media (min-width: 1000px) {
  .layout {
    grid-template-columns: minmax(0, 42rem) minmax(0, 17rem);
    justify-content: space-between;
    column-gap: var(--s-8);
    row-gap: 0;
    align-items: start;
  }
  .layout > * { grid-column: 1; }
  .layout > .page-head { padding-bottom: var(--s-3); }
  /* 補助列は DOM の位置（.layout__main の前でも後ろでも）に関係なく右の列に置く */
  .layout__aside { grid-column: 2; grid-row: 1 / span 3; position: sticky; top: var(--s-5); }
}

.page-head { padding-bottom: var(--s-3); }
.page-head__label { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin-bottom: var(--s-2); }
.page-head__title { font-size: var(--fs-title); font-weight: 800; line-height: 1.35; }
.page-head__desc { margin-top: var(--s-2); color: var(--ink-2); font-size: var(--fs-md); line-height: 1.75; max-width: 38em; }
.page-head__desc a, .page-head__meta a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1.5px; }
.page-head__meta {
  display: flex; flex-wrap: wrap; gap: 2px var(--s-4);
  margin-top: var(--s-3); color: var(--muted); font-size: var(--fs-sm);
}
.page-head__meta strong { color: var(--ink); font-weight: 600; }
.page-head__links { display: flex; flex-wrap: wrap; gap: 0 var(--s-4); margin-top: var(--s-2); }
@media (max-width: 559.98px) {
  /* スマートフォンでは見出し部を詰め、最初の画面に記事を入れる（SPEC 13.2-6） */
  .page-head__meta { margin-top: var(--s-2); }
  .page-head__links { margin-top: 0; }
  .layout > .page-head > .page-head__links:last-child { margin-bottom: -8px; } /* リンクの 44px のうち、字の下の空きを次の間隔に重ねる */
  /* 小型の変種: 題と補足を 1 行に並べる（最新ページ用。入りきらない幅では補足が次の行に回る） */
  .page-head--compact { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s-3); }
  .page-head--compact .page-head__title { font-size: 1.25rem; line-height: 1.4; }
  .page-head--compact .page-head__meta { margin-top: 0; }
}

.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3);
  padding-top: var(--s-3); margin-top: var(--s-7); margin-bottom: var(--s-2);
  border-top: 1px solid var(--line-strong);
  position: relative;
}
.section-head::before {
  content: ""; position: absolute; left: 0; top: -1px; width: 24px; height: 2px; background: var(--accent);
}
.page-head + .section-head { margin-top: var(--s-5); }
.section-head__title { font-size: var(--fs-lg); font-weight: 700; }

/* 文中の補助リンク（下線つき・44px 高） */
.link {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap);
  color: var(--ink); font-size: var(--fs-md); font-weight: 600;
  text-decoration: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
}
.link:hover { color: var(--accent-strong); }

/* ───────── 4. ヘッダー・フッター ───────── */
.site-header { border-bottom: 1px solid var(--line-strong); background: var(--bg); }
.site-header__in {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: var(--s-3);
  padding-top: env(safe-area-inset-top);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; justify-self: start;
  color: var(--ink-strong); text-decoration: none;
  font-weight: 800; font-size: var(--fs-lg); letter-spacing: -0.01em; line-height: 1;
  white-space: nowrap;
}
.brand__mark { width: 22px; height: 22px; flex: none; }
.brand__mark .m-accent { fill: var(--accent); }
.brand__mark .m-ink { fill: currentColor; }
.brand__sub {
  font-family: var(--font-mono); font-weight: 600; font-size: 0.8em;
  color: var(--accent-strong); letter-spacing: 0.02em; margin-left: -2px;
}
.site-actions { display: flex; align-items: center; gap: 2px; margin-right: -10px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap);
  background: none; border: 0; border-radius: var(--radius);
  color: var(--ink); text-decoration: none;
}
.icon-btn:hover { background: var(--surface); }

/* テーマ切替: JS があるときだけ表示。状態は html[data-theme] で決まる */
.theme-toggle { display: none; }
.js .theme-toggle { display: inline-flex; }
.theme-toggle .icon { display: none; }
:root:not([data-theme]) .theme-toggle .icon--auto,
:root[data-theme="light"] .theme-toggle .icon--light,
:root[data-theme="dark"] .theme-toggle .icon--dark { display: block; }

.site-nav { grid-column: 1 / -1; margin-inline: -10px; }
.site-nav ul { display: flex; list-style: none; gap: 0; }
.site-nav a {
  position: relative;
  display: inline-flex; align-items: center; min-height: var(--tap);
  padding: 0 10px;
  color: var(--muted); font-size: var(--fs-md); font-weight: 600; text-decoration: none;
  white-space: nowrap;
}
.site-nav button {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 10px;
  background: none; border: 0; color: var(--muted); font-size: var(--fs-md); font-weight: 600; white-space: nowrap;
}
.site-nav__end { margin-left: auto; }
.site-nav a:hover, .site-nav button:hover { color: var(--ink-strong); }
.site-nav a[aria-current] { color: var(--ink-strong); }
.site-nav a[aria-current]::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--accent);
}
@media (min-width: 720px) {
  .site-header__in { grid-template-columns: auto 1fr auto; column-gap: var(--s-5); }
  .brand { min-height: 60px; }
  .site-nav { grid-column: 2; grid-row: 1; margin: 0; align-self: stretch; }
  .site-nav ul { height: 100%; }
  .site-nav a { height: 100%; }
  /* 管理ナビのログアウト（form > button）もリンクと同じ高さ・同じ基線にそろえる */
  .site-nav li, .site-nav form { display: flex; height: 100%; }
  .site-nav button { height: 100%; }
  .site-actions { grid-column: 3; }
}

.site-footer {
  border-top: 1px solid var(--line-strong);
  padding-block: var(--s-5) calc(var(--s-6) + env(safe-area-inset-bottom));
  color: var(--muted); font-size: var(--fs-sm);
}
.site-footer__nav { display: flex; flex-wrap: wrap; gap: 0 var(--s-4); list-style: none; margin-bottom: var(--s-3); }
.site-footer__nav a {
  display: inline-flex; align-items: center; min-height: var(--tap);
  color: var(--ink-2); text-decoration: none; font-weight: 600;
}
.site-footer__nav a:hover { color: var(--ink-strong); text-decoration: underline; }
.site-footer__note { max-width: 44em; line-height: 1.75; }
.site-footer__sig { margin-top: var(--s-3); font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: 0.04em; }
.site-footer__sig a { color: inherit; }

/* ───────── 5. フィード ───────── */
/* 種別フィルタ（セグメント） */
.seg { display: flex; list-style: none; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.seg li { flex: 1; }
.seg li + li { border-left: 1px solid var(--border); }
.seg a {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 var(--s-2);
  color: var(--ink-2); font-size: var(--fs-md); font-weight: 600; text-decoration: none;
  white-space: nowrap;
}
.seg a:hover { background: var(--surface); }
.seg a[aria-current] { background: var(--ink-strong); color: var(--bg); }
.seg--auto { display: inline-flex; }
.seg--auto a { padding: 0 var(--s-4); }
.feed-tools { margin-bottom: var(--s-3); }

/* 見張り中タグの帯（モバイル: 横スクロール / デスクトップ: サイドバー） */
.watch { min-width: 0; }
.watch__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.watch__list {
  display: flex; gap: var(--s-2); list-style: none;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
  margin-inline: calc(var(--gutter) * -1); padding: 4px var(--gutter);
}
.watch__list::-webkit-scrollbar { display: none; }
.watch__list li { flex: none; }
.watch__note { display: none; }
@media (max-width: 559.98px) {
  /* 「すべてのタグ」は、すぐ上のナビ「タグ」と同じ行き先。スマートフォンでは省いて 1 行ぶん詰める */
  .watch__head .link { display: none; }
  .watch__list { margin-top: var(--s-1); }
}
@media (max-width: 999.98px) {
  /* タグ別ページ: 帯を .layout__main の後ろに置いたとき（一覧の下の補足） */
  .layout__main + .watch { margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--line-strong); }
  .layout__main + .watch .watch__list { flex-wrap: wrap; row-gap: var(--s-3); overflow: visible; margin: var(--s-3) 0 0; padding: 0; }
}
@media (min-width: 1000px) {
  .watch { border-top: 1px solid var(--line-strong); padding-top: var(--s-3); }
  .watch__list { flex-wrap: wrap; overflow: visible; margin: var(--s-2) 0 0; padding: 0; }
  .watch__note { display: block; margin-top: var(--s-3); color: var(--muted); font-size: var(--fs-sm); line-height: 1.7; }
}

/* 日付の区切り */
.day { margin-top: var(--s-5); }
.day:first-child { margin-top: 0; }
.day__head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: var(--s-3);
  min-height: 36px; padding-top: env(safe-area-inset-top);
  background: var(--bg);
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-feature-settings: normal;
  font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0.02em;
  color: var(--ink-2);
}
.day__head time { color: var(--ink-strong); }
.day__head::after {
  content: ""; flex: 1; height: 7px; min-width: 24px;
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 1px, transparent 1px 8px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 60%);
  mask-image: linear-gradient(90deg, transparent, #000 60%);
}
.day__count { color: var(--muted); font-weight: 400; }

.feed { list-style: none; }
.feed > li { border-bottom: 1px solid var(--line); }
.day .feed > li:last-child { border-bottom: 0; }
.entry { padding: var(--s-4) 0 18px; }
.entry__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px;
  color: var(--muted); font-size: var(--fs-sm); line-height: 1.5;
}
.entry__meta time { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.entry__src { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 14em; }
.entry__src::before, .entry__flag::before { content: "·"; margin-right: 10px; color: var(--muted); }
.entry__flag { color: var(--accent-strong); font-weight: 700; }
.entry__title { font-size: 1.125rem; font-weight: 700; line-height: 1.5; margin-top: 2px; }
.entry__title a { display: block; padding: 6px 0; color: var(--ink-strong); text-decoration: none; }
.entry__title a:hover { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.entry__title a:visited { color: var(--ink-2); }
.entry__summary { max-width: 40em; color: var(--ink-2); font-size: var(--fs-md); line-height: 1.75; }
.entry__summary mark, .entry__title mark { background: var(--mark); color: inherit; padding: 0 1px; }
.entry .tags { margin-top: 10px; }
@media (min-width: 720px) {
  .entry__title { font-size: 1.25rem; }
}
/* 関連記事などの簡略表示 */
.feed--compact .entry { padding: 10px 0 8px; }
.feed--compact .entry__title { font-size: var(--fs-base); }

/* 種別ラベル: 色だけに頼らず「語＋形」で区別する */
.kind {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-strong); font-size: var(--fs-sm); font-weight: 700; white-space: nowrap;
}
.kind::before { content: ""; width: 8px; height: 8px; flex: none; }
.kind--news::before { background: var(--accent); border-radius: 50%; }
.kind--research::before { border: 2px solid var(--ink-strong); }

/* タグチップ */
.tags { display: flex; flex-wrap: wrap; gap: 12px 6px; list-style: none; }
.tag {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--ink); font-size: var(--fs-sm); font-weight: 600; line-height: 1.2;
  text-decoration: none; white-space: nowrap; max-width: 100%;
}
.tag::after { content: ""; position: absolute; inset: -6px -1px; } /* タップ領域を 44px に */
.tag:hover { border-color: var(--ink); background: var(--surface); }
.tag--watch::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.tag__count { color: var(--muted); font-family: var(--font-mono); font-weight: 400; font-variant-numeric: tabular-nums; }

/* 小さな状態表示 */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--ink-2); font-size: var(--fs-xs); font-weight: 700; line-height: 1.5; white-space: nowrap;
}
.badge--watch { border-color: var(--accent); color: var(--ink-strong); }
.badge--watch::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.badge--off { border-style: dashed; color: var(--muted); }
.badge--alert { border-color: var(--accent-strong); color: var(--accent-strong); }

/* もっと読む */
.more { display: flex; justify-content: center; margin-top: var(--s-5); }
.more .btn { width: 100%; max-width: 22rem; }
.more[aria-busy="true"] .btn { opacity: 0.6; pointer-events: none; }
.feed-end { margin-top: var(--s-5); text-align: center; color: var(--muted); font-size: var(--fs-sm); }

/* ───────── 6. タグ一覧 ───────── */
.taglist { list-style: none; border-top: 1px solid var(--line); }
.taglist > li { border-bottom: 1px solid var(--line); }
.tagrow {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--s-3);
  align-items: baseline;
  padding: 14px 0; min-height: var(--tap);
  color: inherit; text-decoration: none;
}
.tagrow__name { display: flex; align-items: center; gap: var(--s-2); color: var(--ink-strong); font-size: var(--fs-body); font-weight: 700; line-height: 1.4; }
.tagrow--watch .tagrow__name::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.tagrow__count { color: var(--ink-2); font-family: var(--font-mono); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tagrow__desc {
  grid-column: 1 / -1; color: var(--ink-2); font-size: var(--fs-md); line-height: 1.65;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.tagrow__meta { grid-column: 1 / -1; color: var(--muted); font-size: var(--fs-sm); }
.tagrow:hover .tagrow__name { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }

/* ───────── 7. 記事 ───────── */
.progress { display: none; }
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .progress {
      display: block; position: fixed; inset: 0 0 auto 0; z-index: 50; height: 3px;
      background: var(--accent); transform-origin: 0 50%;
      animation: progress linear both; animation-timeline: scroll(root block);
    }
  }
}
@keyframes progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.article { max-width: var(--measure); margin-inline: auto; }
.article > * { min-width: 0; }
.article__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--s-3);
  color: var(--muted); font-size: var(--fs-sm);
}
.article__meta time { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.article__title {
  margin-top: var(--s-2);
  font-size: var(--fs-title); font-weight: 800; line-height: 1.4; letter-spacing: 0.005em;
}
.dek { margin-top: var(--s-3); color: var(--ink-2); font-size: var(--fs-body); line-height: 1.8; }
.article__head .tags { margin-top: var(--s-4); }
.ai-note {
  display: flex; gap: var(--s-2); align-items: flex-start;
  margin-top: var(--s-4); padding-top: var(--s-3);
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: var(--fs-sm); line-height: 1.7;
}
.ai-note .icon { margin-top: 3px; }
.ai-note a { color: var(--ink-2); }
.ai-note code { font-family: var(--font-mono); color: var(--ink-2); }

/* 要点 */
.highlights {
  position: relative;
  margin-top: var(--s-5); padding: var(--s-4) var(--s-4) var(--s-4);
  background: var(--surface);
  border-top: 2px solid var(--accent);
}
.highlights__title { display: block; margin-bottom: var(--s-2); color: var(--ink-2); font-size: var(--fs-sm); }
.highlights ul { list-style: none; }
.highlights li {
  position: relative; padding-left: 1.25em;
  font-size: var(--fs-base); line-height: 1.75; color: var(--ink-strong);
}
.highlights li + li { margin-top: var(--s-2); }
.highlights li::before {
  content: ""; position: absolute; left: 0.1em; top: 0.72em;
  width: 6px; height: 6px; background: var(--accent);
}

/* 目次 */
.toc { margin-top: var(--s-5); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.toc summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  min-height: var(--tap); padding: 0 var(--s-4);
  font-size: var(--fs-md); font-weight: 700; color: var(--ink-strong);
  cursor: pointer; list-style: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: "+"; font-family: var(--font-mono); font-size: var(--fs-lg); font-weight: 400; color: var(--muted); }
.toc details[open] summary::after { content: "−"; }
.toc__count { margin-left: var(--s-2); color: var(--muted); font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 400; }
.toc ol { list-style: none; }
.toc details > ol { padding: var(--s-2) var(--s-4) var(--s-3) var(--s-1); border-top: 1px solid var(--line); }
.toc ol ol { padding-left: var(--s-4); }
.toc a {
  display: flex; align-items: center; min-height: var(--tap); padding: 6px 0 6px var(--s-3);
  color: var(--ink-2); font-size: var(--fs-md); line-height: 1.5; text-decoration: none;
}
.toc ol ol a { font-size: var(--fs-sm); }
.toc a:hover { color: var(--ink-strong); text-decoration: underline; }
.toc a[aria-current] { color: var(--ink-strong); font-weight: 700; box-shadow: inset 2px 0 0 var(--accent); }

@media (min-width: 1100px) {
  .article--toc {
    max-width: none;
    display: grid;
    grid-template-columns: minmax(0, var(--measure)) minmax(0, 16rem);
    justify-content: space-between;
    column-gap: var(--s-7);
  }
  .article--toc > * { grid-column: 1; }
  .article--toc > .toc {
    grid-column: 2; grid-row: 1 / span 6;
    align-self: start; position: sticky; top: var(--s-5);
    margin-top: 0; border: 0; border-top: 1px solid var(--line-strong); border-radius: 0;
    max-height: calc(100vh - var(--s-7)); overflow-y: auto;
  }
  .article--toc > .toc summary { padding: 0; pointer-events: none; }
  .article--toc > .toc details summary::after { content: none; }
  .article--toc > .toc details > ol { padding: 0; border-top: 0; }
  .article--toc > .toc a { min-height: 32px; padding-block: 4px; font-size: var(--fs-sm); }
}

/* 記事フッター（出典・更新履歴・共有・関連） */
.article__foot { margin-top: var(--s-7); }
.article__foot > .section-head:first-child { margin-top: 0; }

.sources { list-style: none; counter-reset: src; }
.sources > li { border-bottom: 1px solid var(--line); counter-increment: src; }
.source {
  display: grid; grid-template-columns: 2.25em minmax(0, 1fr) auto; gap: 0 var(--s-1); align-items: start;
  padding: var(--s-3) 0; min-height: var(--tap);
  color: inherit; text-decoration: none;
}
.source::before { content: counter(src, decimal-leading-zero); font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--muted); line-height: 1.75; }
.source__title { font-size: var(--fs-md); font-weight: 600; line-height: 1.6; color: var(--ink-strong);
  text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1.5px; }
.source__meta { grid-column: 2; color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; }
.source .icon { grid-column: 3; grid-row: 1; margin-top: 4px; color: var(--muted); }
.source:hover .source__title { color: var(--accent-strong); }

.updates { list-style: none; }
.updates > li { display: grid; gap: 0 var(--s-3); padding: var(--s-3) 0; border-bottom: 1px solid var(--line); font-size: var(--fs-md); line-height: 1.7; }
.updates time { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
@media (min-width: 560px) { .updates > li { grid-template-columns: 11.5em minmax(0, 1fr); } }

.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px var(--s-4); font-size: var(--fs-md); line-height: 1.7; }
.facts dt { color: var(--muted); white-space: nowrap; }
.facts dd { color: var(--ink); min-width: 0; }
.facts code { font-family: var(--font-mono); font-size: 0.92em; }

.share { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-5); }
.share .btn { flex: 1 1 9.5rem; }

/* ───────── 8. 本文（サーバー生成 HTML） ───────── */
.prose {
  margin-top: var(--s-6);
  font-size: var(--fs-body);
  line-height: 1.85;
  color: var(--ink);
}
.article__head + .prose { margin-top: var(--s-6); }
.prose--doc { margin-top: var(--s-4); }
.toc + .prose { margin-top: var(--s-5); }
.prose > * + * { margin-top: 1.35em; }
.prose > :first-child { margin-top: 0; }

.prose h2, .prose h3, .prose h4 { scroll-margin-top: var(--s-5); font-weight: 700; }
.prose h2 {
  position: relative;
  margin-top: 2.6em; padding-top: 0.85em;
  border-top: 1px solid var(--line-strong);
  font-size: var(--fs-xl); line-height: 1.45;
}
.prose h2::before { content: ""; position: absolute; left: 0; top: -1px; width: 24px; height: 2px; background: var(--accent); }
.prose h3 { margin-top: 2.1em; font-size: var(--fs-lg); line-height: 1.5; }
.prose h4 { margin-top: 1.8em; font-size: var(--fs-body); line-height: 1.6; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: 0.75em; }
.prose h2 a, .prose h3 a, .prose h4 a { text-decoration: none; }

.prose a {
  color: var(--ink-strong);
  text-decoration: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px; text-underline-offset: 0.24em;
}
.prose a:hover { color: var(--accent-strong); }
.prose strong { font-weight: 700; color: var(--ink-strong); }
.prose em { font-style: normal; font-weight: 600; color: var(--ink-strong); } /* 和文に斜体は使わない */
.prose del, .prose s { color: var(--muted); text-decoration: line-through; }
.prose ins { text-decoration: underline double; text-decoration-color: var(--muted); text-decoration-thickness: 1px; text-underline-offset: 0.2em; } /* リンク（朱色の 1 本線）と形で分ける */
.prose abbr[title] { text-decoration: underline dotted; text-decoration-color: var(--muted); text-decoration-thickness: 1.5px; text-underline-offset: 0.24em; cursor: help; }
.prose q { quotes: "「" "」" "『" "』"; }
.prose cite { font-style: normal; }
.prose mark { background: var(--mark); color: inherit; padding: 0.05em 0.15em; }
.prose sup, .prose sub { font-size: 0.72em; line-height: 0; }
.prose kbd {
  font-family: var(--font-mono); font-size: 0.82em;
  padding: 0.1em 0.45em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: var(--radius);
  background: var(--surface); white-space: nowrap;
}

.prose ul, .prose ol { padding-left: 1.45em; }
.prose li { padding-left: 0.15em; }
.prose li + li, .prose li > ul, .prose li > ol { margin-top: 0.4em; }
.prose li > p + p { margin-top: 0.6em; }
.prose ul { list-style: square; }
.prose ul ul { list-style: circle; }
.prose li::marker { color: var(--muted); }
.prose ol > li::marker { font-family: var(--font-mono); font-size: 0.88em; font-variant-numeric: tabular-nums; }

/* 用語の説明（dl） */
.prose dt { font-weight: 700; color: var(--ink-strong); line-height: 1.6; }
.prose dd { margin-top: 0.2em; padding-left: 1.05em; border-left: 1px solid var(--line-strong); color: var(--ink-2); }
.prose dd + dt { margin-top: 1em; }
.prose dd + dd { margin-top: 0.5em; }

.prose blockquote {
  padding: 0.1em 0 0.1em 1.05em;
  border-left: 2px solid var(--line-strong);
  color: var(--ink-2);
}
.prose blockquote > * + * { margin-top: 0.8em; }
.prose blockquote cite, .prose blockquote footer { display: block; color: var(--muted); font-size: var(--fs-sm); font-style: normal; }

.prose code {
  font-family: var(--font-mono); font-size: 0.875em; font-feature-settings: normal;
  padding: 0.12em 0.36em; border-radius: var(--radius);
  background: var(--sunken); color: var(--ink-strong);
}
.prose pre {
  overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
  padding: 14px var(--s-4);
  background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 0.875rem; line-height: 1.65;
  tab-size: 2; white-space: pre; overflow-wrap: normal; line-break: auto; text-autospace: no-autospace;
}
.prose pre code { padding: 0; background: none; font-size: inherit; color: var(--ink); white-space: inherit; }
.codeblock { position: relative; }
.codeblock[data-lang]::before {
  content: attr(data-lang);
  display: flex; align-items: center; min-height: var(--tap); padding: 0 var(--s-4);
  background: var(--sunken); border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.codeblock[data-lang] pre { border-top-left-radius: 0; border-top-right-radius: 0; }
.codeblock__copy {
  position: absolute; top: 0; right: 0;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 56px; height: var(--tap); padding: 0 var(--s-3);
  background: var(--sunken); border: 0; border-left: 1px solid var(--line); border-radius: 0 var(--radius) 0 0;
  color: var(--ink-2); font-size: var(--fs-xs); font-weight: 600;
}
.codeblock:not([data-lang]) .codeblock__copy { top: 1px; right: 1px; border-bottom: 1px solid var(--line); border-radius: 0 2px 0 var(--radius); }
/* 言語名の帯が無いときは、ボタンがコードの右上に重なる。右の余白をボタンの幅だけ広げて、横に動かせば行の終わりまで読めるようにする */
.codeblock:not([data-lang]) > pre { padding-right: calc(60px + var(--s-4)); }
.codeblock__copy:hover { color: var(--ink-strong); }
/* キーボードで pre に来たときの輪は、帯とボタンを含む枠の全体に出す（pre だけに出すと、帯との境目とボタンで輪が切れる）。:has() の無いブラウザーでは pre の輪のまま */
@supports selector(:has(*)) {
  .codeblock:has(> pre:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius); }
  .codeblock > pre:focus-visible { outline: none; }
}

/* 表: 必ず .table-wrap で包む（横スクロールはこの中だけ） */
.table-wrap {
  overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background:
    linear-gradient(90deg, var(--bg) 30%, transparent) left / 32px 100% no-repeat local,
    linear-gradient(270deg, var(--bg) 30%, transparent) right / 32px 100% no-repeat local,
    linear-gradient(90deg, var(--line-strong), transparent) left / 10px 100% no-repeat scroll,
    linear-gradient(270deg, var(--line-strong), transparent) right / 10px 100% no-repeat scroll;
}
.table-wrap table { width: max-content; min-width: 100%; font-size: var(--fs-md); line-height: 1.6; }
.table-wrap th, .table-wrap td {
  padding: 10px 12px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line); max-width: 18em;
}
.table-wrap th { font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); white-space: nowrap; border-bottom-color: var(--line-strong); }
.table-wrap tbody th { border-bottom-color: var(--line); }
.table-wrap tbody tr:last-child > * { border-bottom: 0; }
.table-wrap [align="right"], .table-wrap .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap [align="center"] { text-align: center; }
.table-wrap tfoot > tr > * { border-top: 1px solid var(--line-strong); border-bottom: 0; color: var(--ink-2); font-weight: 600; white-space: normal; }
.table-wrap tfoot > tr + tr > * { border-top-color: var(--line); }
/* 文書ページ（/about・/docs/agents）の表: 720px 未満では枠の幅に収めて、横に動かさずに読めるようにする。
   2 列の表はセルの中で折り返す。3 列以上の表は 1 行を 2 段に組む（最後の列を下の段に回す。見出しの行も同じ形）。
   :has() の無いブラウザーでは 3 列以上も「折り返し」になり、収まらないときは記事の表と同じく枠の中で横に動く。 */
@media (max-width: 719.98px) {
  .prose--doc .table-wrap table { width: 100%; }
  .prose--doc .table-wrap th, .prose--doc .table-wrap td { max-width: none; padding-inline: 10px; overflow-wrap: break-word; }
  .prose--doc .table-wrap td { min-width: 4.5em; }
  .prose--doc .table-wrap td:first-child { min-width: 6em; }

  .prose--doc .table-wrap table:has(tr > :nth-child(3)),
  .prose--doc .table-wrap table:has(tr > :nth-child(3)) :is(thead, tbody, tfoot) { display: block; }
  .prose--doc .table-wrap table:has(tr > :nth-child(3)) tr {
    display: flex; flex-wrap: wrap; align-items: baseline; border-bottom: 1px solid var(--line);
  }
  .prose--doc .table-wrap table:has(tr > :nth-child(3)) thead tr { border-bottom-color: var(--line-strong); }
  .prose--doc .table-wrap table:has(tr > :nth-child(3)) tbody tr:last-child { border-bottom: 0; }
  .prose--doc .table-wrap table:has(tr > :nth-child(3)) :is(th, td) {
    flex: 0 1 auto; min-width: 0; padding: 10px 10px 0; border-bottom: 0; white-space: normal; text-align: left;
  }
  .prose--doc .table-wrap table:has(tr > :nth-child(3)) :is(th, td):first-child { flex: 1 1 0; min-width: 6em; }
  .prose--doc .table-wrap table:has(tr > :nth-child(3)) :is(th, td):last-child { flex: 0 0 100%; padding: 2px 10px 10px; }
  .prose--doc .table-wrap table:has(tr > :nth-child(3)) td:not(:first-child):not(:last-child) { color: var(--ink-2); }
}
.table-wrap caption { caption-side: top; padding: 8px 12px; color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; text-align: left; border-bottom: 1px solid var(--line-strong); }

.prose img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.prose figure > * + * { margin-top: 0; }
.prose figcaption { margin-top: var(--s-2); color: var(--muted); font-size: var(--fs-sm); line-height: 1.7; }

.prose hr {
  height: 7px; border: 0; margin-block: 2.4em;
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 1px, transparent 1px 8px) center / 65px 100% no-repeat;
}

.prose details { border: 1px solid var(--line-strong); border-radius: var(--radius); }
.prose summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  min-height: var(--tap); padding: 8px var(--s-4);
  font-size: var(--fs-base); font-weight: 700; line-height: 1.5; cursor: pointer; list-style: none;
}
.prose summary::-webkit-details-marker { display: none; }
.prose summary::after { content: "+"; font-family: var(--font-mono); font-size: var(--fs-lg); font-weight: 400; color: var(--muted); }
.prose details[open] > summary::after { content: "−"; }
.prose details[open] > summary { border-bottom: 1px solid var(--line); }
.prose details > :not(summary) { margin: var(--s-3) var(--s-4); }

/* 注意書き */
.callout {
  padding: var(--s-3) var(--s-4) 14px;
  background: var(--surface);
  border-left: 3px solid var(--border);
  font-size: var(--fs-base); line-height: 1.8;
}
.callout > * + * { margin-top: 0.6em; }
.callout__title {
  display: flex; align-items: center; gap: var(--s-2);
  font-family: var(--font-mono); font-feature-settings: normal;
  font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.04em; color: var(--ink-strong);
}
.callout__title::before { content: "i"; display: inline-grid; place-items: center; width: 18px; height: 18px; border: 1.5px solid currentColor; border-radius: 50%; font-size: 11px; line-height: 1; }
.callout--tip { border-left-style: double; border-left-width: 5px; }
.callout--tip .callout__title::before { content: "+"; border-radius: 2px; }
.callout--warning { border-left-color: var(--accent); }
.callout--warning .callout__title { color: var(--accent-strong); }
.callout--warning .callout__title::before { content: "!"; border-radius: 2px; background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }

/* 脚注 */
.prose [data-footnote-ref], .prose .footnote-ref {
  font-family: var(--font-mono); text-decoration: none; color: var(--accent-strong); font-weight: 600;
  padding: 0.3em 0.15em; margin: 0 0.05em;
}
.prose [data-footnote-ref]::before, .prose .footnote-ref::before { content: "["; }
.prose [data-footnote-ref]::after, .prose .footnote-ref::after { content: "]"; }
.prose .footnotes { margin-top: 3em; padding-top: var(--s-4); border-top: 1px solid var(--line-strong); font-size: var(--fs-md); line-height: 1.75; color: var(--ink-2); }
.prose .footnotes h2 { all: unset; display: block; font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.08em; color: var(--muted); margin-bottom: var(--s-2); }
.prose .footnotes li:target { background: var(--surface); box-shadow: 0 0 0 6px var(--surface); }
.prose [data-footnote-backref], .prose .footnote-backref {
  display: inline-flex; align-items: center; justify-content: center; min-width: 28px; min-height: 28px;
  font-family: var(--font-mono); text-decoration: none; color: var(--accent-strong);
}

/* ───────── 9. フォーム・ボタン ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--tap); padding: 0 var(--s-4);
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--ink-strong); font-size: var(--fs-md); font-weight: 700; line-height: 1.2;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface); border-color: var(--ink); }
.btn--primary { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.btn--primary:hover { background: var(--ink-strong); border-color: var(--ink-strong); color: var(--bg); }
.btn--danger { border-color: var(--accent-strong); color: var(--accent-strong); }
.btn--quiet { border-color: transparent; color: var(--ink-2); padding-inline: var(--s-2); }
.btn--sm { min-height: var(--tap); padding: 0 var(--s-3); font-size: var(--fs-sm); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn[data-copied] { border-color: var(--ink-strong); }

.form { display: grid; gap: var(--s-5); }
.field { display: grid; gap: 6px; min-width: 0; }
.field__label { font-size: var(--fs-md); font-weight: 700; color: var(--ink-strong); }
.field__req { margin-left: 6px; color: var(--accent-strong); font-size: var(--fs-xs); font-weight: 700; }
.field__hint { color: var(--muted); font-size: var(--fs-sm); line-height: 1.65; }
.field__error { color: var(--accent-strong); font-size: var(--fs-sm); font-weight: 700; line-height: 1.6; }
.input, .textarea, .select {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--ink-strong); font-size: 1rem; line-height: 1.5; /* 16px 未満にしない（iOS の自動ズーム防止） */
  -webkit-appearance: none; appearance: none;
}
.textarea { min-height: 7.5em; resize: vertical; line-height: 1.7; }
.select {
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: right 17px center, right 12px center; background-size: 5px 5px; background-repeat: no-repeat;
}
.input--mono { font-family: var(--font-mono); }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: 1; }
.input:focus-visible, .textarea:focus-visible, .select:focus-visible { outline-offset: 0; border-color: var(--focus); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--accent-strong); border-width: 2px; }
.check { display: flex; gap: var(--s-3); align-items: flex-start; min-height: var(--tap); padding: 10px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--accent-strong); }
.check__text { font-size: var(--fs-md); font-weight: 700; color: var(--ink-strong); line-height: 1.6; }
.check__hint { display: block; color: var(--muted); font-size: var(--fs-sm); font-weight: 400; }
.form__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.form__actions .btn { flex: 1 1 auto; }
@media (min-width: 560px) { .form__actions .btn { flex: 0 0 auto; min-width: 9rem; } }
fieldset { border: 0; padding: 0; min-width: 0; }
legend { padding: 0; }

/* 検索フォーム */
.search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-2); }
.search__tag { margin-top: var(--s-2); }
.search__count { margin-top: var(--s-4); color: var(--muted); font-size: var(--fs-sm); }
.search__tag + .search__count { margin-top: var(--s-1); }
.search__count strong { color: var(--ink-strong); }

/* お知らせ（フラッシュ） */
.flash {
  display: flex; gap: var(--s-3); align-items: flex-start;
  margin-bottom: var(--s-5); padding: var(--s-3) var(--s-4);
  background: var(--surface); border-left: 3px solid var(--ink-strong);
  font-size: var(--fs-md); line-height: 1.7; color: var(--ink-strong);
}
.flash--error { border-left-color: var(--accent); }
.flash--error strong { color: var(--accent-strong); }

/* ───────── 10. 状態（空・404・エラー） ───────── */
.state { max-width: 32rem; margin-inline: auto; padding-block: var(--s-7) var(--s-6); text-align: left; }
.state__code {
  display: flex; align-items: center; gap: var(--s-3);
  font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0.08em; color: var(--muted);
}
.state__code::after {
  content: ""; flex: 1; height: 7px;
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 1px, transparent 1px 8px);
}
.state__title { margin-top: var(--s-3); font-size: var(--fs-title); font-weight: 800; line-height: 1.4; }
.state__text { margin-top: var(--s-3); color: var(--ink-2); line-height: 1.85; }
.state__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-5); }
.state .search { margin-top: var(--s-5); }
.state--inline { padding-block: var(--s-6); max-width: none; }
.state--inline .state__title { font-size: var(--fs-xl); }
.steps { margin-top: var(--s-4); padding-left: 1.4em; color: var(--ink-2); font-size: var(--fs-md); line-height: 1.8; }
.steps li + li { margin-top: 4px; }
/* 問い合わせ用の番号（500 の request_id など） */
.state__ref { margin-top: var(--s-5); padding-top: var(--s-3); border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; }
.state__ref code { font-family: var(--font-mono); color: var(--ink-2); -webkit-user-select: all; user-select: all; }

/* ───────── 11. 管理画面 ───────── */
.admin-flag {
  padding: 2px 8px; border: 1px solid var(--accent-strong); border-radius: var(--radius);
  color: var(--accent-strong); font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em;
}
.site-actions form { display: flex; }
.panel { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: var(--s-4); }
.panel { margin-bottom: var(--s-5); }
.panel__title { font-size: var(--fs-lg); font-weight: 700; margin-bottom: var(--s-4); }
.panel > summary {
  display: flex; align-items: center; justify-content: space-between;
  min-height: var(--tap); margin: calc(var(--s-4) * -1); padding: 0 var(--s-4);
  font-weight: 700; color: var(--ink-strong); cursor: pointer; list-style: none;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::after { content: "+"; font-family: var(--font-mono); font-size: var(--fs-lg); font-weight: 400; color: var(--muted); }
.panel[open] > summary { margin-bottom: var(--s-4); border-bottom: 1px solid var(--line); }
.panel[open] > summary::after { content: "−"; }
.panel--danger { border-color: var(--accent-strong); }

.rows { list-style: none; border-top: 1px solid var(--line-strong); }
.rows > li { border-bottom: 1px solid var(--line); }
.row { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-2); padding: 14px 0; }
.row__title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px var(--s-2); font-size: var(--fs-base); font-weight: 700; color: var(--ink-strong); line-height: 1.5; }
.row__title a { color: inherit; }
.row__meta { display: flex; flex-wrap: wrap; gap: 0 var(--s-3); color: var(--muted); font-size: var(--fs-sm); line-height: 1.7; }
.row__meta code { font-family: var(--font-mono); color: var(--ink-2); }
.row__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.row--off .row__title { color: var(--muted); }
@media (max-width: 719.98px) {
  /* 操作がリンク 1 つの行（タグの「編集」）は、題の右端に置いて行を低くする。POST のフォームは下の行のまま */
  .row:has(> p.row__actions) { grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s-3); align-items: center; }
  .row:has(> p.row__actions) > .row__meta { grid-column: 1 / -1; grid-row: 2; }
  .row:has(> p.row__actions) > p.row__actions { grid-column: 2; grid-row: 1; }
}
@media (min-width: 720px) {
  .row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: var(--s-5); }
  .row__actions { grid-column: 2; grid-row: 1 / span 2; justify-content: flex-end; }
}

/* 一度だけ表示する秘密値 */
.secret {
  margin-bottom: var(--s-5); padding: var(--s-4);
  border: 2px solid var(--accent); border-radius: var(--radius); background: var(--surface);
}
.secret__title { font-size: var(--fs-base); font-weight: 700; color: var(--ink-strong); }
.secret__text { margin-top: 4px; color: var(--ink-2); font-size: var(--fs-md); line-height: 1.7; }
.secret__value {
  display: block; margin-top: var(--s-3); padding: var(--s-3);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: var(--fs-md); line-height: 1.6; color: var(--ink-strong);
  word-break: break-all; -webkit-user-select: all; user-select: all;
}
.secret .btn { margin-top: var(--s-3); width: 100%; }
@media (min-width: 560px) { .secret .btn { width: auto; } }

.login { max-width: 24rem; margin-inline: auto; padding-top: var(--s-6); }
.login__title { font-size: var(--fs-xl); font-weight: 800; margin: var(--s-2) 0 var(--s-5); }

/* ───────── 強制カラーモード ───────── */
/* 背景色で描いた印は強制カラーで消えるので、システムの色で描き直す（語は常に併記している） */
@media (forced-colors: active) {
  .kind--news::before, .tag--watch::before, .badge--watch::before, .tagrow--watch .tagrow__name::before,
  .highlights li::before, .section-head::before, .prose h2::before {
    forced-color-adjust: none; background: CanvasText;
  }
  .site-nav a[aria-current]::after { forced-color-adjust: none; background: Highlight; }
  .seg a[aria-current] { forced-color-adjust: none; background: Highlight; color: HighlightText; }
  .btn--primary { border-width: 2px; }
}

/* ───────── 動きの停止 ───────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important; transition: none !important; scroll-behavior: auto !important;
  }
}

/* ───────── 12. 印刷 ───────── */
@media print {
  :root { --bg: #fff; --surface: #fff; --sunken: #f4f4f4; --ink: #000; --ink-strong: #000; --ink-2: #222; --muted: #444; }
  .site-header, .site-footer, .skip, .progress, .share, .toc, .more, .watch, .feed-tools, .codeblock__copy { display: none !important; }
  .day__head { position: static; }
  .prose pre { white-space: pre-wrap; }
  .codeblock:not([data-lang]) > pre { padding-right: var(--s-4); }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #444; }
}
