:root {
  --font-ui: Chewy, "Trebuchet MS", sans-serif;
  font-family: var(--font-ui);
  color: #ece7d8;
  background: #102421;
  font-synthesis: none;
  --ink: #eee8d9;
  --muted: #a7b7a9;
  --gold: #e7be72;
  --line: #ffffff20;
  --felt: #21463b;
  --serif: var(--font-ui);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(ellipse at 50% 10%, #233b31 0, transparent 70%), #102421;
}
button,
input,
select {
  font: inherit;
}
button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -3px;
}
button {
  color: inherit;
}
h1,
h2,
p {
  margin: 0;
}
h1,
h2 {
  font-family: var(--serif);
  font-weight: normal;
}
.app-shell {
  max-width: 1300px;
  margin: 0 auto;
  padding: 25px 44px 0;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.brand {
  display: flex;
  gap: 15px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  display: block;
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  background: url("../assets/brand/cafe-con-cartas.webp") center / contain no-repeat;
}
.brand-title, .brand-subtitle { display: block; }
.brand-subtitle { margin-top: .12em; font-size: .48em; line-height: 1.2; }
.eyebrow {
  display: block;
  font-size: 9px;
  letter-spacing: 0.23em;
  font-weight: 650;
  color: var(--gold);
}
h1 {
  font-size: 34px;
  line-height: 1.05;
  margin-top: 5px;
  letter-spacing: -0.02em;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.local-badge {
  font-size: 11px;
  color: var(--muted);
  margin-right: 14px;
  display: flex;
  gap: 7px;
  align-items: center;
}
.local-badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a9c791;
}
.button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 7px;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  min-height: 39px;
  transition:
    background 0.18s,
    transform 0.18s;
}
.button:hover:not(:disabled) {
  background: #ffffff10;
  transform: translateY(-1px);
}
.button.light {
  background: #eee8d8;
  color: #20372f;
  border-color: #eee8d8;
}
.button.light:hover {
  background: #fff8e6;
}
.button.light span {
  margin-left: 17px;
}
.button.gold {
  background: var(--gold);
  border-color: var(--gold);
  color: #28372d;
}
.button.gold:hover:not(:disabled) {
  background: #f6d693;
}
.button:disabled {
  opacity: 0.32;
}
.text-button {
  border: 0;
  background: none;
  padding: 7px 0;
  font-size: 11px;
  color: #c8d1c1;
}
.text-button:hover:not(:disabled) {
  color: var(--gold);
}
.game-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin: -8px 0 12px;
}
.game-navigation .text-button {
  min-height: 36px;
}
.game-navigation > span {
  font-size: 10px;
  color: var(--muted);
}
.game {
  border: 1px solid #9caf8050;
  border-radius: 20px;
  padding: 18px 32px 12px;
  background:
    radial-gradient(ellipse at 50% 45%, #32634b88, transparent 75%),
    repeating-linear-gradient(
      0deg,
      #ffffff02 0,
      #ffffff02 1px,
      transparent 1px,
      transparent 3px
    ),
    #1b3e33;
  box-shadow:
    inset 0 0 70px #051f2860,
    0 20px 55px #00000018;
  position: relative;
}
.game:before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid #bbbe8118;
  border-radius: 15px;
  pointer-events: none;
}
.table-topline,
.table-bottomline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 9px;
  letter-spacing: 0.16em;
  color: #acbba6;
  position: relative;
}
.opponents {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(18px, 5vw, 80px);
  row-gap: 4px;
  margin: 17px 0 12px;
}
.opponent {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  padding: 8px 7px 12px;
  border-bottom: 2px solid transparent;
  min-width: 160px;
}
.opponent.active {
  border-color: var(--gold);
}
.avatar {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 20px var(--serif);
  background: #9b7766;
  color: #fff0dc;
  border: 1px solid #ffffff20;
}
.avatar[data-avatar-kind="parts"] { color: transparent; }
.avatar-2 {
  background: #647d91;
}
.avatar-3 {
  background: #8b8960;
}
.avatar-4 {
  background: #756385;
}
.avatar-5 {
  background: #5d8980;
}
.opponent.active .avatar {
  border-color: var(--gold);
}
.opponent-detail strong {
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.cpu-badge {
  font-size: 7px;
  letter-spacing: 0.08em;
  font-weight: 500;
  color: #bbcab8;
  border: 1px solid #bbcab83a;
  padding: 2px 3px;
  border-radius: 3px;
}
.opponent-count {
  display: block;
  font-size: 10px;
  color: #b0c2ac;
  margin-top: 5px;
  white-space: nowrap;
}
.mini-hand {
  display: flex;
  margin-left: 7px;
  padding-left: 8px;
}
.card-back {
  width: 18px;
  height: 27px;
  border: 0;
  border-radius: 3px;
  background: var(--card-back-image) center / 100% 100% no-repeat;
  box-shadow: 0 2px 3px #0003;
  margin-left: -10px;
  transform: rotate(9deg);
}
.table-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  font-size: 8px;
  letter-spacing: 0.22em;
  color: #9fb29a;
  margin: 3px auto 15px;
  max-width: 850px;
}
.line {
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, #b5c09a33, transparent);
}
.table-flower {
  font-size: 12px;
  color: #c0ba8a;
}
.foundations {
  max-width: 940px;
  margin: 0 auto;
  display: grid;
  gap: 8px;
}
.foundation {
  display: grid;
  grid-template-columns: 81px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}
