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

.ns-tool { margin: 22px 0 36px; padding: 16px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.ns-label { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; color: var(--text); font-size: 14px; font-weight: 750; }
.ns-label:first-of-type { margin-top: 0; }
.ns-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; }
.ns-chips, .ns-edit, .ns-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.ns-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; }
.ns-chip:hover:not(:disabled) { border-color: var(--accent); }
.ns-chip:disabled { opacity: .45; cursor: default; }
.ns-chip[aria-pressed="true"], .ns-chip-strong { background: var(--accent); border-color: var(--accent); color: #fff; }
.ns-chip-quiet { background: transparent; color: var(--muted); }
.ns-count { padding: 8px 0; font-variant-numeric: tabular-nums; }
.ns-sublabel { margin: 12px 0 8px; color: var(--text); font-size: 13px; font-weight: 700; }
.ns-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. */
.ns-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; }
.ns-bolt { display: flex; flex: none; flex-direction: column; align-items: center; gap: 4px; width: 42px; padding: 0; border: 0; background: none; color: #f4efe2; cursor: pointer; touch-action: manipulation; transition: transform .25s ease; }
.ns-rod { position: relative; display: flex; flex-direction: column-reverse; align-items: center; gap: 2px; width: 100%; height: calc(var(--cap) * 26px + 14px); padding: 0 0 8px; box-sizing: border-box; border-bottom: 6px solid #b9b2a0; border-radius: 4px; background: linear-gradient(to right, transparent calc(50% - 4px), #8d8676 calc(50% - 4px), #cfc8b6 50%, #8d8676 calc(50% + 4px), transparent calc(50% + 4px)) no-repeat center top / 100% calc(100% - 4px); }
.ns-rod::before { content: ''; position: absolute; top: -6px; left: calc(50% - 9px); width: 18px; height: 8px; border-radius: 4px 4px 2px 2px; background: #cfc8b6; }
.ns-bolt[aria-pressed="true"] .ns-rod { border-bottom-color: #ffd36b; box-shadow: 0 0 0 3px rgba(255, 211, 107, .45); }
.ns-bolt[aria-pressed="true"] .ns-bolt-num { background: #ffd36b; color: #2f2a3d; }
.ns-bolt-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; }
.ns-nut { position: relative; display: grid; place-items: center; flex: none; width: 38px; height: 24px; clip-path: polygon(14% 0, 86% 0, 100% 50%, 86% 100%, 14% 100%, 0 50%); background: linear-gradient(to bottom, rgba(255, 255, 255, .4), transparent 45%, rgba(0, 0, 0, .18)), var(--c); }
.ns-slot { background: transparent; clip-path: none; }
.ns-glyph { width: 14px; height: 14px; fill: var(--ink); }
.ns-in { animation: ns-drop .4s ease-out both; }
.ns-lift { animation: ns-lift .5s ease-out; }
.ns-from .ns-rod { border-bottom-color: #ff9f7a; }
.ns-to .ns-rod { border-bottom-color: #7fe0c4; box-shadow: 0 0 0 3px rgba(127, 224, 196, .35); }
@keyframes ns-drop { from { transform: translateY(-24px); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes ns-lift { 0%, 100% { transform: none; } 40% { transform: translateY(-10px); } }

.ns-palette { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.ns-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; }
.ns-swatch:hover:not(:disabled) { border-color: var(--accent); }
.ns-swatch:disabled { opacity: .4; cursor: default; }
.ns-dot { display: grid; place-items: center; width: 34px; height: 26px; clip-path: polygon(14% 0, 86% 0, 100% 50%, 86% 100%, 14% 100%, 0 50%); background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.ns-dot .ns-glyph { width: 15px; height: 15px; }
.ns-swatch-name { max-width: 100%; font-size: 11px; font-weight: 700; line-height: 1.1; text-align: center; }
.ns-swatch-count { color: var(--muted); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ns-swatch[data-done="true"] .ns-swatch-count { color: var(--accent); }
.ns-status { min-height: 3.2em; margin: 12px 0 0; color: var(--text); font-size: 14px; }
.ns-solve { width: 100%; font-size: 16px; }

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

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

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

.ns-result-cta { margin: 14px 0 0; }

.ns-mode .ns-chip { min-width: 0; }
