
:root{
  --bg:#f6f7fb; --bg2:#fff; --text:#0f172a; --muted:#64748b; --border:#e5e7eb;
  --primary:#0f172a; --accent:#f1f5f9; --shadow:0 6px 24px rgba(15,23,42,.08);
  --radius:16px;
}
*{box-sizing:border-box}
body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,Helvetica,sans-serif;color:var(--text);background:linear-gradient(#f8fafc,#fff)}
.container{max-width:1120px;margin:0 auto;padding:24px}
header.sticky{position:sticky;top:0;background:rgba(255,255,255,.8);backdrop-filter:blur(8px);border-bottom:1px solid var(--border);z-index:10}
header .inner{display:flex;gap:12px;align-items:center;padding:14px 24px}
h1{font-size:20px;margin:0}
.grid{display:grid;gap:20px}
@media(min-width:640px){.grid{grid-template-columns:repeat(2,1fr)}}
@media(min-width:1024px){.grid{grid-template-columns:repeat(3,1fr)}}
.card{background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius);padding:16px;box-shadow:var(--shadow)}
.badge{display:inline-block;padding:6px 10px;border-radius:999px;border:1px solid var(--border);font-size:12px;background:#f8fafc}
.title{font-weight:700;margin:8px 0 0}
.muted{color:var(--muted)}
.row{display:flex;gap:10px;align-items:center}
input[type="search"]{width:100%;max-width:520px;padding:12px 14px;border-radius:12px;border:1px solid var(--border);outline:none}
input[type="search"]:focus{box-shadow:0 0 0 3px #e2e8f0}
.btn{appearance:none;border:1px solid var(--primary);background:var(--primary);color:#fff;padding:10px 14px;border-radius:12px;font-weight:600;cursor:pointer;box-shadow:var(--shadow)}
.btn.secondary{background:#fff;color:var(--primary);border-color:var(--border)}
.btn:active{transform:scale(.99)}
/* Modal */
.modal{position:fixed;inset:0;display:none;place-items:center;z-index:50}
.modal.open{display:grid}
.backdrop{position:absolute;inset:0;background:rgba(0,0,0,.35)}
.dialog{position:relative;width:min(100% - 32px,960px);background:#fff;border:1px solid var(--border);border-radius:18px;overflow:hidden;box-shadow:0 16px 60px rgba(2,6,23,.25)}
.dialog .head{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--border);padding:14px 16px}
.dialog .body{padding:16px;background:#f8fafc;min-height:420px}
.icon-btn{border:1px solid var(--border);border-radius:12px;background:#fff;padding:8px;cursor:pointer}
/* Small UI helpers for games */
.panel{display:grid;gap:12px}
.two-col{display:grid;gap:20px}
@media(min-width:768px){.two-col{grid-template-columns:240px 1fr}}
.stat{font-size:28px;font-weight:800}
.board-ttt{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.cell-ttt{aspect-ratio:1/1;border:1px solid var(--border);border-radius:12px;font-size:28px;font-weight:800;display:flex;align-items:center;justify-content:center;background:#fff}
.board-2048{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.cell-2048{width:80px;height:80px;border:1px solid var(--border);border-radius:12px;display:flex;align-items:center;justify-content:center;font-weight:800;background:#f1f5f9;color:#94a3b8}
.cell-2048.v{background:#fde68a;color:#92400e;border-color:#fcd34d}
.memory-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;justify-items:center}
.memory-card{width:84px;height:108px;border-radius:16px;border:1px solid var(--border);display:flex;align-items:center;justify-content:center;font-size:32px;background:#e2e8f0}
.memory-card.open{background:#fff}
.memory-card.match{background:#d1fae5;border-color:#a7f3d0}
canvas{border:1px solid var(--border);border-radius:14px;background:#fff}
footer{color:var(--muted);font-size:14px;border-top:1px solid var(--border);padding:20px}
