@import url("data:text/css,");

:root {
  --ink: #13221d;
  --cream: #f7efd8;
  --cream-deep: #e9ddbc;
  --gold: #d7ae57;
  --gold-bright: #f2d487;
  --felt: #0d513d;
  --felt-dark: #073426;
  --felt-black: #041d17;
  --red: #a83238;
  --red-bright: #d44a50;
  --blue: #5186a8;
  --shadow: rgba(0, 0, 0, 0.42);
  --panel: rgba(5, 24, 19, 0.93);
  --line: rgba(242, 212, 135, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: #06120f;
  color: var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:focus-visible,
.card:focus-visible {
  outline: 3px solid var(--gold-bright);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.game {
  width: 100%;
  height: 100dvh;
  min-width: 320px;
  min-height: 640px;
  overflow: hidden;
  background:
    radial-gradient(circle at 28% 30%, rgba(41, 107, 80, 0.13), transparent 28%),
    linear-gradient(145deg, #071a15, #030b09 70%);
}

.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(210px, 1fr);
  align-items: center;
  height: 72px;
  padding: 9px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(3, 14, 11, 0.94);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.25);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  width: max-content;
  padding: 0;
  color: var(--cream);
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(242, 212, 135, 0.48);
  border-radius: 7px;
  background: linear-gradient(145deg, #f8f0dc, #ded1ae);
  box-shadow: 0 3px 0 #987338, 0 8px 15px rgba(0, 0, 0, 0.35);
  color: #173a2f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 800;
  transform: rotate(-3deg);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  letter-spacing: 0.02em;
}

.brand small {
  margin-top: 2px;
  color: #aaae9e;
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.match-score {
  display: flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid rgba(215, 174, 87, 0.32);
  border-radius: 8px;
  background: rgba(10, 36, 29, 0.82);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
}

.score-team {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 150px;
  padding: 8px 13px;
}

.score-team span {
  color: #d0c9b5;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.score-team strong {
  margin-left: auto;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  line-height: 1;
}

.score-us strong {
  color: var(--gold-bright);
}

.score-them strong {
  color: #d97979;
}

.score-target {
  display: grid;
  place-content: center;
  min-width: 54px;
  padding: 5px 8px;
  border-inline: 1px solid rgba(215, 174, 87, 0.2);
  background: rgba(0, 0, 0, 0.17);
  text-align: center;
}

.score-target span,
.score-target b {
  display: block;
}

.score-target span {
  color: #83978e;
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.score-target b {
  color: #c7bea8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.icon-button {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border: 1px solid rgba(242, 212, 135, 0.22);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.035);
  color: #dbd3bd;
  cursor: pointer;
  transition: 150ms ease;
}

.icon-button:hover {
  border-color: rgba(242, 212, 135, 0.6);
  background: rgba(242, 212, 135, 0.08);
  color: var(--gold-bright);
}

.icon-button.muted {
  color: #6b7772;
  text-decoration: line-through;
}

.play-area {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) 292px;
  height: calc(100dvh - 72px);
  min-height: 568px;
}

.table-wrap {
  min-width: 0;
  padding: 17px 15px 18px 18px;
}

.table {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 534px;
  overflow: hidden;
  border: 9px solid #432c1c;
  border-radius: 47% / 43%;
  background:
    radial-gradient(ellipse at center, rgba(46, 129, 94, 0.42) 0, rgba(14, 82, 61, 0.1) 52%, rgba(0, 25, 18, 0.38) 100%),
    var(--felt);
  box-shadow:
    0 0 0 2px #9b7041,
    0 0 0 5px #23170f,
    0 24px 55px rgba(0, 0, 0, 0.46),
    inset 0 0 90px rgba(0, 0, 0, 0.42);
}

.table::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(232, 204, 132, 0.2);
  border-radius: inherit;
  pointer-events: none;
}

.table-grain {
  position: absolute;
  inset: 0;
  opacity: 0.3;
  background-image:
    repeating-linear-gradient(28deg, transparent 0 3px, rgba(255, 255, 255, 0.018) 4px, transparent 5px),
    repeating-linear-gradient(112deg, transparent 0 9px, rgba(0, 0, 0, 0.025) 10px, transparent 11px);
  pointer-events: none;
}

.seat {
  position: absolute;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
}

.seat-north {
  top: 15px;
  left: 50%;
  flex-direction: column;
  transform: translateX(-50%);
}

.seat-west {
  top: 47%;
  left: 17px;
  flex-direction: column;
  transform: translateY(-50%);
}

.seat-east {
  top: 47%;
  right: 17px;
  flex-direction: column;
  transform: translateY(-50%);
}

.seat-south {
  right: 18px;
  bottom: 7px;
  left: 18px;
  flex-direction: column;
}

.south-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: -2px;
  padding: 3px 11px 3px 4px;
  border: 1px solid rgba(242, 212, 135, 0.21);
  border-radius: 999px;
  background: rgba(4, 27, 20, 0.86);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
}

.player-portrait {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.35);
  color: white;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 800;
}

.player-portrait.partner,
.player-portrait.you {
  background: linear-gradient(145deg, #c19a49, #806025);
}

.player-portrait.opponent {
  background: linear-gradient(145deg, #ad4c54, #6f2830);
}

.player-info {
  display: flex;
  min-width: 78px;
  flex-direction: column;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  background: rgba(3, 23, 17, 0.8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.south-meta .player-info {
  min-width: 55px;
  align-items: flex-start;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.player-name {
  color: #fff7e2;
  font-size: 11px;
  font-weight: 800;
}

.player-name em {
  display: inline-block;
  margin-left: 4px;
  color: var(--gold-bright);
  font-size: 8px;
  font-style: normal;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.player-status {
  min-height: 12px;
  color: #93ac9f;
  font-size: 9px;
}

.seat.thinking .player-info,
.seat.current .player-info,
.seat.current .south-meta {
  border-color: rgba(242, 212, 135, 0.7);
  box-shadow: 0 0 0 2px rgba(242, 212, 135, 0.1), 0 5px 15px rgba(0, 0, 0, 0.3);
}

.seat.current .player-status,
.seat.thinking .player-status {
  color: var(--gold-bright);
}

.mini-hand {
  position: relative;
  display: flex;
  justify-content: center;
  height: 35px;
  min-width: 76px;
}

.mini-hand.vertical {
  width: 34px;
  height: 92px;
  flex-direction: column;
}

.card-back-mini {
  width: 27px;
  height: 38px;
  flex: 0 0 auto;
  margin-left: -17px;
  border: 2px solid #e4d8ba;
  border-radius: 4px;
  background:
    linear-gradient(135deg, transparent 43%, rgba(239, 216, 153, 0.32) 44% 48%, transparent 49%),
    linear-gradient(45deg, transparent 43%, rgba(239, 216, 153, 0.25) 44% 48%, transparent 49%),
    #184839;
  background-size: 8px 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
}

.card-back-mini:first-child {
  margin-left: 0;
}

.mini-hand.vertical .card-back-mini {
  margin-top: -28px;
  margin-left: 0;
}

.mini-hand.vertical .card-back-mini:first-child {
  margin-top: 0;
}

.center-stage {
  position: absolute;
  z-index: 5;
  top: 44%;
  left: 50%;
  width: min(48%, 390px);
  height: 250px;
  transform: translate(-50%, -50%);
}

.hand-badge,
.contract-badge {
  position: absolute;
  top: -21px;
  padding: 5px 9px;
  border: 1px solid rgba(242, 212, 135, 0.26);
  border-radius: 999px;
  background: rgba(3, 27, 20, 0.72);
  color: #c4cbbf;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hand-badge {
  left: 10px;
}

.contract-badge {
  right: 10px;
  color: var(--gold-bright);
}

.trick-area {
  position: relative;
  width: 100%;
  height: 220px;
}

.table-center-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 82px;
  height: 82px;
  place-content: center;
  border: 1px solid rgba(236, 213, 152, 0.16);
  border-radius: 50%;
  color: rgba(240, 217, 158, 0.18);
  text-align: center;
  transform: translate(-50%, -50%);
}

.table-center-mark::before,
.table-center-mark::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(236, 213, 152, 0.08);
  border-radius: 50%;
}

.table-center-mark span {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  font-weight: 800;
  line-height: 0.8;
}

.table-center-mark small {
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.17em;
}

.trick-slot {
  position: absolute;
  z-index: 2;
  width: 62px;
  height: 86px;
}

.trick-north {
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
}

.trick-south {
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
}

.trick-west {
  top: 50%;
  left: 24px;
  transform: translateY(-50%) rotate(-4deg);
}

.trick-east {
  top: 50%;
  right: 24px;
  transform: translateY(-50%) rotate(4deg);
}

.center-message {
  position: absolute;
  bottom: -4px;
  left: 50%;
  min-width: 190px;
  padding: 5px 13px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background: rgba(3, 24, 18, 0.77);
  color: #d9ddcf;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  text-align: center;
  transform: translateX(-50%);
}

.human-hand {
  display: flex;
  width: min(100%, 850px);
  height: 103px;
  justify-content: center;
  align-items: flex-end;
  padding: 0 16px;
}

.card {
  position: relative;
  display: block;
  width: 64px;
  height: 90px;
  flex: 0 0 64px;
  overflow: hidden;
  padding: 0;
  border: 1px solid #b8aa8d;
  border-radius: 7px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(235, 226, 202, 0.97)),
    #f8f0dc;
  box-shadow: 0 4px 9px rgba(0, 0, 0, 0.38), inset 0 0 0 2px rgba(255, 255, 255, 0.48);
  color: #17231e;
  cursor: default;
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease, opacity 150ms ease;
}

button.card {
  cursor: pointer;
}

.human-hand .card + .card {
  margin-left: clamp(-26px, -1.5vw, -13px);
}

.human-hand .card:nth-child(odd) {
  transform: rotate(-0.8deg);
}

.human-hand .card:nth-child(even) {
  transform: translateY(-2px) rotate(0.7deg);
}

.human-hand .card.legal:hover,
.human-hand .card.selectable:hover {
  z-index: 20;
  transform: translateY(-14px) scale(1.04);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.46), 0 0 0 2px var(--gold-bright);
}

.human-hand .card.selected,
.human-hand .card.selected:nth-child(odd),
.human-hand .card.selected:nth-child(even) {
  z-index: 18;
  transform: translateY(-19px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.44), 0 0 0 3px var(--gold-bright);
}

.card.illegal {
  filter: saturate(0.4) brightness(0.72);
  opacity: 0.72;
}

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

.card-corner {
  position: absolute;
  top: 5px;
  left: 5px;
  display: grid;
  justify-items: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  font-weight: 800;
  line-height: 0.82;
}

.card-corner.bottom {
  top: auto;
  right: 5px;
  bottom: 5px;
  left: auto;
  transform: rotate(180deg);
}

.card-corner small {
  margin-top: 3px;
  font-size: 13px;
}

.card-pip {
  position: absolute;
  top: 50%;
  left: 50%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 31px;
  transform: translate(-50%, -50%);
  text-shadow: 0 1px rgba(255, 255, 255, 0.6);
}

.card-copy {
  position: absolute;
  top: 50%;
  right: 5px;
  width: 9px;
  height: 9px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.35;
  transform: translateY(-50%);
}

.trick-slot .card {
  width: 62px;
  height: 86px;
  animation: deal-in 220ms ease-out both;
}

@keyframes deal-in {
  from { opacity: 0; transform: translateY(-9px) scale(0.82); }
  to { opacity: 1; transform: none; }
}

.side-panel {
  position: relative;
  z-index: 10;
  display: flex;
  min-height: 0;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: -10px 0 28px rgba(0, 0, 0, 0.2);
}

.panel-section {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: #aab6ae;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.round-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
}

.round-stats div {
  padding: 9px 5px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
}

.round-stats div:last-child {
  border-right: 0;
}

.round-stats span,
.round-stats strong {
  display: block;
}

.round-stats span {
  color: #778b81;
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.round-stats strong {
  overflow: hidden;
  margin-top: 3px;
  color: #f1e7cc;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-panel {
  position: relative;
  background:
    radial-gradient(circle at 90% 10%, rgba(215, 174, 87, 0.1), transparent 38%),
    rgba(255, 255, 255, 0.018);
}

.action-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  width: 42px;
  height: 2px;
  background: var(--gold);
}

.action-kicker,
.eyebrow {
  color: var(--gold-bright);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.action-panel h2 {
  margin: 6px 0 5px;
  color: #fff7e3;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 500;
}

.action-panel p {
  min-height: 44px;
  margin: 0;
  color: #aab4ad;
  font-size: 11px;
  line-height: 1.55;
}

.action-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 13px;
}

.action-controls .full {
  grid-column: 1 / -1;
}

.primary-button,
.secondary-button,
.bid-button,
.suit-button {
  min-height: 39px;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.045em;
  transition: 150ms ease;
}

.primary-button {
  border: 1px solid #f1d07f;
  background: linear-gradient(#e5c36f, #bf943c);
  box-shadow: 0 3px 0 #745321, 0 6px 12px rgba(0, 0, 0, 0.24);
  color: #15251e;
}

.primary-button:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.primary-button:active:not(:disabled) {
  transform: translateY(2px);
}

.primary-button.large {
  min-height: 48px;
  padding-inline: 24px;
  font-size: 12px;
}

.secondary-button,
.bid-button,
.suit-button {
  border: 1px solid rgba(242, 212, 135, 0.28);
  background: rgba(255, 255, 255, 0.045);
  color: #e6deca;
}

.secondary-button:hover,
.bid-button:hover,
.suit-button:hover {
  border-color: rgba(242, 212, 135, 0.7);
  background: rgba(242, 212, 135, 0.1);
  color: var(--gold-bright);
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.65);
  opacity: 0.45;
}

.suit-button {
  display: flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
}

.suit-button.red {
  color: #ee777a;
}

.log-panel {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  border-bottom: 0;
}

.text-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--gold);
  cursor: pointer;
  font-size: 9px;
  text-transform: uppercase;
}

.game-log {
  min-height: 0;
  flex: 1;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  scrollbar-color: rgba(215, 174, 87, 0.25) transparent;
  list-style: none;
}

.game-log li {
  position: relative;
  padding: 7px 2px 7px 17px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  color: #aeb8b1;
  font-size: 10px;
  line-height: 1.35;
}

.game-log li::before {
  content: "♦";
  position: absolute;
  top: 7px;
  left: 2px;
  color: rgba(215, 174, 87, 0.7);
  font-size: 8px;
}

.game-log li.important {
  color: #eee3c9;
  font-weight: 700;
}

.toast {
  position: fixed;
  z-index: 100;
  bottom: 25px;
  left: 50%;
  max-width: min(90vw, 420px);
  padding: 10px 16px;
  border: 1px solid rgba(242, 212, 135, 0.35);
  border-radius: 999px;
  background: rgba(4, 20, 16, 0.96);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  color: #f2ead6;
  font-size: 11px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: 220ms ease;
}

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

.modal-backdrop {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: none;
  place-items: center;
  overflow-y: auto;
  padding: 22px;
  background: rgba(1, 9, 7, 0.82);
  backdrop-filter: blur(7px);
}

.modal-backdrop.visible {
  display: grid;
  animation: fade-in 180ms ease both;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  position: relative;
  width: min(100%, 720px);
  max-height: calc(100dvh - 44px);
  overflow-y: auto;
  padding: 31px;
  border: 1px solid rgba(242, 212, 135, 0.43);
  border-radius: 10px;
  background:
    linear-gradient(rgba(11, 47, 37, 0.96), rgba(5, 27, 21, 0.98)),
    #092e24;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.65), inset 0 0 45px rgba(0, 0, 0, 0.23);
}

.modal::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(242, 212, 135, 0.12);
  border-radius: 6px;
  pointer-events: none;
}

