.chess-page{background:#f2f5fc;color:#202844}
.chess-shell{width:100%;max-width:1180px;min-width:0;margin:auto;padding:18px;display:grid;gap:18px;grid-template-columns:minmax(0,1fr)}
.chess-shell>*{min-width:0;max-width:100%;overflow-wrap:anywhere}
.chess-heading h1{font-size:clamp(2rem,7vw,3.5rem);margin:6px 0}
.chess-heading p{margin:6px 0}
.chess-modes{display:none;gap:8px}
.chess-actions{display:flex;gap:8px;flex-wrap:wrap}
.chess-page button,.chess-page select,.chess-page input{font:inherit;min-height:44px;border-radius:9px;border:1px solid #a9bedf;padding:9px 13px;background:#fff;color:#254f91;max-width:100%;white-space:normal}
.chess-page button{cursor:pointer}
.chess-page button:hover,.chess-page button[aria-pressed=true]{background:#e4edff;color:#1c4385}
.chess-page button.chess-presence-action{border-color:#bd253d;color:#bd253d}
.chess-page button.chess-presence-action:hover{background:#fff0f2;color:#a31f34}
.chess-page button:focus-visible,.chess-page select:focus-visible,.chess-page input:focus-visible,.chess-page summary:focus-visible{outline:3px solid #315dcc;outline-offset:2px}
.chess-page button:disabled{opacity:.55;cursor:wait}
.chess-page .chess-modes button{min-width:0;padding:9px 4px}
.chess-page>.site-header .nav-play a[aria-current=page]{background:#edf3ff;color:#2456e8;font-weight:700}
.chess-card{padding:18px;background:#fff;border:1px solid #cbd6e8;border-radius:14px}
.chess-card h2{margin-top:0}
.chess-card label{display:block;margin:10px 0 5px}
.chess-card input{width:100%}
.chess-card p{line-height:1.5}
.chess-play{width:100%;min-width:0;max-width:none;margin:auto;display:grid;gap:14px;align-items:start;scroll-margin-top:0}
.chess-table{min-width:0;padding:10px;display:flex;flex-direction:column;gap:6px;background:#fff;border:1px solid #d6dfef;border-radius:16px}
.chess-arena{width:100%;min-width:0;align-self:center}
.chess-board{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));width:100%;aspect-ratio:1;touch-action:manipulation;border:3px solid #73988b;border-radius:6px;overflow:hidden}
.chess-page .chess-square{position:relative;padding:0;border:0;border-radius:0;min-height:0;aspect-ratio:1;background:#e3ebd5;color:#101c24;line-height:1;display:grid;place-items:center;white-space:nowrap}
.chess-page .chess-square.dark{background:#70998a}
.chess-page .chess-square.selected{box-shadow:inset 0 0 0 4px #e49b2a}
.chess-page .chess-square.last{background:#becb72}
.chess-page .chess-square.dark.last{background:#97ac48}
.chess-page .chess-square.legal:after{content:'';position:absolute;width:20%;height:20%;border-radius:50%;background:#183f42b0;pointer-events:none}
.chess-page .chess-square.check{background:#e88577}
.chess-piece{width:84%;height:84%;pointer-events:none;filter:drop-shadow(0 1px 1px #0002)}
.chess-coordinate-file,.chess-coordinate-rank{position:absolute;font:600 11px/1 system-ui;color:#213d34;pointer-events:none}
.chess-coordinate-file{bottom:3px;right:4px}
.chess-coordinate-rank{top:3px;left:4px}
.chess-square.dark :is(.chess-coordinate-file,.chess-coordinate-rank){color:#101c24}
.chess-square.last :is(.chess-coordinate-file,.chess-coordinate-rank){color:#213d34}
.chess-player{display:flex;align-items:center;gap:8px;min-height:44px;padding:6px 8px;border:2px solid transparent;border-radius:10px;background:#f4f6fb;font-size:14px}
.chess-player strong{min-width:0;flex:1;overflow-wrap:anywhere}
.chess-page button.chess-friend-rival:not([hidden]){width:44px;height:44px;flex:0 0 44px;padding:0;display:grid;place-items:center}
.chess-player output{font-variant-numeric:tabular-nums;font-weight:700;flex-shrink:0;white-space:nowrap;padding:5px 7px;background:#fff;border-radius:6px}
.chess-player-avatar{width:24px;height:24px;flex-shrink:0;border-radius:50%;background:#273440;border:2px solid #344955;box-shadow:inset 0 0 0 3px #ffffff35}
.chess-player[data-color=w] .chess-player-avatar{background:#fff9ec;border-color:#344955}
.damas-page .chess-player[data-color=w] .chess-player-avatar{background:#b62a34;border-color:#842632}
.damas-page .chess-player[data-color=b] .chess-player-avatar{background:#f0dfbb}
.chess-player-active-own{border-color:#b42318;background:#fff4f1}
.chess-player-active-other{border-color:#315dcc;background:#edf2ff}
#chess-turn{margin:0;padding:2px 8px;min-height:24px;font-size:14px;line-height:1.35}
#chess-turn .chess-turn-own,#chess-turn.chess-awaiting-confirmation{color:#b42318;font-weight:700}
#chess-turn .chess-turn-other{color:#254f91}
#chess-variant{margin:0;padding:0 8px 2px;font-size:12px;color:#52617c}
.chess-sidebar{min-width:0;padding:16px;display:flex;flex-direction:column;gap:12px;background:#fff;border:1px solid #cbd6e8;border-radius:14px}
.chess-sidebar p{margin:0;line-height:1.45;overflow-wrap:anywhere}
.chess-sidebar #chess-result:empty{display:none}
.chess-sidebar button{display:inline-flex;align-items:center;justify-content:center;gap:7px;font-size:13px}
.chess-sidebar button svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.chess-sidebar .chess-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.chess-sidebar .chess-actions>button{min-width:0;padding:9px 7px}
.chess-sidebar button[data-action=accept],.chess-sidebar button[data-action=draw_accept],.chess-sidebar button[data-action=cancel_accept]{grid-column:1/-1}
.chess-sidebar #chess-options-toggle{width:100%;margin:0;align-self:stretch}
.chess-sidebar details{margin:0;min-width:0}
.chess-sidebar summary{cursor:pointer;min-height:44px;display:flex;align-items:center;gap:8px;font-size:13px;color:#254f91;list-style:none}
.chess-sidebar summary::before{content:'+';font-size:20px;line-height:1}
.chess-sidebar details[open]>summary::before{content:'−'}
.chess-sidebar summary::-webkit-details-marker{display:none}
#chess-more-actions{grid-column:1/-1}
#chess-more-actions:not(:has(button:not([hidden]))){display:none}
#chess-secondary{border-top:1px solid #d6dfef}
#chess-history{margin:0;padding:0;list-style:none;counter-reset:chess-event;max-height:260px;overflow:auto;font-variant-numeric:tabular-nums}
#chess-history li{padding:8px 6px;border-bottom:1px solid #e3e9f4;overflow-wrap:anywhere;font-size:14px}
#chess-history li::before{counter-increment:chess-event;content:counter(chess-event) '. ';color:#52617c;margin-right:6px}
#chess-history:empty::before{content:'Aún no hay movimientos.';display:block;color:#52617c;padding:8px 0;font-size:13px}
#chess-spectator-link{margin-top:8px}
#chess-status{margin:0;min-height:24px;color:#365483}
#chess-active{display:flex;flex-wrap:wrap;gap:8px}
.chess-page table{width:100%;border-collapse:collapse}
.chess-page td,.chess-page th{padding:9px 5px;text-align:left;border-bottom:1px solid #d6dfef}
.chess-page [hidden]{display:none!important}
.damas-stone{width:74%;height:74%;border-radius:50%;border:2px solid #3c3342;box-shadow:inset 0 0 0 3px #ffffff45,inset 0 -5px 7px #0002,0 2px 3px #0004;display:grid;place-items:center;pointer-events:none}
.damas-stone.red{background:radial-gradient(circle at 35% 28%,#d64c56,#b62a34 70%);color:#fff5e8}
.damas-stone.light{background:radial-gradient(circle at 35% 28%,#fffdf7,#f0dfbb 80%);color:#3c3342}
.damas-stone.king{border-style:double;border-width:4px}
.damas-crown{width:58%;height:58%;fill:currentColor;stroke:currentColor;stroke-width:1;pointer-events:none}
.damas-page .chess-square.legal:after{background:#304e91b0;width:23%;height:23%}
.damas-page .chess-square.light-square{cursor:default}
#chess-board .chess-square.soplada-candidate{outline:3px solid #b42318;outline-offset:-4px;box-shadow:inset 0 0 0 6px #fff7ed}
#chess-soplada{color:#8f241c;font-weight:700;line-height:1.5}
.chess-page dialog{color:#202844;background:#fff;border:2px solid #a9bedf;border-radius:14px;width:min(90vw,400px)}
.chess-page dialog::backdrop{background:#19182b99}
.chess-page #chess-victory{width:min(92vw,480px);max-height:calc(100dvh - 32px);padding:28px;border:1px solid #b5a3ee;border-radius:18px;inset:0;margin:auto!important;overflow:auto;box-shadow:0 18px 70px #17122e33;text-align:left}
.chess-victory-mode{font-size:13px;font-weight:700;color:#6747b8;margin:0 0 10px}
.chess-page #chess-victory h2{font-size:clamp(27px,7vw,38px);line-height:1.15;color:#55349d;margin:0 0 12px;letter-spacing:-.03em}
.chess-victory-reason{font-weight:600;line-height:1.5;margin:0 0 20px}
.chess-victory dl{margin:0;display:grid;gap:16px;padding:18px;background:#f4f1fc;border-radius:12px}
.chess-victory dt{font-size:13px;color:#546079;margin-bottom:4px}
.chess-victory dd{font-weight:700;margin:0;line-height:1.4;overflow-wrap:anywhere}
.chess-victory-note{font-size:14px;line-height:1.6;color:#546079;margin:18px 0}
.chess-page #chess-victory-close{width:100%;min-height:48px;background:#6747b8;color:#fff;border-color:#6747b8}
.chess-tournament-eliminated{color:#b42318;font-weight:700}
.chess-tournament-winner{color:#247342;font-weight:700}
.chess-page #chess-start{inset:0;margin:auto!important;width:min(92vw,480px);max-height:calc(100dvh - 32px);overflow:auto;padding:20px;border:2px solid #315dcc;box-shadow:0 18px 70px #17122e33}
.chess-page #chess-start h2{font-size:clamp(24px,6vw,32px);line-height:1.2;margin:8px 0 12px;padding:10px;border-radius:10px;background:#edf1fa;color:#202844}
.damas-page #chess-start[data-color=w] h2{background:#fff0f0;color:#9b1723}
.chess-page #chess-start p{font-size:14px;line-height:1.45;margin:10px 0}
.chess-page #chess-start-accept{width:100%;background:#315dcc;color:#fff;min-height:48px}
.chess-page #chess-victory[data-outcome=loss]{border-color:#b34b46}
.chess-page #chess-victory[data-outcome=loss] h2{color:#9b302b}
.chess-page #chess-victory[data-outcome=loss] dl{background:#fff3f1}
.chess-page #chess-victory[data-outcome=draw] h2{color:#315483}
.chess-page #chess-victory[data-outcome=draw] dl{background:#eef3fa}
.chess-page #chess-huff-alert{inset:0;margin:auto!important;width:min(92vw,480px);max-height:calc(100dvh - 32px);overflow:auto;padding:24px;border:2px solid #b42318;background:#fff}
.chess-page #chess-huff-alert h2{color:#9b1723;font-size:28px;line-height:1.2}
.chess-page #chess-huff-alert p{line-height:1.6}
.chess-page #chess-huff-alert-close{width:100%;min-height:48px;background:#315dcc;color:#fff}
.chess-page button[data-action=draw_accept]{background:#f8b6d2;color:#571b38;border-color:#a43969;min-height:44px}
.chess-page button[data-action=draw_accept]:hover{background:#f39bc2;color:#571b38}
.chess-page #chess-promotion .chess-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
.chess-page #chess-promotion button{display:flex;align-items:center;justify-content:center;gap:8px}
.chess-page #chess-promotion .chess-piece{width:40px;height:40px;flex-shrink:0}
@media(min-width:700px){.chess-modes{display:grid;grid-template-columns:repeat(7,minmax(0,1fr))}}
@media(max-width:379px){
 .chess-page:has(>.site-header>.game-fullscreen-menu-control){--site-header-height:calc(56px + env(safe-area-inset-top))}
 .chess-page>.site-header.play-compact:has(>.game-fullscreen-menu-control){flex-wrap:nowrap;gap:0;padding-inline:4px}
}
@media(min-width:900px),(min-width:700px) and (max-height:500px){
 .chess-play{grid-template-columns:minmax(0,720px) minmax(240px,320px);gap:18px}
 .chess-table{grid-column:1;grid-row:1;width:min(100%,calc(100dvh - 220px));justify-self:center}
 .chess-sidebar{grid-column:2;grid-row:1}
}
@media(max-width:500px){
 .chess-shell{padding:8px;gap:12px}
 .chess-card{padding:12px}
 .chess-modes{gap:6px}
 .chess-page .chess-modes button{font-size:13px}
 .chess-table{padding:4px;border-radius:12px}
 .chess-player{font-size:13px;padding:5px 4px;gap:5px}
 .chess-player-avatar{width:20px;height:20px}
 .chess-coordinate-file,.chess-coordinate-rank{font-size:9px}
 .chess-coordinate-file{bottom:2px;right:3px}
 .chess-coordinate-rank{top:2px;left:3px}
 .chess-sidebar{padding:12px}
}
@media(orientation:landscape) and (max-height:500px){
 .chess-page #chess-game:not(.game-is-fullscreen){grid-template-columns:minmax(0,1fr) 240px;gap:12px}
 .chess-page #chess-game:not(.game-is-fullscreen) .chess-table{width:min(100%,max(260px,calc(100dvh - 180px)));justify-self:center}
 .chess-player{font-size:12px;min-height:40px}
 .chess-page #chess-victory{width:min(92vw,640px);padding:20px}
 .chess-victory dl{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
 .chess-victory-note{margin:12px 0}
}
@media(max-width:400px){.chess-page #chess-victory{padding:22px}}
@media(prefers-reduced-motion:reduce){.chess-page *{scroll-behavior:auto!important;animation:none!important;transition:none!important}}
.chess-page [data-view=progressive]{overflow-wrap:anywhere}.chess-page #chess-cpu-level{font-weight:700;color:var(--cyan)}
.chess-page:has([data-view=progressive]:not([hidden])) #chess-friends{display:none}
