/* ===== リセット & 変数 ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --color-a: #d4537e;
  --color-b: #2c4a7c;
  --color-a-light: #f8f0f3;
  --color-b-light: #eef1f6;
  --color-text: #333;
  --color-muted: #888;
  --color-border: #ddd;
  --color-bg: #f3f3ed;
  --color-white: #fff;
  --font-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji';
  --radius: 6px;
  --max-width: 640px;
}

html {
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  font-family: var(--font-base);
}

body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
}

a {
  color: var(--color-b);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ===== ナビゲーション ===== */
.site-nav {
  background: #2a2a2a;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid #d4537e;
}

.site-nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
}

.site-logo {
  color: #fff;
  font-weight: 900;
  font-size: 1.2rem;
  text-decoration: none;
  font-family: 'M PLUS Rounded 1c', var(--font-base);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.site-logo:hover {
  text-decoration: none;
  color: #eee;
}

.site-logo-text {
  font-family: 'M PLUS Rounded 1c', var(--font-base);
  font-weight: 900;
  color: #fff;
}

.nav-links {
  display: flex;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}

.nav-links a {
  color: #ccc;
  font-size: 0.85rem;
}

.nav-links a:hover {
  color: #fff;
  text-decoration: none;
}

.nav-search {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.nav-search input {
  background: #3a3a3a;
  border: 1px solid #555;
  border-radius: 4px;
  color: #fff;
  font-size: 0.8rem;
  padding: 4px 10px;
  width: 130px;
  outline: none;
}

.nav-search input::placeholder {
  color: #888;
}

.nav-search input:focus {
  border-color: #d4537e;
}

/* ===== メインコンテナ ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 12px;
}

/* ===== フッター ===== */
.site-footer {
  margin-top: 40px;
  padding: 24px 12px;
  background: #222;
  color: #aaa;
  font-size: 0.8rem;
  text-align: center;
}

.site-footer a {
  color: #ccc;
}

/* ===== トップページ ===== */
.section-title {
  font-size: 1rem;
  font-weight: bold;
  border-left: 4px solid var(--color-a);
  padding-left: 8px;
  margin: 20px 0 12px;
}

.topic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.topic-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px;
  font-size: 0.85rem;
}

.topic-card a {
  color: var(--color-text);
  display: block;
}

.topic-card:hover {
  border-color: #aaa;
}

.topic-card-title {
  font-weight: bold;
  margin-bottom: 4px;
}

.topic-card-meta {
  color: var(--color-muted);
  font-size: 0.75rem;
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.category-badge {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.85rem;
  color: var(--color-text);
}

.category-badge:hover {
  background: var(--color-border);
  text-decoration: none;
}

/* ===== 個別二択ページ ===== */
.breadcrumb {
  font-size: 0.8rem;
  color: var(--color-muted);
  padding: 10px 0 0;
  margin-bottom: 4px;
}

.breadcrumb a {
  color: var(--color-muted);
}

.topic-title {
  font-size: 1.3rem;
  font-weight: bold;
  text-align: center;
  margin: 12px 0 20px;
  line-height: 1.4;
}

/* ===== 投票カード（新デザイン） ===== */
.vote-block {
  margin-bottom: 8px;
}

.vote-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

/* カード型投票UI */
.vote-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

.vote-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.vote-card:active {
  transform: scale(0.97);
}

.vote-card-a {
  border: 2px solid var(--color-a);
}

.vote-card-b {
  border: 2px solid var(--color-b);
}

.vote-card-image {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vote-card-image-a {
  background: #f8f0f3;
}

.vote-card-image-b {
  background: #eef1f6;
}

.vote-card-btn {
  display: block;
  width: 100%;
  padding: 12px 8px;
  font-size: 16px;
  font-weight: bold;
  border: none;
  cursor: pointer;
  text-align: center;
  line-height: 1.3;
  transition: opacity 0.15s;
}

.vote-card-btn:hover {
  opacity: 0.9;
}

.vote-card-btn-a {
  background: var(--color-a);
  color: #fff;
}

.vote-card-btn-b {
  background: var(--color-b);
  color: #fff;
}

/* 後方互換のため旧ボタンスタイルも残す */
.btn-vote {
  padding: 20px 8px;
  font-size: 1.1rem;
  font-weight: bold;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  width: 100%;
  transition: opacity 0.15s, transform 0.1s;
  line-height: 1.3;
}

.btn-vote:active {
  transform: scale(0.97);
}

.btn-vote-a {
  background: var(--color-a);
  color: #fff;
}

.btn-vote-a:hover {
  opacity: 0.9;
}

.btn-vote-b {
  background: var(--color-b);
  color: #fff;
}

.btn-vote-b:hover {
  opacity: 0.9;
}

.vote-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-muted);
  margin: 0 0 8px;
}

/* ===== 投票結果 ===== */
.vote-result {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.result-bar-wrap {
  display: flex;
  height: 44px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 8px;
}

.result-bar-a {
  background: var(--color-a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  font-size: 18px;
  transition: width 0.6s ease;
  min-width: 0;
}

.result-bar-b {
  background: var(--color-b);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  font-size: 18px;
  transition: width 0.6s ease;
  min-width: 0;
}

.result-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.result-label-a {
  color: var(--color-a);
  font-weight: bold;
}

.result-label-b {
  color: var(--color-b);
  font-weight: bold;
  text-align: right;
}

.result-vote-counts {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-bottom: 8px;
}

.result-total {
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-muted);
}

.voted-badge {
  display: inline-block;
  font-size: 0.7rem;
  background: #eee;
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
}

/* 投票後のメッセージ */
.voted-message {
  text-align: center;
  font-size: 0.85rem;
  margin-top: 10px;
  padding: 8px;
  background: #fafafa;
  border-radius: var(--radius);
  color: var(--color-text);
}

.voted-majority {
  color: var(--color-a);
  font-weight: bold;
}

.voted-minority {
  color: var(--color-b);
  font-weight: bold;
}

/* シェアボタン */
.share-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  background: #fff;
  color: var(--color-text);
  text-decoration: none;
  transition: background 0.15s;
}

.share-btn:hover {
  background: #f5f5f5;
  text-decoration: none;
  color: var(--color-text);
}

/* ===== コメント投稿フォーム（投票結果直後） ===== */
.comment-input-box {
  border: 1px solid #e0e0d8;
  border-radius: var(--radius);
  background: #fafaf6;
  padding: 16px;
  margin-bottom: 16px;
}

.comment-input-label {
  font-weight: bold;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--color-text);
}

