:root {
  --bg: #fbf6ee;
  --surface: #ffffff;
  --surface-2: #f4ede2;
  --ink: #2b2622;
  --ink-2: #6b625a;
  --line: #e6dccd;
  --accent: #e8664a;
  --accent-ink: #ffffff;
  --p0: #e8664a;
  --p1: #2a9d8f;
  --p2: #d9a21b;
  --p3: #8e6fc1;
  --p4: #4a7fd8;
  --p5: #8a7f72;
  --ok: #2a9d8f;
  --warn-bg: #fff4d6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 20px rgba(60, 40, 20, .06);
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1916;
    --surface: #26221e;
    --surface-2: #2f2a25;
    --ink: #f1ebe3;
    --ink-2: #b3a99d;
    --line: #3d3630;
    --accent: #f07d62;
    --p0: #f07d62;
    --p1: #43b8a9;
    --p2: #e6b53a;
    --p3: #a98ad8;
    --p4: #6f9be6;
    --p5: #a99d90;
    --warn-bg: #3a3220;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.75;
  font-size: 16px;
}
a { color: var(--accent); }
img, svg, canvas { max-width: 100%; }
button, select, input { font: inherit; }
.wrap { max-width: 820px; margin: 0 auto; padding: 0 16px; }

/* ---- header / footer */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: .02em; }
.brand svg { width: 30px; height: 30px; flex: none; }
.nav { display: flex; gap: 16px; font-size: 14px; }
.nav a { color: var(--ink-2); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }

.site-footer { margin-top: 64px; border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 13px; color: var(--ink-2); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 10px; }
.site-footer a { color: var(--ink-2); }

/* ---- hero */
.hero { padding: 44px 0 20px; }
.hero h1 { font-size: clamp(28px, 6vw, 40px); line-height: 1.3; margin: 0 0 12px; letter-spacing: .01em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lead { color: var(--ink-2); margin: 0 0 18px; }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-size: 14px;
}
.badge svg { width: 16px; height: 16px; color: var(--ok); flex: none; }

