/* Xeno.
 *
 * A first-person card table in CSS 3D.
 *   .scene    perspective camera
 *   .table    the tabletop, tilted away from you; seats stand on its far
 *             edge, played cards and the deck lie on it
 *   .hand     your hand, held up in front of you
 *   .hud      words and buttons, flat and crisp
 *   .fly      cards in flight between deck, hands and piles
 *
 * Palette: ink #1A1D33, velvet #262A47, vellum #EFE6D2, gilt #C8A24C,
 * mist #8C90AE, ember #C0453E.
 */

:root {
  --ink: #1a1d33;
  --ink-2: #12142a;
  --velvet: #262a47;
  --velvet-2: #31365a;
  --line: #3b4069;
  --vellum: #efe6d2;
  --mist: #8c90ae;
  --gilt: #c8a24c;
  --gilt-2: #e0be68;
  --ember: #c0453e;

  --display: "Cormorant Garamond", Georgia, serif;
  --text: "Atkinson Hyperlegible", system-ui, sans-serif;

  --ratio: 1.58;
  --tilt: 55deg;
  --hand-w: min(16vh, 25vw);
  --pile-w: min(10vh, 13vw);
  --far: 1.45;       /* opponents' piles, further away, are drawn bigger */
  --spread: 2.2;     /* widest a pile gets, in card widths past the first */
  --seat-w: min(8.5vh, 11vw);
  --pick-w: min(12vh, 15vw);
  --ease: cubic-bezier(.25, .8, .25, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  overflow: hidden;
  color: var(--vellum);
  font-family: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(ellipse 70% 55% at 50% 58%, rgba(200, 162, 76, .14), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 40%, #23264a 0%, var(--ink-2) 70%);
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gilt); outline-offset: 3px; }
p, h1, h2, h3 { margin: 0; }
#app { position: fixed; inset: 0; }

/* ----------------------------------------------------------------- cards */

.card {
  --w: var(--pile-w);
  position: relative;
  flex: none;
  width: var(--w);
  height: calc(var(--w) * var(--ratio));
  padding: 0;
  border: 0;
  background: none;
  transform-style: preserve-3d;
}
.card__inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform .7s var(--ease);
}
.card.is-down .card__inner { transform: rotateY(180deg); }
.card__face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: calc(var(--w) * .07);
  background: center / cover no-repeat;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 6px 16px rgba(0, 0, 0, .45);
}
.card__back {
  background-image: url(/images/backside.png);
  transform: rotateY(180deg);
}
.card.is-empty { border: 1.5px dashed rgba(239, 230, 210, .2); border-radius: calc(var(--w) * .07); }
button.card { cursor: pointer; }
button.card:disabled { cursor: default; }
.card.is-selected .card__face { box-shadow: 0 0 0 3px var(--gilt), 0 0 28px rgba(200, 162, 76, .6); }
.card.is-ghost { visibility: hidden; }

/* ----------------------------------------------------------------- scene */

.scene {
  position: absolute;
  inset: 0;
  perspective: 1100px;
  perspective-origin: 50% 25%;
  transform-style: preserve-3d;
  /* This full-screen layer sits in front of the table in 3D and would take
     the clicks; only seats and the deck do. */
  pointer-events: none;
}
.table {
  position: absolute;
  left: 50%;
  bottom: -12vh;
  width: min(150vh, 128vw);
  height: 150vh;
  margin-left: calc(min(150vh, 128vw) / -2);
  transform-origin: 50% 100%;
  transform: rotateX(var(--tilt));
  transform-style: preserve-3d;
  border-radius: 50% / 46%;
  background:
    radial-gradient(ellipse 50% 42% at 50% 46%, rgba(200, 162, 76, .10), transparent 72%),
    radial-gradient(ellipse at 50% 50%, #2d3260 0%, #1f2347 55%, #171a36 100%);
  box-shadow:
    0 0 0 10px #3a2f1c,
    0 0 0 13px var(--gilt),
    0 0 0 22px #241d12,
    0 40px 120px rgba(0, 0, 0, .7);
}
/* The magic circle from the original site, inlaid in the cloth. */
.table::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 52%;
  width: 70%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: url(/images/circle.png) center / contain no-repeat;
  opacity: .35;
  pointer-events: none;
}

.on {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  transform-style: preserve-3d;
}
.light {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 34%;
  height: 26%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(224, 190, 104, .36), rgba(224, 190, 104, .08) 60%, transparent);
  transition: left .6s var(--ease), top .6s var(--ease);
  pointer-events: none;
}

