/* French Tarot — card-room on paper. */

:root {
  --paper: #f4efe4;
  --paper-hi: #fbf8f1;
  --paper-lo: #ebe4d5;
  --ink: #1f1c17;
  --ink-2: #5f584c;
  --ink-3: #91887a;
  --rule: #dcd3c1;
  --rule-strong: #c6bba5;
  --red: #b4352a;
  --red-ink: #8a261d;
  --red-bright: #e0614f;
  --felt: #1f4d39;
  --felt-hi: #2b634a;
  --felt-lo: #163a2b;
  --rail: #5a3a24;
  --rail-dark: #38231a;
  --cream: #f6f1e6;
  --brass: #c9a052;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --page-w: 560px;
  --gutter: 16px;
  --ease-out: cubic-bezier(0.2, 0.75, 0.25, 1);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100dvh;
  font: 15px/1.45 var(--sans);
  color: var(--ink);
  background: var(--paper) var(--grain);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

.num {
  font-variant-numeric: tabular-nums;
}

.faint {
  color: var(--ink-3);
}

.hint {
  color: var(--ink-2);
  font-size: 14px;
  margin: 8px 0 0;
}

.error {
  color: var(--red);
  font-weight: 600;
}

/* ---------------------------------------------------------------- page */

.masthead {
  max-width: var(--page-w);
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 10px) var(--gutter) 8px;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  font-family: var(--serif);
  font-size: 17px;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  color: var(--ink);
  text-decoration: none;
}

.page {
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 10px var(--gutter) calc(env(safe-area-inset-bottom) + 40px);
}

.page--table {
  padding-top: calc(env(safe-area-inset-top) + 10px);
}

.section-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 19px;
  margin: 0 0 8px;
}

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

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--paper-hi);
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
  box-shadow: 0 2px 0 var(--ink);
  cursor: pointer;
  transition:
    transform 0.08s ease,
    box-shadow 0.08s ease,
    background-color 0.15s ease;
}

.btn:hover {
  background: #fff;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 var(--ink);
}

.btn--primary {
  background: var(--red);
  border-color: var(--red-ink);
  color: #fff9f0;
  box-shadow: 0 2px 0 var(--red-ink);
}

.btn--primary:hover {
  background: #c03b2f;
}

.btn--quiet {
  border-color: var(--rule-strong);
  color: var(--ink-2);
  box-shadow: 0 2px 0 var(--rule-strong);
}

.btn--small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 14px;
}

.btn:disabled {
  opacity: 0.32;
  box-shadow: none;
  transform: none;
  cursor: default;
}

.htmx-request .btn,
.btn.htmx-request {
  opacity: 0.6;
}

/* ---------------------------------------------------------------- forms */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.field__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 0;
}

.field input:not([type="radio"]) {
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: var(--paper-hi);
  font-size: 17px;
}

.field input:focus {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--ink);
  border-radius: 6px;
  overflow: hidden;
  width: max-content;
}

.segmented label {
  position: relative;
}

.segmented input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.segmented span {
  display: block;
  padding: 10px 22px;
  font-weight: 600;
  cursor: pointer;
}

.segmented label + label span {
  border-left: 1px solid var(--ink);
}

.segmented input:checked + span {
  background: var(--ink);
  color: var(--paper-hi);
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--red);
  outline-offset: -4px;
}

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

.card {
  --w: 60px;
  display: block;
  width: var(--w);
  aspect-ratio: var(--card-aspect);
  border-radius: calc(var(--w) * 0.075);
  background-image: var(--sprite-url);
  background-repeat: no-repeat;
  background-size: var(--sprite-bw) var(--sprite-bh);
  background-position: var(--sprite-x) var(--sprite-y);
  box-shadow:
    0 0 0 0.5px rgba(31, 28, 23, 0.25),
    0 1px 2px rgba(31, 28, 23, 0.2),
    0 3px 8px rgba(31, 28, 23, 0.14);
}

