:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #f0f2ef;
  --text: #16211d;
  --text-dim: #5b6b64;
  --line: #dde3df;
  --accent: #0f766e;
  --accent-soft: #d7f0ea;
  --accent-ink: #0b4f4a;
  --on-accent: #ffffff;
  --warn: #b4530a;
  --warn-soft: #fdeedd;
  --star: #d98324;
  --line-green: #06c755;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 33, 29, .05), 0 8px 24px rgba(16, 33, 29, .06);
}

[data-theme="dark"] {
  --bg: #0e1513;
  --surface: #151f1c;
  --surface-2: #1c2825;
  --text: #e6ede9;
  --text-dim: #9aaba4;
  --line: #2a3733;
  --accent: #4ecdc0;
  --accent-soft: #14332f;
  --accent-ink: #a6e9e0;
  --on-accent: #07211e;
  --warn: #e9a05a;
  --warn-soft: #33251a;
  --star: #e9a83f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.85;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: min(720px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--text-dim); font-size: 12px; }
.small { font-size: 11px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center;
  font-weight: 700; font-size: 17px; line-height: 1;
}
.brand-mark.sm { width: 28px; height: 28px; font-size: 14px; border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { white-space: nowrap; font-size: 15px; line-height: 1.3; letter-spacing: .02em; }
.brand-text small { font-size: 11px; color: var(--text-dim); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.icon-btn {
  flex: none;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 16px; cursor: pointer; line-height: 1;
  display: grid; place-items: center;
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); }
.pill-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: 12px; line-height: 1; padding: 9px 12px; border-radius: 99px; cursor: pointer;
  max-width: 44vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
:is(.icon-btn, .pill-btn, .chip, .card, .link-btn, .cta, .quiz-option, .share-btn, .next-item, input):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- hero ---------- */
.hero { padding: 32px 0 8px; }
.issue-line { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; font-size: 12px; color: var(--text-dim); }
.issue-badge {
  background: var(--accent-soft); color: var(--accent-ink);
  padding: 3px 9px; border-radius: 99px; font-weight: 700; font-size: 11px; letter-spacing: .04em;
}
.hero h1 { margin: 0 0 14px; font-size: clamp(28px, 8vw, 40px); line-height: 1.35; letter-spacing: .01em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-sub { margin: 0 0 20px; color: var(--text-dim); font-size: 15px; }
.hero-sub strong { color: var(--text); }
.trust { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-dim); }
.trust li::before { content: "✓ "; color: var(--accent); font-weight: 700; }

/* 診断済みならヒーローを畳む */
.hero.compact { padding: 18px 0 0; }
.hero.compact h1 { font-size: 20px; margin-bottom: 0; }
.hero.compact :is(.hero-sub, .cta, .trust) { display: none; }

.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; max-width: 420px;
  border: 0; border-radius: 12px; cursor: pointer;
  background: var(--accent); color: var(--on-accent);
  font: inherit; font-size: 16px; font-weight: 700; padding: 15px 20px;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent);
  transition: transform .12s, filter .12s;
}
.cta:hover { transform: translateY(-1px); filter: brightness(1.05); }
.cta:disabled { opacity: .7; cursor: default; transform: none; box-shadow: none; }
.cta-sm { width: auto; font-size: 14px; padding: 10px 16px; margin-top: 12px; box-shadow: none; }
.cta-line { background: var(--line-green); color: #fff; box-shadow: none; }

/* ---------- sections ---------- */
main > section { margin-top: 30px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 18px; line-height: 1.5; }
.section-head > :last-child:not(h2) { flex: none; white-space: nowrap; }

/* ---------- controls ---------- */
.controls { margin-bottom: 14px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; gap: 10px; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 0 12px; min-width: 0;
}
.search-icon { font-size: 13px; opacity: .6; }
.search input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 16px; padding: 9px 0; outline: none;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.scroll-x { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -14px; padding-inline: 14px; }
.chips.scroll-x::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-dim);
  font: inherit; font-size: 13px; line-height: 1;
  padding: 8px 12px; border-radius: 99px; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.chip-saved[aria-pressed="true"] { background: var(--star); border-color: var(--star); color: #fff; }
.chip .count { font-size: 11px; opacity: .8; margin-left: 2px; }

.result-line { display: flex; align-items: center; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-dim); }
.link-btn { border: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.muted-btn { color: var(--text-dim); }

/* ---------- feed / card ---------- */
.feed { display: flex; flex-direction: column; gap: 12px; }

.card {
  display: block; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; cursor: pointer; font: inherit; color: inherit;
  box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s;
}
.card:hover { transform: translateY(-1px); border-color: var(--accent); }
.card.is-read { opacity: .66; }
.card.compact { padding: 14px 16px; box-shadow: none; }
.card.compact h3 { margin-bottom: 6px; }

.card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 9px; }
.rank {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; line-height: 1;
}
.tag {
  font-size: 11px; line-height: 1; padding: 4px 8px; border-radius: 6px;
  background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--line);
}
.tag-cat { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.tag-new { background: var(--warn-soft); color: var(--warn); border-color: transparent; font-weight: 700; }
.card-star { margin-left: auto; font-size: 17px; color: var(--line); line-height: 1; background: none; border: 0; cursor: pointer; padding: 4px 6px; }
.card-star.on { color: var(--star); }

.card h3 { margin: 0 0 8px; font-size: 16.5px; line-height: 1.6; letter-spacing: .005em; }
.card p { margin: 0 0 12px; font-size: 13.5px; color: var(--text-dim); line-height: 1.8; }
.card-action {
  display: flex; gap: 8px; align-items: baseline;
  background: var(--accent-soft); color: var(--accent-ink);
  border-radius: 10px; padding: 9px 12px; margin-bottom: 12px; font-size: 13px; line-height: 1.7;
}
.card-action b { flex: none; font-size: 11px; letter-spacing: .04em; }
.card-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-dim); }
.read-mark { color: var(--accent); }

