/* games-core.css */

.game-page{max-width:1080px;margin:32px auto 70px}.game-page h1{color:#232c48;font-size:clamp(28px,4vw,42px);margin:12px 0}.game-intro{max-width:740px;color:#69738a;margin-bottom:26px}.games-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}.game-card{display:block;padding:28px;border:1px solid #e3e7f1;border-radius:20px;background:#fff;text-decoration:none;color:#232c48;transition:transform .2s,box-shadow .2s}.game-card:hover{transform:translateY(-3px);box-shadow:0 12px 30px #202c4714}.game-card h2{font-size:22px;margin:12px 0}.game-card p{color:#66718b}.game-card strong{color:#5865ed}.game-card-icon{display:grid;place-items:center;width:85px;height:75px;border-radius:16px;font-size:29px;letter-spacing:-4px}.snake-icon{background:#e6f8ee;color:#2eaa70}.tetris-icon{background:#ecebff;color:#6655e9}.game-panel{width:min(100%,550px);margin:0 auto 32px;padding:22px;border-radius:22px;background:#fff;border:1px solid #e3e7f1;box-shadow:0 12px 36px #232c480b}.game-stats{display:flex;justify-content:space-between;flex-wrap:wrap;gap:12px;margin-bottom:16px;font-size:13px;color:#68718b}.game-stats strong{color:#232c48;font-size:19px;margin-left:5px}.game-canvas-wrap{position:relative;display:flex;justify-content:center;align-items:center;background:#141d34;border-radius:14px;padding:12px;overflow:hidden}.game-canvas-wrap canvas{display:block;width:auto;max-width:100%;height:auto;max-height:min(62vh,600px);aspect-ratio:attr(width)/attr(height);background:#141d34;touch-action:none}.game-message{position:absolute;inset:auto 12px;top:50%;transform:translateY(-50%);padding:14px 12px;border-radius:12px;background:#10192be8;color:#fff;text-align:center;font-weight:700;pointer-events:none}.game-message[hidden]{display:none}.game-actions{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:16px}.game-actions .button{font-size:13px;padding:11px 13px}.game-controls{display:flex;justify-content:center;margin-top:16px}.dpad{text-align:center}.dpad>button,.dpad>div button,.tetris-pad button{min-width:53px;min-height:48px;border:1px solid #dce1ee;border-radius:11px;background:#f2f4fa;color:#2a3450;font-size:24px;cursor:pointer;touch-action:manipulation}.dpad>div{display:flex;gap:6px;margin-top:6px}.tetris-pad{display:flex;gap:7px;flex-wrap:wrap;justify-content:center}.game-controls button:active{background:#dce0ff}.game-help{text-align:center;color:#69738a;font-size:12px;margin-top:12px}.game-ad{margin:26px auto 32px;max-width:900px;min-height:90px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:8px;background:#f6f7fb;border:1px dashed #dfe3ee;border-radius:14px;color:#939aac;font-size:12px}.game-ad small{letter-spacing:.1em;font-size:9px}.game-copy{max-width:850px;margin:0 auto;line-height:1.8;color:#566077}.game-copy h2{color:#232c48;font-size:23px;margin:26px 0 10px}.game-copy details{padding:12px 0;border-bottom:1px solid #e6e9f1}.game-copy summary{cursor:pointer;color:#232c48;font-weight:650}.game-more{text-align:center;margin-top:25px}html[data-theme=dark] .game-card,html[data-theme=dark] .game-panel{background:#222a3c;border-color:#39445c;color:#f5f6fc}html[data-theme=dark] .game-page h1,html[data-theme=dark] .game-copy h2,html[data-theme=dark] .game-card h2,html[data-theme=dark] .game-stats strong{color:#f3f5ff}html[data-theme=dark] .game-copy,html[data-theme=dark] .game-intro{color:#c5ccdc}html[data-theme=dark] .game-ad{background:#252d3f;border-color:#48516a}@media(max-width:650px){.games-grid{grid-template-columns:1fr}.game-page{margin-top:18px}.game-panel{padding:12px}.game-actions .button{font-size:12px}.game-canvas-wrap{padding:7px}}
/* V15 - game menus, profiles, game-over and local rankings */
.game-panel{position:relative;isolation:isolate}.game-panel.game-menu-active{min-height:530px}
.game-overlay{position:absolute;inset:0;z-index:12;display:flex;justify-content:center;align-items:flex-start;padding:24px 12px;background:rgba(18,27,48,.91);border-radius:22px;overflow:auto}
.game-overlay[hidden]{display:none!important}
.game-modal{width:min(100%,430px);margin:auto;background:#fff;color:#25304b;padding:25px;border-radius:20px;text-align:center;box-shadow:0 18px 55px #0004}
.game-modal h2{font-size:25px;color:#232c48;margin:8px 0 18px}.game-modal-kicker{font-size:10px;font-weight:800;letter-spacing:.12em;color:#5865ed}
.game-modal label,.game-avatar-label{display:block;text-align:left;font-size:13px;font-weight:700;margin:14px 0 7px}
.game-modal input{width:100%;height:44px;border:1px solid #d9ddec;border-radius:11px;padding:0 13px;font:inherit;color:#232c48;background:#fff}
.avatar-choices{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:6px}.avatar-option{border:2px solid #e3e7f1;background:#f7f8fc;border-radius:12px;min-height:45px;font-size:24px;cursor:pointer}.avatar-option.selected{border-color:#5865ed;background:#edf0ff}.avatar-option:focus-visible{outline:3px solid #5865ed;outline-offset:2px}
.game-modal-actions{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:20px}.game-modal-actions .button{font-size:13px;padding:11px 13px}
.game-finish #final-player{color:#67728b}.game-final-score{border-radius:14px;background:#f1f3ff;padding:15px;margin:16px auto}.game-final-score span{display:block;font-size:11px;font-weight:800;letter-spacing:.1em;color:#65718d}.game-final-score strong{font-size:45px;color:#5865ed}
.game-ranking{max-width:650px;margin:0 auto 24px;padding:22px;background:#fff;border:1px solid #e3e7f1;border-radius:20px}.game-ranking-heading{display:flex;justify-content:space-between;align-items:center;gap:10px}.game-ranking h2{font-size:21px;color:#232c48;margin:5px 0}.game-ranking ol{list-style:none;padding:0;margin:14px 0}.game-ranking li{display:flex;justify-content:space-between;align-items:center;padding:11px 12px;border-bottom:1px solid #e9ebf3;gap:10px;font-size:14px}.game-ranking li strong{white-space:nowrap;color:#5865ed}.game-ranking>p,.rank-empty{font-size:12px;color:#69738a}.game-ranking button{font-size:12px}
html[data-theme=dark] .game-ranking{background:#222a3c;border-color:#39445c}html[data-theme=dark] .game-ranking h2{color:#f3f5ff}html[data-theme=dark] .game-ranking li{border-color:#39445c}
@media(max-width:600px){.game-overlay{padding:12px 8px}.game-modal{padding:18px 13px}.game-modal h2{font-size:21px}.game-ranking{padding:14px}.game-ranking-heading{flex-wrap:wrap}.avatar-option{font-size:21px;min-height:42px}}

/* V16: illustrations replacing placeholder glyphs */
.games-grid .game-card{overflow:hidden;transition:transform .18s ease,box-shadow .18s ease}
.games-grid .game-card:hover{transform:translateY(-3px);box-shadow:0 12px 32px rgba(35,44,72,.12)}
.games-grid .game-card-icon{display:grid;place-items:center;width:142px;height:132px;margin:0 auto 7px;border-radius:24px;letter-spacing:normal;font-size:initial;overflow:visible}
.games-grid .game-card-icon img{display:block;width:128px;height:128px;object-fit:contain;filter:drop-shadow(0 7px 10px rgba(20,30,70,.14))}
.games-grid .snake-icon{background:linear-gradient(145deg,#e8fff3,#d5f8eb)}
.games-grid .tetris-icon{background:linear-gradient(145deg,#eef0ff,#e6e4ff)}
@media(max-width:600px){.games-grid .game-card-icon{width:122px;height:112px}.games-grid .game-card-icon img{width:108px;height:108px}}

/* AkiWeb V17 — polished arcade games */
.games-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr));gap:18px}
.game-card{padding:20px}.game-card-icon{width:100%;height:155px;overflow:hidden;background:linear-gradient(135deg,#101c39,#27245d);border-radius:16px;letter-spacing:normal}
.game-card-icon img{width:100%;height:100%;object-fit:contain;transition:transform .25s}
.game-card:hover .game-card-icon img{transform:scale(1.045)}
.game-card h2{font-size:20px}.game-card p{font-size:14px;line-height:1.55;min-height:64px}
.game-panel-v17{width:min(100%,670px);position:relative}.arcade-board{min-height:345px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:14px;border-radius:16px;background:#111a31;color:#f5f7ff;padding:22px 14px;overflow:hidden;touch-action:pan-y}
.arcade-tools{display:flex;gap:9px;justify-content:center;flex-wrap:wrap;margin:16px 0}.arcade-tools button,.arcade-board button{font:inherit;cursor:pointer}.arcade-tools button{border:1px solid #dfe4f0;background:#f3f5fd;color:#26334e;padding:10px 13px;border-radius:10px;font-weight:700}
.arcade-tools button:disabled{opacity:.4;cursor:not-allowed}.arcade-message{text-align:center;color:#dbe5ff;font-size:14px;line-height:1.5}
.arcade-board .hang-word{display:flex;gap:6px;justify-content:center;flex-wrap:wrap}.hang-word span{border-bottom:3px solid #8da0ff;min-width:21px;text-align:center;font-size:clamp(18px,4vw,28px);font-weight:800;padding-bottom:5px}
.hang-figure{font-family:monospace;white-space:pre;line-height:1.25;font-size:17px;color:#e8eafc;margin:0}
.letter-grid{display:grid;grid-template-columns:repeat(9,minmax(0,1fr));gap:5px;width:100%;max-width:450px}.letter-grid button{background:#303c62;color:#fff;border:1px solid #57658a;border-radius:8px;padding:9px 1px;font-weight:700}.letter-grid button:disabled{opacity:.3}
.sudoku-grid{display:grid;grid-template-columns:repeat(9,1fr);width:min(100%,405px);aspect-ratio:1;border:3px solid #8396d6;border-radius:7px;overflow:hidden}.sudoku-grid button{background:#f5f7ff;color:#22304c;border:1px solid #c8d1e7;font-size:clamp(13px,3.2vw,21px);font-weight:700;padding:0;min-width:0}.sudoku-grid button.given{background:#d9e1fa;color:#34426d}.sudoku-grid button.selected{background:#b5e5fa}.sudoku-grid button.invalid{color:#bd2449;background:#ffe2e9}.sudoku-grid button:nth-child(3n){border-right:2px solid #7b8aaf}.sudoku-grid button:nth-child(n/**/+19):nth-child(-n/**/+27),.sudoku-grid button:nth-child(n/**/+46):nth-child(-n/**/+54){border-bottom:2px solid #7b8aaf}
.mine-grid{display:grid;gap:3px;width:min(100%,420px);grid-template-columns:repeat(var(--cols),1fr)}.mine-grid button{aspect-ratio:1;background:#536b9e;color:#fff;border:1px solid #7285b0;border-radius:5px;padding:0;font-weight:900;font-size:clamp(10px,2.7vw,18px)}.mine-grid button.revealed{background:#dfe8fa;color:#273856}.mine-grid button.mine{background:#ffc7c7}.mine-grid button.flagged{background:#485d90}
.ttt-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:9px;width:min(100%,330px);aspect-ratio:1}.ttt-grid button{border:2px solid #485b91;border-radius:13px;background:#202d4d;color:#81d7ff;font-size:clamp(40px,9vw,68px);font-weight:900}.ttt-grid button.o{color:#ffc96b}
.memory-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:9px;width:min(100%,410px)}.memory-grid button{aspect-ratio:1;border:2px solid #596aa1;border-radius:12px;background:#35447b;color:#fff;font-size:clamp(26px,6vw,42px)}.memory-grid button.face{background:#f0f4ff;color:#24324d}.memory-grid button.matched{background:#d3ffe6;color:#196c46}
.board-2048{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;width:min(100%,400px);padding:9px;background:#344366;border-radius:14px;aspect-ratio:1}.board-2048 div{display:grid;place-items:center;border-radius:8px;background:#536382;color:#fff;font-size:clamp(17px,5vw,33px);font-weight:900}.board-2048 .tile{background:#e9e5da;color:#253450}.board-2048 .t4{background:#d1e9fb}.board-2048 .t8{background:#ffd59a}.board-2048 .t16{background:#ffb777}.board-2048 .t32{background:#ff927c}.board-2048 .t64{background:#ff707b}.board-2048 .t128,.board-2048 .t256,.board-2048 .t512,.board-2048 .t1024,.board-2048 .t2048{background:#7869df;color:white;font-size:clamp(14px,3.8vw,26px)}
.game-panel-v17 .game-overlay{inset:0}.game-panel-v17 .game-modal{width:min(100%,470px)}
@media(max-width:580px){.arcade-board{padding:16px 8px;min-height:320px}.game-panel-v17{padding:12px}.letter-grid{grid-template-columns:repeat(7,minmax(0,1fr))}.games-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.game-card{padding:10px}.game-card-icon{height:115px}.game-card h2{font-size:16px}.game-card p{font-size:12px;min-height:75px}.game-card strong{font-size:12px}}
@media(max-width:360px){.games-grid{grid-template-columns:1fr}}

/* V18: Keep tic-tac-toe squares equal-sized even when text appears. */
.arcade-board .ttt-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(3,minmax(0,1fr));width:min(100%,330px);aspect-ratio:1;flex:0 0 auto;align-self:center;gap:9px}
.arcade-board .ttt-grid button{display:grid;place-items:center;width:100%;height:100%;min-width:0;min-height:0;aspect-ratio:1;box-sizing:border-box;margin:0;padding:0;line-height:1;font-family:Arial,sans-serif;font-size:clamp(35px,8vw,64px);font-weight:900;flex:none;appearance:none;-webkit-appearance:none}
/* Brief in-game result notification without hiding the final board. */
.game-end-notice{position:absolute;z-index:11;left:50%;bottom:24px;transform:translateX(-50%);max-width:calc(100% - 24px);padding:11px 19px;border-radius:12px;background:rgba(15,24,47,.94);color:#fff;font-weight:800;font-size:15px;text-align:center;white-space:nowrap;box-shadow:0 8px 30px #0005;pointer-events:none;animation:gameNoticeIn .2s ease-out}
@keyframes gameNoticeIn{from{opacity:0;transform:translate(-50%,8px)}to{opacity:1;transform:translate(-50%,0)}}
@media(max-width:420px){.arcade-board .ttt-grid{gap:6px}.arcade-board .ttt-grid button{font-size:clamp(30px,12vw,50px)}.game-end-notice{font-size:13px;bottom:12px}}
/* V19: hangman illustration, winning line, stable 2048 and movement */
.hang-scene{width:min(100%,340px);margin:0 auto;filter:drop-shadow(0 9px 13px #0005)}.hang-scene svg{display:block;width:100%;height:auto;max-height:255px}.hang-title{font-size:16px;font-weight:750;color:#f5f6ff;text-align:center}.hang-reveal{min-height:26px;text-align:center;color:#9af2c3;font-weight:800;font-size:17px}.hang-reveal.lost{color:#ffcc92}.hang-word span{min-width:23px}.arcade-board .ttt-grid{position:relative;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(3,minmax(0,1fr));aspect-ratio:1;align-content:stretch}.arcade-board .ttt-grid button{min-width:0;min-height:0;aspect-ratio:auto;width:100%;height:100%;font-size:clamp(36px,8vw,62px);transition:background .18s,color .18s,transform .16s}.ttt-grid button.winning{background:#264c65;color:#b5fbe7}.ttt-win-line{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none;z-index:3}.ttt-win-line line{stroke:#ffe18b;stroke-width:8;stroke-linecap:round;stroke-dasharray:500;stroke-dashoffset:500;animation:tttDraw .65s ease forwards;filter:drop-shadow(0 2px 5px #ffd96e90)}@keyframes tttDraw{to{stroke-dashoffset:0}}.ttt-result{min-height:26px;margin:0;font-size:16px;font-weight:750;color:#c4e7ff;text-align:center}.arcade-board .board-2048{position:relative;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(4,minmax(0,1fr));width:min(100%,400px);aspect-ratio:1;gap:8px;padding:9px;box-sizing:border-box;flex:none;align-self:center}.board-2048 .board-2048-cell{display:grid;place-items:center;min-width:0;min-height:0;width:100%;height:100%;aspect-ratio:auto;border-radius:8px;background:#536382;color:#fff;font-size:clamp(17px,5vw,33px);font-weight:900}.board-2048 .board-2048-cell.tile{background:#e9e5da;color:#253450}.board-2048 .board-2048-cell.t4{background:#d1e9fb}.board-2048 .board-2048-cell.t8{background:#ffd59a}.board-2048 .board-2048-cell.t16{background:#ffb777}.board-2048 .board-2048-cell.t32{background:#ff927c}.board-2048 .board-2048-cell.t64{background:#ff707b}.board-2048 .board-2048-cell.t128,.board-2048 .board-2048-cell.t256,.board-2048 .board-2048-cell.t512,.board-2048 .board-2048-cell.t1024,.board-2048 .board-2048-cell.t2048{background:#7869df;color:#fff;font-size:clamp(14px,3.8vw,26px)}.board-2048-motion{position:absolute;inset:0;pointer-events:none;z-index:5}.board-2048-moving{position:absolute;display:grid;place-items:center;border-radius:8px;background:#e9e5da;color:#253450;font-weight:900;font-size:clamp(17px,5vw,33px);transition:transform 300ms cubic-bezier(.22,1,.36,1);box-sizing:border-box}.board-2048-moving.t4{background:#d1e9fb}.board-2048-moving.t8{background:#ffd59a}.board-2048-moving.t16{background:#ffb777}.board-2048-moving.t32{background:#ff927c}.board-2048-moving.t64{background:#ff707b}.board-2048-moving.t128,.board-2048-moving.t256,.board-2048-moving.t512,.board-2048-moving.t1024,.board-2048-moving.t2048{background:#7869df;color:#fff;font-size:clamp(14px,3.8vw,26px)}

/* V20: 2048 overlay must not participate in CSS grid or obscure cells */
.arcade-board .board-2048{isolation:isolate;overflow:hidden}
.arcade-board .board-2048 > .board-2048-cell{position:relative;z-index:1;opacity:1!important;visibility:visible!important}
.arcade-board .board-2048 > .board-2048-motion{position:absolute!important;inset:0!important;display:block!important;width:100%!important;height:100%!important;min-width:0!important;min-height:0!important;padding:0!important;margin:0!important;background:transparent!important;border:0!important;pointer-events:none;z-index:5}
.arcade-board .board-2048 > .board-2048-motion:empty{display:none!important}
.arcade-board .board-2048 > .board-2048-motion > .board-2048-moving{display:grid;place-items:center;line-height:1;z-index:6}
/* Homepage: original illustrated artwork for each tool */
.v7-tile .v7-ico.tool-art{width:94px!important;height:94px!important;min-width:94px;display:grid;place-items:center;padding:0!important;border:0!important;background:transparent!important;overflow:hidden;border-radius:19px;margin-bottom:15px}
.v7-tile .v7-ico.tool-art img{display:block;width:100%;height:100%;object-fit:cover;border-radius:19px;transition:transform .22s ease}
.v7-tile:hover .v7-ico.tool-art img{transform:scale(1.055)}
@media(max-width:520px){.v7-tile .v7-ico.tool-art{width:75px!important;height:75px!important;min-width:75px}}

/* V21: fluid 2048 slide with stable fixed-size cells */
.arcade-board .board-2048 > .board-2048-motion > .board-2048-moving{transition:transform 300ms cubic-bezier(.22,1,.36,1)!important;will-change:transform;backface-visibility:hidden}

/* V23: illustrated character selection and game-like menus */
.avatar-option{padding:3px!important;overflow:hidden;aspect-ratio:1;min-height:0!important;border-radius:13px!important;transition:transform .15s,border-color .15s}
.avatar-option:hover{transform:translateY(-2px)}.avatar-picture{display:block;width:100%;height:100%;object-fit:cover;border-radius:9px;vertical-align:middle}
#final-player{display:flex;justify-content:center;align-items:center;gap:8px}#final-player .avatar-picture{width:38px;height:38px}
#ranking-list li span{display:inline-flex;align-items:center;gap:8px}#ranking-list .avatar-picture{width:29px;height:29px}
.game-menu-info p{font-size:13px;line-height:1.5;color:#6a7590;margin:8px 0}
.game-menu-detail{margin-top:13px;text-align:left;padding:13px;border:1px solid #dbe0f1;background:#f6f7fd;border-radius:12px;font-size:13px;line-height:1.5}
.game-menu-detail h3{margin:0 0 5px;font-size:15px}.game-menu-detail p{margin:5px 0}
.game-menu-detail[hidden]{display:none!important}
.game-modal-actions .button{min-height:42px}
html[data-theme=dark] .game-menu-detail{background:#192238;border-color:#475577;color:#e5e9f5}
html[data-theme=dark] .game-menu-info p{color:#c4cbe0}
.game-panel:fullscreen{width:100vw!important;max-width:none!important;height:100dvh!important;margin:0!important;border:0!important;border-radius:0!important;overflow:auto;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:12px!important;background:#111827!important}
.game-panel:fullscreen .game-canvas-wrap,.game-panel:fullscreen .arcade-board{max-height:75dvh}
.game-panel:fullscreen .game-stats{width:min(100%,650px)}
@media(hover:none) and (pointer:coarse){.game-controls{display:none!important}.game-canvas-wrap{touch-action:none}.game-page{margin-top:12px}.game-panel{width:100%;max-width:100%}.game-panel .game-modal{max-height:86dvh;overflow:auto}.game-modal-actions .button{font-size:12px}}
@media(max-width:420px){.game-modal{padding:15px 11px}.avatar-choices{gap:4px}.game-modal-actions{gap:5px}.game-modal-actions .button{padding:9px 10px}}

/* V24 — fases e memória responsiva */
.game-stage-menu{font-weight:800;color:var(--primary,#7c87ff);padding:10px 12px;border:1px solid rgba(126,141,255,.28);border-radius:12px;background:rgba(125,141,255,.09);text-align:center}
.game-stage-overlay{z-index:40}.stage-result{font-size:1rem;line-height:1.6}.stage-difficulty{font-weight:700;padding:9px 12px}
.arcade-board .memory-grid{grid-template-columns:repeat(var(--memory-cols,4),minmax(0,1fr));width:min(100%,510px);margin-inline:auto;gap:clamp(5px,1.5vw,12px)}
.arcade-board .memory-grid button{min-width:0;width:100%;aspect-ratio:1/1;font-size:clamp(1.1rem,4vw,2rem)}
@media(max-width:420px){.arcade-board .memory-grid{gap:5px}.arcade-board .memory-grid button{font-size:clamp(1rem,5vw,1.65rem)}}