/* Card index labels used in logs and notes: R♥, 21, Exc */
.cl {
  display: inline-block;
  min-width: 1.6em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.cl--red {
  color: var(--red);
}

.cl--trump {
  padding: 0 3px;
  border-radius: 3px;
  background: var(--paper-lo);
  box-shadow: inset 0 0 0 1px var(--rule);
}

/* ---------------------------------------------------------------- home */

.home__fan {
  position: relative;
  height: 128px;
  margin: 18px auto 6px;
  width: 160px;
}

.home__card {
  --w: 58px;
  position: absolute;
  left: 50%;
  top: 6px;
  margin-left: -29px;
  transform-origin: 50% 120%;
}

.home__card--1 {
  rotate: -14deg;
}

.home__card--2 {
  rotate: 0deg;
  top: 0;
}

.home__card--3 {
  rotate: 14deg;
}

.home__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.1;
  text-align: center;
  margin: 8px 0 6px;
}

.home__lede {
  text-align: center;
  color: var(--ink-2);
  max-width: 30em;
  margin: 0 auto 26px;
}

.newgame {
  padding: 18px 16px 16px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper-hi);
}

.newgame__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}

.tables {
  margin-top: 30px;
}

.tables__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}

.tables__row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 12px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--rule);
  color: inherit;
  text-decoration: none;
}

.tables__row:hover {
  background: var(--paper-hi);
}

.tables__what {
  display: flex;
  flex-direction: column;
}

.tables__kind {
  font-family: var(--serif);
  font-size: 17px;
}

.tables__status {
  font-size: 13px;
  color: var(--ink-2);
}

.tables__score {
  font-weight: 600;
}

.tables__turn {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red);
}

/* ---------------------------------------------------------------- lobby */

.lobby__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 28px;
  margin: 14px 0 2px;
}

.lobby__code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.8em;
  letter-spacing: 0.08em;
}

.lobby__sub {
  color: var(--ink-2);
  margin: 0 0 18px;
}

