:root {
  /* The table: a zinc bar counter with a brass rail. */
  --zinc-950: #192024;
  --zinc-900: #20292e;
  --zinc-800: #2a353b;
  --zinc-700: #38454d;
  --zinc-500: #62727b;
  --zinc-300: #a9b8c0;
  --zinc-100: #e6ecef;
  --brass: #dcaa48;
  --brass-deep: #a4761c;

  /* The cards: printed stock. */
  --paper: #fdfcf8;
  --ink: #1b2125;
  --ink-muted: #5a636a;
  --rule: #e6e3db;

  /* One print color per quartet. */
  --amber: #c47a16;
  --peat: #6b5338;
  --juniper: #2f5fa8;
  --agave: #5a8a27;
  --tiki: #b0365c;
  --grape: #6d3f7e;
  --bitter: #d8432a;
  --herbal: #147c80;

  --font-display: 'Big Shoulders Display', 'Big Shoulders', 'Arial Narrow', sans-serif;
  --font-body: 'Exo 2', system-ui, -apple-system, 'Segoe UI', sans-serif;

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  color: var(--zinc-100);
  background-color: var(--zinc-900);
  background-image:
    repeating-linear-gradient(90deg, rgb(255 255 255 / 0.014) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse 120% 70% at 50% 0%, #3b4850 0%, var(--zinc-900) 62%, var(--zinc-950) 100%);
  background-attachment: fixed;
}

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

:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 2px;
}