.modal-close {
  position: absolute;
  z-index: 2;
  top: 13px;
  right: 13px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.16);
  color: #d9d0b9;
  cursor: pointer;
  font-size: 21px;
}

.welcome-card {
  width: min(100%, 540px);
  padding: 36px 43px 29px;
  overflow: hidden;
  text-align: center;
}

.welcome-card::after {
  content: "P";
  position: absolute;
  top: 45%;
  left: 50%;
  z-index: -1;
  color: rgba(239, 211, 137, 0.035);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 360px;
  font-weight: 900;
  transform: translate(-50%, -50%);
}

.welcome-suits {
  display: flex;
  justify-content: center;
  gap: 17px;
  margin-bottom: 13px;
  color: #e8dfc9;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 23px;
}

.welcome-suits .red {
  color: #d65a5f;
}

.welcome-card h1 {
  margin: 8px 0 13px;
  color: #fff5da;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(45px, 7vw, 66px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.78;
}

.welcome-card h1 i {
  color: var(--gold-bright);
  font-size: 0.64em;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.welcome-copy {
  max-width: 390px;
  margin: 21px auto 23px;
  color: #b9c1b9;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  line-height: 1.55;
}

.welcome-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.welcome-foot {
  display: flex;
  justify-content: center;
  gap: 17px;
  margin-top: 25px;
  padding-top: 15px;
  border-top: 1px solid rgba(242, 212, 135, 0.12);
  color: #87988f;
  font-size: 9px;
  letter-spacing: 0.04em;
}

.rules-card h2,
.summary-card h2 {
  margin: 5px 0 22px;
  color: #fff4d9;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 38px;
  font-weight: 500;
}

.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.rules-grid section {
  position: relative;
  min-height: 128px;
  padding: 17px 16px 14px 49px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.026);
}

