/* Juegos · estilos propios */
.tabs { display: flex; gap: 2px; margin: 0 auto; max-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 3px; border-radius: 10px; background: var(--sunken); border: 1px solid var(--border); }
.tabs button { flex: none; height: 30px; padding: 0 14px; border: 0; border-radius: 7px; background: none; font-weight: 500; color: var(--text-2); }
.tabs button[aria-selected="true"] { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }
.topbar .top-actions { margin-left: 0; }
.game { max-width: 760px; margin: 0 auto; display: grid; gap: 14px; justify-items: center; }
.hud { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.score { display: flex; flex-direction: column; align-items: center; min-width: 74px; padding: 5px 12px; border-radius: 9px; background: var(--sunken); }
.score small { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.score b { font-size: 18px; font-variant-numeric: tabular-nums; }
.help { margin: 0; text-align: center; }
.over { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border-radius: inherit; background: color-mix(in srgb, var(--panel) 82%, transparent); backdrop-filter: blur(3px); text-align: center; animation: fade .2s ease-out; }
.over b { font-size: 24px; }
.over span { color: var(--text-2); }

/* 2048 */
.g2-wrap { position: relative; border-radius: 14px; }
.g2 { --g: min(92vw, 440px); display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); grid-template-rows: repeat(var(--n, 4), 1fr); gap: calc(40px / var(--n, 4)); width: var(--g); aspect-ratio: 1; padding: 10px; border-radius: 14px; background: #bbada0; outline: none; touch-action: none; user-select: none; }
.g2:focus-visible { box-shadow: 0 0 0 3px var(--accent-line); }
.t { display: grid; place-items: center; border-radius: 8px; background: rgba(238, 228, 218, .35); font-weight: 700; font-size: calc(var(--g) / (var(--n, 4) * 2.25)); color: #776e65; font-variant-numeric: tabular-nums; }
.t.v2 { background: #eee4da; } .t.v4 { background: #ede0c8; }
.t.v8 { background: #f2b179; color: #fff; } .t.v16 { background: #f59563; color: #fff; } .t.v32 { background: #f67c5f; color: #fff; } .t.v64 { background: #f65e3b; color: #fff; }
.t.v128, .t.v256, .t.v512 { background: #edcf72; color: #fff; font-size: calc(var(--g) / (var(--n, 4) * 2.75)); } .t.v256 { background: #edcc61; } .t.v512 { background: #edc850; }
.t.v1024, .t.v2048 { background: #edc53f; color: #fff; font-size: calc(var(--g) / 13); box-shadow: 0 0 20px 4px rgba(243, 215, 116, .45); font-size: calc(var(--g) / (var(--n, 4) * 3.25)); } .t.v2048 { background: #edc22e; }
.t.v4096 { background: #3c3a32; color: #fff; font-size: calc(var(--g) / (var(--n, 4) * 3.25)); }
.t.new { animation: pop .18s var(--ease); }
.t.merged { animation: bump .16s var(--ease); }
@keyframes bump { 50% { transform: scale(1.12); } }

/* Buscaminas */
.ms-wrap { position: relative; max-width: 100%; overflow: auto; border-radius: 10px; }
.ms { --cell: 30px; display: grid; gap: 2px; padding: 8px; border-radius: 10px; background: var(--border); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.c { width: var(--cell); height: var(--cell); padding: 0; border: 0; border-radius: 4px; background: var(--panel); box-shadow: inset 0 -2px 0 var(--border-2); font: 700 14px var(--sans); line-height: 1; }
.c:hover:not(.open) { background: var(--hover); }
.c.open { background: var(--sunken); box-shadow: none; cursor: default; }
.c.open.n0 { cursor: default; }
.n1 { color: #2563eb; } .n2 { color: #16a34a; } .n3 { color: #dc2626; } .n4 { color: #7c3aed; } .n5 { color: #b45309; } .n6 { color: #0891b2; } .n7 { color: var(--text); } .n8 { color: var(--text-3); }
.c.flag, .c.mine { font-size: 13px; }
.c.boom { background: #fca5a5; }

/* Serpiente */
.sn-wrap { position: relative; border-radius: 12px; overflow: hidden; }
#sn { display: block; width: min(92vw, 480px); height: auto; aspect-ratio: 1; touch-action: none; }
@media (max-width: 700px) { .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; } .tabs { order: 3; margin: 0; } .ms { --cell: clamp(28px, calc((100vw - 48px) / var(--cols, 9) - 2px), 42px); } .c { font-size: 16px; } }

/* Sudoku */
.sd-wrap, .mm-wrap, .wl-wrap { position: relative; border-radius: 12px; }
.sd { --s: min(92vw, 468px); display: grid; grid-template-columns: repeat(9, 1fr); width: var(--s); aspect-ratio: 1; border: 2px solid var(--text); border-radius: 10px; overflow: hidden; background: var(--panel); user-select: none; touch-action: manipulation; }
.sd.busy { opacity: .4; }
.sc { position: relative; display: grid; place-items: center; padding: 0; border: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--panel); font: 500 calc(var(--s) / 17) var(--sans); color: var(--accent); cursor: pointer; }
.sc.br { border-right: 2px solid var(--text); } .sc.bb { border-bottom: 2px solid var(--text); }
.sc.given { color: var(--text); font-weight: 650; }
.sc.peer { background: var(--sunken); }
.sc.same { background: var(--accent-soft); }
.sc.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.sc.bad { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--panel)); }
.nt { position: absolute; inset: 2px; display: grid; grid-template-columns: repeat(3, 1fr); font-size: calc(var(--s) / 44); line-height: 1; color: var(--text-3); }
.nt i { display: grid; place-items: center; font-style: normal; }
.sd-pad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; width: min(92vw, 468px); }
.sd-pad button { display: flex; flex-direction: column; align-items: center; padding: 6px 0 3px; border: 1px solid var(--border-2); border-radius: 8px; background: var(--panel); color: var(--text); }
.sd-pad button b { font-size: 20px; font-weight: 600; line-height: 1.1; }
.sd-pad button small { font-size: 10px; color: var(--text-3); }
.sd-pad button.full { opacity: .35; }
.sd-pad button:hover { background: var(--hover); }
.sd-tools { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
#sdNotes[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
/* Memoria */
.mm { --cols: 4; --w: min(92vw, 520px); display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 8px; width: var(--w); }
.mc { aspect-ratio: 1; padding: 0; border: 0; border-radius: 10px; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #000)); cursor: pointer; transition: transform .25s var(--ease), background .25s; }
.mc .f { display: grid; place-items: center; width: 100%; height: 100%; font-size: calc(var(--w) / var(--cols) * .5); opacity: 0; transition: opacity .15s; }
.mc.open, .mc.done { background: var(--panel); box-shadow: inset 0 0 0 1px var(--border-2); transform: rotateY(180deg); }
.mc.open .f, .mc.done .f { opacity: 1; transform: rotateY(180deg); }
.mc.done { opacity: .55; cursor: default; }
/* Palabra */
.wl { display: grid; gap: 6px; }
.wr { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.wr.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.wt { display: grid; place-items: center; width: min(15vw, 58px); aspect-ratio: 1; border: 2px solid var(--border-2); border-radius: 6px; font: 700 min(8vw, 28px) var(--sans); text-transform: uppercase; }
.wt.filled { border-color: var(--text-3); }
.wt.ok, .kk.ok, .wl-k.ok { background: #16a34a; border-color: #16a34a; color: #fff; }
.wt.near, .kk.near, .wl-k.near { background: #ca8a04; border-color: #ca8a04; color: #fff; }
.wt.no, .kk.no, .wl-k.no { background: var(--text-3); border-color: var(--text-3); color: #fff; }
.wl-kb { display: grid; gap: 6px; width: min(96vw, 520px); }
.kr { display: flex; gap: 4px; justify-content: center; }
.kk { flex: 1 1 0; min-width: 0; height: 52px; padding: 0; border: 0; border-radius: 6px; background: var(--sunken); font: 600 15px var(--sans); color: var(--text); text-transform: uppercase; }
.kk.wide { flex: 1.6 1 0; font-size: 12px; }
.wl-k { padding: 0 5px; border-radius: 4px; font-weight: 600; }
.big-w { font: 700 26px var(--sans); letter-spacing: .15em; color: var(--text) !important; }
.wl-more { width: min(92vw, 520px); }
.wl-more summary { cursor: pointer; font-size: 13px; color: var(--text-2); text-align: center; }
.wl-dist { display: grid; gap: 3px; margin-top: 8px; }
.dr { display: grid; grid-template-columns: 16px 1fr; gap: 6px; align-items: center; font-size: 12px; }
.dr i { display: block; padding: 2px 6px; border-radius: 4px; background: var(--accent); color: #fff; font-style: normal; text-align: right; }
:root[data-input="touch"] .seg button { min-height: 38px; }
