:root {
  --bo-bg: #0f1020;
  --bo-panel: #1a1b28;
  --bo-panel-2: #212233;
  --bo-accent: #6842ff;
  --bo-accent-2: #8a6bff;
  --bo-secondary: #2a2b3d;
  --bo-text: #fff;
  --bo-muted: #aaadbe;
  --bo-gold: #ffc93c;
  --bo-font:
    "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system,
    "Segoe UI", sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bo-bg);
  color: var(--bo-text);
  font-family: var(--bo-font);
  font-weight: 700;
  -webkit-tap-highlight-color: transparent;
}

body {
  overflow-x: hidden;
}

.bo-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.bo-shell {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 8px 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* HUD ------------------------------------------------------------------ */
.bo-hud {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 760px;
}

.bo-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-height: 36px;
  padding: 7px 13px;
  border-radius: 999px;
  background: linear-gradient(180deg, #27283d, var(--bo-panel));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 3px 0 rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}

.bo-chip span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bo-muted);
}

.bo-chip strong {
  font-size: 17px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.bo-chip-level {
  background: linear-gradient(180deg, #7b5bff, var(--bo-accent));
}

.bo-chip-level span {
  color: rgba(255, 255, 255, 0.8);
}

.bo-chip-stars strong {
  color: var(--bo-gold);
}

.bo-chip-stars strong span {
  font-size: 17px;
  letter-spacing: 0;
  text-transform: none;
  color: inherit;
}

.bo-hud-right {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.bo-icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--bo-secondary);
  color: var(--bo-text);
  font: 900 16px var(--bo-font);
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 3px 0 rgba(0, 0, 0, 0.4);
  transition: transform 0.12s ease;
}

.bo-icon-btn svg {
  width: 20px;
  height: 20px;
}

.bo-icon-btn:active {
  transform: translateY(2px);
}

.bo-icon-btn .bo-snd-off {
  display: none;
}

.bo-icon-btn[aria-pressed="false"] .bo-snd-on {
  display: none;
}

.bo-icon-btn[aria-pressed="false"] .bo-snd-off {
  display: inline;
}

/* Stage ---------------------------------------------------------------- */
.bo-stage {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 320px;
}

#bo-canvas {
  display: block;
  touch-action: manipulation;
  border-radius: 22px;
  outline: none;
  cursor: pointer;
}

#bo-canvas.is-kbd:focus {
  box-shadow:
    0 0 0 3px var(--bo-bg),
    0 0 0 6px var(--bo-accent-2);
}

/* Overlays -------------------------------------------------------------- */
.bo-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: var(--bo-cw, 100%);
  max-width: 100%;
  transform: translateX(-50%);
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(10, 10, 24, 0.62);
  backdrop-filter: blur(3px);
  border-radius: 22px;
  animation: bo-fade 0.25s ease;
}

.bo-overlay[hidden] {
  display: none;
}

@keyframes bo-fade {
  from {
    opacity: 0;
  }
}

.bo-card {
  width: min(360px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 20px 20px 18px;
  border-radius: 24px;
  text-align: center;
  background: linear-gradient(180deg, #2a2b42, var(--bo-panel));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 18px 40px rgba(0, 0, 0, 0.5),
    0 5px 0 rgba(0, 0, 0, 0.35);
  animation: bo-pop 0.42s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes bo-pop {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
}

.bo-card h2 {
  margin: 4px 0 6px;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.01em;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}

.bo-card p {
  margin: 0 0 14px;
  color: var(--bo-muted);
  font-size: 15px;
  line-height: 1.4;
}

.bo-logo svg {
  width: 110px;
  height: 110px;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.45));
  animation: bo-bob 2.4s ease-in-out infinite;
}

@keyframes bo-bob {
  50% {
    transform: translateY(-6px) rotate(-4deg);
  }
}

.bo-kicker {
  margin: 0 !important;
  font-size: 12px !important;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bo-accent-2) !important;
}

.bo-win-stars {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 4px 0 8px;
  font-size: 46px;
  line-height: 1;
}