.suit-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--serif);
  font-size: 14px;
  color: #dbdfc8;
}
.suit-label .suit-art {
  width: 27px;
  height: 27px;
}
.card-slots {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 7px;
}
.card-slot {
  width: 100%;
  max-width: 63px;
  aspect-ratio: 110/156;
  border-radius: 5px;
  background: #08291e1c;
  border: 1px solid #bcd3ac17;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: #bbcca642;
  font-family: var(--serif);
  font-size: 18px;
}
.card-slot.anchor {
  border-color: #d7c58355;
  background: #d8c78408;
}
.card-slot.anchor .slot-rank {
  position: absolute;
  top: 5px;
  left: 7px;
  font-size: 13px;
  color: #d3c99580;
}
.slot-suit {
  width: 30px;
  opacity: 0.2;
}
.slot-suit .suit-art {
  width: 100%;
}
.card-slot.filled {
  border: 0;
  box-shadow: 0 3px 6px #08291e55;
}
.card-slot > .card-art {
  display: block;
  width: 100%;
  height: 100%;
}
.just-played {
  animation: placed 0.4s ease-out;
}
.table-bottomline {
  font-size: 11px;
  letter-spacing: 0;
  margin-top: 13px;
  min-height: 30px;
}
.table-bottomline > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.controller {
  padding: 23px 10px 4px;
}
.hand-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 17px;
  gap: 10px;
}
.human-identity {
  display: flex;
  align-items: center;
  gap: 11px;
}
.human-avatar {
  background: #253a31;
  font: 10px var(--font-ui);
  letter-spacing: 0.06em;
  color: #d8dabf;
}
.hand-heading h2 {
  font-size: 22px;
}
.hand-actions {
  display: flex;
  gap: 8px;
}
.hand {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 0 3px;
  min-height: 145px;
}
.hand-card {
  width: clamp(59px, 6.45vw, 84px);
  padding: 0;
  border: 0;
  background: none;
  position: relative;
  transition: transform 0.2s;
  flex: 0 0 auto;
  border-radius: 7px;
}
.hand-card > .card-art {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 7px;
  box-shadow: 0 5px 12px #0004;
  filter: brightness(0.82);
}
.hand-card.playable > .card-art {
  filter: none;
}
.hand-card.playable:after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  left: calc(50% - 2.5px);
  bottom: -3px;
}
.hand-card.playable:hover,
.hand-card.hinted {
  transform: translateY(-10px);
}
.hand-card.hinted > .card-art {
  outline: 2px dashed var(--gold);
  outline-offset: -2px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.error {
  background: #6a332b;
  color: #ffdfbf;
  padding: 12px;
  border-radius: 7px;
  margin-top: 12px;
  font-size: 13px;
}
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 1px solid #b8c9a518;
  margin-top: 19px;
  padding: 12px 10px 18px;
  color: #8f9f90;
  font: italic 12px var(--serif);
}
.footer-controls {
  display: flex;
  gap: 13px;
  align-items: center;
  font: 10px var(--font-ui);
}
.footer-controls select {
  font-size: 10px;
  color: #c7d0ba;
  background: #182d25;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px;
}
.footer-controls #turn-number {
  border-left: 1px solid var(--line);
  padding-left: 13px;
  font-size: 9px;
  letter-spacing: 0.08em;
}
dialog {
  color: #ebe5d4;
  background: #1b322b;
  border: 1px solid #a2ad7960;
  border-radius: 17px;
  width: min(470px, calc(100% - 28px));
  max-height: 85dvh;
  padding: 27px;
  box-shadow: 0 30px 100px #0008;
}
dialog::backdrop {
  background: #061a17bb;
  backdrop-filter: blur(5px);
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.close-button {
  padding: 0;
  background: none;
  border: 0;
  font-size: 26px;
  color: #c2c9b5;
  width: 32px;
  height: 32px;
}
dialog h2 {
  font-size: 29px;
  line-height: 1.2;
  margin-bottom: 14px;
}
dialog p {
  font-size: 13px;
  line-height: 1.6;
  color: #c1cbb7;
  margin-bottom: 20px;
}
dialog label {
  display: block;
  font-size: 12px;
  margin: 17px 0 7px;
}
dialog input,
dialog select {
  width: 100%;
  padding: 11px;
  border: 1px solid #b5bb9833;
  border-radius: 6px;
  color: #e5e6d3;
  background: #11271f;
}
dialog .small {
  font-size: 11px;
  color: #a8b99c;
  line-height: 1.6;
  margin: 13px 0 20px;
  overflow-wrap: anywhere;
}
.muted {
  color: #99aa90;
}
.wide {
  width: 100%;
  margin-top: 8px;
}
.rules-list {
  padding-left: 22px;
  font-size: 14px;
  line-height: 1.6;
  color: #c5cfba;
}
.rules-list li {
  padding-left: 5px;
  margin-bottom: 16px;
}
.rules-list strong {
  display: block;
  margin-bottom: 3px;
  font-size: 16px;
  font-weight: 400;
  color: #ede6d1;
}
.rank-guide {
  font-family: var(--serif);
  padding: 13px;
  text-align: center;
  background: #ffffff06;
  border-radius: 6px;
  font-size: 16px;
}
.rank-guide b {
  color: var(--gold);
}
.history {
  padding: 0;
  list-style: none;
  font-size: 12px;
  line-height: 1.6;
  max-height: 45vh;
  overflow-y: auto;
}
.history li {
  padding: 10px;
  border-top: 1px solid var(--line);
}
.result-emblem {
  font-size: 53px;
  color: var(--gold);
  text-align: center;
  margin: 10px;
}
.result-scores {
  margin-bottom: 16px;
}
.score-row {
  display: flex;
  justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.score-row span {
  color: #c4cbb6;
}
#result-dialog h2,
#result-copy {
  text-align: center;
}
@keyframes placed {
  from {
    transform: translateY(-12px) scale(0.94);
    opacity: 0.4;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
@media (min-width: 1450px) {
  .app-shell {
    padding-top: 34px;
  }
  .game {
    padding-top: 21px;
    padding-bottom: 17px;
  }
  .card-slot {
    max-width: 68px;
  }
  .foundations {
    gap: 11px;
  }
  .hand {
    gap: 13px;
  }
  .hand-card {
    width: 89px;
  }
}
@media (max-width: 1050px) {
  .app-shell {
    padding: 20px 24px 0;
  }
  .mini-hand {
    display: none;
  }
  .opponents {
    gap: 25px;
  }
  .opponent {
    min-width: 125px;
  }
  .game {
    padding: 17px 22px 10px;
  }
  .foundation {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 8px;
  }
  .card-slots {
    gap: 5px;
  }
  .hand {
    gap: 8px;
  }
  .hand-card {
    width: 65px;
  }
}
@media (max-width: 700px) {
  .app-shell {
    padding: 17px 12px 0;
  }
  .topbar {
    margin-bottom: 18px;
  }
  .brand {
    gap: 10px;
  }
  .brand-mark {
    width: 62px;
    height: 62px;
  }
  h1 {
    font-size: 27px;
  }
  .eyebrow {
    font-size: 7px;
  }
  .top-actions {
    gap: 7px;
  }
  .top-actions .button {
    font-size: 10px;
    padding: 8px 10px;
    min-height: 35px;
  }
  .top-actions .light span,
  .local-badge {
    display: none;
  }
  .game {
    padding: 14px 12px 9px;
    border-radius: 14px;
  }
  .table-topline {
    font-size: 7px;
    letter-spacing: 0.12em;
  }
  .opponents {
    gap: 7px;
    flex-wrap: wrap;
    margin: 13px 0 7px;
  }
  .opponent {
    min-width: 0;
    gap: 6px;
    padding: 6px 5px 8px;
  }
  .avatar {
    width: 29px;
    height: 29px;
    font-size: 16px;
  }
  .opponent-detail strong {
    font-size: 11px;
    gap: 4px;
  }
  .cpu-badge {
    font-size: 6px;
    padding: 1px 2px;
  }
  .opponent-count {
    font-size: 8px;
  }
  .table-heading {
    margin-bottom: 11px;
    font-size: 7px;
  }
  .foundations {
    gap: 7px;
  }
  .foundation {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 7px;
  }
  .suit-label {
    justify-content: center;
  }
  .suit-label span {
    display: none;
  }
  .suit-label .suit-art {
    width: 23px;
    height: 23px;
  }
  .card-slots {
    gap: 3px;
  }
  .card-slot {
    border-radius: 3px;
    font-size: 13px;
  }
  .card-slot.anchor .slot-rank {
    top: 3px;
    left: 4px;
    font-size: 9px;
  }
  .slot-suit {
    width: 16px;
  }
  .table-bottomline {
    margin-top: 9px;
    font-size: 9px;
  }
  .table-bottomline .text-button {
    font-size: 9px;
    white-space: nowrap;
  }
  .controller {
    padding: 20px 3px 0;
  }
  .hand-heading {
    margin-bottom: 12px;
  }
  .human-avatar {
    width: 32px;
    height: 32px;
  }
  .hand-heading h2 {
    font-size: 20px;
  }
  .hand-actions {
    gap: 5px;
  }
  .hand-actions .button {
    font-size: 10px;
    padding: 8px 10px;
    min-height: 35px;
  }
  .hand {
    gap: 12px 9px;
    min-height: 105px;
  }
  .hand-card {
    width: 57px;
  }
  .footer {
    margin-top: 17px;
    padding: 12px 0 16px;
  }
  .footer > span {
    display: none;
  }
  .footer-controls {
    width: 100%;
    justify-content: flex-end;
    gap: 10px;
  }
  dialog {
    padding: 23px;
  }
  dialog h2 {
    font-size: 27px;
  }
  .human-identity {
    gap: 7px;
  }
}
.table-action { text-align: center; }
.table-action:has(button:not([hidden])) { margin-top: 18px; }
.mona-table { max-width: 780px; margin: 0 auto; color: #e9e3d2; }
.mona-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 12px; color: #e5bd70; }
.mona-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 18px; text-align: center; }
.mona-layout h3 { font-family: inherit; font-size: 15px; font-weight: 500; line-height: 1.5; margin: 0 0 14px; }
.mona-layout p, .mona-out { font-size: 12px; line-height: 1.6; }
.mona-discarded { border-left: 1px solid #ffffff26; }
.mona-fan, .mona-pair { min-height: 108px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.mona-fan .card-back { display: block; width: 65px; height: 91px; flex: 0 0 65px; margin: 0 0 0 -30px; transform: rotate(-6deg); }
.mona-fan .card-back:first-child { margin-left: 0; }
.mona-card { width: 70px; }
.mona-card .card-art { display: block; width: 100%; height: auto; }
.mona-out { margin: 16px 0 0; text-align: center; color: #e5bd70; }
.game-mona .opponents { flex-wrap: wrap; }
.game-mona .opponent { flex: 1 1 160px; }
.game-mona .hand-card:disabled { opacity: 1; }
@media (max-width: 700px) {
  .mona-layout { gap: 12px; margin-top: 14px; }
  .mona-layout h3 { font-size: 12px; }
  .mona-layout p, .mona-out { font-size: 11px; }
  .mona-meta { font-size: 10px; }
  .mona-card { width: 49px; }
  .mona-fan, .mona-pair { min-height: 80px; gap: 6px; }
  .mona-fan .card-back { width: 45px; height: 63px; flex-basis: 45px; margin-left: -29px; }
  .game-mona .opponent { flex-basis: 110px; }
  .game-mona .hand-card { width: 60px; }
}
.escoba-table { max-width: 920px; margin: 0 auto; padding: 14px; border: 1px solid transparent; border-radius: 16px; }
.escoba-cards { min-height: 155px; padding: 24px 4px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 17px; }
.table-card { position: relative; width: 72px; padding: 0; border: 0; border-radius: 6px; background: none; flex: 0 0 auto; }
.table-card > .card-art { width: 100%; height: auto; display: block; border-radius: inherit; box-shadow: 0 4px 12px #0004; }
.table-card.selected { outline: 3px solid var(--gold); outline-offset: 4px; transform: translateY(-6px); }
.table-card.selected::after { content: "✓"; position: absolute; right: -9px; top: -12px; background: var(--gold); color: #203929; width: 23px; height: 23px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: bold; }
.table-card:disabled { opacity: 1; cursor: default; }
.hand-card.draggable { width: 87px; touch-action: none; user-select: none; -webkit-user-select: none; }
.hand-card.draggable:not(:disabled) { cursor: grab; }
.hand-card.draggable > .card-art { filter: none; }
.hand-card.picked { transform: translateY(-12px); outline: 2px solid var(--gold); outline-offset: 3px; }
.hand-card.drag-source { opacity: .3; }
.drag-card { position: fixed; z-index: 100; pointer-events: none; transform: translate(-50%, -55%) rotate(-5deg); filter: drop-shadow(0 12px 15px #0006); }
.drag-card > .card-art { display: block; width: 100%; height: auto; }
@media (max-width: 700px) {
  .escoba-table { padding: 6px; }
  .escoba-cards { min-height: 130px; gap: 14px; padding: 20px 3px; }
  .table-card { width: 56px; }
  .hand-card.draggable { width: 67px; }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
}
@media (min-width: 701px) and (max-height: 900px) {
  .app-shell {
    padding-top: 16px;
  }
  .topbar {
    margin-bottom: 17px;
  }
  .game {
    padding-top: 13px;
    padding-bottom: 8px;
  }
  .opponents {
    margin-top: 9px;
    margin-bottom: 5px;
  }
  .opponent {
    padding-bottom: 8px;
  }
  .table-heading {
    margin-bottom: 10px;
  }
  .foundations {
    max-width: 810px;
    gap: 6px;
  }
  .card-slot {
    max-width: 49px;
  }
  .controller {
    padding-top: 16px;
  }
  .hand-heading {
    margin-bottom: 8px;
  }
  .hand-card {
    width: 70px;
  }
  .hand {
    min-height: 124px;
  }
  .footer {
    margin-top: 11px;
  }
}
