:root {
  color-scheme: light;
  --bg: #f7f7f3;
  --surface: #ffffff;
  --ink: #242824;
  --sub: #596159;
  --line: #d9ded7;
  --control-line: #7b867b;
  --accent: #315f4e;
  --accent-ink: #ffffff;
  --hover: #eef2ec;
  --done-bg: #eaf2ec;
  --avoid: #96412f;
  --avoid-bg: #fcf0ec;
  --err: #b4432d;
  --shade: rgb(0 0 0 / .10);
  --toast-icon: #9bd0b6;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #191d1a;
    --surface: #232923;
    --ink: #edf1ea;
    --sub: #b1bcb0;
    --line: #3d483e;
    --control-line: #869586;
    --accent: #9bd0b6;
    --accent-ink: #19271f;
    --hover: #2d362e;
    --done-bg: #283c2e;
    --avoid: #f2ad98;
    --avoid-bg: #342722;
    --err: #f0a08c;
    --shade: rgb(0 0 0 / .45);
    --toast-icon: #315f4e;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}
a {
  color: var(--accent);
  text-underline-offset: .22em;
  text-decoration-thickness: 1px;
}
a:focus-visible, button.copy:focus-visible, #q:focus {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
header.site, main, footer.site {
  width: 100%;
  max-width: 800px;
  margin-inline: auto;
  padding-inline: 24px;
}
header.site {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 20px;
  padding-block: 24px 20px;
}
.logo {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .04em;
  text-decoration: none;
}
.tag { color: var(--sub); font-size: 14px; }
main { padding-block: 8px 64px; }
footer.site {
  padding-block: 24px 36px;
  border-top: 1px solid var(--line);
  color: var(--sub);
  font-size: 14px;
}
footer.site p { margin: 0 0 12px; }
footer.site a, .crumb a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
h1 {
  margin: 24px 0 12px;
  font-size: clamp(24px, 4vw, 30px);
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: .015em;
}
h2 {
  margin: 44px 0 16px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.6;
}
h2 a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: 100%;
  color: inherit;
  text-decoration: none;
}
.lead { margin: 0 0 24px; color: var(--sub); }
.crumb { margin-top: 4px; color: var(--sub); font-size: 14px; }
.crumb a { margin-inline: 2px; }
.hero { padding-block: 8px 16px; }
.hero h1 { max-width: 22em; margin-top: 16px; }
.hero p { margin: 0 0 24px; color: var(--sub); }
#q {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 60px;
  padding: 16px 18px;
  border: 1px solid var(--control-line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
  box-shadow: 0 2px 6px rgb(0 0 0 / .04);
}
#q::placeholder { color: var(--sub); opacity: 1; }
ul.scenes, ul.phrases, ul.avoid {
  list-style: none;
  margin: 0;
  padding: 0;
}
ul.scenes { border-top: 1px solid var(--line); }
ul.scenes > li { border-bottom: 1px solid var(--line); }
ul.scenes a {
  display: block;
  min-height: 44px;
  padding: 16px 12px;
  border-radius: 4px;
  color: var(--ink);
  text-decoration: none;
}
ul.scenes .t { display: block; font-weight: 600; line-height: 1.65; }
ul.scenes .d {
  display: block;
  margin-top: 4px;
  color: var(--sub);
  font-size: 14px;
  line-height: 1.8;
}
ul.phrases, ul.avoid { display: grid; gap: 12px; }
ul.phrases > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 136px;
  gap: 8px 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
ul.phrases p.text, ul.avoid p.text {
  min-width: 0;
  margin: 0;
  font-size: 16px;
  line-height: 1.8;
  white-space: pre-wrap;
}
ul.phrases p.text { grid-column: 1; grid-row: 1; }
ul.phrases p.note, ul.avoid p.note {
  margin: 0;
  color: var(--sub);
  font-size: 14px;
  line-height: 1.8;
}
ul.phrases p.note { grid-column: 1; grid-row: 2; }
button.copy {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  width: 136px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--control-line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--sub);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
  touch-action: manipulation;
}
button.copy.done {
  border-color: var(--accent);
  background: var(--done-bg);
  color: var(--accent);
}
ul.avoid > li {
  padding: 20px 24px;
  border-inline-start: 3px solid var(--avoid);
  border-radius: 0 8px 8px 0;
  background: var(--avoid-bg);
}
ul.avoid p.text {
  color: var(--avoid);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--avoid);
}
ul.avoid p.note { margin-top: 8px; }
ul.tips { margin: 0; padding-inline-start: 1.5em; }
ul.tips > li { padding-inline-start: 4px; }
ul.tips > li + li { margin-top: 10px; }
ul.tips > li::marker { color: var(--accent); }