h1,
h2,
h3,
p,
ol,
ul {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

/* ---------- controls ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.7em 1.25em;
  border: 1px solid var(--zinc-500);
  border-radius: 10px;
  background: var(--zinc-800);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.button:hover {
  background: var(--zinc-700);
}

.button.is-primary {
  border-color: var(--brass);
  background: var(--brass);
  color: #21180a;
}

.button.is-primary:hover {
  background: #e7ba5d;
}

.button.is-quiet {
  min-height: 40px;
  border-color: transparent;
  background: rgb(255 255 255 / 0.06);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.link {
  padding: 0.4em 0;
  border: 0;
  background: none;
  color: var(--zinc-300);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link:hover {
  color: var(--zinc-100);
}

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

.stack {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 0.6em 0.8em;
  border: 1px solid var(--zinc-500);
  border-radius: 10px;
  background: var(--zinc-950);
  font-weight: 500;
}

.field input::placeholder {
  color: var(--zinc-500);
}

.code-input {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.notice {
  padding: 0.7em 0.9em;
  border-left: 4px solid var(--bitter);
  border-radius: 6px;
  background: rgb(216 67 42 / 0.14);
}

.banner {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.5em 16px;
  background: var(--brass);
  color: #21180a;
  font-weight: 600;
  text-align: center;
}

.waiting {
  color: var(--zinc-300);
}

.waiting::after {
  content: '';
  animation: dots 1.4s steps(4, end) infinite;
}

@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* ---------- the card ---------- */

.card {
  --tint: color-mix(in srgb, var(--group) 16%, var(--paper));
  position: relative;
  display: flex;
  flex-direction: column;
  width: 18em;
  padding: 0.45em;
  border-radius: 0.95em;
  background: var(--paper);
  color: var(--ink);
  box-shadow:
    0 0 0 1px rgb(0 0 0 / 0.08),
    0 0.15em 0 rgb(0 0 0 / 0.12),
    0 1em 2.2em rgb(8 12 14 / 0.45);
  overflow: hidden;
}

.card-band {
  display: flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.3em 0.55em 0.3em 0.3em;
  border-radius: 0.6em 0.6em 0 0;
  background: var(--group);
  color: #fff;
}

.card-code {
  display: grid;
  place-items: center;
  min-width: 2.15em;
  height: 2.15em;
  padding: 0 0.2em;
  border-radius: 0.45em;
  background: var(--paper);
  color: var(--group);
  font-family: var(--font-display);
  font-size: 1.05em;
  font-weight: 900;
  line-height: 1;
}

.card-group {
  font-weight: 600;
  font-size: 0.82em;
  line-height: 1.15;
}

.card-photo {
  position: relative;
  height: 9.5em;
  background:
    linear-gradient(to top, color-mix(in srgb, var(--group) 30%, var(--paper)) 0 0.5em, transparent 0.5em),
    radial-gradient(ellipse 70% 90% at 50% 100%, #fff 0%, var(--tint) 70%);
}

.card-photo img {
  position: absolute;
  bottom: 0.5em;
  left: 50%;
  height: calc((100% - 1em) * var(--bottle));
  transform: translateX(-50%);
  filter: drop-shadow(0 0.25em 0.2em rgb(0 0 0 / 0.2));
}

.card-title {
  padding: 0.55em 0.4em 0.45em;
  border-bottom: 1px solid var(--rule);
}

.card-name {
  font-family: var(--font-display);
  font-size: 1.45em;
  font-weight: 800;
  line-height: 0.98;
  text-wrap: balance;
}

.card-origin {
  margin-top: 0.25em;
  color: var(--ink-muted);
  font-size: 0.74em;
}

.card-stats {
  display: grid;
}

.stat {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5em;
  width: 100%;
  min-height: 2.35em;
  padding: 0.38em 0.45em 0.48em;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  color: var(--ink);
  text-align: left;
}

li:last-child > .stat {
  border-bottom: 0;
}

.stat-label {
  display: grid;
  font-size: 0.82em;
  font-weight: 600;
  line-height: 1.15;
}

.stat-label small {
  color: var(--ink-muted);
  font-size: 0.82em;
  font-weight: 500;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.3em;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-value small {
  font-size: 0.68em;
  font-weight: 700;
}

/* How this value ranks against the whole deck. */
.stat-meter {
  position: absolute;
  left: 0.45em;
  right: 0.45em;
  bottom: 0.22em;
  height: 0.16em;
  border-radius: 1em;
  background: linear-gradient(to right, var(--group) var(--meter), var(--rule) var(--meter));
  opacity: 0.75;
}

.is-picking .stat {
  cursor: pointer;
  transition: background-color 120ms ease;
}

.is-picking .stat:hover {
  background: var(--tint);
}

.is-picking .stat:focus-visible {
  outline-color: var(--group);
  outline-offset: -2px;
}

.stat.is-chosen {
  background: color-mix(in srgb, var(--brass) 26%, var(--paper));
  box-shadow: inset 0.25em 0 0 var(--brass-deep);
}

.stamp {
  position: absolute;
  top: 4.4em;
  right: 0.8em;
  padding: 0.05em 0.35em;
  border: 0.16em solid currentColor;
  border-radius: 0.3em;
  font-family: var(--font-display);
  font-size: 2em;
  font-weight: 900;
  line-height: 1;
  transform: rotate(-11deg);
  background: rgb(253 252 248 / 0.82);
}

.stamp.is-won {
  color: var(--brass-deep);
}

.stamp.is-lost {
  color: var(--zinc-500);
}

.stamp.is-tie {
  color: var(--juniper);
}

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

.home {
  display: grid;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 16px 48px;
}

/* The fan scales with its column, so the rotated outer cards never leave it: at 14px the
   three cards span about 44em. */
.home-art {
  container-type: inline-size;
}

.fan {
  --spread: 6.5em;
  position: relative;
  height: 29.5em;
  font-size: min(14px, 100cqi / 44);
}

.fan .card {
  position: absolute;
  top: 1.2em;
  left: 50%;
  margin-left: -9em;
  transform-origin: 50% 120%;
}

.fan .card:nth-child(1) {
  transform: translateX(calc(var(--spread) * -1)) rotate(-12deg);
}

.fan .card:nth-child(2) {
  z-index: 1;
  transform: translateY(-0.6em);
}

.fan .card:nth-child(3) {
  transform: translateX(var(--spread)) rotate(12deg);
}

.home-copy {
  display: grid;
  gap: 20px;
  align-content: start;
  max-width: 34rem;
}

.title {
  font-family: var(--font-display);
  font-size: clamp(3.6rem, 16vw, 6.5rem);
  font-weight: 900;
  line-height: 0.94;
  letter-spacing: -0.01em;
  color: var(--paper);
}

.lede {
  max-width: 30em;
  color: var(--zinc-300);
  font-size: 1.08rem;
}

.rules {
  border-top: 1px solid var(--zinc-700);
  padding-top: 14px;
}

.rules summary {
  font-weight: 600;
  cursor: pointer;
}

.rules ol {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding-left: 1.3em;
  list-style: decimal;
  color: var(--zinc-300);
}

.rules p {
  color: var(--zinc-300);
}

.home-copy > .link {
  justify-self: start;
}

@media (min-width: 860px) {
  .home {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 56px;
    align-items: center;
    min-height: 100dvh;
    padding-block: 48px;
  }
}

/* ---------- panels: join, lobby ---------- */

.panel {
  display: grid;
  gap: 18px;
  max-width: 34rem;
  margin: 0 auto;
  padding: 40px 16px 48px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 900;
  line-height: 0.95;
}

.room-code {
  color: var(--brass);
  letter-spacing: 0.08em;
}

.section-title {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
}

.lobby > .button {
  justify-self: start;
}

.lobby-seats {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--zinc-700);
  border-radius: 12px;
  background: var(--zinc-700);
}

.lobby-seat {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 14px;
  background: var(--zinc-800);
}

.lobby-name {
  flex: 1;
  font-weight: 600;
}

.lobby-tag {
  color: var(--zinc-300);
  font-size: 0.9rem;
}

.choices {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice {
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
}

.choice input {
  width: 20px;
  height: 20px;
  accent-color: var(--brass);
}

/* ---------- game ---------- */

.game {
  display: grid;
  gap: 12px;
  max-width: 1000px;
  margin: 0 auto;
  padding: 8px 16px 32px;
}

.game-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--zinc-300);
  font-size: 0.92rem;
}

.seats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.seat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--zinc-700);
  border-radius: 999px;
  background: var(--zinc-800);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.seat.is-you .seat-name {
  font-weight: 700;
}

