/* ============================================================
   Cruce styles
   1. Tokens, reset, base elements
   2. Lobby shell (index.html)
   3. Shared card primitives
   4. Live play + hotseat table (.play-shell, from design-lab)
   ============================================================ */

:root {
  --bg: #17130e;
  --surface: #201a14;
  --surface-strong: #2b2218;
  --surface-soft: #181f17;
  --line: #5b4a31;
  --line-soft: #3f3525;
  --text: #f6ecd8;
  --muted: #c8b998;
  --accent: #d8aa43;
  --accent-2: #1d6b60;
  --danger: #b83a2f;
  --green: #4f7d32;
  --card: #fbf4df;
  --card-ink: #1c1c1c;
  --walnut: #2d1d10;
  --walnut-dark: #120b07;
  --brass-soft: rgba(216, 170, 67, 0.2);
  --shadow-deep: 0 26px 60px rgba(0, 0, 0, 0.42);
  --asset-room-bg: url("assets/bg-card-room-warm-01.png");
  --asset-felt: url("assets/table-felt-green-01.png");
  --asset-felt-mask: url("assets/table-felt-opening-mask-01.png");
  --asset-table-frame: url("assets/table-frame-oval-walnut-01.png");
  --asset-medallion: url("assets/ui-medallion-brass-01.png");
  --asset-nameplate: url("assets/ui-nameplate-walnut-brass-02.png");
  --asset-button-pill: url("assets/ui-button-pill-brass-walnut-01.png");
  --asset-paper: url("assets/ui-panel-paper-ivory-01.png");
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 198, 110, 0.1), transparent 28rem),
    radial-gradient(ellipse at 50% 68%, rgba(20, 79, 37, 0.1), transparent 42rem),
    linear-gradient(180deg, rgba(8, 6, 4, 0.72), rgba(7, 8, 5, 0.9) 62%, rgba(5, 4, 3, 0.97)),
    var(--asset-room-bg) center top / cover fixed no-repeat,
    #0d0906;
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 235, 186, 0.08), transparent 42%),
    linear-gradient(180deg, #332719, #211910);
  color: var(--text);
  text-decoration: none;
  padding: 7px 14px;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 242, 206, 0.12),
    0 5px 12px rgba(0, 0, 0, 0.18);
}

select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #17120c;
  color: var(--text);
  padding: 7px 10px;
}

input {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #17120c;
  color: var(--text);
  padding: 7px 10px;
}

button:hover:not(:disabled),
a:hover {
  border-color: var(--accent);
  background: linear-gradient(180deg, #3b2c1a, #261c11);
}

button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.cruce-shell {
  width: min(1580px, calc(100vw - 18px));
  margin: 0 auto;
  padding: 6px 0 16px;
}

.lobby-shell {
  max-width: 1100px;
}

.topbar,
.score-strip,
.action-panel,
.event-log {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(46, 36, 24, 0.96), rgba(25, 20, 14, 0.96));
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 50px;
  padding: 5px 11px;
  background:
    linear-gradient(90deg, rgba(216, 170, 67, 0.09), transparent 34%, rgba(29, 107, 96, 0.07)),
    linear-gradient(180deg, rgba(28, 20, 12, 0.88), rgba(11, 8, 5, 0.92));
  backdrop-filter: blur(8px);
}

.topbar-title {
  display: grid;
  gap: 2px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.08rem, 1.46vw, 1.34rem);
  letter-spacing: 0;
  font-weight: 750;
}

h2 {
  font-size: 1rem;
}

.status-line,
.seed-field span,
.seat-label,
.event-log li,
#action-detail {
  color: var(--muted);
}

.status-line {
  font-size: 0.84rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar-actions button,
.topbar-actions a {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 0.86rem;
}

.lobby-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.panel-form {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(44, 35, 23, 0.96), rgba(26, 21, 14, 0.96));
  border-radius: 8px;
  padding: 14px;
}

.inline-form {
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: end;
  margin: 12px 0;
}

.field {
  display: grid;
  gap: 5px;
}

.field span {
  color: var(--muted);
  font-size: 0.85rem;
}

.field input,
.field select {
  width: 100%;
}

.form-status {
  min-height: 1.3em;
}

/* ---- Shared card primitives ---- */
.card {
  appearance: none;
  width: 62px;
  aspect-ratio: 62 / 88;
  min-height: 0;
  flex: 0 0 auto;
  display: block;
  border: 1px solid rgba(246, 236, 216, 0.72);
  border-radius: 8px;
  background: #efe2bd;
  color: var(--card-ink);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(35, 25, 12, 0.18);
  padding: 0;
  overflow: hidden;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.card img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f8edcf;
}

