/* 草むらBBS - ポップで読みやすい草むらテーマ */
:root {
  --bg: #f6fbe9;
  --card: #ffffff;
  --text: #243024;
  --muted: #6a7b6a;
  --line: #e1ecd2;
  --green: #2f9e44;
  --green-dark: #237a35;
  --link: #1d7a34;
  --green-soft: #e6f6d6;
  --accent: #ffd43b;
  --hilite: #fff7cc;
  --danger: #d6453d;
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121a13;
    --card: #1b261c;
    --text: #e4eee2;
    --muted: #94a794;
    --line: #2c3b2d;
    --green: #4cc261;
    --green-dark: #2f8a40;
    --link: #86d894;
    --green-soft: #213423;
    --accent: #e8bc3a;
    --hilite: #3a3515;
    --danger: #ef7d70;
  }
}
:root[data-theme="dark"] {
    --bg: #121a13;
    --card: #1b261c;
    --text: #e4eee2;
    --muted: #94a794;
    --line: #2c3b2d;
    --green: #4cc261;
    --green-dark: #2f8a40;
    --link: #86d894;
    --green-soft: #213423;
    --accent: #e8bc3a;
    --hilite: #3a3515;
    --danger: #ef7d70;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: 16px; }
:root[data-size="s"] { font-size: 14.5px; }
:root[data-size="l"] { font-size: 18px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.7;
  font-size: 1rem;
}
a { color: var(--link); }
a:hover { opacity: .8; }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 16px; padding-bottom: 40px; min-height: 60vh; }

