/* Card Salon (web) — Midnight Blue Note の配色 */
:root {
  --bg-top: #0A1224;
  --bg-bottom: #16264A;
  --felt: #14355F;
  --felt-edge: #0B1D38;
  --accent: #C9A24B;
  --text: #F3EBD8;
  --text-2: #A9B2C6;
  --panel: rgba(14, 26, 51, 0.78);
  --card-face: #F6F0E2;
  --card-back: #12264A;
  --card-back-line: #C9A24B;
  --spade: #16181F;
  --heart: #C8322B;
  --diamond: #1F5FBF;
  --club: #1E7F3C;
  --danger: #D9604F;
  --rail: 160px;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", Georgia, serif;
  --sans: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #05080F;
  color: var(--text);
  font-family: var(--serif);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- 全体の枠: 上下はブラウザの端に固定、横長のゲーム画面、左右に広告 ---- */
.layout {
  height: 100vh;
  height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 16px;
}
.stage {
  min-width: 0;
  position: relative;
  height: 100%;
  /* 16:10 を基本に、横幅が足りなければ画面いっぱいまで */
  width: min(calc(100dvh * 1.6), 100vw);
  container-type: size;
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  overflow: hidden;
}
.ad-rail {
  flex: 0 0 var(--rail);
  display: none;
  align-items: center;
  justify-content: center;
}
.ad-slot {
  width: 160px; height: 600px;
  border: 1px dashed rgba(201, 162, 75, 0.25);
  color: rgba(169, 178, 198, 0.4);
  display: flex; align-items: center; justify-content: center;
  text-align: center; font: 12px var(--sans);
  border-radius: 8px;
}
/* 広告枠は、ゲーム画面の横に十分な余白があるときだけ出す（ゲームの操作エリアとは離す） */
@media (min-aspect-ratio: 2/1) and (min-width: 1100px) {
  .ad-rail { display: flex; }
  .stage { width: min(calc(100dvh * 1.6), calc(100vw - 2 * var(--rail) - 48px)); }
}

/* 縦向きのスマホ向けのお知らせ */
.rotate-hint {
  display: none;
  position: absolute; left: 50%; top: 9cqh; transform: translateX(-50%);
  z-index: 50; padding: 0.6em 1em; border-radius: 999px; pointer-events: none;
  background: var(--panel); border: 1px solid rgba(201, 162, 75, 0.4);
  font: 13px var(--sans); color: var(--text-2); white-space: nowrap;
  animation: hint-out 0.5s ease 5s forwards; /* ボタンの邪魔をしないよう、しばらくしたら消す */
}
@keyframes hint-out { to { opacity: 0; visibility: hidden; } }
@media (orientation: portrait) and (max-width: 820px) { .rotate-hint { display: block; } }

/* ---- 共通パーツ ---- */
.layer { position: absolute; inset: 0; }
.layer.fx { pointer-events: none; z-index: 30; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.btn {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(14px, min(2.4cqh, 1.92cqw), 22px);
  padding: 0.55em 1.6em; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--accent); background: transparent; color: var(--accent);
  transition: transform 0.08s ease, opacity 0.15s ease, background 0.15s ease;
}
.btn.filled { background: var(--accent); color: var(--bg-top); }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn.small { font-size: clamp(12px, min(1.9cqh, 1.52cqw), 19px); padding: 0.4em 1.1em; }
.icon-btn {
  background: var(--panel); border: 1px solid rgba(201, 162, 75, 0.35); color: var(--accent);
  border-radius: 999px; padding: 0.45em 1em; cursor: pointer;
  font: 600 clamp(12px, min(1.8cqh, 1.44cqw), 19px) var(--serif);
}
.chip {
  display: inline-flex; align-items: center; gap: 0.4em;
  padding: 0.25em 0.9em; border-radius: 999px;
  background: var(--accent); color: var(--bg-top);
  font: 700 clamp(12px, min(2cqh, 1.6cqw), 19px) var(--serif);
}
.chip.lock { background: var(--card-face); border: 2px solid var(--accent); font-size: clamp(14px, min(2.6cqh, 2.08cqw), 22px); }
.panel {
  background: var(--panel); border: 1px solid rgba(201, 162, 75, 0.3); border-radius: 18px;
}

/* ---- ロビー ---- */
.lobby {
  align-items: center; justify-content: safe center;
  gap: clamp(16px, 2.4cqh, 28px);
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow-y: auto;
}
.lobby > :not(.backdrop) { flex-shrink: 0; max-width: 100%; }
.lobby .backdrop {
  position: absolute; right: 2%; bottom: 0; height: 88%; opacity: 0.16;
  filter: brightness(1.6) sepia(0.4); pointer-events: none;
}
.brand { text-align: center; z-index: 1; }
.brand h1 {
  margin: 0; color: var(--accent); letter-spacing: 0.16em;
  font: 600 clamp(26px, min(6.4cqh, 5.12cqw), 42px) var(--serif);
}
.brand p { margin: 0.6em 0 0; color: var(--text-2); font-size: clamp(13px, min(2.4cqh, 1.92cqw), 21px); letter-spacing: 0.2em; }
.brand hr { width: 7cqh; border: 0; border-top: 1px solid var(--accent); margin: 2.2cqh auto 0; opacity: 0.7; }
.tables {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: clamp(12px, 1.6cqw, 20px); width: min(100%, 1100px); z-index: 1;
}
.table-card {
  width: 100%; min-width: 0; padding: clamp(16px, 2cqw, 24px); text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid rgba(201, 162, 75, 0.4); border-radius: 20px;
  color: var(--text); font-family: var(--serif);
  transition: border-color 0.15s ease, transform 0.12s ease;
}
.table-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.table-card .kana { overflow-wrap: anywhere; color: var(--accent); letter-spacing: 0.2em; font-size: clamp(11px, min(1.7cqh, 1.36cqw), 18px); }
.table-card h2 { margin: 0.2em 0 0.15em; font-size: clamp(15px, min(3cqh, 2.4cqw), 24px); white-space: normal; overflow-wrap: anywhere; line-height: 1.45; }
.table-card p { margin: 0; color: var(--text-2); font-size: clamp(11px, min(1.8cqh, 1.44cqw), 18px); line-height: 1.55; }
.lobby-footer {
  position: relative; width: 100%; text-align: center; line-height: 1.8; overflow-wrap: anywhere;
  color: var(--text-2); font: clamp(11px, min(1.6cqh, 1.28cqw), 18px) var(--sans); z-index: 1;
}
.lobby-footer a { color: var(--accent); }
.lobby-tools { position: relative; order: -1; align-self: flex-end; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; z-index: 2; }

/* ---- 設定（開始前） ---- */
.setup { align-items: center; justify-content: center; }
.setup .panel { width: min(96cqw, max(70cqw, 92cqh)); max-height: 92cqh; overflow: auto; padding: 3cqh 4cqh; }
.setup h2 { margin: 0 0 2cqh; color: var(--accent); font-size: clamp(20px, min(4cqh, 3.2cqw), 32px); }
.setup .row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2cqh; padding: 1.4cqh 0; border-bottom: 1px solid rgba(169, 178, 198, 0.12); }
.setup .row label { font-size: clamp(14px, min(2.3cqh, 1.84cqw), 22px); }
.setup .note { color: var(--text-2); font: clamp(12px, min(1.8cqh, 1.44cqw), 19px) var(--sans); line-height: 1.6; margin: 0.4em 0 0; }
.seg { display: inline-flex; flex-wrap: wrap; background: rgba(0, 0, 0, 0.25); border-radius: 999px; padding: 3px; }
.seg button {
  border: 0; background: transparent; color: var(--text-2); cursor: pointer;
  padding: 0.4em 1em; border-radius: 999px; font: 600 clamp(12px, min(1.9cqh, 1.52cqw), 19px) var(--serif);
}
.seg button.on { background: var(--accent); color: var(--bg-top); }
.setup .actions { display: flex; gap: 2cqh; justify-content: center; margin-top: 3cqh; }
.rules-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6cqh 3cqh; margin-top: 1cqh; }
.rules-list label { display: flex; align-items: center; gap: 0.6em; font-size: clamp(12px, min(1.9cqh, 1.52cqw), 19px); color: var(--text-2); cursor: pointer; }