.invite {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.invite__url {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: var(--paper-hi);
  font-size: 13px;
  color: var(--ink-2);
}

.lobby__seats {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  counter-reset: seat;
  border-top: 1px solid var(--rule);
}

.lobby__seat {
  display: flex;
  justify-content: space-between;
  padding: 11px 2px;
  border-bottom: 1px solid var(--rule);
  font-family: var(--serif);
  font-size: 17px;
}

.lobby__seat .faint {
  font-family: var(--sans);
  font-size: 13px;
}

/* ---------------------------------------------------------------- table panel */

.context {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  font-size: 12.5px;
  color: var(--ink-2);
}

.context .wordmark {
  font-size: 16px;
  margin-right: 2px;
}

.context__hand {
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
}

.context__contract strong {
  color: var(--red);
}

.context__mode {
  margin-left: auto;
  color: var(--ink-3);
}

/* ---------------------------------------------------------------- felt */

.felt {
  --tw: 56px;
  --th: calc(var(--tw) * var(--card-tall));
  --felt-h: 292px;
  position: relative;
  height: var(--felt-h);
  margin: 8px 7px 22px;
  border-radius: 28px;
  background:
    var(--grain),
    radial-gradient(120% 95% at 50% 42%, var(--felt-hi) 0%, var(--felt) 55%, var(--felt-lo) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 3px 22px rgba(0, 0, 0, 0.38),
    0 0 0 7px var(--rail),
    0 0 0 8px var(--rail-dark),
    0 12px 26px rgba(56, 35, 26, 0.28);
  color: var(--cream);
  isolation: isolate;
}

.felt--5p {
  --felt-h: 312px;
}

/* Seats: a name card that "lights up" when it's that player's turn. */

.seat {
  position: absolute;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-width: 31%;
  padding: 4px 8px 5px;
  border-radius: 5px;
  transition:
    background-color 0.25s ease,
    color 0.25s ease;
}

.seat__name {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 16px;
  font-size: 11.5px;
  color: rgba(246, 241, 230, 0.72);
  white-space: nowrap;
}

.seat__score {
  font-weight: 600;
}

.seat__dealer {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--brass);
  color: #2a1d0c;
  font: 700 9px/1 var(--sans);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}

.seat__note {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.seat__note--bid {
  color: var(--cream);
}

.seat__note--pass {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-style: italic;
  color: rgba(246, 241, 230, 0.55);
}

.seat__note--taker {
  padding: 1px 5px 0;
  border-radius: 3px;
  background: var(--red);
  color: #fff6ec;
}

.seat__note--partner,
.seat__note--mark {
  padding: 0 4px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px currentColor;
}

.seat__note--mark {
  color: var(--brass);
}

.seat.is-active {
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.seat.is-active .seat__meta,
.seat.is-active .seat__note--bid {
  color: var(--ink-2);
}

.seat.is-active .seat__note--pass {
  color: var(--ink-3);
}

.seat__thinking {
  display: inline-flex;
  gap: 2px;
}

.seat__thinking i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  animation: think 1.1s ease-in-out infinite;
}

.seat__thinking i:nth-child(2) {
  animation-delay: 0.15s;
}

.seat__thinking i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes think {
  0%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 1;
  }
}

.seat--s {
  bottom: 10px;
  left: 50%;
  translate: -50% 0;
  align-items: center;
  text-align: center;
}

.seat--n {
  top: 10px;
  left: 50%;
  translate: -50% 0;
  align-items: center;
  text-align: center;
}

.seat--w {
  left: 8px;
  top: 50%;
  translate: 0 -50%;
}

.seat--e {
  right: 8px;
  top: 50%;
  translate: 0 -50%;
  align-items: flex-end;
  text-align: right;
}

.felt--5p .seat--w,
.felt--5p .seat--e {
  top: 76%;
}

.seat--nw,
.seat--ne {
  top: 10px;
  translate: -50% 0;
  align-items: center;
  text-align: center;
}

.seat--nw {
  left: 22%;
}

.seat--ne {
  left: 78%;
}

.seat--e .seat__name,
.seat--e .seat__meta {
  justify-content: flex-end;
}

.seat--s .seat__name,
.seat--s .seat__meta,
.seat--n .seat__name,
.seat--n .seat__meta,
.seat--nw .seat__name,
.seat--nw .seat__meta,
.seat--ne .seat__name,
.seat--ne .seat__meta {
  justify-content: center;
}

/* Centre of the table: chien, verdict. */

.felt__center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.chien {
  display: flex;
  padding-left: 22px;
}

.chien--closed .chien__card {
  --w: 34px;
  margin-left: -22px;
  rotate: calc((var(--i) - 2.5) * 3deg);
  transform-origin: 50% 110%;
}

.chien--open .chien__card {
  --w: 42px;
  margin-left: -15px;
}

.chien--open {
  padding-left: 15px;
  translate: 0 -14px;
}

.felt--5p .chien--open .chien__card {
  --w: 48px;
}

.verdict {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  animation: rise 0.45s var(--ease-out) both;
}

.verdict__word {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.8;
}

.verdict__num {
  font-family: var(--serif);
  font-size: 54px;
  line-height: 1;
}

.verdict.is-down .verdict__num {
  color: #ffb8a8;
}

.verdict__sub {
  font-size: 13px;
  opacity: 0.75;
}

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 8px;
  }
}

/* The trick: each card sits slightly toward the player who played it. */

.trick {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.trick__slot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  margin: calc(var(--th) / -2) 0 0 calc(var(--tw) / -2);
  rotate: var(--r, 0deg);
}

.trick__slot .card {
  --w: var(--tw);
  box-shadow:
    0 0 0 0.5px rgba(0, 0, 0, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.3),
    0 6px 14px rgba(0, 0, 0, 0.22);
}

