* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: #0b3d2e url("assets/bg-felt.jpg") center / cover fixed no-repeat;
  color: #f2ede3;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
  user-select: none;
}

.screen {
  min-height: 100vh;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hidden { display: none !important; }

h2 { font-family: Georgia, "Times New Roman", serif; color: #e8c877; letter-spacing: .5px; }

.brand { text-align: center; margin-top: 24px; }
.brand-icon {
  width: 96px; height: 96px; border-radius: 22px;
  box-shadow: 0 6px 18px rgba(0,0,0,.5), 0 0 0 2px rgba(201,162,75,.5);
}
.brand h1 { margin: 12px 0 4px; font-size: 28px; font-family: Georgia, "Times New Roman", serif; color: #e8c877; }
.tagline { opacity: .75; font-size: 14px; }

.menu-card {
  width: 100%; max-width: 360px;
  background: rgba(255,255,255,.06);
  border-radius: 16px;
  padding: 20px;
  margin-top: 24px;
  display: flex; flex-direction: column; gap: 10px;
}
.menu-card label { font-size: 13px; opacity: .8; margin-top: 4px; }
.menu-card input, .menu-card select {
  padding: 12px; border-radius: 10px; border: none;
  background: rgba(255,255,255,.12); color: #fff; font-size: 16px;
}
.divider { text-align: center; opacity: .5; font-size: 12px; margin: 4px 0; }

.btn-primary, .btn-secondary {
  padding: 12px 16px; border-radius: 10px; border: none;
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.btn-primary { background: #c9a24b; color: #1a1a1a; }
.btn-secondary { background: rgba(255,255,255,.12); color: #fff; }
.btn-primary:disabled, .btn-secondary:disabled { opacity: .35; cursor: default; }

.error { color: #ff8a80; min-height: 18px; }
.hint { opacity: .7; font-size: 14px; text-align: center; }

#lobby-players { list-style: none; padding: 0; width: 100%; max-width: 320px; }
#lobby-players li {
  display: flex; justify-content: space-between; padding: 10px 14px;
  background: rgba(255,255,255,.06); border-radius: 10px; margin-bottom: 8px;
}
.host-tag { background: #c9a24b; color: #1a1a1a; font-size: 11px; padding: 2px 6px; border-radius: 6px; }

/* тузование */
#tuzovanie-log { width: 100%; max-width: 320px; margin-top: 12px; }
.tuzovanie-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.tuzovanie-row span { opacity: .85; }

/* карта */
.card {
  width: 52px; height: 74px; border-radius: 8px; background: #fdfaf3; color: #1a1a1a;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; font-family: Georgia, "Times New Roman", serif;
  box-shadow: 0 2px 4px rgba(0,0,0,.4);
  border: 1.5px solid #c9a24b;
  flex-shrink: 0;
}
.card.mini { width: 36px; height: 50px; font-size: 13px; border-width: 1px; }
.card.red { color: #a5261f; }
.card .suit { font-size: 14px; }
.card.mini .suit { font-size: 11px; }
.card.joker {
  background: linear-gradient(160deg,#0f4a37,#0b3d2e) center / cover;
  border-color: #e8c877;
}
.card.joker .joker-face { font-size: 22px; filter: drop-shadow(0 0 3px rgba(232,200,119,.7)); }
.card.mini.joker .joker-face { font-size: 16px; }
.card.facedown {
  background: url("assets/card-back.jpg") center / cover;
  border-color: #e8c877;
}
.card.disabled { opacity: .35; }

.scoreboard { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; width: 100%; margin-bottom: 6px; }
.score-chip {
  display: flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 20px;
  background: rgba(255,255,255,.08); font-size: 13px;
}
.score-chip.dealer { outline: 1px solid #c9a24b; }
.score-chip .pts { font-weight: 700; }

.deal-info { font-size: 12px; opacity: .8; text-align: center; margin-bottom: 8px; }

.table {
  width: 100%; max-width: 420px; aspect-ratio: 1.3;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  grid-template-areas:
    ".    top   ."
    "left center right"
    ".    .     .";
  gap: 4px;
  margin-bottom: 10px;
}
.seat { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 70px; justify-content: center; }
.seat-top { grid-area: top; }
.seat-left { grid-area: left; }
.seat-right { grid-area: right; }
.seat-name { font-size: 12px; opacity: .85; }
.table-center { grid-area: center; display: flex; align-items: center; justify-content: center; }
.trump-indicator { font-size: 30px; opacity: .9; }

.panel { width: 100%; max-width: 420px; margin-bottom: 8px; }
.mini-hand { display: flex; gap: 6px; justify-content: center; margin: 8px 0; }
.button-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.button-row button { min-width: 40px; }

.bidding-history { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; font-size: 13px; }
.bid-row { opacity: .85; }

.hand-area { width: 100%; overflow-x: auto; padding: 10px 0; }
.hand { display: flex; gap: 6px; justify-content: center; min-width: min-content; margin: 0 auto; }

#results-body, #final-body { width: 100%; max-width: 420px; }
.player-result {
  background: rgba(255,255,255,.06); border-radius: 12px; padding: 12px; margin-bottom: 8px;
}
.player-result.shtanga { outline: 1px solid #ff8a80; }
.pr-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pr-name { font-weight: 600; }
.foul-tag { background: #c0392b; color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 6px; margin-left: 6px; }
.pr-score { font-size: 13px; }
.pr-score.pos { color: #8bd17c; }
.pr-score.neg { color: #ff8a80; }
.pr-total { font-size: 12px; opacity: .7; margin-top: 4px; }

.final-row {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px;
  background: rgba(255,255,255,.06); margin-bottom: 8px;
}
.final-row.winner { background: rgba(201,162,75,.25); outline: 1px solid #c9a24b; }
.final-row .place { font-weight: 700; width: 24px; text-align: center; }
.final-row .name { flex: 1; }
.final-row .pts { font-weight: 700; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px;
}
.modal-box {
  background: #123; border-radius: 16px; padding: 20px; width: 100%; max-width: 320px;
  display: flex; flex-direction: column; gap: 12px; align-items: center;
}

.premium-row {
  display: flex; justify-content: space-between; padding: 6px 12px;
  background: rgba(201,162,75,.12); border-radius: 8px; margin-bottom: 4px; font-size: 13px;
}
.premium-row .pos { color: #8bd17c; }
.premium-row .neg { color: #ff8a80; }

.demand-banner { font-size: 12px; opacity: .85; text-align: center; margin-bottom: 4px; }

#leaderboard-body { width: 100%; max-width: 420px; margin: 12px 0; }
.leaderboard-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: rgba(255,255,255,.06); border-radius: 10px; margin-bottom: 6px; font-size: 14px;
}
.leaderboard-row .place { width: 24px; font-weight: 700; text-align: center; opacity: .8; }
.leaderboard-row .username { flex: 1; }
.leaderboard-row .elo { font-weight: 700; }
.leaderboard-row .games { font-size: 12px; opacity: .6; }

.final-row .elo-delta { font-size: 12px; margin-left: 8px; }
.final-row .elo-delta.pos { color: #8bd17c; }
.final-row .elo-delta.neg { color: #ff8a80; }
