:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --panel-2: #eef1f5;
  --border: #dde1e8;
  --text: #1a1d24;
  --muted: #6b7280;
  --accent: #e63e63;
  --accent-2: #d97706;
  --ok: #16a34a;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--accent-2); }

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

header.site {
  text-align: center;
  padding: 24px 12px 8px;
}
header.site h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.02em;
}
header.site h1 .accent { color: var(--accent); }
header.site p.tagline {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 16px 0;
}
.toolbar .name-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 260px;
}
.toolbar input[type="text"] {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 15px;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: -4px 0 16px;
}
.action-bar .cover-status { margin: 0; }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 14px;
  transition: filter .15s ease;
}
button:hover { filter: brightness(1.15); }
button.primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  font-weight: 700;
}
button.primary:hover { filter: brightness(1.05); }
button.ok {
  background: var(--ok);
  border: 1px solid var(--ok);
  color: #fff;
  font-weight: 700;
}
button.ok:hover { filter: brightness(1.05); }
button:disabled { opacity: .5; cursor: not-allowed; }

.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}

.publish-bar { display: flex; justify-content: center; margin-top: 24px; }
.publish-bar button.primary { padding: 12px 48px; font-size: 16px; }
/* At exactly TARGET the merged counter/CTA turns green and pulses so it's obvious you can publish. */
.publish-bar button.primary.exact {
  background: var(--ok);
  border-color: var(--ok);
  box-shadow: 0 0 0 0 var(--ok);
  animation: publishReady 1.6s ease-out 2;
}
@keyframes publishReady {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); }
  100% { box-shadow: 0 0 0 12px rgba(22, 163, 74, 0); }
}

