:root {
  --ink: #17312a;
  --muted: #61716c;
  --paper: #f7f5ef;
  --surface: #ffffff;
  --line: #dfe4df;
  --green: #1f5f4a;
  --green-dark: #174837;
  --mint: #dceee5;
  --orange: #ed8351;
  --orange-soft: #fff0e7;
  --danger: #a8392f;
  --shadow: 0 18px 50px rgba(23, 49, 42, 0.08);
  color-scheme: light;
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); line-height: 1.7; }
a { color: var(--green); text-underline-offset: 0.2em; }
a:hover { color: var(--orange); }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; }
button, a { transition: 160ms ease; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }

.skip-link { position: fixed; top: -5rem; left: 1rem; z-index: 100; padding: .7rem 1rem; background: var(--ink); color: white; }
.skip-link:focus { top: 1rem; }
.site-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: .75rem max(1.25rem, calc((100vw - 1180px) / 2)); background: rgba(247, 245, 239, .94); border-bottom: 1px solid rgba(23, 49, 42, .1); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: .7rem; color: var(--ink); font-size: 1.08rem; font-weight: 800; text-decoration: none; letter-spacing: .02em; }
.brand img { width: 44px; height: 44px; border-radius: 14px; object-fit: cover; }
.site-header nav { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; flex-wrap: wrap; }
.site-header nav > a:not(.button) { color: var(--ink); text-decoration: none; font-weight: 650; font-size: .91rem; }
.inline-form { display: inline; margin: 0; }
.link-button { border: 0; padding: 0; color: var(--green); background: none; cursor: pointer; font-weight: 650; }
.demo-banner { padding: .7rem 1rem; color: #71340f; background: #ffe6d7; border-bottom: 1px solid #f2b38d; text-align: center; font-weight: 700; }
.page-shell { width: min(1180px, calc(100% - 2.5rem)); min-height: calc(100vh - 180px); margin: 0 auto; padding: 3rem 0 5rem; }
.site-footer { padding: 2rem max(1.25rem, calc((100vw - 1180px) / 2)); color: var(--muted); background: #edf0eb; font-size: .86rem; }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .65rem; font-size: clamp(2.15rem, 5vw, 4.5rem); line-height: 1.15; letter-spacing: -.045em; }
h2 { line-height: 1.3; letter-spacing: -.025em; }
.eyebrow { margin-bottom: .55rem; color: var(--orange); font-size: .75rem; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
.lead { max-width: 680px; color: var(--muted); font-size: 1.12rem; }
.muted, .help-text { color: var(--muted); }
.help-text { margin: .25rem 0 0; font-size: .82rem; }

.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: .65rem 1.1rem; color: var(--green); background: transparent; border: 1px solid var(--green); border-radius: 999px; cursor: pointer; font-weight: 750; line-height: 1.1; text-decoration: none; }
.button:hover { color: white; background: var(--green); }
.button-primary { color: white; background: var(--green); box-shadow: 0 8px 22px rgba(31, 95, 74, .17); }
.button-primary:hover { background: var(--green-dark); }
.button-danger { color: var(--danger); border-color: var(--danger); }
.button-danger:hover { color: white; background: var(--danger); }
.button-quiet { color: var(--muted); border-color: var(--line); }
.button-small { min-height: 36px; padding: .5rem .85rem; font-size: .88rem; }
.button-wide { width: 100%; }
.button-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }

.hero { display: grid; grid-template-columns: 1.28fr .72fr; align-items: center; gap: 4rem; min-height: 520px; padding: 2rem 0 4rem; }
.hero .lead { max-width: 720px; margin: 1.5rem 0 2rem; }
.hero-visual { position: relative; display: grid; place-items: center; min-height: 390px; border-radius: 40% 60% 60% 40% / 42% 38% 62% 58%; background: var(--mint); }
.hero-visual img { width: min(300px, 75%); border-radius: 28%; filter: drop-shadow(0 24px 36px rgba(23, 49, 42, .22)); }
.insight-float { position: absolute; right: -1rem; bottom: 2rem; padding: .85rem 1.1rem; background: white; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); font-size: .85rem; }
.insight-float strong { color: var(--orange); font-size: 1.4rem; }
.feature-grid, .metric-grid, .insight-grid, .detail-grid { display: grid; gap: 1rem; }
.feature-grid { grid-template-columns: repeat(3, 1fr); }
.feature-card { min-height: 230px; padding: 1.65rem; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; }
.feature-number { color: var(--orange); font-weight: 800; }