@media (hover: hover) {
  a:hover { text-decoration: underline; }
  ul.scenes a:hover { background: var(--hover); text-decoration: none; }
  ul.scenes a:hover .t { text-decoration: underline; text-underline-offset: .22em; }
  button.copy:hover { background: var(--hover); color: var(--ink); }
  button.copy.done:hover { background: var(--done-bg); color: var(--accent); }
}
button.copy:active { border-color: var(--accent); }

@media (max-width: 520px) {
  header.site, main, footer.site { padding-inline: 20px; }
  header.site { gap: 0 12px; padding-block: 16px; }
  .tag { width: 100%; }
  main { padding-bottom: 48px; }
  h2 { margin-top: 36px; }
  #q { padding-inline: 12px; }
  ul.scenes a { padding-inline: 4px; }
  ul.phrases > li { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 20px; }
  button.copy { grid-column: 1; grid-row: 3; justify-self: end; }
  ul.avoid > li { padding: 18px 20px; }
}

@media (forced-colors: active) {
  ul.avoid > li { border: 1px solid CanvasText; border-inline-start-width: 3px; }
  button.copy.done { border-style: double; border-width: 3px; }
}

/* 画面での見え方:文言を、実際に出る部品の形で見せる(場面の種類ごと) */
ul.phrases p.text { position: relative; justify-self: start; max-width: 100%; }
.ui-error p.text, .ui-notice p.text, .ui-loading p.text, .ui-success p.text { padding-inline-start: 34px; }
.ui-error p.text::before, .ui-notice p.text::before, .ui-success p.text::before {
  position: absolute; inset-inline-start: 0; top: .3em;
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  font-size: 13px; font-weight: 700; line-height: 1;
}
.ui-error p.text::before { content: "!"; background: var(--err); color: var(--surface); }
.ui-notice p.text::before { content: "i"; background: var(--accent); color: var(--accent-ink); font-family: Georgia, serif; }
.ui-success p.text { padding: 12px 18px 12px 46px; border-radius: 8px; background: var(--ink); color: var(--bg); box-shadow: 0 4px 14px var(--shade); }
.ui-success p.text::before { content: "✓"; inset-inline-start: 14px; top: 14px; background: transparent; color: var(--toast-icon); font-size: 16px; }
.ui-confirm p.text { padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 6px 20px var(--shade); }
ul.phrases.ui-empty p.text { justify-self: stretch; padding: 22px 16px; border: 1px dashed var(--control-line); border-radius: 8px; color: var(--sub); text-align: center; }
ul.phrases.ui-form p.text { justify-self: stretch; padding-top: 54px; color: var(--err); font-size: 14px; }
.ui-form p.text::before {
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 44px;
  border: 1px solid var(--err); border-radius: 6px; background: var(--bg);
}
.ui-button p.text { padding: 10px 22px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.ui-loading p.text::before {
  content: ""; position: absolute; inset-inline-start: 0; top: .35em; width: 20px; height: 20px;
  border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ui-loading p.text::before { animation: none; } }
@media (forced-colors: active) {
  .ui-success p.text, .ui-button p.text { border: 1px solid CanvasText; }
}

/* トップの「種類からさがす」 */
ul.kinds { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
ul.kinds a { display: block; height: 100%; padding: 16px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); text-decoration: none; }
ul.kinds .t { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 600; }
ul.kinds .n { color: var(--sub); font-size: 13px; font-weight: 400; white-space: nowrap; }
ul.kinds .d { display: block; margin-top: 6px; color: var(--sub); font-size: 14px; line-height: 1.7; }
@media (hover: hover) { ul.kinds a:hover { border-color: var(--accent); background: var(--hover); } }
#results .none { color: var(--sub); }

/* ヘッダーの検索欄と、種類の切り替え */
header.site .find { flex: 1 1 200px; display: flex; justify-content: flex-end; }
header.site .find input { width: 100%; max-width: 240px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--control-line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; }
header.site .find input:focus { outline: 3px solid var(--accent); outline-offset: 2px; }
ul.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
ul.chips a, ul.chips span { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: 15px; }
ul.chips span[aria-current] { border-color: var(--accent); color: var(--accent); font-weight: 600; }
@media (hover: hover) { ul.chips a:hover { border-color: var(--accent); background: var(--hover); } }
@media (max-width: 520px) { header.site .find { justify-content: stretch; } header.site .find input { max-width: none; } }

/* 検索欄:虫めがねを入れて、ひと目で検索欄と分かるようにする */
.search { position: relative; display: block; width: 100%; }
.search .loupe { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--sub); pointer-events: none; }
.search input#q, header.site .find .search input { padding-inline-start: 44px; }
header.site .find .search { max-width: 240px; }
@media (max-width: 520px) { header.site .find .search { max-width: none; } }
ul.scenes .when { display: block; color: var(--sub); font-size: 13px; }
ul.kinds a { display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: 12px; align-content: start; }
ul.kinds .kind-icon { grid-row: 1 / span 2; margin-top: 2px; color: var(--ink); }
ul.kinds .t, ul.kinds .d { grid-column: 2; }

