/* 返し上手 / Kaeshi — 「会話の吹き出し」が主役の紙面。
 * PaperLens（墨・朱）とは逆に、明るい紙＋藍のインク。4つの投票軸は色を固定し、ランキングも同じ色で通す。
 * 編集は site/assets/ が正本（public/ はビルドで毎回上書き）。 */
:root {
  --bg: #f7f4ee;
  --paper: #fffdf8;
  --panel: #f0ebe1;
  --line: #e2dbcd;
  --line-strong: #cbc1ae;
  --ink: #1f2433;
  --ink-soft: #3d4357;
  --dim: #6b6f7d;
  --accent: #2f4fa3;        /* 藍 */
  --accent-soft: #e5eaf7;
  --them: #ffffff;           /* 相手の吹き出し */
  --me: #e9efff;             /* 自分の吹き出し */
  --funny: #c77700;  --funny-bg: #fff3dc;
  --clever: #0f7c80; --clever-bg: #dcf3f2;
  --kind: #2f8a4c;   --kind-bg: #e1f4e6;
  --moving: #7a4fc2; --moving-bg: #efe7fb;
  --danger: #b3261e;
  --round: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", system-ui, sans-serif;
  --sans: "Hiragino Sans", "Noto Sans JP", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171e; --paper: #1c1f28; --panel: #232733; --line: #2f3442; --line-strong: #444a5c;
    --ink: #eceef4; --ink-soft: #c9cdd8; --dim: #9aa0b0; --accent: #8fa8ff; --accent-soft: #252c44;
    --them: #232733; --me: #263055;
    --funny: #f0a83a; --funny-bg: #3a2c12; --clever: #4fc3c7; --clever-bg: #12302f;
    --kind: #6cc98b; --kind-bg: #15301e; --moving: #b598ef; --moving-bg: #2a2140; --danger: #ff8a80;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--sans);
  font-size: 16px; line-height: 1.8; min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
.hidden { display: none !important; }
.dim { color: var(--dim); font-size: .88rem; }
.wrap { width: 100%; max-width: 860px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; padding: 20px 0 48px; }
h1, h2, h3 { font-family: var(--round); line-height: 1.4; letter-spacing: .01em; }
h1 { font-size: 1.7rem; margin: .4rem 0 .8rem; }
h2 { font-size: 1.25rem; margin: 1.8rem 0 .7rem; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 .5rem; }
p + p { margin-top: .7rem; }
ul, ol { padding-left: 1.3rem; }

/* ── ヘッダ ── */
.hd { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.hd .wrap { display: flex; align-items: center; gap: 12px; min-height: 56px; flex-wrap: wrap; }
.logo { font-family: var(--round); font-weight: 700; font-size: 1.2rem; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.logo:hover { text-decoration: none; }
.logo .mark { width: 28px; height: 28px; }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; align-items: center; }
.nav a, .nav button.link { color: var(--ink-soft); padding: 6px 10px; border-radius: 999px; font-size: .92rem; }
.nav a:hover { background: var(--panel); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.lang { font-size: .85rem; border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px 10px !important; }

/* ── ボタン・入力 ── */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--paper);
  color: var(--ink); padding: 8px 16px; border-radius: 999px; font: inherit; font-size: .95rem; cursor: pointer; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { padding: 4px 12px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: 0; font: inherit; color: var(--accent); cursor: pointer; }
input[type=text], input[type=month], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 10px 12px; }
textarea { min-height: 88px; resize: vertical; }
label { display: block; font-size: .9rem; color: var(--ink-soft); margin: 12px 0 4px; }
.counter { text-align: right; font-size: .8rem; color: var(--dim); }
.notice { border-radius: 12px; padding: 12px 14px; background: var(--panel); margin: 12px 0; font-size: .93rem; }
.notice.warn { background: #fff4e5; color: #6a4300; }
.notice.err { background: #fde8e6; color: var(--danger); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .notice.warn { background: #3a2c12; color: #f6d39b; } :root:not([data-theme="light"]) .notice.err { background: #3b1a18; } }

/* ── カード ── */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 12px 0; }
.card h3 { margin-top: 0; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 12px; }
.tabs a, .tabs button { border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 14px; font-size: .9rem; color: var(--ink-soft); background: var(--paper); cursor: pointer; font-family: inherit; }
.tabs a[aria-current="true"], .tabs button[aria-current="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ── 吹き出し（主役） ── */
.talk { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.bubble { position: relative; max-width: 92%; padding: 12px 16px; border-radius: 18px; border: 1px solid var(--line); font-size: 1.02rem; }
.bubble.them { align-self: flex-start; background: var(--them); border-bottom-left-radius: 6px; }
.bubble.me { align-self: flex-end; background: var(--me); border-bottom-right-radius: 6px; }
.bubble .who { display: block; font-size: .78rem; color: var(--dim); margin-bottom: 2px; }
.scene { font-size: .9rem; color: var(--ink-soft); background: var(--panel); border-radius: 12px; padding: 8px 12px; }
.scene::before { content: "🎬 "; }

/* ── 回答と投票 ── */
.answer { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; margin: 10px 0; }
.answer .text { font-size: 1.05rem; white-space: pre-wrap; word-break: break-word; }
.answer .meta { display: flex; gap: 8px; align-items: center; font-size: .82rem; color: var(--dim); margin-top: 6px; flex-wrap: wrap; }
.votes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.vote { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 4px 12px; font-size: .88rem; cursor: pointer;
  border: 1.5px solid currentColor; background: transparent; font-family: inherit; }
.vote .n { font-variant-numeric: tabular-nums; font-weight: 600; }
.vote.funny { color: var(--funny); } .vote.funny.on { background: var(--funny-bg); }
.vote.clever { color: var(--clever); } .vote.clever.on { background: var(--clever-bg); }
.vote.kind { color: var(--kind); } .vote.kind.on { background: var(--kind-bg); }
.vote.moving { color: var(--moving); } .vote.moving.on { background: var(--moving-bg); }
.vote.on { cursor: default; font-weight: 600; }
.vote:disabled { opacity: .55; cursor: not-allowed; }
.axis-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.axis-dot.funny { background: var(--funny); } .axis-dot.clever { background: var(--clever); }
.axis-dot.kind { background: var(--kind); } .axis-dot.moving { background: var(--moving); }
.tag { display: inline-block; font-size: .78rem; border-radius: 6px; padding: 0 8px; background: var(--panel); color: var(--ink-soft); }
.tag.adult { background: #fde8e6; color: var(--danger); }
.menu { margin-left: auto; position: relative; }
.menu > button { background: none; border: 0; color: var(--dim); cursor: pointer; font-size: 1.1rem; padding: 0 6px; }
.menu .pop { position: absolute; right: 0; top: 26px; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 12px; padding: 6px; z-index: 5; min-width: 180px; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.menu .pop button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 10px; border-radius: 8px; font: inherit; font-size: .9rem; color: var(--ink); cursor: pointer; }
.menu .pop button:hover { background: var(--panel); }

/* ── 国旗 ── */
.flag { width: 20px; height: 15px; border-radius: 2px; vertical-align: -2px; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.flag.none { display: inline-block; width: 15px; height: 15px; border-radius: 50%; background: var(--line-strong); }

/* ── ランキング ── */
.rank { list-style: none; padding: 0; counter-reset: r; }
.rank li { counter-increment: r; display: grid; grid-template-columns: 2.2rem 1fr; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rank li::before { content: counter(r); font-family: var(--round); font-weight: 700; font-size: 1.2rem; color: var(--axis, var(--accent)); text-align: center; }
.rank .p { font-size: .85rem; color: var(--dim); }
.empty { text-align: center; color: var(--dim); padding: 28px 12px; border: 1px dashed var(--line-strong); border-radius: 16px; }

/* ── 教科書: 良い返し / 避ける返しの対比 ── */
.contrast { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
@media (max-width: 640px) { .contrast { grid-template-columns: 1fr; } }
.good, .avoid { border-radius: 16px; padding: 12px 14px; border: 1px solid var(--line); background: var(--paper); }
.good h3, .avoid h3 { margin-top: 0; font-size: .95rem; }
.good h3 { color: var(--kind); } .avoid h3 { color: var(--danger); }
.ret { padding: 10px 0; border-top: 1px dashed var(--line); }
.ret:first-of-type { border-top: 0; }
.ret q { font-size: 1.02rem; display: block; quotes: "「" "」"; }
html[lang="en"] .ret q { quotes: "“" "”"; }
.ret .why { font-size: .9rem; color: var(--ink-soft); margin-top: 4px; }
.editorial { display: inline-block; font-size: .78rem; border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 10px; color: var(--dim); }
table.matrix { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.matrix th, table.matrix td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
table.matrix th { background: var(--panel); font-weight: 600; }
.scroll-x { overflow-x: auto; }

/* ── フッタ ── */
.ft { border-top: 1px solid var(--line); background: var(--paper); padding: 20px 0 28px; font-size: .85rem; color: var(--dim); }
.ft .wrap { display: flex; gap: 14px; flex-wrap: wrap; }
.ft a { color: var(--dim); }

/* ── モーダル ── */
dialog { border: 1px solid var(--line-strong); border-radius: 16px; padding: 20px; max-width: 420px; width: calc(100% - 32px); background: var(--paper); color: var(--ink); }
dialog::backdrop { background: rgba(10,12,20,.45); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.hero { padding: 18px 0 6px; }
.hero .lead { font-size: 1.08rem; color: var(--ink-soft); }
.note-author { border-left: 3px solid var(--accent); padding: 4px 0 4px 14px; margin: 14px 0; color: var(--ink-soft); }
.note-author .sig { display: block; text-align: right; font-size: .85rem; color: var(--dim); margin-top: 6px; }

/* 見本環境の帯（preview channel のみ） */
.sample-banner { position: sticky; top: 0; z-index: 30; background: #b3261e; color: #fff; text-align: center; font-weight: 700; padding: 6px 12px; font-size: .9rem; }
.sample-banner + .hd { top: 33px; }
/* 運営の例（票の対象外）: 回答カードと見分けがつくよう点線・背景なし */
.examples { border: 1px dashed var(--line); border-radius: 16px; padding: 10px 14px; margin: 12px 0; }
.examples h3 { margin: 0 0 4px; font-size: .95rem; }
.example { padding: 8px 0; border-top: 1px dashed var(--line); }
.example:first-of-type { border-top: 0; }
.example .text { white-space: pre-wrap; word-break: break-word; }
.example .meta { display: flex; gap: 6px; flex-wrap: wrap; font-size: .8rem; color: var(--dim); margin-top: 4px; }
.tag.ex { border-style: dashed; }
.odai-static { padding-left: 1.2em; line-height: 1.9; }
