:root {
  --bg: #120e26;
  --bg2: #1b1636;
  --panel: #231c44;
  --panel2: #2c2453;
  --line: #3b3268;
  --text: #f1edff;
  --sub: #b5acd9;
  --dim: #7d74a8;
  --accent: #b77bff;
  --accent2: #ff7fbf;
  --gold: #ffd27a;
  --good: #7fe0b4;
  --bad: #ff8a9a;
  --wolf: #ff6b81;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --radius: 14px;
  font-family: 'M PLUS Rounded 1c', system-ui, -apple-system, 'Hiragino Sans', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input { font: inherit; }
.hidden { display: none !important; }
#app { position: fixed; inset: 0; overflow: hidden; }
.scr { position: absolute; inset: 0; display: none; }
.scr.on { display: block; }
.scr-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pixel-bg { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.ic { display: block; flex: none; }

/* ボタン */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 24px; border-radius: 999px; font-weight: 800; font-size: 16px; letter-spacing: .04em; transition: transform .08s, background .2s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, #a46bff, #ff6fb1); color: #fff; box-shadow: 0 6px 20px rgba(183, 123, 255, .35); }
.btn-ghost { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18); }
.btn-sm { min-height: 42px; font-size: 14px; padding: 0 18px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--sub); }
.icon-btn:active { background: rgba(255, 255, 255, .08); }

/* タイトル */
#scr-title .title-box { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 24px 24px calc(28px + var(--safe-b)); text-align: center; }
.logo { display: flex; flex-direction: column; align-items: center; margin-bottom: 6px; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .45)); }
.logo-l { font-family: 'DotGothic16', monospace; font-size: 26px; color: var(--gold); letter-spacing: .1em; }
.logo-w { font-family: 'DotGothic16', monospace; font-size: 46px; line-height: 1.05; color: #fff; text-shadow: 3px 0 0 #b77bff, -3px 0 0 #ff6fb1, 0 3px 0 #3a2d6e; letter-spacing: .02em; }
.title-sub { font-family: 'DotGothic16', monospace; color: var(--sub); margin: 8px 0 22px; font-size: 14px; letter-spacing: .08em; }
.title-btns { display: flex; flex-direction: column; gap: 12px; width: min(320px, 100%); }
.title-row { display: flex; gap: 10px; }
.title-row .btn { flex: 1; }
.title-ver { color: var(--dim); font-size: 11px; margin: 14px 0 0; }
.title-ver button { color: var(--sub); text-decoration: underline; font-size: 11px; margin-left: 6px; }

/* 設定 */
.setup { max-width: 560px; margin: 0 auto; padding: calc(20px + var(--safe-t)) 16px calc(28px + var(--safe-b)); }
.setup-h { font-family: 'DotGothic16', monospace; font-weight: 400; font-size: 24px; margin: 6px 0 18px; text-align: center; }
.field { display: block; margin-bottom: 20px; }
.field-l { display: block; font-size: 13px; color: var(--sub); margin-bottom: 8px; font-weight: 700; }
.field-hint { display: block; font-size: 12px; color: var(--dim); margin-top: 6px; min-height: 1em; }
.field input { width: 100%; height: 50px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); padding: 0 14px; font-size: 18px; -webkit-user-select: text; user-select: text; }
.field input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.seg { display: flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; height: 42px; border-radius: 9px; font-weight: 700; color: var(--sub); }
.seg button.on { background: var(--panel2); color: #fff; box-shadow: inset 0 0 0 1px var(--accent); }
.presets { display: grid; gap: 10px; }
.preset { text-align: left; padding: 14px; border-radius: var(--radius); background: var(--bg2); border: 1px solid var(--line); }
.preset.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--panel); }
.preset b { display: block; font-size: 16px; margin-bottom: 4px; }
.preset span { display: block; font-size: 12px; color: var(--sub); line-height: 1.5; }
.preset .roles { color: var(--gold); margin-top: 6px; }
.setup-btns { display: flex; gap: 10px; margin-top: 8px; }
.setup-btns .btn { flex: 1; }

