/* よろず掲示板 — サイト側スタイル
   温かいオフホワイト背景＋濃インク＋くすんだティール緑のアクセント。
   メタ情報（レス番号・ID・日付）は等幅で、テキストボードらしい情報密度を保つ。 */

:root {
  --bg: #f6f4ef;
  --surface: #fffefb;
  --surface-soft: #faf8f3;
  --ink: #24262b;
  --ink-soft: #585c64;
  --ink-faint: #8a8e96;
  --line: #e4e0d5;
  --line-strong: #d2cdbf;
  --accent: #2e6e5e;
  --accent-strong: #235445;
  --accent-soft: #e7efec;
  --amber: #a97b2f;
  --amber-soft: #f5ecdc;
  --danger: #a4432f;
  --danger-soft: #f7e8e4;
  --name-green: #35714b;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
  --sans: system-ui, "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
}

a { color: var(--accent); }
a:hover { color: var(--accent-strong); }

.mono { font-family: var(--mono); font-size: 0.86em; }

.container { max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* ---------- ヘッダー ---------- */

.site-header {
  background: var(--ink);
  color: #f2f0ea;
  border-bottom: 3px solid var(--accent);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.brand { text-decoration: none; white-space: nowrap; }
.brand-mark {
  font-size: 22px;
  font-weight: 700;
  color: #f2f0ea;
  letter-spacing: 0.06em;
}
.brand-sub {
  margin-left: 4px;
  font-size: 13px;
  color: #b9c5c0;
  letter-spacing: 0.24em;
}
.header-search { display: flex; gap: 0; }
.header-search input {
  width: 240px;
  max-width: 48vw;
  padding: 6px 10px;
  border: 1px solid #4a4e56;
  border-right: none;
  border-radius: 4px 0 0 4px;
  background: #33363d;
  color: #f2f0ea;
  font-size: 13px;
}
.header-search input::placeholder { color: #8a8e96; }
.header-search button {
  padding: 6px 14px;
  border: none;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.header-search button:hover { background: var(--accent-strong); }

/* ---------- フラッシュ ---------- */

.flash {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 4px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  font-size: 14px;
}
.flash-error { border-left-color: var(--danger); background: var(--danger-soft); }

/* ---------- トップ（板一覧） ---------- */

main.container { padding-top: 20px; padding-bottom: 48px; }

.hero { padding: 18px 0 6px; }
.hero h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: 0.04em; }
.hero-tagline { margin: 0; color: var(--ink-soft); }
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-soft);
  font-size: 13px;
}
.hero-stats strong { color: var(--accent); font-size: 16px; }

.section-title {
  margin: 30px 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--line-strong);
  font-size: 17px;
}

.hot-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: hot;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.hot-list li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  counter-increment: hot;
}
.hot-list li:first-child { border-top: none; }
.hot-list li::before {
  content: counter(hot);
  min-width: 1.4em;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 13px;
  text-align: right;
}
.hot-board {
  flex-shrink: 0;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}
.hot-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.hot-title:hover { color: var(--accent); }
.hot-meta { margin-left: auto; flex-shrink: 0; color: var(--amber); font-size: 12px; }

.category-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.category-jump a {
  padding: 6px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}
.category-jump a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.board-category { margin-bottom: 20px; scroll-margin-top: 16px; }
.category-name {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 14px;
  letter-spacing: 0.12em;
}
.board-rows {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
}
.board-row {
  display: grid;
  grid-template-columns: 170px 1fr auto;
  gap: 2px 18px;
  align-items: baseline;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  text-decoration: none;
}
.board-rows .board-row:first-child { border-top: none; }
.board-row:hover { background: var(--surface-soft); }
.board-row-name { color: var(--ink); font-size: 15px; font-weight: 700; }
.board-row:hover .board-row-name { color: var(--accent-strong); text-decoration: underline; }
.board-row-desc {
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.6;
}
.board-row-meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
  color: var(--ink-faint);
  font-size: 12px;
  white-space: nowrap;
}
.board-row-threads { min-width: 48px; text-align: right; }
.badge-today {
  min-width: 64px;
  padding: 0 6px;
  border-radius: 3px;
  background: var(--amber-soft);
  color: var(--amber);
  font-style: normal;
  text-align: center;
}
.badge-today-empty { background: none; }
.board-row-last { min-width: 60px; text-align: right; }

/* ---------- パンくず・板ヘッダー ---------- */

.breadcrumb {
  margin: 2px 0 14px;
  color: var(--ink-faint);
  font-size: 12.5px;
}
.breadcrumb a { color: var(--ink-soft); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }

