@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700;800&family=DM+Mono:wght@500;700&family=Outfit:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: dark;
  --bg-deep: #060e0b;
  --bg-surface: #0b1814;
  --felt-base: #0f271e;
  --felt-light: #163a2c;
  --felt-glow: #1d4a39;
  --wood-border: #382214;
  --wood-glow: rgba(229, 184, 105, 0.2);
  --gold: #e5b869;
  --gold-light: #fae3b4;
  --gold-dark: #9e742c;
  --cream: #fbf7ee;
  --cream-card: #fdfbf7;
  --muted: #95ab9f;
  --ink: #1a1e21;
  --red-suit: #b92b27;
  --blue-suit: #1d3557;
  --green-suit: #2d6a4f;
  --gold-suit: #b8860b;
  --danger: #d9534f;
  --success: #2ea043;
  --font-display: "Cinzel", Georgia, serif;
  --font-body: "Outfit", system-ui, -apple-system, sans-serif;
  --font-mono: "DM Mono", monospace;
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--cream);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding: 8px 0 20px;
  background: 
    radial-gradient(circle at 50% 25%, rgba(22, 58, 44, 0.45), transparent 60%),
    radial-gradient(circle at 50% 85%, rgba(11, 24, 20, 0.8), transparent 70%),
    var(--bg-deep);
  background-attachment: fixed;
  color: var(--cream);
  font-family: var(--font-body);
  display: flex;
  flex-direction: column;
}

button {
  font: inherit;
  user-select: none;
}

.app-shell {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 8px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* TOPBAR / BRAND */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(11, 24, 20, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(229, 184, 105, 0.16);
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--cream);
}

.brand-logo-wrap {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle, #244b3c, #0c1813);
  border: 2px solid var(--gold);
  box-shadow: 0 0 10px rgba(229, 184, 105, 0.35);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand-logo-wrap:hover {
  transform: scale(1.06);
  box-shadow: 0 0 16px rgba(229, 184, 105, 0.55);
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.brand-mark {
  font-size: 18px;
  display: grid;
  place-items: center;
}

.logo-change-badge {
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--gold);
  color: #112d22;
  border: 1px solid #fff;
  font-size: 9px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
  transition: transform 0.15s ease;
}

.brand-logo-wrap:hover .logo-change-badge {
  transform: scale(1.18);
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-main {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 5px;
}

.brand-main span {
  color: var(--gold);
}

.brand-sub {
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.online-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(229, 184, 105, 0.16), rgba(229, 184, 105, 0.05));
  border: 1px solid rgba(229, 184, 105, 0.35);
  color: var(--gold-light);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.online-mode-btn:hover {
  background: linear-gradient(135deg, rgba(229, 184, 105, 0.3), rgba(229, 184, 105, 0.12));
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 3px 12px rgba(229, 184, 105, 0.25);
}

.table-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 5px 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #39e58c;
  box-shadow: 0 0 8px #39e58c;
}

.offline-dot {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}

/* SCOREBOARD (TANTEADOR) */
.scoreboard {
  background: linear-gradient(145deg, rgba(15, 39, 30, 0.85), rgba(9, 20, 16, 0.95));
  border: 1px solid rgba(229, 184, 105, 0.2);
  border-radius: 14px;
  padding: 8px 18px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.scoreboard::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.35;
}

.team-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}

.team-name {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

.team-score strong {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  margin: 1px 0 2px;
}

.ours strong {
  color: var(--gold-light);
  text-shadow: 0 0 14px rgba(229, 184, 105, 0.35);
}

.theirs strong {
  color: #ff9e8f;
  text-shadow: 0 0 14px rgba(255, 120, 100, 0.3);
}

.score-caption {
  font-size: 8px;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
}

.score-middle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.score-vs {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.14em;
  opacity: 0.75;
}

.score-divider {
  width: 1px;
  height: 18px;
  background: rgba(229, 184, 105, 0.2);
}

.score-track {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  display: flex;
  background: rgba(0, 0, 0, 0.4);
}

.score-track span {
  width: 0;
  height: 100%;
  transition: width 0.35s ease;
}

#our-progress {
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-light));
  box-shadow: 0 0 6px var(--gold);
}