/* ---- ゲーム画面 ---- */
.game { padding: 1.6cqh 2cqh 1.2cqh; gap: 1.2cqh; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1cqh; }
.topbar .title { color: var(--accent); font-size: clamp(14px, min(2.6cqh, 2.08cqw), 22px); letter-spacing: 0.1em; }
.topbar .tools { display: flex; gap: 1cqh; }

.seats { display: flex; gap: 1.2cqh; justify-content: center; }
.seat {
  flex: 0 1 18cqh; min-width: 0; padding: 1cqh 1cqh 1.2cqh; text-align: center;
  background: var(--panel); border: 1px solid rgba(201, 162, 75, 0.2); border-radius: 14px;
  position: relative; transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.seat.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 18px rgba(201, 162, 75, 0.35); }
.seat.out { opacity: 0.55; }
.seat .avatar {
  width: 7.6cqh; height: 7.6cqh; border-radius: 50%; margin: 0 auto;
  background: var(--accent) center/cover no-repeat; border: 2px solid rgba(0, 0, 0, 0.3);
}
.seat .name { font-weight: 700; font-size: clamp(13px, min(2.3cqh, 1.84cqw), 21px); margin-top: 0.5cqh; }
.seat .count { color: var(--text-2); font-size: clamp(11px, min(1.8cqh, 1.44cqw), 18px); }
.seat .action { min-height: 4.4cqh; margin-top: 0.6cqh; display: flex; justify-content: center; align-items: center; gap: 2px; font-size: clamp(11px, min(1.8cqh, 1.44cqw), 18px); color: var(--text-2); }
.seat .badge { position: absolute; top: -1.2cqh; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: clamp(11px, min(1.6cqh, 1.28cqw), 18px); padding: 0.15em 0.7em; }