.trick__slot--s { --x: 50%; --y: 64.5%; --r: 2deg; --fx: 0px; --fy: 110px; }
.trick__slot--n { --x: 50%; --y: 35.5%; --r: -3deg; --fx: 0px; --fy: -110px; }
.trick__slot--w { --x: 36.5%; --y: 50%; --r: 5deg; --fx: -120px; --fy: 0px; }
.trick__slot--e { --x: 63.5%; --y: 50%; --r: -4deg; --fx: 120px; --fy: 0px; }
.felt--5p {
  --tw: 52px;
}
.felt--5p .trick__slot--s { --y: 65%; }
.felt--5p .trick__slot--w { --x: 31%; --y: 47%; --fx: -110px; --fy: 70px; }
.felt--5p .trick__slot--e { --x: 69%; --y: 47%; --fx: 110px; --fy: 70px; }
.trick__slot--nw { --x: 39%; --y: 31%; --r: 4deg; --fx: -70px; --fy: -100px; }
.trick__slot--ne { --x: 61%; --y: 31%; --r: -3deg; --fx: 70px; --fy: -100px; }

.trick__slot.is-arriving {
  animation: arrive 0.3s var(--ease-out) both;
}

@keyframes arrive {
  from {
    translate: var(--fx) var(--fy);
    opacity: 0;
    scale: 0.94;
  }
}

.trick__slot.is-winner .card {
  box-shadow:
    0 0 0 2px var(--brass),
    0 4px 10px rgba(0, 0, 0, 0.35),
    0 10px 22px rgba(0, 0, 0, 0.25);
}

.trick__slot.is-winner {
  z-index: 10 !important;
}

/* Trick taken: the pile slides off toward the winner. */
.trick.sweep-s { --sx: 0px; --sy: 150px; }
.trick.sweep-n { --sx: 0px; --sy: -150px; }
.trick.sweep-w { --sx: -170px; --sy: 0px; }
.trick.sweep-e { --sx: 170px; --sy: 0px; }
.trick.sweep-nw { --sx: -90px; --sy: -150px; }
.trick.sweep-ne { --sx: 90px; --sy: -150px; }
.felt--5p .trick.sweep-w { --sx: -150px; --sy: 90px; }
.felt--5p .trick.sweep-e { --sx: 150px; --sy: 90px; }

/* --gx/--gy: offset to the winning card; --wr: its rotation (set by app.js). */
.trick__slot {
  --gx: 0px;
  --gy: 0px;
  --wr: var(--r, 0deg);
}

.trick.is-sweeping .trick__slot {
  animation: collect 0.9s linear 0.75s forwards;
}

.trick.is-sweeping .trick__slot.is-arriving {
  animation:
    arrive 0.3s var(--ease-out) both,
    collect 0.9s linear 0.75s forwards;
}

@keyframes collect {
  0% {
    translate: 0 0;
    rotate: var(--r, 0deg);
    animation-timing-function: cubic-bezier(0.45, 0, 0.2, 1);
  }
  36% {
    translate: var(--gx) var(--gy);
    rotate: var(--wr);
    scale: 1;
    opacity: 1;
  }
  46% {
    translate: var(--gx) var(--gy);
    rotate: var(--wr);
    scale: 1;
    opacity: 1;
    animation-timing-function: cubic-bezier(0.4, 0, 0.75, 0.55);
  }
  100% {
    translate: calc(var(--gx) + var(--sx)) calc(var(--gy) + var(--sy));
    rotate: var(--wr);
    scale: 0.5;
    opacity: 0;
  }
}

/* ---------------------------------------------------------------- dock */

.dock {
  min-height: 60px;
  margin: 0 0 6px;
}

.dock__headline {
  margin: 0;
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.22;
}

.is-my-turn .dock__headline {
  color: var(--red-ink);
}

.dock__detail,
.dock__error {
  margin: 3px 0 0;
  font-size: 14px;
  color: var(--ink-2);
  min-height: 1.4em;
}

.dock__error {
  color: var(--red);
  font-weight: 600;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0 4px;
}

.actions--bids {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
}

.actions--bids .btn {
  grid-column: span 2;
  padding: 0 8px;
}

.actions--bids .btn:nth-child(n + 4) {
  grid-column: span 3;
}

.actions--calls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.btn--suit {
  flex-direction: column;
  gap: 2px;
  min-height: 54px;
}

.btn--suit .btn__glyph {
  font-size: 26px;
  line-height: 1;
}

