/* Waiting rooms use document flow; live card-table positioning stays separate. */
body.is-card-lobby { height: auto; min-height: 100dvh; display: block; overflow: auto; }
body.is-card-lobby > .masthead { min-height: 72px; height: auto; padding: 8px clamp(16px,4vw,40px); width: min(1240px,100%); }
body.is-card-lobby .masthead .header-actions, body.is-card-lobby .masthead .club-tag { display: none; }
body.is-card-lobby .masthead #rules-open { margin-left: auto; order: initial; }
body.is-card-lobby #app { width: 100%; min-height: 0; flex: initial; padding: 0; }
.game-shell.card-lobby { display: block; width: min(1120px,100%); height: auto; min-height: 0; padding: 0 clamp(16px,4vw,36px) 28px; margin: auto; }
.card-lobby > .room-bar { padding: 12px 0; border-block: 1px solid var(--line); gap: 10px; min-height: 70px; }
.card-lobby .table-title { margin: 0 auto 0 0; display: grid; gap: 4px; min-width: 0; }
.card-lobby .table-title .connection { display: flex; }
.card-lobby .table-home { flex-shrink: 0; }
.card-lobby .card-room-controls { gap: 8px; }
.card-lobby .card-room-controls > button { min-height: 44px; padding: 10px 14px; font-size: 12px; white-space: nowrap; }
.card-lobby > .lobby-heading { text-align: left; padding: clamp(24px,4vw,44px) 0 24px; }
.card-lobby .lobby-heading .eyebrow { font-size: 10px; margin-bottom: 12px; }
.card-lobby .lobby-heading h1 { font-size: clamp(30px,4.2vw,48px); line-height: 1.15; margin: 0 0 12px; }
.card-lobby .lobby-heading > p:last-child { line-height: 1.7; margin: 0; font-size: 14px; }
.lobby-layout { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); gap: 24px; align-items: start; }
.lobby-seating { background: #193c52; border: 1px solid #315769; border-radius: 20px; padding: clamp(20px,3vw,32px); color: #f5ead5; min-width: 0; }
.lobby-seating-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 16px; }
.lobby-seating .eyebrow { color: #c1d4d4; font-size: 9px; margin-bottom: 10px; }
.lobby-seating h2 { color: #f5ead5; font-size: clamp(23px,2.5vw,30px); line-height: 1.25; margin: 0; }
.lobby-count { display: inline-block; border: 1px solid #ffffff35; border-radius: 100px; padding: 7px 10px; font-size: 11px; white-space: nowrap; }
.lobby-seats { list-style: none; padding: 0; margin: 26px 0 20px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.lobby-seat { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-width: 0; padding: 16px; border: 1px solid #ffffff25; background: #ffffff08; border-radius: 12px; }
.lobby-seat.is-you { border-color: #e3b86995; background: #e3b8690c; }
.lobby-seat.is-empty { border-style: dashed; background: transparent; }
.lobby-seat .avatar { width: 40px; height: 40px; overflow: hidden; font-size: 18px; }
.lobby-seat.is-empty .avatar { background: #ffffff15; color: #c1d4d4; }
.lobby-seat > div { min-width: 0; flex: 1 1 74px; }
.lobby-seat strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-seat > div > span { display: block; color: #c1d4d4; font-size: 11px; line-height: 1.6; margin-top: 3px; }
.seat-presence { flex: 0 0 100%; color: #c1d4d4; font-size: 10px; }
.seat-presence:before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #a6b5ba; margin-right: 6px; }
.seat-presence.is-online:before { background: #98c5ac; }
.lobby-team-note { color: #c1d4d4; font-size: 12px; line-height: 1.8; margin: 0 0 22px; max-width: 55ch; }
.lobby-status { display: flex; align-items: start; gap: 8px; padding-top: 18px; border-top: 1px solid #ffffff25; font-size: 12px; line-height: 1.7; }
.lobby-status .status-dot { flex-shrink: 0; margin-top: 6px; background: #98c5ac; }
.lobby-invite { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: clamp(20px,3vw,28px); min-width: 0; }
.lobby-invite > .eyebrow { font-size: 9px; margin-bottom: 12px; }
.lobby-invite h2 { font-size: 25px; line-height: 1.25; margin-bottom: 12px; }
.lobby-invite > p:not(.eyebrow) { font-size: 13px; line-height: 1.8; margin-bottom: 22px; }
.card-lobby .lobby-invite .room-code { display: grid; grid-template-columns: minmax(0,1fr) auto; width: 100%; gap: 8px; padding: 16px; border-radius: 12px; text-align: left; margin-bottom: 12px; }
.card-lobby .room-code > span:first-child { display: block; grid-column: 1; font-size: 9px; letter-spacing: .12em; }
.card-lobby .room-code strong { grid-column: 1; font-size: clamp(22px,3vw,30px); letter-spacing: .13em; overflow-wrap: anywhere; }
.card-lobby .room-code .copy-icon { grid-column: 2; grid-row: 1; font-size: 23px; text-align: right; }
.card-lobby .copy-code-label { font-size: 11px; font-weight: 700; grid-column: 2; grid-row: 2; }
.lobby-invite #copy-invite { width: 100%; display: flex; align-items: center; justify-content: space-between; min-height: 48px; font-size: 13px; }
.lobby-invite #invite-qr { display: block; width: 100%; min-height: 44px; margin: 6px 0; font-size: 12px; }
.card-lobby .lobby-controls { padding: 22px 0 0; border-top: 1px solid var(--line); margin-top: 18px; max-width: none; }
.card-lobby .lobby-controls .primary { min-height: 50px; font-size: 14px; }
.card-lobby .lobby-controls p { font-size: 12px; line-height: 1.8; margin: 12px 0 0; }
.card-lobby > .table-footer { position: static; display: flex; justify-content: space-between; align-items: center; gap: 14px; min-height: 56px; padding-top: 16px; font-size: 10px; }
.card-lobby > .table-footer .text-button { width: auto; height: auto; min-height: 44px; font-size: 12px; padding: 8px 0; }
.card-lobby > .table-footer .text-button:before { content: none; }
.card-lobby > .table-footer > span { display: block; }
.game-shell.card-lobby .lobby-promotion { position: static; display: none; width: auto; margin: 28px 0 0; }
.room-chat-toggle { position: relative; display: inline-flex; justify-content: center; align-items: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 10px; }
.chat-unread { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; border-radius: 20px; background: #c3463d; color: white; font-size: 10px; padding: 2px 4px; }
.card-room-controls .room-copy-invite { min-height: 44px; padding: 10px 14px; font-size: 12px; }
dialog.room-chat { width: min(460px,calc(100vw - 24px)); height: min(650px,calc(100dvh - 24px)); max-height: calc(100dvh - 24px); padding: 0; overflow: hidden; border-radius: 18px; border: 1px solid var(--line); }
dialog.room-chat[open] { display: flex; flex-direction: column; }
dialog.room-chat::backdrop { background: #071b2ab8; }
.room-chat-header { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 22px 22px 16px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.room-chat-header .eyebrow { font-size: 9px; margin: 0 0 8px; }
.room-chat-header h2 { font-size: 24px; margin: 0; }
#room-chat-context { font-size: 11px; margin: 8px 0 0; color: var(--muted); }
#room-chat-close { width: 44px; min-height: 44px; flex-shrink: 0; border-radius: 50%; background: #edf1e9; }
.room-chat-log { min-height: 70px; flex: 1; overflow: auto; overscroll-behavior: contain; padding: 18px 22px; }
.chat-empty { color: var(--muted); font-size: 14px; line-height: 1.8; max-width: 28ch; margin: 24px auto; text-align: center; }
.chat-message { padding: 12px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fffdf8; }
.chat-message.is-mine { background: #eaf0e7; border-color: #cfdccc; }
.chat-message > div { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.chat-message b { min-width: 0; overflow-wrap: anywhere; font-size: 12px; }
.chat-message time { flex-shrink: 0; font-size: 9px; color: var(--muted); }
.chat-message p { margin: 8px 0 0; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; white-space: pre-wrap; }
.room-reactions { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 4px; padding: 10px 18px; border-block: 1px solid var(--line); flex-shrink: 0; }
.room-reactions > button { min-width: 0; min-height: 44px; border-radius: 10px; background: transparent; font-size: 24px; }
.room-reactions > button:hover { background: #edf1e9; }
#room-chat-form { padding: 14px 22px 16px; flex-shrink: 0; }
#room-chat-form label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 7px; }
#room-chat-input { resize: none; width: 100%; min-height: 66px; padding: 10px 12px; border: 1px solid #bccbc7; border-radius: 10px; font-family: inherit; font-size: 16px; color: var(--ink); background: var(--surface); line-height: 1.5; }
.chat-compose-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 8px; }
#room-chat-count { color: var(--muted); font-size: 11px; }
#room-chat-send { min-height: 44px; padding: 10px 25px; }
#room-chat-status { font-size: 11px; line-height: 1.6; color: var(--muted); margin: 10px 0 0; }
.clipboard-buffer { position: fixed; width: 2px; height: 2px; top: 0; left: 0; padding: 0; opacity: 0; font-size: 16px; }
.manual-copy-dialog h2 { font-size: 28px; padding-right: 30px; }
.manual-copy-dialog p { font-size: 14px; line-height: 1.7; }
.manual-copy-dialog textarea { display: block; width: 100%; font: 16px/1.6 inherit; resize: vertical; padding: 12px; margin: 8px 0 16px; border: 1px solid var(--line); border-radius: 10px; }
@media(min-width:1200px) { .game-shell.card-lobby .lobby-promotion { display: block; } }
@media(max-width:900px) {
  .lobby-layout { grid-template-columns: minmax(0,1fr); gap: 18px; }
  .card-lobby .lobby-heading { padding: 26px 0 22px; }
  .card-lobby .card-room-controls #table-options { font-size: 11px; padding-inline: 10px; }
  body.is-card-table .room-chat-toggle { width: 44px; padding: 0; border: 1px solid #f5ead530; background: #ffffff0d; color: var(--cream); border-radius: 9px; }
  body.is-card-table .room-chat-toggle .chat-button-text, body.is-card-table .room-copy-invite { display: none; }
  body.is-card-table .card-room-controls { gap: 5px; }
  body.is-card-table .room-code .copy-icon { display: none; }
  body.is-card-table .table-title .eyebrow { font-size: 10px; letter-spacing: .04em; }
  body.is-card-table .room-code { min-width: 0; padding-inline: 6px; }
  body.is-card-table .room-code strong { font-size: 11px; letter-spacing: .06em; }
  body.is-card-table #notice { bottom: auto; top: calc(env(safe-area-inset-top) + 114px); padding: 8px 12px; font-size: 11px; }
}
@media(max-width:600px) {
  body.is-card-table .room-code { display: none; }
  .card-lobby .table-title .connection { font-size: 9px; }
  .card-lobby .card-room-controls .chat-button-text { display: none; }
  .card-lobby .card-room-controls > .room-chat-toggle { padding: 0; }
  .card-lobby .lobby-heading { padding: 22px 0 18px; }
  .card-lobby .lobby-heading .eyebrow { display: none; }
  .lobby-invite { order: -1; padding: 20px; }
  .lobby-invite > .eyebrow { display: none; }
  .lobby-invite h2 { font-size: 21px; margin-bottom: 8px; }
  .lobby-invite > p:not(.eyebrow) { font-size: 12px; line-height: 1.6; margin-bottom: 14px; }
  .card-lobby .lobby-invite .room-code { padding: 12px 14px; gap: 5px; margin-bottom: 10px; }
  .card-lobby .room-code strong { font-size: 25px; }
  .card-lobby .lobby-controls { margin-top: 10px; padding-top: 14px; }
  .card-lobby .lobby-controls p { font-size: 11px; margin-top: 8px; }
  .lobby-seats { grid-template-columns: minmax(0,1fr); gap: 8px; margin-block: 20px 16px; }
  .lobby-seat { flex-wrap: nowrap; padding: 12px; gap: 10px; }
  .lobby-seat .avatar { width: 32px; height: 32px; font-size: 15px; }
  .lobby-seat > div { flex: 1 1 0; }
  .lobby-seat strong { font-size: 13px; }
  .lobby-seat > div > span { font-size: 10px; }
  .lobby-seat .seat-presence { flex: 0 0 auto; font-size: 9px; }
  .lobby-team-note { font-size: 11px; margin-bottom: 14px; }
  .lobby-status { padding-top: 14px; font-size: 11px; }
  dialog.room-chat { margin: auto auto max(12px,env(safe-area-inset-bottom)); height: min(640px,calc(100dvh - 24px)); }
}
@media(max-height:500px) {
  .room-chat-header { padding: 10px 16px; }
  .room-chat-header .eyebrow, #room-chat-context { display: none; }
  .room-chat-header h2 { font-size: 22px; }
  #room-chat-form { padding: 8px 16px; }
  #room-chat-input { min-height: 42px; height: 42px; }
  #room-chat-status { margin-top: 4px; }
  .room-reactions { padding-block: 4px; }
}
