/* ============================================
   パパ偏差値.com — 共通CSS（design.md準拠）
   二者対構造：Mama Coral × Papa Indigo
   ============================================ */

:root {
  /* Brand */
  --mama-coral: #E96A5C;
  --mama-coral-light: #FBE9E6;
  --papa-indigo: #3D5577;
  --papa-indigo-light: #EDF1F7;
  --guilty-red: #C9342B;
  --innocent-green: #2F9E6E;
  --offering-gold: #D99A2B;
  --offering-gold-dark: #B07B1E;
  /* Text / Surface */
  --text-primary: #3A3232;
  --text-sub: #6B5F5C;
  --text-caption: #948A87;
  --bg: #FFFFFF;
  --bg-warm: #FBF6F3;
  --border: #EBE3DF;
  --danger: #B3261E;
  /* Type */
  --font-body: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic Medium", "游ゴシック Medium", YuGothic, "游ゴシック体", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "M PLUS Rounded 1c", sans-serif; /* スコア・ロゴ・スタンプ専用 */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-warm);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font-body); cursor: pointer; border: none; background: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  max-width: 1024px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
}
.site-logo {
  font-family: var(--font-display); font-weight: 800;
  font-size: 20px; letter-spacing: 0.02em;
  color: var(--mama-coral);
}
.site-logo .logo-com { color: var(--papa-indigo); font-size: 14px; }
.header-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- Buttons ---------- */
.btn-post {
  background: var(--mama-coral); color: #fff;
  font-size: 14px; font-weight: 700;
  padding: 8px 18px; border-radius: 999px;
  transition: opacity .15s;
}
.btn-post:hover { opacity: .85; }

.btn-share {
  display: block; width: 100%;
  background: var(--mama-coral); color: #fff;
  font-size: 15px; font-weight: 700;
  padding: 14px 24px; border-radius: 12px;
  text-align: center;
  transition: opacity .15s;
}
.btn-share:hover { opacity: .85; }

