/* モノクロを基本に、緑はアクセント（リンクなど）にだけ使う。夜空のような暗い配色 */
:root {
  --bg: #0f0f11;
  --surface: #18181b;
  --surface-2: #222226;
  --text: #ececee;
  --muted: #9d9da4;
  --border: #2e2e33;
  --accent: #3ccf8e;       /* 記事がある：緑 */
  --accent-ink: #5fe0a6;
  --accent-soft: rgba(60, 207, 142, .12);
  --on-accent: #08130e;
  --missing: #ff6b6b;      /* 記事がない：赤 */
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --radius: 6px;
  --header-bg: rgba(15, 15, 17, .92);
  --overlay-bg: rgba(24, 24, 27, .92);
  --th-text: #c8c8cd;
  --warn: #f5c26b;
  --scrollbar: #3a3a40;
  --star: rgba(255, 255, 255, .3);
  --catch: #a3a3aa;       /* キャッチコピー：本文より暗めの灰色 */
  color-scheme: dark;
}
/* ライトモード（右上の太陽／月のボタンで切り替え） */
:root[data-theme="light"] {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f0f0f3;
  --text: #1d1d20;
  --muted: #5c5c64; /* 薄い背景の上でも読みやすい濃さ */
  --border: #e0e0e5;
  --accent: #1fa971;
  --accent-ink: #13865a;
  --accent-soft: rgba(31, 169, 113, .1);
  --on-accent: #ffffff;
  --missing: #d33a3a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06);
  --header-bg: rgba(255, 255, 255, .92);
  --overlay-bg: rgba(255, 255, 255, .95);
  --th-text: #3d3d44;
  --warn: #a8670a;
  --scrollbar: #c4c4cc;
  --star: transparent;
  --catch: #48484f;       /* キャッチコピー：黒寄りの灰色 */
  color-scheme: light;
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  /* スクロールバーの場所をいつも空けておく（長いページと短いページを行き来しても、横にずれないように） */
  scrollbar-gutter: stable;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 15px;
  line-height: 1.8;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { font: inherit; color: inherit; }
code { background: var(--surface-2); border-radius: 4px; padding: .1em .35em; font-size: .9em; }

.inner { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); font-size: .9em; }

/* ---------- ヘッダー ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 56px; }
.logo { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-size: 17px; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-mark {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--accent); color: #fff; font-size: 15px;
}
.search { flex: 1; display: flex; max-width: 420px; margin-left: auto; }
.search input {
  flex: 1; min-width: 0;
  height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-right: 0;
  border-radius: 18px 0 0 18px;
  background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 14px;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--surface); }
.search button {
  width: 44px; height: 36px;
  border: 1px solid var(--accent); border-radius: 0 18px 18px 0;
  background: var(--accent); color: #fff; cursor: pointer;
  display: grid; place-items: center;
}
.nav { display: flex; gap: 4px; }
.nav a { color: var(--muted); font-size: 14px; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

@media (max-width: 1000px) {
  .header-inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 8px; gap: 8px 12px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .nav { margin-left: auto; }
  .nav a { padding: 4px 8px; }
}

/* ---------- 共通 ---------- */
main.inner { flex: 1; padding-top: 24px; padding-bottom: 48px; }
.page-title { font-size: 24px; margin: 0 0 16px; line-height: 1.4; }
.count { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.section { margin-top: 32px; }
.section-title {
  font-size: 17px; margin: 0 0 12px; padding-left: 10px;
  border-left: 4px solid var(--accent); line-height: 1.4;
}
.notice {
  background: var(--accent-soft); border-radius: var(--radius);
  padding: 12px 16px; margin: 0 0 20px;
}
.empty { color: var(--muted); }
.more { text-align: right; margin: 12px 0 0; }
.crumb { margin: 0 0 4px; font-size: 13px; color: var(--muted); }

.hero {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 24px; box-shadow: var(--shadow);
  background-image: linear-gradient(135deg, var(--accent-soft), transparent 60%);
}
.hero h1 { margin: 0 0 6px; font-size: 26px; line-height: 1.4; }
.hero p { margin: 0; color: var(--muted); }
.hero .hero-stats { margin-top: 12px; font-size: 13px; }
.hero-stats strong { color: var(--text); }

/* ---------- タグ ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-ink);
  font-size: 13px; line-height: 1.8;
}
.tag::before { content: "#"; opacity: .6; }
.tag:hover { text-decoration: none; filter: brightness(.96); }
.tag-count { color: var(--muted); font-size: 12px; }
.tags-large .tag { font-size: 15px; padding: 4px 14px; }
.tags-small .tag { font-size: 12px; padding: 0 8px; }
.tag-hash { color: var(--muted); margin-right: 2px; }

/* ---------- カード ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card {
  display: flex; gap: 12px; padding: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); box-shadow: var(--shadow);
  transition: border-color .15s;
}
.card:hover { text-decoration: none; border-color: var(--accent); }
.card-thumb {
  flex: none; width: 72px; height: 72px; border-radius: 8px; overflow: hidden;
  background: var(--surface-2); display: grid; place-items: center;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-initial { font-size: 28px; font-weight: 700; color: var(--muted); }
.card-body { min-width: 0; }
.card-title { font-weight: 700; line-height: 1.4; }
.card-reading { font-size: 12px; color: var(--muted); line-height: 1.4; }
.card-summary {
  margin: 4px 0 0; font-size: 13px; color: var(--muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- 縦並びの一覧（アイコン・名前・一言紹介） ---------- */
.rows {
  list-style: none; margin: 0; padding: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.rows > li + li { border-top: 1px solid var(--border); }
.row, .trash-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; color: var(--text); }
a.row:hover { text-decoration: none; background: var(--surface-2); }
.row-icon {
  flex: none; width: 48px; height: 48px; border-radius: 50%; overflow: hidden;
  background: var(--surface-2); display: grid; place-items: center;
}
.row-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row-icon .thumb-initial { font-size: 20px; }
.row-body { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.45; }
.row-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-summary { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-desc { color: var(--muted); margin: -8px 0 16px; }

/* トップページの一覧への入口 */
/* 5つの一覧の入口は、すべて同じ幅・同じ高さにそろえる（折り返しても大きさは変わらない） */
.kind-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); grid-auto-rows: 1fr; gap: 12px; }
.kind-tile {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); transition: border-color .15s;
}
.kind-tile:hover { border-color: var(--accent); }
.kind-tile-link { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 16px 18px; color: var(--text); }
.kind-tile-link:hover { text-decoration: none; }
.kind-tile-head { display: flex; align-items: baseline; gap: 4px; padding-left: 10px; border-left: 4px solid var(--accent); }
.kind-tile-title { font-size: 17px; font-weight: 700; line-height: 1.4; }
.kind-tile-desc { color: var(--muted); font-size: 14px; line-height: 1.6; flex: 1; }
.kind-tile-more { color: var(--accent-ink); font-size: 13px; font-weight: 600; }
.kind-tile-add { position: absolute; top: 12px; right: 12px; }

