/* FCK Life Counter V5: tournament mode, server-backed clocks retained */
#life-counter-modal{background:#101017;color:#fff}#life-counter-modal>header{background:#17151f;border-bottom:1px solid #3e3445;z-index:12}#life-counter-modal>header button{background:#292530;color:#fff;border:1px solid #514653;border-radius:9px}#life-counter-root.fck-v5-board{flex:1;height:auto;min-height:0;gap:5px;padding:5px;background:#101017;grid-auto-rows:minmax(0,1fr)}
#life-counter-root.fck-v5-board .fck-v5-player{position:relative;isolation:isolate;justify-content:center;padding:8px;gap:4px;background:var(--fck-card);border-radius:13px;overflow:auto;overscroll-behavior:contain}
#life-counter-root.fck-v5-board .fck-v5-player:before{content:"";position:absolute;inset:0;background:linear-gradient(135deg,#ffffff16,transparent 60%,#00000055);pointer-events:none;z-index:-1}
#life-counter-root .fck-v5-name{position:relative;z-index:2;font-size:clamp(13px,2.4vw,19px);font-weight:800;max-width:85%;background:#0003;padding:4px 12px;border-radius:9px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#life-counter-root .fck-v5-life{position:relative;z-index:2;font-size:clamp(56px,13vh,155px);font-weight:850;line-height:1.05;pointer-events:none;text-shadow:0 4px 18px #0006}
#life-counter-root .fck-v5-touch{position:absolute;inset:0;display:flex;justify-content:space-between;z-index:1}#life-counter-root .fck-v5-touch button{width:38%;height:100%;background:transparent;border:0;color:#fff9;font-size:clamp(28px,5vw,60px);font-weight:300;cursor:pointer}#life-counter-root .fck-v5-touch button:active{background:#ffffff22}
#life-counter-root .fck-v5-sub{position:relative;z-index:2;display:flex;flex-wrap:wrap;gap:6px;justify-content:center}#life-counter-root .fck-v5-sub button{background:#0005;border:1px solid #ffffff70;border-radius:8px;color:white;padding:5px 10px;font-size:12px;cursor:pointer}
#life-counter-root .fck-v5-commander{position:relative;z-index:2;width:min(95%,420px);max-height:30%;overflow:auto;background:#111b2be8;padding:5px 9px;border-radius:9px}#life-counter-root .fck-v5-commander summary{cursor:pointer;font-size:12px;text-align:center;font-weight:700}#life-counter-root .fck-v5-commander>div{display:grid;grid-template-columns:1fr 30px 28px 30px;gap:5px;align-items:center;font-size:12px}#life-counter-root .fck-v5-commander button{padding:4px}
#life-counter-root .overtime-player{position:relative;z-index:2;flex-shrink:0;max-width:95%;max-height:42%;overflow:auto}#life-counter-root .fck-roll-active{outline:5px solid #ffdf5c;outline-offset:-5px;filter:brightness(1.25)}
#fck-v5-compact{display:none;position:absolute;top:5px;left:50%;transform:translateX(-50%);z-index:20}#fck-v5-menu-button{background:#25212e;color:white;border:1px solid #ffa23a;border-radius:13px;padding:8px 15px;box-shadow:0 5px 20px #0009}#fck-v5-menu{position:absolute;top:calc(100% + 5px);left:50%;transform:translateX(-50%);width:210px;background:#211e29;border:1px solid #514653;border-radius:13px;padding:8px;box-shadow:0 12px 30px #000a}#fck-v5-menu[hidden]{display:none}#fck-v5-menu button{display:block;width:100%;padding:10px;background:#292530;border:0;color:white;text-align:left;border-radius:8px;margin:2px 0}
#life-counter-modal.fck-v5-collapsed>header{display:none}#life-counter-modal.fck-v5-collapsed #fck-v5-compact{display:block}#life-counter-modal.fck-v5-collapsed #life-counter-root{padding-top:45px}
#life-fck-history{position:absolute;inset:0;background:#000b;z-index:30;display:grid;place-items:center;padding:15px}#life-fck-history[hidden]{display:none}.fck-v5-history-card{background:#211e29;border:1px solid #514653;border-radius:17px;padding:20px;width:min(420px,100%);max-height:85dvh;overflow:auto}.fck-history-list{max-height:55dvh;overflow:auto}.fck-history-list>div{display:flex;gap:12px;justify-content:space-between;padding:9px;border-bottom:1px solid #ffffff22}.fck-history-list b{color:#ffad57}.fck-v5-history-card button{margin-top:12px;padding:10px 20px;border-radius:8px;background:#ff9b34;border:0;color:#111;font-weight:800}
@media(max-width:700px){#life-counter-root.fck-v5-board .fck-v5-player{padding:4px;gap:2px}#life-counter-root .fck-v5-life{font-size:clamp(42px,12vh,100px)}#life-counter-root .fck-v5-sub button{padding:3px 6px;font-size:10px}#life-counter-root .fck-v5-commander{max-height:24%}#life-counter-root .overtime-player{max-height:43%}}
@media(max-height:450px) and (orientation:landscape){#life-counter-root .fck-v5-life{font-size:clamp(35px,17vh,85px)}#life-counter-root .fck-v5-name{font-size:12px}#life-counter-root .fck-v5-sub button{padding:2px 5px}#life-counter-root .overtime-player{max-height:48%}}

/* V5 controls: matching public counter dialogs and history navigation */
#life-counter-root .fck-v5-sub button{background:#0005;border:1px solid #ffffff70;border-radius:8px;color:#fff;padding:5px 10px;font-size:12px}
.fck-history-tabs{display:flex;gap:6px;overflow-x:auto;padding:8px 0 14px}.fck-history-tabs button{flex:0 0 auto;background:#33303d;color:white;border:1px solid #777;border-radius:9px;padding:7px 10px}.fck-history-tabs button.active{background:#ff9b34;color:#111;border-color:#ff9b34}
.fck-history-entries{max-height:40dvh;overflow:auto}.fck-history-entries>div{display:flex;align-items:center;gap:12px;justify-content:space-between;padding:10px 3px;border-bottom:1px solid #ffffff22}.fck-history-entries .positive{color:#79e0a4}.fck-history-entries .negative{color:#ff8989}.fck-history-entries small{color:#bbb}.fck-modal-note{color:#ddd;font-size:13px}
.fck-counter-actions,.fck-commander-row{display:flex;align-items:center;gap:12px;justify-content:space-between;padding:12px 0}.fck-counter-actions strong{font-size:32px}.fck-commander-row span{flex:1}.fck-counter-actions button,.fck-commander-row button{background:#34303b;border:1px solid #777;color:#fff;padding:8px 14px;border-radius:8px}
.fck-v5-history-card .fck-clear-history{display:block;background:#38303c;color:#fff;border:1px solid #777;margin-top:14px}

/* Header minimizado: el tablero ocupa toda la altura; menú flotante superpuesto. */
#life-counter-modal.fck-v5-collapsed{display:flex;flex-direction:column;height:100dvh;min-height:0;overflow:hidden}
#life-counter-modal.fck-v5-collapsed > header{display:none!important;flex:0 0 0!important;min-height:0!important;height:0!important;padding:0!important;margin:0!important;border:0!important}
#life-counter-modal.fck-v5-collapsed #life-counter-root.fck-v5-board{flex:1 1 auto!important;height:100%!important;min-height:0!important;padding:5px!important;margin:0!important;grid-auto-rows:minmax(0,1fr)}
#life-counter-modal.fck-v5-collapsed #fck-v5-compact{display:block!important;position:absolute!important;top:max(5px,env(safe-area-inset-top))!important;left:50%!important;transform:translateX(-50%)!important;z-index:100!important;pointer-events:none}
#life-counter-modal.fck-v5-collapsed #fck-v5-menu-button,#life-counter-modal.fck-v5-collapsed #fck-v5-menu{pointer-events:auto}
#life-counter-modal.fck-v5-collapsed #fck-v5-menu{max-height:min(75dvh,480px);overflow-y:auto}

/* High Roll V5: animated roulette and winner overlay */
#life-counter-modal .fck-v5-player.fck-roll-active{outline:5px solid #ffe57a;outline-offset:-6px;filter:brightness(1.45);box-shadow:inset 0 0 45px #fff8;z-index:2}
#life-counter-modal .fck-v5-player.fck-roll-winner{outline:6px solid #ffda45;outline-offset:-7px;box-shadow:inset 0 0 85px #ffdc6a99,0 0 25px #ffb52e;z-index:3;animation:fckRollPulse .7s ease-in-out infinite alternate}
@keyframes fckRollPulse{to{filter:brightness(1.55)}}
#fck-v5-roll-overlay{position:absolute;inset:55px 0 0;z-index:150;pointer-events:none;display:none;align-items:center;justify-content:center}
#fck-v5-roll-overlay.visible{display:flex}
#fck-v5-roll-box{pointer-events:auto;text-align:center;background:#17131feb;border:2px solid #ffb447;border-radius:20px;padding:18px 25px;box-shadow:0 10px 45px #000b;max-width:90vw;color:white}
#fck-v5-roll-title{font-size:clamp(20px,4vw,32px);font-weight:900;color:#ffcc73}
#fck-v5-roll-name{font-size:clamp(18px,3.5vw,27px);font-weight:800;margin:10px 0}
#fck-v5-roll-box button{background:#b95d18;border:1px solid #ffb447;border-radius:10px;padding:10px 16px;color:white;margin:5px}
#life-counter-modal.fck-v5-collapsed #fck-v5-roll-overlay{inset:0}

/* Tiempo extra compartido 1v1 */
@keyframes fckExtraHeartbeat{0%,100%{transform:scale(1)}14%{transform:scale(1.07)}28%{transform:scale(1)}42%{transform:scale(1.045)}60%{transform:scale(1)}}
#life-timer.fck-extra-pulse,#fck-v5-timer.fck-extra-pulse{display:inline-block;animation:fckExtraHeartbeat 1.45s ease-in-out infinite;color:#ffb64b;text-shadow:0 0 14px rgba(255,137,35,.55)}
.fck-shared-extra #life-timer{color:#ffb64b}
@media(prefers-reduced-motion:reduce){#life-timer.fck-extra-pulse,#fck-v5-timer.fck-extra-pulse{animation:none}}

/* Commander Tax: misma mecánica del contador público, sin alterar el modal. */
#life-counter-root .fck-v5-name-row{display:flex;align-items:center;justify-content:center;gap:7px;max-width:100%;min-width:0;position:relative;z-index:2}
#life-counter-root .fck-v5-name-row .fck-v5-name{min-width:0;max-width:100%;margin:0}
#life-counter-root .fck-v5-tax-group{display:flex;align-items:center;gap:5px;flex-shrink:0}
#life-counter-root .fck-v5-tax{width:34px;height:34px;min-width:34px;padding:0;border-radius:50%;font-weight:900;background:#171a25;color:#fff;border:2px solid #ffffff88;cursor:pointer}
@media(max-width:700px){#life-counter-root .fck-v5-tax{width:27px;height:27px;min-width:27px;font-size:12px}#life-counter-root .fck-v5-name-row{gap:4px}}

/* Opciones individuales del jugador */
.fck-player-options{display:flex;flex-direction:column;align-items:stretch;gap:13px;padding:8px 2px}.fck-player-option-check{display:flex;align-items:center;gap:10px;cursor:pointer}.fck-player-option-check input{width:18px;height:18px;flex:none}.fck-player-reset-tax{padding:10px 12px;border-radius:9px;border:1px solid #ffffff65;background:#ffffff14;color:inherit;cursor:pointer}.fck-player-options small{opacity:.75;line-height:1.5}

/* v11.15: ventana de daño de comandante más amplia, sin afectar historial/opciones. */
#life-fck-history .fck-v5-history-card:has(.fck-commander-group){width:min(640px,calc(100vw - 28px));max-width:100%;}
#life-fck-history .fck-history-list:has(.fck-commander-group)> .fck-commander-group{display:block;padding:10px 4px 14px;}
#life-fck-history .fck-commander-group .fck-commander-row:first-child{padding:4px 8px 8px;justify-content:center;text-align:center;}
#life-fck-history .fck-commander-group .fck-commander-row:not(:first-child){display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:10px;padding:9px 8px;}
#life-fck-history .fck-commander-group .fck-commander-row:not(:first-child)>span{flex:0 0 100%;text-align:center;font-weight:700;overflow-wrap:anywhere;}
#life-fck-history .fck-commander-group .fck-commander-row:not(:first-child)>strong{min-width:42px;text-align:center;font-size:21px;}
#life-fck-history .fck-commander-group .fck-commander-row:not(:first-child)>button{min-width:46px;margin-top:0;}

/* v11.16: filas horizontales en daño de comandante */
#life-fck-history .fck-commander-group .fck-commander-row:not(:first-child){display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:flex-end;gap:10px;}
#life-fck-history .fck-commander-group .fck-commander-row:not(:first-child)>span{flex:1 1 auto;min-width:0;text-align:left;overflow-wrap:anywhere;}
#life-fck-history .fck-commander-group .fck-commander-row:not(:first-child)>button{flex:0 0 46px;}
#life-fck-history .fck-player-commander-names{display:flex;flex-direction:column;gap:10px;}
#life-fck-history .fck-player-commander-names label{display:flex;flex-direction:column;gap:5px;font-size:13px;}
#life-fck-history .fck-player-commander-names input{width:100%;box-sizing:border-box;background:#15131b;border:1px solid #777;color:#fff;border-radius:8px;padding:10px;}
#life-fck-history .fck-player-commander-names button{align-self:flex-start;margin-top:0;}
@media(max-width:440px){#life-fck-history .fck-commander-group .fck-commander-row:not(:first-child){gap:5px;padding:8px 2px;}#life-fck-history .fck-commander-group .fck-commander-row:not(:first-child)>button{flex-basis:36px;min-width:36px;padding:7px 4px;}#life-fck-history .fck-commander-group .fck-commander-row:not(:first-child)>strong{min-width:30px;font-size:18px;}}

/* v11.17: filas de jugadores como en contador publico */
#life-fck-history .fck-v5-history-card:has(.fck-commander-player){width:min(640px,calc(100vw - 24px));max-width:100%;}
#life-fck-history .fck-history-list:has(.fck-commander-player){display:block;}
#life-fck-history .fck-commander-player{display:flex;align-items:center;gap:12px;padding:12px 2px;border-bottom:1px solid rgba(255,255,255,.13);}
#life-fck-history .fck-commander-player:last-child{border-bottom:0;}
#life-fck-history .fck-commander-player-name{flex:1 1 120px;min-width:0;font-weight:750;overflow-wrap:anywhere;}
#life-fck-history .fck-commander-columns{flex:0 1 65%;display:flex;justify-content:flex-end;gap:10px;min-width:0;}
#life-fck-history .fck-commander-column{flex:1 1 0;min-width:0;max-width:175px;display:flex;flex-direction:column;gap:8px;}
#life-fck-history .fck-commander-label{font-size:12px;font-weight:750;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
#life-fck-history .fck-commander-controls{display:flex;align-items:center;justify-content:space-between;gap:5px;}
#life-fck-history .fck-commander-controls button{flex:0 0 34px;min-width:0;padding:9px 0;background:#302b37;border:1px solid #574a60;border-radius:10px;color:#fff;cursor:pointer;}
#life-fck-history .fck-commander-controls strong{flex:1;text-align:center;font-size:17px;}
@media(max-width:470px){#life-fck-history .fck-commander-player{gap:7px;}#life-fck-history .fck-commander-player-name{flex-basis:85px;font-size:13px;}#life-fck-history .fck-commander-columns{flex-basis:72%;gap:5px;}#life-fck-history .fck-commander-controls button{flex-basis:30px;padding:8px 0;}#life-fck-history .fck-commander-label{font-size:10px;}}
