/* Viewport sized game surface;
dialogs and the lobby keep normal scrolling. */
body.play-page.in-game-table-active,body.play-page:has(#gameTableView.active) {
  height:100dvh;
  overflow:hidden!important;
  overscroll-behavior:none;
}
.play-page.in-game-table-active .app-container {
  max-width:1440px;
  height:100dvh;
  min-height:0;
  padding:0;
  overflow:hidden;
}
.play-page #gameTableView.active {
  --table-height:calc(100dvh - 12px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  display:flex!important;
  flex-direction:column;
  gap:0;
  width:100%;
  max-width:1440px;
  height:100dvh!important;
  min-height:0;
  max-height:100dvh!important;
  padding:calc(6px + env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));
  overflow:hidden!important;
  justify-content:center;
  align-items:center;
}
.game-toolbar { display:none!important; }
.table-brand {
  width:36px;
  height:36px;
  border-radius:9px;
}
.table-actions {
  display:flex;
  align-items:center;
  gap:6px;
  margin-left:auto;
}
.table-room-code {
  color:#9caec8;
  font-size:11px;
  letter-spacing:1px;
  margin-right:5px;
}
.play-page .game-toolbar .hud-btn {
  min-width:36px;
  height:34px;
  padding:0 9px;
  border-radius:9px;
}
.play-page .game-toolbar .hud-turn-pill {
  display:flex;
  min-width:0;
  max-width:55%;
  height:34px;
  margin:0;
  padding:0 11px;
}
.hud-turn-name {
  overflow:hidden;
  text-overflow:ellipsis;
}
.hud-timer-badge {
  flex-shrink:0;
  font-variant-numeric:tabular-nums;
}
.play-page .game-table-container {
  display:grid;
  grid-template-columns:minmax(0,calc(var(--table-height) * .96)) minmax(260px,340px);
  grid-template-rows:auto minmax(0,1fr);
  gap:10px 20px;
  width:100%;
  height:var(--table-height);
  max-height:var(--table-height);
  min-height:var(--table-height);
  flex:0 0 var(--table-height);
  align-items:center;
  justify-content:center;
  box-sizing:border-box;
}
.play-page .game-center-arena {
  display:contents;
}
.play-page .board-wrapper {
  grid-column:1;
  grid-row:1/3;
  align-self:center;
  justify-self:center;
  width:min(100%,calc(var(--table-height) * .96))!important;
  height:var(--table-height)!important;
  max-height:var(--table-height)!important;
  max-width:none!important;
  aspect-ratio:.96!important;
  container-type:inline-size;
  margin:0!important;
  padding:6px;
  border:1px solid #dcb84b;
  border-radius:12px;
  background:#0b2148;
  box-shadow:0 12px 36px #0005,inset 0 0 0 2px #e9bd3a12;
  justify-content:stretch;
  align-items:stretch;
}
.play-page .game-board {
  flex:1;
  min-height:0;
  grid-template-columns:repeat(10,minmax(0,1fr));
  grid-template-rows:repeat(10,minmax(0,1fr));
  gap:3px;
}
.play-page .cell {
  appearance:none;
  padding:0;
  margin:0;
  min-width:0;
  min-height:0;
  border:0;
  border-radius:3px;
  background:#fff;
  overflow:hidden;
  box-shadow:0 1px 2px #0003;
  transition:box-shadow 120ms ease;
  touch-action:manipulation;
}
.playing-card-face {
  display:block;
  width:100%;
  height:100%;
  object-fit:fill;
  pointer-events:none;
  user-select:none;
  -webkit-user-drag:none;
}
.board-card-face,.hand-card-face {
  position:absolute;
  inset:0;
  border-radius:inherit;
}
.play-page .cell:hover:not(.occupied):not(.corner) {
  transform:none;
}
.play-page .cell:focus-visible {
  outline:3px solid #ffdc66;
  outline-offset:1px;
  z-index:8;
}
.play-page .cell.corner {
  background:#fffdf5;
  color:#c49a26;
  border:0;
  box-shadow:0 1px 2px #0003;
}
.play-page .corner-icon {
  font-size:clamp(13px,2.1vw,25px);
  line-height:1;
  filter:none;
}
.play-page .cell.occupied {
  overflow:hidden;
  z-index:1;
}
.play-page .cell.legal-target {
  border:0!important;
  outline:2px solid #ffda55;
  outline-offset:0;
  box-shadow:0 0 0 2px #ffda55,0 0 10px #ffcd4670!important;
  animation:none!important;
  transform:none!important;
}
.play-page .cell.legal-target .board-card-face {
  opacity:.76;
}
.play-page .cell .chip {
  width:68%;
  height:auto;
  aspect-ratio:1;
  max-width:none;
  border-width:1.5px;
}
.play-page .cell .chip.last-move::after {
  width:4px;
  height:4px;
  top:1px;
  right:1px;
  border-width:1px;
  animation:none;
}
.play-page .cell .chip.locked {
  animation:none;
  box-shadow:0 0 0 1px #fbbf24,inset 0 0 5px #fde047!important;
}
.play-page .chip-name-tag {
  display:none;
}
.play-page .cell.turn-highlight-active {
  animation:none!important;
  transform:none!important;
  border:0!important;
  overflow:visible!important;
  outline:2px solid #d6e9ff;
  outline-offset:0;
  box-shadow:0 0 0 2px #d6e9ff80!important;
}
.play-page .cell.turn-highlight-me {
  outline-color:#34d399;
  box-shadow:0 0 0 2px #34d39980,0 0 14px #34d39980!important;
}
.play-page .cell.turn-highlight-team {
  outline-color:#60a5fa;
  box-shadow:0 0 0 2px #60a5fa80,0 0 14px #60a5fa80!important;
}
.play-page .cell.turn-highlight-opponent {
  outline-color:#fb7185;
  box-shadow:0 0 0 2px #fb718580,0 0 14px #fb718580!important;
}
.play-page .turn-indicator-pill {
  display:inline-flex;
  max-width:min(170px,45cqw);
  padding:3px 7px;
  font-size:clamp(9px,1.8cqw,12px);
  line-height:1.15;
  letter-spacing:0;
  text-transform:none;
  overflow:hidden;
  text-overflow:ellipsis;
  animation:moveBadgeIn 180ms ease-out;
}
.play-page .cell.left-edge .turn-indicator-pill {
  left:0;
  transform:none;
}
.play-page .cell.right-edge .turn-indicator-pill {
  left:auto;
  right:0;
  transform:none;
}
@keyframes moveBadgeIn {
  from { opacity:0; }
  to { opacity:1; }
}
.play-page .cell.sequence-celebration,.play-page .cell.sequence-winning-highlight {
  transform:none!important;
  animation:none!important;
  border:0!important;
  outline:2px solid #ffe16a;
}
/* Names, team colours and sequence scores stay visible without repeated metadata. */
.play-page .game-side-panel {
  grid-column:2;
  grid-row:1;
  width:100%;
  min-width:0;
  max-width:none;
  gap:10px;
  padding:12px;
  border-radius:14px;
  background:#0c1b36;
  box-shadow:none;
  backdrop-filter:none;
}
.play-page .side-panel-header {
  padding:0;
  border:0;
}
.play-page .side-panel-title {
  font-size:12px;
  color:#b8c6db;
}
.play-page .side-target-badge {
  font-size:10px;
  background:transparent;
  border:0;
  padding:0;
}
.play-page .side-players-list {
  flex-direction:column;
  gap:6px;
  overflow:visible;
  max-height:none;
}
.play-page .side-player-card {
  min-width:0;
  gap:8px;
  padding:8px;
  border-width:1px;
  border-left:3px solid var(--team-color);
  box-shadow:none;
}
.play-page .side-player-card.is-turn {
  transform:none;
  animation:none;
  box-shadow:none;
  border-color:#dfb950;
  border-left-color:var(--team-color);
  background:#1e2c42;
}
.play-page .side-player-card.urgent-turn {
  animation:none;
  border-color:#e87474;
}
.play-page .side-player-avatar {
  width:28px;
  height:28px;
  font-size:12px;
}
.play-page .side-team-pip {
  width:12px;
  height:12px;
  font-size:7px;
}
.play-page .side-player-name {
  font-size:12px;
  max-width:none;
}
.play-page .side-player-info {
  gap:3px;
}
.play-page .side-player-bottom {
  gap:4px;
}
.play-page .side-seq-count {
  font-size:11px;
  color:#c6d2e4;
}
.play-page .side-team-text,.play-page .bot-diff-pill { display:none; }
.play-page .role-badge {
  font-size:8px;
  flex-shrink:0;
}
/* A dealt fan beside the board on desktop, below it on portrait phones. */
.play-page .player-tray {
  grid-column:2;
  grid-row:2;
  align-self:center;
  width:100%;
  max-width:none;
  min-width:0;
  margin:0;
  border-color:#e8bd322b;
}
.play-page #playerTray {
  --hand-card-width:clamp(66px,9vw,94px);
  position:relative;
  container-type:inline-size;
  display:flex;
  flex-direction:column;
  padding:14px 10px 8px;
  border-radius:16px;
  background:radial-gradient(ellipse at 50% 100%,#123368,#0a1834 75%);
  overflow:visible;
}
.hand-heading {
  position:relative;
  z-index:2;
  text-align:center;
}
.hand-heading h2 {
  margin:0 0 4px;
  color:#fff8dd;
  font-size:18px;
  line-height:1.2;
  font-weight:800;
}
.hand-heading p {
  margin:0;
  color:#b7c5db;
  font-size:12px;
  line-height:1.3;
}
.play-page #handCardsContainer {
  --fan-step:calc(var(--hand-card-width) * .34);
  position:relative;
  display:block;
  width:100%;
  height:calc(var(--hand-card-width) * 1.4 + 55px);
  padding:0;
  overflow:visible;
  isolation:isolate;
}
@supports(width:1cqw) {
  .play-page #handCardsContainer {
    --hand-card-width:min(94px,30cqw);
  }
}
.play-page #handCardsContainer .hand-card {
  --hand-lift:0px;
  position:absolute;
  left:50%;
  top:22px;
  width:var(--hand-card-width);
  height:auto;
  aspect-ratio:5/7;
  margin:0;
  padding:0;
  appearance:none;
  border:1px solid #dce2eb;
  border-radius:7px;
  background:#fff;
  transform-origin:50% 90%;
  transform:translate(calc(-50% + var(--fan-offset) * var(--fan-step)),calc(var(--fan-drop) * .65 - var(--hand-lift))) rotate(var(--display-angle,var(--fan-angle)));
  z-index:var(--fan-order);
  box-shadow:0 4px 9px #0006;
  transition:transform 220ms ease,box-shadow 180ms,border-color 180ms;
  touch-action:manipulation;
}
@media(hover:hover) {
  .play-page #handCardsContainer .hand-card:hover {
    --hand-lift:14px;
    z-index:var(--fan-order)!important;
    transform:translate(calc(-50% + var(--fan-offset) * var(--fan-step)),calc(var(--fan-drop) * .65 - 14px)) rotate(var(--fan-angle))!important;
  }
}
.play-page #handCardsContainer .hand-card:focus-visible {
  --hand-lift:16px;
  outline:2px solid #ffe16a;
  outline-offset:2px;
  z-index:var(--fan-order)!important;
  transform:translate(calc(-50% + var(--fan-offset) * var(--fan-step)),calc(var(--fan-drop) * .65 - 16px)) rotate(var(--fan-angle))!important;
}
.play-page #handCardsContainer .hand-card.selected {
  --hand-lift:22px;
  border-color:#ffe16a;
  z-index:var(--fan-order)!important;
  box-shadow:0 0 0 2px #e8bd32,0 8px 16px #0008;
  transform:translate(calc(-50% + var(--fan-offset) * var(--fan-step)),calc(var(--fan-drop) * .65 - 22px)) rotate(var(--fan-angle))!important;
}
.play-page #handCardsContainer .hand-card.is-dealing {
  animation:fanDeal 400ms ease var(--deal-delay,0ms) both;
}
@keyframes fanDeal {
  from {
    opacity:0;
    transform:translate(-50%,45px) rotate(0deg);
  }
  to {
    opacity:1;
    transform:translate(calc(-50% + var(--fan-offset) * var(--fan-step)),calc(var(--fan-drop) * .65 - var(--hand-lift))) rotate(var(--display-angle,var(--fan-angle)));
  }
}
.play-page #handCardsContainer .jack-badge,.play-page #handCardsContainer .dead-badge {
  left:3px;
  right:3px;
  bottom:3px;
  transform:none;
  padding:2px 0;
  font-size:8px;
  line-height:1.2;
  letter-spacing:0;
  text-align:center;
  z-index:5;
}
.play-page #playerTray .dead-card-bar {
  position:absolute;
  bottom:5px;
  left:5px;
  right:5px;
  z-index:60;
  margin:0;
  padding:5px;
  border-radius:8px;
  background:#172b49;
}
.play-page .dead-msg {
  font-size:10px;
}
.play-page #swapDeadCardBtn {
  min-height:30px;
  padding:5px 8px;
  font-size:10px;
}
.play-page #spectatorModeBanner {
  display:none;
}
.play-page #spectatorTray {
  padding:15px;
}
.play-page .spec-tray-body {
  flex-wrap:wrap;
}
.play-page .spec-tray-info span {
  display:none;
}
body.play-page.in-game-table-active #notificationBanner:not(.hidden) {
  display:block!important;
  position:fixed;
  z-index:1500;
  top:calc(54px + env(safe-area-inset-top));
  left:50%;
  transform:translateX(-50%);
  width:max-content;
  max-width:calc(100% - 24px);
  margin:0;
  padding:8px 14px;
  border-radius:10px;
  font-size:12px;
  box-shadow:0 5px 20px #0005;
}
@media(max-width:900px) and (orientation:portrait) {
  .play-page #gameTableView.active {
    --hand-height:clamp(156px,23dvh,184px);
    --table-height:calc(100dvh - 58px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    --board-height:calc(var(--table-height) - 38px - var(--hand-height) - 12px);
    gap:6px;
    padding:calc(5px + env(safe-area-inset-top)) max(6px,env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left));
  }
  .game-toolbar { display:none!important; }
  .table-brand {
    width:29px;
    height:29px;
    border-radius:7px;
  }
  .table-actions {
    gap:4px;
  }
  .table-room-code {
    display:none;
  }
  .play-page .game-toolbar .hud-btn {
    min-width:32px;
    padding:0 7px;
    height:32px;
  }
  .play-page .game-toolbar .hud-turn-pill {
    flex:1;
    max-width:none;
    gap:4px;
    padding:0 7px;
    font-size:11px;
    height:32px;
  }
  .play-page .game-table-container {
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:38px minmax(0,1fr) var(--hand-height);
    gap:6px;
    height:100%;
    min-height:0;
    max-height:100%;
    flex:1 1 auto;
    align-items:stretch;
  }
  .play-page .game-side-panel {
    grid-column:1;
    grid-row:1;
    padding:0;
    border:0;
    background:transparent;
  }
  .play-page .side-panel-header {
    display:none;
  }
  .play-page .side-players-list {
    display:flex;
    flex-direction:row;
    gap:4px;
    height:38px;
    width:100%;
  }
  .play-page .side-player-card {
    flex:1 1 0;
    padding:3px 5px;
    gap:0;
    border-radius:7px;
  }
  .play-page .side-player-avatar-wrap {
    display:none;
  }
  .play-page .side-player-info {
    gap:1px;
  }
  .play-page .side-player-top {
    gap:3px;
  }
  .play-page .side-player-name {
    font-size:10px;
  }
  .play-page .side-seq-count {
    font-size:9px;
    line-height:1.2;
  }
  .play-page .role-badge {
    font-size:6px;
    padding:0 2px;
  }
  .play-page .side-turn-indicator .turn-live-text {
    display:none!important;
  }
  .play-page .side-turn-indicator {
    padding:1px 4px!important;
    gap:3px!important;
    font-size:10px!important;
  }
  .play-page .board-wrapper {
    grid-column:1!important;
    grid-row:2!important;
    width:min(calc(100vw - 12px),var(--board-height),460px)!important;
    height:min(calc(100vw - 12px),var(--board-height),460px)!important;
    max-height:var(--board-height)!important;
    max-width:calc(100vw - 12px)!important;
    aspect-ratio:1/1!important;
    align-self:center!important;
    justify-self:center!important;
    padding:3px!important;
    border-radius:8px!important;
    margin:0 auto!important;
  }
  .play-page .game-board {
    display:grid!important;
    grid-template-columns:repeat(10,1fr)!important;
    grid-template-rows:repeat(10,1fr)!important;
    gap:2px!important;
    width:100%!important;
    height:100%!important;
  }
  .play-page .cell {
    border-radius:2px;
  }
  .play-page .player-tray {
    grid-column:1;
    grid-row:3;
    align-self:stretch;
  }
  .play-page #playerTray {
    --hand-card-width:clamp(54px,9.2dvh,75px);
    padding:6px 8px 0;
    border-radius:13px;
  }
  .hand-heading h2 {
    font-size:13px;
    margin:0 0 1px;
  }
  .hand-heading p {
    font-size:10px;
    line-height:1.2;
  }
  .play-page #handCardsContainer {
    --hand-card-width:min(clamp(54px,9.2dvh,75px),22cqw);
    --fan-step:calc(var(--hand-card-width) * .47);
    flex:1;
    min-height:0;
    height:auto;
  }
  .play-page #handCardsContainer .hand-card {
    top:9px;
    border-radius:5px;
  }
  .play-page #handCardsContainer .hand-card.selected {
    --hand-lift:10px;
  }
  .play-page #handCardsContainer .hand-card:hover {
    --hand-lift:6px;
  }
  .play-page #handCardsContainer .hand-card:focus-visible {
    --hand-lift:7px;
  }
}
@media(max-height:480px) and (orientation:landscape) {
  .play-page #gameTableView.active {
    --table-height:calc(100dvh - 54px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    gap:4px;
    padding-top:4px;
    padding-bottom:6px;
  }
  .game-toolbar { display:none!important; }
  .play-page .game-table-container {
    grid-template-columns:minmax(0,calc(var(--table-height) * .96)) minmax(225px,42%);
    gap:8px 16px;
  }
  .play-page .game-side-panel {
    padding:5px;
    gap:4px;
  }
  .play-page .side-panel-header,.play-page .side-player-avatar-wrap {
    display:none;
  }
  .play-page .side-players-list {
    flex-direction:row;
    gap:4px;
  }
  .play-page .side-player-card {
    flex:1;
    padding:4px;
  }
  .play-page .side-player-name {
    font-size:10px;
  }
  .play-page .side-player-top {
    gap:2px;
  }
  .play-page #playerTray {
    padding:7px 8px 0;
  }
  .hand-heading h2 {
    font-size:14px;
  }
  .hand-heading p {
    font-size:10px;
  }
  .play-page #handCardsContainer {
    --hand-card-width:min(72px,25cqw,19dvh);
    height:calc(var(--hand-card-width) * 1.4 + 38px);
  }
  .play-page #handCardsContainer .hand-card {
    top:10px;
  }
}
@media(prefers-reduced-motion:reduce) {
  .play-page #handCardsContainer .hand-card {
    transition:none;
  }
  .play-page #handCardsContainer .hand-card.is-dealing {
    animation:none;
  }
  .play-page .cell .chip {
    animation:none!important;
  }
  .play-page .turn-indicator-pill {
    animation:none;
  }
}


