/* ── Layout shell ── */
.shell{ position:relative; z-index:1; max-width:1020px; margin:0 auto; padding:1.25rem 1rem 2.5rem; }
.topbar{ display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap; margin-bottom:1rem; }
.brand{ display:flex; align-items:center; gap:.85rem; }
.brand-mark{
  width:48px; height:48px; flex:0 0 48px; display:grid; place-items:center;
  border-radius:14px; color:#fff;
  background:linear-gradient(135deg,var(--primary),var(--secondary));
  box-shadow:0 10px 30px rgba(220,38,38,.35), inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-mark svg{ width:24px; height:24px; }
.brand h1{ font-size:clamp(1.15rem,2.6vw,1.6rem); font-weight:900; letter-spacing:-.02em; line-height:1.2; }
.brand p{ font-size:.8rem; color:var(--muted); font-weight:600; }
.tools{ display:flex; gap:.5rem; }

/* ── Icon buttons ── */
.icon-btn{
  width:48px; height:48px; display:grid; place-items:center; cursor:pointer;
  border-radius:14px; border:1px solid var(--border-strong); color:var(--text);
  background:var(--card); backdrop-filter:blur(10px);
  transition:transform .18s cubic-bezier(.16,1,.3,1), background .18s, box-shadow .18s, color .18s;
}
.icon-btn svg{ width:20px; height:20px; stroke-width:1.75; }
.icon-btn:hover{ transform:translateY(-2px); background:var(--card-hover); box-shadow:0 12px 32px rgba(0,0,0,.45); }
.icon-btn:active{ transform:translateY(0) scale(.96); }
.icon-btn:focus-visible{ outline:2px solid var(--secondary); outline-offset:2px; }
.icon-btn.off{ color:var(--muted); }

/* ── HUD ── */
.hud{ display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:.6rem; margin-bottom:.85rem; }
.stat{
  display:flex; flex-direction:column; gap:.15rem; padding:.6rem .75rem;
  border:1px solid var(--border); border-radius:var(--radius-sm);
  background:var(--card); backdrop-filter:blur(10px); min-width:0;
}
.stat-ico{ display:grid; place-items:center; width:22px; height:22px; }
.stat-ico svg{ width:18px; height:18px; stroke-width:1.75; }
.c-amber{ color:var(--amber); } .c-violet{ color:var(--violet); }
.c-blue{ color:#60A5FA; } .c-red{ color:var(--primary); } .c-green{ color:var(--accent); }
.stat-label{ font-size:.68rem; color:var(--muted); font-weight:700; letter-spacing:.02em; }
.stat-value{ font-size:.95rem; color:var(--text); }
.pixel{ font-family:var(--pixel); font-size:.8rem; letter-spacing:.02em; }
.hearts{ display:flex; gap:3px; }
.hearts svg{ width:14px; height:14px; fill:var(--primary); stroke:var(--primary); }
.combo{ transition:box-shadow .2s, border-color .2s; }
.combo.hot{ border-color:rgba(34,197,94,.5); box-shadow:0 0 0 1px rgba(34,197,94,.25), 0 10px 30px rgba(34,197,94,.18); }
@media (max-width:720px){ .hud{ grid-template-columns:repeat(3,minmax(0,1fr)); } .combo{ grid-column:span 3; } }

/* ── Stage / canvas ── */
.stage{
  position:relative; border-radius:22px; overflow:hidden;
  border:1px solid var(--border-strong);
  background:linear-gradient(180deg,#0A1226 0%,#060B16 100%);
  box-shadow:inset 0 0 90px rgba(37,99,235,.20), inset 0 0 140px rgba(220,38,38,.10), var(--shadow);
  touch-action:none;
}
.stage canvas{ display:block; width:100%; height:auto; aspect-ratio:900/640; }

/* ── Overlays ── */
.overlay{
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  padding:1.25rem; text-align:center; background:rgba(5,9,18,.82);
  backdrop-filter:blur(6px); animation:fadeIn .25s ease both;
}
.overlay[hidden]{ display:none; }
.panel{ max-width:560px; width:100%; }
.panel h2{ font-size:clamp(1.3rem,3.4vw,2rem); font-weight:900; letter-spacing:-.02em; }
.panel h2 .hl{ color:var(--accent); }
.panel .lead{ color:var(--muted); font-size:.92rem; margin-top:.5rem; font-weight:600; }
.big-score{ font-family:var(--pixel); font-size:1.4rem; color:var(--amber); display:block; margin-top:.6rem; }

/* ── Start screen bits ── */
.diff{ display:flex; gap:.4rem; justify-content:center; margin:1rem 0 .35rem; }
.chip{
  cursor:pointer; font-family:var(--sans); font-weight:800; font-size:.8rem;
  padding:.5rem 1.05rem; min-height:44px; border-radius:999px; color:var(--muted);
  border:1px solid var(--border-strong); background:transparent;
  transition:all .18s cubic-bezier(.16,1,.3,1);
}
.chip:hover{ color:var(--text); background:var(--card-hover); transform:translateY(-2px); }
.chip.on{ color:#04121F; background:linear-gradient(135deg,var(--accent),#4ADE80); border-color:transparent; box-shadow:0 8px 26px rgba(34,197,94,.35); }
.controls{ display:flex; flex-wrap:wrap; gap:.5rem; justify-content:center; margin-top:1rem; }
.ctrl{
  display:flex; align-items:center; gap:.4rem; padding:.45rem .8rem; font-size:.75rem; font-weight:700;
  color:var(--muted); border:1px solid var(--border); border-radius:999px; background:var(--card);
}
.ctrl svg{ width:15px; height:15px; stroke-width:1.75; color:var(--secondary); }

/* ── Buttons ── */
.actions{ display:flex; gap:.6rem; justify-content:center; flex-wrap:wrap; margin-top:1.25rem; }
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:.5rem;
  min-height:48px; padding:.7rem 1.5rem; border-radius:999px; cursor:pointer;
  font-family:var(--sans); font-size:.92rem; font-weight:800; border:none;
  transition:transform .18s cubic-bezier(.16,1,.3,1), box-shadow .18s, opacity .18s, background .18s;
}
.btn svg{ width:18px; height:18px; stroke-width:1.75; }
.btn-primary{ background:linear-gradient(135deg,var(--primary),#F97316); color:#fff; box-shadow:0 12px 34px rgba(220,38,38,.35); }
.btn-primary:hover{ transform:translateY(-2px); box-shadow:0 18px 44px rgba(220,38,38,.5); }
.btn-ghost{ background:var(--card); color:var(--text); border:1px solid var(--border-strong); backdrop-filter:blur(10px); }
.btn-ghost:hover{ transform:translateY(-2px); background:var(--card-hover); }
.btn:active{ transform:translateY(0) scale(.97); }
.btn:focus-visible{ outline:2px solid var(--secondary); outline-offset:3px; }

/* ── Power-up legend ── */
.legend{ display:flex; flex-wrap:wrap; gap:.5rem; justify-content:center; margin-top:.9rem; }
.legend span{ display:inline-flex; align-items:center; gap:.4rem; font-size:.72rem; font-weight:700; color:var(--muted); }
.dot{ width:10px; height:10px; border-radius:3px; display:inline-block; }
.dot.g{ background:var(--accent); } .dot.b{ background:var(--secondary); }
.dot.c{ background:var(--cyan); } .dot.r{ background:var(--primary); }

/* ── Toast ── */
.toast-wrap{ position:fixed; bottom:1.25rem; inset-inline-start:1.25rem; z-index:80; display:flex; flex-direction:column; gap:.5rem; }
.toast{
  display:flex; align-items:center; gap:.55rem; padding:.7rem 1.1rem; border-radius:12px;
  font-size:.85rem; font-weight:800; color:var(--text); background:rgba(10,16,30,.92);
  border:1px solid var(--border-strong); box-shadow:var(--shadow);
  backdrop-filter:blur(10px); animation:slideUp .3s cubic-bezier(.16,1,.3,1) both;
}
.toast svg{ width:16px; height:16px; color:var(--accent); }

/* ── Footer hints ── */
.footnote{ margin-top:1rem; text-align:center; font-size:.72rem; color:var(--muted); font-weight:600; }
.footnote kbd{
  font-family:var(--pixel); font-size:.6rem; padding:.25rem .4rem; border-radius:6px;
  border:1px solid var(--border-strong); background:var(--card); color:var(--text);
}

/* ── Animations ── */
@keyframes fadeIn{ from{ opacity:0 } to{ opacity:1 } }
@keyframes slideUp{ from{ opacity:0; transform:translateY(14px) } to{ opacity:1; transform:none } }
@keyframes pop{ from{ opacity:0; transform:scale(.94) } to{ opacity:1; transform:none } }
.panel{ animation:pop .32s cubic-bezier(.16,1,.3,1) both; }
@media (prefers-reduced-motion:reduce){
  *{ animation-duration:.001ms !important; transition-duration:.001ms !important; }
}
@media (max-width:520px){
  .shell{ padding:.85rem .6rem 1.75rem; }
  .brand-mark{ width:42px; height:42px; flex-basis:42px; }
  .icon-btn{ width:44px; height:44px; }
  .stat-value{ font-size:.85rem; }
}
