:root {
  --hot-pink: #ff2d78; --electric-blue: #00c2ff; --sunny: #ffd23f;
  --lime: #7bed4f; --grape: #9b5de5; --tangerine: #ff6b35;
  --cream: #fff8f0; --ink: #1a1a2e; --ink-light: #3d3d5c;
  --muted: #62627b; --card-bg: #fff;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 1rem/1.5 'Outfit', 'Inter', system-ui, sans-serif; }
button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
h1, h2, p { margin: 0; }
.fun-font { font-family: 'Titan One', 'Outfit', sans-serif; font-weight: 400; }
.color-bar { display: flex; height: 6px; }
.color-bar span { flex: 1; background: var(--hot-pink); }
.color-bar span:nth-child(2) { background: var(--grape); }
.color-bar span:nth-child(3) { background: var(--lime); }
.color-bar span:nth-child(4) { background: var(--sunny); }
.color-bar span:nth-child(5) { background: var(--electric-blue); }
.ms-skip { position: fixed; top: 1rem; left: 1rem; z-index: 2000; padding: .75rem; background: var(--card-bg); transform: translateY(-200%); }
.ms-skip:focus { transform: none; }
.ms-main { width: min(100%, 600px); margin: auto; padding: 16px 16px 40px; }
.ms-main:focus { outline: none; }
.ms-breadcrumb { font-size: .85rem; margin-bottom: 18px; }
.ms-heading { text-align: center; margin-bottom: 22px; }
.ms-eyebrow { font-size: .72rem; letter-spacing: .12em; font-weight: 800; margin-bottom: 8px; }
h1 { overflow-wrap: anywhere; font-size: clamp(2.1rem, 9vw, 3.3rem); line-height: 1.12; margin-bottom: 12px; text-decoration: underline; text-decoration-color: var(--sunny); text-decoration-thickness: 7px; text-underline-offset: 4px; }
.ms-heading > p:last-child { font-size: 1.05rem; }
.game-container { border: 2px solid var(--ink); border-radius: 20px; padding: 20px; background: var(--card-bg); box-shadow: 5px 5px 0 var(--grape); }
.game-container h2 { font-size: 1.25rem; line-height: 1.3; }
#ms-setup > p { margin-top: 12px; }
.ms-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; font-size: .8rem; font-weight: 800; margin-bottom: 12px; }
.ms-stats > span { min-width: 0; min-height: calc(3em + 10px); display: flex; align-content: center; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px; border: 2px solid var(--ink); border-radius: 8px; background: #e4f9da; padding: 4px 8px; }
.ms-stats > span:last-child { background: #fff1c6; }
.ms-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 3px solid var(--ink); border-radius: 10px; overflow: hidden; }
.ms-cell { position: relative; min-width: 0; min-height: max(44px, calc(1.3em + 16px)); border: 1px solid var(--ink); border-radius: 0; padding: 7px 3px; background: #fff; color: #1a1a2e; font-size: 1.5rem; line-height: 1.3; font-weight: 700; }
.ms-cell:nth-child(4n+2) { border-right-width: 3px; }
.ms-cell:nth-child(n+5):nth-child(-n+8) { border-bottom-width: 3px; }
.ms-cell.is-given { background: #eee3fb; font-weight: 900; }
.ms-cell[aria-pressed="true"] { box-shadow: inset 0 0 0 3px #0a66c2; }
.ms-cell:focus-visible { outline-offset: -6px; }
.ms-cell.is-conflict { background: #ffd0df; }
.ms-cell.is-conflict::after { content: '!'; position: absolute; right: 2px; top: 0; font-size: .65rem; font-weight: 900; }
.ms-selection { min-height: 3em; margin: 8px 0; font-size: .8rem; line-height: 1.5; overflow-wrap: anywhere; }
.ms-keypad { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ms-keypad button { min-width: 0; min-height: 44px; padding: 6px; border: 2px solid var(--ink); border-radius: 8px; background: #e4f9da; font-size: 1.1rem; line-height: 1.3; font-weight: 800; }
.ms-erase { width: 100%; min-height: 52px; margin-top: 10px; padding: 10px; border: 2px solid var(--ink); border-radius: 8px; background: #ffd0df; font-weight: 800; overflow-wrap: anywhere; }
.ms-keypad button:disabled, .ms-erase:disabled { background: #ededf1; color: #51516a; cursor: default; }
.ms-conflicts { margin-top: 12px; font-size: .85rem; overflow-wrap: anywhere; }
.ms-result { margin-top: 16px; font-weight: 800; text-align: center; }
#ms-arena { width: min(100%, 320px); margin: auto; scroll-margin-top: 90px; scroll-margin-bottom: 16px; }
.ms-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.ms-primary, .ms-secondary { min-height: 52px; flex: 1; min-width: 110px; border: 2px solid var(--ink); border-radius: 10px; padding: 11px 14px; font-weight: 800; line-height: 1.3; }
.ms-primary { background: var(--lime); box-shadow: 3px 3px 0 var(--ink); }
.ms-secondary { background: var(--card-bg); }
.ms-status { font-size: .9rem; margin-top: 16px; }
.ms-status:empty { margin: 0; }

.ms-small { font-size: .85rem; color: var(--ink-light); }

.ms-keyboard { margin: 20px 4px 28px; }
.ms-about { border-top: 2px solid var(--ink); padding-top: 22px; }
.ms-about h2 { font-size: 1.3rem; }
.ms-about p { margin-top: 12px; }
#ms-share-fallback { margin-top: 18px; }
label { display: block; font-weight: 700; margin-bottom: 8px; }
textarea { width: 100%; border: 2px solid var(--ink); border-radius: 8px; background: var(--card-bg); padding: 10px; resize: vertical; }
[data-theme="pro"] .ms-primary { background: #0a66c2; color: #fff; box-shadow: none; }
@media (max-width: 359px) {
  .ms-main { padding-inline: 12px; }
  .ms-heading { margin-bottom: 14px; }
  .game-container { padding: 14px 12px; }
  .game-container h2 { font-size: 1.15rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

#ms-play { scroll-margin-top: 90px; }
#ms-paused { margin: 24px 0; text-align: center; }

.ms-primary { flex-basis: 100%; }
.ms-primary, .ms-secondary, .ms-best, .ms-status { overflow-wrap: anywhere; }