.table {
  flex: 1; min-height: 0; border-radius: 28px; position: relative;
  background: radial-gradient(ellipse at center, #1C477C 0%, var(--felt) 45%, var(--felt-edge) 100%);
  border: 1px solid rgba(201, 162, 75, 0.45);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6cqh;
}
.table .badges { display: flex; gap: 1cqh; min-height: 4.4cqh; align-items: center; }
.table .field { display: flex; gap: 0.8cqh; align-items: center; justify-content: center; min-height: 18cqh; }
.table .caption { color: var(--accent); font-size: clamp(13px, min(2.3cqh, 1.84cqw), 21px); min-height: 3cqh; }
.table .hint { color: var(--text-2); font-size: clamp(12px, min(2cqh, 1.6cqw), 19px); }

.status { display: flex; align-items: center; justify-content: center; gap: 1.2cqh; min-height: 4.6cqh; }
.status .turn { font-size: clamp(12px, min(1.9cqh, 1.52cqw), 19px); padding: 0.25em 0.9em; letter-spacing: 0.08em; }
.status .msg { font-size: clamp(13px, min(2.3cqh, 1.84cqw), 21px); color: var(--text); }
.controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 1cqh 2cqh; min-height: 6cqh; }

.hand { position: relative; height: 21cqh; display: flex; justify-content: center; align-items: flex-end; padding-bottom: 0.6cqh; }
.hand .slot { position: relative; cursor: pointer; transition: transform 0.15s ease; }
/* 札の幅は 19cqh / 1.4 ≒ 13.6cqh。横幅に収まるよう、重なりを札の枚数(--n)から決める */
.hand .slot + .slot {
  margin-left: calc(-1 * max(var(--overlap, 4.2cqh), (var(--n, 1) * 13.6cqh - 100cqw + 4cqh) / max(var(--n, 1) - 1, 1)));
}
.hand .slot.sel { transform: translateY(-2.6cqh); }
.hand .slot.dim { filter: brightness(0.62); }
.hand .slot.hi .card-svg { filter: drop-shadow(0 0 8px var(--accent)); }

.card-svg { display: block; filter: drop-shadow(0 0.4cqh 0.6cqh rgba(0, 0, 0, 0.4)); }

/* ババ抜き: 相手の伏せ札 */
.fan { display: flex; justify-content: center; }
.fan .slot { cursor: pointer; transition: transform 0.15s ease; }
.fan { max-width: 100%; }
/* 伏せ札の幅は 17cqh / 1.4 ≒ 12.14cqh。卓の幅に収まるよう、重なりを枚数(--n)から決める */
.fan .slot + .slot { margin-left: calc(-1 * max(3.2cqh, (var(--n, 1) * 12.14cqh - 100cqw + 8cqh) / max(var(--n, 1) - 1, 1))); }
.fan .slot:hover { transform: translateY(-1.6cqh); }

