:root {
  color-scheme: light;
  --teal: #204e47;
  --teal-2: #326a5e;
  --teal-glow: #a6ddc5;
  --cream: #f5eddd;
  --cream-2: #e8dcc5;
  --ivory: #fff8e9;
  --ink: #303d36;
  --muted: #687064;
  --wood: #50362b;
  --wood-2: #35251f;
  --gold: #b99a60;
  --felt: #21594d;
  --felt-2: #183f37;
  --red: #a0443c;
  --line: #d9cbb2;
  --shadow: 0 .45cqw 1.5cqw rgb(24 37 29 / 20%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #192722;
  color: var(--ink);
  font-family: Nunito, system-ui, sans-serif;
  font-weight: 500;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button,
input,
select,
a,
.tile[tabindex] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
.tile[tabindex]:focus-visible {
  outline: .18cqw solid var(--teal-2);
  outline-offset: .22cqw;
}

::selection {
  background: #c7e5d5;
  color: var(--ink);
}

.stage {
  position: relative;
  isolation: isolate;
  width: min(100vw, calc(100vh * 16 / 9));
  width: min(100vw, calc(100dvh * 16 / 9));
  aspect-ratio: 16 / 9;
  container-type: size;
  overflow: hidden;
  font-size: 1.08cqw;
  line-height: 1.4;
}

.room {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: #b7a58b;
  background-image:
    url('/img/room.webp'),
    radial-gradient(
      ellipse at 17% 15%,
      rgb(255 244 215 / 80%),
      transparent 55%
    ),
    linear-gradient(
      180deg,
      #e6d8bd 0%,
      #c8b294 37%,
      #527365 38%,
      #334f43 74%,
      #75604a 100%
    );
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

/* Room, furniture and table ornament belong to the render. */
.room::before,
.room::after {
  content: none;
}

#screen {
  position: absolute;
  inset: 0;
  z-index: 1;
}

#modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

#modal > * {
  pointer-events: auto;
}

/* Common controls */

.pill {
  position: absolute;
  z-index: 3;
  max-width: 46cqw;
  padding: .48em 1.15em;
  border: .07cqw solid rgb(185 154 96 / 65%);
  border-radius: 99em;
  background: var(--cream);
  color: var(--ink);
  font-weight: 800;
  text-align: center;
  box-shadow: 0 .2cqw .65cqw rgb(24 37 29 / 17%);
}

.pill.dark {
  background: var(--teal);
  color: var(--cream);
  border-color: var(--gold);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  min-height: 2.5em;
  padding: .5em 1.15em;
  border: .08cqw solid #b5aa92;
  border-radius: 99em;
  background: #fff8eb;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 .1cqw .25cqw rgb(34 43 33 / 7%);
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 120ms ease;
}

.btn.primary {
  background: var(--teal);
  color: var(--ivory);
  border-color: var(--gold);
  box-shadow: 0 .18cqw .45cqw rgb(24 55 44 / 18%);
}

.btn.gold {
  background: #dcc58f;
  color: #3e3524;
  border-color: #a98a51;
}

.btn.red {
  background: var(--red);
  color: #fff8ef;
  border-color: #863c35;
}

.btn:not(:disabled):active {
  transform: translateY(.08cqw);
  box-shadow: none;
}

.btn:disabled {
  opacity: .48;
  cursor: default;
  box-shadow: none;
}

.toast {
  position: absolute;
  z-index: 50;
  top: 11cqh;
  left: 50%;
  max-width: 68cqw;
  padding: .7em 1.4em;
  border: .07cqw solid var(--gold);
  border-radius: 99em;
  background: #204e47;
  color: var(--ivory);
  text-align: center;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -.5cqw);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Tile sprites: the upper image replaces the gradient when available. */

.tile {
  --w: 4.45cqw;
  position: relative;
  isolation: isolate;
  display: block;
  flex: 0 0 auto;
  width: var(--w);
  height: calc(var(--w) * 4 / 3);
  border-radius: calc(var(--w) * .105);
  background-color: var(--ivory);
  background-image:
    url('/img/tile-face.webp'),
    linear-gradient(160deg, #fffcef, #eadfc8);
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  box-shadow:
    0 calc(var(--w) * .035)
      calc(var(--w) * .055) rgb(16 35 26 / 23%);
  user-select: none;
  -webkit-user-select: none;
}

.tile svg {
  position: absolute;
  z-index: 1;
  inset: 6% 8%;
  display: block;
  width: 84%;
  height: 88%;
  overflow: hidden;
  pointer-events: none;
}

.tile.back {
  background-color: #347b63;
  background-image:
    url('/img/tile-back.webp'),
    linear-gradient(150deg, #438b71, #28634f);
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

.t-xs { --w: 1.22cqw; }
.t-sm { --w: 1.65cqw; }
.t-md { --w: 2.8cqw; }
.t-lg { --w: 4.45cqw; }

.tile.sel {
  outline: .12cqw solid var(--teal-glow);
  outline-offset: .07cqw;
  box-shadow:
    0 0 .75cqw rgb(166 221 197 / 58%),
    0 .18cqw .35cqw rgb(16 35 26 / 20%);
}

.tile.drawn {
  margin-left: .75cqw;
}

.tile.last {
  outline: .13cqw solid #d6b777;
  outline-offset: .07cqw;
}

/* Transparent registration plane over the rendered tabletop. */

.table {
  position: absolute;
  z-index: 1;
  left: 7cqw;
  right: 7cqw;
  top: 15cqh;
  bottom: 19cqh;
  transform: perspective(90cqw) rotateX(26deg);
  transform-origin: 50% 100%;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  pointer-events: none;
}

.felt {
  position: absolute;
  inset: 2.2cqw;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.table::before,
.table::after,
.felt::before,
.felt::after {
  content: none;
}

.board {
  position: absolute;
  top: 6%;
  left: 50%;
  height: 88%;
  aspect-ratio: 1;
  transform: translateX(-50%);
}

.zone {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.zone.r0 { transform: rotate(0deg); }
.zone.r1 { transform: rotate(-90deg); }
.zone.r2 { transform: rotate(180deg); }
.zone.r3 { transform: rotate(90deg); }

.discards {
  position: absolute;
  top: 62%;
  left: 50%;
  display: grid;
  grid-template-columns: repeat(6, 1.3cqw);
  grid-auto-rows: calc(1.3cqw * 4 / 3);
  gap: .17cqw .13cqw;
  width: max-content;
  transform: translateX(-50%);
}

.discards .tile {
  --w: 1.3cqw;
}

.discards .tile.last {
  z-index: 1;
  animation: tile-arrive 200ms ease-out;
}

.side-row {
  position: absolute;
  bottom: -6%;
  left: 50%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: .45cqw;
  width: max-content;
  transform: translateX(-50%);
  white-space: nowrap;
}

.side-row .tile {
  --w: 1.12cqw;
}

.group {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  gap: .07cqw;
}

.compass {
  position: absolute;
  top: 36%;
  left: 36%;
  display: grid;
  place-items: center;
  width: 28%;
  height: 28%;
  border: .08cqw solid rgb(185 154 96 / 65%);
  border-radius: .8cqw;
  background: rgb(25 66 55 / 92%);
  color: var(--cream);
  text-align: center;
  box-shadow: 0 .18cqw .5cqw rgb(11 31 22 / 15%);
}

.compass .wind {
  color: #dfcc9d;
  font: 700 2.5cqw / 1 'Noto Serif SC', serif;
}

.compass .small {
  margin-top: .25em;
  color: #dfE6d8;
  font-size: .73cqw;
}

.compass .seat {
  position: absolute;
  color: #a7b9ab;
  font: 700 1.05cqw / 1 'Noto Serif SC', serif;
}

.compass .seat.on {
  color: var(--teal-glow);
  text-shadow: 0 0 .35cqw rgb(166 221 197 / 30%);
}

.compass .s0 {
  bottom: 5%;
  left: 50%;
  transform: translateX(-50%);
}

.compass .s1 {
  top: 50%;
  right: 5%;
  transform: translateY(-50%) rotate(-90deg);
}

.compass .s2 {
  top: 5%;
  left: 50%;
  transform: translateX(-50%) rotate(180deg);
}

.compass .s3 {
  top: 50%;
  left: 5%;
  transform: translateY(-50%) rotate(90deg);
}

/* Player names */

.plate {
  position: absolute;
  z-index: 3;
  min-width: 10cqw;
  max-width: 20cqw;
  padding: .42em 1.05em;
  border: .08cqw solid var(--gold);
  border-radius: 1.5em;
  background: var(--teal);
  color: var(--cream);
  text-align: center;
  box-shadow: 0 .2cqw .6cqw rgb(17 37 27 / 24%);
  transition: box-shadow 180ms ease, border-color 180ms ease;
}

.plate .nm {
  overflow-wrap: anywhere;
  font-size: .98em;
  font-weight: 800;
}

.plate .sc {
  margin-top: .1em;
  color: #d6e2d6;
  font-size: .82em;
  font-variant-numeric: tabular-nums;
}

.plate .w {
  margin-right: .4em;
  color: #dfcc9d;
  font-family: 'Noto Serif SC', serif;
}

.plate .dealer {
  margin-left: .4em;
  color: #e3cc95;
  font-size: .76em;
  white-space: nowrap;
}

.plate.turn {
  border-color: var(--teal-glow);
  box-shadow:
    0 0 0 .12cqw rgb(166 221 197 / 40%),
    0 0 .8cqw rgb(166 221 197 / 25%),
    0 .2cqw .6cqw rgb(17 37 27 / 24%);
}

.plate.p0 {
  left: 3cqw;
  bottom: 26cqh;
}

.plate.p1 {
  right: 2cqw;
  top: 39cqh;
  max-width: 17cqw;
}

.plate.p2 {
  top: 10cqh;
  left: 50%;
  transform: translateX(-50%);
}

.plate.p3 {
  left: 2cqw;
  top: 39cqh;
  max-width: 17cqw;
}

.plate .bubble {
  position: absolute;
  bottom: calc(100% + .55cqw);
  left: 50%;
  width: max-content;
  max-width: 20cqw;
  padding: .35em .8em;
  border: .07cqw solid var(--line);
  border-radius: .8em;
  background: var(--cream);
  color: var(--teal);
  font-weight: 800;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

/* Foreground hand: no second painted wooden table or rack. */

.rack {
  position: absolute;
  z-index: 4;
  left: 3cqw;
  right: 3cqw;
  bottom: 11cqh;
  height: 14cqh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: .7cqw;
  padding: 0 .6cqw .65cqw;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.hand {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  gap: .2cqw;
}

.hand .tile {
  cursor: default;
  transition: transform 130ms ease, box-shadow 160ms ease;
}

.hand.active .tile {
  cursor: pointer;
  touch-action: manipulation;
}

.hand .tile.sel {
  z-index: 2;
  transform: translateY(-.65cqw);
}

.hand .tile.drawn {
  margin-left: .75cqw;
}

.melds {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  gap: .38cqw;
  padding-bottom: .08cqw;
}

/* Local overrides keep full hands, flowers and exposed sets together. */
.rack .melds .tile {
  --w: 2cqw;
}

.rack > .group .tile {
  --w: 1.15cqw;
}

/* Bottom controls */

.bar {
  position: absolute;
  z-index: 5;
  left: 1.5cqw;
  right: 1.5cqw;
  bottom: 1.5cqh;
  display: flex;
  align-items: center;
  gap: .6cqw;
  min-height: 8.5cqh;
  padding: .65cqh 1cqw;
  border: .07cqw solid rgb(185 154 96 / 65%);
  border-radius: 1.1cqw;
  background: var(--cream);
  box-shadow: 0 .3cqw 1cqw rgb(24 37 29 / 20%);
}

.bar > .btn {
  flex: 0 0 auto;
  padding-inline: .85em;
}

.bar .msg {
  flex: 1 1 20cqw;
  min-width: 10cqw;
  color: var(--muted);
  font-size: .94em;
  text-align: center;
  text-wrap: pretty;
}

.bar .msg b {
  color: var(--teal);
  font-weight: 800;
}

.timer {
  display: inline-block;
  min-width: 2.7em;
  color: var(--red);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timer:empty {
  display: none;
}

.acts {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .4cqw;
  max-width: 43cqw;
}

.acts:empty {
  display: none;
}

.acts .btn {
  padding-inline: .9em;
}

/* Claim choices */

.prompt {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 27cqh;
  display: flex;
  align-items: center;
  gap: .9cqw;
  width: max-content;
  max-width: 78cqw;
  max-height: 30cqh;
  overflow: auto;
  padding: .85cqw 1.1cqw;
  border: .09cqw solid var(--gold);
  border-radius: 1cqw;
  background: var(--cream);
  box-shadow: 0 .5cqw 1.8cqw rgb(17 37 27 / 24%);
  transform: translateX(-50%);
}

.prompt > .tile {
  flex-shrink: 0;
}

.prompt .row {
  align-items: center;
  gap: .45cqw;
}

.prompt .btn {
  gap: .25em;
  padding: .45em .85em;
}

.prompt .btn .tile {
  --w: 1.35cqw;
}

/* Panels */

.panel {
  position: absolute;
  padding: 1.8cqw 2cqw;
  border: .08cqw solid rgb(185 154 96 / 70%);
  border-radius: 1.3cqw;
  background: rgb(245 237 221 / 98%);
  color: var(--ink);
  box-shadow: 0 .7cqw 2.6cqw rgb(24 37 29 / 26%);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #b6aa90 transparent;
  overflow-wrap: anywhere;
}

.panel h1,
.panel h2,
.panel h3 {
  color: var(--teal);
  font-weight: 800;
  line-height: 1.2;
  text-wrap: balance;
}

.panel h1 {
  margin: 0 0 .3em;
  font-size: 2.1em;
  letter-spacing: -.025em;
}

.panel h2 {
  margin: 0 0 .65em;
  font-size: 1.45em;
}

.panel h3 {
  margin: 1.1em 0 .5em;
  font-size: 1.15em;
}

.panel p {
  margin: .65em 0 1em;
}

.panel p:last-child {
  margin-bottom: 0;
}

.panel a {
  color: var(--teal);
  text-underline-offset: .18em;
}

/* Authentication */

.auth {
  top: 50%;
  left: 50%;
  width: 35cqw;
  max-height: 91cqh;
  transform: translate(-50%, -50%);
}

.auth > .muted {
  margin-top: 1em;
  margin-bottom: 1.2em;
}

.auth form {
  display: grid;
  gap: .8cqw;
}

.auth form > .btn {
  width: 100%;
}

.field {
  display: grid;
  gap: .35em;
  min-width: 0;
  color: var(--muted);
  font-size: .94em;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  min-height: 2.8em;
  padding: .6em .85em;
  border: .08cqw solid #bdB29b;
  border-radius: .55em;
  background: #fffbf2;
  color: var(--ink);
  font-weight: 500;
  box-shadow: inset 0 .08cqw .16cqw rgb(48 61 54 / 3%);
}

.field input::placeholder {
  color: #7a7c6e;
}

.field input:focus,
.field select:focus {
  border-color: var(--teal-2);
}

.tabs {
  display: flex;
  gap: .3cqw;
  margin-bottom: 1.1cqw;
  padding: .25cqw;
  border: .07cqw solid var(--line);
  border-radius: 99em;
  background: #e9dfcb;
}

.tabs .btn {
  flex: 1;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.tabs .btn.on {
  border-color: var(--gold);
  background: var(--teal);
  color: var(--ivory);
  box-shadow: 0 .1cqw .3cqw rgb(24 55 44 / 12%);
}

.err {
  min-height: 1.4em;
  color: var(--red);
  font-size: .94em;
  font-weight: 700;
}

.logo {
  display: flex;
  align-items: center;
  gap: .4cqw;
  min-width: 0;
}

.logo .tile {
  --w: 2.15cqw;
}

.logo h1 {
  margin: 0 0 0 .35em;
}

/* Lobby */

.lobby {
  top: 4cqh;
  right: 3cqw;
  bottom: 4cqh;
  left: 3cqw;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1.4cqw;
}

.lobby header {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1cqw;
  padding-bottom: 1cqw;
  border-bottom: .07cqw solid var(--line);
}

.lobby header > .row {
  justify-content: flex-end;
  gap: .65cqw;
}

.lobby > div {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.card {
  min-width: 0;
  padding: 1.15cqw 1.25cqw;
  border: .07cqw solid #ded2ba;
  border-radius: .85cqw;
  background: #fff8ec;
}

.card h2 {
  font-size: 1.3em;
}

.card > .row .field {
  flex: 1 1 12cqw;
}

.card > .row > .btn {
  flex: 0 0 auto;
}

.room-row {
  display: grid;
  grid-template-columns: minmax(5cqw, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: .75cqw;
  padding: .9cqw 0;
  border-bottom: .07cqw solid #e4dac5;
}

.room-row:last-child {
  border-bottom: 0;
}

.room-row > b {
  color: var(--teal);
  overflow-wrap: anywhere;
}

.seats {
  min-width: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.room-row .seats small {
  display: inline-block;
  margin-top: .22em;
  color: var(--muted);
  line-height: 1.4;
}

.room-row .btn {
  min-width: 6.7cqw;
  max-width: 10cqw;
  padding-inline: .8em;
}

.lb {
  width: 100%;
  border-collapse: collapse;
  font-size: .94em;
  font-variant-numeric: tabular-nums;
}

.lb td,
.lb th {
  padding: .6em .35em;
  border-bottom: .07cqw solid #e4dac5;
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.lb th {
  color: var(--muted);
  font-size: .86em;
  font-weight: 800;
}

.lb td:first-child {
  width: 2em;
  color: var(--muted);
}

.lb td:nth-child(n + 3),
.lb th:nth-child(n + 3) {
  text-align: right;
}

.lb tr:last-child td {
  border-bottom: 0;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .8cqw;
  min-width: 0;
}

.row > * {
  min-width: 0;
}

.muted {
  color: var(--muted);
}

/* Waiting room */

.waitroom {
  top: 50%;
  left: 50%;
  width: 53cqw;
  max-height: 91cqh;
  transform: translate(-50%, -50%);
}

.seat-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8cqw;
  margin: 1.2cqw 0;
}

.seat-list .card {
  display: flex;
  align-items: center;
  gap: .8cqw;
  min-height: 6.8cqw;
}

.seat-list .card > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.seat-list .card b {
  color: var(--teal);
}

.link {
  display: block;
  flex: 1 1 22cqw;
  min-width: 0;
  padding: .65em .8em;
  border: .08cqw dashed #b7aa8a;
  border-radius: .6em;
  background: #fffbf2;
  color: var(--teal);
  font-family: ui-monospace, Consolas, monospace;
  font-size: .9em;
  overflow-wrap: anywhere;
  user-select: all;
}

/* Rules and result dialogs */

#modal .backdrop {
  position: absolute;
  z-index: 20;
  inset: 0;
  background: rgb(17 34 27 / 57%);
}

#modal .panel {
  z-index: 21;
  top: 50%;
  left: 50%;
  width: 68cqw;
  max-height: 90cqh;
  padding: 1.7cqw 2cqw;
  transform: translate(-50%, -50%);
}

#modal .panel > h2 {
  padding-right: 2cqw;
}

#modal .panel > .row:last-child {
  padding-top: .8cqw;
  border-top: .07cqw solid var(--line);
}

.fan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .98em;
  font-variant-numeric: tabular-nums;
}

.fan-table td {
  padding: .48em .55em;
  border-bottom: .07cqw solid #e0d5bf;
  vertical-align: top;
}

.fan-table td:last-child {
  width: 30%;
  color: var(--teal);
  font-weight: 800;
  text-align: right;
}

.fan-table tr:last-child td {
  border-bottom: 0;
  background: #e7e4d2;
  font-weight: 800;
}

.fan-table tr:last-child td:first-child {
  border-radius: .45em 0 0 .45em;
}

.fan-table tr:last-child td:last-child {
  border-radius: 0 .45em .45em 0;
}

.result-hand {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .7cqw;
  margin: 1.1cqw 0;
  padding: .7cqw .5cqw;
  border-radius: .6cqw;
  background: #e6e2d0;
}

.result-hand .group {
  max-width: 100%;
  flex-wrap: wrap;
  row-gap: .5cqw;
}

.result-hand .tile.sel {
  margin-inline: .15cqw;
}

.pay {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65cqw;
  margin-top: 1.1cqw;
}

.pay .card {
  padding: .8cqw .55cqw;
  text-align: center;
}

.pay .card > b {
  display: block;
  overflow-wrap: anywhere;
}

.pay .card > div {
  margin: .15em 0;
  font-size: 1.7em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.pay .card small {
  display: block;
  font-size: .8em;
}

.plus {
  color: #28654d;
  font-weight: 800;
}

.minus {
  color: var(--red);
  font-weight: 800;
}

.close-x {
  position: absolute;
  top: .7cqw;
  right: .8cqw;
  display: grid;
  place-items: center;
  width: 2.1cqw;
  height: 2.1cqw;
  padding: 0;
  border: .07cqw solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.7em;
  line-height: 1;
}

/* Hover never competes with persistent selection. */

@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):hover {
    border-color: var(--gold);
    background-color: #eee3ce;
  }

  .btn.primary:not(:disabled):hover {
    background-color: var(--teal-2);
  }

  .btn.gold:not(:disabled):hover {
    background-color: #e5d1a5;
  }

  .btn.red:not(:disabled):hover {
    background-color: #8e3b35;
  }

  .tabs .btn.on:not(:disabled):hover {
    background-color: var(--teal-2);
  }

  .hand.active .tile:not(.sel):hover {
    z-index: 1;
    transform: translateY(-.3cqw);
  }

  .hand.active .tile.sel:hover {
    transform: translateY(-.65cqw);
  }

  .room-row:hover {
    background-color: rgb(232 220 197 / 22%);
  }

  .close-x:hover {
    border-color: var(--line);
    background-color: var(--cream-2);
    color: var(--teal);
  }
}

@keyframes tile-arrive {
  from {
    opacity: .35;
    transform: translateY(-.35cqw);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Panels adapt inside the fixed 16:9 canvas. */

@container (max-width: 900px) {
  .panel {
    font-size: 1.35cqw;
  }

  .lobby {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  }

  .lobby header .logo h1 {
    font-size: 1.65em;
  }

  .lobby header > .row {
    gap: .45cqw;
  }

  .lobby header > .row > span {
    flex-basis: 100%;
    text-align: right;
  }

  .room-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .room-row > b {
    grid-column: 1;
  }

  .room-row > .seats {
    grid-column: 1;
  }

  .room-row > .btn {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .auth {
    width: 42cqw;
  }

  .waitroom {
    width: 63cqw;
  }

  #modal .panel {
    width: 76cqw;
  }

  .bar {
    font-size: 1.15cqw;
  }
}

@container (max-width: 600px) {
  .panel {
    font-size: 1.7cqw;
  }

  .lobby {
    display: block;
  }

  .lobby header {
    margin-bottom: 1.4cqw;
  }

  .lobby > div {
    overflow: visible;
  }

  .lobby > .card {
    margin-top: 1.4cqw;
  }

  .auth {
    width: 58cqw;
  }

  .waitroom {
    width: 78cqw;
  }

  #modal .panel {
    width: 88cqw;
  }

  .room-row .btn {
    max-width: 17cqw;
  }

  .pay {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bar {
    flex-wrap: wrap;
    gap: .35cqw .6cqw;
    font-size: 1.35cqw;
  }

  .bar .msg {
    flex-basis: 40cqw;
  }

  .bar .acts {
    flex: 1 1 100%;
    max-width: none;
  }

  .bar:has(.acts:not(:empty)) .msg {
    text-align: right;
  }

  .rack {
    bottom: 13cqh;
  }

  .prompt {
    max-width: 88cqw;
    font-size: 1.4cqw;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Board pinned onto the felt of room.webp: app.js fitBoard() sets size + matrix3d from /img/scene.json. */
.table.fitted { left: 0; top: 0; right: auto; bottom: auto; transform-origin: 0 0; }
.table.fitted .felt { inset: 0; }
.table.fitted .board { inset: 0; width: 100%; height: 100%; transform: none; }
/* Inside the fitted board, cqw = 1% of the felt, so table objects scale with the picture. */
.table.fitted .board { container-type: size; }
.table.fitted .compass { top: 40%; left: 40%; width: 20%; height: 20%; border-radius: 2cqw; border-width: .25cqw; }
.table.fitted .compass .wind { font-size: 6.5cqw; }
.table.fitted .compass .small { font-size: 2.2cqw; }
.table.fitted .compass .seat { font-size: 3.2cqw; }
.table.fitted .discards { top: 67%; grid-template-columns: repeat(6, 5.2cqw); grid-auto-rows: calc(5.2cqw * 4 / 3); gap: .5cqw .4cqw; }
.table.fitted .discards .tile { --w: 5.2cqw; }
.table.fitted .side-row { bottom: -1%; gap: 1cqw; }
.table.fitted .side-row .tile { --w: 3.1cqw; }
.table.fitted .group { gap: .15cqw; }
/* My hand standing in the painted near rack (fitScene sets box and --hw). */
.rack.fitted { right: auto; bottom: auto; padding: 0; gap: calc(var(--hw) * .25); align-items: center; }
.rack.fitted .hand .tile { --w: var(--hw); }
.rack.fitted .melds .tile, .rack.fitted > .group .tile { --w: calc(var(--hw) * .62); }
/* Opponents' tiles mapped onto their painted racks (fitScene sets size, --tw and matrix3d). */
.opp { position: absolute; left: 0; top: 0; z-index: 2; transform-origin: 0 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.opp .side-row { position: static; transform: none; gap: calc(var(--tw) * .5); }
.opp .tile { --w: var(--tw); }
