/* ── リセット・変数 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #111318;
  --surface: #181b24;
  --card: #1c1f2e;
  --card-hover: #212538;
  --border: #2a2d40;
  --border-light: #343750;
  --accent: #8b7cf6;
  --accent-dim: rgba(139,124,246,0.12);
  --text: #e8e6f0;
  --text-sub: #a09db8;
  --text-muted: #5c5a72;
  --green: #5ec47a;
  --yellow: #f0b93a;
  --red: #e06060;
  --serif: 'Noto Serif JP', serif;
  --sans: 'Noto Sans JP', -apple-system, sans-serif;
  --radius: 8px;
  --radius-lg: 14px;
}

html { font-size: 15px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.7;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ── レイアウト ── */
.inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── ヘッダー ── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .inner {
  display: flex;
  align-items: center;
  height: 52px;
  gap: 24px;
}

.logo {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.logo-beta {
  font-size: 0.6rem;
  color: var(--accent);
  margin-left: 4px;
  font-family: var(--sans);
  vertical-align: super;
}

.gnav {
  display: flex;
  gap: 20px;
  margin-left: auto;
}

.gnav a {
  font-size: 0.85rem;
  color: var(--text-sub);
  transition: color 0.15s;
}
.gnav a:hover { color: var(--text); }

/* ── フィルターバー ── */
.filter-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.filter-form { display: flex; flex-direction: column; gap: 10px; }

.filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-search {
  flex: 1;
  min-width: 180px;
  padding: 7px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.87rem;
  font-family: var(--sans);
  outline: none;
  transition: border-color 0.15s;
}
.filter-search:focus { border-color: var(--accent); }
.filter-search::placeholder { color: var(--text-muted); }

.btn-search {
  padding: 7px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 700;
  transition: opacity 0.15s;
}
.btn-search:hover { opacity: 0.85; }

/* 配信ラジオラベル */
.stream-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--card);
  border: 1.5px solid var(--border);
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.15s;
}
.stream-label input[type=radio] { display: none; }
.stream-label.active,
.stream-label:has(input:checked) {
  background: var(--bg-from, #222);
  border-color: var(--bg);
  background: var(--bg);
  border-color: var(--accent);
  color: var(--text);
}

/* ジャンルタグ（フィルター用） */
.genre-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  color: var(--text-sub);
  background: transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.genre-tag.active,
.genre-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.filter-select {
  padding: 5px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-sub);
  font-size: 0.83rem;
  font-family: var(--sans);
  outline: none;
}

.clear-link {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: underline;
}

/* ── アニメグリッド ── */
.main-content { padding: 20px 0 48px; }

.result-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.anime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 14px;
}

.anime-grid.sm {
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

/* ── アニメカード ── */
.anime-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.15s;
}
.anime-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.card-link { display: block; }

.card-thumb {
  position: relative;
  width: 100%;
  padding-bottom: 56%;
  background: #14151f;
  overflow: hidden;
}
.card-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.anime-card:hover .card-thumb img { transform: scale(1.03); }

.card-thumb-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--text-muted);
  background: linear-gradient(135deg, #1a1d2e, #232640);
  writing-mode: vertical-rl;
  letter-spacing: 0.1em;
}

.card-season {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(139,124,246,0.85);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}

.card-score {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 900;
  border: 2px solid;
}
.card-score.high { background: rgba(94,196,122,0.15); color: var(--green); border-color: var(--green); }
.card-score.mid  { background: rgba(240,185,58,0.15);  color: var(--yellow); border-color: var(--yellow); }
.card-score.low  { background: rgba(224,96,96,0.15);   color: var(--red);    border-color: var(--red); }

.card-body {
  padding: 8px 10px 6px;
}

.card-title {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 5px;
}

.card-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.genre-badge {
  font-size: 0.68rem;
  padding: 1px 6px;
  background: rgba(139,124,246,0.1);
  color: var(--text-muted);
  border-radius: 3px;
  border: 1px solid var(--border);
}

.card-streams {
  padding: 6px 10px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  border-top: 1px solid var(--border);
}

.stream-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}

.stream-badge.lg {
  font-size: 0.82rem;
  padding: 4px 12px;
}