#their-progress {
  background: linear-gradient(90deg, #ff7b6b, #b92b27);
  box-shadow: 0 0 6px #ff7b6b;
  margin-left: auto;
}

/* LA MESA (FELT TABLE) */
.table {
  background: 
    radial-gradient(ellipse at 50% 50%, var(--felt-light), var(--felt-base) 80%),
    var(--felt-base);
  border: 3px solid var(--wood-border);
  border-radius: 20px;
  padding: 12px 16px 14px;
  box-shadow: 
    0 12px 35px rgba(0, 0, 0, 0.55),
    inset 0 0 50px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(229, 184, 105, 0.22);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.table-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.round-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--gold-light);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(229, 184, 105, 0.22);
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}

.text-button {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.text-button:hover {
  background: rgba(229, 184, 105, 0.15);
  border-color: var(--gold);
  color: var(--cream);
  transform: translateY(-1px);
}

/* OPPONENT AREA */
.opponent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
  min-height: 60px;
}

.player-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(9, 20, 16, 0.65);
  padding: 4px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.player-tag strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.player-tag small {
  display: block;
  font-size: 9px;
  color: var(--muted);
  font-family: var(--font-mono);
  margin-top: 1px;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  font-family: var(--font-mono);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.avatar-opponent {
  background: linear-gradient(135deg, #c94b3e, #852219);
  color: #fff;
  border-color: rgba(255, 120, 100, 0.4);
}

.avatar-self {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  color: #112d22;
  border-color: var(--gold);
}

.opponent-cards {
  display: flex;
  gap: 6px;
}

/* CARD BACK */
.card-back {
  width: 44px;
  height: 64px;
  border-radius: 7px;
  background: 
    repeating-linear-gradient(45deg, #1b3d30 0, #1b3d30 3px, #122820 3px, #122820 6px),
    #133126;
  border: 1.5px solid rgba(229, 184, 105, 0.7);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
  position: relative;
  overflow: hidden;
}

.card-back::after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px solid rgba(229, 184, 105, 0.3);
  border-radius: 4px;
}

/* PLAY AREA (BAZAS + MUESTRA) */
.play-area {
  background: rgba(7, 18, 14, 0.45);
  border: 1px solid rgba(229, 184, 105, 0.18);
  border-radius: 16px;
  min-height: 140px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  position: relative;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.45);
}

.sample-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 2;
  padding: 4px 8px;
  background: rgba(9, 20, 16, 0.75);
  border: 1px solid rgba(229, 184, 105, 0.28);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.sample-label {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--gold);
  text-shadow: 0 0 6px rgba(229, 184, 105, 0.4);
}

.sample-card-container {
  transform: rotate(-6deg);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}

.sample-card-container .playing-card {
  width: 52px;
  height: 76px;
}

.trick-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  position: relative;
  z-index: 1;
  min-height: 84px;
}

#table-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--gold-light);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 8px #000;
  background: rgba(9, 20, 16, 0.9);
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid rgba(229, 184, 105, 0.35);
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
}

.played-card-slot {
  width: 58px;
  height: 84px;
  display: grid;
  place-items: center;
}

.played-card-slot .playing-card {
  width: 58px;
  height: 84px;
  animation: dropCard 0.26s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}

#opponent-play .playing-card {
  transform: rotate(-4deg);
}

#player-play .playing-card {
  transform: rotate(4deg);
}