.card:disabled {
  opacity: 1;
  cursor: default;
  filter: saturate(0.92);
}

.card-back {
  background:
    linear-gradient(45deg, rgba(216, 170, 67, 0.28) 0 2px, transparent 2px 10px),
    linear-gradient(135deg, rgba(27, 91, 64, 0.95), rgba(32, 24, 15, 0.96)),
    #1d2f20;
  border-color: rgba(216, 170, 67, 0.42);
}

/* Lobby responsive */
@media (max-width: 900px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .lobby-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Live play + hotseat table
   ============================================================ */
/* Live play screen: migrated from public/cruce/design-lab.html. */
.cruce-play-body {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 11%, rgba(255, 211, 126, 0.13), transparent 28rem),
    radial-gradient(ellipse at 50% 64%, rgba(17, 111, 56, 0.18), transparent 34rem),
    linear-gradient(90deg, rgba(4, 3, 2, 0.9), rgba(4, 3, 2, 0.2) 24%, rgba(4, 3, 2, 0.2) 76%, rgba(4, 3, 2, 0.92)),
    linear-gradient(180deg, rgba(7, 5, 3, 0.56), rgba(7, 5, 3, 0.88) 66%, rgba(3, 3, 2, 0.98)),
    var(--asset-room-bg) center top / cover no-repeat,
    #090604;
}

.cruce-play-body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 48%, transparent 0 34%, rgba(0, 0, 0, 0.12) 56%, rgba(0, 0, 0, 0.56) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), transparent 20%, rgba(0, 0, 0, 0.32));
}

.play-shell {
  position: relative;
  z-index: 1;
  width: min(1560px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 8px 0 0;
}

.play-shell .topbar {
  position: relative;
  z-index: 50;
  width: min(1420px, 100%);
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 auto;
  padding: 6px 12px 6px 18px;
  border: 1px solid rgba(216, 170, 67, 0.28);
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(216, 170, 67, 0.13), rgba(24, 16, 9, 0.78) 36%, rgba(10, 7, 4, 0.88)),
    rgba(13, 9, 6, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 213, 0.1),
    0 14px 34px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(8px);
}

.play-shell .topbar-title {
  display: grid;
  gap: 1px;
}

.play-shell .topbar h1 {
  margin: 0;
  color: #fff3d6;
  font-size: clamp(1.1rem, 1.35vw, 1.38rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.play-shell .status-line {
  margin: 0;
  color: rgba(244, 225, 184, 0.72);
  font-size: 0.78rem;
}

.play-shell .topbar-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(216, 170, 67, 0.2);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 236, 188, 0.06), rgba(0, 0, 0, 0.1)),
    rgba(9, 6, 4, 0.44);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 213, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.24);
}

.play-shell .topbar-actions button,
.play-shell .topbar-actions a {
  position: relative;
  min-height: 31px;
  padding: 5px 13px;
  border-color: rgba(216, 170, 67, 0.34);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 239, 200, 0.16), transparent 58%),
    linear-gradient(180deg, rgba(77, 51, 24, 0.94), rgba(28, 17, 8, 0.98));
  color: rgba(255, 240, 207, 0.94);
  font-size: 0.81rem;
  font-weight: 800;
  letter-spacing: 0;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.52);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 213, 0.18),
    inset 0 -2px 0 rgba(0, 0, 0, 0.28),
    0 5px 12px rgba(0, 0, 0, 0.22);
  transition: border-color 140ms ease, filter 140ms ease, transform 140ms ease;
}

.play-shell .topbar-actions button::after,
.play-shell .topbar-actions a::after {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  top: 4px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 236, 188, 0.38), transparent);
  pointer-events: none;
}

.play-shell .topbar-actions button:hover,
.play-shell .topbar-actions a:hover {
  border-color: rgba(255, 218, 142, 0.58);
  filter: brightness(1.08);
}

.play-shell .topbar-actions button:active,
.play-shell .topbar-actions a:active {
  transform: translateY(1px);
}

/* Collapsed local-seat dev menu (top-right). */
.play-shell .local-tools {
  position: relative;
}

.play-shell .local-tools-toggle {
  position: relative;
  min-height: 31px;
  display: grid;
  grid-auto-flow: column;
  place-items: center;
  gap: 6px;
  padding: 5px 12px;
  list-style: none;
  cursor: pointer;
  border: 1px solid rgba(216, 170, 67, 0.34);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 239, 200, 0.16), transparent 58%),
    linear-gradient(180deg, rgba(77, 51, 24, 0.94), rgba(28, 17, 8, 0.98));
  color: rgba(255, 240, 207, 0.94);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 213, 0.18),
    inset 0 -2px 0 rgba(0, 0, 0, 0.28),
    0 5px 12px rgba(0, 0, 0, 0.22);
  transition: border-color 140ms ease, filter 140ms ease;
}