.comment-input-box textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font-base);
  resize: vertical;
  min-height: 48px;
  background: #fff;
}

.comment-input-box textarea:focus {
  outline: none;
  border-color: #aaa;
}

.comment-input-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.comment-char-count {
  text-align: right;
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-top: 4px;
}

.comment-char-count.over {
  color: #c00;
}

.btn-submit-comment {
  padding: 8px 20px;
  background: var(--color-a);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
}

.btn-submit-comment:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-submit-comment:hover:not(:disabled) {
  opacity: 0.9;
}

.form-error {
  color: #c00;
  font-size: 0.85rem;
  margin-top: 8px;
}

/* ===== ライバルピーク ===== */
.rival-peek {
  background: #fff5f5;
  border: 1px solid #f0d0d0;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.rival-peek-header {
  font-weight: bold;
  font-size: 0.9rem;
  color: var(--color-b);
  margin-bottom: 10px;
}

.rival-peek-comment {
  font-size: 0.9rem;
  color: var(--color-text);
  margin-bottom: 8px;
  line-height: 1.6;
}

.rival-peek-empty {
  color: var(--color-muted);
  font-size: 0.85rem;
}

.rival-peek-actions {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--color-muted);
}

.rival-peek-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0;
}

.rival-peek-comment-clickable {
  cursor: pointer;
}

.rival-peek-comment-clickable:hover {
  text-decoration: underline;
}

@keyframes comment-highlight-fade {
  0% { background-color: #fff3cd; }
  100% { background-color: transparent; }
}

.comment-item--highlight {
  animation: comment-highlight-fade 2s ease-out forwards;
}

/* ===== コメント ===== */
.comments-section {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.comments-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.comments-header {
  font-weight: bold;
  font-size: 1rem;
}

.comment-sort-buttons {
  display: flex;
  gap: 4px;
}

.comment-sort-btn {
  padding: 3px 10px;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background: none;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--color-muted);
}

.comment-sort-btn.active {
  background: var(--color-text);
  color: #fff;
  border-color: var(--color-text);
}

.comment-filters {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--color-border);
}

.comment-filter-btn {
  padding: 6px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: -2px;
}

.comment-filter-btn.active {
  color: var(--color-text);
  font-weight: bold;
  border-bottom-color: var(--color-a);
  background: none;
}

.comment-item {
  border-top: 1px solid var(--color-border);
  padding: 10px 0;
  font-size: 0.9rem;
}