.btn-subsc {
  display: block; width: 100%;
  background: var(--papa-indigo); color: #fff;
  font-size: 15px; font-weight: 700;
  padding: 13px 24px; border-radius: 12px;
  text-align: center;
}
.btn-offering {
  display: inline-block;
  background: #fff; color: var(--offering-gold-dark);
  border: 1.5px solid var(--offering-gold);
  font-size: 14px; font-weight: 700;
  padding: 10px 20px; border-radius: 12px;
  transition: all .15s;
}
.btn-offering:hover { background: var(--offering-gold); color: #fff; }

/* ---------- 共感ボタン ---------- */
.btn-empathy {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid var(--border);
  background: #fff; color: var(--text-sub);
  font-size: 13px; font-weight: 700;
  padding: 6px 14px; border-radius: 999px;
  transition: transform .12s ease, background .15s, color .15s, border-color .15s;
  min-height: 34px;
}
.btn-empathy:active { transform: scale(0.95); }
.btn-empathy.is-on {
  background: var(--mama-coral-light);
  color: var(--mama-coral);
  border-color: var(--mama-coral);
}

/* ---------- Category Chips ---------- */
.chip {
  display: inline-block;
  font-size: 12px; font-weight: 700;
  padding: 3px 12px; border-radius: 999px;
  background: var(--mama-coral-light); color: var(--mama-coral);
}
.chip--papa { background: var(--papa-indigo-light); color: var(--papa-indigo); }
.chip-row {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 12px 16px 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip-row .chip { flex-shrink: 0; padding: 6px 16px; font-size: 13px; }
.chip-row .chip.is-inactive { background: #fff; color: var(--text-sub); border: 1px solid var(--border); }

/* ---------- Layout ---------- */
.layout {
  max-width: 1024px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr;
  gap: 24px; padding: 0 0 96px;
}
.feed { max-width: 680px; width: 100%; margin: 0 auto; padding: 0 16px; }
.sidebar { display: none; }

@media (min-width: 1024px) {
  .layout { grid-template-columns: 680px 280px; justify-content: center; padding: 0 16px 64px; }
  .feed { padding: 0; }
  .sidebar { display: block; padding-top: 16px; }
}

/* ---------- Post Card ---------- */
.post-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
}
.post-card__title {
  font-size: 17px; font-weight: 700; line-height: 1.5;
  margin: 8px 0 6px;
}
.post-card__body {
  font-size: 15px; color: var(--text-primary);
  overflow-wrap: break-word;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card__footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px;
}
.post-meta { font-size: 12px; color: var(--text-caption); }
.post-meta .report { color: var(--danger); margin-left: 10px; }

/* ---------- Section ---------- */
.section-title { font-size: 20px; font-weight: 700; line-height: 1.45; margin: 24px 0 12px; }
.page-title { font-size: 24px; font-weight: 700; line-height: 1.4; }
.caption { font-size: 11px; line-height: 1.55; color: var(--text-caption); }

/* ---------- Sidebar widgets ---------- */
.widget {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 16px; padding: 16px; margin-bottom: 16px;
}
.widget__title { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.rank-list { list-style: none; }
.rank-list li {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 13px; padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.rank-list li:last-child { border-bottom: none; }
.rank-num { font-family: var(--font-display); font-weight: 800; color: var(--offering-gold); min-width: 18px; }

/* ---------- Score (診断結果) ---------- */
.score-display {
  font-family: var(--font-display); font-weight: 800;
  font-size: 72px; line-height: 1; letter-spacing: 0.02em;
}
.score--low { color: var(--guilty-red); }
.score--mid { color: var(--text-primary); }
.score--high { color: var(--innocent-green); }

/* ---------- Verdict (裁判所) ---------- */
.stamp {
  font-family: var(--font-display); font-weight: 800;
  font-size: 28px; line-height: 1; letter-spacing: 0.02em;
  display: inline-block; padding: 10px 22px;
  border: 3px solid currentColor; border-radius: 12px;
  transform: rotate(-6deg);
}
.stamp--guilty { color: var(--guilty-red); }
.stamp--innocent { color: var(--innocent-green); }

.verdict-bar {
  height: 32px; border-radius: 999px; overflow: hidden;
  display: flex; width: 100%;
}
.verdict-bar__guilty {
  background: var(--guilty-red); color: #fff;
  display: flex; align-items: center; padding-left: 14px;
  font-size: 14px; font-weight: 700; white-space: nowrap;
}
.verdict-bar__innocent {
  background: var(--innocent-green); color: #fff;
  display: flex; align-items: center; justify-content: flex-end; padding-right: 14px;
  font-size: 14px; font-weight: 700; white-space: nowrap;
  flex: 1;
}

.vote-buttons { display: flex; gap: 12px; margin-top: 16px; }
.btn-vote {
  flex: 1; min-height: 52px;
  font-size: 15px; font-weight: 700;
  border-radius: 12px; border: 2px solid;
  background: #fff;
  transition: all .15s;
}
.btn-vote--guilty { color: var(--guilty-red); border-color: var(--guilty-red); }
.btn-vote--guilty:hover, .btn-vote--guilty.is-voted { background: var(--guilty-red); color: #fff; }
.btn-vote--innocent { color: var(--innocent-green); border-color: var(--innocent-green); }
.btn-vote--innocent:hover, .btn-vote--innocent.is-voted { background: var(--innocent-green); color: #fff; }

/* ---------- 発言の引用（裁判所） ---------- */
.quote-card {
  background: var(--papa-indigo-light);
  border-radius: 12px; padding: 16px;
  font-size: 17px; font-weight: 700; line-height: 1.6;
  color: var(--papa-indigo);
  position: relative;
}

/* ---------- 固定シェアCTA ---------- */
.fixed-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  background: var(--bg);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(58, 50, 50, 0.12);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.fixed-cta__inner { max-width: 560px; margin: 0 auto; }

/* ---------- 下部タブバー ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
  background: var(--bg); border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; text-align: center; padding: 8px 0 6px;
  font-size: 10px; font-weight: 700; color: var(--text-caption);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 44px;
}
.tabbar a .tab-icon { font-size: 20px; line-height: 1; }
.tabbar a.is-active { color: var(--mama-coral); }
@media (min-width: 1024px) { .tabbar { display: none; } }

/* ---------- 機能ページ共通 ---------- */
.page-narrow { max-width: 560px; margin: 0 auto; padding: 24px 16px 140px; }
.result-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px 24px; text-align: center;
}
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ---------- LINE / サブスク予告バナー ---------- */
.banner-line {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 16px; padding: 16px; text-align: center;
}

/* ---------- タブバー 準備中バッジ ---------- */
.tabbar a { position: relative; }
.tab-soon {
  display: block;
  font-size: 8px; font-weight: 700;
  color: var(--text-caption);
  line-height: 1.2;
  margin-top: -1px;
}
.tabbar a.is-muted { color: var(--text-caption); opacity: 0.55; }
.tabbar a.is-muted:hover { color: var(--text-caption); }

/* ---------- 固定CTA（タブバーと共存） ---------- */
.fixed-cta--above-tabbar { bottom: 58px; }
@media (min-width: 1024px) { .fixed-cta--above-tabbar { bottom: 0; } }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ============================================
   v2追加：スレ詳細・コメント・投稿フォーム・身バレ注意
   ============================================ */

/* ---------- スレ詳細 ---------- */
.thread-main { padding: 20px; }
.thread-main .post-card__body { display: block; -webkit-line-clamp: unset; overflow: visible; }
.comment-count-label { font-size: 14px; font-weight: 700; color: var(--text-sub); }

/* ---------- コメント ---------- */
.comment {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.comment--papa {
  background: var(--papa-indigo-light);
  border-color: var(--papa-indigo-light);
}
.comment__meta { font-size: 11px; color: var(--text-caption); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.comment__badge {
  font-size: 10px; font-weight: 700;
  padding: 1px 8px; border-radius: 999px;
  background: var(--mama-coral-light); color: var(--mama-coral);
}
.comment--papa .comment__badge { background: #fff; color: var(--papa-indigo); }
.comment__body { font-size: 14px; line-height: 1.7; overflow-wrap: break-word; }
.comment__footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.comment .btn-empathy { font-size: 12px; padding: 4px 12px; min-height: 28px; }

/* ---------- 入力フォーム ---------- */
.form-label { font-size: 13px; font-weight: 700; margin-bottom: 6px; display: block; }
.form-input, .form-textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px; line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--mama-coral);
}
.form-textarea { min-height: 140px; resize: vertical; }
.form-hint { font-size: 11px; color: var(--text-caption); margin-top: 4px; }
.chip-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-select .chip { cursor: pointer; padding: 7px 16px; font-size: 13px; border: 1.5px solid transparent; }
.chip-select .chip.is-inactive { background: #fff; color: var(--text-sub); border-color: var(--border); }

/* ---------- 身バレ注意 ---------- */
.privacy-note {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px; line-height: 1.6; color: var(--text-sub);
}
.privacy-alert {
  display: none;
  background: #FDF3E5;
  border: 1.5px solid var(--offering-gold);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px; line-height: 1.6;
  color: #8A6516;
  margin-top: 10px;
}
.privacy-alert.is-visible { display: block; }
.privacy-alert strong { display: block; margin-bottom: 2px; }

/* ---------- 投稿前確認モーダル ---------- */
.modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 200;
  background: rgba(58, 50, 50, 0.45);
  padding: 16px;
  align-items: center; justify-content: center;
}
.modal-overlay.is-open { display: flex; }
.modal {
  background: var(--bg);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(58, 50, 50, 0.12);
  max-width: 420px; width: 100%;
  padding: 24px 20px;
}
.modal__title { font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.modal__check {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 14px; line-height: 1.6;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.modal__check:last-of-type { border-bottom: none; }
.modal__check input { width: 18px; height: 18px; margin-top: 3px; flex-shrink: 0; accent-color: var(--mama-coral); }
.modal__actions { display: flex; gap: 10px; margin-top: 16px; }
.btn-modal-cancel {
  flex: 1; padding: 12px;
  font-size: 14px; font-weight: 700;
  color: var(--text-sub);
  border: 1.5px solid var(--border);
  border-radius: 12px; background: #fff;
}
.btn-modal-submit {
  flex: 1.4; padding: 12px;
  font-size: 14px; font-weight: 700;
  color: #fff; background: var(--mama-coral);
  border-radius: 12px;
  opacity: 0.4; pointer-events: none;
  transition: opacity .15s;
}
.btn-modal-submit.is-ready { opacity: 1; pointer-events: auto; }

/* ---------- SVGアイコン（絵文字置換） ---------- */
.icon { width: 1.2em; height: 1.2em; vertical-align: -0.22em; display: inline-block; }
.tabbar .icon { width: 22px; height: 22px; vertical-align: 0; }
.tab-icon .icon { width: 22px; height: 22px; }
.btn-empathy .icon { width: 15px; height: 15px; color: var(--text-caption); }
.btn-empathy.is-on .icon { color: var(--mama-coral); }
.widget__title .icon, .section-title .icon, .comment-count-label .icon { color: var(--papa-indigo); }
.icon-crown { color: var(--offering-gold); }
.privacy-note .icon, .privacy-alert .icon { flex-shrink: 0; margin-top: 2px; }
