* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #1a5235;
  min-height: 100vh;
  color: #fff;
}

#app {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100vh;
}

/* ── Header ── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}
.header h1 {
  font-size: 1.4rem;
  letter-spacing: 3px;
  font-weight: 800;
  text-shadow: 1px 2px 6px rgba(0,0,0,0.4);
}

/* ── Player zones ── */
.player-zone {
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  padding: 12px 16px;
  transition: background 0.2s;
}
.player-zone.active { background: rgba(0,0,0,0.35); }

.player-name {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0.55;
  margin-bottom: 10px;
}
.active .player-name { opacity: 1; color: #ffd700; }

.score-badge {
  background: rgba(255,255,255,0.13);
  border-radius: 99px;
  padding: 1px 9px;
  font-size: 0.73rem;
  font-weight: 400;
  margin-left: 6px;
  letter-spacing: 0;
}

.hand {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 110px;
  align-items: flex-end;
  padding-bottom: 6px;
}

/* ── Table center ── */
.table-center {
  display: flex;
  justify-content: center;
  gap: 48px;
  padding: 6px 0;
}
.pile-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.pile-label {
  font-size: 0.68rem;
  letter-spacing: 1.2px;
  opacity: 0.55;
  text-transform: uppercase;
}

/* ── Cards ── */
.card {
  width: 66px;
  height: 98px;
  border-radius: 8px;
  border: 2px solid transparent;
  background: transparent;
  display: flex;
  flex-direction: column;
  padding: 0;
  box-shadow: 2px 3px 8px rgba(0,0,0,0.45);
  user-select: none;
  position: relative;
  flex-shrink: 0;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
  overflow: hidden;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  border-radius: 6px;
  pointer-events: none;
}

.card.clickable { cursor: pointer; }
.card.clickable:hover {
  transform: translateY(-10px);
  box-shadow: 2px 14px 20px rgba(0,0,0,0.45);
}
.card.selected {
  transform: translateY(-20px) !important;
  border-color: #e74c3c;
  border-width: 2.5px;
  box-shadow: 0 20px 26px rgba(0,0,0,0.5) !important;
}

.card.face-down {
  background: repeating-linear-gradient(135deg, #1b3a5a 0 6px, #22497a 6px 12px);
  border-color: #4a80bb;
  cursor: default;
}

.card.pile-draw,
.card.drawable { cursor: pointer; }
.card.pile-draw:hover,
.card.drawable:hover { transform: scale(1.07); }

.card.empty-pile {
  background: rgba(255,255,255,0.07);
  border: 2px dashed rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.35);
  font-size: 0.65rem;
  text-align: center;
  justify-content: center;
  align-items: center;
  cursor: default;
}

.cv { font-weight: 700; font-size: 13px; line-height: 1.15; }
.cv small { font-size: 9px; font-weight: 400; display: block; line-height: 1.2; }
.cv.top { align-self: flex-start; }
.cv.bot { align-self: flex-end; transform: rotate(180deg); }
.cs { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 26px; }

/* ── Buttons ── */
button {
  padding: 10px 22px;
  border: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  letter-spacing: 0.3px;
}
button:hover:not(:disabled) { opacity: .83; transform: translateY(-1px); }
button:active:not(:disabled) { transform: translateY(0); }
button:disabled { opacity: .3; cursor: not-allowed; }

.btn-draw    { background: #2980b9; color: #fff; }
.btn-discard { background: #c0392b; color: #fff; }
.btn-cantar  { background: #f39c12; color: #1a1a1a; }
.btn-new     { background: #27ae60; color: #fff; }

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

.status-bar {
  text-align: center;
  font-size: 0.83rem;
  opacity: 0.65;
  min-height: 1.3em;
}

/* ── Start screen ── */
.start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  flex: 1;
}
.start-screen h1 {
  font-size: 3.5rem;
  letter-spacing: 6px;
  text-shadow: 3px 5px 14px rgba(0,0,0,0.45);
}

.player-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 260px;
}
.player-inputs input {
  padding: 11px 14px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  background: rgba(255,255,255,0.14);
  color: #fff;
  outline: none;
}
.player-inputs input:focus { background: rgba(255,255,255,0.24); }
.player-inputs input::placeholder { color: rgba(255,255,255,0.38); }

/* ── Result overlay ── */
.result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.62);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.result-card {
  background: #16422c;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 16px;
  padding: 36px 44px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.result-card h2 { font-size: 1.7rem; }
.result-card p  { font-size: 0.9rem; opacity: 0.8; }

.score-table { width: 100%; border-collapse: collapse; }
.score-table td {
  padding: 7px 12px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  font-size: 0.95rem;
}
.score-table td:last-child { text-align: right; font-weight: 700; }

.result-groups {
  font-size: 0.78rem;
  opacity: 0.65;
  text-align: left;
  line-height: 1.6;
}

/* ── Mode selection ── */
.mode-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 260px;
}

.btn-mode {
  background: #3498db;
  color: #fff;
  padding: 16px 22px;
  font-size: 1rem;
}

.btn-back {
  background: rgba(255,255,255,0.15);
  color: #fff;
  align-self: flex-start;
  padding: 8px 16px;
  font-size: 0.88rem;
}