/* Unsaved-changes indicator vs the published (公開) state, shown only while editing. */
.diff-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 8px 14px;
  border: 1px solid var(--warn, #d97706);
  border-radius: 8px;
  background: rgba(217, 119, 6, .08);
}
.diff-bar .diff-count { color: var(--warn, #b45309); font-size: 14px; font-weight: 600; }
.diff-bar button.ghost {
  background: transparent;
  border: 1px solid var(--muted);
  color: var(--muted);
  padding: 6px 16px;
  font-size: 13px;
}
.diff-bar button.ghost:hover { background: rgba(107, 114, 128, .12); filter: none; }

.clear-bar { display: flex; justify-content: center; margin-top: 32px; }
button.danger {
  background: transparent;
  border: 1px solid var(--danger, #c0455e);
  color: var(--danger, #e0607a);
}
button.danger:hover { background: rgba(192, 69, 94, .15); filter: none; }

/* ── 管理画面 (admin.html) ─────────────────────────────────────────── */
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.admin-nav a {
  padding: 6px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}
.admin-nav a:hover { background: var(--panel-2); }
.admin-nav a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.admin-page[hidden] { display: none; }
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}
.pager .pager-info { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
@media (max-width: 640px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
}
.stat-card .n { font-size: 24px; font-weight: 700; }
.stat-card .k { font-size: 12px; color: var(--muted); margin-top: 2px; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.admin-table th, .admin-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  white-space: nowrap;
}
.admin-table th { background: var(--panel-2); color: var(--muted); font-weight: 600; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table td.owner { white-space: normal; word-break: break-word; }
.admin-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table a.slug { font-family: ui-monospace, Menlo, monospace; }
.admin-table td.warn { color: var(--accent); }
.admin-table td.num.hot { color: #fff; background: var(--accent); font-weight: 700; }
.admin-table td.muted { color: var(--muted); }
.admin-empty { text-align: center; color: var(--muted); padding: 32px; }
.admin-table td.report-text { white-space: normal; word-break: break-word; max-width: 260px; }
.admin-table td.report-text .report-cover {
  display: block;
  max-width: 72px;
  max-height: 100px;
  width: auto;
  height: auto;
  border-radius: 4px;
  background: var(--panel-2);
}
.admin-table td.report-actions { white-space: nowrap; }
.admin-table td.report-actions button,
.admin-table td.report-actions a { margin-left: 6px; }
.admin-table td.report-actions button:first-child,
.admin-table td.report-actions a:first-child { margin-left: 0; }
.admin-table td.report-actions a { font-size: 13px; white-space: nowrap; }
.admin-table a.detail { cursor: pointer; }
.corr-thumb { width: 40px; height: 56px; object-fit: contain; background: var(--panel-2); border-radius: 4px; display: block; }
.corr-noimg { width: 40px; height: 56px; display: flex; align-items: center; justify-content: center; background: var(--panel-2); border-radius: 4px; color: var(--muted); font-size: 10px; }
.corr-thumb.zoomable { cursor: zoom-in; }

/* 表紙の拡大表示オーバーレイ */
.cover-zoom {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.8);
  cursor: zoom-out;
}
.cover-zoom[hidden] { display: none; }
.cover-zoom img {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

/* リスト詳細モーダル */
.detail-modal { max-width: 880px; width: 92vw; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  max-height: 60vh;
  overflow: auto;
  margin: 12px 0;
}
.detail-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  font-size: 12px;
}
.detail-item .di-cover { width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: var(--panel-2); display: block; }
.detail-item .di-noimg { width: 100%; aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center; background: var(--panel-2); color: var(--muted); font-size: 11px; }
.detail-item .di-body { padding: 6px 8px; }
.detail-item .di-pos { color: var(--muted); }
.detail-item .di-title { font-weight: 600; line-height: 1.3; max-height: 2.6em; overflow: hidden; }
.detail-item .di-author { color: var(--muted); max-height: 2.4em; overflow: hidden; }
.detail-item .di-flags { margin-top: 4px; color: var(--accent); font-size: 11px; }

/* 表紙キャッシュ操作 */
.cover-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.cover-single { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.cover-single input[type="text"] {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  width: 200px;
}

/* 控えめな通報リンク（公開ビュー） */
.report-link {
  background: none;
  border: none;
  padding: 2px 4px;
  color: var(--muted);
  font-size: 12px;
  opacity: .6;
  transition: opacity .15s ease, color .15s ease;
}
.report-link:hover { opacity: 1; color: var(--accent); filter: none; }
.report-link:disabled { opacity: .5; color: var(--muted); }
.dinfo .report-link { display: block; margin-top: 10px; text-align: left; }
/* 巻ピッカー内の「間違っています」通報。行の右端に旗アイコンだけを置き、ホバー
   （デスクトップ）または .revealed 付与（タッチ端末の初回タップ）で文言を展開する。 */
.report-flag {
  flex: none;
  align-self: center;
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  padding: 4px 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  opacity: .45;
  cursor: pointer;
  transition: opacity .15s ease, color .15s ease;
}
.report-flag .flag-icon { font-size: 16px; }
.report-flag .flag-text {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  transition: max-width .2s ease, opacity .15s ease, margin-left .2s ease;
}
.report-flag:hover,
.report-flag.revealed { opacity: 1; color: var(--accent); }
.report-flag:hover .flag-text,
.report-flag.revealed .flag-text {
  max-width: 120px;
  opacity: 1;
  margin-left: 4px;
}
.report-flag:disabled { opacity: .4; cursor: default; }

/* シリーズ名の通報はヘッダ（巻一覧の見出し行）に置くので、行内の巻通報と違って文言を常に
   見せる（展開アニメ無し）。通報済みは薄く固定して二度押しさせない。 */
.name-report-flag { opacity: .7; vertical-align: middle; }
.name-report-flag .flag-text { max-width: none; opacity: 1; margin-left: 4px; }
.name-report-flag.reported { opacity: .45; color: var(--muted); cursor: default; }

/* 「間違っています」で非表示にした巻を本人が戻す導線。折りたたみ（<details>）で普段は邪魔せず、
   開くと巻ごとに「戻す」を出す。 */
.hidden-restore {
  margin: 8px 0 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  font-size: 13px;
}
.hidden-restore > summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 12px;
  color: var(--muted);
  user-select: none;
}
.hidden-restore > summary::-webkit-details-marker { display: none; }
.hidden-restore > summary::before { content: "▸ "; }
.hidden-restore[open] > summary::before { content: "▾ "; }
.hidden-restore > summary:hover { color: var(--accent); }
.hidden-list {
  padding: 4px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hidden-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.hidden-label { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden-row .linkbtn { flex: none; }

/* 詳細ダイアログ右上の通報メニュー。旗アイコン1つ（.report-toggle）をタップ/ホバー
   で開き、対象（表紙・コメント）ごとの項目を .report-pop に出す。 */
#detailModal .modal { position: relative; }
#detailModal h2 { padding-right: 40px; }
.report-menu { position: absolute; top: 14px; right: 14px; z-index: 2; }
.report-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 9px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: .7;
  transition: opacity .15s ease, color .15s ease, border-color .15s ease;
}
.report-toggle:hover,
.report-toggle[aria-expanded="true"] { opacity: 1; color: var(--accent); border-color: var(--accent); }
.report-pop {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 150px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.report-pop[hidden] { display: none; }
.report-item {
  background: none;
  border: none;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}
.report-item:hover { background: var(--panel-2); color: var(--accent); }

.mylists {
  margin-top: 40px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.mylists-title { margin: 0 0 4px; font-size: 16px; }
.mylists-note { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.mylists-list { list-style: none; margin: 0; padding: 0; }
.mylists-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.ml-view { flex: 1 1 auto; color: var(--text); text-decoration: none; font-weight: 600; }
.ml-view:hover { color: var(--accent); }
.ml-edit {
  flex: 0 0 auto;
  padding: 6px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}
.ml-edit:hover { background: var(--accent); color: #fff; }
.ml-del {
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}
.ml-del:hover { color: var(--danger, #c0455e); }

.slot {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-align: left;
  padding: 0;
}
.slot .num {
  position: absolute;
  top: 6px; left: 6px;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 12px;
  padding: 1px 7px;
  border-radius: 20px;
  z-index: 2;
}
.slot.over-limit {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.slot.over-limit .num { background: var(--accent); }
.slot.empty {
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border-style: dashed;
}
.slot.empty .plus { font-size: 28px; line-height: 1; }
.slot.empty .label { font-size: 12px; margin-top: 4px; }

.slot .cover {
  width: 100%;
  flex: 1;
  min-height: 0;
  object-fit: contain;
  background: var(--panel-2);
}
.slot .cover.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  padding: 8px;
  text-align: center;
}
.slot .meta {
  padding: 6px 8px;
  background: var(--panel);
}
.slot .meta .t {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  max-height: 2.6em;
  overflow: hidden;
}
.slot .meta .c {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  max-height: 2.4em;
  overflow: hidden;
}
.slot-remove {
  position: absolute;
  top: 6px; right: 6px;
  width: 26px; height: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.65);
  color: #fff;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  z-index: 4;
}
.slot-remove:hover { background: var(--accent); }
/* Desktop: reveal × on hover. Touch devices have no hover, so keep it always visible. */
@media (hover: hover) {
  .slot:hover .slot-remove { display: flex; }
}
@media (hover: none) {
  .slot .slot-remove { display: flex; }
}

.slot .badges {
  position: absolute;
  top: 6px; right: 6px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.slot .badge {
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 20px;
}
.slot .badge-spoiler { background: var(--accent); }
.slot .badge-comment { background: rgba(0,0,0,.6); }

/* ---------- reorder mode ---------- */
#reorderToggle.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

/* Selected card: accent ring + check badge. */
.grid.reorder .slot.selected {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}
.slot-check {
  position: absolute;
  top: 6px; right: 6px;
  width: 24px; height: 24px;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
  z-index: 4;
}
.slot.selected .slot-check { display: flex; }

/* Insertion caret: a tappable strip on the card's leading edge that means
   "move the selection to just before this card". Only rendered on unselected
   cards once a selection exists. */
.ins-caret {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 30%;
  z-index: 5;
  cursor: copy;
  border-left: 4px solid var(--accent);
  background: linear-gradient(to right, rgba(230,62,99,.28), rgba(230,62,99,0));
}
.ins-caret::after {
  content: "▸";
  position: absolute;
  top: 50%; left: 4px;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
}
@media (hover: hover) {
  .ins-caret { opacity: .55; }
  .ins-caret:hover { opacity: 1; }
}

.reorder-controls {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
}
.reorder-count { font-size: 13px; color: var(--muted); }
.reorder-spacer { flex: 1; }
@media (max-width: 560px) {
  .reorder-count { flex-basis: 100%; }
}

/* modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,17,21,.4);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 12px;
  z-index: 50;
  overflow: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  padding: 18px;
}
.modal h2 { margin: 0 0 12px; font-size: 18px; }
.modal .row { display: flex; gap: 8px; margin-bottom: 12px; }
.modal input[type="text"], .modal textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}
.modal textarea { resize: vertical; min-height: 60px; }
.modal label.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }

.sel-cover { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; }
.sel-cover-thumb { width: 44px; height: 62px; flex: none; }
.sel-cover-thumb img, .sel-cover-thumb .noimg {
  width: 100%; height: 100%; object-fit: cover; border-radius: 4px;
  background: var(--panel-2); display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--muted); text-align: center;
}

.results { max-height: 320px; overflow: auto; margin: 8px 0; }
.result {
  display: flex;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  align-items: center;
}
.result:hover { background: var(--panel-2); }
.result img, .result .noimg {
  width: 44px; height: 62px; object-fit: cover;
  border-radius: 4px; background: var(--panel-2); flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--muted);
}
.result .info { flex: 1; }
.result .info .t { font-size: 14px; font-weight: 600; }
.result .info .a { font-size: 12px; color: var(--muted); }
.result .chev { color: var(--muted); font-size: 20px; flex: none; padding: 0 4px; }

.vol-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
}
.linkbtn {
  background: none;
  border: none;
  color: var(--accent-2);
  padding: 4px 2px;
}
.linkbtn:hover { filter: brightness(1.15); text-decoration: underline; }

/* 「最新巻を取得」ボタン。検索カード(.result)内と巻一覧バー(.vol-bar)の両方で使う。 */
.sup-btn {
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  flex: none;
  white-space: nowrap;
  border-color: var(--accent-2);
  color: var(--accent-2);
}
.sup-btn:hover { background: rgba(217, 119, 6, .12); filter: none; }
/* マスター更新日・最終確認日。長くなり得るので独立した行に落として折り返す。 */
.sup-stamp {
  font-size: 12px;
  color: var(--muted);
  flex-basis: 100%;
  order: 5;
  text-align: right;
}

/* キーワード取得バー（検索結果の先頭に常設）。 */
.live-bar { justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
/* live MADB 由来の検索カードにつく識別バッジ。 */
.live-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
  color: var(--accent-2);
  border: 1px solid var(--accent-2);
  border-radius: 999px;
}

.gap-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 4px 0 8px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px dashed var(--muted);
  border-radius: 8px;
}
.gap-label { font-size: 12px; color: var(--muted); }
.gap-btn { font-size: 13px; }

.modal-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; }
.hint { color: var(--muted); font-size: 13px; }
.spinner { color: var(--muted); font-size: 14px; padding: 10px 0; display: flex; align-items: center; gap: 8px; }
.spinner::before {
  content: "";
  flex: none;
  width: 16px; height: 16px;
  border: 2px solid rgba(230, 62, 99, .25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner::before { animation-duration: 2s; }
}

.cover-status {
  display: flex; align-items: center; gap: 8px;
  margin: 6px 0; font-size: 12px;
}
.cover-status::before {
  content: "";
  flex: none;
  width: 12px; height: 12px;
  border: 2px solid rgba(230, 62, 99, .25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .cover-status::before { animation-duration: 2s; }
}

.share-url {
  display: flex; gap: 8px; margin: 8px 0;
}
.share-url input { flex: 1; }

footer.site {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 24px 12px;
}
footer.site .aff-disclosure { font-size: 11px; margin: 6px 0 0; opacity: .8; }
footer.site .foot-links { font-size: 12px; margin: 8px 0 0; }
footer.site .foot-links a { color: var(--muted); }

/* static content pages (about など) */
.prose {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 16px 0;
}
.prose h2 {
  font-size: 18px;
  margin: 22px 0 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.prose h2:first-of-type { border-top: none; padding-top: 0; margin-top: 4px; }
.prose h3 { font-size: 15px; margin: 16px 0 4px; }
.prose p { margin: 8px 0; }
.prose ul { margin: 8px 0; padding-left: 20px; }
.prose li { margin: 4px 0; }
.prose .lead { color: var(--muted); font-size: 14px; }
.prose .note {
  font-size: 12px;
  color: var(--muted);
  background: var(--panel-2);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 12px 0;
}
.prose .src-name { font-weight: 700; }

/* view page: read-only */
.slot.view { cursor: pointer; }
.slot.view .meta .c.spoiler {
  filter: blur(5px);
  cursor: pointer;
  user-select: none;
}
.slot.view .meta .c.spoiler.revealed { filter: none; cursor: default; }

/* view detail modal */
.detail-body { display: flex; gap: 14px; }
.detail-body .dcover, .detail-body .dnoimg {
  width: 96px; height: 132px; object-fit: cover; border-radius: 6px;
  background: var(--panel-2); flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted);
}
.detail-body .dinfo { flex: 1; min-width: 0; }
.detail-body .dauthor { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.detail-body .dcomment { white-space: pre-wrap; word-break: break-word; }
.detail-body .dcomment.spoiler {
  filter: blur(5px); cursor: pointer; user-select: none;
}
.detail-body .dcomment.spoiler.revealed { filter: none; cursor: default; }
.detail-body .dcomment.empty { color: var(--muted); }
.detail-reveal { margin-top: 10px; }

/* view detail modal — buy links */
.buy { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.buy-title { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.buy-group { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.buy-btn {
  display: inline-block; text-decoration: none; font-size: 13px; font-weight: 700;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  color: #fff; transition: filter .15s ease;
}
.buy-btn:hover { filter: brightness(1.08); }
.buy-btn.amazon { background: #ff9900; color: #1a1015; border-color: #e88a00; }
.buy-btn.rakuten { background: #bf0000; border-color: #a30000; }
.buy-btn.mercari { background: #ff0211; border-color: #d80010; }
.buy-note { font-size: 11px; color: var(--muted); margin: 4px 0 0; }

/* correction page */
.toolbar .check { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.fix-list { display: flex; flex-direction: column; gap: 10px; }
.fix-row {
  display: flex; gap: 12px; align-items: center;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
}
.fix-cover { width: 56px; height: 78px; flex: none; }
.fix-cover img, .noimg {
  width: 100%; height: 100%; object-fit: cover; border-radius: 4px;
  background: var(--panel-2); display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--muted); text-align: center;
}
.fix-info { flex: 1; min-width: 0; }
.fix-info .t { font-size: 14px; font-weight: 600; overflow: hidden; }
.fix-info .a { font-size: 12px; color: var(--muted); }

.cand-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  max-height: 360px; overflow: auto; margin: 6px 0 14px;
}
@media (max-width: 560px) { .cand-grid { grid-template-columns: repeat(3, 1fr); } }
.cand {
  display: flex; flex-direction: column; gap: 4px; padding: 6px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; text-align: center;
}
.cand:hover { border-color: var(--accent); }
.cand img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 4px; background: var(--panel); }
.cand .src {
  align-self: center;
  font-size: 9px; font-weight: 700; color: var(--accent-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 0 6px;
}
.cand .cap { font-size: 10px; color: var(--muted); line-height: 1.3; max-height: 2.6em; overflow: hidden; }
.fix-info .a.isbn { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }

/* ── 人気ランキング (ranking.html / ranking.js) ──────────────────────────── */
.rank-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; }
.rank-tab {
  padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--panel); color: var(--muted); font-size: 13px; cursor: pointer;
}
.rank-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.rank-note { color: var(--muted); font-size: 12px; margin: 4px 0 12px; }
.rank-empty { color: var(--muted); text-align: center; padding: 32px 0; }

.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rank-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px;
}
.rank-num {
  flex: 0 0 auto; width: 32px; text-align: center;
  font-size: 18px; font-weight: 700; color: var(--muted);
}
.rank-num.top { color: var(--accent); }
.rank-cover { flex: 0 0 auto; width: 48px; height: 68px; }
.rank-cover .cover {
  width: 48px; height: 68px; object-fit: contain; background: var(--panel-2); border-radius: 4px;
}
.rank-cover .cover.placeholder {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 9px; padding: 4px; text-align: center; overflow: hidden;
}
.rank-meta { flex: 1 1 auto; min-width: 0; }
.rank-title { font-weight: 600; font-size: 14px; line-height: 1.3; }
.rank-author { color: var(--muted); font-size: 12px; margin-top: 2px; }
.rank-count { flex: 0 0 auto; text-align: right; white-space: nowrap; }
.rank-count-num { font-size: 18px; font-weight: 700; color: var(--accent); }
.rank-count-unit { font-size: 11px; color: var(--muted); margin-left: 2px; }
