/* v249: visor exclusivo en la segunda fila del dialogo, sin superposiciones. */
#r246Viewer #r247Stage{display:grid;grid-template-columns:minmax(0,1fr) minmax(290px,29%);grid-template-rows:minmax(0,1fr);gap:.75rem;padding:.75rem;overflow:hidden!important;background:#111827}
#r247Stage #r246FrameBox,#r247Stage #r247ReplayShell{grid-column:1;grid-row:1;min-width:0;min-height:0;width:100%;max-height:100%;box-sizing:border-box}
#r247Stage #r246FrameBox{background:#151d2b;overflow:hidden}
#r247Stage #r246FrameBox iframe{display:block;width:100%;height:100%;border:0}
#r247Stage[data-mode="board"] #r246FrameBox{display:none!important}
#r247Stage[data-mode="lichess"] #r247ReplayShell{display:none!important}
#r247Stage #r247ReplayShell{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:.35rem;padding:.4rem;overflow:hidden;background:#111827}
#r247Stage #r247ReplayShell[hidden]{display:none!important}
#r247Players{flex:0 0 auto;max-width:100%;font-size:clamp(.84rem,1.5vw,1rem);line-height:1.35;text-align:center;overflow-wrap:anywhere;margin:0}
#r247Board{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));grid-template-rows:repeat(8,minmax(0,1fr));width:min(100%,calc(100dvh - 190px));aspect-ratio:1/1;max-width:900px;max-height:100%;min-width:0;min-height:0;flex:0 0 auto;overflow:hidden;box-sizing:border-box;margin:0;outline-offset:3px}
#r247Board .r247-square{display:grid;place-items:center;min-width:0;min-height:0;overflow:hidden;user-select:none}
#r247Board .r247-square.light{background:#f0d9b5;color:#20252b}
#r247Board .r247-square.dark{background:#b58863;color:#20252b}
#r247Board .r247-square img{display:block;width:95%;height:95%;object-fit:contain;pointer-events:none;user-select:none}
#r247Stage .r247-nav{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:.35rem;min-height:42px;max-width:100%;margin:0;padding:.15rem 0}
#r247Stage .r247-nav button{min-width:42px;min-height:40px;max-width:100%;padding:.35rem .55rem}
#r247MoveInfo{font-variant-numeric:tabular-nums;font-size:.81rem;min-width:92px;text-align:center}
#r247Stage #r247Sidebar{grid-column:2;grid-row:1;display:flex;flex-direction:column;align-items:stretch!important;gap:.7rem;width:auto!important;max-width:none!important;max-height:none!important;min-width:0;min-height:0;overflow-y:auto;padding:.6rem;border:1px solid #34445a;border-radius:.6rem;background:#1a2536;box-sizing:border-box}
#r247Stage .r247-heading{display:flex;gap:.35rem;align-items:flex-start;flex-wrap:wrap;line-height:1.35}
#r247Stage .r247-heading strong{font-size:1rem}#r247Stage .r247-heading small{font-size:.74rem;color:#c3d0df}
#r247Stage .r247-row{display:flex;flex-wrap:wrap;gap:.5rem;min-width:0;align-items:center}
#r247Stage .r247-row input{min-width:0;width:100%;flex:1 1 160px;box-sizing:border-box;min-height:40px;background:#fff;border:1px solid #8498b1;border-radius:.5rem;padding:.45rem .65rem;color:#111827}
#r247Stage .r247-row button{min-height:40px;max-width:100%;white-space:normal}
#r247Stage #r247Games{display:block;width:100%;max-width:100%;min-height:110px;max-height:40%;flex:0 0 auto;border:1px solid #90a0b6;border-radius:.5rem;background:#fff;color:#101827;padding:.3rem;font-size:.84rem;box-sizing:border-box}
#r247Stage #r247Status{font-size:.84rem;line-height:1.45;overflow-wrap:anywhere;min-height:1.4em;flex:0 0 auto;margin:0;color:#d5e1f1}
@media(max-width:760px){
 #r246Viewer #r247Stage{display:flex;flex-direction:column;gap:.6rem;padding:.55rem;overflow-y:auto!important;overscroll-behavior:contain}
 #r247Stage #r247ReplayShell{width:100%;height:auto;flex:0 0 auto;order:0;padding:.15rem;overflow:visible}
 #r247Stage #r246FrameBox{height:min(65dvh,570px);min-height:230px;flex:0 0 auto;order:0}
 #r247Board{width:min(100%,calc(100dvh - 210px));max-height:none;max-width:100%}
 #r247Stage #r247Sidebar{width:100%;max-height:none!important;overflow:visible;flex:0 0 auto;order:1;padding:.7rem}
 #r247Stage #r247Games{max-height:145px}
}
@media(max-width:420px){#r247Stage .r247-nav button{min-width:35px;min-height:38px;padding:.3rem .45rem}#r247MoveInfo{min-width:66px;font-size:.75rem}}

/* v254: dos bandas compactas de jugadores; no cambia el tablero principal. */
#r247Stage .r254-player{display:flex;align-items:center;justify-content:space-between;gap:.5rem;width:min(100%,900px);box-sizing:border-box;min-height:36px;flex:0 0 auto;background:#1b2637;border:1px solid #3d4a5d;border-radius:.4rem;padding:.28rem .55rem;text-align:left;line-height:1.15;color:#f1f5f9;overflow:hidden}
#r247Stage .r254-identity{min-width:0;display:flex;flex-direction:column;gap:.12rem;text-align:left;overflow:hidden}
#r247Stage .r254-identity strong{font-size:.9rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#r247Stage .r254-identity small{font-size:.73rem;color:#c9d7e8;min-height:.85em}
#r247Stage .r254-clock{flex:0 0 auto;font-size:1rem;font-weight:700;white-space:nowrap;font-variant-numeric:tabular-nums;background:#111827;padding:.28rem .4rem;border-radius:.25rem}
#r247Stage .r254-player[data-turn="true"]{border-color:#93b4d8}
#r247Stage #r247Board .r254-last{box-shadow:inset 0 0 0 4px #d7c13e}
@media(max-width:420px){#r247Stage .r254-identity strong{font-size:.8rem}#r247Stage .r254-clock{font-size:.83rem}#r247Stage .r254-player{padding:.25rem .35rem}}

@media(max-width:760px){#r247Stage .r254-player{width:min(100%,calc(100dvh - 210px))}}

/* v255: los tiempos extrapolados no son relojes físicos confirmados. */
#r247Stage .r254-clock[data-estimated="true"]::before{content:'≈ ';font-size:.72em;color:#c9d7e8}
#r247Stage .r254-clock[data-running="true"]{outline:1px solid #93b4d8}

/* v261: compact local player following controls */
#r261Players{min-width:0;border:1px solid #34445a;border-radius:.5rem;padding:.45rem;overflow-wrap:anywhere} #r261Players summary{cursor:pointer;font-weight:600} #r261Players .r261-hint,#r261Count{font-size:.8rem;line-height:1.35} #r261Players .r261-actions{display:flex;flex-wrap:wrap;gap:.35rem;margin:.35rem 0;min-width:0} #r261Players button,#r261Players select,#r261Only{min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere;min-height:36px} #r261Players select{flex:1 1 120px} #r261Only[aria-pressed=true],#r261Players button[aria-pressed=true]{outline:2px solid #9ab9ec;outline-offset:-2px} #r261Players button:focus-visible,#r261Only:focus-visible,#r261Saved:focus-visible{outline:2px solid #fff;outline-offset:2px}

/* v264: local archive, compact and scoped away from the approved header. */
#r264History{min-width:0;max-width:100%;box-sizing:border-box;padding:.55rem .7rem;border:1px solid #39465b;border-radius:.6rem;overflow-wrap:anywhere;background:#1d283b}
#r264History summary{cursor:pointer;font-weight:600;min-height:36px;align-content:center}
#r264History p,#r264History label,#r264History small{font-size:.84rem;line-height:1.35;display:block;margin:.35rem 0}
#r264History input,#r264History select{width:100%;max-width:100%;min-width:0;box-sizing:border-box;background:#fff;color:#141b28;border:1px solid #8090aa;border-radius:.5rem;padding:.4rem;font-size:.85rem;min-height:44px}
#r264History .r264-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.45rem;margin:.45rem 0}
#r264History button,#r264Save{min-width:0;max-width:100%;min-height:44px;white-space:normal;overflow-wrap:anywhere}
#r264History a[hidden]{display:none!important}

/* v265: round controls scoped to the spectator sidebar; main header unchanged. */
#r265RoundNav[hidden],#r265Controls[hidden]{display:none!important}
#r265RoundNav{min-width:0;max-width:100%;display:grid;gap:.35rem;padding:.4rem;border:1px solid #34445a;border-radius:.5rem;box-sizing:border-box}
#r265Controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.35rem;min-width:0}
#r265Select{grid-row:1;grid-column:1/-1;min-width:0;width:100%;max-width:100%;background:white;color:#141b28;box-sizing:border-box;font-size:.85rem;border-radius:.4rem}
#r265RoundNav button,#r265Select{min-height:44px;min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere}
#r265Status{font-size:.78rem;line-height:1.35;overflow-wrap:anywhere}