/* ---- cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.section { margin-top: 28px; }
.section > h2 { font-size: 20px; margin: 0 0 12px; }

/* ---- drop zone */
.drop {
  display: block; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 32px 16px;
  background: var(--surface); transition: border-color .15s, background .15s;
}
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--surface-2); }
.drop strong { display: block; font-size: 18px; margin-bottom: 4px; }
.drop span { color: var(--ink-2); font-size: 14px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 14px; }
.controls label { font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
select { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 9px 18px; cursor: pointer; text-decoration: none; font-weight: 600; font-size: 15px;
}
.btn:hover { border-color: var(--ink-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.05); border-color: var(--accent); }
.btn-link { border: 0; background: none; padding: 0; color: var(--ink-2); font-weight: 400; text-decoration: underline; cursor: pointer; font-size: 14px; }

.progress { margin-top: 16px; }
.progress-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress-bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress p { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.error { margin-top: 16px; padding: 12px 16px; border-radius: 10px; background: var(--warn-bg); font-size: 14px; }

/* ---- summary */
.summary-head { font-size: clamp(22px, 5vw, 28px); line-height: 1.4; margin: 0 0 6px; font-weight: 800; }
.meta { color: var(--ink-2); font-size: 14px; margin: 0 0 16px; }
.pairs { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.pair { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pair .who { font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.pair .num { font-size: 26px; font-weight: 800; white-space: nowrap; }
.pair .num small { font-size: 13px; font-weight: 600; margin-left: 2px; }
.name { font-weight: 700; overflow-wrap: anywhere; }
.arrow { color: var(--ink-2); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; margin-top: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---- phrase list */
.phrases { display: grid; gap: 14px; }
.phrase { padding: 18px 20px; }
.phrase-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.phrase-word { font-size: 24px; font-weight: 800; margin: 0; overflow-wrap: anywhere; line-height: 1.4; }
.phrase-dir { font-size: 14px; margin: 2px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.phrase-tools { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; font-size: 13px; }
.phrase-tools label { display: flex; align-items: center; gap: 6px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.timeline { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 8px; font-size: 14px; }
.timeline div { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; }
.timeline b { display: block; font-size: 16px; }
.timeline small { color: var(--ink-2); }
.lag { font-size: 14px; color: var(--ink-2); margin: 0 0 6px; }
.chart { width: 100%; max-width: 480px; height: auto; display: block; margin-top: 4px; }
.chart text { fill: var(--ink-2); font-size: 14px; font-family: var(--font); }
.chart .axis { stroke: var(--line); }
details { margin-top: 8px; font-size: 14px; }
details summary { cursor: pointer; color: var(--ink-2); }
.quote { margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--line); background: var(--surface-2); border-radius: 0 8px 8px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.quote small { display: block; color: var(--ink-2); }
.excluded-note { font-size: 14px; color: var(--ink-2); margin-top: 10px; }
.empty { text-align: center; color: var(--ink-2); padding: 28px 16px; }

/* ---- share */
.share-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); align-items: start; }
.share-preview { width: 100%; border-radius: 12px; border: 1px solid var(--line); display: block; background: var(--surface-2); }
.share-options { display: grid; gap: 12px; }
.share-options label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.share-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.hint { font-size: 13px; color: var(--ink-2); margin: 0; }

/* ---- prose pages */
.prose { padding-top: 32px; }
.prose h1 { font-size: clamp(26px, 5vw, 34px); line-height: 1.35; margin: 0 0 8px; }
.prose h2 { font-size: 21px; margin: 40px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.prose h3 { font-size: 17px; margin: 26px 0 6px; }
.prose ol, .prose ul { padding-left: 1.4em; }
.prose li { margin: 4px 0; }
.prose .note { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; font-size: 15px; }
.prose dl dt { font-weight: 700; margin-top: 16px; }
.prose dl dd { margin: 4px 0 0; color: var(--ink); }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); }

.ad-slot { margin: 28px 0; min-height: 0; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

@media (max-width: 640px) {
  .nav { gap: 12px; font-size: 13px; }
  .brand span { font-size: 15px; }
  .share-grid { grid-template-columns: 1fr; }
  .share-preview { max-width: 320px; margin: 0 auto; }
  .phrase { padding: 16px; }
  .phrase-word { font-size: 21px; }
}
@media (max-width: 380px) {
  .brand span { display: none; }
}
.brand .la { fill: var(--p0); }
.brand .lb { fill: var(--p1); }
.endings { margin-top: 20px; }
.endings > summary { font-weight: 700; color: var(--ink); padding: 10px 0; }
.endings .hint { margin: 0 0 12px; }
.timeline { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.timeline small + b + small { display: block; margin-top: 2px; }
.to-names { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 2px; }
.heavy { margin-top: 16px; border-color: var(--accent); }
.heavy h3 { margin: 0 0 6px; font-size: 18px; }
.heavy p { margin: 0 0 12px; }
.heavy-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.examples { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: start; margin: 16px 0 8px; }
.examples figure { margin: 0; }
.examples img { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.examples figcaption { font-size: 14px; color: var(--ink-2); margin-top: 8px; }
/* ---- 保存方法の図解 */
.prose ol.steps { list-style: none; padding: 0; margin: 14px 0 8px; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); counter-reset: step; }
.prose ol.steps.steps-wide { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.prose ol.steps li { margin: 0; counter-increment: step; position: relative; }
.prose ol.steps img { width: 100%; height: auto; display: block; max-width: 200px; margin: 0 auto; }
.prose ol.steps.steps-wide img { max-width: 320px; }
.prose ol.steps p { margin: 8px 0 0; font-size: 14px; line-height: 1.65; }
.prose ol.steps p::before { content: counter(step); display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; margin-right: 6px; vertical-align: 1px; }
.prose .hint { font-size: 13px; color: var(--ink-2); }
