:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --text: #111827;
  --muted: #4b5563;
  --faint: #6b7280;
  --line: #e5e7eb;
  --accent: #1d4ed8;
  --accent-soft: #eff4ff;
  --warn: #92400e;
  --warn-soft: #fef3c7;
  --cat-ai: #1d4ed8;
  --cat-ai-service: #047857;
  --cat-ai-chip: #7c3aed;
  --cat-economy: #b45309;
  --cat-politics: #be123c;
  --radius: 10px;
  --wrap: 880px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.sheet-open { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  font-feature-settings: "palt" 1;
}
a { color: var(--accent); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--text); color: #fff; padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

/* ヘッダー */
.masthead { border-bottom: 1px solid var(--line); }
.masthead-inner { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 12px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 22px; letter-spacing: 0.01em; color: var(--text); text-decoration: none; }
.edition { margin: 0; font-size: 13px; color: var(--faint); }

/* タブ */
.tabs { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,0.96); backdrop-filter: saturate(1.4) blur(6px); border-bottom: 1px solid var(--line); }
.tabs-inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-top: 6px; padding-bottom: 6px; }
.tabs-inner::-webkit-scrollbar { display: none; }
.tab { flex: none; border: 0; background: none; padding: 8px 12px; border-radius: 999px; cursor: pointer; font-size: 15px; color: var(--muted); white-space: nowrap; }
.tab:hover { background: var(--surface); }
.tab[aria-selected="true"] { background: var(--text); color: #fff; font-weight: 600; }
.tab-count { margin-left: 6px; font-size: 12px; opacity: 0.7; font-variant-numeric: tabular-nums; }

/* 絞り込み */
.filters { display: flex; flex-direction: column; gap: 10px; padding: 16px 0 4px; }
.search input { width: 100%; font-size: 16px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.search input:focus { background: #fff; border-color: var(--accent); outline: none; }
.regions { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.result-note { margin: 4px 0 0; font-size: 13px; color: var(--faint); min-height: 1em; }

/* セクション・カード */
.section { padding: 12px 0 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--text); padding-bottom: 4px; margin-bottom: 4px; }
.section-head h2 { margin: 0; font-size: 18px; }
.cards { display: flex; flex-direction: column; }
.card { position: relative; border-bottom: 1px solid var(--line); }
.card-main { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; background: none; border: 0; padding: 14px 44px 14px 0; cursor: pointer; }
.card-main:hover .card-title { text-decoration: underline; text-underline-offset: 3px; }
.card-meta, .sheet-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--faint); margin: 0; }
.cat { font-weight: 700; color: var(--cat, var(--accent)); }
[data-cat="ai"] { --cat: var(--cat-ai); }
[data-cat="ai-service"] { --cat: var(--cat-ai-service); }
[data-cat="ai-chip"] { --cat: var(--cat-ai-chip); }
[data-cat="economy"] { --cat: var(--cat-economy); }
[data-cat="politics"] { --cat: var(--cat-politics); }
.status { background: var(--warn-soft); color: var(--warn); padding: 0 6px; border-radius: 4px; }
.read-mark { color: var(--faint); }
.card-title { font-size: 17px; font-weight: 700; line-height: 1.5; }
.card.is-read .card-title { color: var(--muted); font-weight: 600; }
.card-deck { font-size: 14.5px; color: var(--muted); line-height: 1.6; }
.card-source { font-size: 12.5px; color: var(--faint); }
.card-save { position: absolute; right: 0; top: 10px; width: 40px; height: 40px; border: 0; background: none; font-size: 20px; color: var(--faint); cursor: pointer; border-radius: 8px; }
.card-save:hover { background: var(--surface); }
.card-save[aria-pressed="true"] { color: #d97706; }
.empty { color: var(--faint); font-size: 14px; padding: 12px 0; margin: 0; }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 4px 0; font-size: 14px; font-weight: 600; }
.link-btn:hover { text-decoration: underline; }

.footer { margin-top: 32px; padding-top: 16px; padding-bottom: 40px; border-top: 1px solid var(--line); font-size: 13px; color: var(--faint); }

/* 詳細パネル */
.scrim { position: fixed; inset: 0; background: rgba(17,24,39,0.35); z-index: 20; }
.sheet { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100%); background: #fff; z-index: 30; display: flex; flex-direction: column; box-shadow: -8px 0 32px rgba(0,0,0,0.12); outline: none; }
.sheet[hidden], .scrim[hidden] { display: none; }
.sheet-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--line); flex: none; }
.sheet-bar .link-btn { font-size: 15px; }
.save-btn { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 14px; font-size: 14px; cursor: pointer; }
.save-btn[aria-pressed="true"] { border-color: #d97706; color: #b45309; background: #fffbeb; }
.sheet-body { overflow-y: auto; padding: 18px 20px 40px; flex: 1; overscroll-behavior: contain; }
.sheet-title { font-size: 23px; line-height: 1.45; margin: 8px 0 8px; }
.sheet-deck { font-size: 16px; color: var(--muted); margin: 0 0 6px; }
.sheet-date { font-size: 13px; color: var(--faint); margin: 0 0 16px; }
.sheet-summary { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 16px; font-size: 15.5px; }
.sheet-text p { margin: 0 0 14px; font-size: 16.5px; line-height: 1.85; }
.notice { background: var(--warn-soft); color: var(--warn); padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.facts, .takeaway, .sources { margin-top: 20px; }
.facts h3, .takeaway h3, .sources h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); letter-spacing: 0.04em; }
.facts dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 14.5px; }
.facts dt { color: var(--faint); }
.facts dd { margin: 0; }
.takeaway { border-left: 3px solid var(--text); padding-left: 12px; }
.takeaway p { margin: 0; }
.sources ul { margin: 0; padding-left: 18px; font-size: 14.5px; }
.sources li { margin-bottom: 4px; word-break: break-word; }
.sheet-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 28px; }
.pager-btn { display: flex; flex-direction: column; gap: 2px; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: var(--radius); padding: 10px 12px; cursor: pointer; min-width: 0; }
.pager-btn:hover { background: var(--surface); }
.pager-btn.next { text-align: right; }
.pager-label { font-size: 12.5px; color: var(--accent); font-weight: 600; }
.pager-title { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.back-bottom { display: block; width: 100%; margin-top: 14px; padding: 12px; border: 0; border-radius: var(--radius); background: var(--text); color: #fff; font-weight: 600; cursor: pointer; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 40; max-width: calc(100% - 32px); }
.toast[hidden] { display: none; }

/* 方針ページ */
.doc { padding-top: 20px; padding-bottom: 40px; }
.doc h1 { font-size: 24px; }
.doc h2 { font-size: 18px; margin-top: 28px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.doc table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
.doc th, .doc td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }

@media (max-width: 600px) {
  .sheet-body { padding: 16px 16px 40px; }
  .sheet-title { font-size: 21px; }
  .card-title { font-size: 16.5px; }
}
@media (prefers-reduced-motion: no-preference) {
  .sheet:not([hidden]) { animation: slide-in 0.18s ease-out; }
  @keyframes slide-in { from { transform: translateX(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
}
