/* Live reading room */
body.app { min-height: 100dvh; display: flex; flex-direction: column; }
.rbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px; padding: 8px 16px; min-height: 56px; background: rgba(247,241,230,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.rbar .brand { font-size: 1.5rem; }
.rbar .brand .logo { width: 30px; height: 30px; }
.rbar-mid { display: flex; gap: 8px; flex: 1; justify-content: center; flex-wrap: wrap; }
.rbar-end { display: flex; align-items: center; gap: 10px; }
.pill { font-size: .8rem; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--parchment); letter-spacing: .04em; }
.pill strong { letter-spacing: .18em; color: var(--gold-deep); }
.pill.status.ok { border-color: #5b8a5b; color: #2f5a2f; }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; padding: 4px 10px; border-radius: 8px; background: var(--parchment); }
.timer.warn { background: #f3d89a; } .timer.over { background: #e8a9a0; }
.rbar select { font: inherit; font-size: .85rem; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--ivory); }
.btn.sm { min-height: 38px; padding: 7px 16px; font-size: .8rem; }
@media (max-width: 700px) { .rbar { flex-wrap: wrap; } .rbar-mid { order: 3; flex-basis: 100%; } .rbar-end { margin-left: auto; } }

/* Screens */
.screens { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.screen[hidden], .screens[hidden] { display: none; }
.card-box { width: min(100%, 440px); text-align: center; padding: 34px 26px; border: 1px solid var(--gold); border-radius: var(--radius); background: var(--parchment); box-shadow: inset 0 0 0 6px var(--parchment), inset 0 0 0 7px var(--line), 0 18px 44px rgba(110,84,30,.16); }
.card-box.wide { width: min(100%, 520px); }
.card-box h1 { font-size: clamp(2rem, 8vw, 2.8rem); }
.card-box .big { display: block; font-size: 2.6rem; color: var(--gold); animation: floaty 4s ease-in-out infinite; }
.code-input { width: 100%; min-height: 56px; margin: 6px 0 14px; text-align: center; font: 600 1.6rem var(--sans); letter-spacing: .3em; text-transform: uppercase; border: 1px solid var(--gold); border-radius: 12px; background: var(--ivory); color: var(--ink); }
.preview { position: relative; aspect-ratio: 4/3; margin: 14px 0; border-radius: 14px; overflow: hidden; background: var(--navy); border: 1px solid var(--gold); }
.preview video, .tile video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.tile.remote video { transform: none; }
.ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--gold-light); font-family: var(--serif); font-size: 1.4rem; background: var(--navy); }
.ph[hidden] { display: none; }
.card-box .field { text-align: left; }
.card-box .field label { color: var(--gold-deep); }
.card-box .field input { background: var(--ivory); }
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.linklike { background: none; border: 0; margin-top: 14px; color: var(--gold-deep); text-decoration: underline; cursor: pointer; font: inherit; font-size: .9rem; padding: 8px; }
.fine { font-size: .8rem; color: var(--ink-soft); margin: 10px 0 0; }

