body.portal { line-height: 1.6; }
.bs-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.bs-shell { max-width: 860px; margin: 0 auto; padding: 24px 16px 56px; }
.bs-visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bs-intro h1 { margin-bottom: 12px; }
.bs-h1-sub { display: block; margin-top: 4px; color: var(--muted); font-size: .55em; font-weight: 700; letter-spacing: 0; }
.bs-intro .lead { margin-bottom: 16px; font-size: 17px; }
.bs-ctas { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0; }

.bs-tool { margin: 22px 0 36px; padding: 16px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.bs-label { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; color: var(--text); font-size: 14px; font-weight: 750; }
.bs-label:first-of-type { margin-top: 0; }
.bs-num { display: inline-grid; place-items: center; flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; }
.bs-chips, .bs-edit, .bs-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.bs-chip { min-width: 44px; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); color: var(--text); font-size: 14px; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.bs-chip:hover:not(:disabled) { border-color: var(--accent); }
.bs-chip:disabled { opacity: .45; cursor: default; }
.bs-chip[aria-pressed="true"], .bs-chip-strong { background: var(--accent); border-color: var(--accent); color: #fff; }
.bs-chip-quiet { background: transparent; color: var(--muted); }
.bs-count { padding: 8px 0; font-variant-numeric: tabular-nums; }
.bs-sublabel { margin: 12px 0 8px; color: var(--text); font-size: 13px; font-weight: 700; }
.bs-sublabel span { color: var(--muted); font-weight: 600; }

/* Tubes: one fixed round slot per ball (3 to 6, from --cap), so the shelf only changes height with the tube size. */
.bs-shelf { --cap: 4; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 6px; margin: 0 0 14px; padding: 12px 4px 8px; border-radius: 12px; background: #2f2a3d; }
.bs-tube { display: flex; flex: none; flex-direction: column; align-items: center; gap: 4px; width: 40px; padding: 0; border: 0; background: none; color: #f4efe2; cursor: pointer; touch-action: manipulation; transition: transform .25s ease; }
.bs-glass { display: flex; flex-direction: column-reverse; align-items: center; gap: 2px; width: 100%; height: calc(var(--cap) * 32px + 8px); padding: 3px 3px 4px; box-sizing: border-box; border: 2px solid rgba(244, 239, 226, .55); border-top-color: rgba(244, 239, 226, .2); border-radius: 6px 6px 18px 18px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.bs-tube[aria-pressed="true"] .bs-glass { border-color: #ffd36b; box-shadow: 0 0 0 3px rgba(255, 211, 107, .45); }
.bs-tube[aria-pressed="true"] .bs-tube-num { background: #ffd36b; color: #2f2a3d; }
.bs-tube-num { min-width: 22px; padding: 0 4px; border-radius: 6px; font-size: 12px; font-weight: 800; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.bs-ball { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .45), transparent 45%), var(--c); }
.bs-slot { background: transparent; }
.bs-glyph { width: 16px; height: 16px; fill: var(--ink); }
.bs-in { animation: bs-drop .4s ease-out both; }
.bs-lift { animation: bs-lift .5s ease-out; }
.bs-from .bs-glass { border-color: #ff9f7a; }
.bs-to .bs-glass { border-color: #7fe0c4; box-shadow: 0 0 0 3px rgba(127, 224, 196, .35); }
@keyframes bs-drop { from { transform: translateY(-24px); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes bs-lift { 0%, 100% { transform: none; } 40% { transform: translateY(-10px); } }

.bs-palette { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.bs-swatch { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 76px; padding: 6px 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); cursor: pointer; touch-action: manipulation; }
.bs-swatch:hover:not(:disabled) { border-color: var(--accent); }
.bs-swatch:disabled { opacity: .4; cursor: default; }
.bs-dot { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.bs-dot .bs-glyph { width: 18px; height: 18px; }
.bs-swatch-name { max-width: 100%; font-size: 11px; font-weight: 700; line-height: 1.1; text-align: center; }
.bs-swatch-count { color: var(--muted); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bs-swatch[data-done="true"] .bs-swatch-count { color: var(--accent); }
.bs-status { min-height: 3.2em; margin: 12px 0 0; color: var(--text); font-size: 14px; }
.bs-solve { width: 100%; font-size: 16px; }

.bs-result { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); scroll-margin-top: 12px; }
.bs-result:focus { outline: none; }
.bs-result-title { margin: 0 0 12px; font-size: 22px; }
.bs-replay .bs-shelf { margin-bottom: 10px; }
.bs-caption { min-height: 3.2em; margin: 0 0 10px; color: var(--text); font-size: 15px; font-weight: 650; }
.bs-controls { margin-bottom: 12px; }
.bs-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.bs-copy-status { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 13px; }
.bs-copy-status:empty { display: none; }
.bs-problems { margin: 0 0 10px; padding-left: 20px; color: var(--text); font-weight: 650; }
.bs-problems li { margin-bottom: 4px; }
.bs-controls .bs-chip { padding: 8px 12px; }
.bs-moves { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.bs-move { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font-size: 14px; font-weight: 700; text-align: left; cursor: pointer; font-variant-numeric: tabular-nums; }
.bs-move[data-done="true"] { color: var(--muted); }
.bs-move[aria-current="step"] { border-color: var(--accent); background: #e2f0e9; }
.bs-move-n { min-width: 22px; color: var(--muted); font-size: 12px; }
.bs-move-text { flex: 1; white-space: nowrap; }
.bs-move-what { display: inline-flex; white-space: nowrap; align-items: center; gap: 2px; font-size: 12px; }
.bs-mini { display: inline-grid; flex: none; width: 18px; height: 18px; border-radius: 50%; }
.bs-mini .bs-glyph { width: 12px; height: 12px; }
.bs-note { margin: 8px 0 0; font-size: 13px; }

.bs-article h2 { margin: 30px 0 12px; font-size: 24px; }
.bs-article li { margin-bottom: 8px; color: var(--muted); }
.bs-article li strong { color: var(--text); }
.bs-faq details { padding: 12px 0; border-bottom: 1px solid var(--line); }
.bs-faq summary { color: var(--text); font-weight: 750; cursor: pointer; }
.bs-faq details p { margin: 8px 0 0; }
.bs-cta { margin-top: 32px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.bs-cta h2 { margin-top: 0; }
.bs-cta .text-link { color: var(--accent-strong); }
.bs-footer { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  .bs-in, .bs-lift { animation: none; }
  .bs-tube { transition: none; }
}
@media (min-width: 640px) {
  .bs-shell { padding: 36px 24px 64px; }
  .bs-tool { padding: 22px; }
  .bs-shelf { gap: 14px 12px; }
  .bs-tube { width: 48px; }
  .bs-palette { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}