/* 物語 */
#scr-story { background: #000; }
.story-bg { position: absolute; inset: 0; background-size: cover; background-position: center; filter: brightness(.75); }
.story-stand { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); height: min(62vh, 520px); max-width: 90%; object-fit: contain; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .5)); transition: opacity .25s; }
.story-stand.dim { opacity: 0; }
.story-skip { position: absolute; top: calc(12px + var(--safe-t)); right: 12px; padding: 8px 14px; border-radius: 999px; background: rgba(0, 0, 0, .45); color: #fff; font-size: 13px; z-index: 3; }
.story-box { position: absolute; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); min-height: 136px; background: rgba(18, 14, 38, .92); border: 1px solid rgba(255, 255, 255, .15); border-radius: 16px; padding: 18px 18px 22px; z-index: 2; }
.story-name { position: absolute; top: -14px; left: 14px; padding: 4px 14px; border-radius: 999px; font-weight: 800; font-size: 14px; background: var(--panel2); }
.story-name:empty { display: none; }
.story-text { margin: 0; font-size: 16px; line-height: 1.75; min-height: 3.5em; }
.story-text.narr { color: var(--sub); }
.story-next { position: absolute; right: 16px; bottom: 6px; font-size: 12px; color: var(--sub); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* 役職発表 */
.role-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px 20px calc(24px + var(--safe-b)); }
.role-pre { font-family: 'DotGothic16', monospace; color: var(--sub); margin: 0; }
.role-card { width: min(340px, 100%); background: rgba(27, 22, 54, .94); border: 2px solid var(--accent); border-radius: 20px; padding: 22px 18px; text-align: center; animation: pop .45s cubic-bezier(.2, 1.4, .4, 1); }
.role-card .ric { width: 64px; height: 64px; margin: 0 auto 8px; display: grid; place-items: center; border-radius: 50%; background: var(--panel2); color: var(--gold); }
.role-card h2 { font-family: 'DotGothic16', monospace; font-weight: 400; font-size: 34px; margin: 0 0 4px; }
.role-card .team { font-size: 13px; color: var(--sub); margin-bottom: 12px; }
.role-card p { font-size: 14px; line-height: 1.7; margin: 0; text-align: left; }
.role-card .mates { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; }
.role-card .mates .faces { display: flex; justify-content: center; gap: 10px; margin-top: 8px; }
.role-card.wolf { border-color: var(--wolf); }
.role-card.wolf h2 { color: var(--wolf); }
@keyframes pop { from { transform: scale(.6) rotateY(80deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* ゲーム画面 */
#scr-game { display: none; flex-direction: column; background: radial-gradient(120% 60% at 50% 0%, #241c4a 0%, var(--bg) 70%); }
#scr-game.on { display: flex; }
.g-head { flex: none; display: flex; align-items: center; gap: 8px; padding: calc(6px + var(--safe-t)) 8px 6px 12px; background: rgba(18, 14, 38, .85); border-bottom: 1px solid var(--line); }
.g-day { font-family: 'DotGothic16', monospace; font-size: 17px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.g-day .ic { color: var(--gold); }
.g-role { margin-left: auto; display: flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 12px; font-weight: 700; white-space: nowrap; }
.g-role.wolf { border-color: var(--wolf); color: #ffd0d8; }
.g-head-r { display: flex; }
.g-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.g-center { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.g-side { display: none; }

/* 参加者の顔ならび */
.g-players { flex: none; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px 2px; padding: 8px 6px 6px; border-bottom: 1px solid var(--line); background: rgba(18, 14, 38, .5); }
.pl { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 2px 0; border-radius: 10px; }
.pl:active { background: rgba(255, 255, 255, .06); }
.pl .face { position: relative; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; border: 2px solid var(--pc, var(--line)); background: var(--panel2); }
.pl .face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pl .nm { font-size: 10px; line-height: 1.1; color: var(--sub); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.pl.me .nm { color: #fff; }
.pl.dead .face { filter: grayscale(1) brightness(.45); }
.pl.dead .nm { text-decoration: line-through; color: var(--dim); }
.pl .x { position: absolute; inset: 0; display: grid; place-items: center; color: #ff8a9a; font-size: 26px; font-weight: 800; text-shadow: 0 1px 2px #000; }
.pl .badge { position: absolute; top: -2px; right: calc(50% - 30px); min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; font-size: 10px; font-weight: 800; display: grid; place-items: center; background: var(--gold); color: #2a1a00; box-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.pl .badge.b2 { top: auto; bottom: 14px; background: #fff; color: #222; }
.pl .badge.wolfmate { background: var(--wolf); color: #fff; }
.pl .badge.black { background: #1a1a1a; color: #fff; border: 1px solid #fff; }
.pl .badge.white { background: #fff; color: #333; }
.pl .memo { position: absolute; top: -2px; left: calc(50% - 30px); width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--bg); }
.pl .memo.m1 { background: #fff; }
.pl .memo.m2 { background: #111; box-shadow: 0 0 0 1px #fff; }
.pl .memo.m3 { background: var(--gold); }
.pl.speaking .face { box-shadow: 0 0 0 3px var(--gold); }
.pl.target .face { box-shadow: 0 0 0 3px var(--accent2); }

/* ログ（会話） */
.log { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 10px 16px; display: flex; flex-direction: column; gap: 8px; }
.msg { display: flex; gap: 8px; align-items: flex-start; animation: fadeup .25s ease-out; max-width: 760px; }
@keyframes fadeup { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg .mf { flex: none; width: 34px; height: 34px; border-radius: 50%; overflow: hidden; border: 2px solid var(--pc, var(--line)); background: var(--panel2); }
.msg .mf img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msg .mb { min-width: 0; }
.msg .mn { font-size: 11px; font-weight: 800; color: var(--pc, var(--sub)); margin: 0 0 2px 2px; }
.msg .mt { background: var(--panel); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 8px 12px; font-size: 15px; line-height: 1.6; word-break: break-word; }
.msg.you { flex-direction: row-reverse; margin-left: auto; }
.msg.you .mn { text-align: right; margin: 0 2px 2px 0; }
.msg.you .mt { background: #3b2a6e; border-color: #5a43a0; border-radius: 14px 4px 14px 14px; }
.msg.narr { align-self: center; max-width: 92%; }
.msg.narr .mt { background: transparent; border: 0; color: var(--sub); text-align: center; font-size: 14px; padding: 4px 8px; }
.msg.narr.big .mt { font-family: 'DotGothic16', monospace; color: var(--gold); font-size: 18px; padding: 10px 8px 2px; }
.msg.narr.death .mt { color: var(--bad); }
.msg.sys { align-self: center; }
.msg.sys .mt { background: rgba(255, 255, 255, .05); border: 1px dashed var(--line); color: var(--sub); font-size: 12px; border-radius: 999px; padding: 4px 14px; }
.msg.sys.good .mt { color: var(--good); border-color: var(--good); }
.msg.sys.bad .mt { color: var(--bad); border-color: var(--bad); }
.msg.flag .mt { box-shadow: 0 0 0 2px var(--gold) inset; }
.log-end { height: 4px; flex: none; }

/* 下の操作バー */
.g-bar { flex: none; display: grid; grid-template-columns: 56px 1fr 1fr; gap: 8px; padding: 8px 10px calc(8px + var(--safe-b)); background: rgba(18, 14, 38, .92); border-top: 1px solid var(--line); }
.bar-btn { height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 800; font-size: 15px; background: var(--panel); border: 1px solid var(--line); position: relative; }
.bar-btn:active { transform: scale(.97); }
.bar-btn.on { color: var(--gold); border-color: var(--gold); }
.bar-say { background: linear-gradient(135deg, #7a4fe0, #b45bd6); border: 0; color: #fff; }
.bar-say[disabled] { opacity: .35; }
.bar-say .cnt { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: rgba(0, 0, 0, .3); font-size: 12px; }
.bar-say .free { position: absolute; top: -8px; right: -4px; background: var(--gold); color: #2a1a00; font-size: 10px; padding: 2px 6px; border-radius: 8px; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.bar-next.vote { background: linear-gradient(135deg, #ff6fb1, #ff9a6b); border: 0; color: #fff; }
.bar-next.wait { color: var(--sub); }

/* 下から出るパネル */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-bg { position: absolute; inset: 0; background: rgba(5, 3, 15, .55); animation: fadein .2s; }
@keyframes fadein { from { opacity: 0; } }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 86%; display: flex; flex-direction: column; background: var(--bg2); border-radius: 20px 20px 0 0; border-top: 1px solid var(--line); box-shadow: 0 -10px 40px rgba(0, 0, 0, .5); animation: slideup .25s cubic-bezier(.2, .9, .3, 1); padding-bottom: var(--safe-b); }
@keyframes slideup { from { transform: translateY(100%); } }
.sheet-head { flex: none; display: flex; align-items: center; gap: 4px; padding: 8px 6px 4px; }
.sheet-head h3 { flex: 1; margin: 0; text-align: center; font-size: 16px; font-weight: 800; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 14px 18px; }
.sheet-note { font-size: 12px; color: var(--sub); margin: 0 0 10px; line-height: 1.6; }

.acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 78px; padding: 8px 4px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; font-weight: 800; text-align: center; position: relative; }
.act .ic { color: var(--accent); }
.act small { font-weight: 400; font-size: 10px; color: var(--sub); }
.act.free::after { content: '無料'; position: absolute; top: 4px; right: 4px; font-size: 9px; padding: 1px 5px; border-radius: 6px; background: var(--gold); color: #2a1a00; }
.act.hot { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.act[disabled] { opacity: .35; }

.pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pick .pl { padding: 6px 0; border: 1px solid transparent; background: var(--panel); }
.pick .pl.sel { border-color: var(--accent2); background: var(--panel2); }
.pick .pl .face { width: 50px; height: 50px; }
.pick .pl .nm { font-size: 11px; }
.pick .pl .sub2 { font-size: 10px; color: var(--gold); }

.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { text-align: left; padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 14px; line-height: 1.55; display: flex; gap: 10px; align-items: flex-start; }
.opt.sel { border-color: var(--accent2); background: var(--panel2); }
.opt .ofc { flex: none; width: 28px; height: 28px; border-radius: 50%; overflow: hidden; border: 2px solid var(--pc, var(--line)); }
.opt .ofc img { width: 100%; height: 100%; object-fit: cover; }
.opt .tag { flex: none; font-size: 10px; padding: 2px 6px; border-radius: 6px; background: var(--panel2); color: var(--gold); font-weight: 800; margin-top: 2px; }
.opt .tag.weak { color: var(--dim); }
.opt.disabled { opacity: .4; pointer-events: none; }
.preview { margin: 14px 0 10px; padding: 12px 14px; border-radius: 12px; background: #3b2a6e; border: 1px solid #5a43a0; font-size: 14px; line-height: 1.6; }
.preview::before { content: 'あなた：'; display: block; font-size: 11px; color: var(--sub); margin-bottom: 2px; font-weight: 800; }
.send { width: 100%; margin-top: 4px; }
.sub-h { font-size: 12px; color: var(--sub); font-weight: 800; margin: 14px 0 8px; }
.sub-h:first-child { margin-top: 0; }
.wb { display: flex; gap: 8px; }
.wb button { flex: 1; height: 44px; border-radius: 12px; font-weight: 800; background: var(--panel); border: 1px solid var(--line); }
.wb button.on.w { background: #fff; color: #222; }
.wb button.on.b { background: #111; color: #fff; border-color: #fff; }

/* 記録 */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button { flex: 1; height: 38px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--sub); }
.tabs button.on { color: #fff; border-color: var(--accent); }
.rec-day { margin-bottom: 14px; }
.rec-day h4 { margin: 0 0 6px; font-size: 13px; color: var(--gold); font-family: 'DotGothic16', monospace; font-weight: 400; }
.rec-row { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 0; border-bottom: 1px dashed rgba(255, 255, 255, .06); }
.rec-row .arrow { color: var(--dim); }
.rec-row .cnt { margin-left: auto; color: var(--sub); font-size: 12px; }
.rec-row.exec { color: var(--bad); }
.mini { display: inline-flex; align-items: center; gap: 4px; }
.mini img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; border: 1px solid var(--pc, var(--line)); }
.claim-card { padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 8px; }
.claim-card.broken { border-color: var(--bad); }
.claim-card .ch { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; }
.claim-card .ch .role { font-size: 11px; padding: 2px 8px; border-radius: 8px; background: var(--panel2); color: var(--gold); }
.claim-card .res { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 12px; }
.claim-card .res span { padding: 2px 8px; border-radius: 8px; background: rgba(255, 255, 255, .06); }
.claim-card .res span.b { background: #111; color: #fff; border: 1px solid #888; }
.claim-card .res span.w { background: #eee; color: #222; }
.claim-card .warn { color: var(--bad); font-size: 12px; margin-top: 6px; }
.empty { color: var(--dim); font-size: 13px; text-align: center; padding: 18px 0; }

/* 人物の詳細 */
.who { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.who img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 3px solid var(--pc, var(--line)); }
.who b { font-size: 18px; display: block; }
.who span { font-size: 12px; color: var(--sub); }
.memo-row { display: flex; gap: 8px; margin: 10px 0 4px; }
.memo-row button { flex: 1; height: 40px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.memo-row button.on { border-color: var(--accent2); color: #fff; background: var(--panel2); }

/* 夜 */
#scr-night { background: #07051a; }
.night-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: calc(16px + var(--safe-t)) 14px calc(16px + var(--safe-b)); }
.night-card { background: rgba(14, 10, 34, .92); border: 1px solid var(--line); border-radius: 18px; padding: 16px; max-width: 560px; width: 100%; margin: 0 auto; max-height: 72%; overflow-y: auto; }
.night-title { font-family: 'DotGothic16', monospace; font-size: 22px; text-align: center; margin: 0 0 6px; color: var(--gold); }
.night-text { text-align: center; font-size: 14px; color: var(--sub); margin: 0 0 12px; line-height: 1.6; }
.night-result { text-align: center; font-size: 17px; margin: 12px 0; line-height: 1.6; }
.night-result b.b { color: var(--wolf); }
.night-result b.w { color: var(--good); }
.wolfchat { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.night-card .btn { width: 100%; margin-top: 12px; }

/* 開票 */
.tally { display: flex; flex-direction: column; gap: 6px; }
.tally .rec-row { animation: fadeup .2s both; }
.tally-sum { margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--panel); text-align: center; font-size: 15px; line-height: 1.7; }
.tally-sum b { color: var(--bad); }

/* 結果 */
.result { max-width: 680px; margin: 0 auto; padding: calc(24px + var(--safe-t)) 16px calc(28px + var(--safe-b)); text-align: center; }
.result h2 { font-family: 'DotGothic16', monospace; font-weight: 400; font-size: 30px; margin: 4px 0; }
.result .win { color: var(--gold); }
.result .lose { color: var(--sub); }
.result .rteam { font-size: 15px; color: var(--sub); margin-bottom: 18px; }
.reveal { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0 20px; }
.reveal .rv { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.reveal .rv img { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; border: 2px solid var(--pc, var(--line)); }
.reveal .rv.dead img { filter: grayscale(.8) brightness(.7); }
.reveal .rv .n { font-size: 11px; font-weight: 700; }
.reveal .rv .r { font-size: 11px; padding: 1px 8px; border-radius: 8px; background: var(--panel); color: var(--sub); }
.reveal .rv .r.wolf, .reveal .rv .r.madman { background: #4a1d2a; color: #ffc4cf; }
.reveal .rv .r.fox { background: #4a3a10; color: var(--gold); }
.reveal .rv .r.seer, .reveal .rv .r.medium, .reveal .rv .r.knight { background: #1d3a4a; color: #bde9ff; }
.result-btns { display: flex; flex-direction: column; gap: 10px; max-width: 320px; margin: 0 auto; }
.stat-box { margin: 10px auto 20px; max-width: 360px; font-size: 13px; color: var(--sub); line-height: 1.8; }

/* 遊び方 */
.howto h4 { margin: 16px 0 6px; font-size: 14px; color: var(--gold); }
.howto p, .howto li { font-size: 13px; line-height: 1.75; color: var(--text); }
.howto ul { padding-left: 18px; margin: 4px 0; }

.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); z-index: 80; background: rgba(40, 32, 80, .96); border: 1px solid var(--accent); padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 700; max-width: 90%; text-align: center; animation: fadeup .2s; }

/* ───── PC・横長画面 ───── */
@media (min-width: 900px) {
  .g-main { flex-direction: row; }
  .g-players { width: 230px; grid-template-columns: 1fr; align-content: start; gap: 2px; padding: 10px 8px; border-bottom: 0; border-right: 1px solid var(--line); overflow-y: auto; }
  .g-players .pl { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 5px 8px; }
  .g-players .pl .nm { font-size: 13px; }
  .g-players .pl .face { width: 40px; height: 40px; }
  .g-players .pl .badge { right: auto; left: 34px; }
  .g-players .pl .memo { left: 2px; }
  .g-players .pl .info { font-size: 11px; color: var(--dim); }
  .g-side { display: block; width: 320px; border-left: 1px solid var(--line); overflow-y: auto; padding: 12px; background: rgba(18, 14, 38, .5); }
  .log { padding: 16px 20px; }
  .msg .mt { font-size: 15px; }
  .g-bar { grid-template-columns: 64px 1fr 1fr; max-width: 760px; width: 100%; margin: 0 auto; border-top: 0; background: transparent; }
  .sheet-panel { left: 50%; right: auto; width: 560px; transform: translateX(-50%); bottom: 24px; border-radius: 20px; border: 1px solid var(--line); max-height: 84%; animation: fadein .2s; }
  .acts { grid-template-columns: repeat(4, 1fr); }
  .pick { grid-template-columns: repeat(6, 1fr); }
  .story-box { left: 50%; right: auto; width: 720px; transform: translateX(-50%); }
  .reveal { grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 899px) {
  .g-players .pl .info { display: none; }
}
@media (max-height: 640px) and (max-width: 899px) {
  .g-players .pl .face { width: 36px; height: 36px; }
  .g-players { gap: 2px; padding: 4px 4px; }
  .bar-btn { height: 46px; }
}

/* ───── 追加：引用・タップできる吹き出し・あなたの番 ───── */
.quote { display: block; margin: 0 0 4px; padding: 5px 10px; border-left: 3px solid var(--pc, var(--line)); background: rgba(255, 255, 255, .05); border-radius: 6px; font-size: 12px; color: var(--sub); line-height: 1.5; }
.quote b { color: var(--pc, var(--sub)); margin-right: 4px; font-size: 11px; }
.quote.big { font-size: 14px; color: var(--text); margin-bottom: 14px; }
.msg.tappable .mt { cursor: pointer; }
.msg.tappable .mt:active { filter: brightness(1.25); }
.msg.sys.turn .mt { border-style: solid; border-color: var(--gold); color: var(--gold); }
.bar-next.wait { border-color: var(--gold); color: var(--gold); animation: pulse 1.2s infinite; }
.free-box { margin-bottom: 14px; padding: 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--accent); }
.free-box .sub-h { margin-top: 0; color: var(--accent); }
.free-in { width: 100%; resize: none; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); padding: 10px; font: inherit; font-size: 15px; -webkit-user-select: text; user-select: text; margin-bottom: 8px; }
.free-in:focus { outline: 2px solid var(--accent); border-color: transparent; }
.prog { height: 10px; border-radius: 5px; background: var(--panel); overflow: hidden; margin: 10px 0; }
.prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #a46bff, #ff6fb1); transition: width .3s; }
.night-pick { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 6px 0; }
.face.big { width: 84px; height: 84px; border-radius: 50%; overflow: hidden; border: 3px solid var(--pc, var(--line)); }
.face.big img { width: 100%; height: 100%; object-fit: cover; }
.night-card .btn + .btn { margin-top: 8px; }
.wolfchat .msg .mt { font-size: 14px; }
/* 立ち絵：イメージカラーの枠 */
.story-stand { width: auto; height: min(56vh, 470px); border: 4px solid var(--sc, #fff); border-radius: 18px; background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, .22), rgba(18, 14, 38, .55)); box-shadow: 0 0 0 3px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .5); filter: none; }
/* PC：左の名前をそろえる */
@media (min-width: 900px) {
  .g-players .pl { text-align: left; }
  .g-players .pl > div:not(.face) { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
  .g-players .pl .nm { text-align: left; }
}

.ollama-opts { margin-top: 10px; }
.ollama-opts input { width: 100%; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); padding: 0 12px; font-size: 15px; -webkit-user-select: text; user-select: text; }
.seg button[disabled] { opacity: .35; }
