.panel,
.score,
.context > div,
.status-feed article,
.history {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.panel h2,
.panel p {
  margin: 0;
}

.score,
.context > div {
  display: grid;
  gap: 4px;
  min-height: 68px;
  padding: 12px;
}

.status-feed {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.status-feed article {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-left: 4px solid var(--accent);
}

.score.active {
  outline: 3px solid var(--accent);
}

.score span {
  font-size: 1.5rem;
  font-weight: 800;
}

.score small,
.context span,
.status-feed span,
.eyebrow {
  color: var(--muted);
}

.context strong,
.status-feed strong {
  font-size: 0.82rem;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.78rem;
  font-weight: 800;
}

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

.actions.vertical {
  align-items: stretch;
  flex-direction: column;
}

button,
select,
input {
  border: 1px solid var(--line);
  border-radius: 8px;
}

button {
  min-height: 44px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 750;
}

button.secondary {
  background: var(--surface-2);
  color: var(--text);
}

button:disabled {
  opacity: 0.45;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.icon-button {
  width: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

input,
select {
  min-height: 44px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
}

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

.player-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 180px);
  gap: 10px;
  align-items: end;
}

.toggle {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.toggle input {
  width: 22px;
  min-height: 22px;
}

.hand {
  display: grid;
  grid-template-columns: repeat(5, minmax(58px, 1fr));
  gap: 8px;
}

.card {
  position: relative;
  overflow: hidden;
  aspect-ratio: 0.68;
  min-height: 118px;
  padding: 8px;
  display: grid;
  align-content: space-between;
  justify-items: center;
  background: #fffdf8;
  color: #1a1a1a;
  border: 2px solid #cfc7b7;
  box-shadow: 0 5px 14px rgba(31, 42, 46, 0.14);
}

.card strong {
  font-size: 2rem;
}

.card span {
  justify-self: start;
  font-weight: 900;
}

.card small {
  position: absolute;
  z-index: 1;
  top: 5px;
  right: 4px;
  left: 4px;
  text-align: center;
  line-height: 1.2;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.72rem;
  text-transform: capitalize;
}

.card:not(.court-card) .card-suit {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.card .card-rank {
  position: absolute;
  top: 22px;
  left: 5px;
}

.card.red strong,
.card.red span,
.card-label.red {
  color: #b42318;
}

.card.black strong,
.card.black span,
.card-label.black {
  color: #111827;
}

.card-label {
  font-weight: 900;
  white-space: nowrap;
}

.court-card-art {
  position: absolute;
  z-index: 0;
  inset: 5px 6px;
  width: calc(100% - 12px);
  height: calc(100% - 10px);
  object-fit: cover;
  border: 1px solid rgba(79, 91, 173, 0.55);
  pointer-events: none;
}

.court-card .card-rank,
.court-card .card-suit {
  position: absolute;
  z-index: 1;
  left: 5px;
  min-width: 1.15em;
  padding-inline: 2px;
  line-height: 1;
  text-align: center;
  background: rgba(255, 253, 248, 0.9);
  border-radius: 3px;
}

.court-card .card-rank {
  top: 22px;
}

.court-card .card-suit {
  top: 42px;
  font-size: 1.35rem;
}

.court-card small {
  padding: 1px 4px;
  background: rgba(255, 253, 248, 0.88);
  border-radius: 4px;
}

.suit-symbol.suit-red {
  color: #b42318;
}

.suit-symbol.suit-black {
  color: #111827;
}

.card.selected,
.card[aria-pressed="true"] {
  border-color: var(--focus);
  background: linear-gradient(180deg, #fff8dd, #fffdf8 48%, #f7e6b8);
  box-shadow:
    inset 0 0 0 4px #f2c96d,
    0 0 0 4px rgba(242, 201, 109, 0.72),
    0 16px 28px rgba(31, 42, 46, 0.34);
  transform: translateY(-14px) scale(1.04);
  z-index: 12;
}

.hand.has-selection .card:not(.selected):not([aria-pressed="true"]):not(:disabled) {
  opacity: 1;
  filter: saturate(0.65) brightness(0.82);
}

.card.selected::before,
.card[aria-pressed="true"]::before {
  content: "";
  position: absolute;
  z-index: 5;
  inset: 0 0 auto;
  height: 10px;
  background: #f2c96d;
  box-shadow: 0 1px 0 rgba(31, 42, 46, 0.24);
}

.selected-card-marker {
  position: absolute;
  z-index: 8;
  bottom: 8px;
  right: 6px;
  padding: 4px 7px;
  color: #fffdf8 !important;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  background: #1f2a2e;
  border: 1px solid rgba(255, 253, 248, 0.75);
  border-radius: 999px;
}

.selected-exchange-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: -4px 0 2px;
}

.selected-exchange-cards .card-label {
  padding: 4px 7px;
  color: #fffdf8;
  background: #1f2a2e;
  border: 1px solid #f2c96d;
  border-radius: 999px;
  box-shadow: 0 3px 8px rgba(31, 42, 46, 0.18);
}

.card:disabled {
  opacity: 1;
  transform: none;
}

.hand .card:disabled {
  filter: brightness(0.82);
}

.open-card-hand {
  display: flex;
  justify-content: center;
}

.open-card-hand .card:disabled {
  width: 150px;
  flex: 0 0 150px;
  filter: none;
}

.hand.is-arranging .card,
.hand.can-reorder .card {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.card.arrange-selected {
  border-color: #0f766e;
  box-shadow:
    inset 0 0 0 3px rgba(15, 118, 110, 0.42),
    0 0 0 4px rgba(20, 184, 166, 0.34),
    0 16px 28px rgba(31, 42, 46, 0.28);
  transform: translateY(-18px) scale(1.04);
  z-index: 14;
}

.card.arrange-dragging {
  cursor: grabbing;
  opacity: 1;
  z-index: 20;
}

.card.arrange-drop-target {
  border-color: #b45309;
  box-shadow:
    inset 0 0 0 3px rgba(180, 83, 9, 0.34),
    0 0 0 4px rgba(245, 158, 11, 0.28),
    0 16px 28px rgba(31, 42, 46, 0.24);
}

.hand.is-concealed .card {
  position: relative;
  overflow: hidden;
  opacity: 1;
  filter: none;
  color: transparent;
  border-color: #d3aa65;
  background:
    linear-gradient(rgba(1, 10, 18, 0.14), rgba(1, 10, 18, 0.24)),
    url("../../assets/cards/back-royal-v2.jpg") center / cover,
    #031722;
  box-shadow:
    inset 0 0 0 4px #f2d493,
    inset 0 0 0 7px #174c67,
    0 5px 14px rgba(5, 24, 36, 0.28);
}

.hand.is-concealed .card > * {
  visibility: hidden;
}

.hand.is-concealed .card::before,
.hand.is-concealed .card::after {
  content: none;
}

@media (min-width: 700px) {
  .card .card-rank {
    font-size: 1.25rem;
  }

  .card .card-suit {
    font-size: 2.5rem;
  }

  .court-card .card-suit {
    top: 2rem;
    font-size: 1.7rem;
  }
}

.played,
.final-hands,
.round-events,
.win-audit,
.completed-trick-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.online-hand {
  position: sticky;
  z-index: 10;
  bottom: 8px;
  border-color: rgba(171, 116, 42, 0.72);
  background: linear-gradient(180deg, #fffdf8, #f5ead5);
  box-shadow: 0 -8px 30px rgba(5, 24, 36, 0.2);
}

.online-hand.is-active {
  border-color: #d4a34d;
  box-shadow: 0 -8px 34px rgba(212, 163, 77, 0.3);
}

.online-card-fan {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(5px, 1vw, 10px);
  min-height: 148px;
  padding: 12px 8px 2px;
  overflow: visible;
}

.online-card-fan .card {
  --fan-angle: 0deg;
  --fan-y: 0px;
  width: min(172px, calc((100% - 40px) / 5));
  flex: 0 1 172px;
  transform: translateY(var(--fan-y)) rotate(var(--fan-angle));
  transform-origin: 50% 115%;
}

.online-card-fan .card:nth-child(1) {
  --fan-angle: -4deg;
  --fan-y: 6px;
}

.online-card-fan .card:nth-child(2) {
  --fan-angle: -2deg;
  --fan-y: 2px;
}

.online-card-fan .card:nth-child(4) {
  --fan-angle: 2deg;
  --fan-y: 2px;
}

.online-card-fan .card:nth-child(5) {
  --fan-angle: 4deg;
  --fan-y: 6px;
}

.online-card-fan .card.selected,
.online-card-fan .card[aria-pressed="true"] {
  transform: translateY(calc(var(--fan-y) - 24px)) scale(1.04) rotate(var(--fan-angle));
}

.online-card-fan .card.arrange-selected {
  transform: translateY(calc(var(--fan-y) - 28px)) scale(1.04) rotate(var(--fan-angle));
}

.online-card-fan .card:disabled {
  transform: translateY(var(--fan-y)) rotate(var(--fan-angle));
}

.online-hand-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.online-hand-heading h2,
.online-hand-heading p {
  margin: 0;
}

.online-hand-heading > div:first-child {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.hand-tools {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  pointer-events: none;
}

.hand-tools > button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.74rem;
  pointer-events: auto;
}

.hand-arrange-actions {
  display: flex;
  flex: 1 0 100%;
  justify-content: flex-end;
  gap: 4px;
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.hand-arrange-actions[hidden] {
  display: none;
}

.hand-arrange-actions button {
  min-width: 42px;
  min-height: 34px;
  padding: 6px 9px;
  font-size: 0.9rem;
  pointer-events: auto;
}

.hand-tools-hint {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  text-align: right;
  text-transform: uppercase;
}

.hand-sort-options {
  position: absolute;
  z-index: 25;
  top: calc(100% + 7px);
  right: 0;
  width: min(280px, calc(100vw - 42px));
  display: grid;
  gap: 6px;
  padding: 10px;
  color: var(--text);
  text-align: left;
  background: #fffdf8;
  border: 1px solid #b17a35;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(7, 31, 44, 0.25);
  pointer-events: auto;
}

.hand-sort-options[hidden] {
  display: none;
}

.hand-sort-options strong {
  padding: 2px 3px 5px;
  font-size: 0.82rem;
}

.hand-sort-group-label {
  padding: 2px 3px 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hand-sort-options button {
  min-height: 36px;
  padding: 6px 9px;
  font-size: 0.76rem;
}

.hand-sort-options button[aria-pressed="true"] {
  outline: 3px solid #e6b958;
  outline-offset: -3px;
}

.empty-hand {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed #cfc7b7;
  border-radius: 10px;
}

.online-game {
  align-content: start;
  gap: 14px;
  padding-block: 4px 24px;
}

.online-game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.online-game-header h1 {
  margin: 0;
  font-size: clamp(1.4rem, 4vw, 2rem);
}

.turn-pill {
  flex: 0 0 auto;
  padding: 8px 12px;
  color: #d9e5e8;
  background: #173846;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 850;
}

.turn-pill.is-yours {
  color: #172b31;
  background: #f2c96d;
  border-color: #d39d32;
}

.online-table {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 14px;
  color: #f8f2df;
  background:
    radial-gradient(circle at 50% 42%, rgba(34, 89, 105, 0.76), transparent 48%),
    linear-gradient(145deg, #0d3442, #071f2c 72%);
  border: 5px solid #b17a35;
  outline: 2px solid #563515;
  outline-offset: -7px;
  border-radius: 28px;
  box-shadow: 0 18px 42px rgba(7, 31, 44, 0.28), inset 0 0 38px rgba(0, 0, 0, 0.22);
}

.game-moment {
  position: absolute;
  z-index: 30;
  inset: 50% auto auto 50%;
  min-width: min(82%, 420px);
  display: grid;
  justify-items: center;
  padding: 18px 24px;
  color: #162d35;
  text-align: center;
  background: rgba(249, 226, 174, 0.97);
  border: 3px double #7e4c20;
  border-radius: 18px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.44);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: game-moment 1100ms ease-out both;
}

.game-moment small {
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.game-moment strong {
  font-family: Georgia, serif;
  font-size: clamp(2rem, 9vw, 4.4rem);
  line-height: 1;
}

.chicago-moment {
  color: #fff5dd;
  background: rgba(128, 26, 22, 0.97);
  border-color: #edc66d;
  text-shadow: 0 2px 0 #4b1110;
}

.four-kind-moment {
  color: #fff6da;
  background: rgba(10, 42, 57, 0.97);
  border-color: #edc66d;
}

.victory-moment {
  color: #452414;
  background: rgba(246, 205, 111, 0.98);
}

.round-moment strong {
  font-size: clamp(1.7rem, 7vw, 3.4rem);
}

.player-rail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.table-player {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  background: rgba(4, 22, 31, 0.72);
  border: 1px solid rgba(239, 209, 148, 0.25);
  border-radius: 14px;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.table-player.active {
  border-color: #f2c96d;
  box-shadow: 0 0 0 2px rgba(242, 201, 109, 0.2), 0 0 22px rgba(242, 201, 109, 0.18);
  transform: translateY(-2px);
}

.table-player.is-you {
  background: rgba(89, 42, 35, 0.76);
}

.player-token {
  width: 34px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: #142f39;
  background: #e5bd6e;
  border: 2px solid #f8e4b9;
  border-radius: 50%;
  font-weight: 900;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
}

.seat-2 .player-token {
  background: #b8c9d4;
}

.seat-3 .player-token {
  background: #d68f78;
}

.seat-4 .player-token {
  background: #a9c59b;
}

.seat-5 .player-token {
  background: #c7acd0;
}

.player-details {
  min-width: 0;
  display: grid;
}

.player-details strong,
.player-details small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-details small {
  color: #bfced2;
  font-size: 0.7rem;
}

.player-score {
  position: relative;
  font-size: 1.2rem;
  font-weight: 900;
  white-space: nowrap;
}

.player-score em {
  position: absolute;
  top: -24px;
  right: -8px;
  padding: 3px 6px;
  color: #162d35;
  background: #f2c96d;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28);
  font-size: 0.72rem;
  font-style: normal;
  animation: score-bump 900ms ease-out both;
}

.player-score em.negative {
  color: #fff;
  background: #b43d2f;
}

.table-player.score-changed {
  animation: player-score-flash 900ms ease-out;
}

.player-score small {
  margin-left: 2px;
  font-size: 0.68rem;
  color: #c7d4d7;
}

.card-count {
  grid-column: 2 / -1;
  color: #d7c292;
  font-size: 0.68rem;
}

.table-felt {
  position: relative;
  min-height: 245px;
  display: grid;
  align-content: center;
  justify-items: center;
  overflow: hidden;
  padding: 32px 14px 18px;
  border: 1px solid rgba(237, 215, 169, 0.16);
  border-radius: 50% / 22%;
}

.table-mark {
  position: absolute;
  inset: 50% auto auto 50%;
  display: grid;
  color: rgba(234, 214, 169, 0.09);
  text-align: center;
  text-transform: uppercase;
  transform: translate(-50%, -50%) rotate(-4deg);
  pointer-events: none;
}

.table-mark span {
  font-size: 0.8rem;
  letter-spacing: 0.32em;
}

.table-mark strong {
  font-family: Georgia, serif;
  font-size: clamp(2.5rem, 9vw, 5.5rem);
  letter-spacing: 0.04em;
}

.table-status {
  position: absolute;
  top: 10px;
  padding: 4px 10px;
  color: #e9d5aa;
  background: rgba(3, 18, 26, 0.54);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.table-plays {
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.table-play {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.table-play.is-new {
  animation: card-arrives 240ms ease-out both;
}

.table-play > span {
  max-width: 100px;
  overflow: hidden;
  color: #dbe5e7;
  font-size: 0.7rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.online-trick-card {
  width: clamp(68px, 11vw, 92px);
}

.online-trick-card .card {
  width: 100%;
  min-height: 112px;
  opacity: 1;
}

.table-empty {
  margin: 0;
  color: #aebfc3;
  font-size: 0.86rem;
}

.trick-confirmation {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  padding: 9px 16px;
  color: #1b3037;
  background: #f2c96d;
  border: 2px solid #fff0c7;
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transform: translate(-50%, -50%);
  animation: trick-confirm 700ms ease-out both;
}

.online-action-zone {
  position: relative;
  z-index: 12;
  width: min(1040px, 100%);
  margin-inline: auto;
}

.online-action-panel {
  gap: 10px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.online-action-panel.compact-action {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.online-action-panel.compact-action h2 {
  font-size: 1.1rem;
  white-space: nowrap;
}

.online-action-panel.compact-action p {
  min-width: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.online-action-panel.compact-action .actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.online-action-panel.compact-action .actions button {
  min-height: 40px;
  white-space: nowrap;
}

.online-action-panel.waiting {
  grid-template-columns: auto 1fr;
  align-items: baseline;
}

.online-action-panel.waiting h2 {
  font-size: 1rem;
}

.online-action-panel.waiting p {
  color: var(--muted);
  font-size: 0.82rem;
}

.online-action-panel.dramatic,
.online-action-panel.chicago-choice {
  border-color: #b43d2f;
}

.online-utility-actions {
  padding-top: 10px;
  justify-content: flex-end;
}

.game-journal {
  display: grid;
  gap: 6px;
}

.journal-latest {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  color: #dce7e9;
  background: #173846;
  border: 1px solid rgba(177, 122, 53, 0.6);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(7, 31, 44, 0.14);
}

.journal-latest > span:last-child {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.journal-latest small {
  color: #d8bd83;
  font-size: 0.63rem;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.journal-latest strong {
  overflow: hidden;
  font-size: 0.86rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journal-marker {
  color: #f2c96d;
  font-size: 0.72rem;
  filter: drop-shadow(0 0 5px rgba(242, 201, 109, 0.55));
}

.journal-history,
.online-tools {
  color: var(--muted);
  font-size: 0.8rem;
}

.journal-history summary,
.online-tools summary {
  width: fit-content;
  padding: 5px 2px;
  cursor: pointer;
  font-weight: 750;
}

.journal-history ol {
  display: grid;
  gap: 5px;
  margin: 4px 0 0;
  padding: 10px 12px 10px 32px;
  background: rgba(255, 255, 255, 0.72);
  border-left: 3px solid #b17a35;
  border-radius: 8px;
}

.journal-history li {
  padding-left: 3px;
}

.online-tools {
  justify-self: end;
}

.online-tools[open] {
  width: 100%;
}

.online-tools summary {
  margin-left: auto;
}

@keyframes card-arrives {
  from {
    opacity: 0;
    transform: translateY(-14px) rotate(-3deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0);
  }
}

@keyframes deal-card {
  from {
    opacity: 1;
    transform: translate(45vw, -35vh) rotate(16deg) scale(0.72);
  }
}

@keyframes trick-confirm {
  0% {
    opacity: 0;
    transform: translate(-50%, -35%) scale(0.82);
  }
  24%,
  72% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -65%) scale(0.96);
  }
}

@keyframes game-moment {
  0% {
    opacity: 0;
    transform: translate(-50%, -42%) scale(0.75) rotate(-2deg);
  }
  18%,
  70% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -58%) scale(1.04);
  }
}

@keyframes score-bump {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.7);
  }
  22%,
  72% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
  }
}

@keyframes player-score-flash {
  20%,
  60% {
    border-color: #f2c96d;
    box-shadow: 0 0 0 3px rgba(242, 201, 109, 0.24), 0 0 28px rgba(242, 201, 109, 0.24);
  }
}

.played span,
.final-hands article,
.round-events p,
.win-audit article,
.completed-tricks li,
.completed-trick-cards span,
.rule-help,
.explain-box,
.notice {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
}

.explain-box {
  display: grid;
  gap: 4px;
  border-left: 4px solid var(--accent-2);
}

.rule-help {
  color: var(--muted);
  border-left: 4px solid var(--accent);
}

.round-events {
  display: grid;
}

.score-summary {
  display: grid;
  gap: 8px;
}

.score-summary h3 {
  margin: 0;
  font-size: 1rem;
}

.score-event-log {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: score-events;
}

.score-event-log li {
  counter-increment: score-events;
  display: grid;
  grid-template-columns: minmax(90px, 0.8fr) minmax(170px, 1.5fr) auto minmax(130px, auto);
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
}

.score-event-log li::before {
  content: counter(score-events);
  width: 22px;
  height: 22px;
  grid-column: 1;
  grid-row: 1;
  display: grid;
  place-items: center;
  margin-right: 28px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 800;
}

.score-event-log li > strong {
  grid-column: 1;
  grid-row: 1;
  padding-left: 30px;
}

.score-event-log li > span {
  color: var(--muted);
  font-size: 0.78rem;
}

.score-event-log li > b {
  color: #176c53;
  white-space: nowrap;
}

.score-event-log li > small {
  color: var(--muted);
  white-space: nowrap;
}

.score-event-log li:first-child {
  border-top: 0;
}

.score-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.score-breakdown > span {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.72rem;
}

.score-breakdown strong {
  color: var(--text);
  font-size: 0.98rem;
}

@media (max-width: 620px) {
  .score-event-log li {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 8px;
  }

  .score-event-log li::before {
    display: none;
  }

  .score-event-log li > strong {
    grid-column: 1;
    grid-row: auto;
    padding-left: 0;
  }

  .score-event-log li > span {
    grid-column: 1 / -1;
  }

  .score-event-log li > b {
    grid-column: 2;
    grid-row: 1;
  }

  .score-event-log li > small {
    grid-column: 1 / -1;
  }
}

.win-audit {
  display: grid;
}

.win-audit h3,
.round-events h3 {
  width: 100%;
  margin: 0;
  font-size: 1rem;
}

.win-audit article {
  display: grid;
  gap: 3px;
}

.win-audit span {
  color: var(--muted);
}

.notice.error {
  background: #ffe7e2;
}

.room-code {
  margin: 0;
  font-size: clamp(2.8rem, 12vw, 6rem);
  letter-spacing: 0.12em;
}

.room-players {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 24px;
}

.room-players li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.room-player-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.online-lobby {
  align-content: start;
  width: min(820px, 100%);
  margin-inline: auto;
  padding-block: 22px;
}

.lobby-invite {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: clamp(22px, 5vw, 38px);
  color: #f8f1df;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0, rgba(53, 106, 120, 0.8), transparent 54%),
    linear-gradient(145deg, #0d3442, #071f2c 75%);
  border: 5px solid #b17a35;
  outline: 2px solid #563515;
  outline-offset: -8px;
  border-radius: 26px;
  box-shadow: 0 18px 42px rgba(7, 31, 44, 0.28), inset 0 0 38px rgba(0, 0, 0, 0.2);
}

.lobby-invite .eyebrow {
  color: #d8bd83;
}

.lobby-code-label {
  margin: 8px 0 -8px;
  color: #b9cbd0;
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lobby-invite .room-code {
  margin: 0;
  color: #f4d17c;
  font-size: clamp(3.1rem, 14vw, 6.6rem);
  line-height: 1;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  text-shadow: 0 4px 0 #5b3019, 0 0 24px rgba(244, 209, 124, 0.2);
}

.lobby-instruction {
  max-width: 530px;
  margin: 4px 0;
  color: #d7e2e4;
}

.lobby-share-actions {
  justify-content: center;
}

.lobby-share-actions button {
  min-width: 190px;
}

.lobby-share-actions .secondary {
  color: #f8f1df;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.28);
}

.copy-status {
  min-height: 1.25em;
  color: #f2c96d;
  font-size: 0.78rem;
  font-weight: 750;
}

.lobby-rules {
  color: var(--muted);
  text-align: center;
  font-size: 0.8rem;
}

.lobby-rules summary {
  width: fit-content;
  margin-inline: auto;
  padding: 4px;
  cursor: pointer;
  font-weight: 750;
}

.lobby-rules p {
  margin: 6px 0 0;
}

.lobby-players-panel {
  gap: 12px;
}

.lobby-player-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.lobby-player-heading h2 {
  margin: 0;
}

.lobby-player-heading h2 span {
  color: var(--muted);
  font-size: 0.82rem;
}

.readiness-count {
  padding: 6px 9px;
  color: #6f4c18;
  background: #f7e8c8;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}

.readiness-count.complete {
  color: #155d49;
  background: #d9f3e9;
}

.lobby-players-panel .room-players {
  gap: 7px;
  padding: 0;
  list-style: none;
}

.lobby-players-panel .room-players li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 9px 10px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 12px;
}

.lobby-players-panel .room-players li.is-ready {
  background: #e5f3ed;
  border-color: #9fcfbb;
}

.lobby-players-panel .room-players li.is-you {
  box-shadow: inset 4px 0 #b17a35;
}

.lobby-player-token {
  width: 36px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: #173846;
  background: #e5bd6e;
  border: 2px solid #fff2cd;
  border-radius: 50%;
  font-weight: 900;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.14);
}

.lobby-player-name {
  min-width: 0;
  display: grid;
}

.lobby-player-name strong,
.lobby-player-name small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lobby-player-name small {
  color: var(--muted);
  font-size: 0.7rem;
}

.ready-state {
  padding: 5px 8px;
  color: #796a57;
  background: rgba(255, 255, 255, 0.68);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 850;
}

.is-ready .ready-state {
  color: #155d49;
  background: #fff;
}

.lobby-players-panel .room-player-actions {
  grid-column: 2 / -1;
}

.lobby-players-panel .room-player-actions button {
  min-height: 34px;
  padding: 5px 9px;
  font-size: 0.72rem;
}

.lobby-main-actions {
  padding-top: 4px;
}

.lobby-main-actions #online-start,
.lobby-main-actions #online-ready {
  flex: 1 1 180px;
}

.resume-strip {
  width: min(900px, 100%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: #173846;
  border: 1px solid #b17a35;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(7, 31, 44, 0.16);
}

.resume-strip button {
  flex: 1 1 230px;
}

.resume-strip .secondary {
  color: #f8f1df;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.28);
}

.play-path {
  position: relative;
  min-width: 0;
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 8px;
  overflow: hidden;
  padding: 22px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.play-path::after {
  position: absolute;
  content: "";
  width: 150px;
  aspect-ratio: 1;
  top: -78px;
  right: -62px;
  background: rgba(15, 123, 108, 0.08);
  border-radius: 50%;
}

.play-path.online-path {
  color: #f6f1e4;
  background:
    radial-gradient(circle at 100% 0, rgba(56, 108, 121, 0.68), transparent 46%),
    linear-gradient(145deg, #0d3442, #071f2c 76%);
  border-color: #b17a35;
}

.play-path.online-path::after {
  background: rgba(242, 201, 109, 0.1);
}

.play-path h2,
.play-path p {
  margin: 0;
}

.play-path h2 {
  font-family: Georgia, serif;
  font-size: clamp(1.45rem, 4vw, 2rem);
}

.play-path > p:not(.eyebrow) {
  min-height: 3em;
  color: var(--muted);
}

.play-path.online-path > p:not(.eyebrow) {
  color: #c8d7da;
}

.play-path .eyebrow {
  color: #a9702e;
}

.play-path.online-path .eyebrow {
  color: #e0bf7a;
}

.path-symbol {
  color: #b43d2f;
  font-family: Georgia, serif;
  font-size: 2.25rem;
  line-height: 1;
}

.online-path .path-symbol {
  color: #e4b750;
}

.play-path > button,
.play-path > .actions {
  width: 100%;
  margin-top: auto;
}

.online-path .secondary {
  color: #f8f1df;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.28);
}

.home-rules {
  min-height: 38px;
  padding-block: 7px;
}

.entry-header {
  justify-content: flex-start;
}

.entry-header > div {
  display: grid;
  gap: 2px;
}

.entry-header .eyebrow {
  margin: 0;
}

.entry-card {
  gap: 18px;
  padding: clamp(20px, 5vw, 32px);
  border-top: 5px solid #b17a35;
  border-radius: 18px;
}

.entry-intro {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: #d8e4e6;
  background: #173846;
  border-radius: 12px;
}

.entry-intro p {
  margin: 0;
}

.entry-card label span {
  font-size: 0.82rem;
}

.entry-card input {
  font-size: 1rem;
}

.entry-card .room-code-input {
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.entry-submit {
  width: 100%;
}

.local-game {
  align-content: start;
  gap: 14px;
  padding-block: 4px 24px;
}

.local-game-header {
  padding-inline: 4px;
}

.local-game-header h1 {
  font-family: Georgia, serif;
}

.local-table {
  position: relative;
  display: grid;
  gap: 14px;
  padding: clamp(12px, 2.5vw, 22px);
  color: #f8f2df;
  background:
    radial-gradient(circle at 50% 42%, rgba(34, 89, 105, 0.8), transparent 50%),
    linear-gradient(145deg, #0d3442, #071f2c 72%);
  border: 5px solid #b17a35;
  outline: 2px solid #563515;
  outline-offset: -7px;
  border-radius: 28px;
  box-shadow: 0 18px 42px rgba(7, 31, 44, 0.28), inset 0 0 38px rgba(0, 0, 0, 0.22);
}

.local-table .scoreboard {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.local-table .score {
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 70px;
  padding: 9px 10px;
  color: #eef4f4;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: none;
}

.local-table .score.active {
  color: #172b31;
  background: #f4d17c;
  border-color: #fff0bd;
  outline: 2px solid #7a4a1d;
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.25);
}

.local-player-token {
  width: 38px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: #173846;
  background: #e5bd6e;
  border: 2px solid #fff2cd;
  border-radius: 50%;
  font-weight: 900;
}

.score.active .local-player-token {
  color: #f9ecd0;
  background: #173846;
  border-color: #567783;
}

.local-player-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.local-player-copy strong,
.local-player-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.local-table .local-player-copy small {
  color: #b9cbd0;
  font-size: 0.68rem;
}

.local-table .score.active .local-player-copy small {
  color: #5b4b30;
}

.local-player-score {
  display: grid;
  justify-items: end;
  font-family: Georgia, serif;
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 0.9;
}

.local-player-score small {
  color: inherit;
  font-family: system-ui, sans-serif;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.local-action-zone {
  display: grid;
  place-items: center;
  min-height: 310px;
  padding: clamp(0px, 1vw, 8px);
}

.local-action-zone > .panel {
  width: min(820px, 100%);
}

.local-action-panel {
  color: var(--text);
  background: linear-gradient(180deg, #fffdf8, #f5ead5);
  border: 1px solid rgba(171, 116, 42, 0.7);
  border-radius: 18px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
}

.local-hand-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.local-hand-heading h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(1.35rem, 4vw, 1.85rem);
}

.local-hand-panel > p:not(.rule-help) {
  text-align: center;
}

.local-card-fan {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(5px, 1vw, 10px);
  min-height: 150px;
  padding: 14px 8px 4px;
}

.local-card-fan .card {
  --fan-angle: 0deg;
  --fan-y: 0px;
  width: min(172px, calc((100% - 40px) / 5));
  flex: 0 1 172px;
  transform: translateY(var(--fan-y)) rotate(var(--fan-angle));
  transform-origin: 50% 115%;
}

.local-card-fan .card:nth-child(1) {
  --fan-angle: -4deg;
  --fan-y: 6px;
}

.local-card-fan .card:nth-child(2) {
  --fan-angle: -2deg;
  --fan-y: 2px;
}

.local-card-fan .card:nth-child(4) {
  --fan-angle: 2deg;
  --fan-y: 2px;
}

.local-card-fan .card:nth-child(5) {
  --fan-angle: 4deg;
  --fan-y: 6px;
}

.local-card-fan .card.selected,
.local-card-fan .card[aria-pressed="true"] {
  transform: translateY(calc(var(--fan-y) - 24px)) scale(1.04) rotate(var(--fan-angle));
}

.local-card-fan .card.arrange-selected {
  transform: translateY(calc(var(--fan-y) - 28px)) scale(1.04) rotate(var(--fan-angle));
}

.local-card-fan .card:disabled {
  transform: translateY(var(--fan-y)) rotate(var(--fan-angle));
}

.local-action-panel > .actions {
  justify-content: center;
}

.local-action-panel > .actions button {
  flex: 1 1 180px;
}

.local-trick {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(13, 52, 66, 0.08);
  border: 1px dashed rgba(13, 52, 66, 0.3);
  border-radius: 12px;
}

.local-trick .eyebrow {
  color: #795523;
}

.local-trick .played {
  justify-content: center;
}

.completed-tricks {
  display: grid;
  gap: 8px;
  padding: 12px;
  color: var(--text);
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid rgba(171, 116, 42, 0.6);
  border-radius: 16px;
}

.completed-tricks-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.completed-tricks-heading .eyebrow,
.completed-tricks-heading strong {
  margin: 0;
}

.completed-tricks ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.completed-tricks li {
  display: grid;
  gap: 6px;
  background: #fff8e8;
}

.completed-tricks li > span {
  color: var(--muted);
  font-size: 0.78rem;
}

.completed-trick-cards span {
  padding-block: 7px;
  background: #fffdf8;
  border: 1px solid var(--line);
}

.round-result-panel {
  width: min(900px, 100%) !important;
}

.computer-turn {
  justify-items: center;
  text-align: center;
}

.computer-chip {
  width: 58px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: #f4d17c;
  background: #173846;
  border: 3px double #b17a35;
  border-radius: 50%;
  font-size: 1.8rem;
}

.history {
  padding: 12px 14px;
}

.history p {
  margin: 10px 0 0;
}

.handoff {
  width: min(620px, 100%);
  min-height: calc(100vh - 36px);
  justify-items: center;
  margin-inline: auto;
  padding: clamp(24px, 6vw, 54px);
  color: #f8f1df;
  text-align: center;
  background:
    radial-gradient(circle at 50% 28%, rgba(53, 106, 120, 0.82), transparent 42%),
    linear-gradient(145deg, #0d3442, #071f2c 76%);
  border: 5px solid #b17a35;
  outline: 2px solid #563515;
  outline-offset: -8px;
  border-radius: 28px;
  box-shadow: 0 18px 42px rgba(7, 31, 44, 0.3), inset 0 0 38px rgba(0, 0, 0, 0.22);
}

.handoff .eyebrow {
  color: #e0bf7a;
}

.handoff h1 {
  max-width: 500px;
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(1.8rem, 6vw, 3rem);
}

.handoff-privacy {
  max-width: 420px;
  margin: 0;
  color: #c8d7da;
}

.handoff #show-hand {
  min-width: min(360px, 100%);
  background: #c94737;
  border-color: #ed8b72;
}

.handoff-card-backs {
  height: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.handoff-card-backs i {
  width: 78px;
  aspect-ratio: 0.68;
  margin-inline: -18px;
  background:
    repeating-linear-gradient(45deg, transparent 0 6px, rgba(255, 255, 255, 0.16) 6px 8px),
    #8d251f;
  border: 5px double #f2d48c;
  border-radius: 8px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.handoff-card-backs i:first-child {
  transform: rotate(-10deg) translateY(8px);
}

.handoff-card-backs i:last-child {
  transform: rotate(10deg) translateY(8px);
}

.review-screen {
  text-align: center;
}

.review-message {
  max-width: 620px;
  margin: 0 auto;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 1.15rem;
  font-weight: 750;
}

.trick-review-screen {
  justify-items: center;
}

.trick-review-screen h1 {
  margin: 0;
  font-family: Georgia, serif;
}

.trick-review-cards {
  width: min(680px, 100%);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.trick-review-cards article {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 14px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.trick-review-cards article.winner {
  background: #fff1c9;
  border-color: #b17a35;
  box-shadow: 0 0 0 3px rgba(242, 201, 109, 0.28), var(--shadow);
}

.trick-review-cards .card-label {
  font-size: clamp(1.8rem, 8vw, 3.2rem);
}

.exchange-review-screen {
  justify-items: center;
}

.exchange-review-screen h1 {
  margin: 0;
  font-family: Georgia, serif;
}

.exchange-reveal-fan {
  width: min(760px, 100%);
}

.exchange-reveal-fan .is-replacement-card {
  border-color: #b17a35;
  box-shadow: 0 0 0 3px rgba(242, 201, 109, 0.26), 0 5px 14px rgba(31, 42, 46, 0.14);
}

.exchange-back-card {
  color: transparent !important;
  background:
    linear-gradient(rgba(1, 10, 18, 0.14), rgba(1, 10, 18, 0.24)),
    url("../../assets/cards/back-royal-v2.jpg") center / cover,
    #031722;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 4px #f2d493,
    inset 0 0 0 7px #174c67;
}

.exchange-back-card > * {
  display: none !important;
}

.exchange-concealed-card {
  color: transparent !important;
  border-color: #d3aa65;
  background:
    linear-gradient(rgba(1, 10, 18, 0.14), rgba(1, 10, 18, 0.24)),
    url("../../assets/cards/back-royal-v2.jpg") center / cover,
    #031722;
  box-shadow:
    inset 0 0 0 4px #f2d493,
    inset 0 0 0 7px #174c67,
    0 5px 14px rgba(5, 24, 36, 0.28);
}

.exchange-concealed-card > * {
  visibility: hidden;
}

.exchange-concealed-card::before,
.exchange-concealed-card::after {
  content: none;
}

.computer-turn {
  border-left: 4px solid var(--focus);
}

.pause-toggle {
  max-width: 420px;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  max-width: min(92vw, 520px);
  padding: 12px 14px;
  background: #1f2a2e;
  color: #fff;
  border-radius: 8px;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: no-preference) {
  .card,
  #toast {
    transition: transform 160ms ease, opacity 160ms ease, border-color 160ms ease;
  }

  .online-hand.is-active .card:not(:disabled):hover {
    transform: translateY(calc(var(--fan-y) - 8px)) rotate(var(--fan-angle));
  }

  .online-hand.is-active .card.selected:hover {
    transform: translateY(calc(var(--fan-y) - 14px)) rotate(var(--fan-angle));
  }

  .online-hand.is-active .card.arrange-selected:hover {
    transform: translateY(calc(var(--fan-y) - 28px)) scale(1.04) rotate(var(--fan-angle));
  }

  .local-card-fan .card:not(:disabled):hover {
    transform: translateY(calc(var(--fan-y) - 8px)) rotate(var(--fan-angle));
  }

  .local-card-fan .card.selected:hover {
    transform: translateY(calc(var(--fan-y) - 14px)) rotate(var(--fan-angle));
  }

  .local-card-fan .card.arrange-selected:hover {
    transform: translateY(calc(var(--fan-y) - 28px)) scale(1.04) rotate(var(--fan-angle));
  }

  .online-card-fan.is-sneaking .card,
  .local-card-fan.is-sneaking .card {
    animation: sneak-card 1250ms cubic-bezier(0.2, 0.76, 0.2, 1) both;
  }

  .exchange-reveal-fan.is-exchange-revealing .is-replacement-card {
    animation: exchange-card-reveal 1350ms cubic-bezier(0.2, 0.76, 0.2, 1) both;
  }

  .online-card-fan.is-sorting .card,
  .local-card-fan.is-sorting .card {
    animation: sort-card-settle 360ms cubic-bezier(0.2, 0.78, 0.25, 1) both;
  }

  .online-card-fan:is(.is-sneaking, .is-sorting) .card:nth-child(2),
  .local-card-fan:is(.is-sneaking, .is-sorting) .card:nth-child(2) {
    animation-delay: 220ms;
  }

  .online-card-fan:is(.is-sneaking, .is-sorting) .card:nth-child(3),
  .local-card-fan:is(.is-sneaking, .is-sorting) .card:nth-child(3) {
    animation-delay: 440ms;
  }

  .online-card-fan:is(.is-sneaking, .is-sorting) .card:nth-child(4),
  .local-card-fan:is(.is-sneaking, .is-sorting) .card:nth-child(4) {
    animation-delay: 660ms;
  }

  .online-card-fan:is(.is-sneaking, .is-sorting) .card:nth-child(5),
  .local-card-fan:is(.is-sneaking, .is-sorting) .card:nth-child(5) {
    animation-delay: 880ms;
  }

  .exchange-reveal-fan.is-exchange-revealing .card:nth-child(2) {
    animation-delay: 360ms;
  }

  .exchange-reveal-fan.is-exchange-revealing .card:nth-child(3) {
    animation-delay: 720ms;
  }

  .exchange-reveal-fan.is-exchange-revealing .card:nth-child(4) {
    animation-delay: 1080ms;
  }

  .exchange-reveal-fan.is-exchange-revealing .card:nth-child(5) {
    animation-delay: 1440ms;
  }

  .online-card-fan.is-dealt .card {
    animation: deal-card 360ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
  }

  .online-card-fan.is-dealt .card:nth-child(2) {
    animation-delay: 55ms;
  }

  .online-card-fan.is-dealt .card:nth-child(3) {
    animation-delay: 110ms;
  }

  .online-card-fan.is-dealt .card:nth-child(4) {
    animation-delay: 165ms;
  }

  .online-card-fan.is-dealt .card:nth-child(5) {
    animation-delay: 220ms;
  }
}

@keyframes sneak-card {
  0% {
    opacity: 1;
    clip-path: inset(82% 0 0 round 8px);
    transform: translateY(calc(var(--fan-y) + 46px)) rotate(var(--fan-angle));
  }
  46% {
    opacity: 1;
    clip-path: inset(42% 0 0 round 8px);
    transform: translateY(calc(var(--fan-y) + 18px)) rotate(var(--fan-angle));
  }
  78% {
    clip-path: inset(0 round 8px);
    transform: translateY(calc(var(--fan-y) - 7px)) rotate(var(--fan-angle));
  }
  100% {
    clip-path: inset(0 round 8px);
    transform: translateY(var(--fan-y)) rotate(var(--fan-angle));
  }
}

@keyframes exchange-card-reveal {
  0% {
    opacity: 1;
    clip-path: inset(100% 0 0 round 8px);
    transform: translateY(calc(var(--fan-y) + 58px)) rotate(calc(var(--fan-angle) - 2deg));
  }
  38% {
    opacity: 1;
    clip-path: inset(58% 0 0 round 8px);
    transform: translateY(calc(var(--fan-y) + 26px)) rotate(var(--fan-angle));
  }
  74% {
    clip-path: inset(0 round 8px);
    transform: translateY(calc(var(--fan-y) - 8px)) rotate(var(--fan-angle));
  }
  100% {
    opacity: 1;
    clip-path: inset(0 round 8px);
    transform: translateY(var(--fan-y)) rotate(var(--fan-angle));
  }
}

@keyframes sort-card-settle {
  0% {
    opacity: 1;
    transform: translateY(calc(var(--fan-y) + 12px)) scale(0.94) rotate(var(--fan-angle));
  }
  100% {
    opacity: 1;
    transform: translateY(var(--fan-y)) scale(1) rotate(var(--fan-angle));
  }
}

@media (prefers-reduced-motion: reduce) {
  .table-play {
    animation: none;
  }

  .trick-confirmation {
    display: none;
  }

  .game-moment,
  .player-score em {
    display: none;
  }

  .table-player.score-changed {
    animation: none;
  }
}

@media (max-width: 520px) {
  .player-row {
    grid-template-columns: 1fr;
  }

  .hand {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  .card {
    min-height: 86px;
    padding: 5px;
  }

  .card strong {
    font-size: 1.45rem;
  }

  .card span {
    font-size: 0.9rem;
  }

  .card small {
    font-size: 0.62rem;
  }

  .local-game {
    gap: 10px;
  }

  .local-table {
    padding: 9px;
    border-width: 4px;
    border-radius: 20px;
  }

  .local-table .scoreboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .local-table .score {
    min-height: 58px;
    padding: 6px;
  }

  .local-player-token {
    width: 29px;
  }

  .local-player-score {
    font-size: 1.1rem;
  }

  .local-player-copy small {
    font-size: 0.6rem;
  }

  .local-action-zone {
    min-height: 270px;
    padding: 0;
  }

  .local-action-panel {
    padding: 12px 9px;
    border-radius: 14px;
  }

  .local-card-fan {
    justify-content: flex-start;
    min-height: 112px;
    padding-inline: 4px;
    overflow: hidden;
  }

  .local-card-fan.is-sneaking,
  .local-card-fan.exchange-reveal-fan.is-exchange-revealing {
    min-height: 132px;
    padding-bottom: 18px;
    overflow: visible;
  }

  .local-card-fan .card {
    width: clamp(68px, 24vw, 92px);
    min-width: clamp(68px, 24vw, 92px);
    flex-basis: clamp(68px, 24vw, 92px);
  }

  .local-card-fan .card + .card {
    margin-left: clamp(-32px, -7vw, -22px);
  }

  .local-card-fan .card:nth-child(1) {
    --fan-angle: -3deg;
  }

  .local-card-fan .card:nth-child(2) {
    --fan-angle: -1.5deg;
  }

  .local-card-fan .card:nth-child(4) {
    --fan-angle: 1.5deg;
  }

  .local-card-fan .card:nth-child(5) {
    --fan-angle: 3deg;
  }

  .handoff {
    min-height: calc(100vh - 24px);
    padding-inline: 16px;
    border-width: 4px;
    border-radius: 20px;
  }

  .online-game {
    gap: 10px;
  }

  .online-game-header {
    align-items: flex-start;
  }

  .turn-pill {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .online-table {
    padding: 9px;
    border-width: 4px;
    border-radius: 20px;
  }

  .player-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .table-player {
    padding: 6px;
  }

  .player-token {
    width: 28px;
  }

  .player-details small,
  .card-count {
    font-size: 0.62rem;
  }

  .player-score {
    font-size: 1rem;
  }

  .table-felt {
    min-height: 190px;
    padding-inline: 5px;
  }

  .table-plays {
    gap: 5px;
  }

  .online-trick-card {
    width: clamp(52px, 16vw, 68px);
  }

  .online-trick-card .card {
    min-height: 82px;
  }

  .online-action-panel.waiting {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .online-action-panel.compact-action {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .online-action-panel.compact-action .actions {
    justify-content: stretch;
  }

  .online-action-panel.compact-action .actions button {
    flex: 1 1 130px;
  }

  .online-hand {
    bottom: 4px;
    padding: 10px 8px;
  }

  .online-card-fan {
    justify-content: flex-start;
    min-height: 112px;
    padding-inline: 4px;
    overflow: hidden;
  }

  .online-card-fan.is-sneaking,
  .online-card-fan.exchange-reveal-fan.is-exchange-revealing {
    min-height: 132px;
    padding-bottom: 18px;
    overflow: visible;
  }

  .online-card-fan .card {
    width: clamp(68px, 24vw, 92px);
    min-width: clamp(68px, 24vw, 92px);
    flex-basis: clamp(68px, 24vw, 92px);
  }

  .online-card-fan .card + .card {
    margin-left: clamp(-32px, -7vw, -22px);
  }

  .online-card-fan .card:nth-child(1) {
    --fan-angle: -3deg;
  }

  .online-card-fan .card:nth-child(2) {
    --fan-angle: -1.5deg;
  }

  .online-card-fan .card:nth-child(4) {
    --fan-angle: 1.5deg;
  }

  .online-card-fan .card:nth-child(5) {
    --fan-angle: 3deg;
  }

  .online-hand-heading {
    align-items: flex-start;
    margin-bottom: 6px;
  }

  .online-hand-heading,
  .local-hand-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .hand-tools {
    width: 100%;
    gap: 6px;
    justify-content: flex-start;
  }

  .hand-tools-hint {
    text-align: left;
  }

  .hand-arrange-actions {
    justify-content: stretch;
  }

  .hand-arrange-actions button {
    flex: 1 1 0;
  }

  .hand-tools > button,
  .hand-arrange-actions button {
    min-height: 42px;
    padding-inline: 10px;
    font-size: 0.76rem;
  }

  .online-hand-heading .rule-help {
    padding: 6px 8px;
    font-size: 0.72rem;
  }

  .journal-latest strong {
    white-space: normal;
  }

  .online-tools,
  .online-tools[open] {
    width: 100%;
  }

  .online-utility-actions button {
    flex: 1 1 140px;
  }

  .online-lobby {
    padding-block: 0 18px;
  }

  .lobby-invite {
    padding: 22px 12px;
    border-width: 4px;
    border-radius: 18px;
  }

  .lobby-invite .room-code {
    font-size: clamp(2.65rem, 15vw, 4.5rem);
    letter-spacing: 0.1em;
    text-indent: 0.1em;
  }

  .lobby-share-actions {
    width: 100%;
  }

  .lobby-share-actions button {
    min-width: 0;
    flex: 1 1 100%;
  }

  .lobby-player-heading {
    align-items: flex-start;
  }

  .lobby-players-panel .room-players li {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .lobby-main-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .lobby-main-actions #online-start,
  .lobby-main-actions #online-ready,
  .lobby-main-actions > span {
    grid-column: 1 / -1;
  }
}

/* Kortfärgerna ska alltid vinna över den omgivande komponentens dekorfärg. */
.suit-symbol.suit-red {
  color: #b42318;
}

.suit-symbol.suit-black {
  color: #111827;
}
.account-navigation { padding: 16px; text-align: center; }
.account-navigation a { color: inherit; text-decoration: underline; }
.demo-navigation { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding: 10px 18px; background: #153e34; color: #f4f6f3; border-bottom: 2px solid #ddba73; font-size: 14px; }
.demo-navigation a { color: #ddba73; padding: 6px 0; font-weight: 700; }
.demo-navigation a:focus-visible { outline: 2px solid #ddba73; outline-offset: 3px; }
body[data-demo] .hero-art { max-width: 360px; }
.trick-player-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 12px; width: min(680px, 100%); margin-inline: auto; }
.trick-player { display: grid; grid-template-rows: auto 136px auto; justify-items: center; align-items: start; gap: 8px; min-width: 0; padding: 8px 0; border-bottom: 3px solid transparent; }
.trick-player-name { font-size: 15px; text-align: center; overflow-wrap: anywhere; max-width: 100%; }
.trick-player .trick-card-face, .trick-card-placeholder { width: 92px; max-width: 100%; height: 136px; min-height: 0; border-radius: 6px; }
.trick-player .trick-card-face { opacity: 1; transform: none; cursor: default; }
.trick-card-placeholder { border: 1px dashed #91a79c; background: #ffffff0d; }
.trick-play-status { font-size: 13px; text-align: center; overflow-wrap: anywhere; }
.trick-winner { border-bottom-color: #ad741e; }
.trick-winner .trick-card-face { border-color: #ad741e; box-shadow: 0 0 0 2px #ddba73; }
.trick-winner .trick-play-status { font-weight: 800; color: #76500e; }
.trick-totals { text-align: center; font-weight: 650; overflow-wrap: anywhere; }
.computer-turn .local-trick { width: 100%; grid-column: 1 / -1; }
@media (max-width: 540px) {
  .trick-player-grid { gap: 8px; }
  .trick-player { grid-template-rows: auto 112px auto; }
  .trick-player .trick-card-face, .trick-card-placeholder { width: 76px; height: 112px; }
  .trick-player-name { font-size: 13px; }
  .trick-player .card small { font-size: 10px; }
}
.hand-sort-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); flex: 0 1 190px; gap: 0; pointer-events: auto; }
.hand-sort-quick button { min-width: 0; min-height: 44px; padding: 7px 6px; font-size: 13px; border-radius: 0; background: #f4f7f5; color: #173f35; border: 1px solid #8aa79a; overflow-wrap: anywhere; }
.hand-sort-quick button:first-child { border-radius: 4px 0 0 4px; }
.hand-sort-quick button:last-child { border-radius: 0 4px 4px 0; }
.hand-sort-quick button[aria-pressed="true"] { background: #ddba73; color: #173f35; border-color: #ddba73; box-shadow: inset 0 -3px 0 #76500e; }
.hand-sort-quick button:hover:not(:disabled) { background: #e4eee8; color: #173f35; }
.hand-sort-quick button:disabled { opacity: .5; }