.btn--suit.is-red .btn__glyph {
  color: var(--red);
}

.btn__hint {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
}

.actions--ecart {
  justify-content: space-between;
}

.ecart-count {
  font-size: 15px;
  color: var(--ink-2);
}

.ecart-count b {
  font-size: 20px;
  color: var(--ink);
}

.actions__aside {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  font-size: 13px;
}

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

.hand {
  --cw: min(84px, calc((min(100vw, var(--page-w)) - 2 * var(--gutter)) / 5.5));
  --ch: calc(var(--cw) * var(--card-tall));
  --overlap-x: 0.45;
  --overlap-y: 0.42;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  padding: 18px 0 calc(var(--ch) * var(--overlap-y) + 6px) calc(var(--cw) * var(--overlap-x));
  margin: 4px 0 6px;
}

.hand__card {
  appearance: none;
  position: relative;
  display: block;
  margin: 0 0 calc(var(--ch) * -1 * var(--overlap-y)) calc(var(--cw) * -1 * var(--overlap-x));
  padding: 0;
  border: 0;
  background: none;
  transition:
    translate 0.16s var(--ease-out),
    filter 0.2s ease,
    opacity 0.18s ease;
}

.hand__card .card {
  --w: var(--cw);
}

button.hand__card {
  cursor: pointer;
}

.hand__card.is-locked {
  translate: 0 6px;
  filter: brightness(0.62) saturate(0.55);
  cursor: default;
}

.hand--playing .hand__card.is-playable .card {
  box-shadow:
    0 0 0 0.5px rgba(31, 28, 23, 0.25),
    0 2px 3px rgba(31, 28, 23, 0.2),
    0 6px 14px rgba(31, 28, 23, 0.18);
}

@media (hover: hover) and (pointer: fine) {
  .hand--playing .hand__card.is-playable:hover,
  .hand--ecart .hand__card.is-selectable:hover {
    translate: 0 -10px;
  }
}

.hand__card.is-armed {
  translate: 0 -18px;
  z-index: 5;
}

.hand__card.is-armed .card,
.hand__card.is-selected .card {
  outline: 2px solid var(--red);
  outline-offset: 1px;
}

.hand__card.is-selected {
  translate: 0 -10px;
  z-index: 4;
}

.hand__card.is-from-chien::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: -8px;
  left: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brass);
  box-shadow: 0 0 0 1px rgba(56, 35, 26, 0.4);
}

.hand__card.is-leaving {
  translate: 0 -46px;
  opacity: 0;
}

.hand.is-dealing .hand__card {
  animation: deal 0.42s var(--ease-out) both;
  animation-delay: calc(var(--i) * 24ms);
}

@keyframes deal {
  from {
    opacity: 0;
    translate: 0 -60px;
    rotate: -4deg;
  }
}

/* ---------------------------------------------------------------- result */

.receipt {
  margin: 4px 0 18px;
  padding: 14px 16px 16px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper-hi);
  box-shadow: 0 1px 0 var(--rule);
  animation: rise 0.4s var(--ease-out) both;
}

.receipt__lines {
  margin: 0;
}

.receipt__line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px dotted var(--rule-strong);
  font-size: 14.5px;
}

.receipt__line dt {
  color: var(--ink-2);
}

.receipt__line dd {
  margin: 0;
  font-weight: 600;
}

.receipt__line.is-muted dd,
.receipt__line.is-muted dt {
  color: var(--ink-3);
  font-weight: 400;
}

.receipt__line--total {
  margin-top: 6px;
  padding-top: 9px;
  border-top: 1.5px solid var(--ink);
  border-bottom: 0;
  font-size: 16px;
}

.receipt__line--total dt {
  color: var(--ink);
  font-weight: 600;
}

.receipt__deltas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.receipt__deltas li {
  display: flex;
  flex-direction: column;
  padding: 7px 9px;
  border-radius: 6px;
  background: var(--paper-lo);
  font-size: 13px;
  color: var(--ink-2);
}

.receipt__deltas b {
  font-size: 18px;
  color: var(--ink);
}

