.sb-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 24px;
  color: var(--cg-ink);
  font-family: Inter, Arial, sans-serif;
}

.sb-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sb-stats,
.sb-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sb-stats {
  flex-wrap: wrap;
}

.sb-stat {
  min-width: 72px;
  padding: 8px 10px;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: var(--cg-panel);
  box-shadow: 0 8px 20px rgba(33, 43, 40, 0.08);
}

.sb-stat span {
  display: block;
  color: var(--cg-muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.sb-stat strong {
  display: block;
  margin-top: 2px;
  font-size: 18px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.sb-btn,
.sb-close {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(33, 43, 40, 0.08);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.sb-btn {
  padding: 0 14px;
}

.sb-btn:hover,
.sb-close:hover {
  transform: translateY(-1px);
  border-color: var(--cg-teal);
}

.sb-btn:focus-visible,
.sb-close:focus-visible,
.sb-tile:focus-visible,
.sb-board:focus-visible,
.sb-segbtn:focus-visible {
  outline: 3px solid rgba(49, 95, 157, 0.35);
  outline-offset: 3px;
}

.sb-icon,
.sb-tone {
  display: inline-grid;
  place-items: center;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.sb-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sb-primary {
  border-color: transparent;
  background: var(--cg-green);
  color: #fff;
}

.sb-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid #bfd0cc;
  border-radius: 8px;
  background: linear-gradient(140deg, #e9f5f1, #f8fbfa 45%, #f5f0df);
  box-shadow: var(--cg-shadow);
}

.sb-stage.sb-shake {
  animation: sb-shake 300ms ease;
}

@keyframes sb-shake {
  16% { transform: translateX(-8px); }
  34% { transform: translateX(7px); }
  54% { transform: translateX(-5px); }
  74% { transform: translateX(3px); }
}

.sb-fx {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.sb-board {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: min(72vh, 610px);
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 20% 0%, rgba(18, 122, 137, 0.18), transparent 36%),
    radial-gradient(circle at 84% 16%, rgba(196, 122, 23, 0.16), transparent 35%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(247, 249, 245, 0.92));
  touch-action: manipulation;
}

.sb-board-top,
.sb-board-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sb-board-top strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  line-height: 1;
}

.sb-board-foot {
  margin-top: auto;
  color: var(--cg-muted);
  font-size: 13px;
  font-weight: 900;
}

.sb-chip {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 99px;
  background: var(--cg-blue);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.sb-def {
  min-height: 72px;
  padding: 18px;
  border: 1px solid rgba(18, 122, 137, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--cg-ink);
  font-size: clamp(20px, 4vw, 30px);
  font-weight: 900;
  line-height: 1.14;
}

.sb-cue {
  min-height: 28px;
  color: var(--cg-teal);
  font-size: 15px;
  font-weight: 900;
  text-transform: uppercase;
}

.sb-meter {
  display: flex;
  align-items: end;
  justify-content: center;
  min-height: 42px;
  gap: 8px;
}

.sb-beat {
  width: clamp(22px, 8vw, 46px);
  height: 18px;
  border-radius: 99px;
  background: var(--cg-teal);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}

.sb-hi {
  height: 34px;
  background: var(--cg-amber);
}

.sb-quiet {
  opacity: 0.35;
  background: var(--cg-muted);
}

.sb-slots,
.sb-bank {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.sb-slots {
  min-height: 72px;
  gap: 8px;
}

.sb-bank {
  min-height: 130px;
  align-content: center;
  gap: 9px;
}

.sb-slot,
.sb-tile {
  display: grid;
  place-items: center;
  width: clamp(39px, 10vw, 58px);
  height: clamp(48px, 12vw, 68px);
  border-radius: 8px;
  font-size: clamp(24px, 6vw, 38px);
  font-weight: 950;
  line-height: 1;
}

.sb-slot {
  border: 2px dashed rgba(49, 95, 157, 0.28);
  background: rgba(255, 255, 255, 0.58);
  color: var(--cg-ink);
}

.sb-filled {
  border-style: solid;
  border-color: #d6c49a;
  background: linear-gradient(165deg, #fff9e7, #eadbb8);
  box-shadow: 0 5px 0 rgba(97, 77, 41, 0.22), inset 0 -3px 6px rgba(150, 130, 90, 0.18);
  animation: sb-lock 160ms ease;
}

@keyframes sb-lock {
  45% { transform: translateY(-4px) scale(1.04); }
}

.sb-tile {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #c9b98f;
  background: linear-gradient(165deg, #fffdf4, #eadab6);
  color: #1d262c;
  box-shadow: 0 5px 0 rgba(97, 77, 41, 0.28), inset 0 -3px 6px rgba(150, 130, 90, 0.2);
  cursor: pointer;
  transition: transform 110ms ease, opacity 110ms ease;
}

.sb-tile:hover {
  transform: translateY(-2px);
}

.sb-tile:disabled {
  cursor: default;
}

.sb-used {
  opacity: 0.18;
  transform: scale(0.92);
}

.sb-good {
  animation: sb-good 220ms ease;
}

.sb-bad {
  animation: sb-bad 300ms ease;
}

@keyframes sb-good {
  48% { transform: translateY(-8px) scale(1.07); }
}

@keyframes sb-bad {
  18% { transform: translateX(-8px) rotate(-4deg); }
  40% { transform: translateX(7px) rotate(4deg); }
  68% { transform: translateX(-4px) rotate(-2deg); }
}

.sb-cascade .sb-filled {
  animation: sb-cascade 620ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sb-cascade {
  30% { transform: translateY(-16px) rotate(-3deg); }
  100% { transform: translateY(42px) rotate(8deg); opacity: 0; }
}

.sb-start,
.sb-result {
  position: absolute;
  left: 50%;
  z-index: 6;
  display: grid;
  width: min(88%, 330px);
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  text-align: center;
  box-shadow: var(--cg-shadow);
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
}

.sb-start {
  bottom: 20px;
}

.sb-result {
  top: 50%;
  transform: translate(-50%, -50%);
  animation: sb-pop 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sb-pop {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.95); }
}

.sb-start strong,
.sb-result strong {
  font-size: 23px;
  line-height: 1.1;
}

.sb-start span,
.sb-result span,
.sb-result p {
  margin: 0;
  color: var(--cg-muted);
  font-size: 14px;
  line-height: 1.35;
}

.sb-result-actions,
.sb-below {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sb-result-actions .sb-btn {
  flex: 1 1 0;
}

.sb-below {
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.sb-seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--cg-line);
  border-radius: 10px;
  background: var(--cg-panel);
  box-shadow: 0 8px 20px rgba(33, 43, 40, 0.08);
}

.sb-segbtn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--cg-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.sb-segbtn[aria-pressed="true"] {
  background: var(--cg-teal);
  color: #fff;
}

.sb-status {
  min-height: 22px;
  margin: 10px 2px 0;
  color: var(--cg-muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
}

.sb-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(30, 37, 40, 0.38);
}

.sb-modal-card {
  position: relative;
  width: min(100%, 440px);
  padding: 22px;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  box-shadow: 0 24px 70px rgba(30, 37, 40, 0.22);
}

.sb-modal-card h2 {
  margin: 0 48px 12px 0;
  font-size: 24px;
  line-height: 1.1;
}

.sb-modal-card p {
  margin: 10px 0 0;
  color: var(--cg-muted);
  line-height: 1.45;
}

.sb-close {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.sb-off,
.sb-hidden {
  display: none !important;
}

@media (max-width: 560px) {
  .sb-shell {
    padding: 0 10px 20px;
  }

  .sb-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .sb-stats,
  .sb-actions {
    justify-content: center;
  }

  .sb-stat {
    flex: 1 1 70px;
    text-align: center;
  }

  .sb-actions .sb-btn {
    flex: 0 1 auto;
  }

  .sb-board {
    min-height: 560px;
    padding: 14px 10px;
    gap: 11px;
  }

  .sb-def {
    min-height: 86px;
    padding: 14px;
  }

  .sb-bank {
    min-height: 142px;
    gap: 7px;
  }

  .sb-board-foot {
    font-size: 12px;
  }

  .sb-below {
    align-items: stretch;
    flex-direction: column;
  }

  .sb-seg,
  .sb-clear {
    width: 100%;
  }

  .sb-segbtn,
  .sb-below .sb-btn {
    flex: 1 1 0;
  }
}