.board-header {
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: var(--surface);
}
.board-header h1 { margin: 0 0 4px; font-size: 22px; }
.board-header-desc { margin: 0; color: var(--ink-soft); font-size: 13.5px; }
.board-header-note {
  margin: 8px 0 0;
  color: var(--ink-faint);
  font-size: 12px;
}
.board-header-note code {
  padding: 0 4px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* ---------- 新規スレッド ---------- */

.new-thread {
  margin: 14px 0;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: var(--surface-soft);
}
.new-thread summary {
  padding: 10px 16px;
  color: var(--accent-strong);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.new-thread[open] summary { border-bottom: 1px solid var(--line); }
.new-thread .post-form { padding: 14px 16px; }

/* ---------- スレッド一覧 ---------- */

.list-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0 8px;
}
.sort-tabs { display: flex; gap: 4px; }
.sort-tab {
  padding: 4px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  text-decoration: none;
}
.sort-tab:hover { border-color: var(--accent); color: var(--accent-strong); }
.sort-tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.list-count { color: var(--ink-faint); font-size: 12.5px; }

.thread-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: thread;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
}
.thread-list li { counter-increment: thread; }
.thread-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
}
.thread-list li:first-child { border-top: none; }
.thread-row:hover { background: var(--surface-soft); }
.thread-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1 1 420px;
}
.thread-main::before {
  content: counter(thread) ":";
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 12.5px;
}
.thread-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.thread-title:hover { color: var(--accent); text-decoration: underline; }
.thread-res { color: var(--accent); font-weight: 600; font-size: 13px; }
.thread-sub {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-left: auto;
  color: var(--ink-faint);
  font-size: 12px;
  white-space: nowrap;
}
.thread-momentum { color: var(--amber); }
.thread-views a { color: var(--ink-faint); text-decoration: none; }
.thread-views a:hover { color: var(--accent); text-decoration: underline; }
.thread-closed .thread-title { color: var(--ink-faint); }

.badge {
  padding: 0 7px;
  border-radius: 3px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-full { background: var(--amber-soft); color: var(--amber); }
.badge-stopped { background: var(--danger-soft); color: var(--danger); }

.pager { display: flex; gap: 6px; justify-content: center; margin: 18px 0; }
.pager-item {
  min-width: 34px;
  padding: 4px 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink-soft);
  text-align: center;
  text-decoration: none;
}
.pager-item:hover { border-color: var(--accent); color: var(--accent); }
.pager-item.active { border-color: var(--accent); background: var(--accent); color: #fff; }

.empty-state {
  padding: 36px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--ink-faint);
  text-align: center;
}

/* ---------- スレッド表示 ---------- */

.thread-header {
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: var(--surface);
}
.thread-page-title { margin: 0 0 4px; font-size: 20px; line-height: 1.4; }
.thread-page-meta { margin: 0; color: var(--ink-soft); font-size: 12.5px; }
.thread-views { margin-top: 8px; font-size: 12.5px; display: flex; gap: 14px; flex-wrap: wrap; }
.view-tab { color: var(--accent); text-decoration: none; }
.view-tab:hover { text-decoration: underline; }
.view-tab.active { color: var(--ink); font-weight: 700; }
.filter-note { color: var(--amber); font-weight: 600; }