/* A discard pile overlaps more as it grows (--n cards), so it's never wider
   than one card plus --spread card widths, however long the game runs. */
.pile { --cw: var(--pile-w); display: flex; align-items: center; transform-style: preserve-3d; }
.pile .card { --w: var(--cw); }
.pile .card + .card { margin-left: calc(var(--cw) * (min(.38, var(--spread) / max(1, var(--n, 2) - 1)) - 1)); }
.pile .card:nth-child(odd) { transform: rotate(-3deg); }
.pile .card:nth-child(even) { transform: rotate(4deg) translateY(4%); }
.on.is-far .pile { --cw: calc(var(--pile-w) * var(--far)); }

.deck { position: relative; display: flex; align-items: flex-end; gap: calc(var(--pile-w) * .5); transform-style: preserve-3d; }
.deck__stack {
  position: relative;
  width: calc(var(--pile-w) * 1.15);
  height: calc(var(--pile-w) * 1.15 * var(--ratio));
  padding: 0;
  border: 0;
  background: none;
  transform-style: preserve-3d;
}
.deck__stack .card { --w: calc(var(--pile-w) * 1.15); position: absolute; left: 0; top: 0; }
button.deck__stack { cursor: pointer; pointer-events: auto; }
.deck.is-live::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--pile-w) * 3.4);
  height: calc(var(--pile-w) * 3.4);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(224, 190, 104, .55), rgba(224, 190, 104, .12) 55%, transparent);
  animation: pool 1.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes pool { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.deck.is-live .deck__stack .card:last-child .card__face { animation: glow 1.8s ease-in-out infinite; }
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 2px var(--gilt), 0 0 18px rgba(200, 162, 76, .4); }
  50% { box-shadow: 0 0 0 3px var(--gilt-2), 0 0 44px rgba(224, 190, 104, .85); }
}
.aside .card { --w: calc(var(--pile-w) * .8); transform: rotate(90deg); }
.count {
  align-self: flex-end;
  transform-origin: 50% 100%;
  transform: rotateX(calc(var(--tilt) * -1)) scale(1.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 12px 6px;
  border: 1px solid rgba(200, 162, 76, .45);
  border-radius: 10px;
  background: rgba(18, 20, 42, .88);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .45);
  line-height: 1;
  white-space: nowrap;
}
.count b { font-family: var(--display); font-size: 30px; font-weight: 700; }
.count span { color: var(--mist); font-size: 12px; margin-top: 2px; }
.count.is-low b { color: #f5c9c4; }

/* Seats stand on the edge of the table, facing you. */
.seat {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform-origin: 50% 100%;
  transform: translate(-50%, -100%) rotateX(calc(var(--tilt) * -1)) scale(var(--seat-scale, 1.75));
  transform-style: preserve-3d;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
}
.seat__hand { display: flex; gap: 6px; min-height: calc(var(--seat-w) * var(--ratio)); transform-style: preserve-3d; }
.seat__hand .card { --w: var(--seat-w); }
.seat__hand .card:first-child:not(:only-child) { transform: rotate(-6deg); }
.seat__hand .card:last-child:not(:only-child) { transform: rotate(6deg); }
.plate {
  display: flex;
  align-items: baseline;
  gap: 10px;
  max-width: 24vw;
  padding: 6px 16px 7px;
  border: 1px solid rgba(200, 162, 76, .45);
  border-radius: 999px;
  background: rgba(18, 20, 42, .9);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .45);
  white-space: nowrap;
}
.plate__name {
  font-family: var(--display);
  font-size: clamp(20px, 2.6vh, 30px);
  font-weight: 700;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plate__meta { color: var(--mist); font-size: 14px; }
.plate__tag { font-weight: 700; font-size: 14px; color: #f0b4ae; }
.plate__tag.is-protected { color: #a8c9f0; }
.plate__tag.is-win { color: var(--gilt-2); }
.seat.is-turn .plate { border-color: var(--gilt); box-shadow: 0 0 0 1px var(--gilt), 0 0 30px rgba(200, 162, 76, .45); }
.seat.is-turn .plate__name { color: var(--gilt-2); }
.seat.is-out .plate, .seat.is-out .card__face { opacity: .45; }
.seat.is-out .plate__name { text-decoration: line-through; }
.seat.is-offline .plate { border-style: dashed; }
.seat.is-targeted .plate { border-color: var(--ember); box-shadow: 0 0 0 1px var(--ember), 0 0 30px rgba(192, 69, 62, .45); }
button.seat { cursor: pointer; pointer-events: auto; }
.seat.is-targetable .plate { border: 2px dashed var(--gilt-2); animation: beckon 1.4s ease-in-out infinite; }
.seat.is-targetable:hover .plate { background: rgba(200, 162, 76, .25); animation: none; }
@keyframes beckon {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 190, 104, 0); }
  50% { box-shadow: 0 0 0 8px rgba(224, 190, 104, .25); }
}

/* ------------------------------------------------------------- your hand */

.hand {
  position: absolute;
  left: 50%;
  bottom: 7vh;
  width: 0;
  height: calc(var(--hand-w) * var(--ratio));
  perspective: 900px;
  perspective-origin: 50% 0%;
  transition: transform .5s var(--ease);
  pointer-events: none;
}
.hand__tilt { position: absolute; inset: 0; transform: rotateX(14deg); transform-origin: 50% 100%; transform-style: preserve-3d; }
.hand .card {
  --w: var(--hand-w);
  position: absolute;
  left: calc(var(--hand-w) / -2);
  bottom: 0;
  transform-origin: 50% 190%;
  transform: translateX(var(--dx, 0)) rotate(var(--fan, 0deg));
  transition: transform .45s var(--ease);
  pointer-events: auto;
}
.hand button.card:not(:disabled):hover,
.hand button.card:not(:disabled):focus-visible,
.hand .card.is-selected {
  transform: translateX(var(--dx, 0)) rotate(var(--fan, 0deg)) translateY(-14%) translateZ(60px);
}
.hand button.card:not(:disabled) .card__face { box-shadow: 0 0 0 2px var(--gilt), 0 0 26px rgba(200, 162, 76, .5), 0 14px 30px rgba(0, 0, 0, .5); }
.hand .card:disabled .card__face { box-shadow: 0 14px 30px rgba(0, 0, 0, .5); }
.app.is-focus .hand { transform: translateY(62%); }
.app.is-out .hand .card__face { filter: grayscale(.7) brightness(.6); }

.me { position: absolute; left: 20px; bottom: 18px; }
.me .plate { max-width: 30vw; }
.app.is-my-turn .me .plate { border-color: var(--gilt); box-shadow: 0 0 0 1px var(--gilt), 0 0 30px rgba(200, 162, 76, .45); }
.app.is-my-turn .me .plate__name { color: var(--gilt-2); }

/* ------------------------------------------------------------------- HUD */

.hud { position: absolute; inset: 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; text-decoration: none; }
.brand__logo { height: 24px; width: auto; display: block; opacity: .9; }
.top__spacer { flex: 1; pointer-events: none; }

/* Whose turn (or who won): a pill in the top bar, off the table. */
.status {
  position: absolute;
  top: 10px;
  left: 50%;
  translate: -50% 0;
  max-width: min(460px, 44vw);
  padding: 6px 18px 8px;
  border: 1px solid rgba(200, 162, 76, .35);
  border-radius: 999px;
  background: rgba(18, 20, 42, .9);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .4);
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: say .5s var(--ease) both;
}
.status.is-mine { color: var(--gilt-2); border-color: var(--gilt); box-shadow: 0 0 0 1px var(--gilt), 0 0 26px rgba(200, 162, 76, .4); }
.status.is-alert { color: #f5c9c4; border-color: var(--ember); box-shadow: 0 0 0 1px var(--ember), 0 0 26px rgba(192, 69, 62, .35); }

/* Buttons for the moment (Draw, Cancel, Play again): bottom right, clear of
   the table, so cards never fly through them. */
.dock {
  position: absolute;
  right: 20px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(32px, 5.2vh, 54px);
  line-height: 1.02;
  text-wrap: balance;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .35), 0 8px 30px rgba(0, 0, 0, .65);
  animation: say .5s var(--ease) both;
}
@keyframes say { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* Cards can sit right behind the title (cream backs, gold and pale art), so
   it gets its own dark plate like the name plates. */
.focus .title {
  padding: .08em .5em .16em;
  border-radius: .4em;
  background: rgba(18, 20, 42, .84);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.is-mine .title { color: var(--gilt-2); }
.is-alert .title { color: #f5c9c4; }

/* The latest move (if turned on in the menu): under the logo. */
.ticker {
  position: absolute;
  top: 56px;
  left: 14px;
  max-width: min(420px, 30vw);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(18, 20, 42, .82);
  color: #d9d2c1;
  font-size: 14px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* Choosing or revealing: the table dims and one group holds the title, the
   cards held up in the air, and the buttons. */
.dim { position: absolute; inset: 0; background: rgba(10, 12, 28, .72); animation: fade .3s ease both; pointer-events: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.focus {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: min(900px, 94vw);
  max-height: calc(100vh - 110px);
  text-align: center;
}
.focus::before {
  content: "";
  position: absolute;
  inset: -40px -60px;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(12, 14, 32, .88), rgba(12, 14, 32, .6) 60%, transparent);
  pointer-events: none;
}
.air { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 18px; perspective: 900px; }
.air .card { --w: var(--pick-w); transition: transform .25s var(--ease); animation: rise .55s var(--ease) both; }
.air button.card:not(:disabled):hover { transform: translateY(-8px) translateZ(30px); }
.air.is-many { max-width: 640px; }
.air.is-many .card { --w: min(10vh, 14vw); }
@keyframes rise {
  from { opacity: 0; translate: 0 40px; }
  to { opacity: 1; translate: 0 0; }
}
/* Swap / Done for the Reaper's target come in once their cards have landed. */
.focus.is-stage .actions { animation: fade .3s ease 1.8s both; }
/* Watching someone choose from the stage: no dimming, nothing to click. */
.focus.is-watch { pointer-events: none; }
.air__group { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.air__name { padding: 1px 14px 3px; border-radius: 999px; background: rgba(18, 20, 42, .84); font-family: var(--display); font-size: 22px; font-weight: 700; text-shadow: 0 2px 12px rgba(0, 0, 0, .8); }
.air__word { align-self: center; font-family: var(--display); font-style: italic; font-size: 24px; color: var(--mist); }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(18, 20, 42, .88);
  color: var(--vellum);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.btn:hover:not(:disabled) { background: var(--velvet-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: default; color: var(--mist); background: var(--velvet); }
.btn--primary { background: var(--gilt); border-color: var(--gilt); color: var(--ink); box-shadow: 0 8px 24px rgba(200, 162, 76, .3); }
.btn--primary:hover:not(:disabled) { background: var(--gilt-2); border-color: var(--gilt-2); }
.btn--quiet { border-color: transparent; background: transparent; color: var(--mist); min-height: 38px; padding: 0 12px; }
.btn--quiet:hover:not(:disabled) { color: var(--vellum); background: rgba(255, 255, 255, .06); }
.btn--chip { min-height: 38px; padding: 0 14px; }
.badge {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--gilt);
  color: var(--ink);
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}

/* Card chips in the log. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 1px;
  padding: 0 7px 0 3px;
  border-radius: 4px;
  font-weight: 700;
  font-size: .95em;
  line-height: 1.5;
  color: #fff;
  white-space: nowrap;
}
.chip b { display: inline-block; min-width: 1.4em; border-radius: 3px; background: rgba(0, 0, 0, .35); text-align: center; font-size: .9em; }

/* ------------------------------------------------------- cards in flight */

/* Above the table and the words on it; below the scrim (24), drawer (25),
   menu (30), dialogs (40) and toasts (60). */
.fly { position: absolute; inset: 0; z-index: 20; perspective: 1100px; pointer-events: none; }
.fly .card { position: absolute; left: 0; top: 0; will-change: transform; }
/* A glow behind a card shown in the middle (its effect's colour). */
.fx-aura {
  position: absolute;
  inset: -55% -70%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--aura), transparent);
  pointer-events: none;
}
/* The card a Soldier names: a guess, not a real card, so it's outlined. */
.fly .callout { will-change: transform, opacity; }
.callout .card__front { outline: 2px dashed rgba(224, 190, 104, .9); outline-offset: 4px; }
/* The Maiden's shield around a protected player, once an effect bounces off. */
.shield {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(150, 195, 255, .06), rgba(150, 195, 255, .26) 70%, rgba(170, 210, 255, .55) 92%, transparent);
  box-shadow: 0 0 0 2px rgba(195, 222, 255, .85), 0 0 36px 8px rgba(110, 170, 255, .5);
  pointer-events: none;
}
.shield .shield__card { position: relative; left: auto; top: auto; width: var(--w); height: calc(var(--w) * var(--ratio)); opacity: .92; }
/* Two cards meeting: a Noble's (blue), a Revolution's two Boys (fire). */
.clash {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .95), rgba(160, 195, 255, .65) 32%, rgba(80, 130, 230, .25) 60%, transparent);
  pointer-events: none;
}
.clash--fire { background: radial-gradient(closest-side, rgba(255, 250, 235, .95), rgba(255, 190, 90, .75) 30%, rgba(255, 120, 30, .3) 60%, transparent); }
/* The strike on the card an effect takes: a cut, or the Reaper's sweep. */
.fx {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: calc(var(--w) * .07);
  transform: translateZ(3px);
  pointer-events: none;
}
.fx__band { position: absolute; }
.fx--slash .fx__band {
  left: -20%;
  top: 72%;
  width: 150%;
  height: 5%;
  transform-origin: 0 50%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), #fff 12%, #ff5a4a 55%, rgba(255, 90, 74, 0));
  box-shadow: 0 0 14px 3px rgba(255, 60, 50, .85);
}
.fx--reap .fx__band {
  top: -10%;
  bottom: -10%;
  left: 0;
  width: 75%;
  background: linear-gradient(100deg, transparent, rgba(24, 6, 40, .92) 38%, rgba(130, 80, 200, .75) 62%, transparent);
}