.receipt__deltas li.is-up b {
  color: #2d6a45;
}

.receipt__deltas li.is-down b {
  color: var(--red);
}

.receipt__deltas li.is-you {
  box-shadow: inset 0 0 0 1.5px var(--ink);
}

/* ---------------------------------------------------------------- ledger */

.ledger {
  margin-top: 8px;
  border-top: 1px solid var(--rule);
}

.progress {
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}

.progress__row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.progress__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.progress__num {
  font-weight: 700;
  font-size: 15px;
}

.meter {
  position: relative;
  height: 8px;
  border-radius: 4px;
  background: var(--paper-lo);
  box-shadow: inset 0 0 0 1px var(--rule);
}

.meter__fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 4px;
  background: var(--red);
  transition: width 0.5s var(--ease-out);
}

.meter__mark {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  margin-left: -1px;
  background: var(--ink);
}

.meter__mark--best {
  background: var(--ink-3);
  width: 1px;
}

.progress__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  margin-top: 10px;
}

.progress__note {
  font-size: 13px;
  color: var(--ink-2);
}

.bouts {
  display: flex;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bout {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--rule-strong);
  color: var(--ink-3);
}

.bout--attack {
  background: var(--red);
  color: #fff6ec;
  box-shadow: none;
}

.bout--defense {
  background: var(--ink);
  color: var(--paper-hi);
  box-shadow: none;
}

.bout--table {
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--ink);
}

.bout--yours {
  color: var(--red);
  box-shadow: inset 0 0 0 1.5px var(--red);
}

.notes {
  margin: 0;
  padding: 10px 0;
  list-style: none;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
  color: var(--ink-2);
}

.notes li + li {
  margin-top: 4px;
}

.notes b {
  color: var(--ink);
  font-weight: 600;
}

.drawer {
  border-bottom: 1px solid var(--rule);
}

.drawer summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 0;
  font-family: var(--serif);
  font-size: 17px;
  cursor: pointer;
  list-style: none;
}

.drawer summary::-webkit-details-marker {
  display: none;
}

.drawer summary::after {
  content: "";
  margin-left: auto;
  align-self: center;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--ink-2);
  border-bottom: 1.5px solid var(--ink-2);
  rotate: 45deg;
  translate: 0 -2px;
  transition: rotate 0.2s ease;
}

.drawer[open] summary::after {
  rotate: 225deg;
  translate: 0 2px;
}

.drawer__peek {
  display: flex;
  gap: 10px;
  overflow: hidden;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink-3);
  white-space: nowrap;
}

.drawer[open] .drawer__peek {
  visibility: hidden;
}

.tricklog {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.tricklog li {
  display: grid;
  grid-template-columns: 2.2em 6.5em 1fr;
  align-items: baseline;
  padding: 5px 0;
  border-top: 1px dotted var(--rule);
  font-size: 14px;
}

.tricklog__no {
  color: var(--ink-3);
}

.tricklog__who {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tricklog__cards {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
}

.tricklog__play.is-win .cl {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.sheet-wrap {
  overflow-x: auto;
  margin: 0 0 12px;
}

.sheet {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.sheet th,
.sheet td {
  padding: 5px 6px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px dotted var(--rule);
}

.sheet thead th {
  font-weight: 600;
  color: var(--ink-2);
  border-bottom: 1px solid var(--rule-strong);
}

.sheet tbody th,
.sheet tfoot th {
  text-align: left;
  font-weight: 400;
}

.sheet td.is-neg {
  color: var(--ink-2);
}

.sheet tfoot td,
.sheet tfoot th {
  font-weight: 700;
  border-top: 1.5px solid var(--ink);
  border-bottom: 0;
}

/* ---------------------------------------------------------------- wider screens */

@media (min-width: 600px) {
  .felt {
    --tw: 66px;
    --felt-h: 360px;
  }

  .felt--5p {
    --tw: 60px;
    --felt-h: 380px;
  }

  .seat__name {
    font-size: 17px;
  }

  .home__title {
    font-size: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
  }
}