.private-badge {
  display: inline-block; vertical-align: 2px; margin-left: 6px; padding: 0 7px;
  font-size: 11px; font-weight: 700; line-height: 1.7; border-radius: 4px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.kind-badge + .private-badge { margin-left: 4px; vertical-align: 0; }

/* ---------- 一覧・検索 ---------- */
.kana-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.kana-nav button {
  border: 1px solid var(--border); background: var(--surface); border-radius: 6px;
  padding: 2px 12px; cursor: pointer;
}
.kana-nav button:hover { border-color: var(--accent); color: var(--accent-ink); }
.name-list { list-style: none; padding: 0; margin: 0; columns: 3 220px; column-gap: 24px; }
.name-list li { break-inside: avoid; padding: 2px 0; }
.results { list-style: none; padding: 0; margin: 0; }
.results li {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px;
}
.result-title { font-weight: 700; font-size: 17px; }
.result-snippet { margin: 4px 0 8px; color: var(--muted); font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }

/* ---------- 記事 ---------- */
.article-head {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 24px; box-shadow: var(--shadow);
}
.article-title { font-size: 30px; margin: 0; line-height: 1.35; overflow-wrap: anywhere; }
.article-reading { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.article-catch {
  margin: 10px 0 0; font-size: 18px; font-weight: 600; line-height: 1.6;
  color: var(--catch); overflow-wrap: anywhere;
}
.kind-badge {
  display: inline-block; font-size: 12px; line-height: 1.8; padding: 0 10px; margin-bottom: 6px;
  border-radius: 999px; border: 1px solid var(--border); color: var(--muted);
}
.kind-badge:hover { text-decoration: none; border-color: var(--accent); color: var(--accent-ink); }
.article-head .tags { margin-top: 12px; }

/* メイン画像とプロフィールは左側 */
.article-layout {
  display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px;
  margin-top: 20px; align-items: start;
}
.article-layout.no-infobox { grid-template-columns: minmax(0, 1fr); }
.article-main {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 24px 24px; box-shadow: var(--shadow); min-width: 0;
}
.article-summary {
  margin: 0 0 20px; padding: 12px 16px;
  background: var(--surface-2); border-radius: 8px; font-weight: 500;
}

.toc {
  display: inline-block; min-width: 220px; max-width: 100%;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 16px 10px 12px; margin-bottom: 8px;
}
.toc-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc button {
  background: none; border: 0; padding: 1px 0; cursor: pointer;
  color: var(--accent-ink); text-align: left; font-size: 14px; line-height: 1.6;
}
.toc button:hover { text-decoration: underline; }
.toc-3 { padding-left: 1.4em; }
.toc-num { color: var(--muted); margin-right: .6em; font-variant-numeric: tabular-nums; }

.article-body { overflow-wrap: anywhere; }
.article-body h2 {
  font-size: 21px; margin: 32px 0 12px; padding-bottom: 6px;
  border-bottom: 2px solid var(--border); line-height: 1.4; scroll-margin-top: 72px;
}
.article-body h3 {
  font-size: 17px; margin: 24px 0 8px; padding-left: 10px;
  border-left: 4px solid var(--accent); line-height: 1.4; scroll-margin-top: 72px;
}
.article-body h4 { font-size: 15px; margin: 20px 0 6px; }
.article-body p { margin: 0 0 1em; }
.article-body ul, .article-body ol { padding-left: 1.5em; }
.article-body blockquote {
  margin: 0 0 1em; padding: 6px 16px; border-left: 4px solid var(--border); color: var(--muted);
}
.article-body table { border-collapse: collapse; margin: 0 0 1em; display: block; overflow-x: auto; }
.article-body th, .article-body td { border: 1px solid var(--border); padding: 6px 10px; }
.article-body th { background: var(--surface-2); }
.article-body img { border-radius: 8px; }
.article-body pre { background: var(--surface-2); padding: 12px; border-radius: 8px; overflow-x: auto; }
.article-body pre code { background: none; padding: 0; }
.article-body hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }

.wl { font-weight: 500; }
.wl-missing { color: var(--missing); border-bottom: 1px dotted currentColor; cursor: help; }

.updated { margin: 28px 0 0; text-align: right; color: var(--muted); font-size: 13px; }

/* インフォボックス */
.infobox {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.infobox-title {
  background: var(--accent); color: #fff; font-weight: 700; text-align: center;
  padding: 8px 12px; line-height: 1.4;
}
.infobox-img {
  display: block; width: 100%; padding: 0; border: 0; background: var(--surface-2); cursor: zoom-in;
}
.infobox-img img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.infobox-img { overflow: hidden; }
/* メイン画像のトリミング（編集画面） */
.crop-edit {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border);
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; max-width: 100%;
}
.crop-edit > * { min-width: 0; max-width: 100%; }
.crop-edit .btn { white-space: normal; height: auto; line-height: 1.5; padding-top: 6px; padding-bottom: 6px; }
.crop-edit input[type=range] { min-width: 0; }
.crop-title { font-size: 14px; margin: 0; }
.crop-edit .hint { margin: 0; }
.crop-previews { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.crop-frame {
  width: min(240px, 100%); aspect-ratio: 1; overflow: hidden; border-radius: var(--radius); background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--border); cursor: grab; touch-action: none; user-select: none;
}
.crop-frame.is-dragging { cursor: grabbing; box-shadow: 0 0 0 2px var(--accent); }
.crop-frame img { width: 100%; height: 100%; display: block; pointer-events: none; }
.crop-small { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; }
.crop-slider { max-width: 360px; }
/* 画像を設定していないときのかわりの画像（拡大はしない。少し小さめに） */
.infobox-noimage { cursor: default; padding: 12% 22%; }
.infobox-noimage img { object-fit: contain; }
img.noimage { object-fit: contain !important; padding: 12%; }
.profile { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.6; table-layout: fixed; }
.profile + .profile { border-top: 10px solid var(--bg); }
.profile th, .profile td { padding: 7px 12px; border-top: 1px solid var(--border); vertical-align: top; text-align: left; overflow-wrap: anywhere; }
.profile tr:first-child th, .profile tr:first-child td { border-top: 0; }
.profile th { width: 40%; background: var(--surface-2); font-weight: 600; font-size: 13px; }
.profile .ext::after { content: "↗"; font-size: .8em; margin-left: 2px; }
.song-mark { color: var(--muted); margin-right: 4px; }
.swatch {
  display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: 6px;
  vertical-align: -2px; border: 1px solid var(--border);
}

@media (max-width: 860px) {
  .article-layout { grid-template-columns: 1fr; }
  .infobox { max-width: 400px; width: 100%; margin: 0 auto; }
}
@media (max-width: 520px) {
  .article-head, .article-main { padding: 16px; }
  .article-title { font-size: 24px; }
  .hero { padding: 20px 16px; }
}

/* ギャラリー */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.gallery-item {
  position: relative; padding: 0; border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; background: var(--surface-2); cursor: zoom-in; aspect-ratio: 1;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.gallery-item:hover img { transform: scale(1.04); }
.gallery-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 16px 8px 6px; font-size: 12px; line-height: 1.4; color: #fff; text-align: left;
  background: linear-gradient(transparent, rgba(0, 0, 0, .65));
}

.link-list { margin: 0; padding-left: 1.4em; columns: 2 200px; }

/* ライトボックス */
#lightbox {
  border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh;
  width: 100vw; height: 100vh; margin: 0;
}
#lightbox[open] { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; }
#lightbox::backdrop { background: rgba(0, 0, 0, .85); }
#lightbox figure { margin: 0; text-align: center; pointer-events: none; }
#lightbox img { max-width: 100%; max-height: calc(100vh - 80px); border-radius: 6px; pointer-events: auto; }
#lightbox figcaption { color: #eee; margin-top: 8px; font-size: 14px; }
#lightbox button {
  background: rgba(255, 255, 255, .12); border: 0; color: #fff; cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%; font-size: 26px; line-height: 1; justify-self: center;
}
#lightbox button:hover { background: rgba(255, 255, 255, .25); }
#lightbox button[hidden] { visibility: hidden; display: block; }
#lightbox .lb-close { position: fixed; top: 12px; right: 12px; }
@media (max-width: 520px) {
  #lightbox[open] { grid-template-columns: 40px 1fr 40px; }
  #lightbox button { width: 36px; height: 36px; font-size: 22px; }
}

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 36px; padding: 0 16px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-danger { color: var(--missing); }
.btn-danger:hover { border-color: var(--missing); }
.btn-small { height: 30px; padding: 0 12px; font-size: 13px; }
.icon-btn {
  width: 30px; height: 30px; flex: none; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; line-height: 1;
}
.icon-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-ink); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.chip {
  border: 1px dashed var(--border); background: transparent; border-radius: 999px;
  padding: 0 10px; font-size: 12px; line-height: 24px; cursor: pointer; color: var(--muted);
}
.chip:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ---------- 編集モード ---------- */
.edit-banner { background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; line-height: 1.5; }
.edit-banner .inner {
  padding-top: 6px; padding-bottom: 6px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap;
}
.edit-banner .btn { height: 26px; }
.banner-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head .section-title, .section-head .page-title { margin: 0; }
.section-title a { color: inherit; }

/* プロフィールの入力欄 */
.hint-top { margin: -6px 0 12px; }
.prof-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 12px; align-items: start; }
.prof-group { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 12px; margin: 0; min-width: 0; }
.prof-group legend { font-size: 12px; font-weight: 700; color: var(--muted); padding: 0 6px; }
.prof-group .field { margin-bottom: 0; }
.prof-group-wide { grid-column: 1 / -1; }
.schema-group[hidden] { display: none; }
.pf { display: grid; grid-template-columns: 8.5em minmax(0, 1fr); gap: 8px; align-items: start; margin-top: 6px; }
.pf-label { font-size: 13px; font-weight: 600; padding-top: 8px; line-height: 1.4; }
.pf textarea { min-height: 3.6em; }
.pf-songs { display: grid; gap: 6px; justify-items: start; }
.pf-songs > div { width: 100%; }
.song-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: 6px; align-items: center; margin-bottom: 6px; }
@media (max-width: 520px) {
  .pf { grid-template-columns: 1fr; gap: 2px; }
  .pf-label { padding-top: 4px; }
  .song-row { grid-template-columns: minmax(0, 1fr) auto; }
  .song-row [data-song="url"] { grid-column: 1; }
}