.play-shell .local-tools-toggle::-webkit-details-marker {
  display: none;
}

.play-shell .local-tools-toggle::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(255, 226, 161, 0.9);
  transition: transform 160ms ease;
}

.play-shell .local-tools[open] .local-tools-toggle::after {
  transform: rotate(180deg);
}

.play-shell .local-tools-toggle:hover {
  border-color: rgba(255, 218, 142, 0.58);
  filter: brightness(1.08);
}

.play-shell .local-tools[open] .local-tools-toggle {
  border-color: rgba(255, 218, 142, 0.62);
}

.play-shell .local-tools-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  min-width: 208px;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(216, 170, 67, 0.32);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 0%, rgba(216, 170, 67, 0.13), transparent 70%),
    linear-gradient(180deg, rgba(40, 27, 15, 0.97), rgba(13, 9, 6, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 213, 0.1),
    0 18px 38px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(8px);
}

.play-shell .local-tools-label {
  margin: 2px 0 0;
  color: rgba(216, 170, 67, 0.86);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.play-shell .local-tools-menu .local-tools-fill {
  min-height: 34px;
  padding: 5px 12px;
  font-size: 0.84rem;
  font-weight: 800;
}

.play-shell .local-tools-menu .seat-switcher {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.play-shell .local-tools-menu .compact-button {
  min-height: 32px;
  padding: 4px 8px;
  font-size: 0.82rem;
}

.play-shell .local-tools-menu .compact-button.is-current {
  border-color: rgba(255, 220, 148, 0.7);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 231, 169, 0.22), transparent 64%),
    linear-gradient(180deg, #6b451b, #2b170a);
  color: #fff3d6;
}

.play-shell > .inline-form {
  position: absolute;
  left: 50%;
  top: 68px;
  z-index: 40;
  width: min(720px, calc(100vw - 40px));
  margin: 0;
  border-color: rgba(216, 170, 67, 0.3);
  background:
    radial-gradient(circle at 50% 0%, rgba(216, 170, 67, 0.13), transparent 68%),
    linear-gradient(180deg, rgba(40, 27, 15, 0.96), rgba(13, 9, 6, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 213, 0.1),
    0 18px 38px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(8px);
  transform: translateX(-50%);
}

.play-shell .game-stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
  margin: 0;
  isolation: isolate;
}

.play-shell .game-stage::before {
  display: none;
}

/* Fixed "design canvas": authored at 1345x950, then scaled to fit the
   viewport by JS (initTableScaling) so every desktop/tablet width keeps the
   exact same composition without cropping or scrollbars. */
.play-shell .table-scene {
  --dock-w: 1040px;
  position: relative;
  flex: 0 0 auto;
  width: 1345px;
  height: 950px;
  margin-top: 0;
  perspective: 1400px;
  isolation: isolate;
  transform: scale(var(--scene-scale, 1));
  transform-origin: top center;
}

.play-shell .table-scene::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 94px;
  z-index: -1;
  width: 1180px;
  height: 760px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 34%, rgba(255, 231, 169, 0.09), transparent 46%),
    radial-gradient(ellipse at 50% 72%, rgba(0, 0, 0, 0.54), transparent 70%);
  filter: blur(2px);
  transform: translateX(-50%);
}

.play-shell .score-strip {
  position: absolute;
  top: 16px;
  left: 50%;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 4px;
  border: 1px solid rgba(216, 170, 67, 0.28);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 224, 156, 0.16), transparent 68%),
    linear-gradient(180deg, rgba(42, 27, 14, 0.94), rgba(13, 8, 5, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 213, 0.1),
    0 16px 36px rgba(0, 0, 0, 0.34);
  transform: translateX(-50%);
}

.play-shell .score-strip div {
  min-width: 112px;
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 4px 14px;
  border: 1px solid rgba(216, 170, 67, 0.15);
  border-radius: 999px;
  background: rgba(255, 236, 188, 0.045);
}

.play-shell .score-strip .is-target {
  min-width: 88px;
  border-color: rgba(216, 170, 67, 0.42);
  background:
    radial-gradient(circle at 50% 0%, rgba(216, 170, 67, 0.24), transparent 70%),
    linear-gradient(180deg, rgba(62, 42, 20, 0.84), rgba(23, 15, 9, 0.88));
}