.rule-number {
  position: absolute;
  top: 17px;
  left: 13px;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
}

.rules-grid h3,
.meld-reference h3 {
  margin: 0 0 6px;
  color: #ede4ce;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 600;
}

.rules-grid p {
  margin: 0;
  color: #aab5ae;
  font-size: 10px;
  line-height: 1.55;
}

.meld-reference {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin: 17px 0;
  padding: 16px;
  border-top: 1px solid rgba(242, 212, 135, 0.16);
  border-bottom: 1px solid rgba(242, 212, 135, 0.16);
}

.meld-reference h3 {
  grid-column: 1 / -1;
  margin-bottom: 4px;
  color: var(--gold-bright);
  font-size: 13px;
}

.meld-reference div {
  padding: 7px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.13);
}

.meld-reference span,
.meld-reference b {
  display: block;
}

.meld-reference span {
  min-height: 25px;
  color: #aeb8b0;
  font-size: 9px;
}

.meld-reference b {
  color: #f0d483;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
}

.summary-card {
  width: min(100%, 560px);
  text-align: center;
}

.summary-ornament {
  color: rgba(242, 212, 135, 0.34);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
}

.summary-card h2 {
  margin-bottom: 9px;
}

.summary-copy {
  margin: 0 auto 18px;
  color: #aeb9b1;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  line-height: 1.5;
}

