:root { --g2-bg:#0b2a22; --g2-panel:#12382e; --g2-line:#a0c5ac40; --g2-cream:#faf7ef; --g2-muted:#b9cdbf; --g2-gold:#f2cf83; --g2-empty:#ffffff0f; }
    * { box-sizing:border-box; }
    body.sr-2048 { margin:0; background:var(--g2-bg); color:var(--g2-cream); font:15px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; }
    .g2 { max-width:640px; margin:0 auto; padding:16px; }
    .g2 h1 { margin:0 0 4px; font-size:clamp(24px,5vw,34px); line-height:1.1; }
    .g2-lead { margin:0 0 14px; color:var(--g2-muted); }
    .g2 button,.g2-dialog button { font:inherit; color:var(--g2-cream); background:#ffffff0d; border:1px solid var(--g2-line); border-radius:10px; padding:9px 14px; cursor:pointer; }
    .g2 button:hover:not(:disabled) { background:#ffffff1a; }
    .g2 button:disabled { opacity:.45; cursor:default; }
    .g2 button:focus-visible,.g2-dialog button:focus-visible { outline:2px solid var(--g2-gold); outline-offset:2px; }
    .g2 button.g2-primary,.g2-dialog button.g2-primary { background:var(--g2-gold); color:#1b2a22; border-color:var(--g2-gold); font-weight:700; }
    .g2 button.g2-primary:hover:not(:disabled) { background:#ffe0a0; }
    .g2 button[aria-pressed="true"] { background:#f2cf8326; border-color:var(--g2-gold); color:var(--g2-gold); font-weight:600; }
    .g2-row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; justify-content:space-between; margin-bottom:10px; }
    .g2-group { display:flex; flex-wrap:wrap; gap:6px; }
    .g2-stats { display:flex; gap:8px; margin-bottom:10px; }
    .g2-stat { position:relative; flex:1; min-width:0; padding:6px 10px; border:1px solid var(--g2-line); border-radius:10px; background:#ffffff06; }
    .g2-stat small { display:block; color:var(--g2-muted); font-size:10px; letter-spacing:1px; text-transform:uppercase; white-space:nowrap; }
    .g2-stat strong { font-size:20px; color:var(--g2-gold); font-variant-numeric:tabular-nums; }
    .g2-plus { position:absolute; right:10px; top:8px; color:#8ee59a; font-weight:700; animation:g2-rise .7s ease-out forwards; pointer-events:none; }
    @keyframes g2-rise { from { transform:translateY(8px); opacity:0; } 25% { opacity:1; } to { transform:translateY(-14px); opacity:0; } }
    .g2-msg { min-height:21px; margin:0 0 10px; color:var(--g2-muted); font-size:14px; }
    .g2-result { margin-bottom:10px; padding:12px 14px; border:1px solid #f2cf8366; border-radius:12px; background:#1a3b31; }
    .g2-result h2 { margin:0 0 2px; font-size:clamp(20px,5vw,26px); color:var(--g2-gold); }
    .g2-result p { margin:0 0 10px; }
    .g2-result-actions { display:flex; flex-wrap:wrap; gap:8px; }
    .g2-board { position:relative; width:min(100%,520px,calc(100vh - 170px)); min-width:280px; aspect-ratio:1; margin:0 auto; border-radius:12px; background:var(--g2-panel); border:1px solid var(--g2-line); touch-action:none; user-select:none; -webkit-user-select:none; cursor:grab; outline:none; overflow:hidden; }
    .g2-board:focus-visible { outline:2px solid var(--g2-gold); outline-offset:2px; }
    .g2-board.g2-shake { animation:g2-shake .22s ease-out; }
    @keyframes g2-shake { 25% { transform:translateX(-4px); } 75% { transform:translateX(4px); } }
    .g2-slot,.g2-t { position:absolute; width:var(--t); height:var(--t); border-radius:8%; }
    .g2-slot { background:var(--g2-empty); }
    .g2-t { display:grid; place-items:center; font-weight:800; color:#1b2a22; font-variant-numeric:tabular-nums; line-height:1; transition:left .11s ease-in-out,top .11s ease-in-out; font-size:var(--fs); }
    .g2-t.g2-new { animation:g2-pop .16s ease-out .08s backwards; }
    .g2-t.g2-merge { animation:g2-merge .18s ease-out .08s; z-index:2; }
    @keyframes g2-pop { from { transform:scale(.2); opacity:0; } to { transform:none; opacity:1; } }
    @keyframes g2-merge { 50% { transform:scale(1.16); } }
    .g2-under { display:flex; flex-wrap:wrap; gap:8px; align-items:center; justify-content:space-between; width:min(100%,520px); margin:10px auto 0; }
    .g2-pad button { width:44px; height:40px; padding:0; font-size:18px; line-height:1; }
    .g2-pad button.g2-suggest { background:#8fd3ff33; border-color:#8fd3ff; color:#8fd3ff; }
    .g2 details { margin-top:12px; padding:10px 14px; border:1px solid var(--g2-line); border-radius:12px; background:#ffffff06; }
    .g2 summary { cursor:pointer; font-weight:600; }
    .g2-set { display:flex; flex-wrap:wrap; gap:8px 20px; margin-top:10px; align-items:center; }
    .g2-set label { display:flex; gap:7px; align-items:center; }
    .g2-set input[type=range] { width:120px; accent-color:var(--g2-gold); }
    .g2-set input[type=checkbox] { width:18px; height:18px; accent-color:var(--g2-gold); }
    .g2-table { width:100%; margin-top:8px; border-collapse:collapse; font-variant-numeric:tabular-nums; }
    .g2-table th,.g2-table td { padding:5px 6px; text-align:right; border-bottom:1px solid var(--g2-line); }
    .g2-table th:first-child,.g2-table td:first-child { text-align:left; }
    .g2-table th { color:var(--g2-muted); font-size:12px; font-weight:600; }
    .g2-help { margin-top:18px; color:var(--g2-muted); font-size:14px; }
    .g2-help h2 { margin:18px 0 6px; font-size:17px; color:var(--g2-cream); }
    .g2-help h3 { margin:12px 0 2px; font-size:15px; color:var(--g2-cream); }
    .g2-help p { margin:0 0 8px; }
    .g2-help ul { margin:0 0 8px; padding-left:20px; }
    .g2 kbd { padding:1px 6px; border:1px solid var(--g2-line); border-radius:5px; font:inherit; font-size:12px; background:#ffffff0d; }
    .g2-dialog { max-width:360px; padding:18px; border:1px solid var(--g2-line); border-radius:14px; background:var(--g2-panel); color:var(--g2-cream); font:15px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; }
    .g2-dialog::backdrop { background:#0008; }
    .g2-dialog p { margin:0 0 14px; }
    .g2-fx { position:fixed; inset:0; width:100%; height:100%; pointer-events:none; z-index:20; }
    body.sr-2048 [hidden] { display:none !important; }
    @media (max-width:560px) {
      .g2 { padding:12px; }
      .g2 button { padding:8px 11px; }
      .g2-stat strong { font-size:17px; }
      .g2-pad button { width:40px; padding:0; }
    }
    @media (prefers-reduced-motion: reduce) {
      .g2-t { transition:none; }
      .g2-t.g2-new,.g2-t.g2-merge,.g2-board.g2-shake,.g2-plus { animation:none; }
      .g2-plus { display:none; }
    }

/* Preferenze degli effetti e salvataggio. */
body[data-fx="false"] .g2-t { transition:none !important; }
body[data-fx="false"] .g2-t,body[data-fx="false"] .g2-board,body[data-fx="false"] .g2-plus { animation:none !important; }
.g2-save-note { color:var(--g2-muted); font-size:13px; margin:14px 0; }
.g2-more { margin-top:24px; }
.g2-sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
.g2-readable-board { width:100%; border-collapse:collapse; font-size:12px; text-align:center; }
.g2-readable-board caption { text-align:left; margin:8px 0; color:var(--g2-muted); }
.g2-readable-board th,.g2-readable-board td { padding:5px 3px; border-bottom:1px solid var(--g2-line); }