.play-shell .score-strip span {
  color: rgba(205, 185, 140, 0.8);
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.play-shell .score-strip strong {
  color: #fff3d6;
  font-size: 1.1rem;
  line-height: 1;
}

.play-shell .event-log {
  position: absolute;
  top: 18px;
  right: 12px;
  bottom: auto;
  z-index: 30;
  width: 160px;
  max-height: 360px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(216, 170, 67, 0.28);
  border-radius: 999px;
  background: rgba(13, 9, 6, 0.78);
  color: rgba(255, 240, 207, 0.9);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px);
}

.play-shell .event-log[open] {
  width: 320px;
  border-radius: 18px;
}

.play-shell .event-log summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 8px 5px 14px;
  cursor: pointer;
  list-style: none;
}

.play-shell .event-log summary::-webkit-details-marker {
  display: none;
}

.play-shell .event-log summary span:first-child {
  font-size: 0.82rem;
  font-weight: 800;
}

.play-shell #event-log-count {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(216, 170, 67, 0.26);
  border-radius: 50%;
  color: var(--muted);
  font-size: 0.74rem;
}

.play-shell .event-log ol {
  max-height: 286px;
  margin: 0;
  padding: 0 14px 14px 28px;
  overflow: auto;
}

.play-shell .table-base {
  position: absolute;
  left: 50%;
  top: 568px;
  z-index: 2;
  width: 810px;
  height: 92px;
  border-radius: 0 0 46% 46% / 0 0 82% 82%;
  background:
    linear-gradient(180deg, rgba(133, 82, 42, 0.86), rgba(39, 20, 12, 0.98) 74%, rgba(9, 5, 4, 1));
  box-shadow:
    inset 0 10px 16px rgba(255, 214, 154, 0.14),
    inset 0 -24px 28px rgba(0, 0, 0, 0.58),
    0 26px 48px rgba(0, 0, 0, 0.48);
  transform: translateX(-50%);
}

.play-shell .table-plane {
  position: absolute;
  left: 50%;
  top: 36px;
  z-index: 4;
  width: 1080px;
  aspect-ratio: 3 / 2;
  transform: translateX(-50%) rotateX(58deg);
  transform-origin: 50% 72%;
  transform-style: preserve-3d;
}

.play-shell .table-plane::before {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  top: 10%;
  bottom: -4%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 66%, rgba(0, 0, 0, 0.66), transparent 68%);
  filter: blur(12px);
  transform: translateZ(-18px);
}

.play-shell .table-felt,
.play-shell .table-frame {
  position: absolute;
  inset: 0;
}

.play-shell .table-felt {
  z-index: 1;
  overflow: hidden;
  -webkit-mask: var(--asset-felt-mask) center / 100% 100% no-repeat;
  mask: var(--asset-felt-mask) center / 100% 100% no-repeat;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 244, 213, 0.16), transparent 31%),
    linear-gradient(180deg, rgba(25, 114, 54, 0.22), rgba(7, 39, 19, 0.44)),
    var(--asset-felt) center / cover no-repeat;
  box-shadow:
    inset 0 16px 28px rgba(255, 244, 213, 0.05),
    inset 0 -38px 42px rgba(0, 0, 0, 0.42),
    inset 0 0 52px rgba(0, 0, 0, 0.3);
}

.play-shell .table-felt::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 7%, rgba(0, 0, 0, 0.32), transparent 24%),
    radial-gradient(ellipse at 50% 94%, rgba(0, 0, 0, 0.38), transparent 28%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.36), transparent 13%, transparent 87%, rgba(0, 0, 0, 0.36));
}

.play-shell .table-frame {
  z-index: 2;
  background: var(--asset-table-frame) center / 100% 100% no-repeat;
  filter:
    drop-shadow(0 16px 0 rgba(18, 9, 5, 0.92))
    drop-shadow(0 50px 52px rgba(0, 0, 0, 0.48));
}

.play-shell .table-zone,
.play-shell .table-zone[data-player-count],
.play-shell .table-zone[data-player-count="2"],
.play-shell .table-zone[data-player-count="3"] {
  position: absolute;
  inset: 0;
  z-index: 10;
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  display: block;
  margin: 0;
  perspective: 1400px;
}

.play-shell .table-zone[data-player-count="2"] {
  --dock-w: 1160px;
}

.play-shell .seat {
  position: absolute;
  z-index: 12;
  min-width: 0;
  min-height: 0;
  display: grid;
  justify-items: center;
  gap: 0;
  padding: 7px 10px 10px;
  border: 1px solid rgba(216, 170, 67, 0.13);
  border-radius: 20px;
  overflow: visible;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(216, 170, 67, 0.1), transparent 60%),
    linear-gradient(180deg, rgba(20, 13, 7, 0.34), rgba(8, 6, 4, 0.16));
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 213, 0.04),
    0 16px 32px rgba(0, 0, 0, 0.2);
}