.bo-win-stars span {
  color: #3a3b55;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}

.bo-win-stars span.is-on {
  color: var(--bo-gold);
  animation: bo-star 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

.bo-win-stars span.is-on:nth-child(2) {
  animation-delay: 0.15s;
  font-size: 56px;
}

.bo-win-stars span.is-on:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes bo-star {
  from {
    transform: scale(0) rotate(-60deg);
  }
}

.bo-reward {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(104, 66, 255, 0.22);
  color: #d8ccff !important;
  font-weight: 900;
}

.bo-reward:empty {
  display: none;
}

.bo-card-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.bo-card-actions-col {
  flex-direction: column;
  align-items: stretch;
}

/* Buttons ---------------------------------------------------------------- */
.bo-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  font: 900 15px var(--bo-font);
  color: var(--bo-text);
  cursor: pointer;
  transition:
    transform 0.12s ease,
    filter 0.12s ease;
  user-select: none;
}

.bo-btn:active {
  transform: translateY(2px) scale(0.98);
}

.bo-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.bo-btn-primary {
  background: linear-gradient(180deg, #8467ff, var(--bo-accent));
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.25),
    0 4px 0 #3f22b8,
    0 8px 18px rgba(104, 66, 255, 0.4);
}

.bo-btn-secondary,
.bo-btn-booster {
  background: linear-gradient(180deg, #34354b, var(--bo-secondary));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 4px 0 rgba(0, 0, 0, 0.4);
}

.bo-btn-ghost {
  margin-top: 8px;
  background: transparent;
  color: var(--bo-muted);
}

.bo-btn-big {
  min-width: 180px;
  min-height: 54px;
  font-size: 20px;
}

.bo-btn:focus-visible,
.bo-icon-btn:focus-visible {
  outline: 3px solid #b9a8ff;
  outline-offset: 3px;
}

.bo-ico {
  width: 20px;
  height: 20px;
  flex: none;
}

.bo-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.bo-btn-booster {
  padding-right: 20px;
}

.bo-btn-booster[aria-pressed="true"] {
  background: linear-gradient(180deg, #ffb13d, #f07b12);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.3),
    0 4px 0 #a64d05,
    0 0 0 3px rgba(255, 177, 61, 0.35);
  animation: bo-glow 0.9s ease-in-out infinite alternate;
}

@keyframes bo-glow {
  to {
    filter: brightness(1.15);
  }
}

.bo-badge {
  position: absolute;
  top: -7px;
  right: -5px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  background: linear-gradient(180deg, #ff6b8a, #ff3d6a);
  border: 2px solid var(--bo-bg);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

.bo-badge.is-empty {
  background: #4a4b63;
}

.bo-btn.is-bump {
  animation: bo-bump 0.4s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes bo-bump {
  40% {
    transform: scale(1.12);
  }
}

.bo-help {
  margin: 0;
  font-size: 12px;
  color: var(--bo-muted);
  text-align: center;
}

.bo-help kbd {
  display: inline-block;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--bo-secondary);
  color: #fff;
  font: 800 11px var(--bo-font);
}

/* Levels ------------------------------------------------------------------ */
.bo-card-levels {
  width: min(460px, 100%);
}

.bo-levels-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.bo-levels-head h2 {
  margin: 0;
  font-size: 24px;
}

.bo-level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 8px;
}

.bo-level {
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font: 900 16px var(--bo-font);
  color: #fff;
  background: linear-gradient(180deg, #3b3c56, #2a2b3d);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 3px 0 rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.bo-level small {
  font-size: 10px;
  color: var(--bo-gold);
  letter-spacing: -0.05em;
}

.bo-level.is-current {
  background: linear-gradient(180deg, #8467ff, var(--bo-accent));
}

.bo-level:disabled {
  cursor: not-allowed;
  color: #6d6e88;
  background: #1f2030;
  box-shadow: none;
}

.bo-level:focus-visible {
  outline: 3px solid #b9a8ff;
  outline-offset: 2px;
}

@media (max-width: 420px) {
  .bo-actions {
    gap: 7px;
  }
  .bo-chip {
    padding: 6px 10px;
    gap: 4px;
  }
  .bo-chip span {
    font-size: 10px;
  }
  .bo-chip strong {
    font-size: 15px;
  }
  .bo-btn-booster {
    padding: 8px 14px 8px 11px;
    font-size: 14px;
  }
  .bo-help {
    display: none;
  }
  #bo-restart {
    width: 44px;
    padding: 0;
  }
  #bo-restart .bo-lbl {
    display: none;
  }
}

@media (max-width: 360px) {
  .bo-lbl {
    display: none;
  }
  .bo-btn-booster {
    min-width: 56px;
  }
  .bo-hud,
  .bo-hud-right {
    gap: 4px;
  }
  .bo-chip {
    padding: 5px 8px;
  }
  .bo-chip span {
    font-size: 9px;
    letter-spacing: 0.04em;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
