/* Board Game Party 共通の見た目。色はゲームの style.css の :root で上書きできる(ゲームを選んでいるあいだだけ読み込む) */
:root {
  --bg: #f4f3ef; --panel: #ffffff; --line: #e2dfd6; --text: #23262b; --muted: #6b7078;
  --accent: #2d5b8a; --accent-soft: #e8f0f8; --hl: #f2b705; --hl-soft: #fff6d6; --danger: #d0413a;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif; font-size: 16px;
       background: var(--bg); color: var(--text); -webkit-tap-highlight-color: transparent; }
/* 字間(letter-spacing)は最後の文字の後ろにも付くので、同じだけ左に足して中央をそろえる */
h1 { font-size: 26px; margin: 8px 0 14px; letter-spacing: .15em; padding-left: .15em; text-align: center; color: var(--accent); }
h2 { font-size: 16px; margin: 0 0 8px; }
button { font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; background: #fff; color: var(--text); cursor: pointer; }
button:hover:not(:disabled) { background: #f7f7f7; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
button.primary:hover:not(:disabled) { background: #244b72; }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 700; }
button.danger:hover:not(:disabled) { background: #b5352f; }
button:disabled { opacity: .4; cursor: default; }
/* 押した瞬間に少し沈む(手ごたえ) */
button { transition: transform .06s; }
button:active:not(:disabled) { transform: translateY(1px) scale(.97); }
/* すばやく2回タップしたときの画面拡大を止める(2本指の拡大はできる) */
html { touch-action: manipulation; }
/* スクロールバーの場所を常に空けておく(縦に長い画面でスクロールバーが出ても、横の位置がずれないように。PC だけ効く) */
html { scrollbar-gutter: stable; }
input { font: inherit; color: var(--text); }
input:not([type]), input[type=text] { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); width: 100%; background: #fff; }
input[type=number] { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); width: 5em; }
input[type=checkbox] { width: 20px; height: 20px; vertical-align: middle; accent-color: var(--accent); }
label { cursor: pointer; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 14px; }
.hidden { display: none !important; }
.wrap { max-width: 760px; margin: 0 auto; padding: 12px 10px; }
details summary { cursor: pointer; font-weight: 700; }

/* ロビー: ルール設定・メンバー */
.settings .item { display: flex; justify-content: space-between; align-items: center; gap: 10px;
                  padding: 10px 0; border-bottom: 1px solid var(--line); }
/* メンバー: 1人1行、区切り線で並べる。名前は本文と同じ大きさ。ゲームの部品(memberExtra)と「×」は右端 */
.members { display: flex; flex-direction: column; margin: 8px 0; }
.members > div { display: flex; align-items: center; gap: 8px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.members > div:last-child { border-bottom: 0; }
/* 広い画面(960px以上)は2列。左の列を上から埋めてから右の列へ(行数 --rows は room-client.js が入れる)。列のあいだに縦の線 */
@media (min-width: 960px) {
  .members { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(var(--rows, 1), auto); grid-auto-flow: column; }
  .members > div { padding-right: 10px; }
  .members > div.right { border-left: 1px solid var(--line); padding-left: 10px; }
  .members > div.col-end { border-bottom: 0; }
}
.members .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.members .off { flex: 0 0 auto; } /* 切断中の📴は名前と分けて、名前が省略されても消えないように */
.members .rec { flex: 0 0 auto; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; } /* この部屋の戦績(👑勝ち・遊んだ数) */
.members .kick.space { visibility: hidden; } /* ホスト自身の行: 「×」の場所を空けて、右端の部品の位置をそろえる */
.members .kick { border: 0; background: none; padding: 2px 6px; font-size: 15px; color: var(--muted); line-height: 1; }
.members .kick.armed { color: #fff; background: var(--danger); border-radius: 999px; padding: 1px 8px; }
#closeWarn { color: var(--danger); font-weight: 700; margin-top: 10px; }

.log { font-size: 14px; color: var(--muted); max-height: 220px; overflow: auto; line-height: 1.6; }
#toast { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); background: #333; color: #fff;
         padding: 10px 16px; border-radius: 10px; font-size: 15px; z-index: 10; }
/* トーストは上から滑り込む(表示されるたびに) */
#toast:not(.hidden) { animation: toast-in .25s ease-out; }
@keyframes toast-in { from { transform: translate(-50%, -150%); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
#overlay { position: fixed; inset: 0; z-index: 20; background: rgba(244,243,239,.94); display: grid; place-items: center; padding: 16px; }
#overlay .box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; max-width: 420px; text-align: center; }

/* ---------- Board Game Party の共通の画面 ---------- */
#joinView { max-width: 640px; margin: 0 auto; }
/* 入室画面のロゴ(shared/images/logo.png、背景は透明)。入室画面の幅いっぱい */
.siteLogo { margin: 4px 0 10px; padding: 0; }
.siteLogo img { display: block; width: 100%; height: auto; }
/* 部屋の中: ヘッダーの下にゲームの画面を組み立てる。#stage・#gameStage は箱を作らないので、
   ゲームの画面の部品は #gameView の直接の子として並ぶ(ゲームの style.css で #gameView を grid にしてよい) */
#stage, #gameStage { display: contents; }
#gameHeader { grid-area: header; justify-content: space-between; margin-bottom: 10px; }
#gameHeader .logo { color: var(--accent); letter-spacing: .1em; }
#gameHeader button { padding: 4px 10px; font-size: 14px; }
#gameHeader .row { gap: 6px; }
@media (max-width: 599px) { #gameHeader button { padding: 4px 7px; } #gameHeader .row { gap: 4px; } }
/* 狭い画面(480px 未満)はロゴを外し、「📋 招待リンク」を「📋 コピー」にする */
#gameHeader .sm { display: none; }
@media (max-width: 479px) { #gameHeader .logo, #gameHeader .lg { display: none; } #gameHeader .sm { display: inline; } }
@media (min-width: 960px) { body { font-size: 17px; } .wrap { max-width: 1240px; padding-inline: 16px; } }
#memberTools button { margin-left: 8px; }
#botBtn { padding: 2px 8px; font-size: 14px; }

/* ゲームの一覧: 1ゲーム1行、区切り線。選んでいるゲームは左に太い線 */
.gameList { display: flex; flex-direction: column; }
.gameList > div { display: flex; align-items: stretch; gap: 4px; border-bottom: 1px solid var(--line); }
.gameList > div:last-child { border-bottom: 0; }
.gameList button { border: 0; background: none; border-radius: 0; }
/* マウスを乗せたとき: 行と同じ四角で、半透明(選んでいる行の色と左の線が透けて見える)。角丸の背景がはみ出さないように */
.gameList button:hover:not(:disabled) { background: rgba(0, 0, 0, .05); }
.gameList .book { display: flex; align-items: center; }
.gameList .gname { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; text-align: left; padding: 10px 8px; }
.gameList .gname .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gameList .book { padding: 8px 10px; }
.gameList > div.on { box-shadow: inset 4px 0 0 var(--accent); background: var(--accent-soft); }
.gameList > div.on .gname { font-weight: 700; color: var(--accent); }

/* ルール(重ねて表示)。外側か ✕ で閉じる */
#rulesView { position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.35); display: grid; place-items: center; padding: 16px; }
#rulesView .box { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; width: min(640px, 100%);
                  max-height: calc(100dvh - 32px); display: flex; flex-direction: column; }
#rulesView .head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
#rulesView .head h2 { flex: 1; margin: 0; }
#rulesView .head button { border: 0; background: none; padding: 4px 10px; }
#rulesBody { overflow: auto; padding: 4px 16px 16px; line-height: 1.7; }

/* ログ: ゲーム中は「ゲームのログ」の下に、閉じた「部屋のログ」。ロビーの「部屋のログ」は開いたままの見出しにする */
#hubLogs { display: contents; }
#hubLog > summary { font-size: 16px; }
#hubLog[open] > summary { margin-bottom: 8px; }
#hubLog.fixed > summary { list-style: none; cursor: default; pointer-events: none; }
#hubLog.fixed > summary::-webkit-details-marker { display: none; }

/* 音量のパネル(ヘッダーの 🔊 の下に開く。位置は room-client.js が入れる) */
#volPanel { position: fixed; z-index: 26; width: 220px; display: grid; gap: 8px; padding: 12px 14px; background: var(--panel); color: var(--text);
            border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
#volPanel .row { justify-content: space-between; }
#volPanel input[type=range] { width: 100%; accent-color: var(--accent); }
#volPanel button { padding: 6px 10px; font-size: 14px; }
