.bs-page {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #0B0E17;
  z-index: 100;
}

.bs-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: rgba(11,14,23,.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10;
  flex-shrink: 0;
}
.bs-hdr-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: rgba(255,255,255,.08);
  border-radius: 10px; color: #fff; cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}
.bs-hdr-btn:active { background: rgba(255,255,255,.16); }
.bs-hdr-btn svg { width: 18px; height: 18px; }
.bs-hdr-title {
  flex: 1; min-width: 0;
  text-align: center;
  font-size: 11px; font-weight: 800; letter-spacing: 2px;
  color: rgba(255,255,255,.7);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bs-hdr-stats {
  display: flex; gap: 10px;
  flex-shrink: 0;
}
.bs-hdr-stat {
  display: flex; flex-direction: column; align-items: flex-end;
}
.bs-hdr-score-label {
  font-size: 8px; font-weight: 700; letter-spacing: 1.5px;
  color: rgba(255,255,255,.35);
}
.bs-hdr-height {
  font-size: 17px; font-weight: 800; color: #fff;
  line-height: 1.1;
}
.bs-hdr-score {
  font-size: 17px; font-weight: 800; color: #F1C40F;
  line-height: 1.1;
  text-shadow: 0 0 12px rgba(241,196,15,.4);
}
.bs-hdr-score.bs-pop { animation: bs-score-pop .3s ease-out; }
@keyframes bs-score-pop {
  0% { transform: scale(1.4); }
  100% { transform: scale(1); }
}
.bs-mute-btn svg { width: 16px; height: 16px; }

.bs-canvas {
  flex: 1;
  display: block;
  width: 100%;
  min-height: 0;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.bs-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(11,14,23,.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 20;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.bs-overlay.bs-visible {
  opacity: 1; pointer-events: auto;
}

.bs-idle {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 30px 24px;
  max-width: 320px; width: 90%;
}
.bs-idle-icon {
  font-size: 52px; line-height: 1;
  filter: drop-shadow(0 4px 20px rgba(241,196,15,.3));
  animation: bs-float 2.5s ease-in-out infinite;
}
@keyframes bs-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.bs-idle-title {
  font-size: 26px; font-weight: 800; letter-spacing: 5px;
  background: linear-gradient(135deg, #F1C40F, #E67E22, #E74C3C);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.bs-idle-sub {
  font-size: 13px; font-weight: 600; letter-spacing: 1px;
  color: rgba(255,255,255,.5);
}
.bs-idle-best {
  font-size: 12px; font-weight: 700; letter-spacing: 1.5px;
  color: #F1C40F;
  text-shadow: 0 0 10px rgba(241,196,15,.3);
}
.bs-idle-perk {
  font-size: 12px; font-weight: 700; letter-spacing: 1px;
  color: rgba(46,204,113,.9);
}
.bs-idle-cost {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; letter-spacing: 1px;
  color: rgba(255,255,255,.6);
}
.bs-coin-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FFE066, #D4A017);
  box-shadow: 0 0 8px rgba(241,196,15,.5);
  display: inline-block;
  flex-shrink: 0;
}
.bs-coin-dot-lg { width: 22px; height: 22px; }
.bs-play-btn {
  margin-top: 8px;
  font-size: 15px; font-weight: 800; letter-spacing: 3px;
}
.bs-play-btn svg { width: 18px; height: 18px; }
.bs-exit-btn {
  font-size: 12px; font-weight: 700; letter-spacing: 2px;
}
.bs-idle-err {
  font-size: 13px; font-weight: 700; color: #E74C3C;
  margin-top: 8px;
}

.bs-countdown {
  font-size: 80px; font-weight: 800; color: #fff;
  text-shadow: 0 0 40px rgba(241,196,15,.5);
  animation: bs-pop .6s ease-out;
}
@keyframes bs-pop {
  0% { transform: scale(2); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.bs-result {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  padding: 20px;
}
.bs-res-card {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, rgba(40,44,60,.95), rgba(20,22,30,.98));
  border: 1px solid rgba(241,196,15,.25);
  border-radius: 24px;
  padding: 28px 24px;
  max-width: 320px; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,.6), 0 0 30px rgba(241,196,15,.08);
  animation: bs-card-in .35s ease-out;
}
.bs-res-card-best {
  border-color: rgba(241,196,15,.55);
  box-shadow: 0 20px 50px rgba(0,0,0,.6), 0 0 44px rgba(241,196,15,.22);
}
@keyframes bs-card-in {
  0% { transform: translateY(30px) scale(.95); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
.bs-res-title {
  font-size: 18px; font-weight: 800; letter-spacing: 3px;
  color: #F1C40F;
  text-shadow: 0 0 15px rgba(241,196,15,.4);
}
.bs-res-row {
  display: flex; gap: 30px;
}
.bs-res-stat {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.bs-res-label {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  color: rgba(255,255,255,.4);
}
.bs-res-val {
  font-size: 32px; font-weight: 800; color: #fff;
  line-height: 1;
}
.bs-res-coins {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  background: rgba(241,196,15,.1);
  border-radius: 30px;
  border: 1px solid rgba(241,196,15,.2);
}
.bs-res-coins-val {
  font-size: 22px; font-weight: 800; color: #F1C40F;
}
.bs-res-best {
  font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  color: rgba(255,255,255,.45);
}
.bs-res-err {
  font-size: 12px; font-weight: 600; color: #E74C3C;
  text-align: center; line-height: 1.4;
}
.bs-res-buttons {
  display: flex; flex-direction: column; gap: 8px;
  width: 100%; margin-top: 4px;
}
.bs-res-buttons .btn { font-size: 14px; font-weight: 700; letter-spacing: 2px; }
.bs-res-buttons .btn svg { width: 16px; height: 16px; }
.bs-confetti {
  position: absolute; top: -12px;
  width: 7px; height: 12px; border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  animation: bs-confetti-fall linear forwards;
}
@keyframes bs-confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(380px) rotate(340deg); opacity: 0; }
}

.bs-entry {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 13px;
  width: 100%; text-align: left;
  margin-top: 12px; padding: 15px;
  border-radius: 22px; color: var(--stage-text);
  border: none; cursor: pointer;
  background:
    linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,0) 46%),
    linear-gradient(160deg, #1A2744 0%, #0F1A30 55%, #162040 100%);
  box-shadow:
    inset 0 0 0 1px rgba(241,196,15,.3),
    0 14px 30px rgba(0,0,0,.42),
    0 0 26px rgba(52,152,219,.12);
  transition: transform .14s ease, box-shadow .2s ease;
  overflow: hidden;
  animation: bs-entry-glow 3.2s ease-in-out infinite;
}
.bs-entry::before {
  content: ""; position: absolute; left: 10%; right: 10%; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(241,196,15,.5), rgba(52,152,219,.5), transparent);
}
.bs-entry::after {
  content: ""; position: absolute; top: -60%; bottom: -60%;
  width: 46px; left: 0;
  background: linear-gradient(100deg,
    transparent,
    rgba(255,255,255,.09) 40%,
    rgba(241,196,15,.14) 50%,
    rgba(255,255,255,.09) 60%,
    transparent);
  transform: translateX(-140%) skewX(-18deg);
  pointer-events: none;
  animation: bs-entry-shine 4.2s ease-in-out infinite;
}
.bs-entry:active {
  transform: scale(.977);
  box-shadow:
    inset 0 0 0 1px rgba(241,196,15,.5),
    0 8px 20px rgba(0,0,0,.5),
    0 0 34px rgba(52,152,219,.2);
}
@keyframes bs-entry-shine {
  0%, 64% { transform: translateX(-140%) skewX(-18deg); }
  86%, 100% { transform: translateX(340%) skewX(-18deg); }
}
@keyframes bs-entry-glow {
  0%, 100% {
    box-shadow:
      inset 0 0 0 1px rgba(241,196,15,.3),
      0 14px 30px rgba(0,0,0,.42),
      0 0 26px rgba(52,152,219,.12);
  }
  50% {
    box-shadow:
      inset 0 0 0 1px rgba(241,196,15,.45),
      0 14px 30px rgba(0,0,0,.42),
      0 0 34px rgba(241,196,15,.14);
  }
}
.bs-entry-art {
  position: relative; flex-shrink: 0;
  width: 86px; height: 86px;
}
.bs-entry-fx {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 2;
}
.bs-entry-spark {
  position: absolute; top: 18%;
  width: 5px; height: 5px; border-radius: 50%;
  background: #FFE066;
  box-shadow: 0 0 8px 2px rgba(241,196,15,.55);
  opacity: 0;
  animation: bs-spark-twinkle 2.6s ease-in-out infinite;
}
@keyframes bs-spark-twinkle {
  0%, 100% { opacity: 0; transform: scale(.4); }
  12% { opacity: 1; transform: scale(1.25); }
  24% { opacity: 0; transform: scale(.4); }
}
.bs-brick-stack {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; gap: 3px;
  padding-bottom: 10px;
}
.bs-mini-brick {
  height: 12px; border-radius: 3px;
  box-shadow: 0 2px 4px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.2);
  animation: bs-brick-bounce 2.4s ease-in-out infinite;
}
.bs-mini-brick.b1 { width: 52px; background: #E74C3C; animation-delay: 0s; }
.bs-mini-brick.b2 { width: 48px; background: #3498DB; animation-delay: .15s; }
.bs-mini-brick.b3 { width: 44px; background: #2ECC71; animation-delay: .3s; }
.bs-mini-brick.b4 { width: 40px; background: #F1C40F; animation-delay: .45s; }
@keyframes bs-brick-bounce {
  0%, 100% { transform: translateY(0); }
  18% { transform: translateY(-4px); }
  36% { transform: translateY(0); }
}
.bs-falling-brick {
  position: absolute; top: 12px; left: 50%;
  transform: translateX(-50%);
  width: 36px; height: 10px; border-radius: 2px;
  background: #9B59B6;
  box-shadow: 0 2px 6px rgba(155,89,182,.5), inset 0 1px 0 rgba(255,255,255,.25);
  animation: bs-drop-anim 1.8s ease-in-out infinite;
}
@keyframes bs-drop-anim {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  40% { transform: translateX(-50%) translateY(14px); }
  50% { transform: translateX(-50%) translateY(14px) scale(1.05); }
  60% { transform: translateX(-50%) translateY(0); }
}
.bs-holder-line {
  position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 2px; height: 14px;
  background: rgba(255,255,255,.25);
  border-radius: 1px;
}
.bs-entry-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
}
.bs-entry-kicker {
  font-size: 9px; font-weight: 800; letter-spacing: 2.6px;
  color: #3498DB;
  text-shadow: 0 0 10px rgba(52,152,219,.5);
}
.bs-entry-title {
  font-size: 23px; line-height: 1.05; font-weight: 800; letter-spacing: 3px;
  background: linear-gradient(92deg, #F1C40F 8%, #E67E22 52%, #E74C3C 94%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 10px rgba(241,196,15,.35));
}
.bs-entry-sub {
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  color: rgba(235,228,248,.55);
}
.bs-entry-meta {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  color: rgba(241,196,15,.85);
}
.bs-entry-meta .bs-coin-dot { width: 11px; height: 11px; }
.bs-entry-chev {
  flex-shrink: 0; align-self: center;
  font-size: 26px; font-weight: 700; color: var(--stage-gold);
}