.page-heading { margin-bottom: 2.1rem; }
.page-heading h1 { font-size: clamp(2rem, 5vw, 3.7rem); }
.page-heading > p:last-child { color: var(--muted); }
.heading-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; }
.metric-grid { grid-template-columns: repeat(4, 1fr); margin-bottom: 2.5rem; }
.metric { padding: 1.35rem; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.metric span { display: block; color: var(--muted); font-size: .86rem; }
.metric strong { margin-right: .25rem; font-size: 2.4rem; line-height: 1.25; }
.metric small { color: var(--muted); }
.section-block { margin-top: 3rem; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-heading h2 { margin-bottom: 0; font-size: 1.75rem; }
.insight-grid { grid-template-columns: repeat(3, 1fr); }
/* 説明の長さが異なっても、傾向カードのリンク位置と余白を揃える。 */
.insight-card { display: flex; flex-direction: column; padding: 1.4rem; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 8px 22px rgba(23, 49, 42, .04); }
.insight-card h3 { margin-bottom: .6rem; font-size: 1.35rem; }
.insight-card > p { margin-bottom: .25rem; color: var(--muted); }
.insight-card > a { margin-top: auto; padding-top: .8rem; }
.badge, .tag { display: inline-flex; align-items: center; padding: .2rem .55rem; background: var(--mint); border-radius: 999px; font-size: .75rem; font-weight: 700; }
.tag { margin: .12rem .2rem .12rem 0; color: var(--green-dark); }
.lift { margin: .75rem 0; font-size: 2rem; font-weight: 900; }
.lift-positive { color: var(--orange); }
.lift-negative { color: #3b6b94; }
/* 説明文全体の可読性を保ち、平均との差の得点だけを色付き背景で強調する。 */
.score-highlight { display: inline-block; margin: 0 .25rem; padding: .08rem .42rem; border-radius: .45rem; font-weight: 900; white-space: nowrap; }
.score-highlight-positive { color: #9a3f18; background: var(--orange-soft); }
.score-highlight-negative { color: #285a82; background: #e8f1f8; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .9rem 1rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); background: #f1f3ef; font-size: .8rem; letter-spacing: .06em; }
tr:last-child td { border-bottom: 0; }
.rating { color: var(--orange); font-weight: 850; white-space: nowrap; }

.card-panel, .form-panel, .narrow-panel, .filter-panel, .note-panel { padding: 1.6rem; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; }
.card-panel { margin-bottom: 1rem; }
.form-panel { max-width: 800px; margin: 0 auto; }
.wide-form { max-width: 980px; }
.narrow-panel { max-width: 540px; margin: 2rem auto; }
.narrow-panel .lead { font-size: 1rem; }
.stack-form { display: grid; gap: 1.1rem; }
.field { display: grid; align-content: start; gap: .3rem; }
.field label { font-weight: 720; }
.field input:not([type="checkbox"]), .field select, .field textarea { width: 100%; min-height: 46px; padding: .65rem .75rem; color: var(--ink); background: white; border: 1px solid #bdc8c1; border-radius: 10px; }
.field textarea { min-height: 100px; resize: vertical; }
.field input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--green); }
.field ul { margin: .25rem 0; padding: 0; list-style: none; }
.field li label { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.field-error input, .field-error select, .field-error textarea { border-color: var(--danger) !important; }
.required-mark { color: var(--danger); font-size: .75rem; font-weight: 800; }
.error-text { margin: 0; color: var(--danger); font-size: .85rem; font-weight: 650; }
.error-summary { padding: .85rem 1rem; color: #71271f; background: #fde9e6; border: 1px solid #efb6af; border-radius: 12px; }
.error-summary ul { margin-bottom: 0; }
.warning-summary { padding: 1rem; color: #69420e; background: #fff5d9; border: 1px solid #e8c980; border-radius: 12px; }
.warning-summary p { margin: .35rem 0; }
.warning-summary ul { margin: .4rem 0 0; padding-left: 1.25rem; }
.form-section { display: grid; gap: 1rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: 16px; }
.form-section legend { padding: 0 .5rem; font-weight: 850; }
.required-section { background: #fbfcfa; }
.details-form { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.details-form summary { padding: 1rem 1.2rem; background: #eef2ed; cursor: pointer; font-weight: 800; }
.details-form summary span { margin-left: .4rem; color: var(--muted); font-size: .8rem; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; padding: 1.2rem; }
.field-full { grid-column: 1 / -1; }

.filter-bar, .filter-panel { margin-bottom: 1.5rem; }
.filter-bar { display: flex; align-items: flex-end; gap: .8rem; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.grow { flex: 1; }
.filter-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .8rem; margin-bottom: 1rem; }
.card-list { display: grid; gap: .9rem; }
.list-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.4rem; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.list-card h2 { margin-bottom: .25rem; font-size: 1.25rem; }
.list-card p { margin-bottom: .3rem; }
.list-card-metrics { display: flex; gap: 1rem; white-space: nowrap; }
.score-circle { display: grid; flex: 0 0 74px; width: 74px; height: 74px; place-content: center; text-align: center; background: var(--orange-soft); border-radius: 50%; }
.score-circle strong { color: var(--orange); font-size: 1.8rem; line-height: 1; }
.score-circle small { color: var(--muted); }
.pagination { display: flex; justify-content: center; gap: 1.5rem; margin-top: 1.5rem; }
.empty-state { padding: 2.5rem 1.5rem; background: var(--surface); border: 1px dashed #aab9af; border-radius: 20px; text-align: center; }

.detail-grid { grid-template-columns: repeat(2, 1fr); }
.detail-list { margin: 0; }
.detail-list > div { display: grid; grid-template-columns: 140px 1fr; gap: .8rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.detail-list > div:last-child { border: 0; }
.detail-list dt { color: var(--muted); font-size: .85rem; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.detail-hero { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1rem; }
.detail-hero > div { padding: 1.4rem; background: var(--ink); border-radius: 20px; color: white; text-align: center; }
.detail-hero span { display: block; color: #c8d8d1; font-size: .82rem; }
.detail-hero strong { margin-right: .25rem; color: #ffb188; font-size: 2.5rem; }
.memo-box { min-height: 90px; padding: 1rem; background: #f6f7f4; border-radius: 12px; }
.danger-zone, .danger-panel { border-color: #e5b7b1; }
.plain-list { padding-left: 1.2rem; }

.insight-list { display: grid; gap: .8rem; }
.period-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, .7fr)) minmax(0, 1.2fr); gap: 1rem; }
.period-metric, .period-summary { display: grid; align-content: center; min-height: 160px; padding: 1.35rem; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.period-metric span { color: var(--muted); font-size: .86rem; }
.period-metric strong { color: var(--orange); font-size: 2.4rem; line-height: 1.25; }
.period-metric small { color: var(--muted); }
.period-summary strong { margin: .55rem 0 .15rem; font-size: 1.35rem; }
.period-summary p { margin-bottom: 0; color: var(--muted); }
.period-delta { color: var(--green); font-size: 2rem !important; }
.insight-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1.5rem; padding: 1.2rem 1.4rem; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.insight-row h2 { margin-bottom: .3rem; font-size: 1.3rem; }
.insight-row p { margin-bottom: .2rem; }
.insight-row.insufficient { opacity: .72; background: #f1f2ef; }
.insight-facts { display: flex; align-items: center; justify-content: flex-end; gap: .75rem; flex-wrap: wrap; }
.note-panel { margin-top: 1.5rem; background: var(--orange-soft); border-color: #f2c6ad; }
.note-panel p { margin-bottom: 0; }
.message-stack { position: fixed; right: 1rem; top: 78px; z-index: 40; display: grid; gap: .5rem; width: min(390px, calc(100% - 2rem)); }
.message { padding: .75rem 1rem; background: white; border: 1px solid var(--line); border-left: 5px solid var(--green); border-radius: 10px; box-shadow: var(--shadow); }
.message-error { border-left-color: var(--danger); }

@media (max-width: 920px) {
  /* 主要導線を隠さず折り返し、高くなるヘッダーが本文を覆わないよう通常配置する。 */
  .site-header { position: static; align-items: flex-start; flex-direction: column; gap: .75rem; }
  .site-header nav { width: 100%; justify-content: flex-start; gap: .65rem 1rem; }
  .hero { grid-template-columns: 1fr; gap: 1rem; }
  .hero-visual { min-height: 300px; }
  .feature-grid, .metric-grid, .insight-grid, .period-comparison { grid-template-columns: repeat(2, 1fr); }
  .period-summary { grid-column: 1 / -1; }
  .filter-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .page-shell { width: min(100% - 1.5rem, 1180px); padding-top: 2rem; }
  .site-header { padding: .65rem .75rem; }
  .brand span { display: none; }
  .site-header nav { flex-wrap: wrap; }
  h1 { font-size: 2.35rem; }
  .hero { min-height: auto; padding-top: .5rem; }
  .hero-visual { min-height: 250px; }
  .insight-float { right: .25rem; bottom: .5rem; }
  .feature-grid, .metric-grid, .insight-grid, .detail-grid, .detail-hero, .form-grid, .filter-grid, .period-comparison { grid-template-columns: 1fr; }
  .period-summary { grid-column: auto; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .heading-actions, .section-heading, .list-card, .insight-row { align-items: stretch; flex-direction: column; display: flex; }
  .heading-actions .button-primary { width: 100%; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .list-card-metrics, .insight-facts { justify-content: flex-start; }
  .detail-list > div { grid-template-columns: 1fr; gap: .15rem; }
  th, td { padding: .75rem; }
}

/* 構成ラベルは画像内で縮小せず、狭幅では接続順に縦へ並べる。 */
.architecture-flow { margin: 1.5rem 0; }
.architecture-nodes { display: flex; align-items: center; gap: 1rem; }
.architecture-node { flex: 1; min-width: 0; padding: 1rem; border: 1px solid var(--green); border-radius: 12px; background: var(--surface); overflow-wrap: anywhere; }
.architecture-node strong, .architecture-node span { display: block; }
.architecture-destinations { flex: 1; display: grid; gap: 1rem; min-width: 0; }
.architecture-arrow { flex: 0 0 auto; font-size: 1.5rem; }
@media (max-width: 640px) {
  .architecture-nodes { flex-direction: column; align-items: stretch; }
  .architecture-arrow { text-align: center; transform: rotate(90deg); }
  .architecture-destinations { width: 100%; }
}