.seat.is-turn {
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgb(220 170 72 / 0.25);
}

.seat.is-out {
  opacity: 0.45;
}

.seat-name small {
  color: var(--zinc-300);
}

.seat-count {
  display: grid;
  place-items: center;
  min-width: 2em;
  height: 2em;
  padding: 0 0.4em;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.status {
  min-height: 3em;
  font-size: 1.05rem;
  font-weight: 500;
  text-wrap: pretty;
}

.board {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.hand {
  font-size: clamp(13px, 4.4vw, 19px);
}

.is-revealing .hand {
  font-size: clamp(11px, 3.4vw, 17px);
}

.card-slot {
  display: grid;
  place-items: center;
  width: 18em;
  height: 24em;
  border: 2px dashed var(--zinc-500);
  border-radius: 0.95em;
  color: var(--zinc-300);
}

.card.is-dealt {
  animation: deal 380ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes deal {
  from {
    opacity: 0;
    transform: translateY(-1.2em) rotate(-3deg) scale(0.96);
  }
}

.animate .stamp {
  animation: stamp 260ms cubic-bezier(0.3, 1.6, 0.5, 1) both 380ms;
}

@keyframes stamp {
  from {
    opacity: 0;
    transform: rotate(-11deg) scale(1.8);
  }
}

.reveal {
  display: grid;
  gap: 10px;
  order: -1;
  width: 100%;
  max-width: 30rem;
}

.reveal-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
}

.plays {
  display: grid;
  gap: 6px;
}

.play {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  min-height: 60px;
  padding: 6px 14px 6px 10px;
  border: 1px solid var(--zinc-700);
  border-left: 5px solid var(--group);
  border-radius: 10px;
  background: var(--zinc-800);
}

.play-bottle {
  grid-row: 1 / 3;
  justify-self: center;
  height: 48px;
}

.play-who {
  font-weight: 700;
}

.play-card {
  grid-column: 2;
  color: var(--zinc-300);
  font-size: 0.86rem;
  line-height: 1.2;
}

.play-value {
  grid-column: 3;
  grid-row: 1 / 3;
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.play-value small {
  font-size: 0.6em;
}

.play.is-winner {
  border-color: var(--brass);
  background: color-mix(in srgb, var(--brass) 18%, var(--zinc-800));
}

.play.is-winner .play-value {
  color: var(--brass);
}

.play.is-tie {
  border-color: var(--zinc-300);
}

.animate .play {
  animation: slide-in 300ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i) * 90ms);
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(1.5rem);
  }
}

.reveal .button {
  justify-self: start;
}

.pot {
  min-height: 1.5em;
  color: var(--zinc-300);
  text-align: center;
}

@media (min-width: 860px) {
  .board {
    grid-template-columns: auto 1fr;
    align-items: start;
    justify-items: start;
    gap: 32px;
  }

  .hand,
  .is-revealing .hand {
    font-size: 19px;
  }

  .reveal {
    order: 0;
  }

  .pot {
    text-align: left;
  }
}

/* ---------- game over ---------- */

.over {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(15 20 23 / 0.72);
  backdrop-filter: blur(4px);
}

.over-panel {
  display: grid;
  gap: 18px;
  width: min(100%, 26rem);
  padding: 24px;
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
}

.over-panel .button:not(.is-primary) {
  border-color: var(--rule);
  background: #fff;
}

.over-panel .waiting {
  color: var(--ink-muted);
}

.standings {
  display: grid;
}

.standings li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
}

.standings li:first-child {
  font-weight: 700;
}

/* ---------- deck ---------- */

.deck {
  display: grid;
  gap: 36px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.deck-head {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.deck-head p {
  color: var(--zinc-300);
}

.quartet {
  display: grid;
  gap: 14px;
}

.quartet-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 800;
}

.quartet-title span {
  display: grid;
  place-items: center;
  width: 1.4em;
  height: 1.4em;
  border-radius: 0.3em;
  background: var(--group);
  color: #fff;
  font-size: 0.85em;
}

.quartet-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(216px, 1fr));
  gap: 20px;
  justify-items: center;
  font-size: 12px;
}

@media (min-width: 600px) {
  .quartet-cards {
    grid-template-columns: repeat(auto-fill, minmax(234px, 1fr));
    font-size: 13px;
  }
}

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