@keyframes dropCard {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* PLAYER AREA & CARDS */
.player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.player-cards {
  display: flex;
  justify-content: center;
  gap: clamp(8px, 3vw, 20px);
  width: 100%;
  align-items: flex-end;
  padding: 4px 0;
}

.player-tag-self {
  align-self: center;
  background: rgba(9, 20, 16, 0.7);
  border: 1px solid rgba(229, 184, 105, 0.25);
}

/* ==========================================================================
   SPANISH PLAYING CARDS (BARAJA ESPAÑOLA)
   ========================================================================== */
.playing-card {
  width: 58px;
  height: 84px;
  border-radius: 8px;
  background: var(--cream-card);
  color: var(--ink);
  position: relative;
  box-shadow: 
    0 5px 14px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px #e8dec8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #d4c8b0;
  flex: none;
  overflow: hidden;
  user-select: none;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

.playing-card::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(130, 105, 65, 0.35);
  border-radius: 5px;
  pointer-events: none;
  z-index: 3;
}

.player-cards .playing-card {
  width: clamp(74px, 23vw, 98px);
  height: clamp(108px, 34vw, 144px);
  cursor: pointer;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5), inset 0 0 0 1px #e8dec8;
}

.player-cards .playing-card::before {
  inset: 4px;
  border-radius: 7px;
}

.player-cards .playing-card:hover:not(.disabled),
.player-cards .playing-card:focus-visible:not(.disabled) {
  transform: translateY(-10px) scale(1.04);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.65), 0 0 0 2px var(--gold);
  border-color: var(--gold);
  z-index: 10;
}

.player-cards .playing-card:active:not(.disabled) {
  transform: translateY(-5px) scale(1.02);
}

.playing-card.disabled {
  opacity: 0.6;
  cursor: default;
  filter: grayscale(0.2);
}

/* Card indices */
.card-index {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 4;
  line-height: 1;
  pointer-events: none;
}

.card-index.top-left {
  top: 4px;
  left: 5px;
}

.card-index.bottom-right {
  bottom: 4px;
  right: 5px;
  transform: rotate(180deg);
}

.card-rank {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 12px;
  line-height: 1;
}

.player-cards .playing-card .card-rank {
  font-size: 15px;
}

.card-index-suit {
  width: 10px;
  height: 10px;
  margin-top: 1px;
  display: grid;
  place-items: center;
}

.player-cards .playing-card .card-index-suit {
  width: 12px;
  height: 12px;
}

/* Suit colors */
.suit-espada { color: var(--blue-suit); }
.suit-basto { color: var(--green-suit); }
.suit-oro { color: var(--gold-suit); }
.suit-copa { color: var(--red-suit); }

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

/* Center Artwork & Pips */
.card-art {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 14px 8px;
  position: relative;
  z-index: 2;
}

.court-art {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
}

.card-pips {
  width: 100%;
  height: 100%;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 4px 6px;
}

.card-pips svg {
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25));
}

.sample-card-container .card-pips svg,
.played-card-slot .card-pips svg {
  width: 13px;
  height: 13px;
}

/* Pip Grids */
.pips-1 {
  grid-template-columns: 1fr;
}
.pips-1 svg {
  width: 40px;
  height: 40px;
}
.sample-card-container .pips-1 svg,
.played-card-slot .pips-1 svg {
  width: 28px;
  height: 28px;
}

.pips-2 {
  grid-template-rows: 1fr 1fr;
}
.pips-3 {
  grid-template-rows: 1fr 1fr 1fr;
}
.pips-4, .pips-6 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(auto-fit, minmax(0, 1fr));
}
.pips-5 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
}
.pips-5 svg:nth-child(5) {
  grid-column: 1 / -1;
  grid-row: 2;
}
.pips-7 {
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
}
.pips-7 svg:nth-child(1) { grid-area: 1 / 1; }
.pips-7 svg:nth-child(2) { grid-area: 1 / 3; }
.pips-7 svg:nth-child(3) { grid-area: 2 / 1; }
.pips-7 svg:nth-child(4) { grid-area: 2 / 2; }
.pips-7 svg:nth-child(5) { grid-area: 2 / 3; }
.pips-7 svg:nth-child(6) { grid-area: 3 / 1; }
.pips-7 svg:nth-child(7) { grid-area: 3 / 3; }

/* Pieza Badge */
.pieza-badge {
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #d4af37, #996515);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 1px 5px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  border: 1px solid #fae3b4;
  z-index: 5;
  white-space: nowrap;
  animation: piezaGlow 2s infinite ease-in-out;
}

