:root {
  --bg: #123524;
  --panel: #fffdf6;
  --ink: #1d2b22;
  --muted: #6b7a70;
  --line: #e2ddcf;
  --accent: #1f9d55;
  --accent-ink: #fff;
  --danger: #d64541;
  --gold: #f4b400;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(0, 0, 0, .25);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
input { font: inherit; }

#scene { position: fixed; inset: 0; }
#scene canvas { display: block; width: 100%; height: 100%; touch-action: none; }

/* ---------- pantallas de inicio y sala ---------- */
.screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 50% 30%, rgba(18, 53, 36, .2), rgba(10, 30, 20, .65)); overflow-y: auto; z-index: 5; }
.panel { width: min(420px, 100%); background: var(--panel); border-radius: 20px; padding: 24px 20px; box-shadow: var(--shadow); }
.panel.wide { width: min(520px, 100%); }
.logo { margin: 0; text-align: center; font-size: 38px; letter-spacing: 2px; font-weight: 900; color: #c62828;
  text-shadow: 0 2px 0 #fff, 0 4px 0 rgba(0, 0, 0, .15); }
.logo span { color: var(--accent); }
.sub { text-align: center; color: var(--muted); margin: 6px 0 20px; }
.field { display: block; font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.field input, .row input, .num-input { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: 12px;
  border: 2px solid var(--line); font-size: 17px; background: #fff; color: var(--ink); outline: none; }
.field input:focus, .row input:focus { border-color: var(--accent); }
.row { display: flex; gap: 8px; }
.row input { margin: 0; text-transform: uppercase; letter-spacing: 3px; text-align: center; font-weight: 700; }
.or { text-align: center; color: var(--muted); font-size: 13px; margin: 18px 0 10px; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }

.btn { border: 0; border-radius: 12px; padding: 12px 16px; background: #eef0ea; font-weight: 700; cursor: pointer;
  transition: transform .08s, filter .15s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.gold { background: var(--gold); color: #3a2a00; }
.btn.ghost { background: transparent; color: var(--muted); width: 100%; margin-top: 6px; }
.btn.big { width: 100%; padding: 15px; font-size: 17px; }
.btn.small { padding: 8px 12px; font-size: 14px; }

.lobby-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.code { font-size: 32px; font-weight: 900; letter-spacing: 5px; }
.panel h3 { margin: 18px 0 8px; font-size: 15px; }
.lobby-players { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.lobby-players li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: #f3f1e8; }
.lobby-players .kick { margin-left: auto; }
.swatch { width: 18px; height: 18px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .15); }
.tag { font-size: 11px; background: var(--ink); color: #fff; border-radius: 6px; padding: 2px 6px; }
.off { opacity: .5; }
.picker { display: flex; flex-wrap: wrap; gap: 6px; }
.picker button { border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 10px; cursor: pointer; font-size: 14px; }
.picker button.on { border-color: var(--accent); background: #e7f6ec; font-weight: 700; }
.picker button:disabled { opacity: .35; }
.picker.colors { margin-top: 8px; }
.picker.colors button { width: 34px; height: 34px; border-radius: 50%; padding: 0; }
.picker.colors button.on { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--ink); }
.settings { display: grid; gap: 8px; margin-top: 6px; }
.settings label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.settings select { font: inherit; padding: 6px; border-radius: 8px; border: 1px solid var(--line); }
#startBtn { margin-top: 18px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#hud > * { pointer-events: auto; }
#topbar { position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 8px; align-items: flex-start;
  padding: calc(8px + var(--safe-t)) 8px 0; }
#players { flex: 1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
#players::-webkit-scrollbar { display: none; }
.pchip { flex: none; display: flex; align-items: center; gap: 7px; padding: 6px 10px 6px 7px; border-radius: 12px;
  background: rgba(255, 253, 246, .92); box-shadow: 0 2px 8px rgba(0, 0, 0, .18); font-size: 13px; cursor: pointer;
  border: 2px solid transparent; transition: border-color .2s; }
.pchip.turn { border-color: var(--gold); }
.pchip.out { opacity: .45; text-decoration: line-through; }
.pchip .nm { font-weight: 700; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pchip .mn { font-variant-numeric: tabular-nums; }
.pchip .mn.neg { color: var(--danger); font-weight: 700; }
.pchip .ic { font-size: 11px; }
.top-buttons { display: flex; gap: 6px; }
.icon-btn { position: relative; width: 42px; height: 42px; border-radius: 12px; border: 0; background: rgba(255, 253, 246, .92);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18); font-size: 19px; cursor: pointer; }
#chatDot, .dot { position: absolute; top: 5px; right: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }
.dot { position: static; display: inline-block; margin-left: 6px; vertical-align: middle; }

#ticker { position: absolute; left: 8px; right: 8px; bottom: calc(150px + var(--safe-b)); display: flex; flex-direction: column;
  align-items: flex-start; gap: 4px; pointer-events: none !important; }
#ticker div { background: rgba(0, 0, 0, .55); color: #fff; padding: 4px 9px; border-radius: 8px; font-size: 12.5px; max-width: 100%;
  animation: fadein .3s; }
#ticker div.old { opacity: .55; }

#bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 10px calc(10px + var(--safe-b));
  background: linear-gradient(transparent, rgba(0, 0, 0, .35) 30%); display: grid; gap: 8px; }
#status { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); font-size: 14px; text-align: center; min-height: 20px; }
#status b { color: #ffe27a; }
#actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
#actions .btn { min-width: 130px; padding: 14px 18px; font-size: 16px; box-shadow: 0 3px 10px rgba(0, 0, 0, .3); }
#tools { display: flex; gap: 8px; justify-content: center; }
#tools .btn { background: rgba(255, 253, 246, .92); }
.mini-dice { display: inline-flex; gap: 4px; vertical-align: middle; margin: 0 4px; }
.mini-dice span { width: 22px; height: 22px; border-radius: 5px; background: #fff; color: #111; display: grid; place-items: center;
  font-weight: 900; font-size: 13px; text-shadow: none; }

/* ---------- tarjeta sacada ---------- */
#cardPop { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); width: min(320px, 86vw); z-index: 6;
  border-radius: 16px; padding: 18px; box-shadow: var(--shadow); text-align: center; font-weight: 600; font-size: 17px;
  animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); pointer-events: none; }