.play-shell .seat[hidden] {
  display: none !important;
}

.play-shell .seat:not(.is-viewer).seat-top {
  top: 86px;
  left: 50%;
  width: auto;
  min-width: 310px;
  transform: translateX(-50%);
}

.play-shell .seat:not(.is-viewer).seat-left {
  top: 384px;
  left: max(40px, calc(50% - 660px));
  width: auto;
  align-items: center;
  transform: none;
}

.play-shell .seat:not(.is-viewer).seat-right {
  top: 384px;
  right: max(40px, calc(50% - 660px));
  width: auto;
  align-items: center;
  transform: none;
}

.play-shell .seat:not(.is-viewer).is-active .seat-meta {
  border-color: rgba(255, 218, 142, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 213, 0.16),
    0 0 0 1px rgba(216, 170, 67, 0.12),
    0 0 28px rgba(216, 170, 67, 0.2),
    0 14px 30px rgba(0, 0, 0, 0.34);
}

.play-shell .seat-meta::before {
  display: none;
}

.play-shell .seat:not(.is-viewer) .seat-meta {
  position: relative;
  z-index: 2;
  min-width: 152px;
  min-height: 41px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 5px 13px 5px 6px;
  border: 1px solid rgba(216, 170, 67, 0.42);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 229, 165, 0.14), transparent 58%),
    linear-gradient(180deg, rgba(72, 47, 22, 0.88), rgba(25, 15, 8, 0.96) 56%, rgba(10, 7, 4, 0.98)),
    var(--asset-nameplate) center / 100% 100% no-repeat;
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 213, 0.18),
    inset 0 -2px 0 rgba(0, 0, 0, 0.32),
    0 11px 22px rgba(0, 0, 0, 0.34);
}

.play-shell .seat:not(.is-viewer) .seat-meta::after {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  margin-left: 2px;
  border: 1px solid rgba(255, 226, 161, 0.28);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 239, 202, 0.5), transparent 36%),
    linear-gradient(180deg, rgba(216, 170, 67, 0.7), rgba(85, 54, 21, 0.86));
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 213, 0.16),
    0 0 9px rgba(216, 170, 67, 0.12);
}

.play-shell .seat .avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  margin-left: -2px;
  border: 1px solid rgba(255, 226, 161, 0.3);
  border-radius: 50%;
  background: var(--asset-medallion) center / cover no-repeat;
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 213, 0.18),
    0 5px 9px rgba(0, 0, 0, 0.36);
}

.play-shell .seat .identity {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.play-shell .seat .identity strong {
  max-width: 112px;
  overflow: hidden;
  color: rgba(255, 239, 203, 0.94);
  font-size: 0.86rem;
  font-weight: 850;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.55);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-shell .seat .identity span {
  color: rgba(216, 194, 145, 0.82);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.15;
  text-transform: uppercase;
}

.play-shell .seat .team-banner {
  flex: 0 1 auto;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.play-shell .seat:not(.is-viewer) .hand {
  position: relative;
  width: fit-content;
  height: 104px;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-start;
  gap: 6px;
  margin-top: -2px;
  padding: 13px 12px 0;
  overflow: visible;
  border: 0;
  border-top: 1px solid rgba(216, 170, 67, 0.16);
  border-radius: 0 0 18px 18px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(216, 170, 67, 0.1), transparent 62%),
    linear-gradient(90deg, transparent, rgba(10, 7, 4, 0.42) 15%, rgba(10, 7, 4, 0.42) 85%, transparent);
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.28));
}

.play-shell .seat:not(.is-viewer) .hand::before,
.play-shell .seat:not(.is-viewer) .hand::after {
  content: none;
}

.play-shell .seat:not(.is-viewer) .hand::before {
  right: calc(50% + 76px);
}

.play-shell .seat:not(.is-viewer) .hand::after {
  left: calc(50% + 76px);
  transform: scaleX(-1);
}

.play-shell .seat:not(.is-viewer) .hand[data-count="0"] {
  display: none;
}

.play-shell .seat:not(.is-viewer) .card,
.play-shell .seat:not(.is-viewer) .card.card-back {
  position: relative;
  width: 62px;
  height: 88px;
  aspect-ratio: auto;
  margin-left: 0;
  border: 1px solid rgba(35, 24, 12, 0.4);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(30, 18, 8, 0.12)),
    url("cards/card_back.png") center / cover no-repeat;
  box-shadow:
    inset 0 0 0 1px rgba(255, 244, 213, 0.2),
    0 0 0 1px rgba(255, 236, 188, 0.05),
    0 8px 13px rgba(0, 0, 0, 0.32),
    0 0 12px rgba(255, 221, 150, 0.08);
  transform: none;
}

