:root {
  color-scheme: dark;
  --bg: #0f1020;
  --panel: #1a1b28;
  --panel-2: #212233;
  --line: #2f3148;
  --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;
}

.bs {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.bs-side {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.bs-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.bs-logo {
  width: 36px;
  height: 36px;
  flex: none;
  filter: drop-shadow(0 3px 6px rgb(0 0 0 / 0.4));
}
.bs-brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.1;
  background: linear-gradient(180deg, #fff 30%, #c9bcff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.bs-hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.chip {
  display: grid;
  justify-items: center;
  gap: 0;
  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.1;
}
.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.bump strong {
  animation: bump 0.35s ease-out;
}
.chip.warn {
  background: linear-gradient(180deg, #ff5a6e, #c61f3b);
}
.chip.warn span {
  color: #ffe1e5;
}
@keyframes bump {
  40% {
    transform: scale(1.3);
  }
}

.bs-actions {
  display: none;
  gap: 8px;
}
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  font: inherit;
  font-weight: 900;
  font-size: 0.95rem;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    filter 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.pill:hover {
  filter: brightness(1.1);
}
.pill:active {
  transform: translateY(2px) scale(0.98);
}
.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-primary:active {
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / 0.25),
    0 2px 0 #4424c4;
}
.pill-secondary {
  background: var(--secondary);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.08),
    0 4px 0 #1b1c2a;
}
.pill-big {
  min-height: 54px;
  min-width: 180px;
  font-size: 1.2rem;
}
button:focus-visible,
canvas:focus-visible {
  outline: 3px solid #ffd84a;
  outline-offset: 3px;
}

.bs-help {
  display: none;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.5;
}
.bs-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;
}

.bs-stage {
  position: relative;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 400 / 540;
  margin: 0 auto;
  border-radius: 22px;
  overflow: hidden;
  background: #151631;
  box-shadow:
    0 0 0 2px #26284a,
    0 18px 40px rgb(0 0 0 / 0.5);
}
.bs-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  -webkit-user-select: none;
  user-select: none;
}
.bs-stage.shake {
  animation: shake 0.4s ease-in-out;
}
@keyframes shake {
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(5px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(2px);
  }
}

.bs-swap {
  position: absolute;
  width: 52px;
  height: 52px;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bs-swap:active {
  transform: translate(-50%, -50%) scale(0.92);
}

.bs-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: radial-gradient(
    circle at 50% 40%,
    rgb(40 30 110 / 0.72),
    rgb(10 10 25 / 0.9)
  );
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.bs-overlay[hidden] {
  display: none;
}
.bs-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  padding: 22px 18px 24px;
  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;
  }
}
.bs-card-art {
  width: 120px;
  height: 56px;
  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(-5px);
  }
}
.bs-card h2 {
  margin: 0;
  font-size: 1.9rem;
  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;
}
.bs-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
}
.bs-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin: 4px 0 6px;
}
.bs-results[hidden] {
  display: none;
}
.bs-results div {
  display: grid;
  padding: 8px 6px;
  border-radius: 16px;
  background: #14152a;
}
.bs-results span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.bs-results strong {
  font-size: 1.35rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.bs-results .badge {
  grid-column: 1 / -1;
  padding: 6px;
  background: linear-gradient(180deg, #ffd84a, #ff9f1a);
  color: #3b2200;
  font-weight: 900;
}

@media (min-width: 680px) {
  body {
    padding: 12px 16px;
  }
  .bs {
    grid-template-columns: 220px minmax(0, 400px);
    justify-content: center;
    align-items: start;
    gap: 22px;
    max-width: 660px;
  }
  .bs-side {
    gap: 14px;
    padding-top: 6px;
  }
  .bs-brand {
    flex-direction: column;
    align-items: flex-start;
  }
  .bs-logo {
    width: 52px;
    height: 52px;
  }
  .bs-brand h1 {
    font-size: 1.9rem;
  }
  .bs-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;
  }
  .bs-actions,
  .bs-help {
    display: flex;
  }
  .bs-help {
    flex-direction: column;
    gap: 4px;
  }
  .bs-actions .pill {
    flex: 1;
  }
}
@media (max-width: 679px) {
  .bs-side {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }
  .bs-brand h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .bs-actions {
    display: flex;
  }
  .bs-actions .pill {
    width: 42px;
    padding: 0;
  }
  .bs-actions .pill-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}
@media (min-width: 680px) {
  .pill-icon {
    display: none;
  }
}
@media (max-width: 359px) {
  .bs-brand {
    display: none;
  }
  .bs-side {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }
  .bs-hud {
    gap: 4px;
  }
  .chip span {
    font-size: 0.56rem;
  }
  .chip strong {
    font-size: 0.9rem;
  }
}

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