#cardPop.chance { background: #fbe1c2; border: 4px solid #f39c3d; }
#cardPop.chest { background: #d5ecfa; border: 4px solid #4aa3df; }
#cardPop h4 { margin: 0 0 8px; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; opacity: .7; }

/* ---------- modales ---------- */
#modal { position: fixed; inset: 0; z-index: 8; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; }
#modal .sheet { width: min(560px, 100%); max-height: 86vh; overflow-y: auto; background: var(--panel); border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(16px + var(--safe-b)); animation: up .25s ease-out; }
@media (min-width: 700px) {
  #modal { align-items: center; }
  #modal .sheet { border-radius: 20px; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet-head h2 { margin: 0; font-size: 19px; }
.close { border: 0; background: #eee; border-radius: 50%; width: 34px; height: 34px; font-size: 18px; cursor: pointer; }

.deed { border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; background: #fff; }
.deed .band { padding: 10px; text-align: center; font-weight: 900; text-transform: uppercase; }
.deed .band small { display: block; font-weight: 600; font-size: 11px; letter-spacing: 1px; opacity: .8; }
.deed table { width: 100%; border-collapse: collapse; font-size: 14px; }
.deed td { padding: 5px 12px; text-align: left; }
.deed td:last-child { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.deed tr.cur td { background: #fff3c4; }
.deed .foot { border-top: 1px solid var(--line); padding: 8px 12px; font-size: 13px; color: var(--muted); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btn-row .btn { flex: 1; }

.plist { display: grid; gap: 8px; }
.pgroup { border-radius: 12px; background: #fff; border: 1px solid var(--line); overflow: hidden; }
.pgroup .gh { padding: 6px 10px; font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.prow { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.prow .pn { flex: 1; min-width: 120px; font-weight: 600; cursor: pointer; }
.prow .pn small { display: block; color: var(--muted); font-weight: 400; }
.prow .btn { padding: 7px 10px; font-size: 13px; }
.houses { letter-spacing: -2px; }
.mort { color: var(--danger); font-size: 12px; font-weight: 700; }

.trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .trade-cols { grid-template-columns: 1fr; } }
.trade-col { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.trade-col h4 { margin: 0 0 8px; font-size: 14px; }
.check { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; }
.check input { width: 18px; height: 18px; }
.offer { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; font-size: 14px; }
.offer ul { margin: 4px 0; padding-left: 18px; }

.auction { text-align: center; }
.auction .high { font-size: 34px; font-weight: 900; margin: 8px 0 2px; }
.auction .timer { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin: 10px 0; }
.auction .timer i { display: block; height: 100%; background: var(--gold); transition: width .25s linear; }
.bid-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }

.log { display: flex; flex-direction: column; gap: 4px; max-height: 55vh; overflow-y: auto; font-size: 14px; margin-bottom: 10px; }
.log div { padding: 5px 8px; border-radius: 8px; background: #f3f1e8; }
.log div.chat { background: #e3f1ff; }
.chat-row { display: flex; gap: 8px; }
.chat-row input { flex: 1; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--line); }

.winner { text-align: center; padding: 10px 0; }
.winner .trophy { font-size: 64px; }

#toasts { position: fixed; top: calc(64px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 9; display: grid; gap: 6px;
  width: min(420px, 92vw); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; animation: fadein .2s; }
.toast.err { background: var(--danger); }
#conn { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0, 0, 0, .8); color: #fff;
  padding: 12px 18px; border-radius: 12px; z-index: 20; }

@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.6); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (min-width: 900px) {
  #ticker { bottom: auto; top: 70px; left: 16px; max-width: 300px; }
  .pchip { font-size: 14px; padding: 8px 12px 8px 9px; }
}

/* ---------- invitación ---------- */
.invite { background: #fff3c4; border: 2px dashed var(--gold); border-radius: 12px; padding: 10px 12px; text-align: center;
  margin-bottom: 14px; font-size: 15px; }
.invite b { letter-spacing: 3px; }
.share-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.btn.wa { background: #25d366; color: #fff; }
.link-pill { display: block; width: 100%; margin-top: 10px; border: 1px dashed var(--line); background: #f6f4ec; color: var(--muted);
  border-radius: 10px; padding: 8px 10px; font-size: 13px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.link-pill::before { content: '🔗 '; }

/* ---------- ajustes ---------- */
#settingsBtn { position: fixed; top: calc(8px + var(--safe-t)); right: 8px; z-index: 7; }
.settings-gap { width: 42px; flex: none; }
.opt-title { margin: 16px 0 8px; font-size: 14px; font-weight: 800; }
.opt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.opt { border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 12px 10px; cursor: pointer; text-align: left;
  display: flex; gap: 10px; align-items: center; font-weight: 700; }
.opt .em { font-size: 26px; }
.opt small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 2px; }
.opt.on { border-color: var(--accent); background: #e7f6ec; box-shadow: 0 0 0 2px #fff inset; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: #eef0ea; border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; border-radius: 9px; padding: 10px 6px; background: transparent; font-weight: 700; cursor: pointer; }
.seg button.on { background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .15); color: var(--accent); }
.seg-desc { font-size: 13px; color: var(--muted); margin-top: 8px; min-height: 36px; }

/* ---------- negociación ---------- */
.trade-with { display: flex; align-items: center; gap: 8px; }
.side { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.side + .side { margin-top: 10px; }
.side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.side-head h4 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.side-head .cash { font-size: 12px; color: var(--muted); }
.money-box { display: flex; align-items: center; gap: 6px; background: linear-gradient(135deg, #e8f7ee, #d4f0df); border: 2px solid #b7e2c6;
  border-radius: 14px; padding: 6px; }
.money-box button { width: 40px; height: 40px; border: 0; border-radius: 10px; background: #fff; font-size: 20px; font-weight: 900;
  color: var(--accent); cursor: pointer; flex: none; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.money-box button:disabled { opacity: .35; }
.money-field { flex: 1; display: flex; align-items: center; justify-content: center; min-width: 0; }
.money-field span { font-size: 24px; font-weight: 900; color: #1b7a43; }
.money-field input { width: 100%; min-width: 0; border: 0; background: transparent; font-size: 26px; font-weight: 900; color: #1b7a43;
  text-align: center; outline: none; -moz-appearance: textfield; font-variant-numeric: tabular-nums; }
.money-field input::-webkit-outer-spin-button, .money-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.chips { display: flex; gap: 6px; margin: 8px 0 4px; flex-wrap: wrap; }
.chips button { border: 1px solid #b7e2c6; background: #fff; border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 700;
  color: #1b7a43; cursor: pointer; }
.chips button:disabled { opacity: .35; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 10px; }
.pcard { position: relative; border: 2px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; cursor: pointer;
  text-align: center; padding: 0 0 6px; font-size: 12px; line-height: 1.2; transition: transform .1s, box-shadow .15s, border-color .15s; }
.pcard .pc-band { height: 22px; display: grid; place-items: center; font-size: 14px; }
.pcard .pc-name { font-weight: 800; padding: 5px 4px 2px; min-height: 30px; display: grid; place-items: center; }
.pcard .pc-price { color: var(--muted); }
.pcard .pc-badge { position: absolute; top: 26px; right: 4px; background: var(--danger); color: #fff; border-radius: 5px; font-size: 9px;
  padding: 1px 4px; font-weight: 800; }
.pcard.on { border-color: var(--ink); transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0, 0, 0, .18); }
.pcard.on::after { content: '✓'; position: absolute; top: 2px; right: 4px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  color: var(--accent); font-weight: 900; font-size: 12px; line-height: 18px; }
.pcard.dim { opacity: .4; cursor: not-allowed; }
.empty-side { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.swap-icon { text-align: center; font-size: 20px; margin: -2px 0; opacity: .6; }
.trade-summary { position: sticky; bottom: -16px; margin: 12px -16px -16px; padding: 12px 16px calc(12px + var(--safe-b));
  background: var(--panel); border-top: 1px solid var(--line); }
.trade-summary .bal { font-size: 13px; color: var(--muted); margin-bottom: 8px; text-align: center; }
.trade-summary .bal b.pos { color: var(--accent); }
.trade-summary .bal b.neg { color: var(--danger); }
.offer { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; font-size: 14px; }
.offer-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: start; }
.offer-col h5 { margin: 0 0 6px; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.offer-arrow { align-self: center; font-size: 18px; opacity: .5; }
.tag-list { display: flex; flex-direction: column; gap: 4px; }
.ptag { display: flex; align-items: center; gap: 6px; border-radius: 8px; background: #f6f4ec; padding: 4px 6px; font-size: 12.5px; font-weight: 600; }
.ptag i { width: 10px; height: 22px; border-radius: 3px; flex: none; }
.ptag.cash { background: #e3f5ea; color: #1b7a43; font-weight: 900; }
.ptag.none { color: var(--muted); font-weight: 400; background: transparent; }
.screen { padding-top: calc(60px + var(--safe-t)); }
.share-btns { flex-direction: column; align-items: stretch; }
.share-btns .btn { padding: 9px 12px; font-size: 14px; }
.picker .swatch, .offer-col .swatch, .side-head .swatch, .trade-with .swatch { display: inline-block; vertical-align: middle; }

/* ---------- resultado de los dados ---------- */
#diceResult { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); z-index: 6; pointer-events: none; text-align: center;
  background: rgba(20, 30, 25, .78); color: #fff; padding: 10px 22px 12px; border-radius: 16px; box-shadow: var(--shadow);
  animation: dicepop .35s cubic-bezier(.2, 1.4, .4, 1); backdrop-filter: blur(4px); }
@keyframes dicepop { from { transform: translateX(-50%) scale(.6); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
#diceResult small { display: block; font-size: 13px; opacity: .8; }
#diceResult b { display: block; font-size: 30px; font-weight: 900; letter-spacing: 1px; }
#diceResult em { display: block; font-style: normal; font-weight: 900; color: #ffe27a; font-size: 15px; }
kbd { font: 700 11px system-ui, sans-serif; background: rgba(255, 255, 255, .25); border-radius: 5px; padding: 2px 6px; margin-left: 6px;
  vertical-align: middle; border-bottom: 2px solid rgba(0, 0, 0, .2); }
.sound-row { display: flex; align-items: center; gap: 12px; }
.sound-row input[type=range] { flex: 1; accent-color: var(--accent); }
.add-bot { margin-top: 8px; width: 100%; border: 2px dashed var(--line); background: #fff; }

/* ---------- editor de tablero ---------- */
.board-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding: 10px 12px;
  border-radius: 12px; background: linear-gradient(135deg, #fff7e0, #fde9c4); border: 1px solid #f2d79a; }
.board-name { margin: 0 0 10px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; background: #eef0ea; border-radius: 12px; padding: 4px; margin-bottom: 12px; scrollbar-width: none; }
.tabs button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 9px 10px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.tabs button.on { background: #fff; color: var(--accent); box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.seg.seg2 { grid-template-columns: 1fr 1fr; flex: 1; }
.ev-new { background: #fff; border: 2px solid #b7e2c6; border-radius: 14px; padding: 12px; margin-bottom: 14px; }
.ev-title { display: block; font-weight: 800; margin-bottom: 6px; }
.ev-new textarea, .ev-card textarea { width: 100%; border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; resize: vertical; }
.ev-new textarea:focus, .ev-card textarea:focus { border-color: var(--accent); outline: none; }
.ev-detect { font-size: 13px; margin: 8px 0; min-height: 18px; }
.ev-detect b { color: #1b7a43; }
.ev-add-row { display: flex; gap: 8px; align-items: center; }
.ev-examples button { text-align: left; font-weight: 600; }
.ev-list-head { font-weight: 800; margin: 14px 0 8px; }
.ev-list { display: grid; gap: 8px; }
.ev-card { border-radius: 12px; padding: 10px; border: 2px solid; }
.ev-card.suerte { background: #fff4e6; border-color: #f7c48a; }
.ev-card.caja { background: #eaf5fd; border-color: #a9d3f2; }
.ev-row { display: flex; gap: 8px; align-items: flex-start; }
.ev-row.ev-fx { margin-top: 6px; flex-wrap: wrap; align-items: flex-end; }
.ev-effect, .ev-param select { max-width: 100%; padding: 7px 8px; border-radius: 9px; border: 1px solid var(--line); font: inherit; font-size: 13px; background: #fff; }
.ev-effect { flex: 1 1 220px; }
.ev-param { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); gap: 2px; }
.ev-param input { width: 90px; padding: 7px 8px; border-radius: 9px; border: 1px solid var(--line); font: inherit; }
.ev-param select { width: 200px; }
.pe-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 8px 10px; border-top: 1px solid var(--line); }
.pe-row label { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); gap: 2px; }
.pe-row input { padding: 7px 8px; border-radius: 9px; border: 1px solid var(--line); font: inherit; width: 84px; }
.pe-row input.pe-name { flex: 1 1 160px; width: auto; font-weight: 700; }
.pe-rent { width: 100%; font-size: 13px; }
.pe-rent summary { cursor: pointer; color: var(--muted); }
.pe-rents { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.pe-rents input { width: 100%; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.color-item { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font-weight: 700; cursor: pointer; }
.color-item input { width: 44px; height: 36px; border: 0; padding: 0; background: none; cursor: pointer; }
.json-area { width: 100%; min-height: 46vh; font: 12px/1.45 ui-monospace, Consolas, monospace; border: 2px solid var(--line); border-radius: 12px;
  padding: 10px; background: #1e2420; color: #d6f5df; resize: vertical; }
.file-btn { display: inline-flex; align-items: center; }
.editor-error { margin-top: 10px; background: #fde8e7; color: #9b2420; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.editor-foot .btn-row .btn { flex: 1; }

/* ---------- ventanas a la medida de la pantalla (sin scroll de página) ---------- */
#modal .sheet { max-height: calc(100dvh - 8px); }
#modal .sheet.full { height: calc(100dvh - 8px); display: flex; flex-direction: column; overflow: hidden; }
@media (min-width: 700px) { #modal .sheet.full { height: min(760px, calc(100dvh - 40px)); width: min(760px, 100%); } }
.sheet-head { flex: none; margin-bottom: 8px; }
.sheet.full .tab-body { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.sheet.full .tabs, .sheet.full .board-name, .sheet.full .editor-error { flex: none; }
.sheet.full .editor-foot { position: static; margin: 10px 0 0; padding: 0; border: 0; }
.sheet.full .log { flex: 1; min-height: 0; max-height: none; }

/* negociación: dos columnas lado a lado */
.tc { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tc-col { display: flex; flex-direction: column; gap: 6px; min-height: 0; min-width: 0; background: #fff; border: 1px solid var(--line);
  border-top: 4px solid; border-radius: 12px; padding: 8px; }
.tc-head { display: flex; align-items: center; gap: 6px; font-size: 13px; min-width: 0; }
.tc-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-head small { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.tc-head .swatch { width: 12px; height: 12px; display: inline-block; }
.money-box.sm { padding: 4px; gap: 4px; border-radius: 12px; }
.money-box.sm button { width: 30px; height: 32px; font-size: 18px; border-radius: 8px; }
.money-box.sm .money-field span { font-size: 15px; }
.money-box.sm .money-field input { font-size: 19px; }
.chips.sm { margin: 0; gap: 4px; flex-wrap: nowrap; }
.chips.sm button { flex: 1; padding: 4px 0; font-size: 11.5px; min-width: 0; }
.tc-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 2px; }
.prow2 { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; border: 1.5px solid var(--line); background: #fff;
  border-radius: 8px; padding: 6px 7px 6px 0; font: inherit; font-size: 12px; cursor: pointer; overflow: hidden; flex: none; }
.prow2 i { width: 6px; align-self: stretch; margin: -6px 0; flex: none; }
.prow2 .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.prow2 .p { color: var(--muted); font-size: 11px; flex: none; }
.prow2.on { border-color: var(--accent); background: #e7f6ec; }
.prow2.on .p::after { content: ' ✓'; color: var(--accent); font-weight: 900; }
.prow2.dim { opacity: .38; cursor: not-allowed; }
.tc .empty-side { margin: 4px 0; font-size: 12px; }
.tc-foot { flex: none; padding-top: 8px; }
.tc-foot .bal { font-size: 12.5px; text-align: center; color: var(--muted); margin-bottom: 6px; }
.tc-foot .bal b.pos { color: var(--accent); }
.tc-foot .bal b.neg { color: var(--danger); }
.tc-foot .btn { width: 100%; padding: 13px; font-size: 16px; }

/* salir (en ajustes) */
.exit-box { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.exit-btn { width: 100%; background: #f3f1e8; }
.btn.danger-soft { background: #fde8e7; color: #b3261e; }
.exit-box.confirm { background: #fff6f5; border: 1px solid #f3c4c0; border-radius: 12px; padding: 12px; }
.exit-box.confirm p { margin: 0 0 4px; font-size: 14px; }

/* ---------- sala de espera compacta ---------- */
#lobby .panel { padding: 16px 16px 14px; }
#lobby .panel h3 { margin: 12px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
#lobby .code { font-size: 28px; }
.lobby-players { display: flex !important; flex-wrap: wrap; gap: 6px !important; }
.lobby-players li { padding: 5px 8px !important; font-size: 13px; gap: 6px !important; }
.lobby-players .kick { padding: 2px 7px; font-size: 11px; margin-left: 2px; }
.add-bot { margin-top: 6px; padding: 7px; }
#tokenPick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
#tokenPick button { padding: 6px 2px; font-size: 13px; }
.picker.colors { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; justify-items: center; margin-top: 6px; }
.picker.colors button { width: 30px; height: 30px; }
#lobby .board-box { margin-top: 10px; padding: 8px 10px; }
#lobby .board-box .btn { padding: 8px 10px; font-size: 14px; }
#lobby .settings { gap: 4px; font-size: 13px; }
#lobby .settings label { font-size: 13px; }
#startBtn { margin-top: 12px; padding: 13px; }
#lobbyWait { margin: 6px 0 0; }
#lobbyWait:empty { display: none; }
.link-pill { margin-top: 8px; padding: 6px 10px; }
.prow2 .n { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; }