/* カットイン */
.cutin {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(0.9);
  z-index: 30; pointer-events: none; opacity: 0;
  padding: 2cqh 5cqh; border-radius: 18px; text-align: center;
  background: rgba(10, 18, 36, 0.92); border: 1.5px solid var(--accent);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.cutin.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.cutin .t { color: var(--accent); font: 700 clamp(20px, min(5cqh, 4cqw), 32px) var(--serif); letter-spacing: 0.08em; }
.cutin .s { color: var(--text); font-size: clamp(12px, min(2.2cqh, 1.76cqw), 19px); margin-top: 0.4em; }
.cutin.emph .t { color: #FFD873; }

/* 結果 */
.overlay {
  position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: rgba(3, 6, 14, 0.62);
}
.result { width: min(60cqw, 80cqh); padding: 3.4cqh 4cqh; text-align: center; }
.result h2 { margin: 0 0 2cqh; color: var(--accent); letter-spacing: 0.3em; font-size: clamp(20px, min(4.4cqh, 3.52cqw), 32px); }
.result .rows { display: grid; gap: 1cqh; text-align: left; }
.result .r { display: flex; align-items: center; gap: 1.6cqh; padding: 0.8cqh 1.4cqh; border-radius: 12px; background: rgba(0, 0, 0, 0.2); }
.result .r.me { border: 1px solid var(--accent); }
.result .r .lbl { min-width: 7em; font-weight: 700; }
.result .r .avatar { width: 4.6cqh; height: 4.6cqh; border-radius: 50%; background: var(--accent) center/cover; }
.result .foot { color: var(--text-2); font-size: clamp(12px, min(1.8cqh, 1.44cqw), 19px); margin: 2cqh 0 0; }
.result .actions { display: flex; gap: 2cqh; justify-content: center; margin-top: 2.4cqh; }

/* ログ */
.log { position: absolute; top: 7cqh; right: 2cqh; bottom: 2cqh; width: min(40cqw, 52cqh); z-index: 35; display: flex; flex-direction: column; }
.log header { display: flex; justify-content: space-between; align-items: center; padding: 1.6cqh 2cqh; border-bottom: 1px solid rgba(169, 178, 198, 0.15); }
.log ol { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.log li { padding: 0.9cqh 2cqh; border-bottom: 1px solid rgba(169, 178, 198, 0.08); font: clamp(12px, min(1.9cqh, 1.52cqw), 19px) var(--sans); }
.log li.div { color: var(--accent); font-weight: 700; border: 0; padding-top: 1.6cqh; }

.noscript { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }

/* 開始演出 */
.deal { position: absolute; inset: 0; background: rgba(3, 6, 14, 0.5); cursor: pointer; }
.deal-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }

.howto { margin: 0; padding-left: 1.4em; display: grid; gap: 1.2cqh; color: var(--text); font: clamp(13px, min(2.1cqh, 1.68cqw), 21px)/1.7 var(--sans); }

/* ---- 7並べ ---- */
/* 盤面の札の大きさは、卓の大きさから決める（cqh/cqw が卓を基準にする） */
.table.board-host { container-type: size; }
.sevens-board { display: grid; gap: 2cqh; }
.sevens-board .row { display: flex; gap: 0.5cqw; justify-content: center; }
.sevens-board .cell { position: relative; border-radius: 6px; }
.sevens-board .empty {
  border: 1px dashed rgba(201, 162, 75, 0.35); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(201, 162, 75, 0.45); font-size: max(12px, 8cqh);
}
.sevens-board .cell.last .card-svg { filter: drop-shadow(0 0 6px var(--accent)); }
.sevens-board .cell.exposed .card-svg { opacity: 0.72; }
.sevens-board .cell.target { cursor: pointer; }
.sevens-board .cell.target .empty { border: 2px solid var(--accent); background: rgba(201, 162, 75, 0.18); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { background: rgba(201, 162, 75, 0.38); } }

/* ---- 神経衰弱 ---- */
.mem-grid { display: grid; gap: 1cqh; justify-content: center; align-content: center; }
.mem-card { border-radius: 8px; transition: transform 0.12s ease, opacity 0.4s ease; }
.mem-card.can { cursor: pointer; }
.mem-card.can:hover { transform: translateY(-0.6cqh); }
.mem-card.gone { visibility: hidden; }
.mem-card.flash .card-svg { filter: drop-shadow(0 0 10px #FFD873); }
.mem-card.flip { animation: flipin 0.3s ease; }
@keyframes flipin { 0% { transform: scaleX(0.05); } 100% { transform: scaleX(1); } }
.seat.compact { flex-basis: 15cqh; padding: 0.8cqh; }
.seat.compact .avatar { width: 5cqh; height: 5cqh; }
.seat.me { border-color: rgba(201, 162, 75, 0.5); }

/* ---- ソリティア（このゲームだけ、♠♣は黒・♥♦は赤の2色） ---- */
.klondike { --diamond: var(--heart); --club: var(--spade); --kw: min(10.4cqh, 11.6cqw); --kh: calc(var(--kw) * 1.4); }
.k-table { justify-content: flex-start; padding: 2.4cqh 2cqh; gap: 2.4cqh; }
.k-row { display: grid; grid-template-columns: repeat(7, var(--kw)); gap: min(2.4cqh, 1.6cqw); justify-content: center; }
.k-tableau { flex: 1; min-height: 0; }
.k-pile, .k-col { position: relative; width: var(--kw); height: var(--kh); cursor: pointer; }
.k-col { height: 100%; }
.k-card, .k-fan { position: absolute; left: 0; top: 0; }
.k-empty {
  width: var(--kw); height: var(--kh); border-radius: 8px; border: 1px dashed rgba(201, 162, 75, 0.45);
  display: flex; align-items: center; justify-content: center; color: rgba(201, 162, 75, 0.55); font-size: max(14px, 3.4cqh);
}
.k-empty .suit.s1, .k-empty .suit.s2 { color: rgba(200, 50, 43, 0.6); }
.k-pile.sel .card-svg, .k-fan.sel .card-svg, .k-card.sel .card-svg { filter: drop-shadow(0 0 7px var(--accent)) brightness(0.93); }
.k-pile.hi, .k-fan.hi .card-svg, .k-card.hi .card-svg { filter: drop-shadow(0 0 9px #FFD873); }
.k-col.dest::before {
  content: ''; position: absolute; left: -0.5cqh; right: -0.5cqh; top: -0.5cqh; bottom: 0;
  border: 2.5px solid var(--accent); border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 12px rgba(201, 162, 75, 0.45);
}
.klondike .tools .chip { font-size: max(12px, 1.9cqh); }

/* ---- ハーツ: トリックを十字に並べる（下=あなた, 左=1, 上=2, 右=3）。大きさは卓が基準 ---- */
.h-table { justify-content: flex-start; }
.h-chips { position: absolute; top: 3cqh; left: 2cqw; display: flex; flex-direction: column; align-items: flex-start; gap: 1.2cqh; z-index: 1; }
.h-chip { background: var(--panel); color: var(--text-2); border: 1px solid rgba(201, 162, 75, 0.35); font-weight: 600; }
.h-chip.on { color: var(--danger); }
.h-chip.accent { color: var(--accent); }
.h-cross { position: absolute; inset: 0; }
.h-trick { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); }
.h-trick.new { animation: h-in 0.25s ease; }
.h-trick.p0 { transform: translate(-50%, calc(-50% + 25cqh)); }
.h-trick.p1 { transform: translate(calc(-50% - 14cqw), -50%); }
.h-trick.p2 { transform: translate(-50%, calc(-50% - 25cqh)); }
.h-trick.p3 { transform: translate(calc(-50% + 14cqw), -50%); }
.h-trick.win .card-svg { filter: drop-shadow(0 0 10px var(--accent)); outline: 3px solid var(--accent); outline-offset: -2px; border-radius: 10%; }
@keyframes h-in { from { opacity: 0; } to { opacity: 1; } }

/* ---- ジンラミー ---- */
.g-score { display: flex; flex-direction: column; justify-content: center; }
.g-total { color: var(--accent); font: 700 max(20px, 5cqh) var(--serif); }
.g-table { justify-content: center; gap: 4cqh; }
.g-cpu { min-height: 10cqh; color: var(--text-2); font-size: max(12px, 6cqh); text-align: center; padding: 0 2cqw; }
.g-piles { display: flex; gap: 8cqw; justify-content: center; }
.g-pile { display: flex; flex-direction: column; align-items: center; gap: 1.5cqh; border-radius: 10px; }
.g-pile.can { cursor: pointer; }
.g-pile.can .card-svg, .g-pile.can .k-empty { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 10%; }
.g-label { color: var(--text-2); font-size: max(11px, 5cqh); }
.g-chips { display: flex; gap: 1.5cqw; justify-content: center; }
/* 手札: ミールごとにまとめ、境目に隙間 */
.g-hand { gap: 0; }
.g-hand .g-group { display: flex; align-items: flex-end; }
/* 組の境目も重ねて、隙間ぶん（最大4か所）を見込んで横幅に収める */
.g-hand { --ov: max(4.2cqh, (var(--n, 1) * 13.6cqh - 100cqw + 10cqh) / max(var(--n, 1) - 1, 1)); }
.g-hand .slot + .slot { margin-left: calc(-1 * var(--ov)); }
.g-hand .g-group + .g-group { margin-left: calc(-1 * var(--ov) + 1.4cqh); }
.g-hand .slot.meld { transform: translateY(-1.6cqh); }
.g-reveal { display: flex; flex-wrap: wrap; gap: 1.2cqh; justify-content: center; margin-top: 2cqh; }
.g-reveal .g-group { display: inline-flex; }
.g-reveal .g-group .card-svg + .card-svg { margin-left: -2.6cqh; }
.g-reveal .g-group.dw { opacity: 0.75; }
.g-reveal .g-group.laid { outline: 2px dashed var(--accent); outline-offset: 3px; border-radius: 8px; }

/* ---- セブンブリッジ ---- */
.sb-table { flex-direction: row; align-items: stretch; justify-content: flex-start; gap: 2cqw; padding: 1.6cqh 2cqw; }
.sb-piles { display: flex; flex-direction: column; justify-content: center; gap: 2cqh; }
.sb-label { font-size: max(11px, 1.8cqh); }
.sb-melds { flex: 1; min-width: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 44cqh), 1fr)); gap: 1cqh 1.4cqw; align-content: start; }
.sb-melds .hint { align-self: center; }
.sb-meld { display: flex; align-items: center; gap: 1cqh; padding: 0.6cqh 1cqh; border-radius: 10px; background: rgba(0, 0, 0, 0.18); border: 2px solid transparent; }
.sb-meld.can { border-color: var(--accent); cursor: pointer; }
.sb-owner { color: var(--text-2); font-size: max(11px, 1.7cqh); min-width: 5em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-cards { display: flex; flex: 1; }
.sb-slot { position: relative; }
.sb-slot + .sb-slot { margin-left: -2cqh; }
.sb-slot i { position: absolute; bottom: -0.6cqh; left: 50%; transform: translateX(-50%); font: 700 max(10px, 1.5cqh) var(--sans); color: var(--accent); background: var(--panel); padding: 0 0.4em; border-radius: 6px; font-style: normal; }
.sb-meld .chip { font-size: max(10px, 1.5cqh); padding: 0.15em 0.6em; }

.sh-suit { font-size: max(20px, 3.6cqh); padding: 0.1em 0.9em; }

/* Interface reflow follows the stage width, including when ad rails are visible. */
.brand { min-width: 0; }
.brand h1 { font-size: clamp(24px, min(6.4cqh, 6cqw), 52px); overflow-wrap: anywhere; }
.brand p { line-height: 1.7; }
.btn, .icon-btn, .seg button { max-width: 100%; overflow-wrap: anywhere; }
.setup h2 { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.setup h2 .icon-btn { float: none !important; }
.setup .row > *, .rules-list label { min-width: 0; max-width: 100%; }
.rules-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.rules-list input { flex-shrink: 0; }
.setup .actions, .result .actions { flex-wrap: wrap; }
.topbar, .topbar .tools, .status { flex-wrap: wrap; }
.topbar .title, .status .msg { min-width: 0; overflow-wrap: anywhere; }
.seat .name, .seat .count, .seat .action { overflow-wrap: anywhere; }
.table .caption, .table .hint { max-width: 100%; text-align: center; overflow-wrap: anywhere; }
.result { width: min(92cqw, 640px); max-height: 90cqh; overflow-y: auto; }
.result .r { flex-wrap: wrap; }
.result .r .lbl { min-width: 0; overflow-wrap: anywhere; }
.rotate-hint { max-width: 92cqw; white-space: normal; text-align: center; }
@container (max-width: 600px) {
  .setup .panel { padding: 20px 16px; }
  .setup .row { align-items: flex-start; gap: 10px; }
  .setup .row > .seg { width: 100%; border-radius: 16px; }
  .seg button { flex: 1 1 auto; min-height: 40px; }
  .topbar .tools { gap: 6px; }
  .log { width: 92cqw; }
}
/* Rotation is useful during play; it should not cover lobby or setup text. */
.stage:has(.lobby, .setup) > .rotate-hint { display: none; }