/* 表示確認（PC / スマホ） */
.device {
  border: 0; padding: 0; margin: auto; width: calc(100vw - 24px); height: calc(100vh - 24px);
  max-width: none; max-height: none; border-radius: 14px; background: var(--surface-2); color: var(--text);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}
.device[open] { display: flex; flex-direction: column; }
.device::backdrop { background: rgba(0, 0, 0, .6); }
.device-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.device-size { margin-right: auto; font-size: 12px; }
.device-stage { flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; padding: 16px; }
.device-frame {
  position: relative; overflow: hidden; background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 4px 20px rgba(0, 0, 0, .2);
}
.device-frame.is-phone { border: 6px solid #2a2c31; border-radius: 28px; box-sizing: content-box; }
.device-frame iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; background: var(--bg); }
.nav .nav-new { color: var(--accent-ink); font-weight: 700; }
.article-head { position: relative; }
.head-edit { position: absolute; top: 16px; right: 16px; }
.is-editing .article-title { padding-right: 84px; }
a.wl-missing { text-decoration: none; cursor: pointer; }
a.wl-missing:hover { border-bottom-style: solid; }

.editor { max-width: 920px; margin: 0 auto; }
.editor-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.editor-bar .page-title { margin: 0; }
.editor-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.editor-foot { justify-content: flex-end; margin-top: 20px; }
.editor-error {
  background: color-mix(in srgb, var(--missing) 12%, var(--surface)); color: var(--missing);
  border-radius: 8px; padding: 10px 14px; margin: 0 0 16px; font-weight: 600;
}
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px 20px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0;
}
.panel-title { font-size: 15px; margin: 0 0 12px; }
.editor-top { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; }
.editor-top .panel { margin-bottom: 16px; }
@media (max-width: 760px) {
  .editor-top { grid-template-columns: 1fr; gap: 0; }
}

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field-label em { font-style: normal; font-size: 11px; color: #fff; background: var(--missing); border-radius: 4px; padding: 0 5px; margin-left: 4px; }
.field small, .hint { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; margin: 4px 0 0; }
.editor input:not([type=file]):not([type=search]), .editor textarea, .editor select, .picker-filter {
  width: 100%; min-width: 0; padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 14px; line-height: 1.6;
}
.editor input:focus, .editor textarea:focus, .editor select:focus, .picker-filter:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; background: var(--surface);
}
.editor textarea { resize: vertical; }
.tag-suggest { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -6px 0 14px; font-size: 12px; }

.image-slot, .slot-empty { max-width: 260px; margin: 0 auto; }
.image-slot { text-align: center; }
.slot-img { display: block; width: 100%; padding: 0; border: 0; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--surface-2); }
.slot-img img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.slot-path { font-size: 12px; color: var(--muted); margin: 6px 0; overflow-wrap: anywhere; }
.slot-actions { display: flex; gap: 6px; justify-content: center; }
.slot-empty {
  display: grid; place-items: center; width: 100%; aspect-ratio: 1;
  border: 2px dashed var(--border); border-radius: 8px; background: var(--surface-2);
  color: var(--muted); cursor: pointer; font-weight: 600;
}
.slot-empty:hover { border-color: var(--accent); color: var(--accent-ink); }

.prof-row { display: grid; grid-template-columns: 9em minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.row-btns { display: flex; gap: 4px; }
.row-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 520px) {
  .prof-row { grid-template-columns: minmax(0, 1fr) auto; }
  .prof-row .prof-key { grid-column: 1 / -1; }
  .prof-row .prof-val { grid-column: 1; }
}

.gallery-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.gal-item { border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: var(--surface-2); display: grid; gap: 6px; }
.gal-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: block; }
.gal-item input { font-size: 13px !important; padding: 4px 8px !important; }
.gal-item .row-btns { justify-content: center; }

.body-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.body-head .panel-title { margin: 0; }
.tabs { display: flex; background: var(--surface-2); border-radius: 8px; padding: 3px; }
.tab { border: 0; background: transparent; padding: 3px 14px; border-radius: 6px; font-size: 13px; cursor: pointer; color: var(--muted); }
.tab.is-active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.toolbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.toolbar.is-disabled { opacity: .4; pointer-events: none; }
.toolbar button {
  border: 1px solid var(--border); background: var(--surface); border-radius: 6px;
  padding: 2px 10px; font-size: 13px; cursor: pointer;
}
.toolbar button:hover { border-color: var(--accent); color: var(--accent-ink); }
.editor .toolbar select { width: auto; padding: 2px 8px; font-size: 13px; }
.body-input { min-height: 360px; font-family: ui-monospace, "Cascadia Mono", Consolas, "BIZ UDGothic", monospace !important; font-size: 14px; }
.body-preview { min-height: 360px; border: 1px dashed var(--border); border-radius: 8px; padding: 4px 16px; }

