:root {
  color-scheme: dark;
  --bg: #0f1020;
  --panel: #1a1b28;
  --panel-2: #212233;
  --accent: #6842ff;
  --accent-hi: #8c6dff;
  --text: #fff;
  --muted: #aaadbe;
  --secondary: #2a2b3d;
  font-family:
    "Nunito",
    ui-rounded,
    "SF Pro Rounded",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}
* {
  box-sizing: border-box;
}
html,
body {
  width: 100%;
  min-width: 0;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
body {
  padding: 12px;
  overflow-x: hidden;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.sb {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}
.sb-side {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.sb-brand {
  display: none;
  align-items: center;
  gap: 10px;
}
.sb-logo {
  width: 40px;
  height: 40px;
  flex: none;
  filter: drop-shadow(0 4px 8px rgb(104 66 255 / 0.55));
}
.sb-brand h1 {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.01em;
  background: linear-gradient(180deg, #fff 30%, #c9bcff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sb-hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.chip {
  display: grid;
  justify-items: center;
  min-width: 0;
  padding: 6px 4px 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.07),
    0 4px 10px rgb(0 0 0 / 0.25);
}
.chip span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.chip strong {
  font-size: 1.02rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  min-height: 1.15em;
}
.chip-score {
  background: linear-gradient(180deg, #7b5cff, #5230e6);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.25),
    0 4px 14px rgb(104 66 255 / 0.4);
}
.chip-score span {
  color: #e2dbff;
}
.chip-lives strong {
  display: flex;
  align-items: center;
  gap: 3px;
}
.chip-lives i {
  display: block;
  width: 12px;
  height: 14px;
  background: linear-gradient(180deg, #fff, #b9a8ff 55%, #6842ff);
  clip-path: polygon(50% 0, 100% 85%, 72% 100%, 28% 100%, 0 85%);
  filter: drop-shadow(0 0 3px rgb(140 109 255 / 0.8));
}
.chip-lives i.lost {
  background: #3a3b52;
  filter: none;
}
.chip.bump strong {
  animation: bump 0.35s ease-out;
}
.chip.warn {
  background: linear-gradient(180deg, #ff5a6e, #c61f3b);
}
@keyframes bump {
  40% {
    transform: scale(1.3);
  }
}

.sb-actions {
  display: flex;
  gap: 8px;
}
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  font: inherit;
  font-weight: 900;
  font-size: 0.92rem;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    filter 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.pill:hover:not(:disabled) {
  filter: brightness(1.12);
}
.pill:active:not(:disabled) {
  transform: translateY(2px) scale(0.98);
}
.pill:disabled {
  opacity: 0.45;
  cursor: default;
}
.pill-primary {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / 0.25),
    0 5px 0 #4424c4,
    0 10px 22px rgb(104 66 255 / 0.45);
}
.pill-secondary {
  background: var(--secondary);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.08),
    0 4px 0 #1b1c2a;
}
.pill-toggle[aria-pressed="true"] {
  background: linear-gradient(180deg, #2fd9a0, #11a877);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.3),
    0 4px 0 #0a7352;
}
.pill-big {
  min-height: 56px;
  min-width: 190px;
  font-size: 1.25rem;
}
.sb-actions .pill {
  flex: 1;
  padding: 0 10px;
}
button:focus-visible,
canvas:focus-visible {
  outline: 3px solid #ffd84a;
  outline-offset: 3px;
}

.sb-help {
  display: none;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.5;
}
.sb-help span {
  display: block;
}
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--secondary);
  box-shadow: 0 2px 0 #14151f;
  color: #fff;
  font: inherit;
  font-size: 0.75rem;
  text-align: center;
}

.sb-stage {
  position: relative;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 400 / 560;
  margin: 0 auto;
  border-radius: 22px;
  overflow: hidden;
  background: #0b0c1d;
  box-shadow:
    0 0 0 2px #26284a,
    0 0 40px rgb(104 66 255 / 0.25),
    0 18px 40px rgb(0 0 0 / 0.5);
}
.sb-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.sb-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: radial-gradient(
    circle at 50% 40%,
    rgb(40 30 110 / 0.6),
    rgb(8 8 22 / 0.88)
  );
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sb-overlay[hidden] {
  display: none;
}
.sb-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  padding: 22px 18px 26px;
  border-radius: 26px;
  background: linear-gradient(180deg, #25264a, #1a1b28);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.1),
    0 20px 50px rgb(0 0 0 / 0.55);
  text-align: center;
  animation: card-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes card-in {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
}
.sb-card-art {
  width: 140px;
  height: 64px;
  filter: drop-shadow(0 6px 10px rgb(0 0 0 / 0.45));
  animation: float 2.6s ease-in-out infinite;
}
@keyframes float {
  50% {
    transform: translateY(-6px);
  }
}
.sb-card h2 {
  margin: 0;
  font-size: 2.1rem;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.01em;
  background: linear-gradient(180deg, #fff 35%, #c7b8ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sb-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
}
.sb-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin: 4px 0 8px;
}
.sb-results[hidden] {
  display: none;
}
.sb-results div {
  display: grid;
  padding: 8px 6px;
  border-radius: 16px;
  background: #14152a;
}
.sb-results span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sb-results strong {
  font-size: 1.35rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.sb-results .badge {
  grid-column: 1 / -1;
  padding: 6px;
  background: linear-gradient(180deg, #ffd84a, #ff9f1a);
  color: #3b2200;
  font-weight: 900;
}

@media (min-width: 700px) {
  body {
    padding: 12px 16px;
  }
  .sb {
    grid-template-columns: 220px minmax(0, 400px);
    justify-content: center;
    align-items: start;
    gap: 22px;
    max-width: 660px;
  }
  .sb-side {
    gap: 14px;
    padding-top: 8px;
  }
  .sb-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }
  .sb-logo {
    width: 54px;
    height: 54px;
  }
  .sb-hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .chip {
    padding: 9px 6px 10px;
    border-radius: 20px;
  }
  .chip strong {
    font-size: 1.35rem;
  }
  .chip-lives i {
    width: 15px;
    height: 17px;
  }
  .sb-actions {
    flex-direction: column;
  }
  .sb-help {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
}
@media (max-width: 380px) {
  body {
    padding: 8px;
  }
  .sb-hud {
    gap: 4px;
  }
  .chip span {
    font-size: 0.56rem;
  }
  .chip strong {
    font-size: 0.9rem;
  }
  .chip-lives i {
    width: 9px;
    height: 11px;
  }
  .sb-actions .pill {
    font-size: 0.8rem;
    gap: 4px;
  }
}
@media (max-width: 340px) {
  .sb-actions .pill svg {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
