/* AIおもしろスレ — まとめアプリ風。草は緑。 */
:root {
  --ink: #16181d;
  --paper: #ffffff;
  --bg: #eceef2;
  --line: #dde1e7;
  --mute: #868c98;
  --brand: #ff5a1f;      /* まとめアプリのオレンジ */
  --kusa: #1f9d3a;       /* 草 */
  --aori: #e02424;       /* 煽り */
  --majire: #1f5fe0;     /* マジレス */
  --tokutei: #8b2fd6;    /* 特定 */
  --name: #228b22;       /* 名無しさん（2ch の緑） */
  --anchor: #0000ee;     /* 安価（2ch の青） */
  --board: #efefef;      /* 掲示板の背景 */
  --player: #fff6d1;     /* スレ主の書き込み */
  --display: "Dela Gothic One", "Hiragino Kaku Gothic StdN", sans-serif;
  --body: "M PLUS 1p", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  --aa: "MS PGothic", "IPAMonaPGothic", "Mona", "Hiragino Kaku Gothic ProN", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  width: 100%;
  background: #16181d;
  color: var(--ink);
  font-family: var(--body);
  display: flex; justify-content: center; align-items: center;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--brand); outline-offset: 2px;
}

/* ===== 端末 ===== */
#phone {
  position: relative;
  width: 100%; max-width: 430px;
  height: 100vh; /* 古いブラウザ向け */
  height: var(--app-h, 100dvh);
  background: var(--bg);
  display: flex; flex-direction: column;
  overflow: hidden;
  padding-top: env(safe-area-inset-top);
}
@media (min-width: 520px) and (min-height: 700px) {
  #phone { height: min(var(--app-h, 100dvh) - 32px, 932px); border-radius: 36px; box-shadow: 0 0 0 10px #2a2d35, 0 30px 80px rgba(0,0,0,.6); }
}


#app { position: relative; flex: 1; min-height: 0; min-width: 0; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.scroll { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

