:root {
  --felt: #145a3a;
  --felt-dark: #0d3f28;
  --felt-edge: #0a2e1d;
  --ink: #f3efe4;
  --muted: #b9c8bd;
  --accent: #f2c14e;
  --red: #c62828;
  --black: #1b1b1b;
  --card: #fffdf7;
  --panel: #10251b;
  --panel-2: #173325;
  --good: #58c27d;
  --bad: #e5645a;
  --us: #2e6fb5;
  --them: #8a3b3b;
  --card-w: 72px;
  --card-h: 104px;
  --hand-w: 72px;
  --hand-h: 104px;
  --small-w: 42px;
  --small-h: 60px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--felt-edge);
  color: var(--ink);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.suit-red { color: #ff6b6b; }
.suit-black { color: var(--ink); }

/* ---------- Buttons & inputs ---------- */
button {
  font: inherit; font-weight: 700;
  border: 0; border-radius: 8px; padding: 8px 12px; cursor: pointer;
  background: var(--card); color: var(--black);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
  touch-action: manipulation;
}
button:hover { filter: brightness(.93); }
button:disabled { opacity: .6; cursor: default; }
button.primary { background: var(--accent); }
button.danger { background: var(--bad); color: #fff; }
button.ghost { background: rgba(255, 255, 255, .12); color: var(--ink); }
button.link {
  background: none; box-shadow: none; color: var(--muted); font-weight: 500;
  text-decoration: underline; padding: 4px; align-self: center;
}
button.mini { padding: 2px 8px; font-size: 12px; border-radius: 6px; }
input {
  font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .15); background: var(--panel-2); color: var(--ink);
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Cards ---------- */
.card {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 8px;
  background: var(--card);
  color: var(--black);
  position: relative;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
  user-select: none;
  flex: none;
  border: 1px solid #d8d2c2;
}
.card.red { color: var(--red); }
.card .corner {
  position: absolute; top: 5px; left: 7px;
  font-weight: 800; font-size: calc(var(--card-w) * .25); line-height: 1; text-align: center;
}
.card .corner small { display: block; font-size: .9em; }
.card .pip { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--card-w) * .52); opacity: .9; }
.card .pts {
  position: absolute; right: 4px; bottom: 4px;
  font-size: 11px; font-weight: 800; color: #fff;
  background: #6b5a2a; border-radius: 99px; padding: 0 5px; line-height: 1.5;
}
.card.back {
  background: repeating-linear-gradient(45deg, #7a1f2b 0 6px, #8e2a37 6px 12px);
  border: 3px solid #f3efe4;
}
.card.small { --card-w: var(--small-w); --card-h: var(--small-h); border-radius: 6px; }
.card.small .pts { display: none; }
.card.small.back { border-width: 2px; }

/* Trump cards: gold frame, glow and a star badge. */
.card.trump {
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 2px rgba(242, 193, 78, .45), 0 0 14px rgba(242, 193, 78, .55), 0 2px 6px rgba(0, 0, 0, .35);
  background: linear-gradient(160deg, #fffaf0 0%, #fff3d1 100%);
}
.card.trump::after {
  content: "★"; position: absolute; top: -8px; left: -8px;
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; line-height: 1;
  background: var(--accent); color: #6b4a00; box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}
.card.small.trump::after { width: 16px; height: 16px; font-size: 10px; top: -6px; left: -6px; }

/* ---------- App layout (desktop) ---------- */
.app {
  display: grid;
  grid-template-columns: 1fr 300px;
  min-height: 100vh;
  align-items: start;
}
.table {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  grid-template-rows: auto auto minmax(240px, 1fr) auto auto auto auto;
  grid-template-areas:
    "top      top      top"
    ".        north    ."
    "west     center   east"
    "prompt   prompt   prompt"
    "controls controls controls"
    "south    south    south"
    "hand     hand     hand";
  gap: 8px;
  padding: 16px;
  background: radial-gradient(ellipse at center, var(--felt) 0%, var(--felt-dark) 75%);
  overflow-x: hidden;
}
.topbar { grid-area: top; display: none; }
.seat-2 { grid-area: north; justify-self: center; }
.seat-3 { grid-area: west; align-self: center; justify-self: start; }
.seat-1 { grid-area: east; align-self: center; justify-self: end; }
.seat-0 { grid-area: south; justify-self: center; }
.center { grid-area: center; position: relative; min-height: 240px; }
.prompt { grid-area: prompt; text-align: center; min-height: 22px; color: var(--accent); font-weight: 600; }
.controls { grid-area: controls; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; min-height: 8px; }
.hand {
  grid-area: hand;
  display: flex; justify-content: center; flex-wrap: nowrap;
  padding: 14px 0 8px;
}

/* ---------- Seats ---------- */
.seat {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 12px;
  background: rgba(0, 0, 0, .18);
  border: 2px solid transparent;
  min-width: 140px; max-width: 100%;
  transition: border-color .2s, box-shadow .2s;
}
.seat.turn { border-color: var(--accent); box-shadow: 0 0 18px rgba(242, 193, 78, .35); }
.seat .name { font-weight: 700; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; max-width: 100%; }
.seat .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 12em; }
.tag {
  font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 99px;
  background: rgba(255, 255, 255, .15); color: var(--ink); white-space: nowrap;
}
.tag.team-us { background: var(--us); }
.tag.team-them { background: var(--them); }
.tag.dealer { background: #555; }
.tag.bot { background: #5b4a8a; }
.tag.offline { background: #7a5b16; }
.seat .status { font-size: 13px; color: var(--muted); min-height: 18px; }
.seat .status.bid { color: var(--accent); font-weight: 700; }
.seat-row { display: flex; align-items: center; gap: 10px; }
.backs { display: flex; align-items: center; position: relative; }
.backs .card { margin-left: -30px; }
.backs .card:first-child { margin-left: 0; }
.backs .count { display: none; }
.hidden-trump { display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--accent); gap: 2px; font-weight: 700; }
.hidden-trump .card { transform: rotate(90deg); margin: 10px 0; box-shadow: 0 0 0 2px rgba(242, 193, 78, .6), 0 2px 6px rgba(0, 0, 0, .4); }

/* ---------- Your hand ---------- */
/* Cards overlap just enough to fit on one row: --n is the number of cards. */
.hand .card {
  --card-w: var(--hand-w); --card-h: var(--hand-h);
  cursor: default;
  transition: transform .12s, opacity .12s, box-shadow .12s;
}
.hand .card + .card { margin-left: min(6px, calc((100% - var(--n) * var(--hand-w)) / (var(--n) - 1))); }
.hand .card.playable { cursor: pointer; }
.hand .card.playable:hover { transform: translateY(-12px); box-shadow: 0 8px 16px rgba(0, 0, 0, .45); z-index: 2; }
.hand.my-turn .card.playable { transform: translateY(-6px); }
.hand.my-turn .card.playable:hover { transform: translateY(-14px); }
.hand .card.disabled { opacity: .45; filter: grayscale(.4); }
.hand .card.trump.disabled { opacity: .6; }

/* Your face-down trump, set aside at the edge of the table. */
.trumpslot {
  position: absolute; left: 20px; bottom: 24px; z-index: 3;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px 10px 10px; border-radius: 12px;
  background: rgba(0, 0, 0, .28); border: 1px dashed rgba(242, 193, 78, .6);
  font-size: 12px; font-weight: 700; color: var(--accent); line-height: 1.2;
}
.trumpslot small { color: var(--muted); font-weight: 500; }
.trumpslot .card { transform: rotate(-8deg); }

/* ---------- Trick area ---------- */
.slot { position: absolute; }
/* Top/bottom cards hug the middle so the trick reads as one cluster on tall screens. */
.slot-0 { left: 50%; bottom: max(4px, calc(50% - var(--card-h) * 1.5 - 8px)); transform: translateX(-50%); }
.slot-2 { left: 50%; top: max(4px, calc(50% - var(--card-h) * 1.5 - 8px)); transform: translateX(-50%); }
.slot-3 { left: calc(50% - var(--card-w) - 58px); top: 50%; transform: translateY(-50%); }
.slot-1 { left: calc(50% + 58px); top: 50%; transform: translateY(-50%); }
.slot .card { transition: transform .7s ease-in, opacity .7s ease-in; }
/* Winner glows green so it can't be confused with the gold trump frame. */
.slot.winner .card { box-shadow: 0 0 0 3px #6fe39a, 0 0 18px rgba(111, 227, 154, .7), 0 6px 18px rgba(0, 0, 0, .5); }
.slot.winner .card { animation: win-pulse .9s ease 1; }
@keyframes win-pulse { 50% { transform: scale(1.08); } }
/* Finished trick slides toward the winner and fades. */
.center.collect-0 .slot .card { transform: translateY(170px) scale(.55); opacity: 0; }
.center.collect-2 .slot .card { transform: translateY(-170px) scale(.55); opacity: 0; }
.center.collect-1 .slot .card { transform: translateX(200px) scale(.55); opacity: 0; }
.center.collect-3 .slot .card { transform: translateX(-200px) scale(.55); opacity: 0; }
.center-note {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 13px; color: var(--muted); text-align: center; pointer-events: none; white-space: nowrap;
}
.center-note.won {
  color: var(--ink); font-weight: 700; background: rgba(0, 0, 0, .45);
  padding: 3px 10px; border-radius: 99px; z-index: 2;
}

/* ---------- Controls ---------- */
.baton { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.baton-head { font-size: 14px; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; justify-content: center; }
.baton-cur { font-size: 26px; color: var(--accent); line-height: 1; }
.baton-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
button.raise {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 64px; padding: 8px 12px; border-radius: 12px; line-height: 1.1;
}
.raise-k { font-size: 20px; font-weight: 800; }
.raise-v { font-size: 12px; font-weight: 600; opacity: .7; }
button.raise.max {
  background: linear-gradient(135deg, #f2c14e, #e0663a); color: #1b1b1b;
  box-shadow: 0 0 14px rgba(242, 120, 60, .45);
}
.redeal {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  background: rgba(229, 100, 90, .15); border: 1px solid rgba(229, 100, 90, .5);
  padding: 6px 10px; border-radius: 10px; font-size: 13px;
}

/* ---------- Side panel ---------- */
.side {
  background: var(--panel);
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  position: sticky; top: 0; height: 100vh;
  overflow: hidden;
  border-left: 1px solid rgba(255, 255, 255, .06);
}
.side-head { display: flex; justify-content: space-between; align-items: center; }
.side h1 { margin: 0; font-size: 22px; letter-spacing: .5px; }
.side h1 span { color: var(--accent); }
.drawer-close { display: none; }
.info, .score, .roombox { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; font-size: 14px; flex: none; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 2px 0; }
.k { color: var(--muted); }
.trump-big { font-size: 20px; font-weight: 800; }
.last-trick { font-weight: 700; display: flex; gap: 6px; }
.last-trick .lt-win { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; margin-top: 4px; position: relative; }
.bar > div { height: 100%; background: var(--good); }
.bar .target { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--accent); }
.rules { background: var(--panel-2); border-radius: 10px; padding: 8px 12px; font-size: 13px; flex: none; }
.rules summary { cursor: pointer; font-weight: 700; }
.rules ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.log {
  flex: 1; min-height: 80px; overflow-y: auto; background: var(--panel-2); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; color: var(--muted);
}
.log div { padding: 2px 0; border-bottom: 1px solid rgba(255, 255, 255, .04); }
.log div:last-child { color: var(--ink); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #777; }
.dot.online { background: var(--good); }
.dot.offline { background: var(--bad); }
.dot.bot { background: #9b87d6; }
.backdrop { display: none; }

/* ---------- Modal & toast ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .55);
  display: grid; place-items: center; z-index: 40; padding: 16px;
}
.modal .box {
  background: var(--panel); border-radius: 14px; padding: 24px 28px; width: min(360px, 100%);
  text-align: center; box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
}
.modal h2 { margin: 0 0 8px; }
.modal .made { color: var(--good); }
.modal .failed { color: var(--bad); }
.modal table { margin: 12px auto; border-collapse: collapse; }
.modal td { padding: 4px 12px; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  background: #222; color: #fff; padding: 10px 16px; border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .4); max-width: calc(100vw - 32px);
}

/* ---------- Trump reveal animation ---------- */
.revealfx {
  position: fixed; inset: 0; z-index: 45; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(circle at 50% 45%, rgba(242, 193, 78, .28), rgba(0, 0, 0, .6) 62%);
  opacity: 0;
}
.revealfx.play { animation: fx-fade 2.8s ease forwards; }
@keyframes fx-fade { 0% { opacity: 0; } 8% { opacity: 1; } 82% { opacity: 1; } 100% { opacity: 0; } }
.fx-rays {
  position: absolute; left: 50%; top: 45%; width: 520px; height: 520px; margin: -260px 0 0 -260px;
  background: repeating-conic-gradient(rgba(242, 193, 78, .22) 0 8deg, transparent 8deg 24deg);
  border-radius: 50%;
  mask-image: radial-gradient(circle, #000 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle, #000 30%, transparent 70%);
  animation: fx-spin 2.8s linear forwards;
}
@keyframes fx-spin { from { transform: rotate(0) scale(.6); } to { transform: rotate(90deg) scale(1.1); } }
.fx-card { perspective: 900px; width: 120px; height: 174px; position: relative; }
.fx-inner {
  position: relative; width: 100%; height: 100%; transform-style: preserve-3d;
  animation: fx-flip 2.8s cubic-bezier(.2, .8, .2, 1) forwards;
}
@keyframes fx-flip {
  0% { transform: translateY(40px) scale(.4) rotateY(0); }
  18% { transform: translateY(0) scale(1.1) rotateY(0); }
  42% { transform: scale(1.15) rotateY(180deg); }
  52% { transform: scale(1) rotateY(180deg); }
  100% { transform: scale(1) rotateY(180deg); }
}
.fx-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.fx-front { transform: rotateY(180deg); }
.fx-face .card { --card-w: 120px; --card-h: 174px; border-radius: 12px; }
.fx-face .card.trump { box-shadow: 0 0 0 3px var(--accent), 0 0 40px rgba(242, 193, 78, .9); }
.fx-title {
  position: relative; font-size: 30px; font-weight: 800; text-align: center; padding: 0 16px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .8);
  animation: fx-pop 2.8s ease forwards;
}
.fx-title .suit-red { color: #ff7b7b; }
.fx-sub { position: relative; color: var(--ink); font-weight: 600; opacity: .85; animation: fx-pop 2.8s ease forwards; }
@keyframes fx-pop {
  0%, 38% { transform: scale(.5); opacity: 0; }
  48% { transform: scale(1.15); opacity: 1; }
  56%, 100% { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .fx-inner, .fx-rays, .fx-title, .fx-sub, .slot.winner .card { animation-duration: .01s; }
  .fx-inner { transform: rotateY(180deg); }
}

/* ---------- Lobby & waiting room ---------- */
.screen {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: 24px 16px;
  background: radial-gradient(ellipse at center, var(--felt) 0%, var(--felt-dark) 75%);
}
.panel { background: var(--panel); border-radius: 16px; padding: 28px; box-shadow: 0 16px 48px rgba(0, 0, 0, .45); width: 100%; }
.lobby-box { max-width: 400px; display: flex; flex-direction: column; gap: 14px; }
.waiting-box { max-width: 620px; display: flex; flex-direction: column; gap: 16px; }
.home-link {
  align-self: flex-start; margin: -6px 0 -2px;
  color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none;
  padding: 4px 10px 4px 0;
}
.home-link:hover { color: var(--ink); text-decoration: underline; }
.home-link[hidden] { display: none; }
.brand { margin: 0; font-size: 34px; letter-spacing: .5px; }
.brand span { color: var(--accent); }
.sub { margin: 0; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.wide { width: 100%; padding: 12px; }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 3px; font-weight: 700; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: rgba(255, 255, 255, .12); }
.room-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
.room-head .k { font-size: 13px; }
.room-code { font-size: 40px; font-weight: 800; letter-spacing: 8px; color: var(--accent); line-height: 1.1; }
.seat-picker { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-areas: ". n ." "w c e" ". s ."; gap: 10px; }
.pick {
  background: var(--panel-2); border-radius: 12px; padding: 10px; min-height: 96px;
  display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center; text-align: center;
  border-top: 3px solid transparent;
}
.pick.team-A { border-top-color: var(--us); }
.pick.team-B { border-top-color: var(--them); }
.pick .k { font-size: 12px; }
.pick-name { font-weight: 700; word-break: break-word; }
.pick-0 { grid-area: s; } .pick-1 { grid-area: e; } .pick-2 { grid-area: n; } .pick-3 { grid-area: w; }
.pick-center { grid-area: c; display: grid; place-items: center; border-radius: 12px; background: var(--felt); color: var(--muted); font-size: 13px; }
.w-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ---------- Medium screens ---------- */
@media (max-width: 1000px) and (min-width: 701px) {
  .app { grid-template-columns: 1fr 250px; }
  :root { --hand-w: 64px; --hand-h: 92px; }
}

/* ---------- Phones ---------- */
@media (max-width: 700px) {
  :root {
    --card-w: 60px; --card-h: 86px;
    --hand-w: 60px; --hand-h: 87px;
    --small-w: 26px; --small-h: 38px;
  }
  body { font-size: 14px; }
  .app { display: block; min-height: 0; }

  /* One screen, no page scroll: top bar, seats, trick, controls, hand. */
  .table {
    height: 100vh; height: 100dvh; min-height: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto auto minmax(190px, 1fr) auto auto auto auto;
    grid-template-areas:
      "top      top      top"
      "west     north    east"
      "center   center   center"
      "prompt   prompt   prompt"
      "controls controls controls"
      "south    south    south"
      "hand     hand     hand";
    gap: 4px;
    padding: calc(4px + env(safe-area-inset-top)) 6px calc(4px + env(safe-area-inset-bottom));
    overflow: hidden;
  }
  .topbar {
    display: flex; align-items: center; gap: 6px;
    background: rgba(0, 0, 0, .3); border-radius: 12px; padding: 4px 4px 4px 10px;
  }
  .tb-info { flex: 1; display: flex; justify-content: space-between; gap: 6px; min-width: 0; }
  .tb-cell { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
  .tb-k { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
  .tb-v { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tb-v .suit-red, .tb-v .suit-black { font-size: 20px; line-height: 1; }
  .tb-v .lock { font-size: 10px; color: var(--muted); margin-left: 3px; }
  .tb-v .us { color: #8ab8ff; } .tb-v .them { color: #ff9c9c; }
  .tb-menu { background: rgba(255, 255, 255, .12); color: var(--ink); box-shadow: none; font-size: 18px; padding: 6px 12px; }

  /* Compact seats: name, a single card back with a count, status. */
  .seat { min-width: 0; width: 100%; padding: 4px 6px; gap: 2px; border-radius: 10px; align-self: stretch; justify-content: flex-start; }
  .seat .name { gap: 3px; font-size: 13px; }
  .seat .nm { max-width: 100%; }
  .tag { font-size: 9px; padding: 0 5px; }
  .seat .tag.team-us, .seat .tag.team-them { display: none; }
  .seat.us { border-left: 3px solid var(--us); }
  .seat.them { border-left: 3px solid var(--them); }
  .seat.turn { border-color: var(--accent); }
  .seat .status { font-size: 11px; min-height: 14px; }
  .seat-row { gap: 6px; }
  .backs .card { display: none; }
  .backs .card:first-child { display: block; }
  .backs .count {
    display: grid; place-items: center; position: absolute; right: -8px; bottom: -6px;
    min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px;
    background: var(--panel); color: var(--ink); font-size: 11px; font-weight: 800;
    border: 1px solid rgba(255, 255, 255, .3);
  }
  .hidden-trump { font-size: 9px; }
  .hidden-trump .card { margin: 4px 0; }

  /* Your seat collapses to a single row above your hand. */
  .seat-0 { flex-direction: row; justify-content: center; gap: 8px; width: auto; padding: 2px 10px; }
  .seat-0 .status:empty { display: none; }

  .center { min-height: 190px; }
  .slot-3 { left: calc(50% - var(--card-w) - 44px); }
  .slot-1 { left: calc(50% + 44px); }
  .center.collect-0 .slot .card { transform: translateY(120px) scale(.5); }
  .center.collect-2 .slot .card { transform: translateY(-120px) scale(.5); }
  .center.collect-1 .slot .card { transform: translateX(120px) scale(.5); }
  .center.collect-3 .slot .card { transform: translateX(-120px) scale(.5); }
  .card.trump::after { width: 16px; height: 16px; font-size: 10px; top: -6px; left: -6px; }

  .prompt { font-size: 13px; min-height: 18px; line-height: 1.3; padding: 0 4px; }
  .controls { gap: 6px; }
  .controls > button { padding: 8px 12px; }
  .baton { gap: 4px; }
  .baton-head { font-size: 12px; }
  .baton-cur { font-size: 20px; }
  .baton-row { gap: 6px; flex-wrap: nowrap; }
  button.raise { min-width: 0; flex: 1 1 0; padding: 7px 6px; border-radius: 10px; }
  .raise-k { font-size: 17px; }
  .raise-v { font-size: 10px; }
  .redeal { font-size: 12px; padding: 4px 8px; gap: 6px; }

  .hand { padding: 10px 2px 2px; }
  .hand .card.playable:hover { transform: none; }
  .hand.my-turn .card.playable, .hand.my-turn .card.playable:hover { transform: translateY(-8px); }

  /* Your trump card tucks into the left edge beside the trick area. */
  .trumpslot {
    grid-area: center; position: relative; left: auto; bottom: auto;
    align-self: start; justify-self: start; margin: 4px 0 0 2px;
    flex-direction: column; gap: 2px; padding: 4px; font-size: 9px; text-align: center;
  }
  .trumpslot small { display: none; }
  .trumpslot br { display: none; }
  .trumpslot .card { --card-w: 34px; --card-h: 50px; }

  /* Info panel becomes a bottom sheet. */
  .side {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    height: 80vh; height: 80dvh;
    z-index: 35; border-left: 0; border-radius: 18px 18px 0 0;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
    transform: translateY(105%); transition: transform .25s ease;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, .5);
  }
  .app.drawer-open .side { transform: none; }
  .drawer-close { display: block; padding: 4px 10px; }
  .app.drawer-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 34; }

  .fx-card { width: 100px; height: 145px; }
  .fx-face .card { --card-w: 100px; --card-h: 145px; }
  .fx-title { font-size: 24px; }
  .fx-rays { width: 380px; height: 380px; margin: -190px 0 0 -190px; }

  .panel { padding: 20px; }
  .room-code { font-size: 32px; letter-spacing: 6px; }
  .seat-picker { gap: 6px; }
  .pick { min-height: 84px; padding: 8px 6px; }
  .pick button { padding: 6px 8px; font-size: 13px; }
}

/* Very short phones (landscape or small): tighten further. */
@media (max-width: 700px) and (max-height: 640px) {
  :root { --card-w: 46px; --card-h: 66px; --hand-w: 52px; --hand-h: 75px; }
  .center { min-height: 150px; }
  .slot-3 { left: calc(50% - var(--card-w) - 34px); }
  .slot-1 { left: calc(50% + 34px); }
  .seat .status { display: none; }
}
