/* 人狼（CPUと1人で）。共通の見た目は ../common/base.css、方針は site/DESIGN.md */
:root {
  --day-board: #EEF1E4;      /* 昼の村の地（うすい草色） */
  --night-board: #3A4660;    /* 夜の村の地（落ち着いた紺） */
  --night-edge: #4A5A7C;
  --night-ink: #E9ECF4;
  --team-v: var(--p-blue);
  --team-w: var(--p-red);
  --me-soft: #EAF1F8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --day-board: #2E332A; --night-board: #262D3D; --night-edge: #8295BC; --me-soft: #26313D; }
}
:root[data-theme="dark"] { --day-board: #2E332A; --night-board: #262D3D; --night-edge: #8295BC; --me-soft: #26313D; }

.stage { padding: 12px; }
.board-wrap { max-width: 640px; margin: 0 auto; background: var(--day-board); border-radius: var(--radius); padding: 10px; transition: background-color .4s; }
.stage[data-time="night"] .board-wrap { background: var(--night-board); }
@media (prefers-reduced-motion: reduce) { .board-wrap { transition: none; } }

/* 村の人たち */
.village { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); gap: 8px; }
.seat {
  appearance: none; font: inherit; color: var(--ink); position: relative; display: flex; flex-direction: column; align-items: center;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 4px 4px 6px; min-height: 44px; cursor: default;
  transition: border-color var(--dur), background-color var(--dur), opacity var(--dur);
}
.seat:disabled { opacity: 1; }
.seat .face { width: 100%; max-width: 104px; aspect-ratio: 1; height: auto; object-fit: contain; display: block; }
.seat .name { font-weight: 700; font-size: 15px; line-height: 1.3; margin-top: 2px; }
.seat.you .name { color: var(--accent); }
.seat .num { position: absolute; left: 4px; top: 2px; font-size: 13px; font-weight: 700; color: var(--ink-sub); }
.seat .tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; margin-top: 3px; }
.tag { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; line-height: 1.5; padding: 0 5px; border-radius: 4px; border: 1px solid var(--line-strong); background: var(--surface); white-space: nowrap; }
.tag.gone, .tag.mine { white-space: normal; text-align: center; }
.stage .tag .ricon { width: 14px; height: 14px; }
.tag.co { border-color: var(--accent); color: var(--accent); font-weight: 700; border-radius: 10px 10px 10px 2px; }
.tag.role { border-width: 2px; }
.tag.role { font-weight: 700; }
.tag.role.r-wolf, .tag.role.r-madman { color: var(--ng); border-color: var(--ng); }
.tag.role.r-villager, .tag.role.r-seer, .tag.role.r-medium, .tag.role.r-knight { color: var(--team-v); border-color: var(--team-v); }
.tag.mine.black { background: var(--ng); border-color: var(--ng); color: #fff; font-weight: 700; }
.tag.mine.white { background: var(--team-v); border-color: var(--team-v); color: #fff; font-weight: 700; }
.tag.mine.black .ricon { stroke: #fff; }
.tag.gone { color: var(--ink-sub); border-style: dashed; }
.seat.out .face { filter: grayscale(1); opacity: .4; }
.seat.out .name { color: var(--ink-sub); }
.seat.speaking { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.seat.pickable { border-color: var(--accent); border-style: dashed; cursor: pointer; }
.seat.pickable:hover { background: var(--accent-soft); }
.seat.marked { background: var(--accent-soft); }
.seat:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
.seat .votes {
  position: absolute; right: 2px; top: 2px; z-index: 1; min-width: 30px; padding: 0 6px; border-radius: 999px;
  background: var(--warn); color: #fff; font-weight: 800; font-size: 14px; line-height: 1.7; text-align: center;
}
.stage[data-time="night"] .seat:not(.out) { border-color: var(--night-edge); }

/* 役職の印 */
.st-in { display: inline; }
.st-in .ricon { margin-right: 6px; }
.ricon, .stage .ricon { display: inline-block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; flex: none; vertical-align: -3px; }
.ricon .fill, .ricon.r-wolf path { fill: currentColor; }
.stage .ricon.big { width: 56px; height: 56px; stroke-width: 1.4; }

/* はじめの役職カード */
.board-wrap { position: relative; }
.rolecard {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(360px, calc(100% - 24px)); z-index: 5;
  background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius); padding: 16px 20px; text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.rolecard.flip { animation: rc-flip .45s ease-out; }
@keyframes rc-flip { from { transform: translate(-50%, -50%) rotateY(90deg); } to { transform: translate(-50%, -50%) rotateY(0); } }
@media (prefers-reduced-motion: reduce) { .rolecard.flip { animation: none; } }
.rolecard p { margin: 0 0 6px; }
.rc-head { color: var(--ink-sub); }
.rc-icon { color: var(--accent); }
.rc-name { font-size: 1.6rem; font-weight: 800; }
.rc-team { font-weight: 700; color: var(--ink-sub); }
.rc-desc { text-align: left; }
.rc-mates { font-weight: 700; color: var(--ng); }

/* あなたの操作 */
#play { max-width: 640px; margin: 10px auto 0; }
.actions { min-height: 56px; margin-top: 10px; }
.actions .ask { font-weight: 700; margin: 0 0 6px; }
.actions .ask-note { color: var(--ink-sub); margin: 0 0 6px; font-size: 15px; }
.actions .btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions .btn { font-size: 16px; padding: 0 14px; }
.actions .btn .ricon { margin-right: 4px; }
.who-btn .n { display: inline-block; min-width: 1.4em; margin-right: 4px; font-size: 13px; color: var(--ink-sub); }
.who-btn.marked { background: var(--accent-soft); }
.skip-row .ask-note { margin: 0; flex: 1 1 auto; }

/* 会話の記録 */
.log {
  margin-top: 10px; height: 260px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 10px; scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) { .log { scroll-behavior: auto; } }
.log:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
.l-day { text-align: center; font-weight: 800; color: var(--ink-sub); margin: 10px 0 6px; border-top: 1px solid var(--line); padding-top: 6px; }
.l-day:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.l-day.night { color: var(--night-edge); }
.l-sys { text-align: center; color: var(--ink-sub); font-size: 15px; margin: 4px 0; }
.l-priv { font-size: 15px; margin: 4px 0; padding: 4px 8px; border-left: 4px solid var(--warn); background: var(--bg); }
.l-priv .lock { font-size: 13px; font-weight: 700; color: var(--warn); margin-right: 6px; }
.l-votes { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 14px; color: var(--ink-sub); margin: 4px 0; }
.l-votes .vh { font-weight: 700; color: var(--ink); }
.l-talk { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; }
.l-talk .mini { width: 36px; height: 36px; object-fit: contain; flex: none; background: var(--day-board); border-radius: 50%; }
.l-talk .bub { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px 10px; }
.l-talk .who { display: block; font-size: 13px; font-weight: 700; color: var(--ink-sub); }
.l-talk .txt { display: block; line-height: 1.6; }
.l-talk.me { flex-direction: row-reverse; }
.l-talk.me .bub { background: var(--me-soft); border-color: var(--accent); }
.l-talk.new { animation: l-in .25s ease-out; }
@keyframes l-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .l-talk.new { animation: none; } }

/* わかっていること */
.facts { margin-top: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 12px; }
.facts summary { cursor: pointer; font-weight: 700; min-height: var(--tap); display: flex; align-items: center; }
.facts ul { margin: 0 0 8px; padding-left: 1.2em; }
.facts p { margin: 0 0 8px; }
.facts .gone-s { margin-left: 6px; font-size: 13px; color: var(--ink-sub); border: 1px dashed var(--line-strong); border-radius: 4px; padding: 0 4px; }
.facts .castline, .facts .outs { color: var(--ink-sub); font-size: 15px; }

.subs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* 結果 */
.result-panel { border: 2px solid var(--ink); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 10px; text-align: center; background: var(--surface); }
.result-panel h2 { margin: 0 0 4px; font-size: 1.5rem; }
.result-panel .you-line { font-weight: 700; font-size: 1.1rem; margin: 0 0 4px; }
.result-panel .you-line.win { color: var(--ok); }
.result-panel .you-line.lose { color: var(--ng); }
.result-panel .note { color: var(--ink-sub); font-size: 14px; margin: 0; }
.result-panel .controls { justify-content: center; margin-top: 8px; }
.review:empty { display: none; }
.review { margin-top: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 14px 10px; }
.review h3 { margin: 8px 0 4px; font-size: 1rem; }
.rv-roles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 12px; }
.rv-roles li { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.rv-role { color: var(--ink-sub); }
.rv-out, .rv-alive { font-size: 13px; color: var(--ink-sub); margin-left: 4px; }
.rv-list { margin: 0; padding-left: 1.2em; }
.rv-list li { margin: 4px 0; }
.rv-list li > span { display: block; font-size: 15px; }
.rv-list .rv-v { color: var(--ink-sub); font-size: 14px; }

.moon { display: inline-block; width: 16px; height: 16px; border-radius: 50%; box-shadow: inset -5px -2px 0 0 var(--night-edge); }

/* スマホ幅 */
@media (max-width: 480px) {
  .stage { padding: 8px; }
  .board-wrap { padding: 6px; }
  .village { gap: 5px; }
  .seat { padding: 3px 2px 4px; }
  .seat .name { font-size: 13px; }
  .seat .num { font-size: 12px; left: 3px; }
  .tag { font-size: 12px; padding: 0 3px; }
  .stage .tag:not(.co) .ricon { display: none; }
  .stage .tag .ricon { width: 12px; height: 12px; }
  .log { height: 220px; }
  .l-talk .mini { width: 30px; height: 30px; }
  .actions .btn { font-size: 15px; padding: 0 10px; }
}
/* 上のバーの高さを一定に（No.93。数字は一番長い文が画面の幅（360px・375px 以上・641px 以上）で何行になるか。--tb-rt はふりがなの分。base.css・turnbar.js） */
.turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; --tb-rt: 11px; --tb-st-rt: 11px; }
@media (min-width: 375px) { .turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; } }
@media (min-width: 641px) { .turnbar { --tb-msg-lines: 1; --tb-st-lines: 1; } }
/* 上のバーの高さ ここまで */