/* Top Side Controls in Game Side Panel */
.play-page .side-panel-controls {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding-bottom:8px;
  border-bottom:1px solid rgba(255,255,255,0.08);
}
.play-page .side-room-tag {
  display:flex;
  align-items:center;
  gap:5px;
}
.play-page .side-room-lbl {
  color:#64748b;
  font-size:10px;
  font-weight:700;
  letter-spacing:0.5px;
}
.play-page .side-room-tag .table-room-code {
  color:#fbbf24;
  font-size:12px;
  font-weight:800;
  letter-spacing:1.2px;
  background:rgba(245,158,11,0.12);
  padding:2px 6px;
  border-radius:4px;
  border:1px solid rgba(245,158,11,0.25);
  margin-right:0;
}
.play-page .side-panel-action-btns {
  display:flex;
  align-items:center;
  gap:5px;
  margin-left:auto;
}
.play-page .side-panel-action-btns .hud-btn {
  min-width:32px;
  height:28px;
  padding:0 7px;
  border-radius:7px;
  font-size:12px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:rgba(255,255,255,0.06);
  border:1px solid rgba(255,255,255,0.12);
  color:#cbd5e1;
  cursor:pointer;
  transition:all 0.15s ease;
}
.play-page .side-panel-action-btns .hud-btn:hover {
  background:rgba(255,255,255,0.14);
  color:#fff;
  border-color:rgba(255,255,255,0.25);
}
.play-page .side-panel-action-btns .hud-btn-leave {
  font-size:11px;
  font-weight:700;
  color:#f87171;
  background:rgba(239,68,68,0.1);
  border-color:rgba(239,68,68,0.3);
  padding:0 9px;
}
.play-page .side-panel-action-btns .hud-btn-leave:hover {
  background:rgba(239,68,68,0.22);
  border-color:#ef4444;
  color:#fff;
}
.play-page .side-turn-indicator {
  display:inline-flex!important;
  align-items:center;
  gap:5px;
  margin-left:auto;
  flex-shrink:0;
  padding:3px 8px;
  border-radius:12px;
  background:rgba(245,158,11,0.18);
  border:1px solid #f59e0b;
  color:#fbbf24;
  font-size:11px;
  font-weight:700;
  letter-spacing:0.2px;
  white-space:nowrap;
}
.play-page .side-turn-indicator .turn-live-dot {
  width:6px;
  height:6px;
  border-radius:50%;
  background:#fbbf24;
  box-shadow:0 0 6px #f59e0b;
  animation:pulseDot 1s infinite alternate;
}
.play-page .side-turn-indicator .turn-live-timer {
  font-variant-numeric:tabular-nums;
  font-weight:800;
  color:#ffffff;
  background:rgba(0,0,0,0.35);
  padding:1px 5px;
  border-radius:6px;
  margin-left:2px;
}
.play-page .side-player-card.urgent-turn .side-turn-indicator {
  background:rgba(239,68,68,0.22);
  border-color:#ef4444;
  color:#fca5a5;
}
.play-page .side-player-card.urgent-turn .side-turn-indicator .turn-live-dot {
  background:#ef4444;
  box-shadow:0 0 6px #ef4444;
}
.play-page .side-player-card.is-turn {
  border-color:#f59e0b!important;
  border-left-color:#f59e0b!important;
  background:linear-gradient(135deg, rgba(245,158,11,0.16) 0%, #152747 100%)!important;
  box-shadow:0 0 12px rgba(245,158,11,0.25)!important;
}
.play-page .side-player-card.is-turn.urgent-turn {
  border-color:#ef4444!important;
  border-left-color:#ef4444!important;
  background:linear-gradient(135deg, rgba(239,68,68,0.22) 0%, #152747 100%)!important;
  box-shadow:0 0 14px rgba(239,68,68,0.4)!important;
}
