/*
 * デザイン方針
 *   - 生成り色の背景に、白い角丸カードとやわらかい影で要素をまとめる
 *   - ボタンは丸いピル型。主ボタンはロゴの炎と同じ赤みのオレンジ
 *   - ゲームはアイコン・人数バッジ・カテゴリのラベルで見分けやすくする
 */
:root {
  --bg: #f6f2ec;
  --panel: #ffffff;
  --ink: #3d3430;
  --sub: #5f5651;
  --muted: #8d8580;
  --line: #ebe4dc;
  --soft: #f1ece6;
  --field: #efebe6;
  --primary: #c9442b;
  --primary-d: #a93620;
  --primary-soft: #fbece6;
  --accent: #1f8a7d;
  --wolf: #5b45a0;
  --ok: #1d8a5f;
  --ng: #c93a3f;
  --talk-bg: #f8dfd3;
  --talk-ink: #8f3d24;
  --quick-bg: #dde5ea;
  --quick-ink: #3a5566;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(70, 45, 25, .06), 0 6px 18px rgba(70, 45, 25, .08);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
input, select { font: inherit; color: inherit; }
h2, h3 { margin: 0; font-weight: 700; }
a { color: var(--ink); text-underline-offset: 3px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: .85em; }

/* ---------- ボタン ---------- */
.btn {
  border: none; background: var(--soft); border-radius: 999px;
  padding: .6em 1.3em; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: background .15s, transform .08s, box-shadow .15s;
}
.btn:hover:not(:disabled) { background: #e8e1d9; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn.primary { background: linear-gradient(180deg, #d6553a, var(--primary)); color: #fff; box-shadow: 0 2px 0 var(--primary-d), 0 6px 14px rgba(201, 68, 43, .25); }
.btn.primary:hover:not(:disabled) { background: var(--primary-d); }
.btn.primary:disabled { background: var(--soft); color: var(--muted); box-shadow: none; opacity: 1; }
.btn.ghost { background: transparent; color: var(--sub); }
.btn.ghost:hover:not(:disabled) { background: rgba(0, 0, 0, .05); }
.btn.small { padding: .35em .9em; font-size: .85rem; }
.btn.lg { padding: .85em 1.6em; font-size: 1.08rem; }
.btn.block { display: block; width: 100%; }
a.btn { display: inline-block; text-decoration: none; }
.pill { font-weight: 700; white-space: nowrap; color: var(--sub); background: var(--soft); border-radius: 999px; padding: .2em .8em; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.timer.urgent { color: var(--ng); }

/* 入力欄は塗りつぶしの角丸 */
.field input, .answer-form input, .chat-form input {
  border: 2px solid transparent; border-radius: 999px; background: var(--field);
  padding: .65em 1.1em; width: 100%;
}
.field input:focus, .answer-form input:focus, .chat-form input:focus, .join-row input:focus {
  outline: none; border-color: var(--primary); background: #fff;
}
/* 部屋コードは控えめに下線 */
.join-row input { border: none; border-bottom: 1px solid #cfc7bf; border-radius: 0; background: transparent; padding: .6em 0; width: 100%; }

/* ---------- ホーム ---------- */
.home { max-width: 760px; margin: 0 auto; padding: 40px 20px 48px; }
.hero { margin-bottom: 24px; }
.logo-big { display: block; height: 64px; width: auto; }
.tagline { font-size: 2rem; margin: .5em 0 .4em; line-height: 1.4; font-weight: 800; }
.lead { color: var(--sub); line-height: 1.8; margin: 0; }
br.sp { display: none; }
.home-card { max-width: 480px; display: grid; gap: 18px; background: var(--panel); border-radius: 20px; padding: 22px; box-shadow: var(--shadow); }
.field { display: grid; gap: 8px; font-size: .9rem; font-weight: 700; color: var(--ink); }
.field input { font-size: 1.05rem; font-weight: 400; }
.invited { background: var(--primary-soft); border-radius: 12px; padding: 10px 14px; text-align: center; }
.invited b { font-family: ui-monospace, monospace; font-size: 1.15em; letter-spacing: .1em; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--sub); font-size: .8rem; margin: 22px 0 6px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.join-row { display: flex; gap: 12px; align-items: flex-end; }
.join-row input { text-transform: uppercase; letter-spacing: .08em; }
.join-row .btn { background: transparent; }
.join-row .btn:hover { background: var(--soft); }

/* 3つのステップ */
.steps-block { max-width: 480px; margin-top: 32px; text-align: center; }
.steps-block h2 { font-size: 1.2rem; margin-bottom: 16px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.steps li { position: relative; display: grid; justify-items: center; gap: 6px; font-size: .9rem; font-weight: 700; }
.step-num { position: absolute; top: 0; left: calc(50% - 40px); width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .8rem; display: grid; place-items: center; }
.step-icon { width: 52px; height: 52px; fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.home-links { margin: 18px 0 0; font-size: .9rem; font-weight: 700; }

/* ゲーム一覧（カード） */
.cat-pill { display: inline-block; font-size: .85rem; font-weight: 700; border-radius: 999px; padding: .2em .9em; margin: 22px 0 12px; }
.cat-talk { background: var(--talk-bg); color: var(--talk-ink); }
.cat-quick { background: var(--quick-bg); color: var(--quick-ink); }
.game-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.game-item { display: flex; align-items: center; gap: 16px; height: 100%; padding: 16px 18px; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; text-decoration: none; transition: transform .12s, box-shadow .12s; }
a.game-item:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(70, 45, 25, .08), 0 10px 24px rgba(70, 45, 25, .12); }
.gi-icon { flex: none; width: 64px; height: 64px; display: grid; place-items: center; font-size: 2.8rem; line-height: 1; }
.gi-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.gi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gi-head b { font-size: 1.1rem; }
.gi-desc { font-size: .88rem; color: var(--sub); line-height: 1.6; }
.people { flex: none; display: inline-flex; align-items: center; gap: 3px; font-size: .75rem; font-weight: 700; border-radius: 999px; padding: .15em .6em; background: var(--talk-bg); color: var(--talk-ink); }
.cat-quick + .game-list .people, .game-quick .people { background: var(--quick-bg); color: var(--quick-ink); }
.i-people { width: 14px; height: 14px; fill: currentColor; }
/* クイズの「？」は参考デザインに合わせて灰色 */
.gi-icon.gray, .game-icon.gray { filter: grayscale(1) brightness(.75); }

/* ---------- 紹介ページ（SEO） ---------- */
.lp-section { margin-top: 56px; }
.lp-section h2 { font-size: 1.35rem; margin-bottom: 16px; }
.lp-cat { font-size: .85rem; font-weight: 700; margin: 22px 0 12px; display: inline-block; border-radius: 999px; padding: .2em .9em; background: var(--talk-bg); color: var(--talk-ink); }
.lp-games { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.lp-games a { display: block; height: 100%; padding: 14px 18px; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; text-decoration: none; transition: transform .12s; }
.lp-games a:hover { transform: translateY(-2px); }
.lp-games a b { display: block; font-weight: 700; }
.lp-games a span { display: block; font-size: .85rem; color: var(--sub); margin-top: 2px; }
.lp-points, .lp-rules { margin: 0; line-height: 1.9; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px 18px 2.4em; }
.lp-points li + li, .lp-rules li + li { margin-top: 8px; }
.faq { margin: 0; display: grid; gap: 12px; }
.faq dt { font-weight: 700; background: var(--panel); border-radius: var(--radius) var(--radius) 0 0; padding: 16px 20px 0; }
.faq dd { margin: 0; color: var(--sub); line-height: 1.8; background: var(--panel); border-radius: 0 0 var(--radius) var(--radius); padding: 6px 20px 16px; box-shadow: var(--shadow); }
.lp-footer { margin-top: 64px; color: var(--muted); font-size: .85rem; text-align: center; }
.lp-footer a, .crumbs a { color: inherit; }
.lp-logo img { display: block; height: 40px; width: auto; margin-bottom: 20px; }
.crumbs { font-size: .8rem; color: var(--muted); margin-bottom: 24px; }
.lp-hero { background: var(--panel); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); }
.lp-hero h1 { font-size: 2rem; margin: 0 0 12px; line-height: 1.4; }
.lp-hero h1 small { display: block; font-size: .85rem; color: var(--muted); font-weight: 500; margin-top: 4px; }
.lp-meta { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 24px; }
.lp-meta div { background: var(--soft); border-radius: 12px; padding: 8px 14px; }
.lp-meta dt { font-size: .72rem; color: var(--muted); }
.lp-meta dd { margin: 0; font-weight: 700; }
.lp .center { text-align: left; margin-top: 24px; }
.lp-section > p { line-height: 1.9; margin: 0 0 8px; }
.shot { margin: 20px 0 0; }
.shot img { display: block; width: 100%; height: auto; border-radius: 14px; box-shadow: var(--shadow); background: #fff; }
.shot figcaption { margin-top: 10px; font-size: .85rem; color: var(--sub); line-height: 1.7; }
.step-no { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .9rem; margin-right: 10px; vertical-align: 2px; }
@media (max-width: 600px) {
  .home { padding-top: 28px; }
  br.sp { display: inline; }
  .tagline, .lp-hero h1 { font-size: 1.5rem; }
  .game-list { grid-template-columns: 1fr; }
  .gi-icon { width: 52px; height: 52px; font-size: 2.4rem; }
}

/* ---------- 部屋レイアウト ---------- */
.room { height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 18px; background: var(--panel); box-shadow: 0 1px 0 var(--line); }
.logo { display: block; height: 28px; width: auto; }
.room-info { display: flex; align-items: center; gap: 10px; color: var(--sub); font-size: .9rem; }
.code { font-family: ui-monospace, monospace; letter-spacing: .1em; font-size: 1.05rem; color: var(--ink); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.conn { font-size: .8rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; }
.conn::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #c4bcb5; }
.conn[data-status="online"]::before { background: var(--ok); }
.conn[data-status="offline"]::before { background: var(--ng); }

.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px 1fr 300px; gap: 14px; padding: 14px; }
.layout > .side { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-title { font-size: .85rem; font-weight: 700; color: var(--sub); padding: 14px 16px 6px; display: flex; justify-content: space-between; }
.count { color: var(--muted); font-weight: 500; }
.stage { padding: 28px 32px; overflow: auto; min-height: 0; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); }

/* 参加者 */
.players { list-style: none; margin: 0; padding: 0 10px 10px; overflow: auto; }
.player { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; }
.player.me { background: var(--primary-soft); }
.player.offline { opacity: .4; }
.player .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: .92rem; }
.player .name small { color: var(--muted); font-weight: 400; }
.player .crown { font-size: .7rem; color: var(--talk-ink); background: var(--talk-bg); border-radius: 999px; padding: 0 .5em; }
.player .score { font-variant-numeric: tabular-nums; font-weight: 700; font-size: .9rem; }
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-weight: 700; font-size: .8rem; flex: none; vertical-align: middle; }
.avatar.sm { width: 20px; height: 20px; font-size: .65rem; }
.avatar.lg { width: 44px; height: 44px; font-size: 1.2rem; }

/* チャット */
.chat-list { list-style: none; margin: 0; padding: 0 16px; flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.chat-list li { line-height: 1.5; word-break: break-word; font-size: .9rem; }
.chat-list .who { font-weight: 700; margin-right: 8px; }
.chat-list .sys { color: var(--muted); font-size: .8rem; background: var(--soft); border-radius: 8px; padding: 4px 8px; }
.chat-list .secret { opacity: .6; }
.chat-list .secret::after { content: "（正解者のみ表示）"; font-size: .75em; color: var(--muted); }
.chat-form { display: flex; gap: 8px; align-items: center; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; padding: .5em .9em; }
.chat-fab { display: none; }

/* ---------- ロビー（待合室・ゲーム選択） ---------- */
.invite { display: flex; align-items: center; gap: 16px; justify-content: space-between; padding: 14px 18px; margin-bottom: 24px; border-radius: 14px; background: var(--soft); flex-wrap: wrap; }
.invite-title { font-size: .8rem; font-weight: 700; color: var(--sub); }
.invite-url { font-family: ui-monospace, monospace; font-size: .88rem; word-break: break-all; margin-top: 2px; }
.section-title { font-size: 1.25rem; margin-bottom: 4px; font-weight: 800; }
.lobby-step { display: inline-block; margin: 0 0 14px; font-size: .8rem; font-weight: 700; color: var(--talk-ink); background: var(--talk-bg); border-radius: 999px; padding: .15em .9em; }
.lobby-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.lobby-guide { margin: 0 0 4px; line-height: 1.8; color: var(--sub); }
.lobby-guide b { color: var(--ink); }
.cat { margin-top: 20px; }
.cat-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cat-head h3 { font-size: .85rem; font-weight: 700; border-radius: 999px; padding: .2em .9em; background: var(--talk-bg); color: var(--talk-ink); }
.cat-quick-head h3 { background: var(--quick-bg); color: var(--quick-ink); }
.cat-head .muted { font-size: .8rem; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.game-card { padding: 16px; border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.game-card .gc-head { display: flex; align-items: center; gap: 12px; }
.game-card .game-icon { font-size: 2.2rem; line-height: 1; }
.game-card .game-name { font-weight: 800; font-size: 1.15rem; flex: 1; }
.game-card .game-desc { color: var(--sub); font-size: .88rem; flex: 1; line-height: 1.7; }
.game-card.unavailable { box-shadow: none; background: var(--soft); }
.game-card.unavailable .game-name, .game-card.unavailable .game-desc { color: var(--muted); }
.game-options { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .82rem; color: var(--sub); }
.game-options label { display: flex; align-items: center; gap: 6px; }
.game-options select { border: none; border-radius: 999px; padding: 3px 8px; background: var(--field); }
.game-card .btn { margin-top: 4px; }
/* 待合室 */
.members { margin: 4px 0 20px; }
.members-count { margin: 0 0 10px; color: var(--sub); }
.members-count b { font-size: 2rem; color: var(--ink); margin-right: 4px; font-variant-numeric: tabular-nums; }
.member-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.member-list li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: var(--soft); }
.member-list li.new { animation: member-in .5s ease-out; }
@keyframes member-in { from { opacity: 0; transform: translateY(6px); } }
.member-name { flex: 1; font-weight: 700; font-size: 1.05rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-name small { font-weight: 400; color: var(--muted); }
.member-role { flex: none; font-size: .72rem; font-weight: 700; color: var(--talk-ink); background: var(--talk-bg); border-radius: 999px; padding: .1em .6em; white-space: nowrap; }
.waiting-action { margin: 0 0 32px; display: grid; gap: 10px; justify-items: start; color: var(--sub); }
.waiting-note { margin: 0 0 32px; color: var(--sub); line-height: 1.8; background: var(--soft); border-radius: 12px; padding: 12px 16px; }
.intro-games { padding-top: 8px; }
.intro-games .game-list { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.intro-games .game-item { box-shadow: none; border: 1px solid var(--line); }

/* ---------- ゲーム共通 ---------- */
.game { display: flex; flex-direction: column; gap: 24px; }
.game-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.game-head h2 { font-size: 1.15rem; }
.game-head h2 small { font-size: .8rem; color: var(--muted); margin-left: 8px; font-weight: 500; }
.host-controls { display: flex; gap: 12px; justify-content: center; margin-top: 8px; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: .8rem; border-bottom: 1px solid var(--ink); padding: 8px; }
.table td { border-bottom: 1px solid var(--line); padding: 10px 8px; vertical-align: middle; }
.table tr.me td { color: var(--primary-d); font-weight: 600; }
.table .pts { font-weight: 700; }
.ranking { list-style: none; padding: 0; margin: 0 auto; max-width: 460px; width: 100%; border-top: 1px solid var(--ink); }
.ranking li { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); font-weight: 600; }
.ranking li:first-child .rank, .ranking li:first-child .pts { color: var(--primary); }
.ranking .rank { width: 24px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.ranking .name { flex: 1; }
.ranking .pts { font-variant-numeric: tabular-nums; }
.chip { display: inline-flex; align-items: center; gap: 5px; margin: 2px 10px 2px 0; font-size: .85rem; }
.badge { font-size: .7rem; padding: 1px 6px; color: #fff; vertical-align: middle; }
.badge.wolf { background: var(--wolf); }

/* お題・答えなど大きな文字で見せる要素（枠なし・ラベル＋大きな文字） */
.word-card, .theme-card, .answer-card { margin: 8px auto; text-align: center; padding: 8px 0; }
.word-card .label, .theme-card .label { color: var(--muted); font-weight: 600; font-size: .8rem; letter-spacing: .05em; }
.word-card .word { font-size: 2.6rem; font-weight: 800; margin-top: 4px; line-height: 1.3; }
.word-card.small .word { font-size: 1.5rem; }
.theme-card .theme { font-size: 1.8rem; font-weight: 800; margin-top: 4px; line-height: 1.4; }
.answer-card { max-width: 560px; font-size: 1.7rem; font-weight: 700; }
.howto { color: var(--sub); line-height: 1.8; text-align: center; }

/* ---------- ワードウルフ ---------- */
.vote-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.vote-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 8px; border: none; border-radius: 0; background: var(--soft); cursor: pointer; font-weight: 600; }
.vote-btn:hover:not(:disabled) { background: #ebebed; }
.vote-btn.on { background: #ece8f6; color: var(--wolf); box-shadow: inset 0 -2px 0 var(--wolf); }
.vote-btn .done { color: var(--ok); font-weight: 500; font-size: .85rem; }
.result-banner { text-align: center; padding: 12px 0; }
.result-banner .big { font-size: 2.2rem; font-weight: 800; }
.result-banner.win-v .big { color: var(--accent); }
.result-banner.win-w .big { color: var(--wolf); }
.result-banner .me-result { margin-top: 6px; font-weight: 600; color: var(--sub); }
.ww-words { display: flex; gap: 48px; justify-content: center; flex-wrap: wrap; }
.ww-words > div { display: flex; gap: 10px; align-items: baseline; }
.ww-words .wolf b { color: var(--wolf); }
.ww-words .label { font-size: .8rem; color: var(--muted); }
.ww-words b { font-size: 1.3rem; }
tr.wolf td { color: var(--wolf); }

/* ---------- クイズ ---------- */
.timebar { height: 3px; background: var(--line); overflow: hidden; }
.timebar > div { height: 100%; background: var(--primary); transition: width .25s linear; }
.question { font-size: 1.5rem; font-weight: 700; text-align: center; padding: 16px 10px; line-height: 1.6; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice { display: flex; align-items: center; gap: 14px; padding: 18px 16px; border: none; border-radius: 0; color: #fff; font-size: 1.05rem; font-weight: 700; cursor: pointer; text-align: left; position: relative; transition: opacity .2s; }
.choice:hover:not(:disabled) { opacity: .9; }
.choice:disabled { cursor: default; }
.choice.c0 { background: #c2415d; } .choice.c1 { background: #2a6f97; } .choice.c2 { background: #b7791f; } .choice.c3 { background: #2f855a; }
.choice .lbl { width: 1.4em; flex: none; opacity: .8; }
.choice .txt { flex: 1; }
.choice .pickers { display: flex; gap: 2px; flex-wrap: wrap; }
.choice .pickers .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, .9); }
.choices:has(.mine) .choice:not(.mine):not(.correct) { opacity: .4; }
.choice.mine { box-shadow: inset 0 -4px 0 var(--ink); }
.choice.wrong { opacity: .3; }
.choice.correct { opacity: 1 !important; }
.choice.correct::after { content: "正解"; position: absolute; right: 12px; top: 6px; font-size: .7rem; font-weight: 700; }
.reveal-box { text-align: center; font-size: 1.3rem; font-weight: 700; padding: 4px; }
.reveal-box.ok { color: var(--ok); }
.reveal-box.ng { color: var(--ng); }

/* ---------- お絵描き ---------- */
.draw-status { text-align: center; font-size: 1.05rem; min-height: 1.6em; }
.draw-status .answer { font-size: 1.3em; color: var(--primary-d); }
.draw-status .hint { font-weight: 700; letter-spacing: .15em; }
.canvas-wrap { position: relative; margin: 0 auto; width: 100%; max-width: 760px; }
.canvas-wrap canvas { width: 100%; aspect-ratio: 4 / 3; display: block; border: 1px solid var(--line); background: #fff; touch-action: none; }
.canvas-wrap canvas.can-draw { cursor: crosshair; border-color: var(--primary); }
.canvas-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .75); pointer-events: none; }
.canvas-overlay div { color: var(--ink); font-size: 1.8rem; font-weight: 800; }
.draw-tools { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; align-items: center; }
.palette, .widths { display: flex; gap: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 1px solid #d4d4d8; cursor: pointer; padding: 0; font-size: .85rem; }
.swatch.on { box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--ink); }
.width { width: 32px; height: 32px; border: none; border-radius: 0; background: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; }
.width span { background: var(--ink); border-radius: 50%; display: block; }
.width.on { box-shadow: inset 0 -2px 0 var(--ink); }
.tool-actions { display: flex; gap: 6px; }
.guessed-list { text-align: center; font-size: .9rem; }

/* ---------- カウントダウン・進捗レーン（数字タッチ） ---------- */
.countdown { position: absolute; inset: 0; display: grid; place-items: center; font-size: 5rem; font-weight: 800; color: var(--ink); background: rgba(255, 255, 255, .92); z-index: 2; }
.lanes { display: grid; gap: 10px; }
.lane { display: grid; grid-template-columns: 140px 1fr 90px; align-items: center; gap: 12px; }
.lane.me .lane-name { font-weight: 700; }
.lane-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; }
.lane-track { position: relative; height: 4px; background: var(--line); }
.lane-bar { height: 100%; transition: width .3s; }
.lane-info { font-size: .85rem; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 数字タッチ ---------- */
.touch-status { text-align: center; font-size: 1.05rem; min-height: 1.8em; }
.next-num { display: inline-block; min-width: 1.4em; text-align: center; font-weight: 800; font-size: 1.3em; color: var(--primary); }
.board { position: relative; width: 100%; max-width: 820px; margin: 0 auto; aspect-ratio: 16 / 10; background: var(--soft); overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.board .target { position: absolute; transform: translate(-50%, -50%); width: max(6.7%, 34px); aspect-ratio: 1; border-radius: 50%; border: none; padding: 0; font-size: clamp(.75rem, 2.2vw, 1.3rem); font-weight: 700; color: #fff; background: hsl(var(--h) 55% 45%); cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .15s; }
.board.live .target { opacity: 1; pointer-events: auto; }
.board.live .target:active { transform: translate(-50%, -50%) scale(.94); }
.board .target.hit { opacity: 0 !important; pointer-events: none !important; }
.board.penalty::after { content: "ミス"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 2rem; font-weight: 800; color: var(--ng); background: rgba(201, 58, 63, .08); pointer-events: none; animation: fade .6s forwards; }
@keyframes fade { to { opacity: 0; } }

/* ---------- テキスト回答系（答えそろえて！・これ誰・価値観・二択） ---------- */
.answer-form { display: flex; gap: 12px; align-items: flex-end; max-width: 460px; margin: 0 auto; width: 100%; }
.answer-form input { flex: 1; min-width: 0; font-size: 1.1rem; }
.groups { display: grid; border-top: 1px solid var(--ink); }
.group { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.group.hit .group-label { color: var(--ok); }
.group-label { font-size: 1.2rem; font-weight: 700; }
.group-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.group-members { grid-column: 1 / -1; }
.reveal-author { text-align: center; font-size: 1.25rem; display: flex; gap: 10px; align-items: center; justify-content: center; }
.sides { display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px; align-items: stretch; }
.vs { align-self: center; font-size: .8rem; color: var(--muted); }
.sides .side { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 12px 20px; border-top: 3px solid var(--line); background: transparent; }
.sides .side-0 { border-top-color: #c2415d; }
.sides .side-1 { border-top-color: #2a6f97; }
.sides .side.win .side-label::after { content: "多数派"; display: block; font-size: .75rem; font-weight: 600; color: var(--primary); margin-top: 4px; }
.side-label { font-size: 1.3rem; font-weight: 700; text-align: center; }
.side-count { font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.side-count small { font-size: .9rem; font-weight: 500; }
.side-members { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; }
.scale { min-width: min(320px, 80vw); gap: 24px; display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); margin-top: 8px; border-top: 1px solid var(--line); padding-top: 6px; }
.my-number { text-align: center; }
.my-number .label { font-size: .8rem; color: var(--muted); }
.my-number .num { font-size: 4rem; font-weight: 800; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.hint-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.hint-list li { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.hint-list li.done { opacity: .5; }
.hint-list .hint { flex: 1; font-size: 1.05rem; }
.badge-num, .played-card { display: inline-block; min-width: 2em; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.badge-num.ng, .played-card.ng { color: var(--ng); }
.played { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.played .arrow { color: var(--muted); }
.value-list { list-style: none; padding: 0; max-width: 560px; margin: 0 auto; width: 100%; border-top: 1px solid var(--line); }
.value-list li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.value-list .num { font-weight: 800; font-size: 1.2rem; width: 2.2em; text-align: right; font-variant-numeric: tabular-nums; }
.value-list .hint { color: var(--sub); margin-left: auto; }
@media (max-width: 860px) {
  .sides { grid-template-columns: 1fr; }
  .vs { justify-self: center; }
  .theme-card .theme { font-size: 1.35rem; }
}

/* ---------- トースト ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: 10px 20px; font-size: .9rem; transition: opacity .4s; text-align: center; }
.toast-error { background: var(--ng); }
.toast.hide { opacity: 0; }

/* ---------- レスポンシブ ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 190px 1fr 260px; }
  .stage { padding: 28px; }
}
@media (max-width: 860px) {
  .room { height: auto; min-height: 100vh; }
  .layout { grid-template-columns: 1fr; gap: 10px; padding: 10px; }
  .players-panel { order: -1; }
  body.in-waiting .players-panel { display: none; }
  .players { display: flex; flex-wrap: wrap; gap: 4px; padding-bottom: 10px; }
  .player { padding: 4px 10px; background: var(--soft); border-radius: 999px; }
  .layout > .chat-panel { position: fixed; right: 8px; bottom: 8px; width: min(380px, calc(100vw - 16px)); height: 60vh; z-index: 20; display: none; box-shadow: 0 8px 32px rgba(70, 45, 25, .25); }
  body.chat-open .layout > .chat-panel { display: flex; }
  .chat-fab { display: block; position: fixed; right: 16px; bottom: 16px; padding: .7em 1.3em; border: none; border-radius: 999px; background: var(--ink); color: #fff; font-size: .9rem; font-weight: 700; z-index: 21; cursor: pointer; box-shadow: 0 6px 18px rgba(0, 0, 0, .2); }
  body.chat-open .chat-fab { bottom: calc(60vh + 12px); }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
  .stage { padding: 18px 16px 88px; }
  .choices { grid-template-columns: 1fr; }
  .question { font-size: 1.2rem; }
  .lane { grid-template-columns: 90px 1fr 70px; }
}