/* Room layout */
.room { flex: 1; display: grid; gap: 14px; padding: 14px; grid-template-columns: 1fr; align-content: start; }
.room[hidden] { display: none; }
@media (min-width: 1000px) { .room { grid-template-columns: minmax(0, 1fr) 340px; height: calc(100dvh - 56px); } .side, .stagecol { overflow-y: auto; } }
.side { display: flex; flex-direction: column; gap: 12px; order: -1; }
@media (min-width: 1000px) { .side { order: 0; } }
.tiles { position: relative; }
.tile { position: relative; overflow: hidden; border-radius: 14px; background: var(--navy); border: 1px solid var(--gold); }
.tile.remote { aspect-ratio: 16/10; max-height: 34vh; width: 100%; }
@media (min-width: 1000px) { .tile.remote { max-height: none; } }
.tile.self { position: absolute; right: 8px; bottom: 8px; width: 28%; max-width: 110px; aspect-ratio: 3/4; border-width: 2px; border-color: var(--ivory); box-shadow: 0 6px 16px rgba(0,0,0,.35); }
.tile .ph { font-size: 1rem; }
.tname { position: absolute; left: 10px; bottom: 8px; font-size: .8rem; color: #fff; background: rgba(28,26,23,.55); padding: 2px 10px; border-radius: 999px; }
.mediabtns { display: flex; gap: 8px; }
.ibtn { flex: 1; min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 6px; font: 500 .85rem var(--sans); color: var(--ink); background: var(--parchment); border: 1px solid var(--gold); border-radius: 12px; cursor: pointer; }
.ibtn[aria-pressed="false"] { background: #e8c9c3; border-color: #b4574b; text-decoration: line-through; }
.ibtn.danger { background: var(--ink); color: var(--gold-light); border-color: var(--ink); }
.panel { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(239,228,207,.7); }
.panel h3 { font-size: 1.2rem; margin-bottom: .4em; }
.panel textarea { width: 100%; font: inherit; font-size: .95rem; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--ivory); color: var(--ink); resize: vertical; }
#detailBody h4 { font-size: 1.5rem; margin: 0 0 2px; color: var(--ink); }
#detailBody .pos { color: var(--gold-deep); font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; font-weight: 600; }
#detailBody p { margin: 6px 0 10px; }

/* Table */
.stagecol { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tablewrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--gold); -webkit-overflow-scrolling: touch; }
.felt { position: relative; min-width: 640px; aspect-ratio: 16/10; background: radial-gradient(ellipse at 50% 30%, #2d3d63, var(--navy) 60%, var(--navy-deep)); background-image: radial-gradient(1px 1px at 12% 20%, #fff8 50%, transparent 52%), radial-gradient(1.5px 1.5px at 85% 18%, #f7f1e6aa 50%, transparent 52%), radial-gradient(1px 1px at 70% 85%, #fff8 50%, transparent 52%), radial-gradient(1.5px 1.5px at 30% 90%, #dcc184aa 50%, transparent 52%), radial-gradient(ellipse at 50% 30%, #2d3d63, var(--navy) 60%, var(--navy-deep)); overflow: hidden; }
.tablehint { position: absolute; inset: auto 0 12px; margin: 0; text-align: center; color: #c9cfdd; font-size: .85rem; pointer-events: none; }
.pile { position: absolute; left: 2.5%; top: 6%; width: 7%; aspect-ratio: 5/8.5; z-index: 1; }
.pile i { position: absolute; inset: 0; border-radius: 6%; background: linear-gradient(135deg, #2b3a5e, #1f2a44); border: 1.5px solid var(--gold-light); }
.pile i:nth-child(2) { transform: translate(-2px, -2px); } .pile i:nth-child(3) { transform: translate(-4px, -4px); } .pile i:nth-child(4) { transform: translate(-6px, -6px); }
.pile b { position: absolute; left: 50%; top: 100%; translate: -50% 6px; font: 500 .7rem var(--sans); color: var(--gold-light); letter-spacing: .1em; }
.pile.shuffling i:nth-child(1) { animation: rif1 1.1s ease-in-out; } .pile.shuffling i:nth-child(2) { animation: rif2 1.1s ease-in-out; } .pile.shuffling i:nth-child(3) { animation: rif1 1.1s .08s ease-in-out reverse; } .pile.shuffling i:nth-child(4) { animation: rif2 1.1s .08s ease-in-out reverse; }
@keyframes rif1 { 0%,100% { transform: none; } 30% { transform: translateX(46px) rotate(8deg); } 60% { transform: translateX(-10px) rotate(-3deg); } }
@keyframes rif2 { 0%,100% { transform: translate(-4px,-4px); } 30% { transform: translateX(-52px) rotate(-8deg); } 60% { transform: translateX(14px) rotate(3deg); } }
.slot { position: absolute; width: calc(var(--cw) * 1%); aspect-ratio: 5/8.5; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); translate: -50% -50%; }
.slot .rot { position: absolute; inset: 0; rotate: calc(var(--r, 0) * 1deg); }
.slot.crossed { z-index: 3; }
.slot .ph-box { position: absolute; inset: 0; border: 1.5px dashed rgba(220,193,132,.6); border-radius: 6%; }
.slot .lbl { position: absolute; top: 100%; left: 50%; translate: -50% 5px; width: 160%; text-align: center; font-size: clamp(9px, 1.25vw, 12px); color: #dfe3ee; line-height: 1.2; pointer-events: none; }
.felt .slot .lbl { font-size: 11px; }
.card3d { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .8s cubic-bezier(.2,.8,.2,1); cursor: default; perspective: 800px; }
.slot.up .card3d { transform: rotateY(180deg); }
.slot.dealt .card3d { animation: deal .7s cubic-bezier(.2,.8,.2,1) backwards; animation-delay: calc(var(--i, 0) * .12s); }
@keyframes deal { from { translate: calc((2.5 - var(--x)) * 8px) calc((6 - var(--y)) * 4px); opacity: 0; rotate: -12deg; } }
.face { position: absolute; inset: 0; border-radius: 6%; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 6px 16px rgba(0,0,0,.45); }
.face svg { width: 100%; height: 100%; display: block; }
.face.f { transform: rotateY(180deg); }
.slot.pick .face { outline: 2px solid var(--gold-light); outline-offset: 2px; }
.slot.click .card3d { cursor: pointer; }
.slot.click:hover .card3d { filter: brightness(1.08); }
.slot.focus .face { box-shadow: 0 0 0 2px var(--gold-light), 0 0 22px rgba(220,193,132,.7); }

.hostctl { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(239,228,207,.7); }
.hostctl[hidden] { display: none; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--gold); background: var(--ivory); font: 500 .82rem var(--sans); color: var(--ink); cursor: pointer; line-height: 1.2; text-align: left; }
.seg button small { display: block; font-size: .68rem; color: var(--ink-soft); }
.seg button[aria-pressed="true"] { background: var(--gold); border-color: #8f6e27; }
.seg button[aria-pressed="true"] small { color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chk { font-size: .8rem; color: var(--ink-soft); display: flex; gap: 6px; align-items: center; }

/* Toast + zoom */
.toast { position: fixed; left: 50%; top: 70px; translate: -50% 0; z-index: 70; width: min(92vw, 380px); padding: 16px; text-align: center; background: var(--ivory); border: 1px solid var(--gold); border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.3); }
.toast[hidden], .zoom[hidden] { display: none; }
.toast p { margin: 0 0 10px; }
.zoom { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(24,33,58,.88); backdrop-filter: blur(4px); animation: fadein .3s; }
@keyframes fadein { from { opacity: 0; } }
.zoom-in { position: relative; display: grid; gap: 18px; align-items: center; justify-items: center; width: min(100%, 760px); max-height: 100%; overflow: auto; color: var(--ivory); text-align: center; }
.zoom-card { width: min(56vw, 240px, 38vh * .588); filter: drop-shadow(0 20px 40px rgba(0,0,0,.5)); animation: pop .6s cubic-bezier(.2,.8,.2,1); }
@keyframes pop { from { transform: rotateY(90deg) scale(.8); opacity: 0; } }
.zoom-card svg { width: 100%; height: auto; border-radius: 10px; display: block; }
.zoom-txt h2 { color: var(--gold-light); margin-bottom: .2em; font-size: 2.2rem; }
.zoom-txt .eyebrow { color: var(--gold-light); }
.zoom-txt p { font-size: 1.1rem; max-width: 30em; margin: 0 auto; }
.zoom-x { position: absolute; top: -6px; right: -4px; width: 44px; height: 44px; border: 0; background: none; color: var(--ivory); font-size: 2.2rem; cursor: pointer; z-index: 2; }
@media (min-width: 700px) { .zoom-in { grid-template-columns: auto 1fr; text-align: left; justify-items: start; } .zoom-card { width: 260px; } .zoom-txt p { margin: 0; } }

.rbar-end[hidden], .rbar-mid [hidden], .panel[hidden], .hostctl[hidden], #detailBody[hidden], #detailEmpty[hidden] { display: none; }
@media (min-width: 1000px) {
  .tablewrap { overflow: hidden; }
  .felt { min-width: 0; width: min(100%, calc((100dvh - 250px) * 1.6)); margin-inline: auto; }
}
.app section { padding: 0; }