.play-shell .seat:not(.is-viewer) .card:first-child {
  margin-left: 0;
}

.play-shell .seat:not(.is-viewer) .card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 30% 12%, rgba(255, 245, 218, 0.24), transparent 34%),
    linear-gradient(140deg, rgba(255, 255, 255, 0.1), transparent 36%);
  pointer-events: none;
}

.play-shell .seat:not(.is-viewer) .card-corner,
.play-shell .seat:not(.is-viewer) .card-suit {
  display: none;
}

.play-shell .seat.is-viewer {
  left: 50%;
  top: 690px;
  z-index: 24;
  width: var(--dock-w);
  min-height: 222px;
  padding: 25px 24px 15px;
  border: 1px solid rgba(216, 170, 67, 0.34);
  border-top-color: rgba(255, 220, 148, 0.46);
  border-radius: 48% 48% 24px 24px / 17% 17% 22px 22px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(216, 170, 67, 0.16), transparent 46%),
    linear-gradient(180deg, rgba(73, 47, 22, 0.68), rgba(25, 16, 9, 0.86) 72%, rgba(10, 7, 5, 0.92));
  box-shadow:
    inset 0 9px 18px rgba(255, 244, 213, 0.07),
    inset 0 -18px 26px rgba(0, 0, 0, 0.28),
    0 22px 44px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(5px);
  transform: translateX(-50%);
}

.play-shell .seat.is-viewer::before {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: 25px;
  bottom: auto;
  z-index: 1;
  height: 1px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 220, 148, 0.42), transparent);
  box-shadow: none;
}

.play-shell .seat.is-viewer::after {
  display: none;
}

.play-shell .seat.is-viewer .seat-meta {
  position: absolute;
  left: 27px;
  top: auto;
  bottom: 19px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 12px 4px 5px;
  border: 1px solid rgba(216, 170, 67, 0.34);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(49, 31, 15, 0.9), rgba(13, 8, 5, 0.94)),
    var(--asset-nameplate) center / 100% 100% no-repeat;
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 213, 0.12),
    0 12px 24px rgba(0, 0, 0, 0.34);
}

.play-shell .seat.is-viewer .seat-meta::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -13px;
  width: 13px;
  height: 1px;
  border: 0;
  background: linear-gradient(90deg, rgba(216, 170, 67, 0.32), transparent);
  transform: translateY(-50%);
}

.play-shell .seat.is-viewer .identity {
  display: flex;
  align-items: center;
  gap: 8px;
}

.play-shell .seat.is-viewer .identity strong {
  max-width: 140px;
  font-size: 0.92rem;
}

.play-shell .seat.is-viewer .team-pill {
  padding: 3px 8px;
  border: 1px solid rgba(216, 170, 67, 0.26);
  border-radius: 999px;
  color: rgba(255, 239, 203, 0.82);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.play-shell .seat.is-viewer .hand {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-end;
  gap: 11px;
  height: 150px;
  min-height: 0;
  margin: -38px 0 0;
  padding: 10px 20px 0;
  overflow: visible;
  border: 0;
  background: transparent;
  scrollbar-color: rgba(216, 170, 67, 0.5) rgba(18, 13, 8, 0.38);
}

.play-shell .seat.is-viewer .card {
  position: relative;
  width: 140px;
  aspect-ratio: 62 / 88;
  margin-left: 0;
  border-radius: 13px;
  z-index: calc(3 + var(--card-index, 0));
  box-shadow:
    0 16px 24px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(36, 24, 10, 0.22),
    0 0 20px rgba(255, 221, 150, 0.08);
  transform: none;
  transform-origin: 50% 112%;
}

.play-shell .table-zone[data-player-count="2"] .seat.is-viewer .card {
  width: 104px;
}

.play-shell .seat.is-viewer .card + .card {
  margin-left: 0;
}

.play-shell .seat.is-viewer .card:not(:disabled):hover,
.play-shell .seat.is-viewer .card:not(:disabled):focus-visible {
  z-index: 40;
  border-color: rgba(255, 221, 142, 0.95);
  outline: 0;
  filter: brightness(1.07);
  box-shadow:
    0 22px 34px rgba(0, 0, 0, 0.46),
    0 0 0 2px rgba(216, 170, 67, 0.48),
    0 0 28px rgba(216, 170, 67, 0.24);
  transform: translateY(-14px) scale(1.02);
}

.play-shell .hand-count-badge {
  display: none;
}

.play-shell .round-widget {
  position: absolute;
  left: 50%;
  top: 268px;
  z-index: 14;
  width: 218px;
  padding: 7px 9px 8px;
  border: 1px solid rgba(216, 170, 67, 0.28);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 0%, rgba(216, 170, 67, 0.18), transparent 68%),
    linear-gradient(180deg, rgba(43, 29, 15, 0.9), rgba(12, 8, 5, 0.94));
  color: var(--text);
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 213, 0.12),
    0 12px 24px rgba(0, 0, 0, 0.34);
  transform: translateX(-50%);
}