/* ---------------------------------------------------------------- drawer */

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  width: min(360px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--velvet);
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 50px rgba(0, 0, 0, .45);
  transform: translateX(105%);
  transition: transform .3s var(--ease);
}
.app.is-drawer .drawer { transform: none; }
.scrim { position: absolute; inset: 0; z-index: 24; background: rgba(0, 0, 0, .35); }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 6px 16px; }
.drawer__title { font-family: var(--display); font-size: 24px; font-weight: 700; }
.people { list-style: none; margin: 0; padding: 0 16px 10px; }
.people li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 15px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #5bbf85; flex: none; }
.dot.is-off { background: transparent; border: 1.5px solid var(--mist); }
.people__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people__score { color: var(--mist); font-size: 13px; white-space: nowrap; }
.tabs { display: flex; gap: 4px; padding: 6px 12px 0; border-top: 1px solid var(--line); }
.tab { padding: 10px 12px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--mist); font-weight: 700; cursor: pointer; }
.tab[aria-selected="true"] { color: var(--vellum); border-bottom-color: var(--gilt); }
.tab .badge { margin-left: 6px; }
.feed { flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: 10px 16px 12px; list-style: none; border-top: 1px solid var(--line); }
.feed li { padding: 5px 0; font-size: 14px; color: #c9c3b4; }
.feed li:first-child { color: var(--vellum); }
.feed--chat li { color: var(--vellum); }
.feed--chat b { color: var(--gilt-2); margin-right: 6px; }
.feed__empty { color: var(--mist) !important; }
.say { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--ink);
  color: var(--vellum);
  font: inherit;
}
.input::placeholder { color: var(--mist); }