.summary-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 19px;
  text-align: left;
}

.summary-team {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.028);
}

.summary-team.contract-team {
  border-color: rgba(242, 212, 135, 0.38);
}

.summary-team h3 {
  margin: 0 0 9px;
  color: #ede2c9;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #9fada5;
  font-size: 10px;
}

.summary-row:last-child {
  border-bottom: 0;
}

.summary-row.total {
  margin-top: 3px;
  color: var(--gold-bright);
  font-weight: 800;
}

@media (max-width: 1040px) {
  .topbar {
    grid-template-columns: 180px 1fr 120px;
  }

  .brand small {
    display: none;
  }

  .score-team {
    min-width: 116px;
  }

  .score-team span {
    max-width: 68px;
    font-size: 9px;
  }

  .play-area {
    grid-template-columns: minmax(540px, 1fr) 268px;
  }

  .table-wrap {
    padding: 14px;
  }

  .human-hand .card {
    width: 58px;
    height: 82px;
    flex-basis: 58px;
  }
}

@media (max-width: 790px) {
  html,
  body {
    overflow: auto;
  }

  .game {
    height: auto;
    min-height: 900px;
    overflow: visible;
  }

  .topbar {
    position: sticky;
    top: 0;
    grid-template-columns: 1fr auto;
    height: 62px;
    padding: 7px 11px;
  }

  .brand-mark {
    width: 34px;
    height: 40px;
    font-size: 20px;
  }

  .brand strong {
    font-size: 14px;
  }

  .match-score {
    position: absolute;
    top: 63px;
    left: 50%;
    z-index: 30;
    transform: translateX(-50%);
  }

  .score-team {
    min-width: 100px;
    padding: 5px 9px;
  }

  .score-team span {
    max-width: 62px;
    font-size: 8px;
  }

  .score-team strong {
    font-size: 20px;
  }

  .score-target {
    min-width: 43px;
    padding: 3px 5px;
  }

  .top-actions {
    grid-column: 2;
  }

  .play-area {
    display: block;
    height: auto;
    min-height: 0;
    padding-top: 29px;
  }

  .table-wrap {
    height: 610px;
    padding: 12px 9px 15px;
  }

  .table {
    min-height: 580px;
    border-width: 6px;
    border-radius: 42% / 38%;
  }

  .seat-west {
    left: 7px;
  }

  .seat-east {
    right: 7px;
  }

  .seat-north {
    top: 13px;
  }

  .seat-south {
    right: 5px;
    bottom: 8px;
    left: 5px;
  }

  .player-info {
    min-width: 62px;
    padding-inline: 5px;
  }

  .player-name em {
    display: none;
  }

  .center-stage {
    top: 43%;
    width: 67%;
  }

  .trick-west {
    left: 4px;
  }

  .trick-east {
    right: 4px;
  }

  .human-hand {
    width: 100%;
    height: 92px;
    padding-inline: 2px;
  }

  .human-hand .card {
    width: 53px;
    height: 76px;
    flex-basis: 53px;
  }

  .human-hand .card + .card {
    margin-left: clamp(-31px, -3.2vw, -17px);
  }

  .card-corner {
    top: 4px;
    left: 4px;
    font-size: 13px;
  }

  .card-corner.bottom {
    right: 4px;
    bottom: 4px;
  }

  .card-pip {
    font-size: 26px;
  }

  .side-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 270px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .round-panel,
  .action-panel {
    border-right: 1px solid var(--line);
  }

  .round-panel {
    grid-column: 1;
  }

  .action-panel {
    grid-row: 1 / 3;
    grid-column: 2;
  }

  .log-panel {
    grid-row: 2;
    grid-column: 1;
    max-height: 150px;
  }
}

@media (max-width: 500px) {
  .icon-button {
    width: 31px;
    height: 31px;
  }

  .top-actions {
    gap: 4px;
  }

  .table-wrap {
    height: 585px;
    padding-inline: 5px;
  }

  .table {
    min-height: 555px;
    border-radius: 36% / 32%;
  }

  .center-stage {
    width: 74%;
  }

  .seat-west .player-info,
  .seat-east .player-info {
    min-width: 49px;
  }

  .player-status {
    max-width: 55px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .human-hand .card {
    width: 49px;
    height: 72px;
    flex-basis: 49px;
  }

  .human-hand .card + .card {
    margin-left: -27px;
  }

  .side-panel {
    display: flex;
    min-height: 0;
  }

  .round-panel,
  .action-panel {
    border-right: 0;
  }

  .log-panel {
    display: none;
  }

  .action-panel p {
    min-height: 0;
  }

  .welcome-card {
    padding: 30px 21px 23px;
  }

  .welcome-actions {
    flex-direction: column;
  }

  .welcome-foot {
    flex-wrap: wrap;
    gap: 6px 13px;
  }

  .rules-grid,
  .summary-table {
    grid-template-columns: 1fr;
  }

  .meld-reference {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal {
    padding: 26px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
