/* Dominó: mesa de fieltro, asientos alrededor, mano abajo. */
.dom { --tw: 54px; display: flex; flex-direction: column; height: calc(100dvh - 58px); max-width: 1240px; margin: 0 auto; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); gap: 8px; }
.dtop { display: flex; align-items: center; gap: 8px; flex: none; }
.dtop .spacer { flex: 1; }
.dinfo { font: 600 15px var(--display); color: var(--soft); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dinfo b { color: var(--yellow); }
.dinfo .chip { font: 800 12px var(--body); padding: 3px 9px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--border); color: var(--soft); }
.dmain { flex: 1; min-height: 0; display: flex; gap: 10px; }

/* mesa */
.dtable { flex: 1; min-width: 0; min-height: 0; display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto 1fr; grid-template-areas: "top top top" "left center right"; gap: 6px 8px; padding: 10px;
  border-radius: 26px; border: 7px solid #5a3818; position: relative;
  background:
    radial-gradient(120% 90% at 50% 40%, rgba(255, 255, 255, .06), transparent 60%),
    repeating-linear-gradient(45deg, rgba(0, 0, 0, .05) 0 2px, transparent 2px 5px),
    radial-gradient(100% 100% at 50% 50%, #17573f, #0c3527 80%);
  box-shadow: inset 0 0 0 2px #7a5127, inset 0 10px 40px rgba(0, 0, 0, .55), 0 14px 40px rgba(0, 0, 0, .5); }
.dcenter { grid-area: center; position: relative; min-width: 0; min-height: 0; }
.dcenter canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }
.s-top { grid-area: top; justify-self: center; }
.s-left { grid-area: left; align-self: center; }
.s-right { grid-area: right; align-self: center; }

/* asientos */
.seat { display: flex; align-items: center; gap: 8px; padding: 6px 10px 9px; border-radius: 16px; background: rgba(6, 22, 16, .62); border: 2px solid rgba(255, 255, 255, .08); position: relative; transition: box-shadow .2s, border-color .2s, background .2s; min-width: 0; }
.seat .who { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.seat .nm { font: 700 14px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.seat .sc { font: 800 12px var(--body); color: var(--cyan); }
.seat .tag { font: 800 10px var(--body); color: var(--orange); text-transform: uppercase; letter-spacing: .5px; }
.seat .backs { display: flex; gap: 2px; align-items: center; min-height: 26px; }
.seat .back { width: 14px; height: 26px; border-radius: 3px; background: linear-gradient(160deg, #2b3a5c, #141c33); border: 1px solid rgba(255, 255, 255, .25); box-shadow: 0 1px 3px rgba(0, 0, 0, .5); position: relative; flex: none; }
.seat .back::after { content: ''; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: #d4a93c; }
.seat .n { font: 800 13px var(--body); color: var(--soft); margin-left: 4px; }
.seat.turn { border-color: var(--yellow); background: rgba(40, 34, 6, .72); box-shadow: 0 0 0 3px rgba(250, 204, 21, .25), 0 0 26px rgba(250, 204, 21, .4); }
.seat.off { opacity: .55; }
.seat .tb { position: absolute; left: 10px; right: 10px; bottom: 3px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .12); overflow: hidden; display: none; }
.seat.turn .tb.on { display: block; }
.seat .tb i { display: block; height: 100%; width: 100%; background: var(--yellow); transform-origin: left; }
.seat .tsec { position: absolute; top: -9px; right: -6px; min-width: 24px; text-align: center; font: 800 12px var(--body); color: #1a1405; background: var(--yellow); border-radius: 999px; padding: 1px 6px; display: none; }
.seat.turn .tsec.on { display: block; }
.seat .tsec.low { background: var(--red); color: #fff; }
.seat.team0 .av { outline: 2px solid #38bdf8; outline-offset: 1px; }
.seat.team1 .av { outline: 2px solid #fb923c; outline-offset: 1px; }
.s-left .backs, .s-right .backs { flex-direction: column; }
.s-left .back, .s-right .back { width: 26px; height: 14px; }
.s-left, .s-right { flex-direction: column; padding: 8px 6px 10px; }
.s-left .who, .s-right .who { align-items: center; }
.s-left .nm, .s-right .nm { max-width: 80px; font-size: 13px; }

/* panel inferior */
.dbar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 54px; }
.dstatus { flex: 1; min-width: 0; }
.dmsg { font: 700 17px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dmsg.mine { color: var(--yellow); }
.dtimer { height: 4px; border-radius: 4px; background: var(--surface2); overflow: hidden; margin: 4px 0 2px; max-width: 320px; }
.dtimer i { display: block; height: 100%; width: 100%; background: var(--yellow); transform-origin: left; }
.dhist { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dactions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dactions .btn { padding: 12px 18px; font-size: 16px; min-height: 46px; }
.dactions .btn.go { background: linear-gradient(135deg, #16a34a, #65a30d); color: #fff; border: 0; box-shadow: 0 8px 22px rgba(34, 197, 94, .3); }
.dstock { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--text); padding: 4px 6px; border-radius: 14px; cursor: default; flex: none; }
.dstock .pile { position: relative; width: 44px; height: 38px; }
.dstock .pile i { position: absolute; width: 34px; height: 18px; border-radius: 4px; background: linear-gradient(160deg, #2b3a5c, #141c33); border: 1px solid rgba(255, 255, 255, .3); box-shadow: 0 2px 4px rgba(0, 0, 0, .5); }
.dstock .lbl { font: 700 13px var(--display); text-align: left; line-height: 1.15; color: var(--soft); }
.dstock.can { cursor: pointer; background: rgba(250, 204, 21, .14); box-shadow: 0 0 0 2px var(--yellow); animation: dpulse 1s infinite; }
@keyframes dpulse { 50% { box-shadow: 0 0 0 5px rgba(250, 204, 21, .35); } }

/* mi mano */
.dhand { flex: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 30px 4px 6px; min-height: calc(var(--tw) * 2 + 40px); align-items: flex-end; }
.dhand .ht { width: var(--tw); height: calc(var(--tw) * 2); position: relative; cursor: default; transition: transform .15s, filter .15s, opacity .15s; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.dhand .ht canvas { width: 100%; height: 100%; display: block; }
.dhand .ht.ok { cursor: pointer; transform: translateY(-12px); filter: drop-shadow(0 0 8px rgba(250, 204, 21, .85)); }
.dhand .ht.ok:hover { transform: translateY(-18px); }
.dhand .ht.sel { transform: translateY(-26px) scale(1.06); filter: drop-shadow(0 0 12px rgba(74, 222, 128, .95)); }
.dhand .ht.dim { opacity: .5; }
.dhand .ht.fresh { animation: dfresh .5s ease-out; }
@keyframes dfresh { from { transform: translateY(-40px) scale(1.2); opacity: 0; } }

/* superposiciones sobre la mesa */
.doverlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 3; }
.doverlay .box { background: rgba(8, 14, 30, .9); border: 1px solid var(--border2); border-radius: 20px; padding: 16px 20px; text-align: center; max-width: 96%; box-shadow: 0 16px 44px rgba(0, 0, 0, .55); animation: pop .45s cubic-bezier(.2, 1.4, .4, 1); }
.doverlay .big { font: 700 28px/1.1 var(--display); background: var(--grad-hot); -webkit-background-clip: text; background-clip: text; color: transparent; }
.doverlay .big.win { background: linear-gradient(135deg, #fde047, #4ade80); -webkit-background-clip: text; background-clip: text; }
.doverlay .sub { color: var(--soft); margin: 6px 0 10px; font-weight: 700; }
.doverlay .rest { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.doverlay .rest > div { font-size: 12px; color: var(--muted); font-weight: 800; }
.doverlay .rest .mini { display: flex; gap: 3px; margin-top: 4px; justify-content: center; flex-wrap: wrap; max-width: 220px; }
.doverlay canvas.mt { width: 20px; height: 40px; }
.dbanner { position: absolute; left: 50%; top: 14%; transform: translateX(-50%); z-index: 4; pointer-events: none; font: 700 40px var(--display); letter-spacing: 3px; color: #fff; text-shadow: 0 4px 0 #7f1d1d, 0 8px 24px rgba(0, 0, 0, .6); background: rgba(185, 28, 28, .92); border-radius: 16px; padding: 4px 22px; animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); }

/* marcador */
.dscore { width: 260px; flex: none; margin: 0; padding: 12px; overflow: auto; }
.dscore table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.dscore th { font: 800 11px var(--body); color: var(--muted); text-align: right; padding: 4px 4px; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dscore th:first-child, .dscore td:first-child { text-align: left; color: var(--muted); }
.dscore td { text-align: right; padding: 4px; border-top: 1px solid var(--border); font-weight: 700; }
.dscore td.w { color: var(--lime); }
.dscore td.t { color: var(--muted); }
.dscore tr.tot td { font: 700 16px var(--display); color: var(--cyan); border-top: 2px solid var(--border2); }
.dscore .meta { color: var(--muted); font-size: 12px; margin-top: 8px; }

@media (min-width: 1000px) { #d-score-btn, #d-score-x { display: none; } .dscore[hidden] { display: block !important; } }
@media (max-width: 999px) {
  .dscore { position: fixed; left: 12px; right: 12px; bottom: 12px; top: auto; width: auto; max-height: 55vh; z-index: 12; background: #141a33; box-shadow: 0 20px 60px rgba(0, 0, 0, .7); }
}
@media (max-width: 640px) {
  .dom { padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 6px; }
  .dtable { padding: 6px; border-width: 5px; border-radius: 20px; gap: 4px; }
  .seat { padding: 4px 6px 7px; gap: 5px; border-radius: 12px; }
  .seat .av { width: 24px; height: 24px; font-size: 10px; }
  .seat .nm { font-size: 12px; max-width: 74px; }
  .seat .back { width: 10px; height: 20px; }
  .s-left .back, .s-right .back { width: 20px; height: 10px; }
  .s-left .nm, .s-right .nm { max-width: 54px; font-size: 11px; }
  .s-left, .s-right { padding: 6px 4px 8px; }
  .dmsg { font-size: 15px; }
  .dactions .btn { padding: 10px 14px; font-size: 15px; }
  .dstock .lbl { display: none; }
  .dhand { gap: 5px; padding-top: 28px; }
  .dbanner { font-size: 28px; }
}
