/* Mapas mega, zoom, chat, ladrones, menú y mensaje de camino tapado */

.maps.three { grid-template-columns: repeat(3, 1fr); }
.maps.three .mapcard { padding: 8px 10px; gap: 8px; }
.maps.three .mapprev { width: 64px; height: 56px; }
.maptypes { margin-top: 4px; }
.maptypes .chip { font-size: 14px; padding: 4px 12px; }
.hint.small { font-size: 12px; margin: 6px 0 0; }
.slots.many { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.slots.many .slot { min-height: 54px; padding: 6px 8px; gap: 6px; }
.slots.many .slot-house { width: 20px; }
.slots.many .slot-name { font-size: 13px; }
.slots.many .slot.empty { font-size: 11px; }

/* barra superior: en pantallas grandes todo en una fila */
.tb-row { display: contents; }
.tb-btns { display: flex; gap: 6px; order: 5; }
.bank small { font-size: 11px; opacity: .6; font-weight: 700; margin-right: -4px; }
.chat-btn { position: relative; }
.chat-badge { display: none; position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 4px;
  background: #e2402f; color: #fff; font: 900 11px/18px 'Nunito', sans-serif; box-shadow: 0 0 0 2px #2a170a; animation: pop .3s; }
.chat-badge.show { display: block; }
@keyframes pop { from { transform: scale(0); } }

/* cámara del mapa */
#board { touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
#board.dragging { cursor: grabbing; }
#board.dragging * { pointer-events: none; }
#zoomctl { position: absolute; right: 10px; bottom: 10px; z-index: 3; display: flex; flex-direction: column; gap: 6px; }
.zbtn { width: 38px; height: 38px; border-radius: 50%; border: 2px solid #8a5d2b; background: rgba(255,246,220,.92); color: #2a1c0e;
  font: 900 22px/1 'Nunito', sans-serif; cursor: pointer; box-shadow: 0 3px 8px rgba(0,0,0,.35); display: grid; place-items: center; padding: 0; }
.zbtn:hover { background: #ffe9a8; }
.zbtn:active { transform: scale(.92); }
.water.far { opacity: .75; }

/* terreno oculto que se descubre */
.terr-wrap { transform-box: fill-box; transform-origin: center; }
.terr-wrap.unfog { animation: unfog .7s ease-in-out both; }
@keyframes unfog { 0% { transform: scaleX(1); } 50% { transform: scaleX(0); filter: brightness(1.8); } 100% { transform: scaleX(1); } }
.token-wrap.gone { transition: opacity .4s, transform .4s; opacity: 0; }

/* varios ladrones */
.robber { transition: transform .9s cubic-bezier(.5,-0.3,.4,1.4); }
.robber .rob-hit { fill: transparent; pointer-events: none; }
.robber.pickable .rob-hit { pointer-events: all; cursor: pointer; }
.robber.pickable .robber-bob { filter: drop-shadow(0 0 4px #fff); }
.robber.sel .robber-bob { filter: drop-shadow(0 0 6px #ffd56b) drop-shadow(0 0 12px #ff5a4a); animation: bob .6s ease-in-out infinite; }
.rob-badge circle { fill: #2a1c0e; stroke: #ffd56b; stroke-width: 2; }
.rob-badge text { fill: #ffd56b; font: 900 11px 'Nunito', sans-serif; text-anchor: middle; }
.robber, .robber * { pointer-events: none; }
.robber.pickable .rob-hit { pointer-events: all; }

/* chat */
#chatbox { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#chat-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px 0; }
.chat-tabs { display: flex; gap: 4px; flex: 1; }
.chat-tabs .tab { font-size: 12px; padding: 3px 8px; }
#chat-head .btn.red { display: none; }
#chat { display: flex; gap: 6px; }
#chat input { flex: 1; min-width: 0; }
#chat .btn { flex: none; }
.lg.empty { opacity: .6; font-style: italic; padding: 10px 0; text-align: center; }
body.chat-hidden #chatbox { display: none; }
body.chat-hidden #players { max-height: none; }

#sysmodal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; background: rgba(5,10,20,.7); backdrop-filter: blur(3px); }
#sysmodal.hidden { display: none; }

/* muchos jugadores (mapa mega): panel compacto */
#players.many { gap: 5px; }
#players.many .pl { padding: 4px 8px; }
#players.many .pl-house { width: 20px; }
#players.many .pl-name { font-size: 13px; }
#players.many .pl-vp { font-size: 18px; }
#players.many .pl-stats { font-size: 11px; gap: 7px; }

/* pantallas compactas: tablets, celulares y celulares en horizontal */
@media (max-width: 1000px), (max-height: 520px) and (orientation: landscape) {
  #chatbox { display: none; }
  body.chat-open #chatbox {
    display: flex; position: fixed; inset: 0; z-index: 95; background: linear-gradient(#1d120a, #120b06);
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    animation: fadeIn .2s;
  }
  body.chat-open #chat-head { padding: 10px 10px 6px; border-bottom: 2px solid #8a5d2b; }
  body.chat-open #chat-head .btn.red { display: inline-block; font-size: 14px; padding: 6px 12px; }
  body.chat-open .chat-tabs .tab { font-size: 14px; padding: 6px 10px; }
  body.chat-open #log { display: block; flex: 1; min-height: 0; font-size: 15px; padding: 10px 14px; }
  body.chat-open #chat { display: flex; }
  body.chat-open #chat { padding: 8px 10px 10px; }
  body.chat-open #chat input { font-size: 16px; padding: 10px 12px; } /* 16px evita el zoom automático en iPhone */
  body.chat-open #chat .btn { font-size: 15px; padding: 8px 14px; }
}

/* celular vertical: barra superior en dos filas que nunca se cortan */
@media (max-width: 760px) {
  #topbar { flex-direction: column; align-items: stretch; gap: 3px; padding: calc(4px + env(safe-area-inset-top)) 6px 4px; overflow: visible; }
  .tb-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
  .tb-main .brand { flex: none; }
  .tb-main .goal { flex: none; }
  .tb-main .roll-mini { flex: 1; min-width: 0; }
  .tb-btns { flex: none; gap: 4px; margin-left: auto; }
  #topbar .tb-btns .btn.small { padding: 3px 6px; font-size: 15px; }
  .tb-info { overflow-x: auto; scrollbar-width: none; gap: 10px; white-space: nowrap; }
  .tb-info::-webkit-scrollbar { display: none; }
  .tb-info .bank { display: flex !important; margin: 0; gap: 6px; font-size: 12px; flex: none; }
  .tb-info .bank .ico { width: 15px; height: 15px; }
  .tb-info #myports { margin: 0; flex: none; display: flex; align-items: center; }
  .tb-info .ports-title { display: inline !important; font-size: 11px; opacity: .8; margin-right: 3px; }
  .chat-btn .txt { display: none; }
  .maps.three { grid-template-columns: 1fr; }
  .slots.many { grid-template-columns: repeat(2, 1fr); }
  #zoomctl { right: 6px; bottom: 6px; gap: 4px; }
  .zbtn { width: 34px; height: 34px; font-size: 20px; }
}
@media (max-width: 440px) {
  .tb-main .brand { display: block; font-size: 13px; }
  .tb-main .brand .code-pill { display: none; }
}
/* celular horizontal */
@media (max-height: 520px) and (orientation: landscape) {
  .chat-btn .txt, .emote-top .txt { display: none; }
  .bank small { display: none; }
  #zoomctl { flex-direction: row; right: 6px; bottom: 6px; }
  .zbtn { width: 32px; height: 32px; font-size: 18px; }
}

/* nada debe ensanchar la pantalla más que el celular (era lo que cortaba el mapa y la barra) */
#game { grid-template-columns: minmax(0, 1fr); width: 100%; max-width: 100vw; overflow: hidden; }
#topbar, #main, #bottom, .tb-row, .tb-info, #side, #players { min-width: 0; }
#main { grid-template-columns: minmax(0, 1fr) 310px; }
@media (max-width: 1400px) { #main { grid-template-columns: minmax(0, 1fr) 270px; } }
@media (max-width: 1000px) { #main { grid-template-columns: minmax(0, 1fr); } }
@media (max-height: 520px) and (orientation: landscape) { #main { grid-template-columns: minmax(0, 1fr) 190px; } }

@media (max-width: 760px) {
  #toasts { top: auto; bottom: 150px; }
}
@media (max-width: 760px) { #toasts { right: 54px; } }
.pl-stats span { white-space: nowrap; }
@media (max-width: 760px) { #players.many .pl { min-width: 138px; } #players.many .pl-stats { gap: 5px; } }

/* 🚪 salir y menú ☰ del celular */
.phone-only { display: none !important; }
.leave-btn { border-color: rgba(255,120,100,.5) !important; }
#menu-pop { position: fixed; top: 44px; right: 6px; z-index: 80; display: none; flex-direction: column; gap: 6px; padding: 8px;
  background: linear-gradient(#3d2410, #24140a); border: 2px solid var(--gold); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.6); min-width: 220px; }
#menu-pop.show { display: flex; animation: rise .2s ease-out; }
.menu-item { text-align: left; font: 800 16px 'Nunito', sans-serif; color: #fbeccb; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px; padding: 12px 14px; cursor: pointer; }
.menu-item:active { transform: scale(.98); }
.menu-item.danger { color: #fff; background: #b3352a; border-color: #ff8a7a; }
.room-code .btn.red { margin-left: 4px; }
@media (max-width: 760px) {
  .desk-only { display: none !important; }
  .phone-only { display: inline-block !important; }
  #menu-pop { top: calc(40px + env(safe-area-inset-top)); left: auto; right: 6px; }
}
@media (max-width: 1400px) { .leave-btn .txt { display: none; } }

/* 🤏 camino tapado */
.cutfx { background: radial-gradient(circle, rgba(80,20,0,.5), rgba(0,0,0,.88)); animation: fadeIn .2s, quake .4s .2s 2; padding: 0 12px; }
.cut-title { font-size: clamp(26px, 6vw, 72px); max-width: 1100px; line-height: 1.15; }
.cut-sub { font-size: clamp(28px, 6vw, 76px); margin-top: 6px; animation-delay: .5s; }
.cut-road { display: flex; align-items: center; gap: 0; margin-bottom: 14px; animation: bigIn .5s both; }
.cut-road span { width: clamp(70px, 16vw, 180px); height: 16px; background: repeating-linear-gradient(90deg, #8a5d2b 0 18px, #6b4420 18px 22px); border-radius: 8px; box-shadow: 0 3px 0 #2a1608; }
.cut-road b { font-size: clamp(38px, 7vw, 70px); margin: 0 -6px; animation: dropIn .6s .3s cubic-bezier(.3,1.6,.5,1) both; z-index: 1; filter: drop-shadow(0 4px 6px rgba(0,0,0,.6)); }
@keyframes dropIn { from { transform: translateY(-200px) scale(.5); opacity: 0; } }