/* 場面の一覧:押せるカードにして、種類・題名・代表の文言を見せる */
ul.scenes { display: grid; gap: 10px; border-top: 0; }
ul.scenes > li { border-bottom: 0; }
ul.scenes a { position: relative; display: block; padding: 16px 48px 16px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
ul.scenes a::after { content: ""; position: absolute; inset-inline-end: 20px; top: 50%; width: 9px; height: 9px; border-top: 2px solid var(--sub); border-right: 2px solid var(--sub); transform: translateY(-50%) rotate(45deg); }
ul.scenes .k { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; color: var(--sub); font-size: 13px; line-height: 1.6; }
ul.scenes .k .kind-icon { color: var(--sub); }
ul.scenes .k .when { display: inline; margin-inline-start: 8px; }
ul.scenes .t { margin-top: 4px; font-size: 17px; }
ul.scenes .ex { display: block; margin-top: 10px; padding: 8px 12px; border-radius: 6px; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.7; }
ul.scenes .ex::before { content: "例 "; color: var(--sub); font-size: 12px; }
@media (hover: hover) { ul.scenes a:hover { border-color: var(--ink); background: var(--surface); } ul.scenes a:hover .t { text-decoration: none; } }
@media (max-width: 520px) { ul.scenes a { padding: 14px 40px 14px 14px; } ul.scenes a::after { inset-inline-end: 16px; } }

/* 検索欄:二重の枠をやめて1本の太い枠に。消すボタンも白黒に */
#q:focus, header.site .find input:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
input[type="search"]::-webkit-search-cancel-button { filter: grayscale(1); opacity: .6; cursor: pointer; }
#results h2 { margin-top: 24px; padding-top: 0; border-top: 0; }

/* PC の左の目次(1000px 以上の場面ページ・種類ページだけ) */
nav.side { display: none; }
@media (min-width: 1000px) {
  body.has-side header.site, body.has-side footer.site { max-width: 1120px; }
  .wrap { display: grid; grid-template-columns: 240px minmax(0, 800px); gap: 32px; max-width: 1120px; margin-inline: auto; padding-inline: 24px; }
  .wrap > main { max-width: none; padding-inline: 0; }
  nav.side { display: block; position: sticky; top: 16px; align-self: start; max-height: calc(100vh - 32px); overflow-y: auto; padding: 16px 8px 24px 0; font-size: 14px; }
  nav.side details { border-bottom: 1px solid var(--line); }
  nav.side summary { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; font-weight: 600; list-style: none; }
  nav.side summary::-webkit-details-marker { display: none; }
  nav.side summary::after { content: ""; margin-inline-start: auto; width: 7px; height: 7px; border-right: 1.5px solid var(--sub); border-bottom: 1.5px solid var(--sub); transform: rotate(-45deg); transition: transform .15s; }
  nav.side details[open] summary::after { transform: rotate(45deg); }
  nav.side ul { list-style: none; margin: 0 0 4px; padding: 0; }
  nav.side li a, nav.side li span { display: block; padding: 6px 10px 6px 24px; border-radius: 6px; color: var(--ink); text-decoration: none; line-height: 1.6; }
  nav.side li span[aria-current] { background: var(--hover); font-weight: 600; box-shadow: inset 3px 0 0 var(--ink); }
  nav.side a.all { display: block; padding: 6px 10px 12px 24px; color: var(--sub); font-size: 13px; }
  .kind-nav { display: none; }
}
@media (min-width: 1000px) and (hover: hover) { nav.side li a:hover { background: var(--hover); } }
/* 目次の選択中:背景と丸い縦線をやめ、種類のアイコンから下りる細い線の上に、いまの場面だけ黒い線を重ねる */
@media (min-width: 1000px) {
  nav.side ul { margin: 0 0 4px 7px; border-left: 1px solid var(--line); }
  nav.side li a, nav.side li span { margin-left: -1px; padding: 6px 10px 6px 16px; border-left: 2px solid transparent; border-radius: 0; }
  nav.side li span[aria-current] { border-left-color: var(--ink); background: none; box-shadow: none; font-weight: 600; }
  nav.side a.all { padding-left: 24px; }
}
@media (min-width: 1000px) and (hover: hover) { nav.side li a:hover { background: none; border-left-color: var(--sub); } }
/* PC ではどのページもヘッダーとフッターの幅をそろえ、ページを移ってもロゴの位置が動かないようにする */
@media (min-width: 1000px) { header.site, footer.site { max-width: 1120px; } }
/* 入力欄の下のエラー文は文言そのものなので、小さくしすぎない */
ul.phrases.ui-form p.text { font-size: 16px; font-weight: 500; }

/* 画面での見え方:見出し・本文・ボタンを1つの画面に組み立てる */
figure.compose { margin: 0; padding: 32px 24px 16px; border-radius: 8px; background: var(--hover); }
figure.compose .box { max-width: 440px; margin: 0 auto; padding: 22px 24px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 8px 24px var(--shade); }
figure.compose .ct { margin: 0 0 8px; font-size: 17px; font-weight: 600; line-height: 1.6; }
figure.compose .cb { margin: 0; color: var(--sub); font-size: 15px; line-height: 1.8; }
figure.compose .btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
figure.compose .b { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 16px; border: 1px solid var(--control-line); border-radius: 8px; font-size: 15px; }
figure.compose .b.main { border-color: var(--ink); background: var(--ink); color: var(--bg); }
figure.compose figcaption { margin-top: 14px; color: var(--sub); font-size: 13px; text-align: center; }
/* お知らせはダイアログではなく、画面の上に出る帯として見せる */
figure.compose-notice .box { max-width: none; padding: 16px 20px 16px 52px; position: relative; border-radius: 8px; box-shadow: none; }
figure.compose-notice .box::before { content: "i"; position: absolute; inset-inline-start: 18px; top: 18px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--bg); font-family: Georgia, serif; font-size: 13px; font-weight: 700; }
@media (max-width: 520px) { figure.compose { padding: 20px 12px 12px; } figure.compose .box { padding: 18px 16px 14px; } }
/* 部品の見本も白黒にそろえる(赤はエラーの意味があるので残す) */
.ui-notice p.text::before { background: var(--ink); color: var(--bg); }
.ui-button p.text { background: var(--ink); color: var(--bg); }
.ui-loading p.text::before { border-top-color: var(--ink); }
:root { --toast-icon: #ffffff; }
@media (prefers-color-scheme: dark) { :root { --toast-icon: #191d1a; } }
/* 避けたい例は、おすすめより目立たせない:色の背景と取り消し線をやめ、小さな × だけで示す */
ul.avoid > li { position: relative; padding: 14px 18px 14px 44px; border: 1px dashed var(--line); border-inline-start: 1px dashed var(--line); border-radius: 8px; background: transparent; }
ul.avoid > li::before { content: "×"; position: absolute; inset-inline-start: 16px; top: 13px; color: var(--err); font-size: 17px; font-weight: 600; line-height: 1.6; }
ul.avoid p.text { color: var(--sub); text-decoration: none; font-size: 15px; }
ul.avoid p.note { margin-top: 4px; color: var(--sub); font-size: 13px; }
@media (forced-colors: active) { ul.avoid > li { border: 1px dashed CanvasText; } }
/* 「どんなときに使うか」を先に読み、そのあとに文言の見本を見る順にする */
ul.phrases p.note { grid-row: 1; font-size: 13px; }
ul.phrases p.text { grid-row: 2; }

/* コピーボタン:クリップボードの絵で「写す」ボタンだと分かるようにする。押したあとはチェックに変える */
button.copy { display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--ink); }
button.copy .ci { flex: none; }
button.copy .ci-done, button.copy.done .ci-copy { display: none; }
button.copy.done .ci-done { display: inline; }
/* 「文言をコピー」「コピーしました」が折り返さないよう、幅は中身に合わせる */
button.copy { width: auto; min-width: 152px; white-space: nowrap; }
ul.phrases > li { grid-template-columns: minmax(0, 1fr) auto; }
@media (max-width: 520px) { ul.phrases > li { grid-template-columns: minmax(0, 1fr); } }
