/* ===== Banco Monopoly ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --green: #0e5f38;
  --green-dark: #0a4429;
  --green-light: #e4f2e9;
  --red: #d32f2f;
  --red-dark: #a82424;
  --cream: #f6f1e5;
  --ink: #1c1c1c;
  --gold: #c9a227;
  --shadow: 0 3px 0 rgba(0,0,0,.25);
}

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--cream);
  color: var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
}

.hidden { display: none !important; }
.view { min-height: 100dvh; }

/* ---------- botones ---------- */
.btn {
  border: 3px solid var(--ink);
  border-radius: 14px;
  font-weight: 800;
  font-size: 1.05rem;
  padding: 14px 18px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .05s;
  color: #fff;
  font-family: inherit;
}
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn-red { background: var(--red); }
.btn-green { background: var(--green); }
.btn-ghost { background: #fff; color: var(--ink); font-weight: 700; }
.btn-big { width: 100%; font-size: 1.3rem; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.btn-big .sub { font-size: .8rem; font-weight: 600; opacity: .85; text-transform: uppercase; letter-spacing: 1px; }
.btn-sm { font-size: .85rem; padding: 9px 10px; border-width: 2px; border-radius: 10px; box-shadow: 0 2px 0 rgba(0,0,0,.25); }

/* ---------- inicio ---------- */
.home-wrap {
  max-width: 420px; margin: 0 auto; min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 24px;
}
.logo { text-align: center; margin-bottom: 20px; }
.logo-hat { font-size: 4rem; }
.logo h1 {
  font-size: 2.6rem; line-height: 1; letter-spacing: 2px; color: var(--red);
  text-shadow: 2px 2px 0 var(--ink); font-style: italic;
}
.tagline { margin-top: 10px; font-weight: 600; color: var(--green-dark); }

/* ---------- formularios ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 16px;
  padding-top: calc(16px + env(safe-area-inset-top));
  background: var(--green); color: #fff;
}
.topbar h2 { font-size: 1.2rem; }
.back {
  background: rgba(255,255,255,.2); border: none; color: inherit; font-size: 1.3rem;
  width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
}
.back.small { width: auto; height: auto; font-size: .75rem; padding: 4px 10px; }
.form-wrap { max-width: 420px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: .95rem; }
input {
  border: 3px solid var(--ink); border-radius: 12px; padding: 14px; font-size: 1.1rem;
  font-family: inherit; background: #fff; width: 100%;
}
input:focus { outline: 3px solid var(--gold); }
.code-input { text-transform: uppercase; letter-spacing: 10px; font-size: 1.6rem; font-weight: 800; text-align: center; }

/* ---------- banco ---------- */
.bank-header {
  background: var(--green); color: #fff; padding: 14px 20px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.bank-title { font-size: 1.4rem; font-weight: 900; font-style: italic; }
.bank-code-box, .bank-url-box { display: flex; flex-direction: column; line-height: 1.2; }
.bank-code-box span, .bank-url-box span { font-size: .7rem; opacity: .85; text-transform: uppercase; letter-spacing: 1px; }
.bank-code-box strong { font-size: 1.9rem; letter-spacing: 6px; color: var(--gold); }
.bank-url-box strong { font-size: 1.1rem; }
.bank-header .btn-ghost { margin-left: auto; }
.bank-header .btn-ghost + .btn-ghost { margin-left: 0; }

.bank-body { display: grid; grid-template-columns: 1fr 340px; gap: 20px; padding: 20px; align-items: start; }
@media (max-width: 900px) { .bank-body { grid-template-columns: 1fr; } }

.empty-note {
  background: #fff; border: 3px dashed var(--green); border-radius: 16px;
  padding: 40px 20px; text-align: center; font-size: 1.15rem; line-height: 1.8;
}
.players-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.player-card {
  background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 14px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
}
.player-card.dead { opacity: .5; filter: grayscale(1); }
.pc-top { display: flex; align-items: center; gap: 8px; }
.pc-emoji { font-size: 1.6rem; }
.pc-name { font-weight: 800; font-size: 1.05rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-dot { width: 10px; height: 10px; border-radius: 50%; background: #bbb; }
.pc-dot.on { background: #2ecc40; }
.pc-balance { font-size: 1.7rem; font-weight: 900; color: var(--green-dark); }
.pc-btns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.pc-bankrupt { background: none; border: none; color: #999; font-size: .75rem; cursor: pointer; text-decoration: underline; justify-self: end; font-family: inherit; }

.section-title { margin: 18px 0 10px; font-size: 1rem; }

/* ---------- jugador (celular) ---------- */
.player-header {
  background: var(--green); color: #fff; padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  display: flex; justify-content: space-between; align-items: center;
}
.ph-left { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.1rem; }
.ph-right { display: flex; align-items: center; gap: 10px; }
.ph-code { letter-spacing: 3px; color: var(--gold); font-weight: 800; }

.balance-card {
  margin: 16px; padding: 22px; text-align: center;
  background: var(--green); color: #fff; border: 3px solid var(--ink);
  border-radius: 20px; box-shadow: var(--shadow);
}
.balance-label { font-size: .75rem; letter-spacing: 3px; opacity: .85; }
.balance { font-size: 3rem; font-weight: 900; margin-top: 4px; }
.balance.flash-up { animation: flashUp .8s; }
.balance.flash-down { animation: flashDown .8s; }
@keyframes flashUp { 0% { color: #7dffb0; transform: scale(1.12); } }
@keyframes flashDown { 0% { color: #ff8a80; transform: scale(1.12); } }

.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 16px 8px; }
.btn-action { font-size: 1.05rem; line-height: 1.35; padding: 16px 8px; }

.view#view-player .section-title, #player-others, #player-history { margin-left: 16px; margin-right: 16px; }
.others { display: flex; flex-direction: column; gap: 8px; }
.other-row {
  background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
}
.other-row .pc-name { font-weight: 700; }
.other-row .pc-balance { font-size: 1.1rem; margin-left: auto; }

/* transferencias pendientes */
.pending-card {
  margin: 0 16px 12px; background: #fff8e1; border: 3px solid var(--gold);
  border-radius: 16px; padding: 14px; box-shadow: var(--shadow);
}
.pending-card.incoming { border-color: var(--green); background: var(--green-light); animation: pulse 1.5s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(14,95,56,.15); } }
.pending-text { font-weight: 700; margin-bottom: 10px; }
.pending-amount { font-size: 1.4rem; font-weight: 900; color: var(--green-dark); }
.pending-btns { display: flex; gap: 8px; }
.pending-btns .btn { flex: 1; }
.bank-pending-row {
  background: #fff8e1; border: 2px solid var(--gold); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 8px; font-weight: 600;
}

/* historial */
.history { display: flex; flex-direction: column; gap: 6px; padding-bottom: 30px; }
.history-row {
  background: #fff; border: 2px solid #ddd; border-radius: 10px;
  padding: 8px 12px; font-size: .88rem; display: flex; gap: 10px; align-items: baseline;
}
.history-row time { color: #999; font-size: .75rem; white-space: nowrap; }
.history-row.undone { text-decoration: line-through; opacity: .5; }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 700px) { .modal { align-items: center; } }
.modal-card {
  background: var(--cream); border: 3px solid var(--ink); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 440px; padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
}
@media (min-width: 700px) { .modal-card { border-radius: 20px; } }
.modal-title { font-weight: 900; font-size: 1.2rem; }
.modal-targets { display: flex; flex-wrap: wrap; gap: 8px; }
.modal-targets button {
  border: 2px solid var(--ink); background: #fff; border-radius: 20px; padding: 8px 14px;
  font-weight: 700; cursor: pointer; font-family: inherit; font-size: .95rem;
}
.modal-targets button.sel { background: var(--green); color: #fff; }
.amount-display { font-size: 2.4rem; font-weight: 900; text-align: center; color: var(--green-dark); }
.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chips button {
  border: 2px solid var(--ink); background: #fff; border-radius: 10px; padding: 12px 0;
  font-weight: 800; font-size: 1rem; cursor: pointer; box-shadow: 0 2px 0 rgba(0,0,0,.2);
  font-family: inherit;
}
.chips button:active { transform: translateY(2px); box-shadow: none; }
.chip-clear { background: #ffe0e0 !important; }
.modal-btns { display: flex; gap: 10px; }
.modal-btns .btn { flex: 1; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom));
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px;
  font-weight: 700; z-index: 100; max-width: 90vw; text-align: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.toast.error { background: var(--red-dark); }