.stream-none {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ── 作品詳細ページ ── */
.anime-detail { max-width: 860px; }

.detail-hero {
  display: flex;
  gap: 24px;
  margin-bottom: 32px;
  align-items: flex-start;
}

.detail-thumb {
  width: 160px;
  flex-shrink: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.thumb-placeholder {
  width: 160px;
  height: 226px;
  background: linear-gradient(135deg, #1a1d2e, #232640);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  color: var(--text-muted);
  font-size: 1.2rem;
  writing-mode: vertical-rl;
}

.detail-season {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 4px;
}

.detail-title {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 6px;
}

.detail-studio {
  font-size: 0.82rem;
  color: var(--text-sub);
  margin-bottom: 10px;
}

.detail-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 14px;
}

.detail-scores {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-num {
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 2px;
}
.score-num.high   { color: var(--green); }
.score-num.mid    { color: var(--yellow); }
.score-num.low    { color: var(--red); }
.score-num.accent { color: var(--accent); }
.score-num.muted  { color: var(--text-sub); }

.score-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.vote-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-vote {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-sub);
  font-size: 0.82rem;
  transition: all 0.15s;
}
.btn-vote:hover, .btn-vote.voted {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.detail-section {
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.detail-section:last-child { border-bottom: none; }

.section-title {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.detail-synopsis {
  font-size: 0.9rem;
  line-height: 1.9;
  color: var(--text-sub);
}

.streaming-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.streaming-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.verified-badge {
  font-size: 0.7rem;
  color: var(--green);
  background: rgba(94,196,122,0.1);
  border: 1px solid var(--green);
  padding: 1px 6px;
  border-radius: 3px;
}

.streaming-report {
  margin-top: 14px;
  padding: 12px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.report-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stream-report-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-stream-report {
  padding: 4px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-sub);
  font-size: 0.8rem;
  transition: all 0.15s;
}
.btn-stream-report:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.info-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.info-table th, .info-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.info-table th { color: var(--text-muted); width: 120px; font-weight: 400; }
.info-table a { color: var(--accent); }

/* ── コメント ── */
.comment-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--sans);
  font-weight: 400;
  margin-left: 6px;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 24px;
}

.comment-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 4px;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.comment-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 20px;
}

.comment-uid {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
}

.comment-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.comment-body {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-sub);
}

.comment-body .anchor { color: var(--accent); }

.btn-report-inline {
  margin-left: auto;
  background: transparent;
  border: none;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 3px;
  transition: color 0.15s;
}
.btn-report-inline:hover { color: var(--red); }

/* ── コメント投稿フォーム ── */
.comment-form, .thread-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.form-title {
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--text-sub);
  margin-bottom: 12px;
}

textarea, input[type=text], input[type=password] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.9rem;
  padding: 10px 12px;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s;
  line-height: 1.6;
  margin-bottom: 8px;
}
textarea:focus, input:focus { border-color: var(--accent); }
textarea::placeholder, input::placeholder { color: var(--text-muted); }

.form-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.char-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-right: auto;
}

.btn-submit {
  padding: 8px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 700;
  transition: opacity 0.15s;
}
.btn-submit:hover { opacity: 0.85; }

.btn-cancel {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: all 0.15s;
}
.btn-cancel:hover { border-color: var(--border-light); color: var(--text); }

.form-msg {
  font-size: 0.82rem;
  margin-top: 8px;
  min-height: 20px;
}
.form-msg.ok   { color: var(--green); }
.form-msg.err  { color: var(--red); }

.form-error {
  background: rgba(224,96,96,0.1);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  color: var(--red);
  font-size: 0.85rem;
  padding: 8px 12px;
  margin-bottom: 12px;
}

/* ── 掲示板 ── */
.bbs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-title {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 700;
}

.btn {
  display: inline-block;
  padding: 7px 16px;
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.15s;
}
.btn:hover { background: var(--accent-dim); }

.thread-form-wrap { margin-bottom: 24px; }

.thread-list { display: flex; flex-direction: column; gap: 6px; }

.thread-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}
.thread-item:hover { border-color: var(--border-light); }

.thread-link {
  display: block;
  padding: 12px 14px;
}

.thread-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 4px;
}

.thread-id, .thread-uid {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: monospace;
}

.thread-date { font-size: 0.72rem; color: var(--text-muted); }

.thread-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}

.thread-preview {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.thread-reply-count {
  font-size: 0.75rem;
  color: var(--accent);
}

.thread-detail-title {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.thread-nav { margin-bottom: 16px; }
.back-link { font-size: 0.82rem; color: var(--text-muted); }
.back-link:hover { color: var(--text); }

/* ── エラー・空状態 ── */
.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
}
.empty-state p { margin-bottom: 16px; }
.error-title { font-size: 1.2rem; color: var(--text-sub); }

.muted-text { color: var(--text-muted); font-size: 0.88rem; }

/* ── フッター ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  margin-top: 48px;
}

.footer-note {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-note a { color: var(--text-muted); }
.footer-note a:hover { color: var(--text); }

/* ── シーズンページ ── */
.season-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.season-header h1 {
  font-family: var(--serif);
  font-size: 1.4rem;
}

/* ── レスポンシブ ── */
@media (max-width: 600px) {
  .anime-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .detail-hero {
    flex-direction: column;
  }

  .detail-thumb {
    width: 120px;
  }

  .filter-search { min-width: 0; }
}

/* ===== ページネーション ===== */
.result-range {
  margin-left: 10px;
  font-size: 0.82em;
  color: #888;
}
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 40px 0 20px;
}
.pagination .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #d8d2c4;
  border-radius: 6px;
  background: #fff;
  color: #333;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.pagination .page-link:hover {
  background: #f3efe6;
  border-color: #b8ae98;
}
.pagination .page-link.active {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
  font-weight: 700;
  pointer-events: none;
}
.pagination .page-link.disabled {
  color: #c4bdae;
  background: #f7f5f0;
  border-color: #e5e0d4;
  pointer-events: none;
}
.pagination .page-prev,
.pagination .page-next {
  font-weight: 500;
}
.pagination .page-ellipsis {
  padding: 0 4px;
  color: #999;
  user-select: none;
}
@media (max-width: 600px) {
  .pagination .page-link {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    font-size: 0.88rem;
  }
}
