/* SPDX-License-Identifier: Apache-2.0 | Copyright 2026 alvations (Melon Lab)
 * Numberics house style, lifted from Endless (style.css). Every new game links this first,
 * then its own small style.css. Change a token here only with before/after screenshots of every game. */
:root{
  --bg:#14151c; --panel:#1d1f2a; --cell:#262938; --ink:#ecebf1; --mute:#9a9bb0; --accent:#f2b84b;
  --line:#33364a; --cool:#6fb6ff; --bad:#ff6b6b; --good:#5fd39a;
  --gap:10px; --anim:110ms; --radius:14px; --tile-radius:8px;
}
@media (max-width:520px){ :root{ --gap:7px; } }
*{ box-sizing:border-box; }
html,body{ margin:0; background:var(--bg); color:var(--ink);
  font:16px/1.4 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; }
body{ min-height:100dvh; display:flex; justify-content:center;
  padding:max(16px,env(safe-area-inset-top)) 16px max(16px,env(safe-area-inset-bottom)); }
#app{ width:100%; max-width:480px; position:relative; }
header{ display:flex; justify-content:space-between; align-items:flex-end; gap:12px; margin-bottom:12px; flex-wrap:wrap; }
h1{ margin:0; font-size:2rem; letter-spacing:.02em; color:var(--accent); }
.sub{ margin:0; color:var(--mute); font-size:.85rem; } .sub a{ color:var(--mute); }
.stats{ display:flex; gap:8px; }
.stat{ background:var(--panel); border-radius:10px; padding:6px 12px; min-width:64px; text-align:center; }
.stat > span{ display:block; font-size:.68rem; text-transform:uppercase; letter-spacing:.08em; color:var(--mute); }
.stat b{ font-size:1.1rem; font-variant-numeric:tabular-nums; }
/* power-up tray: 4 slots, gold count badges (identical to Endless) */
.tray{ display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-bottom:6px; }
.pw{ position:relative; background:var(--panel); color:var(--ink); border:1px solid var(--line); border-radius:10px;
  padding:8px 4px; font:inherit; font-size:.85rem; cursor:pointer; white-space:nowrap; }
.pw:disabled{ opacity:.35; cursor:default; }
.pw.armed{ border-color:var(--accent); box-shadow:0 0 0 2px var(--accent) inset; }
.pw i{ font-style:normal; margin-left:6px; background:var(--accent); color:#1b1b22; border-radius:99px;
  padding:0 7px; font-weight:700; font-size:.78rem; }
@media (max-width:380px){ .pw{ font-size:.78rem; } .pw i{ margin-left:3px; padding:0 5px; } }
.hint{ min-height:1.4em; margin:0 0 8px; color:var(--accent); font-size:.85rem; text-align:center; }
/* square board panel */
.board{ position:relative; width:100%; aspect-ratio:1; background:var(--panel); border-radius:var(--radius); padding:var(--gap);
  touch-action:none; user-select:none; -webkit-user-select:none; outline:none; container-type:size; }
