/* House of Turns table kit (table.js): who's playing, chat, reactions, confirm. Needs site.css tokens. */
.table-identity, .table-confirm { width: min(440px, calc(100% - 28px)); }
.table-identity h2 { margin-bottom: 4px; }
.table-note { margin: 0 0 8px; padding: 10px 14px; border-radius: 14px; background: var(--paper); font-weight: 600; font-size: .92rem; }
.table-form { display: grid; gap: 14px; margin-top: 14px; }
.table-form .primary-button { width: 100%; }
.table-form .text-button { justify-self: center; }
.table-me { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--green) 12%, var(--card)); }
.table-me small { display: block; color: var(--muted); font-size: .8rem; }
.table-me b { font-size: 1.1rem; }
.table-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 25%, transparent); }
.table-name-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.table-dice { width: 52px; border: 2px solid var(--line); border-radius: 14px; background: var(--card); font-size: 1.3rem; transition: transform .2s; }
.table-dice:hover { transform: rotate(-15deg) scale(1.05); }
.table-preview { margin: -4px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--paper); font-size: .9rem; }
.table-preview.counted { background: color-mix(in srgb, var(--green) 14%, var(--card)); }
.table-confirm p { color: var(--ink-soft); }
.table-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* Chat: bubbles with names, quick reactions + picker (matches 4Connecting) */
.table-chat { position: relative; }
.table-chat-hint { position: absolute; top: -34px; right: 0; margin: 0; color: var(--muted); font-size: .8rem; font-weight: 600; }
.table-chat-log { display: flex; flex-direction: column; gap: 6px; height: 220px; margin: 0 -6px 4px; padding: 2px 6px; overflow-y: auto; list-style: none; overscroll-behavior: contain; }
.table-chat-log li { max-width: 85%; animation: chatIn .3s cubic-bezier(.2, 1.4, .4, 1); }
.table-chat-log .msg { align-self: flex-start; }
.table-chat-log .msg.mine { align-self: flex-end; text-align: right; }
.table-chat-log .who { display: block; margin: 0 4px 2px; color: var(--muted); font-size: .72rem; font-weight: 600; }
.table-chat-log .who .tag { margin-left: 4px; padding: 1px 6px; border-radius: 999px; background: var(--paper-deep); font-size: .66rem; }
.table-chat-log .bubble { display: inline-block; padding: 8px 12px; border-radius: 16px 16px 16px 4px; background: var(--bubble-theirs); font-size: .93rem; line-height: 1.35; text-align: left; overflow-wrap: anywhere; }
.table-chat-log .mine .bubble { border-radius: 16px 16px 4px 16px; background: var(--bubble-mine); color: var(--bubble-mine-text); }
.table-chat-log .system { align-self: center; max-width: 100%; color: var(--muted); font-size: .8rem; text-align: center; }
@keyframes chatIn { from { opacity: 0; transform: translateY(8px) scale(.92); } }
.table-reactions { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 10px 0 8px; }
.table-reactions[hidden] { display: none; }
.table-reactions button { height: 42px; border: 0; border-radius: 12px; background: var(--paper); font-size: 1.35rem; transition: transform .12s, background .15s; }
.table-reactions button:hover { transform: translateY(-2px) scale(1.08); background: var(--paper-deep); }
.table-reactions button:active { transform: scale(.88); }
.table-reactions .table-emoji-more { font-size: 1.2rem; font-weight: 700; color: var(--ink-soft); }
.table-emoji-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 0 0 8px; padding: 8px; border-radius: 14px; background: var(--paper); max-height: 180px; overflow-y: auto; animation: chatIn .15s ease-out; }
.table-emoji-picker[hidden] { display: none; }
.table-emoji-picker button { height: 38px; border: 0; border-radius: 10px; background: none; font-size: 1.3rem; transition: transform .12s; }
.table-emoji-picker button:hover { background: var(--card); transform: scale(1.12); }
.table-chat-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.table-chat-form[hidden] { display: none; }
.table-chat-form input { padding: 10px 14px; font-size: .95rem; border-radius: 999px; }
.table-chat-form button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--blue); color: #fff; font-size: 1rem; transition: transform .15s; }
.table-chat-form button:active { transform: scale(.88) rotate(-12deg); }

/* Big reactions float up the screen edge with the sender's name */
.table-reaction { position: fixed; bottom: -120px; z-index: 70; display: grid; justify-items: center; pointer-events: none; will-change: transform, opacity; animation: tableFloatUp 2.2s cubic-bezier(.2, .7, .3, 1) forwards; }
.table-reaction .big { font-size: clamp(64px, 11vw, 110px); line-height: 1; filter: drop-shadow(0 8px 14px rgba(0,0,0,.2)); animation: tableWobble .5s ease-in-out 3 alternate; }
.table-reaction .label { margin-top: 4px; padding: 3px 10px; border-radius: 999px; background: var(--ink); color: var(--on-ink); font-size: .8rem; font-weight: 700; white-space: nowrap; }
.table-reaction-bit { position: fixed; bottom: -40px; z-index: 70; font-size: 30px; pointer-events: none; will-change: transform, opacity; animation: tableBitUp 1.6s ease-out forwards; }
@keyframes tableFloatUp { 0% { transform: translateY(0) scale(.4); opacity: 0; } 15% { opacity: 1; transform: translateY(-38vh) scale(1.1); } 70% { opacity: 1; transform: translateY(-58vh) scale(1); } 100% { opacity: 0; transform: translateY(-78vh) scale(.9); } }
@keyframes tableBitUp { 0% { transform: translate(0, 0) scale(.5); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(var(--dx), -65vh) scale(1) rotate(var(--rot)); opacity: 0; } }
@keyframes tableWobble { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }

