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

.ms-label { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; color: var(--text); font-size: 14px; font-weight: 750; }
.ms-label:first-of-type { margin-top: 0; }
.ms-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; }
.ms-chips, .ms-edit { display: flex; flex-wrap: wrap; gap: 8px; }
.ms-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; }
.ms-chip:hover:not(:disabled) { border-color: var(--accent); }
.ms-chip:disabled { opacity: .45; cursor: default; }
.ms-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.ms-chip-quiet { background: transparent; color: var(--muted); }
.ms-fields { display: flex; flex-wrap: wrap; gap: 10px 16px; margin: 12px 0 0; }
.ms-fields label { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; font-weight: 700; }
.ms-fields input { width: 76px; min-height: 40px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; font-weight: 700; }
.ms-hint { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

/* Palette: one brush per cell type. */
.ms-palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-bottom: 10px; }
.ms-brush { min-height: 44px; padding: 4px; border: 2px solid var(--line); border-radius: 10px; background: #e9e5da; color: var(--text); font-size: 17px; font-weight: 800; cursor: pointer; touch-action: manipulation; }
.ms-brush[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.ms-brush-wide { grid-column: span 2; font-size: 14px; }

/* Board: its own scroll box, so wide boards never widen the page. */
.ms-board-wrap { max-width: 100%; overflow: auto; margin: 0 0 10px; padding: 6px; box-sizing: border-box; border-radius: 12px; background: #7d7a72; overscroll-behavior: contain; }
.ms-grid { --cols: 9; --cell: 34px; display: grid; grid-template-columns: repeat(var(--cols), var(--cell)); grid-auto-rows: var(--cell); gap: 2px; width: max-content; margin: 0 auto; }
.ms-cell { position: relative; display: grid; place-items: center; width: var(--cell); height: var(--cell); padding: 0; border: 0; border-radius: 4px; background: #e9e6dd; color: #222; font: 800 calc(var(--cell) * .5)/1 system-ui, sans-serif; cursor: pointer; touch-action: manipulation; font-variant-numeric: tabular-nums; }
.ms-hidden { background: #b9c1cc; box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .6), inset -2px -2px 0 rgba(0, 0, 0, .18); }
.ms-flag { background: #b9c1cc; color: #c62828; box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .6), inset -2px -2px 0 rgba(0, 0, 0, .18); }
.ms-cell:focus-visible { outline: 3px solid #1f6feb; outline-offset: 1px; z-index: 1; }
.ms-n1 { color: #1d4ed8; } .ms-n2 { color: #15803d; } .ms-n3 { color: #c62828; } .ms-n4 { color: #312e81; }
.ms-n5 { color: #7f1d1d; } .ms-n6 { color: #0f766e; } .ms-n7 { color: #111; } .ms-n8 { color: #555; }
/* Result overlay on hidden cells. */
.ms-p { color: #1f2937; font-size: calc(var(--cell) * .36); font-weight: 750; background: color-mix(in srgb, #e05a47 calc(var(--p, 0) * 100%), #b9c1cc); }
.ms-safe { background: #34a56f; color: #fff; box-shadow: none; }
.ms-mine { background: #d64545; color: #fff; box-shadow: none; }
.ms-best { outline: 3px solid #f2b705; outline-offset: -3px; z-index: 1; }
.ms-best::after { content: ''; position: absolute; inset: -5px; border: 2px dashed #f2b705; border-radius: 7px; pointer-events: none; }
.ms-problem { outline: 3px solid #d64545; outline-offset: -3px; }

.ms-status { min-height: 3.2em; margin: 8px 0 0; color: var(--text); font-size: 14px; }
.ms-solve { width: 100%; font-size: 16px; }
.ms-examples { margin: 4px 0 8px; }

.ms-result { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); scroll-margin-top: 12px; }
.ms-result:focus { outline: none; }
.ms-result-title { margin: 0 0 8px; font-size: 22px; }
.ms-note { margin: 0 0 12px; font-size: 14px; }
.ms-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 12px; padding: 0; list-style: none; color: var(--muted); font-size: 13px; }
.ms-legend li { display: flex; align-items: center; gap: 6px; }
.ms-key { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 4px; color: #fff; font-size: 12px; font-weight: 800; }
.ms-key-safe { background: #34a56f; } .ms-key-mine { background: #d64545; }
.ms-key-p { background: #b9c1cc; color: #1f2937; } .ms-key-best { background: #b9c1cc; outline: 3px solid #f2b705; outline-offset: -3px; }
.ms-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.ms-copy-status { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 13px; }
.ms-copy-status:empty { display: none; }
.ms-findings { margin: 0; padding-left: 22px; font-size: 14px; }
.ms-findings li { margin-bottom: 6px; color: var(--text); }
.ms-find-safe::marker { color: #2b8a5a; }
.ms-find-mine::marker { color: #c62828; }

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

@media (min-width: 640px) {
  .ms-shell { padding: 36px 24px 64px; }
  .ms-tool { padding: 22px; }
}
