* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, sans-serif;
  background: #0b3d24;
  color: #fff;
}
.screen { padding: 16px; max-width: 480px; margin: 0 auto; }
.hidden { display: none !important; }

h1 { text-align: center; margin-bottom: 0; }
.subtitle { text-align: center; color: #cde; margin-top: 4px; }

.card-box {
  background: #0f5132;
  border-radius: 12px;
  padding: 14px;
  margin: 14px 0;
}
.card-box h2 { margin-top: 0; font-size: 16px; }
.hint { font-size: 12px; color: #cde; margin: 4px 0 8px; }
.choice-box { cursor: pointer; }
.choice-box:active { background: #1c7a45; }
.mode-toggle { display: flex; gap: 8px; margin: 14px 0; }
.mode-btn {
  background: #0f5132;
  color: #cde;
  font-weight: normal;
}
.mode-btn.active { background: #f0b429; color: #0b3d24; font-weight: bold; }
button.secondary {
  background: #14532d;
  color: #fff;
  font-weight: normal;
  margin-top: 6px;
}
.level-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}
.level-btn {
  padding: 14px;
  border-radius: 10px;
  border: none;
  background: #0f5132;
  color: #fff;
  text-align: left;
  font-size: 15px;
}
.level-btn b { color: #f0b429; }
.colleague-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f5132;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 8px;
}
.colleague-item button { width: auto; padding: 8px 14px; }
.colleague-item input[type="checkbox"] { width: 22px; height: 22px; flex-shrink: 0; }
input {
  width: 100%;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 8px;
  border: none;
  font-size: 15px;
}
button {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: none;
  background: #f0b429;
  font-weight: bold;
  font-size: 15px;
}
button:disabled { background: #6b6b6b; color: #ccc; }
.error { color: #ff8080; text-align: center; }

/* game screen */
.opp-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
}
#opp-name-info { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: bold; }
.colleague-btn {
  width: auto;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 14px;
  background: #2a6b47;
  color: #fff;
  font-weight: normal;
}
.colleague-btn.accepted { background: #1a3d2a; color: #8fd; }
.safety-btn {
  width: auto;
  padding: 4px 8px;
  font-size: 13px;
  border-radius: 14px;
  background: #14532d;
  color: #fff;
  font-weight: normal;
}
.block-picker {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  background: #14532d;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  z-index: 999;
}
.block-picker p { margin: 0 0 8px; font-size: 14px; text-align: center; }
.block-picker .block-picker-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f5132;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
}
.block-picker .block-picker-item button { width: auto; padding: 6px 12px; background: #7a1f1f; color: #fff; }
.block-picker .btn-cancel-block { background: #0b3d24; color: #cde; margin-top: 4px; }
.abandoned-banner { text-align: center; color: #ff8080; font-weight: bold; margin: 4px 0; }
.colleague-btn.pending { background: #f0b429; color: #111; }

.pairs-info {
  background: #0f5132;
  border-radius: 8px;
  padding: 6px 10px;
  margin: 4px 0;
  font-size: 12px;
}
.pairs-row { margin: 2px 0; }

.tapa-box {
  background: #0f5132;
  border-radius: 8px;
  padding: 6px 10px;
  margin: 4px 0;
  font-size: 12px;
}
.tapa-title { margin: 2px 0 6px; font-weight: bold; }
.tapa-side {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
}
.tapa-side input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; }
.tapa-side.active { color: #8fd; }
#tapa-status { margin: 4px 0 0; }
#tapa-status.active { color: #8fd; }

.timer {
  background: #14532d;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: bold;
  min-width: 46px;
  text-align: center;
}
.timer.low { background: #7a1f1f; }

.opp-hand-row {
  display: flex;
  gap: 2px;
  justify-content: center;
  padding: 4px;
  min-height: 54px;
  flex-wrap: wrap;
}
.card.tiny-back {
  width: 35px;
  height: 50px;
  background: radial-gradient(120% 90% at 50% 30%, #4f8fc4, #3971a3 65%, #2c5c86);
  border: 1px solid #efe6d2;
  border-radius: 4px;
  position: relative;
}
.card.tiny-back::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 11px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3d6, #e4c98a 55%, #c9a15a 85%);
}

.melds-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  min-height: 30px;
  padding: 2px 4px;
}

.table { padding: 4px 4px; }
.piles { display: flex; gap: 16px; justify-content: center; margin-bottom: 4px; }
.pile { text-align: center; }
.pile-label { font-size: 12px; color: #cde; margin-bottom: 4px; }
.frozen-hint { font-size: 10px; color: #9fd7ff; margin-top: 2px; }

/* Pozo congelado por un comodín: se muestra cruzado sobre la carta que
   quedó tapada, en vez de ocultarla del todo (a diferencia del 3
   negro, que sí la tapa por completo). */
.discard-frozen-wild {
  position: relative;
  width: 84px;
  height: 84px;
  margin: 0 auto;
}
.discard-frozen-wild .card {
  margin: 0;
  position: absolute;
}
.discard-frozen-wild .under-card {
  left: 14px;
  top: 2px;
}
.discard-frozen-wild .top-card {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(90deg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 80px;
  background: #fff;
  border-radius: 7px;
  margin: 2px;
  border: 2px solid transparent;
  user-select: none;
  overflow: hidden;
  flex-shrink: 0;
}
.card-face { width: 100%; height: 100%; display: block; pointer-events: none; }
.card.wild { border-color: #f0b429; }
.card.black3 { border-color: #777; }
.card.selected { border-color: #f0b429; transform: translateY(-6px); }
.card.back {
  background: radial-gradient(120% 90% at 50% 30%, #4f8fc4, #3971a3 65%, #2c5c86);
  color: #efe6d2;
  border-color: #efe6d2;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

#melds-area {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  min-height: 30px;
}
.meld-group {
  background: #14532d;
  border-radius: 8px;
  padding: 4px 6px;
  display: flex;
  gap: 2px;
}
.meld-group.real { outline: 2px solid gold; }
.turn-banner {
  text-align: center;
  padding: 6px;
  font-weight: bold;
  border-radius: 8px;
  margin: 6px 0;
  background: #0f5132;
}
.turn-banner.mine { background: #a34a00; }

.hand-area {
  background: #0f5132;
  border-radius: 12px;
  padding: 8px;
  margin: 8px 0;
  overflow-x: auto;
}
.hand-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  min-height: 84px;
  align-items: center;
}

.actions { display: flex; gap: 8px; margin: 8px 0; }

#log-box {
  background: #062a17;
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
  max-height: 100px;
  overflow-y: auto;
  color: #aee;
}
#opp-info { font-size: 14px; }

/* revancha */
.rematch-banner {
  background: #14532d;
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
  text-align: center;
}
.rematch-banner p { margin: 4px 0; }
#rematch-status { font-size: 12px; color: #cde; }
.match-over-title { font-size: 18px; font-weight: bold; color: #f0b429; margin: 4px 0; }

/* chat */
.chat-bar { margin: 8px 0 20px; }
#btn-toggle-chat {
  background: #0f5132;
  color: #fff;
  font-weight: normal;
}
.chat-panel {
  background: #0f5132;
  border-radius: 10px;
  margin-top: 6px;
  padding: 8px;
}
#chat-messages {
  max-height: 140px;
  overflow-y: auto;
  font-size: 13px;
  margin-bottom: 6px;
}
#chat-messages .msg { margin: 3px 0; }
#chat-messages .msg .who { font-weight: bold; color: #f0b429; }
#chat-messages .msg.mine .who { color: #8fd; }
.chat-input-row { display: flex; gap: 6px; }
.chat-input-row input { margin-bottom: 0; flex: 1; }
.chat-input-row button { width: auto; padding: 10px 14px; }

.invite-banner {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  background: #f0b429;
  color: #111;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  z-index: 999;
  text-align: center;
}
.invite-banner p { margin: 0 0 8px; font-size: 14px; }
.invite-banner button { width: auto; padding: 8px 16px; margin: 0 4px; }

