@font-face {
  font-family: "Liberation Sans";
  src: url("/assets/fonts/LiberationSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Liberation Sans";
  src: url("/assets/fonts/LiberationSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #1c1814;
  --cream: #f4ead6;
  --paper: #fff9ef;
  --teal: #123f3c;
  --lagoon: #1d6a62;
  --deep: #0d2224;
  --coral: #c4472f;
  --gold: #c6a15b;
  --line: rgba(28, 24, 20, 0.12);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  font-family: "Liberation Sans", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }

html, body, body * { touch-action: manipulation; }

body {
  margin: 0;
  min-height: 100vh;
  touch-action: manipulation;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(198, 161, 91, 0.16), transparent 50%),
    var(--deep);
  color: var(--cream);
}

button, input, select { font: inherit; }

button { cursor: pointer; }

.app { min-height: 100vh; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px 8px;
}

.brand {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: 0.01em;
  font-weight: 600;
}

.brand span {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.ghost, .primary, .quiet {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 8px 14px;
}

.ghost {
  background: transparent;
  color: var(--cream);
  border-color: rgba(244, 234, 214, 0.35);
}

.quiet {
  background: rgba(255, 249, 239, 0.08);
  color: var(--cream);
  border-color: transparent;
}

.primary {
  background: var(--coral);
  color: white;
  border: 0;
  padding: 12px 18px;
}

.primary:disabled, .ghost:disabled { opacity: 0.5; cursor: default; }

.home, .lobby {
  width: min(720px, calc(100% - 28px));
  margin: 12px auto 32px;
}

.panel {
  background: var(--cream);
  color: var(--ink);
  border-radius: 22px;
  padding: 22px 18px;
  box-shadow: var(--shadow);
}

.panel h2 { margin: 0 0 6px; font-size: 1.45rem; }

.lede { margin: 0 0 16px; line-height: 1.45; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.95rem; }

input, select {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 12px;
  padding: 12px;
  color: var(--ink);
}

.or {
  text-align: center;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.75rem;
  margin: 16px 0;
  color: rgba(28, 24, 20, 0.55);
}

.ticket {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px dashed rgba(28, 24, 20, 0.3);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 249, 239, 0.7);
  margin-bottom: 14px;
}

.ticket strong {
  font-size: 1.8rem;
  letter-spacing: 0.18em;
}

.choices { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; }

.choices button, .seat-card {
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: 10px 12px;
}

.choices button.on {
  background: var(--teal);
  color: var(--cream);
  border-color: var(--teal);
}

.seat-list { display: grid; gap: 10px; }

.seat-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.seat-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.note { font-size: 0.92rem; line-height: 1.4; }

.scores {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 8px;
}

.chip {
  background: rgba(244, 234, 214, 0.1);
  border: 1px solid rgba(244, 234, 214, 0.18);
  border-radius: 14px;
  padding: 8px 12px;
  min-width: 120px;
}

.chip.yours { border-color: var(--gold); }

.chip b { display: block; font-size: 1.15rem; }

.chip small { opacity: 0.8; }

.chip hr {
  border: 0;
  border-top: 1px solid rgba(244, 234, 214, 0.55);
  margin: 8px 0 6px;
}

.chip-stats {
  display: block;
  font-size: 0.92rem;
  line-height: 1.3;
}

@media (display-mode: standalone) {
  #install { display: none; }
}

.arena {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
  grid-template-columns: 108px 1fr 108px;
  grid-template-areas:
    "north north north"
    "west felt east"
    "south south south";
}

.arena.players-2 {
  grid-template-areas:
    "north north north"
    "felt felt felt"
    "south south south";
}

.arena.players-3 {
  grid-template-areas:
    "west felt east"
    "south south south";
}

.north { grid-area: north; }
.west { grid-area: west; }
.east { grid-area: east; }
.south { grid-area: south; }
.felt { grid-area: felt; }

.seat {
  background: rgba(8, 22, 24, 0.45);
  border-radius: 16px;
  padding: 8px;
  min-height: 74px;
}

.seat.turn { outline: 2px solid var(--gold); }

.seat .who {
  display: block;
  font-size: 0.92rem;
  line-height: 1.35;
  margin-bottom: 6px;
  overflow-wrap: break-word;
}

.who .role {
  font-weight: 400;
}

.mini-hand .card, .mini-hand .back, .backs .back { width: 48px; }

.backs, .mini-hand, .table-cards, .hand {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.felt {
  min-height: 280px;
  border-radius: 24px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(7, 28, 30, 0.18), rgba(7, 28, 30, 0.42)),
    url("/assets/img/table.png") center/cover no-repeat,
    radial-gradient(circle at 50% 40%, #2a7f74, #114940 70%);
  box-shadow: inset 0 0 0 1px rgba(244, 234, 214, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.felt-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
}

.deck-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(8, 22, 24, 0.45);
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
}

.deck-pill .back { width: 36px; }

.table-cards { justify-content: center; min-height: 150px; }

.empty-table {
  margin: auto;
  opacity: 0.85;
  font-style: italic;
}

.card, .back {
  width: 74px;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  border: 0;
  padding: 0;
  position: relative;
  background: #f4ead6;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.hand .card { width: 92px; }

.card img, .back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card:disabled { opacity: 0.72; }

.card.playable { transform: translateY(0); transition: transform 0.12s ease; }

.card.playable:active, .card.playable:focus-visible { transform: translateY(-8px); }

@media (hover: hover) {
  .card.playable:hover { transform: translateY(-8px); }
}

.wild {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  background: var(--coral);
  color: white;
  font-style: normal;
  font-size: 0.68rem;
  border-radius: 999px;
  padding: 2px 4px;
  text-align: center;
}

.you {
  background: rgba(244, 234, 214, 0.08);
  border-radius: 18px;
  padding: 10px;
}

.you .who {
  margin: 2px 0 18px;
  text-align: center;
  font-size: 1.05rem;
  line-height: 1.4;
}

.banner {
  background: var(--cream);
  color: var(--ink);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 8px;
}

.banner.turn-cue {
  max-width: 26rem;
  margin: 0 auto 16px;
  padding: 12px 16px 13px;
  background: rgba(244, 234, 214, 0.1);
  color: var(--cream);
  border: 1px solid rgba(244, 234, 214, 0.28);
  border-radius: 14px;
  text-align: center;
  font-weight: 500;
  line-height: 1.45;
  box-shadow: none;
}

.banner.turn-cue strong {
  display: block;
  margin-bottom: 2px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.banner p { margin: 4px 0 10px; }

.banner .row, .sheet .row { display: flex; flex-wrap: wrap; gap: 8px; }

.log {
  list-style: none;
  margin: 8px 16px 20px;
  padding: 0;
  max-height: 140px;
  overflow: auto;
  font-size: 0.92rem;
  line-height: 1.35;
}

.log li { padding: 3px 0; opacity: 0.92; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 18, 20, 0.58);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 30;
  padding: 0;
}

.sheet {
  width: min(640px, 100%);
  max-height: 82vh;
  overflow: auto;
  background: var(--cream);
  color: var(--ink);
  border-radius: 22px 22px 0 0;
  padding: 16px 16px 22px;
}

.sheet h3 { margin: 0 0 8px; }

.sheet button.option {
  display: block;
  width: 100%;
  text-align: left;
  margin: 8px 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  color: var(--ink);
}

table.points {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

table.points th, table.points td {
  text-align: right;
  padding: 5px 6px;
  border-bottom: 1px solid var(--line);
}

table.points th:first-child, table.points td:first-child { text-align: left; }

.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 16px;
  background: #f3d2c4;
  color: #3d1b12;
  border-radius: 12px;
  padding: 6px 6px 6px 12px;
}

.toast-x {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font-size: 1.5rem;
  line-height: 1;
}

.rules { font-size: 0.98rem; line-height: 1.45; }

.rules ul { padding-left: 18px; }

.captures { margin-top: 8px; }

@media (min-width: 721px) {
  .scores {
    width: min(860px, calc(100% - 32px));
    margin-inline: auto;
    justify-content: center;
    overflow-x: visible;
  }

  .arena {
    width: min(860px, calc(100% - 32px));
    margin-inline: auto;
    grid-template-columns: minmax(168px, 196px) minmax(0, 1fr) minmax(168px, 196px);
    justify-content: center;
  }

  .hand,
  .north .backs,
  .north .mini-hand {
    justify-content: center;
  }
}

@media (min-width: 900px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .card { width: 96px; }
  .hand .card { width: 118px; }
  .felt { min-height: 420px; }
  .overlay { align-items: center; padding: 24px; }
  .sheet { border-radius: 22px; }
  .seat-card { grid-template-columns: 1.2fr 1fr 1fr; align-items: end; }
}

button, .ghost, .primary, .quiet, .choices button, .emote-btn, .consent-btn {
  min-height: 44px;
  touch-action: manipulation;
}

.host-line {
  margin: 0 16px 8px;
  color: var(--gold);
  font-size: 0.92rem;
}

.emote-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.emote-btn {
  width: 48px;
  min-width: 48px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(244, 234, 214, 0.12);
  color: var(--cream);
  border: 1px solid rgba(244, 234, 214, 0.35);
  border-radius: 999px;
  font-size: 1.4rem;
  line-height: 1;
}

.emote-pop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6em;
  height: 1.6em;
  margin: 0 0 0 6px;
  padding: 0;
  background: transparent;
  color: inherit;
  border-radius: 0;
  font-size: 1.45rem;
  line-height: 1;
  font-weight: 400;
  vertical-align: middle;
}

.flyer {
  position: fixed;
  z-index: 45;
  pointer-events: none;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.site-foot {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 8px 16px 28px;
}

.site-foot a, .site-foot button {
  color: var(--cream);
  background: transparent;
  border: 0;
  text-decoration: underline;
  min-height: 44px;
  padding: 10px 4px;
}

.consent {
  position: fixed;
  z-index: 80;
  left: 12px;
  right: 12px;
  bottom: 12px;
  margin: 0 auto;
  max-width: 640px;
  background: var(--cream);
  color: var(--ink);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.consent[hidden] { display: none; }

.consent h2 { margin: 0 0 8px; font-size: 1.25rem; }

.consent p { margin: 0 0 10px; line-height: 1.4; }

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 12px;
  line-height: 1.35;
}

.check input { width: 22px; height: 22px; margin-top: 2px; }

.consent-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.consent-btn {
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  border-radius: 12px;
  border: 2px solid var(--teal);
  box-sizing: border-box;
}

#consent-accept { background: var(--teal); color: var(--cream); }

#consent-reject { background: var(--paper); color: var(--ink); }

.consent-more a { color: var(--teal); }

.ranks, .history { margin: 0; padding-left: 18px; line-height: 1.45; }

.ranks li, .history li { margin: 4px 0; }

.ranks li { display: flex; justify-content: space-between; gap: 8px; }

.privacy h1 { font-size: 1.8rem; margin: 8px 0; }

.privacy h2 { font-size: 1.2rem; margin: 18px 0 6px; }

body:has(#consent:not([hidden])) { padding-bottom: 240px; }

@media (max-width: 720px) {
  .arena, .arena.players-2, .arena.players-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "north north"
      "west east"
      "felt felt"
      "south south";
  }
  .west, .east { min-height: 0; }
}