.empty { text-align: center; color: var(--text-dim); font-size: 14px; padding: 32px 0; }

/* ---------- 今週の1手リスト ---------- */
.action-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.action-list li {
  display: flex; gap: 10px; align-items: flex-start; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.action-list label { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.7; cursor: pointer; }
.action-list input { width: 20px; height: 20px; margin-top: 3px; flex: none; accent-color: var(--accent); }
.action-list li.done span { text-decoration: line-through; color: var(--text-dim); }
.action-tools { display: flex; gap: 10px; flex: none; padding-top: 2px; }
.action-tools .link-btn { font-size: 12px; text-decoration: none; }

/* ---------- subscribe ---------- */
.subscribe {
  text-align: center; padding: 26px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.subscribe h2 { margin: 0 0 6px; font-size: 18px; line-height: 1.5; }
.subscribe p { margin: 0 0 16px; font-size: 14px; color: var(--text-dim); }
.subscribe-note { margin: 12px 0 0 !important; color: var(--text) !important; }
.subscribe-note small { color: var(--text-dim); }

/* ---------- quiz sheet ---------- */
.sheet, .reader { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop, .reader-backdrop { position: absolute; inset: 0; background: rgba(10, 20, 18, .45); backdrop-filter: blur(2px); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; margin-inline: auto;
  width: min(560px, 100%); max-height: 92vh; overflow-y: auto;
  background: var(--bg); border-radius: 20px 20px 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  animation: rise .22s ease;
}
@media (min-width: 640px) {
  .sheet-panel { top: 50%; bottom: auto; transform: translateY(-50%); border-radius: 20px; animation: none; }
}
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
.sheet-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.steps { display: flex; gap: 6px; }
.steps i { width: 28px; height: 4px; border-radius: 4px; background: var(--line); }
.steps i.on { background: var(--accent); }
.sheet-body { padding: 0 20px 24px; }
.sheet-body h2 { margin: 4px 0 16px; font-size: 22px; line-height: 1.45; }
.sheet-body > .muted:first-child { margin: 0; }
.quiz-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 14px; }
.quiz-option {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px; font-weight: 600; text-align: left;
  padding: 14px 16px; border-radius: 12px; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.quiz-option:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- reader ---------- */
.reader-panel {
  position: absolute; inset: 0; margin-inline: auto;
  width: min(720px, 100%);
  background: var(--bg);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  animation: slide .22s ease;
}
@keyframes slide { from { transform: translateY(14px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .reader-panel, .sheet-panel { animation: none; } .card, .cta { transition: none; } }

.reader-bar {
  position: sticky; top: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.reader-bar-actions { display: flex; gap: 8px; }
.icon-btn.star { color: var(--line); }
.icon-btn.star.on { color: var(--star); border-color: var(--star); }

.reader-body, .article-page { padding: 22px 16px 64px; width: min(680px, 100%); margin-inline: auto; }
:is(.reader-body, .article-page) h1 { font-size: clamp(20px, 5vw, 25px); line-height: 1.6; margin: 12px 0 14px; }
:is(.reader-body, .article-page) .lead {
  font-size: 15px; color: var(--text); background: var(--surface);
  border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0;
  padding: 13px 15px; margin: 0 0 22px;
}
:is(.reader-body, .article-page) > p { font-size: 15.5px; margin: 0 0 20px; }
.meta-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.callout { border-radius: var(--radius); padding: 16px; margin: 26px 0; border: 1px solid var(--line); background: var(--surface); }
.callout h3 { margin: 0 0 8px; font-size: 12px; letter-spacing: .08em; color: var(--text-dim); font-weight: 700; }
.callout p { margin: 0; font-size: 15px; }
.callout-action { border-color: transparent; background: var(--accent-soft); }
.callout-action h3 { color: var(--accent-ink); }
.callout-action p { color: var(--accent-ink); font-weight: 600; }
.callout-parent { background: var(--warn-soft); border-color: transparent; }
.callout-parent h3, .callout-parent p { color: var(--warn); }

.share { margin: 28px 0; text-align: center; }
.share-lead { margin: 0 0 10px; font-size: 13px; color: var(--text-dim); }
.share-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.share-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; padding: 11px 18px; border-radius: 99px; cursor: pointer;
  text-decoration: none;
}
.share-line { background: var(--line-green); border-color: var(--line-green); color: #fff; }

.sources { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 16px; }
.sources h3, .next h3 { font-size: 12px; letter-spacing: .08em; color: var(--text-dim); margin: 0 0 10px; }
.sources ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sources li { font-size: 12.5px; color: var(--text-dim); line-height: 1.7; }
.sources a { color: var(--accent); word-break: break-all; }
.unverified { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 5px; background: var(--warn-soft); color: var(--warn); font-weight: 700; margin-left: 4px; }

.next { margin-top: 30px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.next-item {
  width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14.5px; font-weight: 600; line-height: 1.6; padding: 14px 16px; border-radius: 12px; cursor: pointer;
  text-decoration: none; display: block;
}
.next-item:hover { border-color: var(--accent); }

/* ---------- 共有ページ（a/*.html）専用 ---------- */
.page-cta {
  margin: 34px 0 0; padding: 22px 18px; text-align: center; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.page-cta h2 { margin: 0 0 6px; font-size: 17px; line-height: 1.5; }
.page-cta p { margin: 0 0 14px; font-size: 13.5px; color: var(--text-dim); }
a.cta { text-decoration: none; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80;
  background: var(--text); color: var(--bg); font-size: 13.5px; padding: 10px 16px; border-radius: 99px;
  box-shadow: var(--shadow); max-width: calc(100% - 32px);
}

/* ---------- footer ---------- */
.site-footer { margin: 40px 0 60px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-dim); }
.site-footer p { margin: 0 0 8px; }
.author { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.author strong { color: var(--text); font-size: 13px; }
.author p { margin: 4px 0 0; font-size: 12.5px; line-height: 1.8; }
.disclaimer { line-height: 1.8; }

@media (max-width: 420px) {
  .brand-text small { display: none; }
}