@keyframes piezaGlow {
  0%, 100% { box-shadow: 0 0 6px rgba(229, 184, 105, 0.6); }
  50% { box-shadow: 0 0 14px rgba(229, 184, 105, 0.95); }
}

.player-cards .pieza-badge {
  font-size: 8px;
  padding: 1px 7px;
}

/* ==========================================================================
   BUTTONS & CONTROLS (COMFORTABLE & ERGONOMIC)
   ========================================================================== */
.actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}

.call-button, .envido-button, .flor-button {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.flor-button {
  background: linear-gradient(145deg, #b52a78, #7a154c);
  color: #fff;
  border: 1px solid #fca5d5;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  animation: florPulse 2s infinite ease-in-out;
}

.flor-button:hover:not(:disabled) {
  background: linear-gradient(145deg, #c73789, #8d1c5a);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(244, 114, 182, 0.5);
}

.flor-button:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

@keyframes florPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(244, 114, 182, 0.4); }
  50% { box-shadow: 0 0 18px rgba(244, 114, 182, 0.8); }
}

.flor-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(229, 184, 105, 0.14);
  border: 1px solid rgba(229, 184, 105, 0.3);
  color: var(--gold-light);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.flor-toggle:hover {
  background: rgba(229, 184, 105, 0.25);
  border-color: var(--gold);
}

.flor-toggle.off {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--muted);
}

.flor-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #fca5d5;
  background: rgba(181, 42, 120, 0.18);
  border: 1px solid rgba(244, 114, 182, 0.35);
  padding: 4px 10px;
  border-radius: 999px;
}

.flor-option-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(244, 114, 182, 0.08);
  border: 1px solid rgba(244, 114, 182, 0.25);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--cream);
  cursor: pointer;
  user-select: none;
}

.flor-option-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #b52a78;
  cursor: pointer;
}