.board.targeting{ cursor:crosshair; box-shadow:0 0 0 2px var(--accent); }
/* number tile (the Endless tile): set --h for the hue */
.tile{ display:flex; align-items:center; justify-content:center; border-radius:var(--tile-radius); font-weight:800;
  background:hsl(var(--h,40) 62% 60%); color:#15151d; font-variant-numeric:tabular-nums; }
.tile.lo{ background:hsl(40 25% 88%); } .tile.lo2{ background:hsl(38 40% 82%); }
.tile.pop{ animation:nm-pop 140ms ease-out; } .tile.new{ animation:nm-appear 160ms ease-out; }
@keyframes nm-pop{ 50%{ scale:1.12; } }
@keyframes nm-appear{ from{ opacity:0; scale:.6; } }
/* buttons, rows, how-to, toast, overlay */
.row{ display:flex; justify-content:center; gap:8px; margin:14px 0 6px; flex-wrap:wrap; }
.btn{ background:var(--panel); color:var(--ink); border:1px solid var(--line); border-radius:10px; padding:9px 18px; font:inherit; cursor:pointer; }
.btn[aria-pressed="true"]{ border-color:var(--accent); color:var(--accent); }
.btn.primary{ background:var(--accent); color:#1b1b22; border-color:var(--accent); font-weight:700; }
.btn:disabled{ opacity:.35; cursor:default; }
.seg{ display:grid; grid-auto-flow:column; grid-auto-columns:1fr; gap:8px; margin-bottom:10px; }
.seg button{ background:var(--panel); color:var(--mute); border:1px solid var(--line); border-radius:10px; padding:7px; font:inherit; font-size:.85rem; cursor:pointer; }
.seg button[aria-pressed="true"]{ color:var(--ink); border-color:var(--accent); }
/* hover and press feedback (desktop), no movement */
.btn:hover:not(:disabled),.pw:hover:not(:disabled),.seg button:hover{ background:#262a3a; border-color:#4b4f6a; }
.btn:active:not(:disabled),.pw:active:not(:disabled),.seg button:active{ background:#2f3349; }
.btn.primary:hover:not(:disabled){ background:#f5c46a; border-color:#f5c46a; } .btn.primary:active:not(:disabled){ background:#e0a93f; }
.pw.empty{ opacity:.45; } .pw.empty:hover{ opacity:.6; }
a:hover{ color:var(--ink); }
.btn:focus-visible,.pw:focus-visible,.board:focus-visible,.seg button:focus-visible,a:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
a:focus-visible{ border-radius:6px; }
.how{ color:var(--mute); font-size:.82rem; text-align:center; margin:8px 0; }
.how a{ color:var(--mute); }
.games{ display:flex; flex-wrap:wrap; justify-content:center; gap:6px 10px; margin:10px 0 4px; font-size:.82rem; }
.games a{ color:var(--mute); } .games a[aria-current="page"]{ color:var(--accent); text-decoration:none; }
.toast{ position:fixed; left:50%; top:max(12px,env(safe-area-inset-top)); transform:translateX(-50%); background:var(--accent);
  color:#1b1b22; padding:5px 14px; font-size:.9rem; line-height:1.35; border-radius:99px; font-weight:700; opacity:0; pointer-events:none; transition:opacity 200ms;
  width:max-content; max-width:calc(100vw - 32px); text-align:center; z-index:5; box-shadow:0 4px 18px rgba(0,0,0,.45); }
.toast.on{ opacity:1; }
/* warnings and losses: neutral, never the gold reward pill */
.toast.bad{ background:var(--panel); color:var(--ink); border:1px solid var(--bad); font-weight:600; }
.toast.info{ background:var(--panel); color:var(--ink); border:1px solid var(--line); font-weight:600; }
.over{ position:absolute; inset:0; border-radius:var(--radius); background:rgba(20,21,28,.985); display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:10px; text-align:center; padding:20px; z-index:3; }
.over[hidden]{ display:none; } .over h2{ margin:0; font-size:clamp(1.2rem, 5.6vw, 1.6rem); line-height:1.2; text-wrap:balance; }
.over p{ margin:0; color:var(--mute); text-wrap:balance; } .over .best{ color:var(--accent); font-weight:700; }
@media (prefers-reduced-motion:reduce){
  :root{ --anim:0ms; }
  .tile.pop,.tile.new{ animation:none; }
  .toast{ transition:opacity 200ms; } /* opacity is not motion */
}
.games.detail{ display:grid; grid-template-columns:1fr 1fr; gap:8px; margin:14px 0 4px; font-size:.82rem; }
.games.detail a{ display:block; text-decoration:none; background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:8px 10px; color:var(--mute); line-height:1.3; }
.games.detail a b{ display:block; color:var(--ink); font-size:.95rem; } .games.detail a:hover{ border-color:#4b4f6a; }
@media (max-width:340px){ .games.detail{ grid-template-columns:1fr; } }
.pw.empty:focus-visible{ opacity:1; }
.games.detail a b .vs{ font-style:normal; font-weight:600; font-size:.66rem; letter-spacing:.06em; text-transform:uppercase; color:var(--cool); margin-left:6px; vertical-align:1px; }
.stat b.none,.stat .none{ color:var(--mute); font-weight:600; font-size:1.1rem; }