.comment-meta {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.comment-number {
  font-weight: bold;
  color: var(--color-text);
  font-size: 0.8rem;
}

.comment-poster-id {
  font-family: monospace;
  font-size: 0.72rem;
  color: #888;
}

.comment-date {
  font-size: 0.72rem;
}

.comment-choice-a {
  color: var(--color-a);
  font-weight: bold;
}

.comment-choice-b {
  color: var(--color-b);
  font-weight: bold;
}

.comment-badge-hot {
  display: inline-block;
  background: #ff6b35;
  color: #fff;
  font-size: 0.65rem;
  font-weight: bold;
  padding: 1px 5px;
  border-radius: 3px;
}

.comment-body {
  word-break: break-all;
  overflow-wrap: break-word;
  line-height: 1.6;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 400;
}

/* 強調コメント: 👍率75%以上 かつ 合計5以上 */
.comment-body--emphasized {
  font-size: calc(0.9rem + 2px);
  font-weight: 500;
}

/* 縮小コメント: 👎率75%以上 かつ 合計5以上 */
.comment-body--shrunk {
  font-size: calc(0.9rem - 1px);
  color: #999;
  opacity: 0.7;
}

/* 安価リンク */
.anchor-link {
  color: #2c6ead;
  text-decoration: none;
  font-weight: bold;
}

.anchor-link:hover {
  text-decoration: underline;
}

/* 安価ポップアップ */
.anchor-popup {
  position: fixed;
  z-index: 1000;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 10px 12px;
  width: 280px;
  max-width: calc(100vw - 16px);
  pointer-events: auto;
}

.anchor-popup-meta {
  font-size: 0.72rem;
  color: var(--color-muted);
  margin-bottom: 6px;
  font-weight: bold;
}

.anchor-popup-body {
  font-size: 0.85rem;
  line-height: 1.5;
  word-break: break-all;
  overflow-wrap: break-word;
  color: var(--color-text);
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
}

.comment-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0;
}

.comment-action-btn:hover {
  color: var(--color-text);
}

.comment-report-btn {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.72rem;
  color: #bbb;
  padding: 0;
}

.comment-report-btn:hover {
  color: var(--color-muted);
}

.comment-list-empty {
  color: var(--color-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 16px 0;
}

.load-more-btn {
  display: block;
  width: 100%;
  padding: 8px;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-top: 8px;
  text-align: center;
}

.load-more-btn:hover {
  background: var(--color-bg);
}

/* 旧コメントフォームスタイル（後方互換） */
.comment-form {
  border-top: 2px solid var(--color-border);
  padding-top: 16px;
  margin-top: 16px;
}

.comment-form-title {
  font-weight: bold;
  margin-bottom: 10px;
}

.comment-form textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font-base);
  resize: vertical;
  min-height: 80px;
}

.comment-form textarea:focus {
  outline: none;
  border-color: #aaa;
}

.comment-form-meta {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-bottom: 8px;
}

/* ===== 関連二択 ===== */
.related-section {
  margin-bottom: 24px;
}

.related-title {
  font-weight: bold;
  font-size: 0.95rem;
  border-left: 4px solid var(--color-a);
  padding-left: 8px;
  margin: 0 0 10px;
}

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

.related-item {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.9rem;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.related-item:hover {
  border-color: #aaa;
  text-decoration: none;
  color: var(--color-text);
}

.related-item-thumbs {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.related-thumb {
  width: 36px;
  height: 36px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.related-thumb-a {
  background: #f0e8eb;
}

.related-thumb-b {
  background: #e8ecf0;
}

.related-item-info {
  flex: 1;
  min-width: 0;
}

.related-item-title {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.related-item-meta {
  font-size: 0.75rem;
  color: var(--color-muted);
  white-space: nowrap;
  margin-left: auto;
  flex-shrink: 0;
}

/* ===== 広告プレースホルダー ===== */
.ad-unit {
  background: #f9f9f9;
  border: 1px dashed #ccc;
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
  font-size: 0.75rem;
  color: #aaa;
  margin-bottom: 16px;
}

/* ===== カテゴリページ ===== */
.category-header {
  margin: 16px 0;
}

.category-name {
  font-size: 1.3rem;
  font-weight: bold;
}

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

.topic-list-item {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--color-text);
  font-size: 0.9rem;
}

.topic-list-item:hover {
  border-color: #aaa;
  text-decoration: none;
  color: var(--color-text);
}

.topic-vs {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin: 0 2px;
}

/* ===== ランキング ===== */
.ranking-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--color-border);
}

.ranking-tab {
  padding: 8px 16px;
  font-size: 0.9rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.ranking-tab.active {
  color: var(--color-text);
  font-weight: bold;
  border-bottom-color: var(--color-a);
}

.ranking-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
  gap: 10px;
}

.ranking-num {
  font-weight: bold;
  color: var(--color-muted);
  min-width: 24px;
  font-size: 0.85rem;
}

.ranking-num.top3 {
  color: #d4a017;
}

.ranking-link {
  flex: 1;
  color: var(--color-text);
}

.ranking-link:hover {
  text-decoration: none;
  color: var(--color-b);
}

.ranking-meta {
  font-size: 0.75rem;
  color: var(--color-muted);
  white-space: nowrap;
}

/* ===== お題作成ページ ===== */
.create-form {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
}

.create-form label {
  display: block;
  font-weight: bold;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.create-form input[type="text"] {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font-base);
  margin-bottom: 16px;
}

.create-form input[type="text"]:focus {
  outline: none;
  border-color: #aaa;
}

.vs-divider {
  text-align: center;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--color-muted);
  margin: -8px 0 8px;
}

.btn-create {
  width: 100%;
  padding: 14px;
  background: var(--color-a);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 8px;
}

.btn-create:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== ページタイトル ===== */
.page-title {
  font-size: 1.2rem;
  font-weight: bold;
  margin: 16px 0 12px;
}