/* ------------------------------------------------------------------ menu */

.menu {
  position: absolute;
  top: 56px;
  right: 12px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  min-width: 230px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--velvet);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
}
.menu button { padding: 10px 12px; border: 0; border-radius: 6px; background: none; text-align: left; cursor: pointer; }
.menu button:hover:not(:disabled) { background: var(--velvet-2); }
.menu button:disabled { opacity: .4; cursor: default; }
.menu hr { width: 100%; margin: 4px 0; border: 0; border-top: 1px solid var(--line); }
.menu .is-danger { color: #f0b4ae; }

/* ----------------------------------------------------- panels and forms */

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(440px, 92vw);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(38, 42, 71, .96);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  text-align: left;
}
.panel h1 { font-family: var(--display); font-size: 38px; font-weight: 700; line-height: 1; }
.panel label { font-weight: 700; }
.panel .input { height: 48px; font-size: 17px; flex: none; }
.row { display: flex; gap: 10px; }
.row > .btn { flex: 1; }
.error { color: #f0b4ae; font-size: 14px; }
.overlay { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(14, 16, 34, .7); }

.seats { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.seats li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(18, 20, 42, .6);
}
.seats li.is-empty { border-style: dashed; color: var(--mist); }
.seats__name { flex: 1; font-family: var(--display); font-size: 22px; font-weight: 700; }
/* The end of a game. Shown after the last move has played out. */
.end { background: rgba(14, 16, 34, .55); }
.end.is-late { animation: appear .45s ease 2.2s both; }
@keyframes appear { from { opacity: 0; visibility: hidden; } to { opacity: 1; visibility: visible; } }
.end h1.is-win { color: var(--gilt-2); }
.end__rows li.is-win { border-color: var(--gilt); box-shadow: 0 0 0 1px var(--gilt), 0 0 22px rgba(200, 162, 76, .3); }
.end__rows li.is-win .seats__name { color: var(--gilt-2); }
.end__rows li.is-me:not(.is-win) { border-color: rgba(239, 230, 210, .35); }
.end__rows li.is-out .seats__name { color: var(--mist); text-decoration: line-through; }
.add-bot { align-self: flex-start; min-height: 38px; }
.seats li .btn--quiet { margin-left: auto; }
.end__settings { display: flex; flex-direction: column; gap: 12px; }
.end__settings[open] { padding-bottom: 4px; }
.end__settings summary { cursor: pointer; color: var(--mist); font-weight: 700; }
.end__settings summary span { margin-left: 6px; color: var(--vellum); font-weight: 400; }
.end__settings > .field, .end__settings > .toggle { margin-top: 12px; }
.end__ready { min-width: 3.4em; font-size: 13px; font-weight: 700; color: var(--gilt-2); text-align: right; }
.end__ready.is-ready::before { content: "✓ "; }
.end__wins { min-width: 4.5em; color: var(--mist); font-size: 14px; text-align: right; }
.toggle { display: flex; align-items: center; gap: 10px; font-weight: 400; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field select.input { height: 44px; appearance: auto; }
.mode { padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--mist); font-size: 13px; white-space: nowrap; }
@media (max-width: 440px) { .mode { display: none; } }
.toggle input { width: 18px; height: 18px; accent-color: var(--gilt); }

.home { position: absolute; inset: 0; display: grid; place-items: center; }
.home__title { line-height: 0; }
.home__logo { width: min(440px, 84vw); height: auto; display: block; }
.home__fan { display: flex; justify-content: center; margin: 28px 0 36px; perspective: 900px; }
.home__fan .card { --w: min(18vw, 120px); margin: 0 -18px; }

.toast {
  position: absolute;
  left: 50%;
  top: 60px;
  z-index: 60;
  transform: translateX(-50%);
  padding: 10px 16px;
  border: 1px solid rgba(192, 69, 62, .6);
  border-radius: 10px;
  background: var(--velvet);
  color: #f5c9c4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

/* ----------------------------------------------------------------- phone */

@media (max-aspect-ratio: 1/1) {
  :root {
    --tilt: 50deg;
    --hand-w: min(30vw, 15vh);
    --pile-w: min(12vw, 7.5vh);
    --far: 1.15;
    --spread: 1.4;
    --seat-w: min(11vw, 7vh);
    --pick-w: min(20vw, 12vh);
  }
  .scene { perspective: 900px; perspective-origin: 50% 8%; }
  .table { width: 150vw; height: 84vh; margin-left: -75vw; bottom: 8vh; border-radius: 48% / 40%; }
  .seat { --seat-scale: 1.6; }
  .plate { padding: 4px 10px 5px; gap: 6px; max-width: 34vw; }
  .plate__name { font-size: 18px; }
  .seat .plate__meta { display: none; }
  .count { transform: rotateX(calc(var(--tilt) * -1)) scale(1.15); }
  .title { font-size: 30px; }
  /* No room in the top bar: the pill sits just under it, above the seats. */
  .status { top: 54px; max-width: 86vw; padding: 4px 14px 6px; font-size: 19px; }
  /* Buttons above your hand, right of your pile (they're gone before a card
     flies there). */
  .dock {
    right: 10px;
    bottom: calc(var(--hand-w) * var(--ratio) + 4.5vh);
    flex-direction: row;
    gap: 8px;
  }
  .dock .btn { min-height: 40px; padding: 0 16px; font-size: 14px; }
  .btn--chip { padding: 0 12px; white-space: nowrap; }
  .hand { bottom: 3vh; }
  .me { left: 10px; bottom: 8px; }
  .me .plate { max-width: 60vw; }
  .ticker { top: 90px; left: 50%; translate: -50% 0; max-width: 92vw; font-size: 13px; }
  .air.is-many .card { --w: min(15vw, 9vh); }
  .brand__logo { height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