/* 画像選択ダイアログ */
.picker {
  border: 0; padding: 0; border-radius: 14px; background: var(--surface); color: var(--text);
  width: min(880px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}
.picker::backdrop { background: rgba(0, 0, 0, .55); }
.picker.is-drop .picker-box { outline: 3px dashed var(--accent); outline-offset: -8px; }
.picker-box { display: flex; flex-direction: column; max-height: calc(100vh - 48px); padding: 16px; }
.picker-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.picker-head strong { margin-right: auto; }
.picker-filter { width: 200px !important; height: 30px; padding: 2px 10px !important; }
.picker-note { color: var(--muted); font-size: 12px; margin: 8px 0 12px; }
.picker-shrink { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 8px; cursor: pointer; line-height: 1.5; }
.picker-shrink input { accent-color: var(--accent); margin-top: 2px; flex: none; }
.picker-shrink + .picker-note { margin-top: 4px; }
.picker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px;
  overflow-y: auto; min-height: 160px; align-content: start; padding: 2px;
}
.picker-grid > p { grid-column: 1 / -1; }
.picker-cell { position: relative; min-width: 0; }
.picker-cell .picker-item { width: 100%; height: 100%; }
/* 画像の削除ボタン（左上。右上は選んだ順番の数字） */
.picker-del {
  position: absolute; top: 10px; left: 10px; z-index: 1; width: 26px; height: 26px; padding: 0;
  display: grid; place-items: center; border-radius: 50%; border: 0; cursor: pointer;
  font-size: 16px; line-height: 1; background: rgba(0, 0, 0, .65); color: #fff;
  opacity: .85; transition: background .15s, opacity .15s;
}
.picker-del:hover, .picker-del:focus-visible { opacity: 1; background: var(--missing); }
.picker-item {
  position: relative; display: grid; gap: 4px; padding: 6px; text-align: left;
  border: 2px solid transparent; border-radius: 10px; background: var(--surface-2); cursor: pointer;
}
.picker-item:hover { border-color: var(--border); }
.picker-item.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.picker-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: block; background: var(--surface); }
.picker-item span { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-badge {
  position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 13px; display: grid; place-items: center;
}
.picker-foot { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.picker-count { margin-right: auto; color: var(--muted); font-size: 13px; }

/* ---------- フッター ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 13px; }
.site-footer .inner { display: flex; justify-content: space-between; gap: 12px; padding-top: 16px; padding-bottom: 16px; flex-wrap: wrap; }

/* =====================================================================
   テーマ：シンプルなモノクロ＋緑のアクセント
   ===================================================================== */
::selection { background: rgba(60, 207, 142, .3); color: #fff; }
html { scrollbar-color: var(--scrollbar) var(--bg); }

/* うっすらとした星（夜空の名残り。主張しない程度） */
body {
  background-image:
    radial-gradient(1px 1px at 23px 41px, var(--star), transparent 70%),
    radial-gradient(1px 1px at 151px 97px, var(--star), transparent 70%),
    radial-gradient(1px 1px at 271px 211px, var(--star), transparent 70%);
  background-size: 211px 211px, 307px 307px, 331px 331px;
  background-attachment: fixed;
}

/* リンク：記事がある＝緑、記事がない＝赤 */
.wl, .article-body a:not(.wl-missing), .profile a:not(.wl-missing) { color: var(--accent-ink); }
.wl-missing, a.wl-missing { color: var(--missing); }

/* ヘッダー */
.site-header { background: var(--header-bg); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.logo-mark { background: transparent; color: var(--accent-ink); border: 1.5px solid var(--accent); border-radius: 6px; }
.search button { color: var(--on-accent); }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav .nav-new { color: var(--accent-ink); }

/* 見出しと面 */
.section-title { border-left: 3px solid var(--accent); padding-left: 10px; }
.kind-tile-head { padding-left: 10px; border-left: 3px solid var(--accent); }
.hero { background-image: none; }
.hero h1 { letter-spacing: .04em; }
.infobox-title { background: var(--surface-2); color: var(--text); border-top: 2px solid var(--accent); }
.profile th { background: var(--surface-2); color: var(--th-text); }
.article-summary { border-left: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; }
.article-catch { color: var(--catch); }
.kind-badge { border-color: var(--border); color: var(--muted); }
.tag { background: var(--surface-2); border: 1px solid var(--border); color: var(--accent-ink); }
.tag::before { color: var(--muted); }
.btn-primary { color: var(--on-accent); }
.picker-badge { color: var(--on-accent); }
.row-icon { box-shadow: 0 0 0 1px var(--border); }
.kind-tile-more { color: var(--accent-ink); }
.edit-banner { background: var(--surface-2); color: var(--muted); border-bottom: 1px solid var(--border); }
.edit-banner b { color: var(--text); }

/* =====================================================================
   本文の見出し：トグル
   ===================================================================== */
.fold > summary { list-style: none; cursor: pointer; position: relative; padding-right: 32px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary > h2, .fold > summary > h3, .fold > summary > h4 { display: block; }
.fold > summary::after {
  content: ""; position: absolute; right: 8px; top: 50%; width: 7px; height: 7px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-75%) rotate(45deg); transition: transform .2s;
}
.fold:not([open]) > summary::after { transform: translateY(-40%) rotate(-45deg); }
.fold > summary:hover::after { border-color: var(--text); }
.fold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fold.fold-h2 > summary::after { top: calc(50% + 10px); }
.fold.fold-h3 > summary::after { top: calc(50% + 6px); }

/* =====================================================================
   関連イラスト：4枚以上は横スクロール
   ===================================================================== */
.gallery-wrap { position: relative; }
.gallery-wrap.is-carousel .gallery {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: 12px; scroll-behavior: smooth;
  scrollbar-width: thin; scrollbar-color: var(--accent) var(--surface-2);
}
.gallery-wrap.is-carousel .gallery-item { flex: 0 0 calc((100% - 30px) / 4); scroll-snap-align: start; }
.gallery-wrap.is-carousel .gallery::-webkit-scrollbar { height: 8px; }
.gallery-wrap.is-carousel .gallery::-webkit-scrollbar-track { background: var(--surface-2); border-radius: 4px; }
.gallery-wrap.is-carousel .gallery::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }
.gal-nav {
  position: absolute; top: calc(50% - 6px); transform: translateY(-50%); z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--border); background: var(--overlay-bg); color: var(--text);
  font-size: 22px; line-height: 1; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}
.gal-nav:hover { border-color: var(--accent); color: var(--accent-ink); }
.gal-nav:disabled { opacity: 0; pointer-events: none; }
.gal-prev { left: -10px; }
.gal-next { right: -10px; }
@media (max-width: 640px) {
  .gallery-wrap.is-carousel .gallery-item { flex-basis: calc((100% - 10px) / 2.3); }
  .gal-prev { left: -6px; }
  .gal-next { right: -6px; }
}

/* 拡大表示の「10 / 20」 */
.lb-count {
  display: inline-block; margin-right: 10px; padding: 0 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .12); color: #fff;
  font-variant-numeric: tabular-nums; font-size: 13px;
}
.lb-count:empty { display: none; }

/* =====================================================================
   フィルター（ランダム・創作っ子一覧）
   ===================================================================== */
.random-box { max-width: 640px; margin: 0 auto; text-align: center; }
.filter-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0 20px; }
.filter-chips.is-left { justify-content: flex-start; margin: 0 0 16px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
  padding: 5px 14px; border-radius: 999px; font-size: 14px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
}
/* 見えないチェック欄は、チップそのものに重ねておく（押したときに画面が別の場所へ飛ばないように） */
.filter-chip { position: relative; }
.filter-chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.filter-chip::before {
  content: ""; width: 14px; height: 14px; border-radius: 3px; border: 1.5px solid currentColor;
  box-sizing: border-box;
}
.filter-chip.is-on { color: var(--text); border-color: var(--accent); }
.filter-chip.is-on::before {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3 7.5l2.5 2.5L11 4.5' fill='none' stroke='%2308130e' stroke-width='2'/%3E%3C/svg%3E") center / 12px no-repeat;
  border-color: var(--accent);
}
.filter-chip:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip-count { font-size: 12px; color: var(--muted); }
.random-count { color: var(--muted); font-size: 13px; margin: -8px 0 16px; }
.random-go { height: 44px; padding: 0 28px; font-size: 15px; }

/* =====================================================================
   文字を打って探せる入力欄（記事へのリンク・関連記事・登場作品）
   ===================================================================== */
.combo { position: relative; flex: 1; min-width: 200px; }
.editor .combo input { padding-left: 32px; }
.combo::before {
  content: ""; position: absolute; left: 11px; top: 50%; width: 9px; height: 9px; transform: translateY(-60%);
  border: 1.5px solid var(--muted); border-radius: 50%; pointer-events: none;
}
.combo::after {
  content: ""; position: absolute; left: 20px; top: 50%; width: 5px; height: 1.5px; transform: translateY(3px) rotate(45deg);
  background: var(--muted); pointer-events: none;
}
.combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  list-style: none; margin: 0; padding: 4px; max-height: 280px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5); text-align: left;
}
.combo-list li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 4px; cursor: pointer; }
.combo-list li.is-active, .combo-list li:hover { background: var(--surface-2); }
.combo-list .row-icon { width: 30px; height: 30px; }
.combo-list .row-icon .thumb-initial { font-size: 13px; }
.combo-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.combo-text b { font-weight: 600; font-size: 14px; }
.combo-text small { color: var(--muted); font-size: 11px; }
.combo-kind { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 6px; }
.combo-empty { color: var(--muted); cursor: default !important; font-size: 13px; }
.toolbar .combo { flex: 0 1 240px; min-width: 180px; }
.editor .toolbar .combo input { padding-top: 2px; padding-bottom: 2px; font-size: 13px; }

