/* Play tables: Pokémon, Magic, Yu-Gi-Oh. Phone-first: opponent on top (mirrored), you at the bottom, hand along the edge. */

body.at-table { overflow: hidden; }
body.at-table .tabbar { display: none; }
.play-table {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; color: #fff;
  background: #0d0f14; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  user-select: none; -webkit-user-select: none;
}
.pt-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: rgba(0, 0, 0, .35); flex: none; }
.pt-bar button { border: 0; background: rgba(255, 255, 255, .1); color: #fff; border-radius: 999px; min-width: 38px; min-height: 38px; padding: 0 12px; font: 700 15px var(--body); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pt-bar svg { width: 18px; height: 18px; }
.pt-title { flex: 1; min-width: 0; display: grid; line-height: 1.2; }
.pt-title b { font-family: var(--display); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-title small { font-size: 12px; opacity: .75; }

.mat { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 4px; padding: 6px 8px; overflow: hidden; position: relative; }
.mat-pokemon { background: radial-gradient(120% 60% at 50% 50%, #2f8f63, #1b5e43 60%, #123e2d); }
.mat-pokemon::before { content: ""; position: absolute; inset: 8px; border: 2px solid rgba(255, 255, 255, .18); border-radius: 14px; pointer-events: none; }
.mat-pokemon::after { content: ""; position: absolute; left: 50%; top: 50%; width: 88px; height: 88px; margin: -44px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .16); pointer-events: none; }
.mat-mtg { background: radial-gradient(120% 70% at 50% 50%, #3b2c1f, #22180f 60%, #120c07); }
.mat-mtg::before { content: ""; position: absolute; left: 10px; right: 10px; top: 50%; height: 1px; background: linear-gradient(90deg, transparent, #c9962f, transparent); opacity: .6; pointer-events: none; }
.mat-ygo { background: radial-gradient(120% 70% at 50% 50%, #241a3d, #140f26 60%, #0a0714); }
.mat-ygo::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(120, 90, 255, .05) 0 1px, transparent 1px 40px), repeating-linear-gradient(0deg, rgba(120, 90, 255, .05) 0 1px, transparent 1px 40px); pointer-events: none; }

.seat { position: relative; z-index: 1; display: grid; gap: 4px; }
.seat-head { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.seat-head .who { font-weight: 800; font-family: var(--display); font-size: 14px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-head .stat { background: rgba(0, 0, 0, .3); border-radius: 999px; padding: 3px 9px; color: #fff; border: 0; font: 600 12px var(--body); }
.seat-head .stat b { font-family: var(--mono); font-size: 13px; }
.seat-head .life { cursor: pointer; background: rgba(255, 255, 255, .14); }
.turn-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #ffd65a; box-shadow: 0 0 0 3px rgba(255, 214, 90, .3); vertical-align: 1px; }
.seat-empty { text-align: center; padding: 24px 10px; opacity: .8; font-size: 14px; }

/* cards */
.pc { position: relative; flex: none; aspect-ratio: 63 / 88; border-radius: 5px; overflow: hidden; box-shadow: 0 2px 6px rgba(0, 0, 0, .45); cursor: pointer; transition: transform .15s; }
.pc:not(.back) { background: rgba(0, 0, 0, .25); }   /* card backs keep their own artwork */
.pc img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc.xs { width: 26px; border-radius: 3px; }
.pc.sm { width: 40px; }
.pc.md { width: 52px; }
.pc.lg { width: 78px; }
.pc.hand { width: 66px; }
.pc.xl { width: 160px; }
.pc.slot { background: none; box-shadow: none; border: 1.5px dashed rgba(255, 255, 255, .28); display: grid; place-items: center; cursor: default; }
.pc.slot span { font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .55; }
.pc.empty { background: none; box-shadow: none; border: 1.5px dashed rgba(255, 255, 255, .2); }
.pc.tapped { transform: rotate(90deg) scale(.86); }
.pc.def { transform: rotate(90deg) scale(.86); }
.pc.back { border: 3px solid rgba(0, 0, 0, .3); }
.pc .dmg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); min-width: 26px; padding: 2px 5px; border-radius: 999px; background: #e2361c; color: #fff; font: 800 12px var(--mono); text-align: center; box-shadow: 0 0 0 2px #fff; }
.pc .cond { position: absolute; left: 2px; top: 2px; padding: 1px 4px; border-radius: 4px; background: #6b2fa0; color: #fff; font: 800 9px var(--body); }
.pc .att { position: absolute; right: 2px; bottom: 2px; min-width: 16px; height: 16px; border-radius: 8px; background: #ffd65a; color: #3b2405; font: 800 10px var(--mono); display: grid; place-items: center; }
.pc .mat { position: absolute; right: 2px; top: 2px; min-width: 16px; height: 16px; border-radius: 8px; background: #b88cff; color: #1a1030; font: 800 10px var(--mono); display: grid; place-items: center; }
.pc .ctrs { position: absolute; left: 2px; bottom: 2px; display: grid; gap: 1px; }
.pc .ctr { padding: 0 4px; border-radius: 4px; background: rgba(0, 0, 0, .8); color: #fff; font: 800 9px var(--mono); }
.token-face { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; text-align: center; padding: 4px; background: linear-gradient(160deg, #eee, #bbb); color: #222; }
.token-face b { font-size: 9px; line-height: 1.1; }
.token-face small { font-size: 8px; opacity: .6; }

/* Pokémon */
.bench-row { display: flex; gap: 5px; justify-content: center; }
.active-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.active-spot { display: grid; place-items: center; }
.prizes { display: grid; grid-template-columns: repeat(2, 26px); gap: 3px; }
.piles { display: flex; gap: 6px; align-items: flex-start; }
.seat.opp .active-row .piles, .seat.opp .prizes { opacity: .95; }
.pile { position: relative; border: 0; background: none; padding: 0; color: #fff; display: grid; justify-items: center; gap: 2px; cursor: pointer; font: inherit; }
.pile .pl { font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; opacity: .8; }
.pile .pn { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; border-radius: 9px; background: #111; border: 1.5px solid rgba(255, 255, 255, .6); font: 800 10px var(--mono); display: grid; place-items: center; }
.mat-mtg .piles { justify-content: center; }

/* Magic */
.bf-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; min-height: 44px; padding: 4px; border-radius: 10px; background: rgba(255, 255, 255, .04); }
.bf-row.lands { min-height: 36px; }
.bf-empty { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; opacity: .35; }
.bf-row .pc.tapped { margin: 0 8px; }

/* Yu-Gi-Oh */
.ygo-grid { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; }
.ygo-side { display: grid; gap: 6px; justify-items: center; }
.ygo-mid { display: grid; gap: 6px; }
.ygo-row { display: flex; gap: 5px; justify-content: center; }
.ygo-row .pc.md { width: 46px; }
.ygo-row .pc.slot { border-color: rgba(150, 120, 255, .45); box-shadow: inset 0 0 10px rgba(120, 90, 255, .25); }
.ygo-row.monster .pc.slot { border-color: rgba(255, 150, 80, .45); box-shadow: inset 0 0 10px rgba(255, 140, 60, .2); }

.mid-strip { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; min-height: 34px; }
.shared { display: flex; align-items: center; gap: 6px; }
.shared.emz { gap: 18px; }
.phase-bar { display: flex; gap: 3px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.phase-bar button { border: 0; border-radius: 999px; padding: 4px 8px; background: rgba(255, 255, 255, .1); color: #fff; font: 700 10.5px var(--body); white-space: nowrap; cursor: pointer; }
.phase-bar button.on { background: #ffd65a; color: #3b2405; }
.roll { font-size: 12px; background: rgba(0, 0, 0, .4); padding: 3px 10px; border-radius: 999px; }
.log-line { border: 0; background: rgba(0, 0, 0, .3); color: rgba(255, 255, 255, .85); font: 500 11.5px var(--body); padding: 4px 10px; border-radius: 999px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }

.hand-row { flex: none; display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px calc(8px + 50px) 10px; background: linear-gradient(180deg, rgba(0, 0, 0, .25), rgba(0, 0, 0, .55)); scrollbar-width: none; min-height: 112px; align-items: flex-start; }
.hand-row .pc { transition: transform .15s; }
.hand-row .pc:active { transform: translateY(-6px); }
.end-turn { position: fixed; right: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 10px); z-index: 61; min-height: 42px; box-shadow: 0 6px 20px rgba(0, 0, 0, .5); }
.end-turn:disabled { background: rgba(255, 255, 255, .15); color: rgba(255, 255, 255, .7); box-shadow: none; }
.wait-card { position: fixed; left: 16px; right: 16px; top: 30%; z-index: 62; padding: 18px; color: var(--ink); text-align: center; max-width: 420px; margin: 0 auto; }
.code-big { font-size: 34px; font-weight: 700; letter-spacing: .18em; margin: 8px 0 14px; }

/* sheets used at the table */
.pcard-zoom { display: grid; grid-template-columns: 140px 1fr; gap: 14px; align-items: start; margin-top: 4px; }
.pcard-zoom img { width: 140px; border-radius: 7px; box-shadow: var(--shadow); }
.dmg-line { color: var(--down); font-weight: 800; margin: 6px 0 0; }
.act-list { display: grid; gap: 8px; margin-top: 14px; }
.act-list .btn { justify-content: flex-start; }
.choose-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 10px; margin-top: 12px; }
.choose-grid button { border: 0; background: none; padding: 0; display: grid; justify-items: center; gap: 4px; color: inherit; font: inherit; cursor: pointer; }
.choose-grid .pc.md { width: 64px; }
.choose-grid small { font-size: 11px; text-align: center; line-height: 1.15; max-height: 2.3em; overflow: hidden; }
.life-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; margin-top: 12px; }
.log-list { max-height: 60vh; overflow-y: auto; margin-top: 10px; }
.log-list p { margin: 0; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }

/* hub */
.mat-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.mat-dot.g-pokemon { background: #2f8f63; } .mat-dot.g-mtg { background: #b8861f; } .mat-dot.g-ygo { background: #6e3fb0; }
.deck-choices .row { width: 100%; border: 0; background: none; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.deck-choices .row.on { background: color-mix(in srgb, var(--red) 8%, transparent); box-shadow: inset 3px 0 0 var(--red); }
.deck-choices .tick { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.deck-choices .row.on .tick { background: var(--red); border-color: var(--red); }
.fmt-seg { overflow-x: auto; scrollbar-width: none; }
.fmt-seg button { white-space: nowrap; }
.toggle-row { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); cursor: pointer; }
.toggle-row input { width: 20px; height: 20px; accent-color: var(--red); flex: none; }
.toggle-row span { display: grid; }
.toggle-row small { color: var(--ink-3); font-size: 12.5px; }

.play-mini { position: relative; height: 56px; transform: none !important; }
.play-mini span { position: absolute; width: 30px; aspect-ratio: 63 / 88; border-radius: 4px; background: linear-gradient(160deg, #2f8f63, #123e2d); box-shadow: 0 2px 6px rgba(0, 0, 0, .3); border: 2px solid #fff; }
.play-mini span:first-child { left: 2px; top: 6px; transform: rotate(-10deg); background: linear-gradient(160deg, #6e3fb0, #1a1030); }
.play-mini span:last-child { left: 16px; top: 2px; transform: rotate(8deg); }

.pc.set-mine img { opacity: .45; filter: grayscale(.4); }
.pc.set-mine { outline: 2px dashed rgba(255, 255, 255, .6); outline-offset: -2px; }
.pc .set-tag { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 1px 5px; border-radius: 4px; background: rgba(0, 0, 0, .75); color: #fff; font: 800 9px var(--body); letter-spacing: .06em; text-transform: uppercase; }

/* turn clock, spectators, game over */
.pt-title .clock { font-variant-numeric: tabular-nums; font-weight: 700; }
.pt-title .clock.low { color: #ff8a73; animation: clockPulse 1s ease-in-out infinite; }
@keyframes clockPulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .pt-title .clock.low { animation: none; } }
.watch-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font: 700 11px/1.6 var(--sans, system-ui); letter-spacing: .04em; text-transform: uppercase; background: rgba(255, 255, 255, .16); vertical-align: 2px; }
.watch-row { justify-content: center; opacity: .8; }
.time-up { position: fixed; left: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 10px); z-index: 61; min-height: 42px; background: #ffb020; color: #1b1406; box-shadow: 0 6px 20px rgba(0, 0, 0, .5); }
.over-card { position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); z-index: 62; padding: 18px; color: var(--ink); text-align: center; max-width: 420px; margin: 0 auto; animation: overUp .35s cubic-bezier(.2, .9, .3, 1.2); }
.over-card h2 { margin: 0 0 4px; font-family: var(--display); }
.over-card .two { margin-top: 12px; }
@keyframes overUp { from { transform: translateY(30px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .over-card { animation: none; } }
