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

.sp-label { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; color: var(--text); font-size: 14px; font-weight: 750; }
.sp-label:first-of-type { margin-top: 0; }
.sp-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; }
.sp-chips, .sp-edit, .sp-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-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; }
.sp-chip:hover:not(:disabled) { border-color: var(--accent); }
.sp-chip:disabled { opacity: .45; cursor: default; }
.sp-chip[aria-pressed="true"], .sp-chip-strong { background: var(--accent); border-color: var(--accent); color: #fff; }
.sp-chip-quiet { background: transparent; color: var(--muted); }

/* Board and number pad: side by side when there is room, stacked on phones. */
.sp-board { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 12px 20px; }
.sp-grid { --n: 4; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 6px; width: min(100%, calc(var(--n) * 72px)); padding: 8px; box-sizing: border-box; border-radius: 14px; background: #3b3328; }
.sp-cell { display: grid; place-items: center; aspect-ratio: 1; min-width: 0; padding: 0; border: 2px solid #c79a55; border-radius: 10px; background: linear-gradient(160deg, #fff4d8, #f1d39b); color: #3b2a14; font-size: clamp(18px, 6vw, 28px); font-weight: 800; font-variant-numeric: tabular-nums; cursor: pointer; touch-action: manipulation; transition: transform .15s ease; }
.sp-cell.sp-blank { border-style: dashed; border-color: rgba(255, 244, 216, .25); background: transparent; }
.sp-cell.sp-empty { border-style: dashed; border-color: rgba(255, 244, 216, .45); background: rgba(255, 244, 216, .08); }
.sp-cell.sp-selected { outline: 3px solid #4fd1b5; outline-offset: 1px; }
.sp-grid-replay .sp-cell { cursor: default; }
.sp-cell.sp-next { border-color: #4fd1b5; box-shadow: 0 0 0 3px #4fd1b5 inset; }
.sp-cell.sp-last { background: linear-gradient(160deg, #ffe0cf, #ffb08c); }
.sp-pad { --n: 4; display: grid; grid-template-columns: repeat(var(--n), minmax(44px, 1fr)); gap: 6px; width: min(100%, calc(var(--n) * 58px)); }
.sp-key { min-height: 44px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); color: var(--text); font-size: 16px; font-weight: 800; cursor: pointer; touch-action: manipulation; font-variant-numeric: tabular-nums; }
.sp-key:hover { border-color: var(--accent); }
.sp-key.sp-used { color: var(--muted); background: transparent; }
.sp-key-wide { grid-column: span 2; font-size: 14px; }
.sp-key-quiet { color: var(--muted); }

.sp-typed { margin: 16px 0 10px; }
.sp-typed label { display: block; margin-bottom: 6px; color: var(--text); font-size: 13px; font-weight: 700; }
.sp-typed-row { display: flex; gap: 8px; }
.sp-typed input { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font-size: 16px; }

.sp-status { min-height: 3.2em; margin: 12px 0 0; color: var(--text); font-size: 14px; }
.sp-solve { width: 100%; font-size: 16px; }
.sp-progress { display: flex; align-items: center; gap: 12px; margin-top: 10px; color: var(--muted); font-size: 14px; }
.sp-progress[hidden] { display: none; }

.sp-result { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); scroll-margin-top: 12px; }
.sp-result:focus { outline: none; }
.sp-result-title { margin: 0 0 8px; font-size: 22px; }
.sp-note { margin: 0 0 12px; font-size: 14px; }
.sp-replay .sp-grid { margin: 0 auto 10px; }
.sp-caption { min-height: 3.2em; margin: 0 0 10px; color: var(--text); font-size: 15px; font-weight: 650; }
.sp-controls { margin-bottom: 12px; }
.sp-controls .sp-chip { padding: 8px 12px; }
.sp-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.sp-share[hidden] { display: none; }
.sp-copy-status { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 13px; }
.sp-copy-status:empty { display: none; }
.sp-steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.sp-step { min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font-size: 14px; font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums; }
.sp-step[data-done="true"] { color: var(--muted); }
.sp-step[aria-current="step"] { border-color: var(--accent); background: #e2f0e9; }
.sp-step-n { margin-right: 4px; color: var(--muted); font-size: 12px; }

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

@media (min-width: 640px) {
  .sp-shell { padding: 36px 24px 64px; }
  .sp-tool { padding: 22px; }
  .sp-cell { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) { .sp-cell { transition: none; } }