/* 登場作品・関連記事の選択済みリスト */
.pick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.pick-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--accent-ink);
}
.pick-chip button { border: 0; background: none; color: var(--muted); cursor: pointer; width: 22px; height: 22px; border-radius: 50%; line-height: 1; }
.pick-chip button:hover { background: var(--border); color: var(--text); }
.pf-works { display: grid; gap: 4px; }
.rel-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.rel-row .row-icon { width: 34px; height: 34px; }
.rel-row .row-title { flex: 1; min-width: 0; }
.rel-add { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* =====================================================================
   会員：ログイン・アカウント・いいね・お気に入り・コメント
   ===================================================================== */
.account { position: relative; flex: none; }
.account-menu > summary { list-style: none; cursor: pointer; gap: 6px; max-width: 180px; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-badge {
  font-size: 10px; font-weight: 700; padding: 0 6px; border-radius: 4px; line-height: 18px;
  background: var(--accent); color: var(--on-accent);
}
.account-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 220px;
  display: flex; flex-direction: column; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.account-pop a, .account-pop button {
  text-align: left; padding: 8px 10px; border-radius: 4px; color: var(--text); font-size: 14px;
  background: none; border: 0; cursor: pointer;
}
.account-pop a:hover, .account-pop button:hover { background: var(--surface-2); text-decoration: none; }
.account-who { font-size: 12px; color: var(--muted); padding: 4px 10px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; overflow-wrap: anywhere; }
.account-warn { font-size: 12px; color: var(--warn); margin: 4px 10px; line-height: 1.5; }
.account-pop .account-danger { color: var(--missing); border-top: 1px solid var(--border); margin-top: 4px; border-radius: 0 0 4px 4px; }

/* 画面の下に短く出るお知らせ */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 200; max-width: min(92vw, 480px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: var(--radius); font-size: 14px; line-height: 1.6;
  background: var(--text); color: var(--bg); box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  transition: opacity .2s, transform .2s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* 管理者バーの件数バッジ */
.count-badge {
  display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; border-radius: 9px;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  background: var(--missing); color: #fff;
}
.count-badge[hidden] { display: none; }

/* コメント：管理人・書き直し */
.comment .admin-badge { margin-left: 6px; }
.comment.is-admin { border-left: 3px solid var(--accent); padding-left: 10px; }
.comment-edit { margin-top: 8px; }
.comment-actions .comment-report { margin-left: auto; font-size: 12px; color: var(--muted); }
.comment-more { text-align: center; margin: 4px 0 10px; }

/* 会員のアイコン（画像がなければ名前の1文字目） */
.avatar {
  flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; overflow: hidden;
  background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1;
  box-shadow: 0 0 0 1px var(--border); vertical-align: middle;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.is-anon img { object-fit: contain; padding: 3px; }
.comment-head .avatar { margin-right: 2px; }
.account-menu > summary .avatar { width: 22px; height: 22px; font-size: 11px; }
.anon-real { font-size: 11px; padding: 0 6px; border-radius: 4px; border: 1px dashed var(--warn); color: var(--warn); }

/* コメント欄の「匿名で投稿する」 */
/* 「～として投稿」の下の行に「匿名で投稿する」 */
.comment-as { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; flex: 1; min-width: 0; }
.comment-form .comment-anon { white-space: nowrap; }
/* スマホ：右下の「上へ戻る」ボタンにフッターのリンクが隠れないように */
@media (max-width: 640px) { .site-footer .inner { padding-right: 72px; } }
.comment-form .comment-anon input { width: 16px !important; height: 16px; margin: 0; padding: 0; flex: none; }
/* 返信：元のコメントの下に、少し下げて並べる */
.comment-replies { list-style: none; margin: 10px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); display: grid; gap: 10px; }
.comment-replies .comment { padding-top: 0; border-top: 0; }
.reply-slot:not(:empty) { margin-top: 10px; padding-left: 14px; border-left: 2px solid var(--accent); }
.reply-form textarea { width: 100%; }
/* お問い合わせのやりとり（管理人の返事は少し色を付けて右寄せ気味に） */
.inq-item { display: grid; gap: 8px; }
.inq-msg { padding: 8px 12px; border-radius: var(--radius); background: var(--surface-2); }
.inq-msg.from-admin { margin-left: 24px; background: var(--accent-soft); border-left: 3px solid var(--accent); }
.inq-msg .comment-text { margin: 4px 0 0; }
.inq-reply textarea { width: 100%; }
.comment-where .new-badge, .comment-where .pending-badge { margin-left: 6px; }
.comment-anon { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.comment-anon input { accent-color: var(--accent); width: 16px; height: 16px; }
.comment-anon-hint { margin: 6px 0 0; }

/* マイページ */
.mypage-head { display: flex; align-items: center; gap: 12px; }
.mypage-head .avatar { width: 48px; height: 48px; font-size: 20px; }
.mypage-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 18px; border-bottom: 1px solid var(--border); }
.mypage-tabs .tab { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.mypage-tabs .tab:hover { color: var(--text); text-decoration: none; }
.mypage-tabs .tab.is-active { color: var(--text); font-weight: 700; border-bottom-color: var(--accent); }
.mypage-section { margin-bottom: 16px; }
.mypage-section .section-title { margin-top: 0; }
.icon-edit { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.icon-preview .avatar { width: 96px; height: 96px; font-size: 40px; }
.icon-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 180px; }
.stack-form { display: grid; gap: 10px; max-width: 520px; }
.stack-form .btn { justify-self: start; }
/* お問い合わせ：自動で送るプログラムだけが入力する見えない欄 */
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.report-reasons { margin: 6px 0; padding-left: 1.2em; font-size: 13px; color: var(--muted); }

/* 以前の版 */
.picker.versions { width: min(720px, calc(100vw - 32px)); }
.versions-list { overflow-y: auto; min-height: 0; }
.versions .rows li { display: block; }
.versions .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.versions .row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.version-pre {
  margin: 6px 0 10px; padding: 10px; max-height: 300px; overflow: auto;
  background: var(--surface-2); border-radius: 4px; font-size: 12px; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
#autosave-note .notice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* 決まった文章のページ（プライバシーポリシーなど） */
.doc-page { max-width: 760px; }
.doc-page ul { padding-left: 1.4em; }
.doc-page li { margin: 4px 0; }

/* 点検の表示テスト（見えない枠で開く） */
.check-selftest { margin-top: 28px; }
.selftest-frame { position: fixed; left: -10000px; top: 0; width: 1024px; height: 768px; border: 0; visibility: hidden; }

/* 本文へ移動（Tab キーを押したときだけ出る） */
.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 300; padding: 8px 14px; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent); font-weight: 700; transition: top .15s;
}
.skip-link:focus { top: 12px; text-decoration: none; }
#app:focus { outline: none; }

.s-spoiler { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: -4px 0 10px; font-size: 13px; }
.s-spoiler label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.s-spoiler input { accent-color: var(--accent); width: 16px; height: 16px; }

/* 最近の更新 */
.recent-day { font-size: 14px; color: var(--muted); font-weight: 600; margin: 22px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.new-badge {
  display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 4px; vertical-align: 1px;
  font-size: 10px; font-weight: 700; line-height: 18px; background: var(--accent); color: var(--on-accent);
}

/* 検索で一致した文字 */
mark.hit { background: var(--accent-soft); color: inherit; border-radius: 2px; padding: 0 1px; box-shadow: inset 0 -2px 0 var(--accent); }

/* 印刷するとき：飾りやボタンを消して、本文だけを白い紙に */
@media print {
  :root, :root[data-theme] {
    --bg: #fff; --surface: #fff; --surface-2: #f3f3f3; --text: #000; --muted: #444; --border: #ccc;
    --accent-ink: #000; --th-text: #000; color-scheme: light;
  }
  body { background: #fff; font-size: 11pt; }
  body::before, body::after { display: none !important; }
  .site-header, .site-footer, .to-top, .skip-link, .social-row, .comments, .edit-banner,
  .toast, .account, .menu-wrap, .head-actions, .btn, #lightbox { display: none !important; }
  a { color: #000; text-decoration: underline; }
  .article-layout { display: block; }
  .infobox { float: none; width: auto; max-width: 360px; margin: 0 0 16px; break-inside: avoid; }
  h1, h2, h3 { break-after: avoid; }
  img { break-inside: avoid; }
}
@media (max-width: 1000px) {
  .account { order: 2; }
}

.linkish { background: none; border: 0; padding: 0; color: var(--accent-ink); cursor: pointer; text-decoration: underline; font: inherit; }

.auth-dialog {
  border: 0; padding: 0; border-radius: 12px; background: var(--surface); color: var(--text);
  width: min(400px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.auth-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.auth-box { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 22px 22px 20px; }
.auth-close { position: absolute; top: 12px; right: 12px; }
.auth-tabs { align-self: flex-start; }
.auth-google { height: 42px; gap: 10px; background: #fff; color: #1f1f1f; border-color: #fff; }
.auth-google:hover { border-color: var(--accent); }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-box .field { margin: 0; }
.auth-box input, .form-panel input, .form-panel textarea, .comment-form textarea {
  width: 100%; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 15px;
}
.auth-box input:focus, .form-panel input:focus, .form-panel textarea:focus, .comment-form textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px;
}
.form-panel input[type=number] { width: 140px; }
.auth-submit { height: 42px; }
.auth-reset { align-self: center; font-size: 13px; }
.auth-box .notice, .auth-box .editor-error { margin: 0; }

.social-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.social-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 14px;
}
.social-btn:hover { border-color: var(--accent); }
.social-btn.is-on { border-color: var(--accent); color: var(--accent-ink); }
.social-icon { font-size: 15px; }
.social-count { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 2px; }
.social-btn.is-on .social-count { color: var(--accent-ink); }

.comment-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.comment { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; background: var(--surface); }
.comment.is-pending { border-style: dashed; opacity: .9; }
.comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 13px; }
.comment-name { font-weight: 700; font-size: 14px; }
.comment-text { margin: 6px 0 0; overflow-wrap: anywhere; line-height: 1.7; }
.comment-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.comment-where { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.pending-badge { font-size: 11px; padding: 0 8px; border-radius: 999px; background: rgba(245, 194, 107, .15); color: var(--warn); border: 1px solid rgba(245, 194, 107, .5); }
.comment-form { display: grid; gap: 8px; }
.comment-form textarea { resize: vertical; min-height: 80px; }
.comment-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.comment-login { color: var(--muted); }

.sync-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; flex-wrap: wrap; }
.sync-row select {
  padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; max-width: 100%;
}
.loading { text-align: center; padding: 40px 0; }

/* =====================================================================
   トップの大見出し：右側にキャラクター（左に向かって消えていく）
   ===================================================================== */
.hero { position: relative; overflow: hidden; }
.hero-text { position: relative; z-index: 1; max-width: 62%; }
.hero-art {
  position: absolute; top: 0; right: 0; bottom: 0; width: 50%; overflow: hidden;
  /* 枠の左側をぼかす（画像が枠より横に大きいとき用） */
  -webkit-mask-image: linear-gradient(to left, #000 55%, transparent 100%);
  mask-image: linear-gradient(to left, #000 55%, transparent 100%);
  opacity: .95; transition: opacity .2s;
}
/* 画像そのものも左へ向かって消える */
.hero-art img {
  position: absolute; width: auto; max-width: none; display: block;
  -webkit-mask-image: linear-gradient(to left, #000 45%, transparent 100%);
  mask-image: linear-gradient(to left, #000 45%, transparent 100%);
}
.hero-art:hover { opacity: 1; }
.hero.has-art { min-height: 170px; display: flex; align-items: center; }
@media (max-width: 640px) {
  .hero-text { max-width: 100%; }
  .hero-art { width: 75%; opacity: .45; }
}

/* ロゴのアイコンを外したので、文字だけ */
.logo-mark { display: none; }

/* ダーク／ライト切り替えボタン */
.theme-btn { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--muted); }
.theme-btn:hover { color: var(--text); }
@media (max-width: 1000px) {
  .theme-btn { order: 2; }
}

/* タグ一覧の並び順 */
.sort-select { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.sort-select select {
  padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
}

/* タグ一覧の検索 */
.tag-search { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.tag-search input {
  flex: 1; min-width: 200px; max-width: 360px; height: 36px; padding: 0 12px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
}
.tag-search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* キャッチコピーは少し斜めに */
.article-catch { display: block; }
.article-catch > span { display: inline-block; transform: skewX(-10deg); transform-origin: left bottom; }

/* 編集画面：トップページでの写り方 */
.editor:not(.is-chara) .hero-panel { display: none; }
/* 見本は、トップページと同じ幅・同じ中身で作ってから縮小して見せる（写り方を本番と同じにするため） */
.hero-preview-wrap { position: relative; overflow: hidden; margin-bottom: 14px; }
.hero-preview { position: absolute; top: 0; left: 0; transform-origin: top left; pointer-events: none; margin: 0; }
/* 見本の画像は、直接ドラッグ（位置）・ホイール（大きさ）で調整できる */
.hero-preview .hero-art { pointer-events: auto; cursor: grab; touch-action: none; user-select: none; z-index: 2; }
.hero-preview .hero-art.is-dragging { cursor: grabbing; }
.hero-preview .hero-art img { pointer-events: none; }
.hero-preview .hero-art::after {
  content: ""; position: absolute; inset: 0; border: 2px dashed transparent; border-radius: 4px; transition: border-color .15s;
}
.hero-preview .hero-art:hover::after, .hero-preview .hero-art.is-dragging::after { border-color: var(--accent); }
.hero-sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px 20px; margin-bottom: 12px; }
.hero-slider { display: grid; gap: 4px; }
.hero-slider-head { display: flex; justify-content: space-between; font-size: 13px; }
.hero-slider output { color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.editor .hero-slider input[type=range] { width: 100%; margin: 0; accent-color: var(--accent); padding: 0; border: 0; background: none; outline-offset: 2px; }
.hero-slider small { color: var(--muted); font-size: 12px; line-height: 1.5; }

/* 虫眼鏡マークのある検索欄は、文字がマークにかぶらないように左をあける */
.combo input { padding-left: 34px !important; }

/* ヘッダーの「ランダム」メニュー（マウスを乗せると開く） */
.nav-drop { position: relative; }
.nav-drop-label { display: inline-flex; align-items: center; gap: 2px; }
.nav-caret { font-size: 10px; opacity: .7; }
.nav-drop-menu {
  display: none; position: absolute; top: 100%; right: 0; z-index: 50; min-width: 210px;
  flex-direction: column; padding: 6px; margin-top: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
/* ラベルとメニューのすき間でマウスが外れないように */
.nav-drop-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.nav-drop:hover .nav-drop-menu, .nav-drop:focus-within .nav-drop-menu { display: flex; }
.nav-drop.is-closed .nav-drop-menu { display: none; }
.nav-drop.is-open .nav-drop-menu { display: flex; }
/* タッチの機器では、上に乗せた扱いでは開かない（タップで開く） */
@media (hover: none) {
  .nav-drop:hover:not(.is-open) .nav-drop-menu, .nav-drop:focus-within:not(.is-open) .nav-drop-menu { display: none; }
}
.nav-drop-menu button, .nav-drop-menu a {
  text-align: left; padding: 8px 12px; border-radius: 4px; font-size: 14px; color: var(--text);
  background: none; border: 0; cursor: pointer; white-space: nowrap;
}
.nav-drop-menu button:hover, .nav-drop-menu a:hover,
.nav-drop-menu button:focus-visible, .nav-drop-menu a:focus-visible { background: var(--surface-2); text-decoration: none; }
.nav .nav-drop-menu a { color: var(--text); padding: 8px 12px; }
.nav-drop-menu .nav-drop-more { margin-top: 4px; border-top: 1px solid var(--border); border-radius: 0 0 4px 4px; color: var(--accent-ink) !important; }

/* トップページ：編集ボタン・オーナー欄 */
.hero-edit { position: absolute; top: 12px; right: 12px; z-index: 2; }
.owner-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.owner-text { margin: 0 0 12px; line-height: 1.8; }
.owner-text:last-child { margin-bottom: 0; }
.owner-links { display: flex; flex-wrap: wrap; gap: 8px; }
.owner-link {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 14px;
}
.owner-link:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.owner-link-icon { font-weight: 700; }

/* 記事：いいね・お気に入り・リンクをコピー */
.social-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.social-row .social-bar { margin-top: 0; }

/* トップページの編集：リンクの行 */
.link-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; gap: 8px; align-items: center; margin-bottom: 8px; }
@media (max-width: 560px) {
  .link-row { grid-template-columns: minmax(0, 1fr) auto; }
  .link-row [data-lf="url"] { grid-column: 1; }
}

/* タグの管理 */
.tag-new { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.tag-row {
  display: grid; grid-template-columns: minmax(0, 1.2fr) 4em minmax(0, 1fr) 30px; gap: 10px; align-items: center;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.tag-row-name { font-weight: 600; overflow-wrap: anywhere; }
.tag-row-count { font-size: 12px; text-align: right; }
@media (max-width: 560px) {
  .tag-new { grid-template-columns: 1fr; }
  .tag-row { grid-template-columns: minmax(0, 1fr) 3.5em 30px; }
  .tag-row input { grid-column: 1 / -1; grid-row: 2; }
}

/* インポート */
.io-check { display: flex; align-items: center; gap: 12px; width: 100%; cursor: pointer; }
.io-check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }

/* ページの上へ戻るボタン */
.to-top {
  /* 右下に Netlify などの小さな表示が出ても重ならないよう、少し上に置く */
  position: fixed; z-index: 30; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--border); background: var(--overlay-bg); color: var(--text);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
}
.to-top:hover { border-color: var(--accent); color: var(--accent-ink); }
.to-top:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.to-top[hidden] { display: none; }
.logo:focus { outline: none; }
.logo:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }

/* =====================================================================
   一覧の表示（カード／リスト・表示項目）と詳しい検索
   ===================================================================== */
.head-actions { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.view-menu { position: relative; }
.view-menu > summary { list-style: none; cursor: pointer; gap: 6px; }
.view-menu > summary::-webkit-details-marker { display: none; }
.view-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: 240px;
  padding: 12px; display: grid; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.view-modes { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 8px; padding: 3px; }
.view-mode { text-align: center; padding: 6px 0; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--muted); }
.view-mode { position: relative; }
.view-mode input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.view-mode.is-on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.view-mode:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.view-fields { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; font-size: 13px; }
.view-fields legend { font-size: 12px; color: var(--muted); margin-bottom: 4px; padding: 0; }
.view-fields label { display: flex; align-items: center; gap: 6px; min-height: 30px; cursor: pointer; }
.view-fields input { accent-color: var(--accent); width: 16px; height: 16px; }

.v-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.v-meta b { font-weight: 600; margin-right: 4px; color: var(--text); opacity: .7; }
.v-snippet { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.6; overflow-wrap: anywhere; white-space: normal; }
.rows .row-summary { white-space: nowrap; }

.vcards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.vcard {
  display: flex; flex-direction: column; height: 100%; overflow: hidden; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color .15s;
}
.vcard:hover { border-color: var(--accent); text-decoration: none; }
.vcard-img { aspect-ratio: 1; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.vcard-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vcard-img .thumb-initial { font-size: 40px; }
.vcard-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vcard .row-title { white-space: normal; }
.vcard-summary { font-size: 12px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; }
@media (max-width: 520px) {
  .vcards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

.s-form { display: flex; gap: 8px; margin-bottom: 12px; }
.s-form input {
  flex: 1; min-width: 0; height: 42px; padding: 0 12px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 15px;
}
.s-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.s-form .btn { height: 42px; }
.s-filters {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px;
}
.s-filters > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: 14px; }
.s-filters > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#s-filters { padding: 0 14px 12px; }
.s-group { border: 0; margin: 0 0 10px; padding: 0; min-width: 0; }
.s-group legend { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 6px; padding: 0; }
.s-group .filter-chips { margin: 0; }
.s-group .filter-chip { padding: 3px 12px; font-size: 13px; }
.s-group .filter-chip.is-extra { display: none; }
.s-group.show-all .filter-chip.is-extra { display: inline-flex; }
.s-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 4px 0 10px; }
.s-count { margin-right: auto; font-size: 15px; }
.s-active { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.s-active:empty { display: none; }
.active-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent-soft); color: var(--text); font-size: 13px;
}
.active-chip span { color: var(--muted); }
.empty-box {
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); padding: 18px 20px;
}
.empty-box .empty-title { font-weight: 700; margin: 0 0 8px; }
.empty-box ul { margin: 0 0 12px; padding-left: 1.3em; color: var(--muted); font-size: 14px; }
.empty-box .btn { margin-right: 8px; }
@media (max-width: 640px) {
  /* 「表示」の設定は画面の下から出す（画面の外にはみ出さないように） */
  .view-pop {
    position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: auto; z-index: 60; box-shadow: 0 -6px 30px rgba(0, 0, 0, .45);
  }
  /* 見出しとボタンは縦に並べる */
  .section-head { flex-direction: column; align-items: flex-start; }
  .banner-actions { flex-wrap: wrap; }
}
@media (pointer: coarse), (max-width: 640px) {
  .s-group .filter-chip { padding: 7px 12px; }
  .active-chip { padding: 7px 12px; }
  .view-fields label { min-height: 36px; }
}

/* =====================================================================
   段階3：組織・地域の階層、画像の分類、ネタバレ、選んで入れる項目
   ===================================================================== */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 18px; margin-left: 8px; border-left: 1px solid var(--border); }
.tree li { padding: 4px 0 4px 10px; position: relative; }
.tree ul > li::before { content: ""; position: absolute; left: -18px; top: 16px; width: 14px; border-top: 1px solid var(--border); }
.tree a { font-weight: 600; }
.tree-type { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 6px; margin-left: 8px; }
.tree { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }

.gallery-group-title { font-size: 14px; margin: 14px 0 8px; color: var(--muted); font-weight: 700; }
.gallery-group-title:first-of-type { margin-top: 4px; }
.gal-item select { font-size: 12px !important; padding: 3px 6px !important; }

.spoiler-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; font-size: 13px; }
.spoiler {
  border: 1px dashed var(--border); border-radius: var(--radius); margin: 0 0 1em; background: var(--surface-2);
}
.spoiler > summary {
  cursor: pointer; padding: 10px 14px; list-style: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-weight: 600;
}
.spoiler > summary::-webkit-details-marker { display: none; }
.spoiler > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.spoiler-badge { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 4px; background: var(--missing); color: #fff; }
.spoiler-hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.spoiler[open] > summary .spoiler-hint { display: none; }
.spoiler[open] { border-style: solid; }
.spoiler > :not(summary) { padding: 0 14px; }
.spoiler > :last-child { padding-bottom: 12px; }

.pick-chip.is-plain { color: var(--text); }
.reg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.combo-list li.is-new b { color: var(--accent-ink); }

/* =====================================================================
   段階4：関係性・人物相関図
   ===================================================================== */
/* 分類ごとの色（相関図の線・一覧の印で共通） */
[data-group="家族"] { --rel: #e0a35a; }
[data-group="恋人・配偶者"] { --rel: #e26d8a; }
[data-group="友人"] { --rel: #3ccf8e; }
[data-group="仲間"] { --rel: #4aa3df; }
[data-group="師弟"] { --rel: #a78bfa; }
[data-group="主従"] { --rel: #c9b458; }
[data-group="敵対"] { --rel: #ff6b6b; }
[data-group="その他"] { --rel: #9d9da4; }
.rel-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--rel, var(--muted)); margin-right: 6px; flex: none; }

.relations .section-head { margin-bottom: 8px; }
.rel-group-title { display: flex; align-items: center; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.rel-group-title:first-child { margin-top: 0; }
.rel-type {
  font-size: 11px; font-weight: 600; margin-left: 8px; padding: 0 7px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); vertical-align: 1px;
}
.row.is-plain { color: var(--text); }

.rc-figure { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; }
.rc-svg { display: block; width: 100%; max-width: 640px; height: auto; margin: 0 auto; }
.rc-svg .rc-edge line { stroke: var(--rel, var(--muted)); stroke-width: 2.5; opacity: .85; }
.rc-svg .rc-edge rect { fill: var(--surface); stroke: var(--rel, var(--muted)); stroke-width: 1.5; }
.rc-svg .rc-edge text { fill: var(--text); font-size: 14px; font-weight: 700; }
.rc-svg .rc-bg { fill: var(--surface-2); }
.rc-svg .rc-ring { fill: none; stroke: var(--border); stroke-width: 2; }
.rc-svg .is-center .rc-ring { stroke: var(--accent); stroke-width: 3; }
.rc-svg .is-plain .rc-ring { stroke-dasharray: 4 3; }
.rc-svg .rc-initial { fill: var(--muted); font-weight: 700; }
.rc-svg .rc-name { fill: var(--text); font-size: 16px; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.rc-svg a:hover .rc-ring, .rc-svg a:focus .rc-ring { stroke: var(--accent); stroke-width: 3; }
.rc-svg a:focus { outline: none; }
.rc-svg a:focus-visible .rc-ring { stroke-width: 4; }
.rc-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 12px; padding: 6px 4px 2px; }
.rc-legend-item { display: inline-flex; align-items: center; }

/* 編集画面：関係性の行 */
.relation-row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) 9em minmax(0, 1.4fr) auto; gap: 8px; align-items: center;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.relation-row .row-icon { width: 34px; height: 34px; }
.relation-name { font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .relation-row { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .relation-row select, .relation-row input { grid-column: 2 / -1; }
}

/* =====================================================================
   段階5：年表・地図
   ===================================================================== */
.world-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.footer-links { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; }

.tl { list-style: none; margin: 0; padding: 0 0 0 4px; position: relative; }
.tl::before { content: ""; position: absolute; left: 7.4em; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { display: grid; grid-template-columns: 7em minmax(0, 1fr); gap: 0 24px; padding: 6px 0; position: relative; }
.tl-item::before {
  content: ""; position: absolute; left: calc(7.4em - 4px); top: 14px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px var(--bg);
}
.tl-when { font-weight: 700; font-size: 13px; text-align: right; color: var(--accent-ink); padding-top: 3px; overflow-wrap: anywhere; line-height: 1.5; }
.tl-body p { margin: 0; line-height: 1.7; }
.tl-source { display: inline-block; font-size: 12px; margin-top: 2px; color: var(--muted); }
.tl-spoiler { margin: 0; }
.tl-spoiler > summary { padding: 6px 10px; }
.tl-spoiler > p { padding: 0 10px 8px; }
@media (max-width: 520px) {
  .tl::before { left: 6px; }
  .tl-item { grid-template-columns: 1fr; padding-left: 22px; }
  .tl-item::before { left: 2px; }
  .tl-when { text-align: left; }
}

.map-fig { margin: 0; }
.map-stage { position: relative; line-height: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.map-stage img { width: 100%; height: auto; display: block; }
.map-pin {
  position: absolute; transform: translate(-50%, -50%); display: block;
  line-height: 1.3; color: #fff; text-decoration: none;
}
.map-pin:hover, .map-pin:focus { z-index: 2; }
.map-pin:hover { text-decoration: none; }
.map-pin-dot {
  width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 3px solid #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .5); flex: none;
}
.map-pin.is-plain .map-pin-dot { background: var(--muted); }
.map-pin-label {
  position: absolute; left: 50%; top: calc(100% + 3px); transform: translateX(-50%);
  padding: 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap;
  background: rgba(0, 0, 0, .65); color: #fff;
}
/* 地名どうしが重なるときは、上・右・左に逃がす（どこも重なるなら、ピンに触れたときだけ出す） */
.map-pin.lab-above .map-pin-label { top: auto; bottom: calc(100% + 3px); }
.map-pin.lab-right .map-pin-label { top: 50%; left: calc(100% + 4px); transform: translateY(-50%); }
.map-pin.lab-left .map-pin-label { top: 50%; left: auto; right: calc(100% + 4px); transform: translateY(-50%); }
.map-pin.lab-hidden .map-pin-label { display: none; }
.map-pin.lab-hidden:hover .map-pin-label, .map-pin.lab-hidden:focus .map-pin-label { display: block; }
.map-pin-dot { display: block; }
.map-pin:focus-visible { outline: none; }
.map-pin:focus-visible .map-pin-dot, a.map-pin:hover .map-pin-dot { transform: scale(1.25); outline: 2px solid var(--accent); outline-offset: 2px; }
.map-fig.hide-labels .map-pin-label { display: none; }
.map-fig.hide-labels .map-pin:hover .map-pin-label, .map-fig.hide-labels .map-pin:focus .map-pin-label { display: block; }
.map-fig figcaption { padding-top: 10px; }
.map-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; min-height: 32px; }
.map-toggle input { accent-color: var(--accent); width: 16px; height: 16px; }
.map-pin-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; }
.map-pin-list li { display: inline-flex; align-items: center; gap: 6px; }
.map-pin-list .map-pin-dot { width: 10px; height: 10px; border-width: 2px; }
.map-pin-list li.is-plain .map-pin-dot { background: var(--muted); }
.map-edit-stage { cursor: crosshair; }
.map-edit-stage .map-pin { pointer-events: none; }
.map-empty { aspect-ratio: auto; height: 120px; }

.map-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.map-card { display: flex; flex-direction: column; overflow: hidden; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.map-card:hover { border-color: var(--accent); text-decoration: none; }
.map-card-img { aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; }
.map-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.map-card-body { padding: 10px 12px; display: flex; justify-content: space-between; gap: 8px; }

/* 編集画面：年表とピンの行 */
.tl-row { display: grid; grid-template-columns: 6em 10em minmax(0, 1fr) auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.tl-sp { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; white-space: nowrap; cursor: pointer; }
.tl-sp input { accent-color: var(--accent); }
.pin-row { display: grid; grid-template-columns: 24px minmax(0, 1.4fr) minmax(0, 1fr) 4.5em 4.5em auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.pin-no { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
@media (max-width: 640px) {
  .tl-row { grid-template-columns: 6em minmax(0, 1fr) auto; }
  .tl-row [data-tl="text"] { grid-column: 1 / 3; }
  .pin-row { grid-template-columns: 24px minmax(0, 1fr) auto; }
  .pin-row [data-pf="label"], .pin-row [data-pf="x"], .pin-row [data-pf="y"] { grid-column: 2; }
}

/* =====================================================================
   段階6：点検
   ===================================================================== */
.check-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.check-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; cursor: pointer; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text);
}
.check-tile:hover { border-color: var(--accent); }
.check-tile-n { font-size: 26px; font-weight: 700; line-height: 1.1; }
.check-tile.is-warn .check-tile-n { color: var(--warn); }
.check-tile.is-ok .check-tile-n { color: var(--accent-ink); }
.check-tile-label { font-size: 12px; color: var(--muted); line-height: 1.4; }
.check-sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; }
.check-sec > summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; }
.check-sec > summary::-webkit-details-marker { display: none; }
.check-sec > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.check-mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.check-mark.is-warn { background: rgba(245, 194, 107, .18); color: var(--warn); }
.check-mark.is-ok { background: var(--accent-soft); color: var(--accent-ink); }
.check-title { font-weight: 700; }
.check-n { margin-left: auto; font-size: 13px; color: var(--muted); }
.check-content { padding: 0 14px 14px; }
.check-sub { font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list > li { padding: 8px 0; border-top: 1px solid var(--border); line-height: 1.6; }
.check-list > li:first-child { border-top: 0; }
.check-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.check-val {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; margin: 2px 2px 2px 0;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 13px;
}
.check-images { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.check-images li { display: grid; gap: 4px; font-size: 11px; }
.check-images img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); }
.check-images code { overflow-wrap: anywhere; background: none; padding: 0; color: var(--muted); }

/* スマホ・タッチ操作：押しやすい大きさ（40px 以上）にする */
@media (pointer: coarse), (max-width: 640px) {
  .btn-small { height: auto; min-height: 40px; padding: 0 14px; }
  .icon-btn { width: 40px; height: 40px; }
  .theme-btn { width: 40px; height: 40px; }
  .tag { padding: 5px 12px; }
  .chip { line-height: 34px; padding: 0 12px; }
  .kind-badge { padding: 4px 12px; }
  .toc button { padding: 7px 0; }
  .nav a { padding: 8px 8px; }
  .social-btn { height: 40px; }
  .gal-nav { width: 40px; height: 40px; }
  .kana-nav button { min-height: 40px; padding: 2px 14px; }
  .tab { min-height: 36px; padding: 4px 16px; }
  .toolbar button { min-height: 38px; padding: 4px 12px; }
  .editor .toolbar .combo input { min-height: 38px; }
  .prof-row, .rel-row, .link-row, .song-row { gap: 6px; }
}

/* 一覧の入口：「＋ 追加」は文字の下に置く（幅がせまくても見出しと重ならないように） */
.kind-tile { display: flex; flex-direction: column; }
.kind-tile-link { flex: 1; }
.kind-tile-add { position: static; align-self: flex-start; margin: -6px 18px 14px; }
.kind-tile-head { flex-wrap: wrap; }

/* トップページ：「最近更新された記事」と「最近見た記事」を横並びに（スマホでは縦、最近更新が上） */
.home-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; align-items: start; }
.home-pair.is-single { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 760px) {
  .home-pair { grid-template-columns: minmax(0, 1fr); }
}

/* 三本線のメニュー */
.menu-wrap { position: relative; flex: none; }
.menu-btn { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; color: var(--text); }
.menu-btn.is-open { border-color: var(--accent); color: var(--accent-ink); }
.site-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 220px;
  display: flex; flex-direction: column; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .4);
}
.site-menu[hidden] { display: none; }
.site-menu a { padding: 10px 14px; border-radius: 6px; color: var(--text); font-size: 15px; }
.site-menu a:hover, .site-menu a:focus-visible { background: var(--surface-2); text-decoration: none; outline: none; }
.site-menu a.is-current { color: var(--accent-ink); font-weight: 700; }
/* 画面がせまいときのトップバー：1段目「ロゴ … 太陽／月・ログイン・☰」、2段目「新規作成・ランダム・お気に入り」、3段目「検索」 */
@media (max-width: 1000px) {
  .header-inner .logo { order: 0; }
  .header-inner .theme-btn { order: 1; margin-left: auto; }
  .header-inner .account { order: 2; }
  .header-inner .menu-wrap { order: 3; }
  .header-inner .nav { order: 4; flex-basis: 100%; margin-left: 0; justify-content: flex-end; flex-wrap: wrap; }
  .header-inner .search { order: 5; flex-basis: 100%; max-width: none; }
}
@media (max-width: 640px) {
  /* スマホでは画面に収まる幅で、押しやすく */
  .site-menu { width: min(300px, calc(100vw - 24px)); }
  .site-menu a { padding: 12px 14px; }
}

/* 関係性：最初は閉じておき、押すと開く */
.rel-details > summary { list-style: none; cursor: pointer; }
.rel-details > summary::-webkit-details-marker { display: none; }
.rel-details > summary .section-title { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.rel-details > summary::after {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 12px; vertical-align: 3px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .2s;
}
.rel-details[open] > summary::after { transform: rotate(45deg); vertical-align: 5px; }
.rel-details > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.rel-details > summary .rel-hint { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.rel-details[open] > summary .rel-hint { display: none; }
.rel-details .rel-tabs { margin: 12px 0 10px; }

/* ライトモードでの細かい調整 */
:root[data-theme="light"] .auth-google { border-color: var(--border); }
:root[data-theme="light"] .site-header { border-bottom-color: var(--border); }


/* =====================================================================
   支援・会員・販売
   ===================================================================== */
.members-badge { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); }
.shop-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 16px; }
.shop-links .hint { flex-basis: 100%; margin: 0; }
.locked-box {
  margin: 16px 0; padding: 20px; border-radius: var(--radius); text-align: center;
  border: 1px dashed var(--accent); background: var(--accent-soft);
}
.locked-title { font-weight: 700; font-size: 16px; margin: 0 0 6px; }
.locked-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0 0; }
.support-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.member-steps { padding-left: 1.4em; display: grid; gap: 10px; margin: 16px 0; }
.member-ok { border-left: 3px solid var(--accent); }
.row-summary.is-expired { color: var(--missing); }
.member-approve, .member-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.member-approve input { width: 160px; }