.play-shell .round-widget::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--asset-medallion) center / cover no-repeat;
  filter: drop-shadow(0 5px 9px rgba(0, 0, 0, 0.34));
  opacity: 1;
  transform: translateX(-50%);
}

.play-shell .round-widget::after {
  display: none;
}

.play-shell .round-widget-main {
  display: grid;
  gap: 2px;
  justify-items: center;
  text-align: center;
}

.play-shell .round-widget-main span {
  display: block;
  color: rgba(216, 170, 67, 0.86);
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.play-shell .round-widget-main strong {
  display: block;
  max-width: 100%;
  margin-top: 2px;
  overflow: hidden;
  color: #fff3d6;
  font-size: 0.9rem;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-shell .round-token-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin-top: 6px;
}

.play-shell .round-token {
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 3px 5px;
  border: 1px solid rgba(216, 170, 67, 0.15);
  border-radius: 999px;
  background: rgba(7, 5, 3, 0.35);
  color: rgba(255, 239, 203, 0.9);
  font-size: 0.62rem;
}

.play-shell .round-token b {
  color: rgba(205, 185, 140, 0.7);
  font-size: 0.49rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.play-shell .round-token span {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.62rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-shell .trick-grid {
  position: absolute;
  left: 50%;
  top: 450px;
  z-index: 15;
  width: auto;
  min-width: 230px;
  height: 118px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
  transform: translateX(-50%);
}

.play-shell .trick-slot {
  width: auto;
  min-width: 0;
  display: grid;
  place-items: center;
  justify-self: auto;
  align-self: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(246, 236, 216, 0.5);
  box-shadow: none;
  filter: none;
}

.play-shell .trick-slot.is-empty:not(.is-active) {
  display: none;
}

.play-shell .table-zone:not([data-phase="playing"]) .trick-slot.is-empty {
  display: none;
}

.play-shell .trick-slot.is-empty.is-active {
  min-width: 72px;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid rgba(216, 170, 67, 0.24);
  background:
    radial-gradient(circle at 50% 50%, rgba(216, 170, 67, 0.16), transparent 70%),
    rgba(8, 22, 11, 0.22);
  color: rgba(255, 242, 206, 0.78);
  box-shadow: 0 0 18px rgba(216, 170, 67, 0.12);
}

.play-shell .trick-slot.has-card {
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.4));
}

.play-shell .trick-slot .card {
  width: 74px;
  border-radius: 7px;
  box-shadow:
    0 14px 22px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(35, 25, 12, 0.24);
}

.play-shell .trick-slot.has-card:nth-child(2) .card {
  width: 82px;
}

.play-shell .action-panel {
  position: absolute;
  left: calc(50% + 104px);
  top: 848px;
  z-index: 30;
  width: max-content;
  max-width: 800px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 6px 10px 6px 16px;
  border: 1px solid rgba(216, 170, 67, 0.24);
  border-radius: 999px;
  background:
    radial-gradient(circle at 8% 0%, rgba(216, 170, 67, 0.12), transparent 56%),
    linear-gradient(180deg, rgba(32, 21, 12, 0.68), rgba(10, 7, 5, 0.82));
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 213, 0.08),
    0 16px 30px rgba(0, 0, 0, 0.24);
  transform: translateX(-50%);
}

.play-shell .action-panel::before {
  display: none;
}

.play-shell .action-copy {
  flex: 0 0 auto;
  display: grid;
  gap: 1px;
}

.play-shell .action-copy h2 {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.2;
}

.play-shell .action-copy p {
  max-width: 190px;
  overflow: hidden;
  color: rgba(205, 185, 140, 0.82);
  font-size: 0.78rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-shell .action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  min-width: 0;
  max-width: none;
  flex: 0 1 auto;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
}

.play-shell .action-buttons button {
  min-width: 42px;
  min-height: 34px;
  padding: 4px 12px;
  font-size: 0.9rem;
  font-weight: 800;
}