/* New message while the chat is off screen: a bubble slides up from the bottom (tap to jump to chat) */
.table-peek { position: fixed; left: 0; right: 0; width: max-content; margin-inline: auto; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 75; display: flex; align-items: center; gap: 10px; max-width: min(420px, calc(100% - 32px)); padding: 8px 16px 8px 8px; border: 0; border-radius: 999px; background: var(--card); color: var(--ink); box-shadow: 0 12px 34px rgba(0,0,0,.28), inset 0 0 0 1px var(--line); text-align: left; font: inherit; opacity: 0; transform: translateY(140%) scale(.8); pointer-events: none; transition: transform .45s cubic-bezier(.2, 1.5, .4, 1), opacity .25s; }
.table-peek.show { opacity: 1; transform: none; pointer-events: auto; }
.table-peek-avatar { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 800; }
.table-peek.show .table-peek-avatar { animation: tableWobble .3s ease-in-out 2 alternate; }
.table-peek-body { display: grid; min-width: 0; line-height: 1.25; }
.table-peek-body b { font-size: .78rem; color: var(--muted); }
.table-peek-body span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .92rem; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .table-reaction, .table-reaction-bit { display: none; } .table-peek { transition: opacity .2s; } }

/* Between games: change rules / switch game */
.table-next { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.table-next[hidden] { display: none; }
.table-next .ghost-button { min-height: 40px; padding: 8px 14px; font-size: .9rem; }
.table-pick { width: min(560px, calc(100% - 28px)); }
.table-pick .table-note { margin: 4px 0 14px; color: var(--ink-soft); }
.table-pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.table-pick-item { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 0 10px; align-items: center; padding: 10px 12px; border: 0; border-radius: 16px; background: var(--paper); color: var(--ink); text-align: left; transition: transform .15s, background .15s; }
.table-pick-item:hover:not(:disabled) { transform: translateY(-2px); background: var(--paper-deep); }
.table-pick-item:disabled { opacity: .5; cursor: default; }
.table-pick-icon { grid-row: span 2; font-size: 1.6rem; }
.table-pick-item b { font-size: .95rem; line-height: 1.2; }
.table-pick-item small { color: var(--muted); font-size: .78rem; }

/* Host leaving: just leave, or end the table for everyone */
.table-leave-options { display: grid; gap: 8px; margin: 14px 0 6px; }
.table-leave-option { display: grid; gap: 2px; padding: 12px 16px; border: 0; border-radius: 16px; background: var(--paper); color: var(--ink); text-align: left; transition: transform .15s, background .15s; }
.table-leave-option:hover { transform: translateY(-1px); background: var(--paper-deep); }
.table-leave-option small { color: var(--muted); }
.table-leave-option.hard b { color: var(--red-deep); }
.table-leave .text-button { display: block; margin: 6px auto 0; }

/* Phones: Change rules / Switch game share one row instead of stacking. */
@media (max-width: 480px) {
  .table-next { flex-wrap: nowrap; }
  .table-next .ghost-button { flex: 1 1 0; min-width: 0; padding: 8px 10px; font-size: .85rem; white-space: nowrap; }
}

/* Results: who's ready to play again */
.table-ready { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 14px 0 12px; padding: 0; list-style: none; }
.table-ready li { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--paper); text-align: left; transition: background .3s, box-shadow .3s; }
.table-ready-avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--paper-deep); color: var(--ink-soft); font-weight: 800; transition: background .3s, color .3s; }
.table-ready-text { display: grid; line-height: 1.15; }
.table-ready-text b { font-size: .88rem; }
.table-ready-text small { color: var(--muted); font-size: .74rem; font-weight: 600; }
.table-ready li:not(.ready) .table-ready-text small { animation: tableThink 1.4s ease-in-out infinite; }
.table-ready li.ready { background: color-mix(in srgb, var(--green) 18%, var(--card)); box-shadow: inset 0 0 0 2px var(--green); }
.table-ready li.ready .table-ready-avatar { background: var(--green); color: #fff; }
.table-ready li.ready small { color: var(--green); }
.table-ready li.just { animation: tableReadyPop .6s cubic-bezier(.2, 1.6, .4, 1); }
.table-ready li.just .table-ready-avatar { animation: tableWobble .25s ease-in-out 4 alternate; }
@keyframes tableReadyPop { 0% { transform: scale(.7); } 50% { transform: scale(1.15); } }
@keyframes tableThink { 50% { opacity: .45; } }
.table-again-nudge { animation: tableNudge .9s ease-in-out infinite; box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent); }
@keyframes tableNudge { 50% { transform: scale(1.06); box-shadow: 0 0 0 10px transparent; } }
@media (prefers-reduced-motion: reduce) { .table-ready li, .table-again-nudge, .table-ready small { animation: none !important; } }