.call-button {
  background: linear-gradient(145deg, #d4af37, #a47624);
  color: #122119;
  border: 1px solid #fae3b4;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}

.call-button:hover:not(:disabled) {
  background: linear-gradient(145deg, #e5be49, #b5842f);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(229, 184, 105, 0.45);
}

.call-button:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

.envido-button {
  background: linear-gradient(145deg, #1b4d3a, #113326);
  color: #e2f4ea;
  border: 1px solid rgba(145, 200, 159, 0.4);
}

.envido-button:hover:not(:disabled) {
  background: linear-gradient(145deg, #24644b, #174232);
  border-color: #39e58c;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(57, 229, 140, 0.25);
}

.envido-button:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

button:disabled {
  opacity: 0.4;
  cursor: default;
  filter: grayscale(0.5);
  box-shadow: none;
}

/* CALL PANEL */
.call-panel {
  background: rgba(9, 20, 16, 0.95);
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 12px 16px;
  margin-top: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65);
  animation: slideUp 0.22s ease-out;
}

.call-panel[hidden] {
  display: none;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.call-panel p {
  margin: 0 0 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--cream);
}

.call-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.call-choice {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.16s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.call-choice[data-call="accept"] {
  background: linear-gradient(145deg, #2ea043, #1f6f2e);
  color: #fff;
  border: 1px solid #56d364;
  box-shadow: 0 4px 12px rgba(46, 160, 67, 0.4);
  font-size: 14px;
  min-width: 105px;
}

.call-choice[data-call="accept"]:hover {
  background: linear-gradient(145deg, #3fb950, #2ea043);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(46, 160, 67, 0.55);
}

.call-choice[data-call="decline"] {
  background: linear-gradient(145deg, #a42c2c, #731b1b);
  color: #fff;
  border: 1px solid #e5534b;
  box-shadow: 0 4px 12px rgba(164, 44, 44, 0.35);
  font-size: 13px;
  min-width: 95px;
}

.call-choice[data-call="decline"]:hover {
  background: linear-gradient(145deg, #bd3232, #8c2121);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(164, 44, 44, 0.5);
}

.call-choice.secondary,
.call-choice:not([data-call="accept"]):not([data-call="decline"]) {
  background: rgba(229, 184, 105, 0.14);
  color: var(--gold-light);
  border: 1px solid rgba(229, 184, 105, 0.4);
}

.call-choice.secondary:hover,
.call-choice:not([data-call="accept"]):not([data-call="decline"]):hover {
  background: rgba(229, 184, 105, 0.28);
  border-color: var(--gold);
  transform: translateY(-2px);
}

.call-choice:active {
  transform: translateY(1px) scale(0.97);
}

.hint {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  margin: 3px 0 0;
  font-family: var(--font-body);
}

/* FOOTER */
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px 4px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-link {
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
}

.footer-link:hover {
  color: var(--gold-light);
  text-decoration: underline;
}

/* TOAST */
.toast {
  position: fixed;
  z-index: 100;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translate(-50%, 20px);
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(11, 24, 20, 0.95);
  backdrop-filter: blur(12px);
  color: #fff;
  border: 1px solid var(--gold);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7), 0 0 12px rgba(229, 184, 105, 0.3);
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  white-space: nowrap;
}

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

/* LOBBY / ROOM */
.lobby-card, .room-card {
  max-width: 540px;
  width: 100%;
  margin: 10px auto;
  padding: 20px 24px;
  background: rgba(11, 24, 20, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(229, 184, 105, 0.22);
  border-radius: 18px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.5);
}

.online-label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--gold);
  text-transform: uppercase;
}

.online-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(229, 184, 105, 0.3);
  border-radius: 10px;
  outline: none;
  background: rgba(6, 14, 11, 0.85);
  color: var(--cream);
  font-size: 14px;
  font-family: var(--font-body);
  transition: all 0.2s ease;
}

.online-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(229, 184, 105, 0.3);
}

.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.join-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.room-code-input {
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 15px;
  text-align: center;
}

.room-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.room-code-label {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--gold-light);
  text-shadow: 0 0 14px rgba(229, 184, 105, 0.4);
}

.room-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.copy-button {
  min-height: 38px;
  padding: 0 14px;
}

.leave-room {
  color: var(--danger);
  border-color: rgba(217, 83, 79, 0.4);
}

.leave-room:hover {
  background: rgba(217, 83, 79, 0.2);
  border-color: var(--danger);
}

.room-status {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* MOBILE */
@media (max-width: 600px) {
  .app-shell {
    padding: 6px 8px 12px;
    gap: 6px;
  }
  
  .topbar {
    padding: 5px 8px;
    border-radius: 12px;
  }

  .brand-logo-wrap {
    width: 34px;
    height: 34px;
  }

  .brand-main {
    font-size: 13px;
  }

  .brand-sub {
    font-size: 8px;
  }

  .online-mode-btn {
    padding: 5px 8px;
    font-size: 10px;
  }

  .scoreboard {
    padding: 8px 10px 9px;
    gap: 14px;
    border-radius: 12px;
  }

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

  .table {
    padding: 10px 8px 12px;
    border-radius: 16px;
    gap: 8px;
  }

  .play-area {
    min-height: 125px;
    padding: 8px 10px;
  }

  .sample-card-container .playing-card {
    width: 44px;
    height: 64px;
  }

  .played-card-slot {
    width: 48px;
    height: 70px;
  }

  .played-card-slot .playing-card {
    width: 48px;
    height: 70px;
  }

  .player-cards {
    gap: 8px;
  }

  .player-cards .playing-card {
    width: clamp(70px, 28vw, 92px);
    height: clamp(102px, 40vw, 134px);
  }

  .actions {
    gap: 6px;
  }

  .call-button, .envido-button {
    min-height: 44px;
    font-size: 13px;
    padding: 0 8px;
  }

  .call-choice {
    min-height: 40px;
    font-size: 12px;
    padding: 0 12px;
  }

  .card-back {
    width: 38px;
    height: 56px;
  }

  #table-message {
    font-size: 10px;
    padding: 4px 10px;
  }
}
