/* Social Table room: one waiting room, one clear next step. */
body:not(:has(.stage-shell:not([hidden]))) { background: var(--paper); }
.host-shell { width: min(100%, 1120px); padding: 24px 36px 48px; }
.host-shell .shell-header { align-items: center; padding-bottom: 22px; border-bottom: 1px solid #dedad0; }
.brand-lockup { text-decoration: none; color: var(--ink); }
.host-shell .status, .join-shell .status { border: 0; background: #f0eee7; box-shadow: none; font: 600 .76rem var(--body); padding: 8px 12px; }
.room-intro { margin: 32px 0 28px; }
.room-intro .eyebrow { color: var(--ink-soft); text-align: left; margin-bottom: 10px; }
.room-intro h1 { margin: 0; font: 800 clamp(2.4rem, 5vw, 4rem)/1.02 var(--display); letter-spacing: -.045em; }
.room-intro > p:last-child { margin: 12px 0 0; color: var(--ink-soft); font-size: 1.05rem; }
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(290px, 1fr); gap: 28px; align-items: start; }
.lobby-table { grid-column: 1; grid-row: 2 / span 2; border: 2px solid var(--ink); border-radius: 20px; padding: 24px; background: var(--paper); box-shadow: 5px 5px 0 var(--ink); min-width: 0; }
.lobby-table .roster-heading { margin: 0 0 12px; align-items: center; }
.lobby-table h2, .invite-card h2 { font: 800 1.5rem/1.1 var(--display); letter-spacing: -.025em; margin: 0; }
.lobby-table .meta { margin: 0; font: 500 .78rem var(--body); text-align: right; }
.host-shell #roster { margin: 0; }
.host-shell #roster > li { display: grid; grid-template-columns: 26px minmax(0,1fr) auto auto; gap: 10px; min-height: 64px; padding: 12px 0; border-bottom: 1px solid #e5e1d7; align-items: center; }
.host-shell #roster > li.empty { display: block; padding: 28px 0; color: var(--ink-soft); }
.member-name { min-width: 0; overflow-wrap: anywhere; }
.host-shell .member-name strong { font-size: .95rem; }
.host-shell .member-state { font: 500 .75rem var(--body); color: #575163; }
.host-shell .computer-badge { background: #eeece5; border: 0; border-radius: 4px; font: 600 .62rem var(--body); padding: 3px 5px; color: #575163; }
.host-shell .member-menu summary { font-size: .7rem; min-height: 44px; display: flex; align-items: center; color: #575163; cursor: pointer; }
.host-shell .member-menu[open] { grid-column: 2 / -1; }
.host-shell .member-actions { flex-wrap: wrap; }
.host-shell .computer-controls { border: 0; padding: 14px 0 0; margin: 0; }
.host-shell .computer-controls p { color: var(--ink-soft); font-size: .8rem; margin: 0 0 10px; line-height: 1.5; }
.host-shell .computer-actions { display: flex; flex-wrap: wrap; flex-direction: row; gap: 10px; }
.host-shell .computer-actions button { background: #f1eee6; border: 1px solid #bcb5a8; box-shadow: none; font-size: .8rem; min-height: 44px; padding: 8px 12px; }
.host-shell .computer-actions button:disabled { opacity: .6; }
.lobby-start { margin-top: 20px; padding-top: 18px; border-top: 1px solid #dedad0; display: grid; gap: 10px; }
.lobby-start p { color: var(--ink-soft); font-size: .85rem; line-height: 1.5; margin: 0 0 2px; }
.lobby-start .primary { background: var(--pink); width: 100%; min-height: 56px; font: 800 1.1rem var(--display); }
.lobby-start .primary:disabled { background: #eeece5; color: #645d6b; border-color: #c6c0b7; box-shadow: none; }
.lobby-start .link { background: transparent; box-shadow: none; border: 0; font-size: .85rem; text-decoration: underline; }
.lobby-sidebar { grid-column: 2; grid-row: 3; display: grid; gap: 20px; min-width: 0; }
.invite-card { grid-column: 2; grid-row: 2; background: #fff0c6; border-radius: 18px; padding: 24px; border: 1px solid #e9d7a2; }
.invite-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.invite-heading .eyebrow { font-size: .62rem; margin: 0; color: var(--ink-soft); }
.invite-card > p { color: #575163; font-size: .88rem; line-height: 1.5; margin: 12px 0; }
.invite-card .code-stickers { justify-content: flex-start; gap: 8px; margin: 20px 0; }
.invite-card .code-letter { width: 48px; font-size: 2rem; border-width: 2px; border-radius: 8px; box-shadow: 2px 2px 0 var(--ink); }
.invite-card .button { width: 100%; background: var(--paper); }
.invite-card .invite-note { font-size: .74rem; margin-bottom: 0; }
.invite-card .invite-result:empty { display: none; }
.invite-card a { display: inline-flex; align-items: center; color: var(--ink); }
.text-button { border: 0; box-shadow: none; padding: 8px 0; min-height: 44px; background: transparent; color: var(--ink); text-align: left; text-decoration: underline; text-underline-offset: 4px; font: 600 .9rem var(--body); }
.host-shell .game-picker { padding: 0 4px; }
.host-shell .game-feature { margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); overflow: visible; }
.host-shell .game-feature::after { display: none; }
.host-shell .game-category { display: block; color: #675463; margin: 0 0 8px; }
.host-shell .game-feature h2 { font: 800 1.85rem/1 var(--display); text-transform: none; letter-spacing: -.035em; }
.host-shell .game-facts { display: grid; gap: 6px; margin: 12px 0 2px; }
.host-shell .game-facts span { padding: 0; border: 0; color: var(--ink-soft); font: 400 .82rem/1.45 var(--body); }
.room-options { padding: 0 4px; border-top: 1px solid #dedad0; }
.room-options > summary, .compact-options > summary { min-height: 44px; padding: 14px 0; cursor: pointer; font: 600 .85rem var(--body); }
.room-options-body { display: grid; gap: 12px; padding: 0 0 12px; }
.room-options h3, .room-options p { margin: 0; }
.room-options p { font-size: .85rem; color: var(--ink-soft); line-height: 1.5; }
.room-options .button { box-shadow: none; font-size: .85rem; }
#role-summary { color: var(--ink-soft); font-weight: 700; }
.room-options .end-room, .compact-options .end-room { min-height: 44px; border-radius: 8px; }
.rules-dialog { color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: 20px; padding: 28px; width: min(640px, calc(100% - 28px)); max-height: calc(100dvh - 40px); box-shadow: 6px 6px 0 var(--ink); }
.rules-dialog::backdrop { background: rgb(20 18 26 / 55%); }
.rules-dialog .rules-close { float: right; min-height: 44px; box-shadow: none; }
.rules-dialog h2 { font: 800 2rem var(--display); margin: 8px 0 18px; }
.rules-dialog h3 { font: 800 1rem var(--display); margin: 20px 0 8px; color: var(--ink); }
.rules-dialog p, .rules-dialog .game-promise, .rules-dialog li { font: 400 1rem/1.6 var(--body); color: var(--ink-soft); }
.rules-dialog ol { padding-left: 24px; }
.rules-dialog li { display: list-item; padding: 8px 0 8px 6px; min-height: 0; border: 0; }
.rules-dialog li::marker { color: #8b163d; font-weight: 700; }
.rules-dialog .screen-split { display: grid; grid-template-columns: 1fr; gap: 10px; }
.rules-dialog .screen-split p { padding: 14px; border: 0; border-radius: 10px; background: #f1eee6; margin: 0; }
.rules-dialog .screen-split strong { color: var(--ink); display: block; margin-bottom: 4px; }
.join-shell { width: min(100%, 640px); padding: 24px 28px 48px; }
.join-shell .shell-header { align-items: center; }
.join-shell .panel { padding: 28px; border-radius: 20px; background: var(--paper); box-shadow: 5px 5px 0 var(--ink); }
.join-shell .join-screen { margin-top: 24px; }
.join-shell .join-screen h1 { font-size: clamp(2.25rem, 8vw, 3.4rem); letter-spacing: -.045em; line-height: 1.03; }
.join-shell .join-lede { font-size: 1rem; line-height: 1.5; }
.join-shell .step-label { font-size: .65rem; color: var(--ink-soft); }
.join-shell .colors { margin-bottom: 20px; }
.join-shell .color { min-height: 76px; }
.join-shell .player-room-code { margin: 22px 0 0; }
.join-shell .player-room-code .code-letter { width: 32px; font-size: 1.2rem; }
.join-shell #hosting-only { width: 100%; text-align: center; margin-top: 10px; }
.compact-options { position: relative; }
.compact-options .end-room { position: absolute; right: 0; z-index: 5; width: 180px; background: var(--paper); }
.compact-options:not(:has([data-end-room]:not([hidden]))) { display: none; }
.close-play { position: relative; display: block; inset: auto; margin: 8px 12px 8px auto; padding: 8px 14px; min-height: 44px; font-size: .8rem; }
.child-surface:has(.close-play:not([hidden])) iframe { height: calc(100% - 60px); }
@media (max-width: 720px) {
  .host-shell { padding: 18px 20px 36px; }
  .host-shell .shell-header { padding-bottom: 16px; gap: 12px; }
  .host-shell .brand-lockup { font-size: .85rem; }
  .host-shell .brand-mark { width: 26px; height: 26px; }
  .host-shell .status { font-size: .68rem; padding: 7px 9px; }
  .room-intro { margin: 16px 0; }
  .room-intro h1 { font-size: 1.9rem; }
  .room-intro > p:last-child { font-size: .9rem; }
  .lobby-grid { grid-template-columns: 1fr; gap: 20px; }
  .lobby-table, .invite-card, .lobby-sidebar { grid-column: auto; grid-row: auto; }
  .lobby-table { padding: 18px; }
  .lobby-sidebar { gap: 22px; }
  .host-shell #roster > li { gap: 7px; grid-template-columns: 22px minmax(0,1fr) auto auto; }
  .host-shell .member-name strong { font-size: .87rem; }
  .host-shell .member-state { font-size: .68rem; }
  .invite-card { padding: 16px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 14px; align-items: center; }
  .invite-heading, .invite-card > p, #share-invite, #invite-fallback { grid-column: 1 / -1; }
  .invite-heading h2 { font-size: 1.15rem; }
  .invite-card > p { margin: 0; font-size: .8rem; }
  .invite-card .code-stickers { gap: 4px; margin: 0; }
  .invite-card .code-letter { width: 29px; font-size: 1.2rem; }
  .invite-card .button { min-height: 46px; padding: 8px; font-size: .8rem; }
  .invite-card .invite-note { display: none; }
  .invite-card #share-invite { min-height: 44px; padding: 4px 0; }
  .join-shell { padding: 20px 20px 36px; }
  .join-shell .panel { padding: 22px; }
  .join-shell .color { min-height: 70px; }
}
.guest-table { border-top: 1px solid #dedad0; margin-top: 24px; padding-top: 20px; }
.guest-table h2 { font: 800 1.4rem var(--display); margin: 0 0 12px; }
.guest-table ul { padding: 0; margin: 0; list-style: none; }
.guest-table li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px 0; min-height: 48px; }
.guest-table strong { font: 600 .9rem var(--body); overflow-wrap: anywhere; }
.guest-table li > span:last-child { font: 400 .75rem var(--body); color: var(--ink-soft); }
.join-shell .header-actions { align-items: center; gap: 4px 10px; }
.join-shell .brand-lockup { font-size: .88rem; }
.host-shell .game-feature .game-category { display: block; }
.end-dialog { max-width: 480px; }
.end-dialog h2 { line-height: 1.1; letter-spacing: -.025em; }
.end-dialog-actions { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 24px; }
.end-dialog-actions .end-room { min-height: 48px; border-radius: 10px; font: 700 .9rem var(--body); }

/* A child game owns its single scrolling play area. */
body:has(.child-surface.open) { overflow: hidden; }
.child-surface { overflow: hidden; }
.child-surface iframe { display: block; min-height: 0; }

/* Keep the optional TV lobby legible with all fifteen chairs. */
.stage-shell .brand-lockup { color: #f5efe4; }
@media (min-width: 981px) {
  .stage-shell .stage-board { padding: 8px 16px; gap: 12px; }
  .stage-shell .chair-art { width: 64px; height: 64px; }
  .stage-shell .chair { gap: 4px; }
}

/* Keep game identity ahead of invites and chairs in reading and tab order. */
.lobby-grid > .game-picker { grid-column: 1 / -1; grid-row: 1; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid #dedad0; padding: 0 0 16px; }
.lobby-grid > .game-picker .game-feature { flex: 1; }
.lobby-grid > .game-picker .game-category { margin-bottom: 6px; }
.lobby-grid > .game-picker .game-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; }
.lobby-grid > .game-picker #game-selector { max-width: 190px; }
.host-shell .computer-actions button:not(:disabled) { background: #fffdf7; border: 2px solid #14121a; color: #14121a; }
.connection-notice { position: fixed; z-index: 100; inset: auto 12px 12px; margin: 0 auto; max-width: 560px; padding: 14px 18px; border: 2px solid #14121a; border-radius: 12px; background: #fff0c6; color: #14121a; box-shadow: 2px 2px 0 #14121a; font: 600 .9rem/1.5 var(--body); }
#different-room { display: inline-block; margin-top: 12px; }
#different-room[hidden], .connection-notice[hidden] { display: none; }
@media (max-width: 720px) {
  .lobby-grid > .game-picker { grid-column: auto; grid-row: auto; gap: 12px; align-items: start; }
  .lobby-grid > .game-picker #game-selector { width: 125px; flex-shrink: 0; }
  .lobby-grid > .game-picker #game-selector label { font-size: .75rem; }
  .lobby-grid > .game-picker #game { font-size: .85rem; padding: 8px; }
  .lobby-grid > .game-picker .game-facts { display: none; }
}

.lobby-grid > .game-picker .game-feature { display: grid; grid-template-columns: minmax(0,1fr) auto; column-gap: 18px; align-items: center; }
.lobby-grid > .game-picker .game-category, .lobby-grid > .game-picker .game-facts { grid-column: 1 / -1; }
.lobby-grid > .game-picker #open-rules { grid-column: 2; grid-row: 2; white-space: nowrap; }