.posts { margin-top: 14px; }
.post {
  padding: 10px 16px 12px;
  border: 1px solid var(--line);
  border-top: none;
  background: var(--surface);
}
.post:first-child {
  border-top: 1px solid var(--line);
  border-radius: 6px 6px 0 0;
}
.post:last-child { border-radius: 0 0 6px 6px; }
.post:only-child { border-radius: 6px; }
.post:target { background: #f2efe4; }
.post.post-highlight { animation: post-flash 1.2s ease; }
@keyframes post-flash {
  0% { background: var(--amber-soft); }
  100% { background: var(--surface); }
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  color: var(--ink-faint);
  font-size: 12.5px;
}
.post-no {
  padding: 0;
  border: none;
  background: none;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.post-no:hover { color: var(--accent); text-decoration: underline; }
.post-name { color: var(--name-green); font-weight: 700; font-family: var(--sans); font-size: 13px; }
.post-name-abon { color: var(--ink-faint); font-weight: 700; }
.sage-chip {
  padding: 0 6px;
  border-radius: 3px;
  background: #ececec;
  color: #7a7e86;
  font-size: 11px;
}
.post-date { white-space: nowrap; }
.post-id { color: var(--ink-faint); text-decoration: none; white-space: nowrap; }
.post-id:hover { color: var(--accent); text-decoration: underline; }
.post-id.active { color: var(--amber); font-weight: 700; }
.post-refs { color: var(--ink-faint); }
.post-refs .res-anchor { font-size: 12px; }

.post-body {
  margin-top: 4px;
  overflow-wrap: break-word;
  word-break: break-word;
  font-size: 15px;
}
.post-deleted .post-body { color: var(--ink-faint); }

.res-anchor { color: var(--accent); text-decoration: none; }
.res-anchor:hover { text-decoration: underline; }
.ext-link { word-break: break-all; }

.post-gap {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-top: none;
  background: var(--surface-soft);
  color: var(--ink-faint);
  font-size: 12.5px;
  text-align: center;
}

/* アンカーホバーのポップアップ（JSが生成） */
.anchor-popup {
  position: absolute;
  z-index: 50;
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 6px 20px rgba(36, 38, 43, 0.18);
  font-size: 13.5px;
}
.anchor-popup .post-meta { font-size: 12px; }
.anchor-popup .post-body { font-size: 13.5px; max-height: 220px; overflow: hidden; }

.thread-closed-notice {
  margin: 18px 0;
  padding: 16px 20px;
  border: 1px solid var(--amber);
  border-radius: 6px;
  background: var(--amber-soft);
  color: var(--ink);
  font-size: 14px;
}
.thread-closed-notice p { margin: 0 0 4px; }

/* ---------- フォーム ---------- */

.reply-section { margin-top: 26px; }
.remaining { margin-left: 10px; color: var(--ink-faint); font-weight: 400; font-size: 12px; }

.post-form {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.form-row { margin-bottom: 12px; }
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.post-form label {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
}
.req {
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 3px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 11px;
}
.post-form input[type="text"],
.post-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
}
.post-form input:focus,
.post-form textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}
.post-form textarea { resize: vertical; line-height: 1.7; }

/* ハニーポット：botには見えるが人間には見えない */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-actions { display: flex; align-items: center; gap: 14px; }
.btn-primary {
  padding: 8px 26px;
  border: none;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-strong); }
.form-hint { color: var(--ink-faint); font-size: 12px; }

/* ---------- 検索 ---------- */

.search-page h1 { margin: 0 0 12px; font-size: 22px; }
.search-form { display: flex; gap: 8px; flex-wrap: wrap; }
.search-form input[type="search"] {
  flex: 1 1 260px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 14px;
}
.search-form select {
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  font-size: 14px;
}
.search-thread-list, .search-post-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
}
.search-thread-list li, .search-post-list li {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}
.search-thread-list li:first-child, .search-post-list li:first-child { border-top: none; }
.search-thread-list li { display: flex; align-items: baseline; gap: 10px; }
.search-thread-title {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-thread-title:hover { color: var(--accent); }
.search-meta { color: var(--ink-faint); font-size: 12px; margin-left: auto; white-space: nowrap; }
.search-post-head { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.search-snippet { margin: 4px 0 0; color: var(--ink-soft); font-size: 13px; }
.search-snippet mark { background: var(--amber-soft); color: var(--amber); font-weight: 700; }

/* ---------- 404等 ---------- */

.notice-page { padding: 40px 0; text-align: center; }
.notice-page h1 { font-size: 26px; }

/* ---------- フッター ---------- */

.site-footer {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.footer-inner { padding: 20px 16px; }
.footer-brand { margin: 0 0 4px; font-weight: 700; }
.footer-note { margin: 0; color: var(--ink-faint); font-size: 12.5px; }
.footer-note a { color: var(--ink-faint); }

/* ---------- レスポンシブ ---------- */

@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .header-inner { flex-wrap: wrap; gap: 8px; }
  .header-search { width: 100%; }
  .header-search input { width: 100%; max-width: none; flex: 1; }
  .hero h1 { font-size: 22px; }
  .board-row { grid-template-columns: 1fr; }
  .board-row-threads, .board-row-last { min-width: 0; text-align: left; }
  .badge-today { min-width: 0; }
  .badge-today-empty { display: none; }
  .thread-sub { margin-left: 1.6em; width: 100%; }
  .thread-views { display: none; }
  .thread-sub .thread-views { display: flex; gap: 8px; }
  .form-row-2 { grid-template-columns: 1fr; }
  .post { padding: 9px 12px 10px; }
  .hot-meta { display: none; }
  .search-meta { display: none; }
}