.play-shell .action-buttons .pass-button {
  min-width: 82px;
  border-color: rgba(205, 185, 140, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 235, 186, 0.07), transparent 44%),
    linear-gradient(180deg, #2b241a, #14100b);
}

.play-shell .sort-button {
  flex: 0 0 auto;
  min-width: 0;
  min-height: 34px;
  padding: 4px 14px;
  font-size: 0.86rem;
  font-weight: 800;
  border-color: rgba(216, 170, 67, 0.34);
}

.play-shell .sort-button.is-active {
  border-color: rgba(255, 220, 148, 0.7);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 231, 169, 0.22), transparent 64%),
    linear-gradient(180deg, #6b451b, #2b170a);
  color: #fff3d6;
}

.play-shell .seat-switcher {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 4px;
}

.play-shell .seat-switcher .compact-button {
  min-height: 30px;
  padding: 4px 9px;
  font-size: 0.82rem;
}


/* ============================================================
   Lobby already handled above (@media max-width:900).
   Desktop/tablet/laptop: the table is a fixed design canvas
   (.table-scene) scaled to fit by JS (see shared.js initTableScaling).
   Phones (<=600px) drop the canvas and reflow into a vertical stack.
   ============================================================ */
@media (max-width: 600px) {
  .cruce-play-body {
    overflow: auto;
  }

  .play-shell {
    width: 100%;
    padding: 6px 8px 18px;
  }

  .play-shell .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    border-radius: 18px;
  }

  .play-shell .topbar-actions {
    align-self: flex-start;
    flex-wrap: wrap;
  }

  /* Drop the scaled canvas; reflow as a vertical stack. */
  .play-shell .game-stage {
    display: block;
    height: auto !important;
    overflow: visible;
  }

  .play-shell .table-scene {
    position: static;
    width: 100%;
    height: auto;
    margin: 0;
    padding-top: 6px;
    transform: none;
    perspective: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .play-shell .table-scene::before,
  .play-shell .table-base,
  .play-shell .table-plane,
  .play-shell .event-log {
    display: none;
  }

  .play-shell .score-strip {
    position: static;
    order: 0;
    align-self: center;
    flex-wrap: wrap;
    width: 100%;
    max-width: 420px;
    transform: none;
  }

  .play-shell .table-zone,
  .play-shell .table-zone[data-player-count],
  .play-shell .table-zone[data-player-count="2"],
  .play-shell .table-zone[data-player-count="3"] {
    position: static;
    inset: auto;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    perspective: none;
  }

  /* Opponents: compact horizontal chips near the top. */
  .play-shell .table-zone .seat:not(.is-viewer) {
    position: static;
    order: 1;
    transform: none;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
  }

  .play-shell .table-zone .seat:not(.is-viewer) .seat-meta {
    flex: 0 0 auto;
    min-width: 0;
  }

  .play-shell .table-zone .seat:not(.is-viewer) .hand {
    flex: 1 1 auto;
    width: auto;
    height: 48px;
    justify-content: flex-start;
    gap: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    filter: none;
  }

  .play-shell .table-zone .seat:not(.is-viewer) .card,
  .play-shell .table-zone .seat:not(.is-viewer) .card.card-back {
    width: 30px;
    height: 43px;
    margin-left: -12px;
  }

  .play-shell .table-zone .seat:not(.is-viewer) .card:first-child {
    margin-left: 0;
  }

  .play-shell .round-widget {
    position: static;
    order: 2;
    align-self: center;
    width: 100%;
    max-width: 340px;
    transform: none;
  }

  .play-shell .round-widget::before {
    display: none;
  }

  .play-shell .trick-grid {
    position: static;
    order: 3;
    align-self: center;
    width: 100%;
    height: auto;
    min-height: 0;
    flex-wrap: wrap;
    transform: none;
  }

  /* Your dock. */
  .play-shell .seat.is-viewer {
    position: static;
    order: 4;
    width: 100%;
    min-height: 0;
    padding: 12px 8px 10px;
    border-radius: 18px;
    transform: none;
  }

  .play-shell .seat.is-viewer::before {
    display: none;
  }

  .play-shell .seat.is-viewer .seat-meta {
    position: static;
    margin: 0 0 8px;
  }

  .play-shell .seat.is-viewer .hand {
    height: auto;
    margin: 0;
    padding: 6px 0;
    gap: 6px;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .play-shell .seat.is-viewer .card {
    width: 92px;
  }

  .play-shell .action-panel {
    position: static;
    order: 5;
    left: auto;
    width: 100%;
    max-width: none;
    flex-wrap: wrap;
    justify-content: center;
    border-radius: 16px;
    transform: none;
  }
}

