/* Interfaz: barra superior, panel de acción, jugadores, hojas, avisos, efectos, resultado */
.topbar { display: flex; justify-content: space-between; align-items: center; font-size: 12px; gap: 8px; min-height: 26px; }
.topbar .ev { flex: 1; text-align: center; background: var(--gold); color: var(--ink); border-radius: 8px; padding: 2px 6px; font-weight: 800; animation: popIn .4s; }
.topbar .ev:empty { display: none; }
.topbar .tb { display: flex; gap: 6px; }
.iconbtn { border: 0; background: var(--glass2); color: #fff; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; font-size: 16px; }
.iconbtn.off { opacity: .45; }
.iconbtn:active { transform: scale(.92); }

.panel { background: var(--glass); border: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(6px); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 84px; }
.panel.mine { border-color: rgba(255,201,20,.55); box-shadow: 0 0 0 1px rgba(255,201,20,.25), 0 0 24px rgba(255,201,20,.18); }
.panel .msg { font-size: 15px; line-height: 1.3; }
.panel .msg b { color: var(--gold); }
.panel .btns { display: flex; gap: 8px; flex-wrap: wrap; }
.panel .btns .btn { flex: 1; min-width: 120px; }
.bidrow { display: flex; gap: 8px; }
.bidrow .btn { flex: 1; padding: 12px 6px; }
.bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,.2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #ff9f43); width: 100%; transition: width .25s linear; }

.players { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pl { background: var(--glass); border-radius: 13px; padding: 8px 10px 8px 8px; font-size: 12px; position: relative; cursor: pointer; display: flex; gap: 8px; align-items: center; overflow: hidden; transition: background .3s, box-shadow .3s, transform .2s; }
.pl .av { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 900; color: #fff; font-size: 15px; background: radial-gradient(circle at 34% 28%, rgba(255,255,255,.7), transparent 40%), var(--c); border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,.35); }
.pl .bd { min-width: 0; flex: 1; }
.pl.turn { background: rgba(255,201,20,.22); box-shadow: 0 0 0 2px var(--gold) inset, 0 0 18px rgba(255,201,20,.25); transform: translateY(-1px); }
.pl.out { opacity: .4; }
.pl.out .n { text-decoration: line-through; }
.pl .n { font-weight: 800; font-size: 13px; display: flex; gap: 4px; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pl .cash { font-size: 17px; font-weight: 900; color: #b8f5c9; font-variant-numeric: tabular-nums; }
.pl .cash.up { animation: flashUp .7s; }
.pl .cash.down { animation: flashDown .7s; }
@keyframes flashUp { 30% { color: #fff; transform: scale(1.15); text-shadow: 0 0 12px #6dffa6; } }
@keyframes flashDown { 30% { color: #ffd0c6; transform: scale(1.1); text-shadow: 0 0 12px #ff6b4a; } }
.pl .debt { color: #ffb3a1; }
.toolbar { display: flex; gap: 6px; }

/* hojas (modales inferiores) */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(2px); }
.sheet-card { position: relative; background: var(--sand); color: var(--ink); width: min(100%, 560px); max-height: 88vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 18px 16px max(20px, env(safe-area-inset-bottom)); animation: up .22s cubic-bezier(.2,.9,.3,1.1); }
@keyframes up { from { transform: translateY(60px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-x { position: absolute; right: 10px; top: 6px; font-size: 28px; background: none; border: 0; color: var(--ink); cursor: pointer; }
.sheet h3 { margin: 0 0 8px; font-size: 18px; }
.sheet .btn { color: #fff; }
.sheet .btn.gold { color: var(--ink); }
.sheet .btn.ghost { color: var(--ink); border-color: rgba(0,0,0,.25); }
.sheet .btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.sheet .btns .btn { flex: 1; min-width: 100px; }
.sheet .kv { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed rgba(0,0,0,.15); font-size: 14px; }
.sheet .kv.on { background: rgba(255,201,20,.35); font-weight: 800; }
.sheet .band { height: 14px; border-radius: 6px; margin: 4px 0 8px; }
.sheet .prow { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-bottom: 1px solid rgba(0,0,0,.1); font-size: 14px; }
.sheet .prow .sw { width: 10px; height: 26px; border-radius: 4px; flex: none; }
.sheet .prow .grow { flex: 1; min-width: 0; }
.sheet .prow small { display: block; opacity: .65; font-size: 11px; }
.sheet .prow .btn { padding: 6px 9px; font-size: 12px; flex: none; min-width: 0; }
.sheet .chk { display: flex; gap: 8px; align-items: center; padding: 6px 4px; font-size: 14px; }
.sheet .chk input { width: 20px; height: 20px; padding: 0; }
.sheet .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sheet .two h4 { margin: 0 0 4px; font-size: 13px; }
.sheet input[type=number] { width: 100%; padding: 8px; border: 2px solid rgba(0,0,0,.2); }
.sheet .logl { font-size: 13px; padding: 3px 0; border-bottom: 1px dashed rgba(0,0,0,.1); }
.sheet .chatrow { display: flex; gap: 6px; margin-top: 8px; }
.sheet .chatrow input { flex: 1; }
.sheet p { margin: 6px 0; font-size: 14px; line-height: 1.4; }
.sheet ul { padding-left: 18px; font-size: 14px; line-height: 1.45; }

.toast { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: min(92vw, 520px); }
.toast div { background: rgba(10,10,10,.92); color: #fff; padding: 9px 14px; border-radius: 12px; font-size: 14px; animation: pop .2s ease-out; box-shadow: 0 4px 14px rgba(0,0,0,.4); text-align: center; }
.toast div.bad { background: #b3261e; }
.toast div.good { background: #1f7a4c; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* carta con volteo 3D */
.cardpop { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(0,0,0,.3); pointer-events: none; perspective: 900px; }
.cardpop .c { pointer-events: auto; width: min(86vw, 340px); background: linear-gradient(160deg, #fff7de, var(--sand)); color: var(--ink); border-radius: 18px; padding: 22px 18px; text-align: center; border-top: 14px solid var(--teal); box-shadow: 0 18px 50px rgba(0,0,0,.55); animation: flip .6s cubic-bezier(.2,.9,.3,1.1); }
.cardpop .c.event { border-top-color: var(--coral); }
.cardpop .c h4 { margin: 0 0 8px; text-transform: uppercase; letter-spacing: 1px; font-size: 12px; opacity: .7; display: flex; gap: 6px; justify-content: center; align-items: center; }
.cardpop .c p { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; }
.cardpop .c small { display: block; margin-top: 10px; opacity: .6; }
@keyframes flip { 0% { transform: rotateY(-100deg) translateY(60px) scale(.7); opacity: 0; } 100% { transform: none; opacity: 1; } }
.conn { position: fixed; top: 0; left: 0; right: 0; background: #c0392b; text-align: center; padding: 6px; z-index: 100; font-size: 13px; }

/* capas de efectos */
#fx { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
#floaters { position: fixed; inset: 0; z-index: 81; pointer-events: none; overflow: hidden; }
.flo { position: absolute; transform: translate(-50%, -50%); font-weight: 900; font-size: 20px; text-shadow: 0 2px 0 rgba(0,0,0,.55), 0 0 10px rgba(0,0,0,.4); animation: floatUp 1.5s ease-out forwards; white-space: nowrap; }
.flo.plus { color: #7dffae; }
.flo.minus { color: #ff8e7a; }
.flo.info { color: #ffe27a; font-size: 15px; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -80%) scale(1.25); } 100% { opacity: 0; transform: translate(-50%, -260%) scale(1); } }
#banner { position: fixed; left: 0; right: 0; top: 24%; z-index: 85; display: flex; justify-content: center; pointer-events: none; }
#banner div { background: linear-gradient(90deg, transparent, rgba(0,0,0,.72) 18%, rgba(0,0,0,.72) 82%, transparent); padding: 14px 44px; text-align: center; animation: bannerIn 2.1s cubic-bezier(.2,.9,.3,1) forwards; }
#banner h2 { font-size: 30px; letter-spacing: 1px; text-shadow: 0 3px 0 rgba(0,0,0,.4); display: flex; gap: 8px; align-items: center; justify-content: center; }
#banner h2 .i { width: 1em; height: 1em; }
#banner p { margin: 4px 0 0; font-size: 14px; opacity: .9; }
#banner.good h2 { color: var(--gold); }
#banner.bad h2 { color: #ff8e7a; }
#banner.event h2 { color: #8ff0ee; }
@keyframes bannerIn { 0% { opacity: 0; transform: scaleY(.1) scaleX(.6); } 14% { opacity: 1; transform: none; } 82% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-14px); } }
body.shake #app { animation: shake .6s; }
@keyframes shake { 10%,50%,90% { transform: translateX(-6px); } 30%,70% { transform: translateX(6px); } }
#flash { position: fixed; inset: 0; z-index: 79; pointer-events: none; opacity: 0; }
#flash.on { animation: flashOn .7s ease-out; }
@keyframes flashOn { 0% { opacity: .65; } 100% { opacity: 0; } }

/* resultado: podio 3D + premios */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 8px; height: 190px; perspective: 700px; margin: 6px 0; }
.pod { flex: 1; max-width: 110px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.pod .who { font-weight: 800; font-size: 13px; text-align: center; margin-bottom: 4px; word-break: break-word; }
.pod .who small { display: block; font-weight: 700; opacity: .8; }
.pod .blk { width: 100%; border-radius: 10px 10px 0 0; display: grid; place-items: start center; padding-top: 6px; font-size: 26px; font-weight: 900; color: rgba(0,0,0,.55); transform-origin: bottom; animation: rise .9s cubic-bezier(.2,.9,.3,1.1) backwards; background: linear-gradient(#e9eef0, #aab6ba); box-shadow: inset 0 4px 0 rgba(255,255,255,.5); }
.pod.p1 .blk { height: 120px; background: linear-gradient(#ffe27a, #ffc914); animation-delay: .5s; }
.pod.p2 .blk { height: 84px; animation-delay: .25s; }
.pod.p3 .blk { height: 60px; background: linear-gradient(#e7b98a, #c98d59); animation-delay: 0s; }
.pod.p4 .blk { height: 42px; background: linear-gradient(#9fb0b5, #7d8d92); }
.pod .crown { color: var(--gold); font-size: 26px; animation: bob 1.4s ease-in-out infinite; }
@keyframes rise { from { transform: scaleY(0) rotateX(40deg); opacity: 0; } }
.awards { display: grid; gap: 8px; }
.award { display: flex; align-items: center; gap: 10px; background: var(--glass); border-radius: 12px; padding: 9px 12px; animation: screenIn .5s backwards; }
.award .ai { width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: var(--ink); display: grid; place-items: center; flex: none; }
.award b { display: block; font-size: 13px; }
.award span { font-size: 12px; opacity: .85; }
.result { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.result li { background: var(--glass); border-radius: 12px; padding: 10px 14px; display: flex; gap: 10px; align-items: center; }
.result li.win { background: var(--gold); color: var(--ink); font-weight: 800; }
.result .pos { font-size: 20px; font-weight: 900; width: 26px; }
.result .net { margin-left: auto; font-weight: 800; }
table.rank { width: 100%; border-collapse: collapse; font-size: 14px; }
table.rank th, table.rank td { padding: 8px 6px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.15); }
table.rank td:nth-child(n+3), table.rank th:nth-child(n+3) { text-align: right; }
#fx { width: 100vw; height: 100vh; }

/* puntos de color con las propiedades de cada jugador */
.pl .pdots { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 3px; min-height: 0; }
.pl .pdots i { width: 8px; height: 8px; border-radius: 2px; border: 1px solid rgba(255,255,255,.7); }

/* chat */
.chatbox { background: var(--glass); border: 1px solid rgba(255,255,255,.1); border-radius: var(--radius); overflow: hidden; }
.chat-h { width: 100%; display: flex; align-items: center; gap: 10px; background: transparent; border: 0; color: #fff; font: inherit; padding: 10px 12px; cursor: pointer; text-align: left; }
.chat-h .ct { font-weight: 800; }
.chat-h .prev { flex: 1; min-width: 0; font-style: normal; font-size: 12px; opacity: .65; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chatbox.open .chat-h .prev { display: none; }
.chat-h .badge { background: var(--coral); border-radius: 99px; min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; font-size: 12px; animation: popIn .3s; }
.chat-b { display: none; padding: 0 10px 10px; }
.chatbox.open .chat-b { display: block; }
.chat-b .msgs { height: 150px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 6px 2px; scroll-behavior: smooth; }
.chat-b .m { font-size: 14px; line-height: 1.3; background: rgba(0,0,0,.18); padding: 5px 9px; border-radius: 10px; align-self: flex-start; max-width: 92%; word-break: break-word; animation: pop .2s ease-out; }
.chat-b .m.me { align-self: flex-end; background: rgba(255,201,20,.22); }
.chat-b .m b { margin-right: 4px; }
.chat-b .m.empty { opacity: .6; background: none; font-size: 13px; }
.chat-b .quick { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 6px; scrollbar-width: none; }
.chat-b .qk { flex: none; font: inherit; font-size: 12px; background: var(--glass2); color: #fff; border: 0; border-radius: 99px; padding: 5px 10px; cursor: pointer; }
.chat-b .qk:active { transform: scale(.94); }
.chat-f { display: flex; gap: 6px; }
.chat-f input { flex: 1; min-width: 0; padding: 10px 12px; }
.chat-f .btn { flex: none; }

/* pantalla ancha: tablero grande a la izquierda, panel de juego y chat a la derecha */
@media (min-width: 980px) {
  :root { --bw: min(100vh - 120px, 760px); }
  #app { max-width: 1240px; padding-top: 14px; }
  #s-game { display: grid; grid-template-columns: minmax(0, 1fr) 390px; grid-auto-rows: min-content; column-gap: 22px; row-gap: 12px; align-items: start; }
  #s-game > .topbar { grid-column: 1 / -1; }
  #s-game > #board-wrap { grid-column: 1; grid-row: 2 / span 5; justify-self: center; }
  #s-game > :not(.topbar):not(#board-wrap):not(#feed) { grid-column: 2; }
  .chat-b .msgs { height: 210px; }
  .chat-h { cursor: default; }
  .chat-h .prev, .chat-h .badge { display: none; }
  .chat-b { display: block; }
  .tilt #board-wrap { margin-top: -10px; }
  #s-lobby, #s-menu, #s-rank, #s-result { max-width: 560px; margin: 0 auto; width: 100%; }
}
.chatwrap:empty { display: none; }