/* ===== アプリバー ===== */
.appbar {
  flex: none; height: 48px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 8px 0 4px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.appbar .back { width: 40px; height: 40px; font-size: 22px; line-height: 1; border-radius: 50%; }
.appbar .brand { font-family: var(--display); color: var(--brand); font-size: 17px; letter-spacing: .02em; }
.appbar .spacer { flex: 1; }
.appbar .icon-btn { height: 34px; padding: 0 10px; border-radius: 17px; font-size: 13px; font-weight: 700; color: var(--mute); }

/* ===== タイトル（まとめアプリの記事一覧風） ===== */
.hero { background: var(--paper); padding: 22px 18px 18px; border-bottom: 1px solid var(--line); }
.hero .kicker { display: inline-block; font-family: var(--display); color: #fff; background: var(--aori); font-size: 15px; padding: 3px 8px; border-radius: 3px; }
.hero h1 { font-family: var(--display); font-weight: 400; font-size: clamp(28px, 10.5vw, 40px); line-height: 1.15; margin: 12px 0 6px; letter-spacing: -.01em; }
.hero h1 .k { color: var(--kusa); }
.hero h1 small { font-size: 16px; color: var(--mute); margin-left: 4px; }
.hero p { font-size: 14px; line-height: 1.7; color: #4a4f5a; }
.hero .meta { margin-top: 10px; font-size: 12px; color: var(--mute); }

.section-label { padding: 18px 16px 8px; font-size: 12px; font-weight: 800; color: var(--mute); letter-spacing: .08em; }

.article {
  display: flex; gap: 12px; align-items: stretch; width: 100%; text-align: left;
  background: var(--paper); padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.article:active { background: #f6f7f9; }
.article .thumb {
  flex: none; width: 72px; height: 72px; border-radius: 8px;
  display: grid; place-items: center;
  font-family: var(--display); font-size: 30px; color: #fff;
}
.article .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.article .ttl { font-weight: 800; font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.article .desc { font-size: 13px; color: #5a606b; line-height: 1.5; }
.article .foot { margin-top: auto; display: flex; gap: 10px; font-size: 11.5px; color: var(--mute); }
.article .badge { color: var(--kusa); font-weight: 800; }
.article .badge.red { color: var(--aori); }

/* ===== スレ立て ===== */
.form { background: var(--paper); padding: 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.form label { font-size: 12px; font-weight: 800; color: var(--mute); display: block; margin-bottom: 4px; }
.form input, .form textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 8px; background: #fafbfc;
}
.form input:focus, .form textarea:focus { border-color: var(--brand); background: #fff; outline: none; }
.form input[disabled] { color: var(--name); font-weight: 700; }
.suggests { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 16px; }
.suggests button { font-size: 13px; padding: 7px 11px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); text-align: left; }
.btn-primary {
  display: block; width: calc(100% - 32px); margin: 8px 16px 24px;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 17px;
  padding: 14px; border-radius: 12px; box-shadow: 0 3px 0 #c63f0f;
}
.btn-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #c63f0f; }
.btn-primary:disabled { opacity: .4; }

/* ===== スレ画面 ===== */
.thread-head { flex: none; background: var(--paper); padding: 10px 14px 10px; border-bottom: 1px solid var(--line); }
.thread-head h2 { overflow-wrap: anywhere; font-size: 15px; font-weight: 800; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.thread-meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 12px; color: var(--mute); font-variant-numeric: tabular-nums; }
.thread-meta .count b { color: var(--ink); font-size: 14px; }
.thread-meta .momentum { margin-left: auto; font-weight: 800; display: inline-flex; align-items: center; gap: 6px; }
.signal { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.signal i { display: block; width: 3px; background: #d3d7de; border-radius: 1px; transition: background .3s; }
.signal i:nth-child(1) { height: 4px; } .signal i:nth-child(2) { height: 6px; }
.signal i:nth-child(3) { height: 9px; } .signal i:nth-child(4) { height: 12px; }
.signal i.on { background: currentColor; }
.gauge.mental .fill { background: var(--kusa); }
.gauge.mental.mid .fill { background: #f0a400; }
.gauge.mental.low .fill { background: var(--aori); }
.gauge.mental.low .num { color: var(--aori); }
.thread-meta .momentum.hot { color: var(--brand); }
.thread-meta .momentum.cold { color: #5b8bd6; }
.gauge { margin-top: 8px; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; }
.gauge .bar { flex: 1; height: 8px; border-radius: 4px; background: #eef0f3; overflow: hidden; }
.gauge .fill { height: 100%; width: 0; background: linear-gradient(90deg, #ffb37a, var(--brand)); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.gauge .num { width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.mission-goal { margin-top: 6px; font-size: 12px; color: #4a4f5a; }

.res-list { padding-bottom: 12px; background: var(--board); min-height: 100%; }
/* 2ch 配色: 本文は黒・名前は緑・安価は青。反応の違いは色ではなく、拡大・揺れ・弾幕・音・増減の数字で伝える */
.res { background: transparent; padding: 9px 14px 11px; animation: res-in .28s ease-out; position: relative; }
@keyframes res-in { from { opacity: 0; transform: translateY(6px); } }
.res-h { font-size: 11.5px; color: var(--mute); line-height: 1.4; display: flex; flex-wrap: wrap; gap: 0 6px; padding-right: 44px; }
.res-h .no { color: var(--ink); font-weight: 800; }
.res-h .nm { color: var(--name); font-weight: 700; }
.res-h .id.hot { color: var(--aori); font-weight: 700; }
.res-b { margin-top: 5px; font-size: 16px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.res-b .anc { color: var(--anchor); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.res-b { color: #000; }
.res .res-b.aa { font-family: var(--aa); font-size: 14px; line-height: 1.15; white-space: pre; font-weight: 400; color: var(--ink); overflow-x: auto; max-width: 100%; }
.delta {
  position: absolute; right: 12px; top: 9px;
  font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 10px; font-variant-numeric: tabular-nums;
}
.delta.minus { background: #fde8e8; color: var(--aori); }
.delta.plus { background: #e3f5e7; color: var(--kusa); }
.res.player { background: rgba(255, 236, 160, .45); box-shadow: inset 3px 0 0 var(--brand); }
.res.player .tag { background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 800; padding: 0 6px; border-radius: 3px; }
.res.player .res-b { font-weight: 400; }
.res.anka { background: rgba(255, 220, 220, .5); }
.res.system .res-b { color: var(--aori); font-weight: 700; }
.res.killer { outline: 3px solid var(--aori); outline-offset: -3px; }


.typing { padding: 10px 14px; font-size: 12px; color: var(--mute); }
.typing::after { content: "…"; animation: dots 1s steps(3) infinite; display: inline-block; width: 1.2em; overflow: hidden; vertical-align: bottom; }
@keyframes dots { from { width: 0; } }

/* アンカーのポップアップ */
.popup {
  position: absolute; left: 12px; right: 12px; z-index: 30;
  background: #fffef5; border: 1px solid #d9cf9a; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18);
  padding: 8px 10px; font-size: 14px;
  overflow-y: auto;
}

/* 書き込み欄 */
.composer { flex: none; background: var(--paper); border-top: 1px solid var(--line); padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
.chips { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.chip {
  display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; text-align: left; overflow-wrap: anywhere;
  font-size: 14px; line-height: 1.35; padding: 8px 12px; border-radius: 12px;
  background: #f3f4f7; border: 1px solid transparent;
}
.chip:active { background: #e7e9ee; }
.chip .ty { flex: none; font-size: 11.5px; font-weight: 700; padding: 2px 6px; border-radius: 4px; color: #fff; background: var(--mute); }
.ty-neta { background: var(--kusa) !important; }
.ty-boast { background: #d18a00 !important; }
.ty-weak { background: #5b8bd6 !important; }
.ty-counter { background: var(--aori) !important; }
.ty-question { background: var(--majire) !important; }
.ty-detail { background: var(--tokutei) !important; }
.ty-neutral { background: #9aa0aa !important; }
.input-row { display: flex; gap: 8px; align-items: flex-end; }
.input-row textarea {
  flex: 1; min-width: 0; resize: none; font: inherit; font-size: 16px; line-height: 1.4;
  padding: 9px 12px; border-radius: 18px; border: 1.5px solid var(--line); background: #fafbfc; max-height: 96px;
}
.input-row textarea:focus { border-color: var(--brand); outline: none; background: #fff; }
.input-row .send { flex: none; height: 40px; padding: 0 16px; border-radius: 20px; background: var(--brand); color: #fff; font-weight: 800; font-size: 14px; }
.composer.locked .chip, .composer.locked .send, .composer.locked textarea { opacity: .45; pointer-events: none; }

/* 強制安価のシート */
.sheet-backdrop { position: absolute; inset: 0; z-index: 40; background: rgba(10,12,16,.55); display: flex; align-items: flex-end; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-height: calc(100% - 24px); overflow-y: auto; background: var(--paper); border-radius: 18px 18px 0 0; padding: 18px 14px calc(16px + env(safe-area-inset-bottom)); animation: up .3s cubic-bezier(.2,.8,.2,1); }
@keyframes up { from { transform: translateY(100%); } }
.sheet .stamp { display: inline-block; font-family: var(--display); color: #fff; background: var(--aori); padding: 4px 10px; border-radius: 4px; font-size: 15px; transform: rotate(-3deg); }
.sheet h3 { font-size: 15px; margin: 10px 0 4px; }
.sheet p { font-size: 13px; line-height: 1.6; color: #5a606b; margin-bottom: 10px; white-space: pre-line; }
.dare { display: block; width: 100%; text-align: left; padding: 13px 14px; margin-top: 8px; border-radius: 12px; border: 2px solid var(--line); font-weight: 700; font-size: 15px; }
.dare:active { border-color: var(--aori); background: #fff5f5; }

/* 揺れ */
.shake { animation: shake .3s; }
@keyframes shake { 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

/* ===== 演出レイヤー ===== */
.fx { position: absolute; inset: 0; z-index: 60; overflow: hidden; }
.fx-freeze { position: absolute; inset: 0; background: rgba(0,0,0,0); transition: background .4s; }
.fx-freeze.dim { background: rgba(0,0,0,.55); }
.fx-quote {
  position: absolute; left: 18px; right: 18px; top: 34%;
  background: #fff; border-radius: 10px; padding: 14px 16px; box-shadow: 0 10px 40px rgba(0,0,0,.4);
  transform: scale(.6); opacity: 0; transition: transform .35s cubic-bezier(.2,1.4,.4,1), opacity .2s;
  max-height: 40%; overflow: hidden;
}
.fx-quote.on { transform: scale(1); opacity: 1; }
.fx-quote .res-h { padding-right: 0; }
.fx-quote .res-b { font-size: 22px; font-weight: 800; color: var(--aori); }
.fx-fist {
  position: absolute; left: 50%; top: 110%; font-size: min(150px, 38vw); line-height: 1;
  transform: translate(-50%, 0) scale(1.6); filter: drop-shadow(0 12px 18px rgba(0,0,0,.5));
}
.fx-fist.hit { animation: fist .32s cubic-bezier(.5,0,.9,.4) forwards; }
@keyframes fist { to { top: 38%; transform: translate(-50%, -50%) scale(1); } }
.fx-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.fx-flash.on { animation: flash .25s; }
@keyframes flash { 0% { opacity: .9; } 100% { opacity: 0; } }
.fx-crack { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fx-crack path { fill: none; stroke: rgba(255,255,255,.95); stroke-width: 1.6; filter: drop-shadow(0 0 1px rgba(0,0,0,.8)); stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: draw .25s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.shard { position: absolute; inset: 0; overflow: hidden; background: var(--bg); will-change: transform; }
.shard > * { pointer-events: none; }
.fx-caption {
  position: absolute; left: 0; right: 0; bottom: 18%; text-align: center; color: #fff;
  opacity: 0; transform: translateY(12px); transition: all .4s;
}
.fx-caption.on { opacity: 1; transform: none; }
.fx-caption .big { font-family: var(--display); font-size: clamp(28px, 10vw, 40px); letter-spacing: .02em; text-shadow: 0 4px 0 rgba(0,0,0,.4); }
.fx-caption .small { margin-top: 6px; padding: 0 16px; font-size: 14px; font-weight: 700; opacity: .85; }
.fx-skip { position: absolute; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); color: rgba(255,255,255,.7); font-size: 12px; }
.fx-glitch { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(139,47,214,.25) 0 2px, transparent 2px 5px); mix-blend-mode: multiply; animation: glitch .12s steps(2) infinite; }
@keyframes glitch { 50% { transform: translateX(6px); } }
.fx-warn { position: absolute; left: 16px; right: 16px; top: 22%; background: var(--tokutei); color: #fff; padding: 12px 14px; border-radius: 8px; font-weight: 800; font-size: 15px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.fx-phone { position: absolute; left: 50%; top: 45%; font-size: 120px; transform: translate(-50%,-50%); }
.fx-phone.throw { animation: throw .7s cubic-bezier(.3,0,.8,.6) forwards; }
@keyframes throw { to { transform: translate(-50%, 120%) rotate(540deg) scale(.6); } }
.fx-dat { position: absolute; inset: 0; background: rgba(40,42,48,0); display: grid; place-items: center; transition: background 1.2s; padding: 30px; }
.fx-dat.on { background: rgba(40,42,48,.88); }
.fx-dat .msg { color: #e8eaee; font-size: 15px; line-height: 1.9; text-align: center; min-height: 6em; }
.fx-kusa { position: absolute; top: -40px; font-family: var(--display); color: var(--kusa); animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(1000px) rotate(200deg); } }

/* ===== 結果 ===== */
.result-top { background: var(--paper); padding: 18px 16px; display: flex; gap: 16px; align-items: center; border-bottom: 1px solid var(--line); }
.rank { flex: none; width: 84px; height: 84px; border: 4px solid var(--aori); color: var(--aori); border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: 46px; transform: rotate(-8deg); animation: stamp .4s cubic-bezier(.2,1.6,.4,1); }
@keyframes stamp { from { transform: rotate(-8deg) scale(2.2); opacity: 0; } }
.result-top .verdict { font-family: var(--display); font-size: 19px; line-height: 1.35; word-break: keep-all; overflow-wrap: anywhere; }
.result-top .sub { font-size: 13px; color: var(--mute); margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--paper); border-bottom: 1px solid var(--line); }
.stats div { padding: 12px 8px; text-align: center; border-right: 1px solid var(--line); }
.stats div:last-child { border-right: 0; }
.stats b { display: block; font-size: clamp(17px, 5.5vw, 20px); font-variant-numeric: tabular-nums; }
.stats span { font-size: 11px; color: var(--mute); font-weight: 700; }
.matome-preview { padding: 14px 16px 4px; }
.matome-preview img { width: 100%; border-radius: 10px; box-shadow: 0 4px 18px rgba(0,0,0,.15); display: block; }
.btn-row { display: flex; gap: 8px; padding: 10px 16px; }
.btn-row button { flex: 1; padding: 12px; border-radius: 12px; font-weight: 800; font-size: 14px; background: var(--paper); border: 1.5px solid var(--line); }
.btn-row button.share { background: var(--ink); color: #fff; border-color: var(--ink); }

/* 記録 */
.record { background: var(--paper); padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.record b { font-variant-numeric: tabular-nums; }

/* ===== 画面サイズへの追従（viewport.js が #phone に付けるクラス） ===== */
/* 低い画面: ヘッダーと書き込み欄を詰め、候補は横スクロールの 1 列にしてスレ本文の場所を確保する */
#phone.compact .appbar { height: 40px; }
#phone.compact .thread-head { padding: 6px 12px; }
#phone.compact .thread-head h2 { -webkit-line-clamp: 1; font-size: 14px; }
#phone.compact .thread-meta { margin-top: 2px; }
#phone.compact .gauge { margin-top: 4px; }
#phone.compact .mission-goal { display: none; }
#phone.compact .chips { flex-direction: row; overflow-x: auto; overflow-y: hidden; gap: 6px; margin-bottom: 6px; scrollbar-width: none; }
#phone.compact .chips::-webkit-scrollbar { display: none; }
#phone.compact .chip { flex: none; width: auto; max-width: 78%; padding: 6px 10px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#phone.compact .chip > span:last-child { overflow: hidden; text-overflow: ellipsis; }
#phone.compact .res { padding: 8px 12px 10px; }
#phone.compact .hero { padding: 14px 16px 12px; }
#phone.compact .article .thumb { width: 56px; height: 56px; font-size: 24px; }
/* 狭い画面: 文字と余白を少し小さく */
#phone.narrow .res-b { font-size: 15px; }
#phone.narrow .article { gap: 10px; padding: 12px; }
#phone.narrow .article .thumb { width: 56px; height: 56px; font-size: 24px; }
#phone.narrow .result-top { gap: 12px; }
#phone.narrow .rank { width: 68px; height: 68px; font-size: 36px; }
#phone.narrow .input-row .send { padding: 0 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ===== ステージ一覧 ===== */
.article .thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.article.stage .ttl { font-size: 15px; }
.stage-no { font-family: var(--display); font-size: 12px; color: var(--brand); letter-spacing: .04em; display: flex; align-items: center; gap: 6px; }
.stage-no .new { font-family: var(--body); font-weight: 800; font-size: 10.5px; color: #fff; background: var(--aori); padding: 0 6px; border-radius: 3px; }
.article.stage.next { box-shadow: inset 4px 0 0 var(--brand); }
.article.stage.locked { cursor: default; }
.article.stage.locked .thumb { filter: grayscale(1) opacity(.45); }
.article.stage.locked .ttl, .article.stage.locked .desc { color: #a6abb5; }
.stars { color: #f0a400; font-size: 14px; letter-spacing: 1px; }
.stars .off { color: #d9dde4; }

/* ===== ステージの目標・縛り（スレ画面ヘッダー） ===== */
.goals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.goal-chip { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 12px; background: #eef0f3; color: var(--ink); font-variant-numeric: tabular-nums; }
.goal-chip.done { background: #e3f5e7; color: var(--kusa); }
.goal-chip.rule { background: #fde8e8; color: var(--aori); }
.chip.banned { background: #fff1f1; border-color: #f5c2c2; }
.chip.banned .ban { flex: none; font-size: 10.5px; font-weight: 800; color: var(--aori); border: 1px solid var(--aori); border-radius: 4px; padding: 0 4px; }
#phone.compact .goals { margin-top: 4px; gap: 4px; }
#phone.compact .goal-chip { font-size: 11px; padding: 2px 7px; }
.result-stars { font-size: 26px; margin-top: 4px; }
.rank.stage-rank { font-size: 19px; letter-spacing: 0; color: #f0a400; border-color: #f0a400; font-family: var(--body); }
.rank.stage-rank .off { color: #e3e6ea; }
.rank.stage-rank.fail { color: var(--mute); border-color: var(--mute); font-size: 40px; }

/* ===== v2 の終わり方 ===== */
.fx-dark { position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity 1.2s; }
.fx-dark.on { opacity: .82; }
.fx-dark.black { opacity: 1; transition-duration: .15s; }
.fx-sound { position: absolute; left: 0; right: 0; top: 42%; text-align: center; color: #e8eaee; font-family: var(--display); font-size: clamp(22px, 7vw, 32px); letter-spacing: .1em; }
.fx-overbar { position: absolute; background: var(--aori); border-radius: 4px; box-shadow: 0 0 18px rgba(224,36,36,.8); }
.fx-overbar.piece { box-shadow: none; }
.fx-police { position: absolute; inset: 0; opacity: 0; transition: opacity 1.5s; background: radial-gradient(circle at 15% 30%, rgba(255,30,30,.75), transparent 55%), radial-gradient(circle at 85% 30%, rgba(30,80,255,.75), transparent 55%); animation: police .5s steps(1) infinite; }
.fx-police.on { opacity: 1; }
@keyframes police { 50% { background: radial-gradient(circle at 15% 30%, rgba(30,80,255,.75), transparent 55%), radial-gradient(circle at 85% 30%, rgba(255,30,30,.75), transparent 55%); } }
@media (prefers-reduced-motion: reduce) { .fx-police { animation: none; } }

/* ===== v2: スレ画面の演出 ===== */
.screen { --stress: 0; }
.stress-layer { position: absolute; inset: 0; z-index: 15; pointer-events: none; opacity: 0; transition: opacity .6s;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,calc(var(--stress) * .75)) 100%); }
.stressed .stress-layer { opacity: 1; }
.stress-layer::before { content: ""; position: absolute; inset: 0; opacity: calc(var(--stress) * .35);
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.12) 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, rgba(255,0,60,.05) 0 2px, transparent 2px 7px);
  mix-blend-mode: multiply; animation: vhs .18s steps(2) infinite; }
@keyframes vhs { 50% { transform: translateY(2px); } }
.stressed .res-b { text-shadow: calc(var(--stress) * 2.2px) 0 rgba(255,0,40,.45), calc(var(--stress) * -2.2px) 0 rgba(0,120,255,.45); }
.stressed-hard .scroll { animation: jitter 2.6s infinite; }
@keyframes jitter { 0%, 93%, 100% { transform: none; filter: none; } 94% { transform: translateX(-4px) skewX(-2deg); filter: hue-rotate(40deg); } 96% { transform: translateX(5px); } 98% { transform: translateX(-2px) skewX(1deg); } }
.fx-slam { position: absolute; left: 50%; top: 45%; z-index: 35; width: min(92%, 400px); pointer-events: none; transform: translate(-50%, -50%); }
.fx-slam .res { box-shadow: 0 16px 50px rgba(0,0,0,.45); border-radius: 10px; border: 0; }
.fx-slam .res-b { font-size: clamp(22px, 7vw, 30px) !important; font-weight: 800; line-height: 1.4; }
.fx-danmaku { position: absolute; inset: 0; z-index: 34; pointer-events: none; overflow: hidden; }
.fx-danmaku span { position: absolute; left: 100%; white-space: nowrap; font-weight: 800; color: #fff; -webkit-text-stroke: 1px rgba(0,0,0,.6); text-shadow: 0 2px 4px rgba(0,0,0,.4); }
.res-event { font-size: 10.5px; font-weight: 800; color: #fff; background: #6b5bd6; padding: 0 6px; border-radius: 3px; }
.res-event.shift { background: var(--brand); }
.res-event.warn { background: #9aa0aa; }
.photo-attach { margin-top: 6px; display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px; background: #e2e5ea; color: #4d525c; font-size: 13px; }
.input-row .photo { flex: none; height: 40px; padding: 0 10px; border-radius: 20px; background: #eef0f3; color: var(--ink); font-weight: 800; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .stress-layer::before { animation: none; } .stressed-hard .scroll { animation: none; } }

/* ===== v2: 設定・過去ログ ===== */
.settings { background: var(--paper); border-top: 1px solid var(--line); }
.toggle { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toggle-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.toggle-text b { font-size: 15px; }
.toggle-text small { font-size: 12px; color: var(--mute); }
.toggle-knob { flex: none; width: 46px; height: 28px; border-radius: 14px; background: #cfd4db; position: relative; transition: background .2s; }
.toggle-knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.toggle[aria-checked="true"] .toggle-knob { background: var(--brand); }
.toggle[aria-checked="true"] .toggle-knob::after { transform: translateX(18px); }
.article.log .new { background: #5a6170; }
.article.log .new.end-win, .article.log .new.end-clear { background: var(--kusa); }
.article.log .new.end-doxxed, .article.log .new.end-exposed, .article.log .new.end-police, .article.log .new.end-ronpa { background: var(--aori); }
.empty { padding: 32px 20px; color: var(--mute); font-size: 14px; line-height: 1.8; text-align: center; }
.compact-row { padding: 0; }
.hero h1 .k { color: var(--brand); }
#phone.narrow .photo-label { display: none; }
#phone.narrow .input-row .photo { padding: 0 10px; }
#phone.narrow .input-row textarea { padding: 9px 10px; }

/* ===== 返信の出方（v2.2）: 反応ごとに入り方を変える。短いレスは軽く流す ===== */
.res.in-quick { animation: res-quick .18s ease-out; }
@keyframes res-quick { from { opacity: 0; } }
.res.in-kusa { animation: in-kusa .42s cubic-bezier(.2,1.4,.4,1); }
@keyframes in-kusa { 0% { opacity: 0; transform: scale(.92); } 60% { opacity: 1; transform: scale(1.03); } }
.res.in-aori { animation: in-aori .3s cubic-bezier(.2,.9,.3,1), flash-aori 1s ease-out; }
@keyframes in-aori { from { opacity: 0; transform: translateX(28px); } }
@keyframes flash-aori { 0% { background-color: rgba(224,36,36,.14); box-shadow: inset 4px 0 0 var(--aori); } 100% { background-color: transparent; box-shadow: inset 4px 0 0 transparent; } }
.res.in-majire { animation: in-majire .34s ease-out, flash-majire 1.1s ease-out; }
@keyframes in-majire { from { opacity: 0; transform: translateY(-8px); } }
@keyframes flash-majire { 0% { background-color: rgba(31,95,224,.12); box-shadow: inset 4px 0 0 var(--majire); } 100% { background-color: transparent; box-shadow: inset 4px 0 0 transparent; } }
.res.in-doucho { animation: res-in .4s ease-out, flash-doucho 1.2s ease-out; }
@keyframes flash-doucho { 0% { background-color: rgba(31,157,58,.14); } 100% { background-color: transparent; } }
.res.in-tokutei { animation: flash-tokutei 1.4s ease-out; }
@keyframes flash-tokutei { 0% { background-color: rgba(60,20,90,.24); box-shadow: inset 4px 0 0 var(--tokutei); } 100% { background-color: transparent; box-shadow: inset 4px 0 0 transparent; } }
.res.in-neutral { animation: res-in .32s ease-out; }
.res-b.decoding { color: var(--tokutei); font-family: ui-monospace, monospace; }
/* 草: 「ｗ」が浮かんで消える */
.res .float-w { position: absolute; right: 18px; top: 4px; font-weight: 900; font-size: 18px; color: var(--kusa); pointer-events: none; animation: float-w .95s ease-out forwards; }
@keyframes float-w { 0% { opacity: 0; transform: translateY(6px) scale(.8); } 25% { opacity: 1; } 100% { opacity: 0; transform: translateY(-20px) scale(1.15); } }
/* スレ主宛ての >>番号 が光る / 掛け合いの返信先のレスが光る */
.res-b .anc.ping { animation: ping 1.1s ease-out; border-radius: 3px; }
@keyframes ping { 0%, 35% { background: #ffe066; } 100% { background: transparent; } }
.res.pinged { animation: pinged 1.1s ease-out; }
@keyframes pinged { 0%, 30% { box-shadow: inset 0 0 0 2px var(--anchor); background-color: rgba(0,0,238,.06); } 100% { box-shadow: inset 0 0 0 2px transparent; background-color: transparent; } }
/* メンタルの増減 */
.delta { animation: delta-pop .45s cubic-bezier(.2,1.6,.4,1); }
@keyframes delta-pop { from { transform: scale(0); opacity: 0; } }
.gauge.mental.hit .bar { animation: g-hit .5s ease-out; }
.gauge.mental.heal .bar { animation: g-heal .5s ease-out; }
@keyframes g-hit { 0% { box-shadow: 0 0 0 3px rgba(224,36,36,.55); } 100% { box-shadow: 0 0 0 3px transparent; } }
@keyframes g-heal { 0% { box-shadow: 0 0 0 3px rgba(31,157,58,.5); } 100% { box-shadow: 0 0 0 3px transparent; } }
/* 草のコンボ（草が続くと大きくなる） */
.combo { position: absolute; right: 12px; z-index: 6; font-family: var(--display); color: var(--kusa); font-size: min(30px, calc(15px + var(--n, 2) * 2px)); background: rgba(255,255,255,.92); border: 2px solid var(--kusa); border-radius: 999px; padding: 2px 12px; pointer-events: none; opacity: 0; transform: scale(.7); transition: opacity .25s, transform .25s; }
.combo.show { opacity: 1; transform: scale(1); }
.combo.bump { animation: bump .28s cubic-bezier(.2,1.6,.4,1); }
@keyframes bump { 0% { transform: scale(1.35); } 100% { transform: scale(1); } }
/* 早送りの案内（最初の数ターンだけ） */
.skip-hint { position: sticky; bottom: 8px; margin: -26px 12px 0 auto; width: max-content; font-size: 11.5px; color: #fff; background: rgba(0,0,0,.55); padding: 3px 10px; border-radius: 999px; pointer-events: none; opacity: 0; transition: opacity .3s; }
.skip-hint.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .res[class*="in-"], .delta, .res .float-w, .res-b .anc.ping, .res.pinged, .combo.bump, .gauge.mental .bar { animation: none !important; }
}
/* 引用（> で始まる行） */
.res-b .q { color: #5b6270; }