/* ヘッダー */
.site-header {
  background: linear-gradient(135deg, #2fae48 0%, #7fd04b 100%);
  color: #fff;
  border-bottom: 5px solid var(--accent);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; padding-top: 10px; padding-bottom: 10px; }
.site-title { color: #fff; text-decoration: none; font-size: 1.55rem; font-weight: 800; letter-spacing: .04em; text-shadow: 0 2px 0 rgba(0,0,0,.18); }
.site-title .leaf { display: inline-block; margin-right: 6px; transition: transform .25s; }
.site-title:hover .leaf { transform: rotate(-20deg) scale(1.15); }
.site-nav a { color: #fff; text-decoration: none; margin-left: 14px; font-size: .9rem; font-weight: 700; text-shadow: 0 1px 0 rgba(0,0,0,.15); }
.site-nav a:hover { text-decoration: underline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-header { background: linear-gradient(135deg, #1d5a2a, #3b7d2f); }
}
:root[data-theme="dark"] .site-header { background: linear-gradient(135deg, #1d5a2a, #3b7d2f); }

/* カテゴリバー */
.catbar-wrap { background: var(--card); border-bottom: 1px solid var(--line); }
.catbar { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 9px; padding-bottom: 9px; }
.chip {
  display: inline-block; background: var(--c, #ddd); color: #223022; text-decoration: none;
  border-radius: 999px; padding: 2px 13px; font-size: .82rem; font-weight: 700; line-height: 1.7;
  border: 2px solid transparent; white-space: nowrap; transition: transform .1s;
}
.chip:hover { transform: translateY(-1px); opacity: 1; }
.chip.on { border-color: #223022; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.on { border-color: #fff; } }
:root[data-theme="dark"] .chip.on { border-color: #fff; }
@media (max-width: 640px) {
  .catbar { gap: 5px; padding-top: 7px; padding-bottom: 7px; }
  .chip { padding: 0 10px; font-size: .78rem; }
}

/* カード */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; box-shadow: 0 2px 0 rgba(0,0,0,.04); }
.hero { border-top: 6px solid var(--accent); }
.cat-head { border-top: 6px solid var(--c, var(--green)); }
h1 { font-size: 1.3rem; margin: 0 0 8px; line-height: 1.4; }
h2 { font-size: 1.05rem; margin: 0 0 10px; padding-left: 10px; border-left: 6px solid var(--accent); }
.lead { color: var(--muted); margin: 0 0 12px; }
.crumbs { font-size: .82rem; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }

/* カテゴリカード */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.cat-card {
  display: block; background: var(--card); border: 1px solid var(--line); border-top: 6px solid var(--c, var(--green));
  border-radius: var(--radius); padding: 10px 14px 12px; text-decoration: none; color: var(--text);
  transition: transform .12s, box-shadow .12s;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: 0 6px 14px rgba(0,0,0,.09); opacity: 1; }
.cat-card .name { font-weight: 800; font-size: 1.02rem; }
.cat-card .desc { font-size: .8rem; color: var(--muted); margin: 0 0 4px; }
.cat-card .meta { font-size: .74rem; color: var(--muted); }

/* スレッド一覧 */
.thread-list { list-style: none; margin: 0; padding: 0; }
.thread-list li { border-left: 5px solid var(--c, var(--green)); padding: 6px 8px 6px 12px; margin-bottom: 8px; background: var(--bg); border-radius: 0 10px 10px 0; }
.thread-list li:last-child { margin-bottom: 0; }
.thread-list a.t { font-weight: 700; text-decoration: none; word-break: break-word; color: var(--text); }
.thread-list a.t:hover { text-decoration: underline; color: var(--link); }
.thread-list .meta { font-size: .72rem; color: var(--muted); }
.thread-list .count { display: inline-block; font-size: .72rem; font-weight: 700; background: var(--accent); color: #5b4500; border-radius: 999px; padding: 0 8px; margin-left: 4px; vertical-align: 1px; }
.badge { display: inline-block; font-size: .7rem; background: var(--green-soft); color: var(--link); border-radius: 999px; padding: 0 8px; margin-right: 4px; vertical-align: 1px; font-weight: 700; }
.badge.cat { background: var(--c, var(--green-soft)); color: #223022; }
.badge.warn { background: #ffe9a8; color: #7a5600; }
.empty { color: var(--muted); text-align: center; padding: 18px 0; }

/* スレッド表示(コンパクト) */
.thread-view { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px 14px; margin-bottom: 14px; }
.res { padding: 10px 0; border-bottom: 1px solid var(--line); }
.res:last-child { border-bottom: none; }
.res:target { background: var(--hilite); margin: 0 -14px; padding-left: 14px; padding-right: 14px; }
.res-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; font-size: .8rem; color: var(--muted); line-height: 1.6; }
.res-num { font: inherit; font-weight: 800; color: var(--link); background: none; border: none; padding: 0; cursor: pointer; text-decoration: underline; }
.res-name { color: var(--link); font-weight: 700; }
.res-id { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .74rem; }
.idcount { color: var(--muted); margin-left: 1px; }
.res-tools { margin-left: auto; display: inline-flex; gap: 6px; }
.res-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.mini {
  font: inherit; font-size: .72rem; line-height: 1.6; padding: 1px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); color: var(--muted); cursor: pointer; text-decoration: none;
}
.mini:hover { border-color: var(--link); color: var(--link); opacity: 1; }
.mini.del:hover { border-color: var(--danger); color: var(--danger); }
.res-body { margin-top: 4px; word-break: break-word; overflow-wrap: anywhere; line-height: 1.75; font-size: 1rem; }
.res-body.deleted { color: var(--muted); font-style: italic; }
.res-src { font-size: .72rem; margin-top: 3px; color: var(--muted); }
.res-src a { color: var(--muted); }
.anchor { text-decoration: none; }
/* NGバー */
#ng-bar:empty { display: none; }
.ng-bar { background: var(--green-soft); border-radius: 12px; padding: 6px 12px; margin-bottom: 12px; font-size: .82rem; }
.ng-bar ul { list-style: none; margin: 6px 0 2px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ng-bar li { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 0 4px 0 10px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .76rem; }

/* フォーム */
.post-form label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 12px; }
.post-form label small { font-weight: 400; color: var(--muted); }
.post-form label.chk { display: flex; align-items: center; gap: 8px; font-weight: 400; }
input[type=checkbox] { width: auto; margin: 0; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); font: inherit; margin-top: 4px;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.btn, button.btn {
  display: inline-block; background: var(--green); color: #fff; border: none; border-radius: 999px;
  padding: 10px 28px; font: inherit; font-weight: 800; cursor: pointer; text-decoration: none;
  box-shadow: 0 3px 0 var(--green-dark); transition: transform .08s, box-shadow .08s;
}
.btn:hover { opacity: .92; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--green-dark); }
.btn.sub { background: #7b8a7b; box-shadow: 0 3px 0 #5d6b5d; }
.btn.danger { background: var(--danger); box-shadow: 0 3px 0 #a3332d; }
.btn.small { padding: 3px 14px; font-size: .8rem; font-weight: 700; box-shadow: 0 2px 0 var(--green-dark); }
.btn.small.sub { box-shadow: 0 2px 0 #5d6b5d; }
.btn.small.danger { box-shadow: 0 2px 0 #a3332d; }
.hint { font-size: .78rem; color: var(--muted); margin: 10px 0 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
details.new-thread > summary { cursor: pointer; font-weight: 800; color: var(--link); list-style: none; }
details.new-thread > summary::before { content: "✏️ "; }
details.new-thread[open] > summary { margin-bottom: 12px; }
.search-form { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.search-form input[type=text] { margin-top: 0; flex: 1; }

/* ページ送り */
.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 12px 0; }
.pager a, .pager .cur, .pager .gap { min-width: 36px; text-align: center; padding: 3px 10px; border-radius: 999px; font-size: .9rem; }
.pager a { background: var(--card); border: 1px solid var(--line); text-decoration: none; }
.pager .cur { background: var(--green); color: #fff; font-weight: 800; }
.pager .gap { color: var(--muted); padding: 3px 2px; min-width: 0; }

/* メッセージ */
.notice { background: var(--green-soft); border-radius: 10px; padding: 10px 14px; margin: 10px 0; font-size: .9rem; }
.error { color: var(--danger); font-weight: 700; }
.flash { background: var(--green-soft); border-left: 5px solid var(--green); padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.prose h2 { margin-top: 22px; }
.prose ul { padding-left: 1.3em; }

/* フッター */
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; padding: 18px 0 30px; text-align: center; }
.site-footer a { color: var(--muted); }
.site-footer .copy { margin-bottom: 0; }

/* 管理画面 */
.admin-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.admin-nav a { padding: 5px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); text-decoration: none; font-size: .9rem; }
.admin-nav a.on { background: var(--green); color: #fff; border-color: var(--green); }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; font-size: .85rem; color: var(--muted); }
.stats b { color: var(--text); }
table.admin { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.admin th, table.admin td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
table.admin th { color: var(--muted); font-weight: 600; white-space: nowrap; }
table.admin td.body { word-break: break-word; min-width: 180px; }
table.admin .row-deleted td { opacity: .5; }
form.inline { display: inline; }
form.inline-flex { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
form.inline-flex input[type=text], form.inline-flex input[type=number], form.inline-flex select { width: auto; margin: 0; padding: 5px 8px; }
.scroll-x { overflow-x: auto; }
.ip { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; }

/* 画像・お絵描き */
.res-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.res-img { display: block; line-height: 0; }
.res-img img { max-height: 150px; max-width: 100%; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.82); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 14px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; background: #fff; }

.img-field { margin-bottom: 12px; }
.img-field > label { margin-bottom: 6px; }
.img-field input[type=file] { width: 100%; margin-top: 4px; font: inherit; font-size: .85rem; }
.img-previews { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.img-previews:empty { display: none; }
.pv { position: relative; line-height: 0; }
.pv img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.pv-x { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: none; background: var(--danger); color: #fff; font-size: 14px; line-height: 22px; padding: 0; cursor: pointer; }
.draw-box { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-top: 8px; }
.draw-box > summary { cursor: pointer; font-weight: 800; color: var(--link); }
.draw-box[open] > summary { margin-bottom: 8px; }
.draw-tools { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin-bottom: 8px; }
.draw-colors { display: inline-flex; gap: 5px; flex-wrap: wrap; }
.dc { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line); padding: 0; cursor: pointer; }
.dc:hover { transform: scale(1.12); }
.draw-size { width: auto !important; margin: 0 !important; padding: 3px 8px !important; font-size: .82rem; }
.draw-canvas { display: block; width: 100%; max-width: 480px; height: auto; background: #fff; border: 2px dashed var(--line); border-radius: 10px; touch-action: none; cursor: crosshair; }
.adm-img { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.adm-img img { max-height: 70px; max-width: 120px; border-radius: 6px; border: 1px solid var(--line); }

/* NG(完全に非表示) */
.thread-view:not(.reveal-ng) .res.ng { display: none; }
.thread-view.tree:not(.reveal-ng) .res.ng:not(.ng-leaf) { display: block; }
.thread-view.tree:not(.reveal-ng) .res.ng:not(.ng-leaf) > :not(.res-children) { display: none; }
.thread-view.reveal-ng .res.ng > :not(.res-children) { opacity: .5; }

/* 返信ポップアップ・返信リンク */
.anchor { color: var(--link); cursor: pointer; }
.anchor:hover { text-decoration: underline; }
.res-id { cursor: pointer; }
.res-id:hover { color: var(--link); text-decoration: underline; }
.res-replies { font-size: .76rem; color: var(--muted); margin-top: 4px; }
.pop { position: absolute; background: var(--card); border: 2px solid var(--link); border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.28); max-height: 70vh; overflow: auto; padding: 0 12px 8px; box-sizing: border-box; }
.pop-head { position: sticky; top: 0; background: var(--card); display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: .82rem; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.pop .res { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.pop .res:last-of-type { border-bottom: none; }
.pop-msg { font-size: .82rem; color: var(--muted); padding: 6px 0; }
.pop-jump { display: inline-block; font-size: .78rem; margin-top: 4px; }

/* ツリー表示 */
.res-children { margin: 6px 0 0 10px; padding-left: 10px; border-left: 3px solid var(--green-soft); }
.thread-view.tree .res .res { border-bottom: none; padding: 6px 0 2px; }
.thread-view.tree .res:target { margin: 0; padding: 8px 6px; border-radius: 8px; }
.view-ctl, #view-toggle { margin-left: 8px; }

/* 返信先チップ・使い方 */
.reply-chip { display: flex; gap: 8px; align-items: center; justify-content: space-between; background: var(--hilite); border: 1px solid var(--line); border-radius: 10px; padding: 5px 10px; margin-bottom: 8px; font-size: .82rem; }
.howto { margin-top: 8px; font-size: .84rem; }
.howto summary { cursor: pointer; color: var(--link); font-weight: 700; }
.howto ul { margin: 6px 0 0; padding-left: 1.2em; line-height: 1.7; }
.howto code { background: var(--green-soft); border-radius: 4px; padding: 0 4px; }

/* トップ:新着コメント・カテゴリ一覧・動いているスレッド */
.sub { font-weight: 400; color: var(--muted); font-size: .76rem; }
.newc { list-style: none; margin: 0; padding: 0; }
.newc li { border-left: 5px solid var(--c, var(--green)); padding: 5px 4px 5px 10px; margin-bottom: 6px; background: var(--bg); border-radius: 0 10px 10px 0; }
.newc .ttl { font-weight: 700; text-decoration: none; color: var(--link); word-break: break-word; }
.newc .ex { font-size: .84rem; color: var(--muted); word-break: break-word; }
.when { font-size: .72rem; color: var(--muted); margin-left: 4px; white-space: nowrap; }
.newc .count, .thread-list .count { margin-left: 2px; }
.cat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 22px; }
.cat-tile { display: flex; justify-content: space-between; align-items: center; gap: 6px; background: var(--c, #ddd); color: #223022; text-decoration: none; border-radius: 14px; padding: 9px 12px; font-weight: 800; font-size: .9rem; transition: transform .1s; }
.cat-tile:hover { transform: translateY(-2px); opacity: 1; }
.cat-tile .n { font-size: .72rem; background: rgba(255,255,255,.65); border-radius: 999px; padding: 0 8px; }

/* テーマ切替・管理リンク・♥ */
.theme-btn { background: rgba(255,255,255,.25); border: none; border-radius: 999px; width: 30px; height: 30px; margin-left: 12px; cursor: pointer; font-size: 15px; line-height: 30px; padding: 0; vertical-align: middle; }
.theme-btn:hover { background: rgba(255,255,255,.4); }
.site-nav .admin-link { background: rgba(0,0,0,.22); border-radius: 999px; padding: 1px 10px; }
.like-btn { font: inherit; font-size: .8rem; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 1px 12px; cursor: pointer; }
.like-btn:hover { border-color: #e0567a; color: #e0567a; }
.like-btn.on { border-color: #e0567a; color: #e0567a; background: rgba(224,86,122,.08); }
.like-btn .n:empty { display: none; }
.memo-area { width: 100%; min-height: 320px; font: inherit; line-height: 1.6; }
.adm-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.adm-gallery .g { border: 1px solid var(--line); border-radius: 10px; padding: 6px; font-size: .72rem; background: var(--bg); }
.adm-gallery .g img { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; display: block; margin-bottom: 4px; }

/* スマホでスレッドを読みやすく */
@media (max-width: 640px) {
  .wrap { padding-left: 12px; padding-right: 12px; }
  .thread-view { padding: 2px 10px; }
  .res:target { margin-left: -10px; margin-right: -10px; padding-left: 10px; padding-right: 10px; }
  .res { padding: 12px 0; }
  .mini { padding: 3px 11px; }
  .like-btn { padding: 3px 13px; }
  .res-tools { gap: 5px; }
}

/* 表示設定パネル */
.pref-panel { position: fixed; top: 54px; right: 10px; z-index: 900; width: min(300px, calc(100vw - 20px)); background: var(--card); color: var(--text); border: 2px solid var(--link); border-radius: 14px; box-shadow: 0 8px 28px rgba(0,0,0,.3); padding: 10px 14px 12px; font-size: .86rem; }
.pref-panel h3 { margin: 8px 0 4px; font-size: .82rem; color: var(--muted); }
.pref-panel h3:first-child { margin-top: 0; }
.pref-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pref-opt { font: inherit; font-size: .84rem; padding: 3px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; }
.pref-opt.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.theme-btn.pref { font-size: 12px; font-weight: 800; color: #fff; }

/* 表示スタイル「すっきり」(丸みと色を控えめに) */
:root[data-style="clean"] { --radius: 6px; --accent: #a9bba8; }
:root[data-style="clean"] .site-header { background: var(--green-dark) !important; border-bottom: 1px solid rgba(0,0,0,.25) !important; }
:root[data-style="clean"] .site-title { font-size: 1.25rem; text-shadow: none; letter-spacing: 0; }
:root[data-style="clean"] .site-title .leaf { display: none; }
:root[data-style="clean"] .card { box-shadow: none; }
:root[data-style="clean"] .hero, :root[data-style="clean"] .cat-head { border-top: 1px solid var(--line); }
:root[data-style="clean"] h2 { border-left-width: 3px; }
:root[data-style="clean"] .chip, :root[data-style="clean"] .cat-tile { border-radius: 6px; font-weight: 600; }
:root[data-style="clean"] .thread-list li, :root[data-style="clean"] .newc li { background: transparent; border-radius: 0; border-left-width: 3px; border-bottom: 1px solid var(--line); margin-bottom: 0; padding-top: 8px; padding-bottom: 8px; }
:root[data-style="clean"] .btn, :root[data-style="clean"] button.btn { border-radius: 6px; box-shadow: none; }
:root[data-style="clean"] input[type=text], :root[data-style="clean"] input[type=email], :root[data-style="clean"] input[type=password], :root[data-style="clean"] input[type=number], :root[data-style="clean"] textarea, :root[data-style="clean"] select { border-radius: 6px; }
:root[data-style="clean"] .thread-list .count, :root[data-style="clean"] .newc .count { background: var(--green-soft); color: var(--link); border-radius: 4px; }
@media (max-width: 640px) {
  .site-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 0; }
  .site-nav a { margin-left: 0; margin-right: 12px; font-size: .84rem; }
  .theme-btn { margin-left: 0; margin-right: 6px; width: 28px; height: 28px; line-height: 28px; }
  .pref-panel { top: 96px; }
}

/* 運営サイトへのリンク */
.partner-bar { display: block; background: #1f2d22; color: #e9f5e4; text-align: center; font-size: .78rem; padding: 4px 10px; text-decoration: none; line-height: 1.6; }
.partner-bar b { color: #ffe066; }
.partner-bar:hover { background: #2a3d2e; opacity: 1; }
.partner-card { display: flex; align-items: center; gap: 12px; background: var(--card); border: 2px solid var(--accent); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 18px; text-decoration: none; color: var(--text); }
.partner-card:hover { border-color: var(--link); opacity: 1; }
.pc-ico { font-size: 1.6rem; }
.pc-body { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.4; }
.pc-sub { font-size: .74rem; color: var(--muted); }
.pc-name { font-weight: 800; font-size: 1.05rem; }
.pc-go { font-size: .82rem; font-weight: 700; color: var(--link); white-space: nowrap; }
.prose p, .prose li { line-height: 1.85; }
.trash-img { height: 60px; display: flex; align-items: center; justify-content: center; font-size: .9rem; color: var(--muted); background: var(--card); border-radius: 6px; margin-bottom: 4px; }
.adm-gallery .g form { display: inline-block; margin-top: 3px; }

/* ヘッダーの草むら(オリジナルのイラスト) */
.site-header { position: relative; overflow: hidden; }
.site-header .wrap { padding-bottom: 22px; position: relative; z-index: 1; }
.site-header::after {
  content: ""; position: absolute; left: -12px; right: -12px; bottom: 0; height: 26px;
  background: url("header-soft.svg") repeat-x left bottom / 240px 26px; pointer-events: none;
  animation: kb-sway 5s ease-in-out infinite;
}
@keyframes kb-sway { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-9px); } }
@media (prefers-reduced-motion: reduce) { .site-header::after { animation: none; } }
:root[data-style="clean"] .site-header::after { display: none; }
:root[data-style="clean"] .site-header .wrap { padding-bottom: 10px; }
.thread-list .ex { font-size: .84rem; color: var(--muted); word-break: break-word; margin-top: 2px; }
.thread-list .ex mark { background: var(--hilite); color: var(--text); border-radius: 3px; padding: 0 1px; }
.search-form select { width: auto; margin-top: 0; }
.search-form select { flex: 0 0 auto; width: auto; max-width: 42%; padding: 10px 8px; }
.search-form input[type=text] { min-width: 0; }

/* カテゴリ(どのページでも同じ大きさのタイル。トップ以外は折りたたみ) */
.catgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px 0 10px; }
@media (min-width: 641px) { .catgrid { grid-template-columns: repeat(5, 1fr); } }
.ctile { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 36px; padding: 3px 4px; border-radius: 12px; background: var(--c, #ddd); color: #223022; text-decoration: none; font-size: .78rem; font-weight: 800; line-height: 1.25; border: 2px solid transparent; transition: transform .1s; }
.ctile:hover { transform: translateY(-1px); opacity: 1; }
.ctile.on { border-color: #223022; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ctile.on { border-color: #fff; } }
:root[data-theme="dark"] .ctile.on { border-color: #fff; }
:root[data-style="clean"] .ctile { border-radius: 6px; font-weight: 600; }
.catnav > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 7px 0; font-size: .9rem; }
.catnav > summary::-webkit-details-marker { display: none; }
.cn-open { margin-left: auto; font-size: .76rem; color: var(--muted); }
.catnav[open] .cn-open { color: var(--link); }

/* 下部のボタン */
.bottom-nav { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
.bn { flex: 1 1 140px; text-align: center; text-decoration: none; background: var(--c, var(--green-soft)); color: #223022; border-radius: 12px; padding: 9px 12px; font-weight: 800; font-size: .88rem; }
.bn:hover { opacity: .85; }

/* 右下の ▲▼ ボタン */
.fab { position: fixed; right: 12px; bottom: 18px; z-index: 800; display: flex; flex-direction: column; gap: 8px; }
.fab button { width: 44px; height: 44px; border-radius: 50%; border: none; background: rgba(35,122,53,.88); color: #fff; font-size: 16px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.28); padding: 0; line-height: 44px; }
.fab button:hover { background: var(--green-dark); }
.fab button[hidden] { display: none; }

/* ヘッダーの飾り(表示設定で切り替え) */
:root[data-hdr="hill"] .site-header::after { background-image: url("header-hill.svg"); }
:root[data-hdr="clover"] .site-header::after { background-image: url("header-clover.svg"); }
:root[data-hdr="none"] .site-header::after { display: none; }
:root[data-hdr="none"] .site-header .wrap { padding-bottom: 10px; }

/* 文字:本文はふつうのゴシック、見出しやボタンだけ丸ゴシック */
body { font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif; }
h1, h2, .site-title, .btn, .ctile, .bn, .badge, .partner-bar, .count, .mini, .pref-opt { font-family: "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif; }

/* スレッド内の見やすさ(第2弾) */
.res-num { text-decoration: none; background: var(--green-soft); border-radius: 6px; padding: 0 8px; min-width: 1.9em; text-align: center; font-size: .82rem; line-height: 1.6; }
.res-name { color: var(--text); }
.res-date, .res-id { font-size: .74rem; color: var(--muted); }
.res-body { color: var(--text); letter-spacing: .01em; line-height: 1.8; }
.res-body .anchor { text-decoration: underline dotted; text-underline-offset: 3px; }
.res-replies { margin-top: 6px; }
.res + .res { border-top: none; }
@media (max-width: 640px) {
  .res-head { font-size: .78rem; gap: 0 8px; }
  .res-body { font-size: 1.02rem; }
}
@media (max-width: 640px) { .ctile { font-size: .74rem; } }

/* スレッドの操作ボタン・通知・新着バッジ */
.thread-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.thread-tools .mini { font-size: .78rem; padding: 3px 12px; }
.mini.on { border-color: #e0a800; color: #a67c00; background: rgba(255,212,59,.18); font-weight: 700; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 82px; z-index: 950; background: rgba(30,40,32,.94); color: #fff; padding: 8px 16px; border-radius: 999px; font-size: .86rem; box-shadow: 0 4px 14px rgba(0,0,0,.3); max-width: calc(100vw - 32px); text-align: center; }
.toast a { color: #ffe066; font-weight: 700; }
.new-badge { display: inline-block; font-size: .7rem; font-weight: 800; background: #e0567a; color: #fff; border-radius: 999px; padding: 0 8px; margin-left: 4px; vertical-align: 1px; }

/* レスの一番下の更新ボタン */
.bottom-tools { justify-content: center; margin: 12px 0; }
.bottom-tools .mini { font-size: .85rem; padding: 6px 16px; }

/* お知らせ */
.notice-box { background: #fffbe6; border: 1px solid #f0dd8a; font-size: .92rem; }
.card .notice-box { margin: 8px 0; padding: 8px 12px; border-radius: 10px; }
:root[data-theme="dark"] .notice-box { background: #3a3520; border-color: #6b5f2a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .notice-box { background: #3a3520; border-color: #6b5f2a; } }
.notice-box p { margin: .3em 0; }

/* ---- スレッド一覧の画像アイコン ---- */
.thread-list li.has-ico, .newc li.has-ico { display: flex; align-items: center; gap: 10px; }
.li-main { flex: 1; min-width: 0; }
.t-ico { flex: none; width: 46px; height: 46px; border-radius: 10px; overflow: hidden; background: var(--card); border: 1px solid var(--line); display: block; }
.t-ico img { width: 100%; height: 100%; object-fit: cover; display: block; }
.t-ico.def img { object-fit: contain; padding: 6px; opacity: .9; }
@media (max-width: 520px) { .t-ico { width: 40px; height: 40px; } }

/* ---- スレッドの見分けやすさ ---- */
.thread-head { border-top: 6px solid var(--c, var(--green)); }
.thread-head h1 { margin-bottom: 4px; }
.res-label { margin: 14px 4px 6px; font-weight: 800; font-size: .9rem; color: var(--link); display: flex; align-items: center; gap: 8px; }
.res-label::after { content: ""; flex: 1; height: 2px; background: var(--line); border-radius: 2px; }
.thread-view:not(.tree) { background: transparent; border: none; padding: 0; }
.thread-view:not(.tree) > .res { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--c, var(--green)); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.thread-view:not(.tree) > .res:last-child { border-bottom: 1px solid var(--line); }
.thread-view:not(.tree) > .res:target { margin: 0 0 8px; padding: 10px 12px; background: var(--hilite); }
.res-head .like-btn { padding: 0 10px; font-size: .74rem; line-height: 1.6; align-self: center; }
.res-actions { justify-content: flex-end; margin-top: 2px; }
@media (max-width: 520px) {
  .thread-view:not(.tree) > .res { padding: 9px 10px; }
  .thread-view:not(.tree) > .res:target { margin: 0 0 8px; padding: 9px 10px; }
  .res-head .like-btn { padding: 1px 10px; }
}
@media (max-width: 520px) {
  .res-head .res-name { flex: 1 1 calc(100% - 52px); min-width: 0; }   /* 1行目: 番号+名前 / 2行目: 日時+ID+♡ */
}

/* ---- 全体お知らせ(ヘッダーの下) ---- */
.gnotice { background: #fffbe6; border-bottom: 1px solid #f0dd8a; font-size: .9rem; }
.gnotice .wrap { display: flex; align-items: flex-start; gap: 10px; padding-top: 8px; padding-bottom: 8px; }
.gn-body { flex: 1; min-width: 0; }
.gn-body p { margin: .2em 0; }
.gn-body ul { margin: .2em 0; padding-left: 1.3em; }
.gn-body h2, .gn-body h3 { font-size: .95rem; margin: .2em 0; border: none; padding: 0; }
.gn-x { flex: none; background: none; border: none; font-size: 1.3rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
:root[data-theme="dark"] .gnotice { background: #3a3520; border-color: #6b5f2a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gnotice { background: #3a3520; border-color: #6b5f2a; } }

/* ---- スレッドのタイトル横の画像 ---- */
.th-row { display: flex; align-items: center; gap: 14px; }
.th-main { flex: 1; min-width: 0; }
.th-ico { flex: none; width: 84px; height: 84px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--card); display: block; }
.th-ico img { width: 100%; height: 100%; object-fit: cover; display: block; }
.th-ico.def img { object-fit: contain; padding: 10px; opacity: .9; }
@media (max-width: 520px) { .th-ico { width: 64px; height: 64px; border-radius: 12px; } .th-row { gap: 10px; } }
