/* SHIFT classic next: the original game on the site's dark theme. The board, its grid and the navy SHIFT
   button keep their look; the page, the controls and the sheets take the website's dark design. */
@font-face { font-family: 'Atkinson Hyperlegible Next'; src: url('fonts/atkinson-hyperlegible-next-latin.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Literata'; src: url('fonts/literata-latin.woff2') format('woff2'); font-weight: 200 900; font-display: swap; }

:root {
  --nx-bg: #111214; --nx-bg-2: #1a1b1e; --nx-surface: #18191c; --nx-ink: #ecebe7; --nx-ink-2: #c9c8c3; --nx-muted: #94969c;
  --nx-rule: #2a2b2f; --nx-rule-strong: #3a3c41; --nx-accent: #8e86ef; --nx-accent-ink: #a9a2ff;
  --nx-sans: 'Atkinson Hyperlegible Next', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --nx-serif: 'Literata', Georgia, 'Times New Roman', serif;
  /* The game's own type: the bold sans of the board's READY? and score. For scores and the rank line. */
  --nx-game: 'Helvetica Neue', Helvetica, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color-scheme: dark;
}

/* ---------- The page, darkened ---------- */
html, body { background: var(--nx-bg) !important; color-scheme: dark; }
select, input, textarea { color-scheme: dark; }
#sa-app { color: var(--nx-ink) !important; }
#sa-app .logo-main { color: var(--nx-ink) !important; }
#sa-app .logo-tag, #sa-app .logo-by { color: var(--nx-muted) !important; }
#sa-app .typebar { color: var(--nx-ink-2) !important; }
#sa-topbar { background: transparent !important; }
#sa-topbar a { color: var(--nx-ink-2) !important; }
#sa-topbar a:hover { color: var(--nx-ink) !important; }
.sa-hambtn { background: var(--nx-surface) !important; color: var(--nx-ink) !important; border: 1px solid var(--nx-rule) !important; box-shadow: 0 8px 22px rgba(0, 0, 0, .35) !important; }

/* The board and the SHIFT button: unchanged, with shadows that sit on a dark page. */
#sa-app .game-card { box-shadow: 0 18px 44px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .09), 0 0 60px rgba(110, 130, 255, .08) !important; }
#sa-app .shiftBtn { border-color: rgba(255, 255, 255, .12) !important; box-shadow: 0 14px 30px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06) !important; transition: transform .08s ease, filter .15s ease; }
#sa-app .shiftBtn:active { transform: translateY(1px) scale(.995); filter: brightness(1.12) !important; }

/* Score line and chips. */
#sa-app .hud, #sa-app .hud * { color: inherit; }
#sa-app .hud { color: var(--nx-ink-2) !important; }
#sa-score, #sa-best, #sa-mult { color: var(--nx-ink) !important; }
#sa-app .tag { background: var(--nx-bg-2) !important; color: var(--nx-ink-2) !important; border: 1px solid var(--nx-rule) !important; box-shadow: none !important; }
#sa-app #sa-mode { cursor: pointer; }
#sa-app #sa-mode:hover { border-color: var(--nx-rule-strong) !important; color: var(--nx-ink) !important; }
#sa-app .rank-mini { background: rgba(142, 134, 239, .16) !important; color: var(--nx-accent-ink) !important; border-color: transparent !important; }

/* Toolbar: the same buttons in the same places, as quiet dark surfaces. */
#sa-app .toolbtn, #sa-app .iconbtn {
  background: var(--nx-surface) !important; color: var(--nx-ink) !important; border: 1px solid var(--nx-rule) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 6px 16px rgba(0, 0, 0, .28) !important; border-radius: 14px !important;
  transition: background .15s ease, border-color .15s ease, transform .08s ease !important;
}
#sa-app .toolbtn:hover, #sa-app .iconbtn:hover { background: #1f2024 !important; border-color: var(--nx-rule-strong) !important; }
#sa-app .toolbtn:active, #sa-app .iconbtn:active { transform: translateY(1px) scale(.98) !important; background: #232428 !important; }
#sa-app .toolbtn:focus-visible, #sa-app .iconbtn:focus-visible { outline: 2px solid var(--nx-accent) !important; outline-offset: 2px; }
#sa-app .toolbtn svg, #sa-app .toolbtn .toolicon { fill: currentColor; color: var(--nx-ink); }
#sa-app .toolbtn .tlabel { color: var(--nx-ink-2) !important; }
#sa-app .toolbtn.is-on, #sa-app .toolbtn.meter-on { border-color: rgba(142, 134, 239, .55) !important; box-shadow: 0 0 0 1px rgba(142, 134, 239, .25), 0 6px 16px rgba(0, 0, 0, .28) !important; }
#sa-funfacts { background: rgba(24, 25, 28, .86) !important; border-color: var(--nx-rule) !important; color: var(--nx-muted) !important; box-shadow: 0 8px 22px rgba(0, 0, 0, .35) !important; }

/* The original's panels (analytics, context), on dark surfaces. */
#sa-analytics, #sa-context, #sa-scores { background: rgba(8, 8, 10, .6) !important; }
#sa-analytics .an-shell, #sa-analytics .an-card, #sa-app .card, #sa-context .card, #sa-scores .card, #sa-scores > div {
  background: var(--nx-surface) !important; color: var(--nx-ink) !important; border-color: var(--nx-rule) !important; box-shadow: 0 24px 60px rgba(0, 0, 0, .5) !important; }
#sa-analytics .an-card { box-shadow: none !important; background: var(--nx-bg-2) !important; }
#sa-analytics .an-tab, #sa-analytics .chip, #sa-context .chip, #sa-analytics .btn, #sa-context .btn { background: var(--nx-bg-2) !important; color: var(--nx-ink-2) !important; border-color: var(--nx-rule) !important; }
#sa-analytics .an-tab.an-active, #sa-analytics .chip.active, #sa-context .chip.active { color: var(--nx-accent-ink) !important; border-color: rgba(142, 134, 239, .5) !important; }
#sa-analytics, #sa-analytics *:not(svg):not(path):not(line):not(circle):not(polyline) { color: var(--nx-ink-2); }
#sa-analytics h1, #sa-analytics h2, #sa-analytics h3, #sa-analytics .an-big { color: var(--nx-ink) !important; }
#sa-analytics .an-label, #sa-analytics .an-note { color: var(--nx-muted) !important; }
#sa-history th, #sa-history td { border-color: var(--nx-rule) !important; }

.nx-sheet *, .nx-sheet *::before, .nx-sheet *::after, .nx-target, .nx-target * { box-sizing: border-box; }
.nx-sheet [hidden], .nx-target[hidden], .nx-sheet[hidden] { display: none !important; }
.nx-haptic { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none; }

/* ---------- Challenge target under the board ---------- */
.nx-target { display: flex; align-items: center; gap: 12px; width: min(92vw, 520px); margin: 12px auto 0; font-family: var(--nx-sans); font-size: 14px; color: var(--nx-ink-2); }
.nx-target b { font-family: var(--nx-game); font-weight: 800; font-size: 17px; color: var(--nx-ink); font-variant-numeric: tabular-nums lining-nums; }
.nx-target-bar { position: relative; flex: 1; height: 4px; border-radius: 4px; background: var(--nx-rule); }
.nx-target-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 4px; background: var(--nx-accent); transition: width .2s linear; }
.nx-target-bar em { position: absolute; right: -1px; top: -4px; bottom: -4px; width: 2px; border-radius: 2px; background: var(--nx-ink); }
.nx-target.passed .nx-target-bar i { background: #7fd0a0; }
.nx-target.flash { animation: nxFlash .5s ease 3; }
@keyframes nxFlash { 50% { opacity: .35; } }

/* ---------- Sheets in the website's language ---------- */
.nx-sheet { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: flex-end; justify-content: center; background: rgba(8, 8, 10, .62);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: nxFade .25s ease; font-family: var(--nx-sans); color: var(--nx-ink); }
.nx-sheet[hidden] { display: none; }
.nx-card { width: 100%; max-height: 94dvh; overflow-y: auto; overscroll-behavior: contain; padding: 22px 22px max(22px, env(safe-area-inset-bottom));
  background: var(--nx-surface); border-top: 1px solid var(--nx-rule); border-radius: 18px 18px 0 0; box-shadow: 0 -20px 60px rgba(0, 0, 0, .5); animation: nxUp .35s cubic-bezier(.2, .8, .2, 1); }
@media (min-width: 700px) and (min-height: 560px) {
  .nx-sheet { align-items: center; }
  .nx-card { width: min(440px, calc(100vw - 48px)); border: 1px solid var(--nx-rule); border-radius: 16px; padding: 26px 28px 24px; }
  .nx-card.wide { width: min(520px, calc(100vw - 48px)); }
}
@keyframes nxFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nxUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.nx-card > * { margin: 0; }
.nx-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; }
.nx-label { display: block; font-family: var(--nx-sans); font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--nx-muted); margin: 0; }
.nx-opt { text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--nx-muted); opacity: .8; margin-left: 4px; }
.nx-title { margin: 6px 0 0 !important; font-family: var(--nx-serif); font-weight: 500; font-size: 30px; line-height: 1.15; letter-spacing: -.01em; }
.nx-title.sm { margin: 0 !important; font-size: 24px; }
.nx-badge { display: inline-block; margin-top: 10px !important; padding: 4px 12px; border-radius: 999px; font-size: 13px; color: var(--nx-accent-ink); background: rgba(142, 134, 239, .14); box-shadow: inset 0 0 0 1px rgba(142, 134, 239, .3); }
.nx-x { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--nx-rule); background: transparent; color: var(--nx-ink); cursor: pointer; padding: 0; }
.nx-x:hover { border-color: var(--nx-rule-strong); }
.nx-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.nx-fc { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px !important; }
.nx-stat { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: 14px; background: var(--nx-bg-2); border: 1px solid var(--nx-rule); }
.nx-big { font-family: var(--nx-game); font-weight: 800; font-size: 52px; line-height: 1.05; letter-spacing: 0; color: var(--nx-ink); font-variant-numeric: tabular-nums lining-nums; }
.nx-stat .nx-big { color: #9fd8ff; }
.nx-stat.calm .nx-big { color: #ffb3c4; }
.nx-word { font-size: 16px; color: var(--nx-ink-2); }
.nx-scores { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px !important; padding: 2px 4px; }
.nx-num { display: block; margin-top: 4px; font-family: var(--nx-game); font-weight: 800; font-size: 28px; letter-spacing: 0; line-height: 1.1; font-variant-numeric: tabular-nums lining-nums; }
.nx-note { margin-top: 12px !important; font-size: 16px; color: var(--nx-ink-2); }
.nx-note:empty { display: none; }
.nx-fine { margin-top: 10px !important; font-size: 13px; line-height: 1.5; color: var(--nx-muted); text-align: center; }
.nx-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px !important; }
.nx-actions.one { grid-template-columns: 1fr; }
.nx-btn { appearance: none; border: 0; border-radius: 999px; padding: 14px 20px; font-family: var(--nx-sans); font-size: 15.5px; font-weight: 500; cursor: pointer; background: var(--nx-ink); color: #111214; transition: background .2s, box-shadow .2s, transform .08s; }
.nx-btn:hover { background: #fff; }
.nx-btn:active { transform: scale(.98); }
.nx-btn.ghost { background: transparent; color: var(--nx-ink); box-shadow: inset 0 0 0 1px var(--nx-rule-strong); }
.nx-btn.ghost:hover { box-shadow: inset 0 0 0 1px var(--nx-ink); }
.nx-btn:disabled { opacity: .6; cursor: default; }
.nx-btn:focus-visible, .nx-link:focus-visible, .nx-x:focus-visible, .nx-input:focus-visible { outline: 2px solid var(--nx-accent); outline-offset: 3px; }
.nx-links { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 14px !important; color: var(--nx-muted); }
.nx-link { border: 0; background: none; padding: 6px 2px; font-family: var(--nx-sans); font-size: 14.5px; color: var(--nx-accent-ink); cursor: pointer; text-decoration: underline; text-decoration-color: rgba(169, 162, 255, .35); text-underline-offset: 4px; }
.nx-link:hover { text-decoration-color: currentColor; }

/* Details: progress over the last games */
.nx-sub { margin-top: 6px !important; font-size: 16px; color: var(--nx-ink-2); }
.nx-detail { margin-top: 16px !important; padding: 16px; border-radius: 14px; background: var(--nx-bg-2); border: 1px solid var(--nx-rule); }
.nx-detail svg { display: block; width: 100%; height: auto; margin-top: 10px; }
.nx-detail svg text { fill: var(--nx-muted); font-family: var(--nx-sans); font-size: 10px; }
.nx-legend { display: flex; gap: 16px; margin-top: 8px; font-size: 13px; color: var(--nx-ink-2); }
.nx-legend i { display: inline-block; width: 14px; height: 2px; margin-right: 6px; vertical-align: middle; border-radius: 2px; }
.nx-trend { margin-top: 10px !important; font-size: 16px; line-height: 1.5; color: var(--nx-ink); }
.nx-links.left { justify-content: flex-start; margin-top: 6px !important; }

/* Mode chooser */
.nx-modes { display: grid; gap: 10px; margin-top: 16px !important; }
.nx-mode { display: grid; gap: 3px; text-align: left; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--nx-rule); background: var(--nx-bg-2); color: var(--nx-ink); font-family: var(--nx-sans); cursor: pointer; transition: border-color .15s; }
.nx-mode b { font-family: var(--nx-serif); font-weight: 500; font-size: 19px; }
.nx-mode span { font-size: 15px; line-height: 1.45; color: var(--nx-muted); }
.nx-mode:hover { border-color: var(--nx-rule-strong); }
.nx-mode[aria-checked="true"] { border-color: var(--nx-accent); box-shadow: inset 0 0 0 1px var(--nx-accent); }
.nx-mode:focus-visible, .nx-switch:focus-visible { outline: 2px solid var(--nx-accent); outline-offset: 3px; }
.nx-field { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px !important; padding-top: 16px; border-top: 1px solid var(--nx-rule); }
.nx-field b { display: block; font-weight: 500; font-size: 15.5px; }
.nx-field small { display: block; margin-top: 3px; font-size: 13px; color: var(--nx-muted); }
.nx-switch { position: relative; flex: none; width: 46px; height: 28px; border-radius: 999px; border: 1px solid var(--nx-rule-strong); background: var(--nx-bg); padding: 0; cursor: pointer; }
.nx-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--nx-muted); transition: transform .2s; }
.nx-switch[aria-checked="true"] { background: var(--nx-accent); border-color: var(--nx-accent); }
.nx-switch[aria-checked="true"]::after { transform: translateX(18px); background: #fff; }
.nx-sr { position: fixed; top: 0; left: 0; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Visible focus on the original controls too. */
#sa-game:focus-visible { outline: 2px solid var(--nx-accent) !important; outline-offset: -2px; }
#sa-app .shiftBtn:focus-visible, #sa-app #sa-mode:focus-visible, #sa-topbar a:focus-visible { outline: 2px solid var(--nx-accent) !important; outline-offset: 3px; }

/* Versus */
.nx-vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 10px; margin-top: 18px !important; padding: 16px; border-radius: 14px; background: var(--nx-bg-2); border: 1px solid var(--nx-rule); }
.nx-vs > div:last-of-type { text-align: right; }
.nx-vs-mid { font-family: var(--nx-serif); font-style: italic; color: var(--nx-muted); padding-bottom: 6px; }
.nx-verdict { grid-column: 1 / -1; margin: 6px 0 0; font-family: var(--nx-serif); font-size: 24px; text-align: center; }
.nx-verdict.win { color: var(--nx-accent-ink); }

/* Name entry */
.nx-hero { margin-top: 8px !important; font-family: var(--nx-game); font-weight: 800; font-size: 56px; line-height: 1; letter-spacing: 0; font-variant-numeric: tabular-nums lining-nums; }
.nx-rank { margin-top: 10px !important; font-family: var(--nx-game); font-weight: 800; font-size: 22px; letter-spacing: 0; line-height: 1.3; color: var(--nx-ink-2); min-height: 1.3em; }
.nx-form { display: grid; gap: 8px; margin-top: 20px !important; }
.nx-form > * { margin: 0; }
.nx-form .nx-label { margin-top: 8px; }
.nx-input { width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--nx-rule-strong); background: var(--nx-bg); color: var(--nx-ink); font-family: var(--nx-sans); font-size: 17px; }
.nx-input:focus { border-color: var(--nx-accent); outline: none; }
.nx-help { font-size: 14.5px; color: var(--nx-muted); }
.nx-flagrow { display: flex; align-items: center; gap: 10px; }
.nx-flag { font-size: 24px; line-height: 1; min-width: 28px; text-align: center; }
.nx-err { min-height: 1.3em; font-size: 15px; color: #f2a7b4; }

/* Leaderboard */
.nx-table { width: 100%; margin-top: 14px !important; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums lining-nums; }
.nx-table th { padding: 0 8px 8px; font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--nx-muted); text-align: left; }
.nx-table th.rk, .nx-table td.rk { width: 44px; }
.nx-table th.r, .nx-table td.r { text-align: right; width: 34%; }
.nx-table td { padding: 11px 8px; border-top: 1px solid var(--nx-rule); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nx-table td.rk { color: var(--nx-muted); position: relative; }
.nx-table td.r { font-family: var(--nx-game); font-weight: 800; font-size: 16px; letter-spacing: 0; }
.nx-table .who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.nx-table .who span:first-child { overflow: hidden; text-overflow: ellipsis; }
.nx-table tr.top td.rk { color: var(--nx-ink); }
.nx-table tr.top td.rk::after { content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 6px; vertical-align: 2px; border-radius: 50%; background: var(--nx-accent); opacity: .9; }
.nx-table tr.t2 td.rk::after { opacity: .6; }
.nx-table tr.t3 td.rk::after { opacity: .35; }
.nx-table tr.me td { background: rgba(142, 134, 239, .12); color: var(--nx-accent-ink); }
.nx-table tr.me td:first-child { border-radius: 10px 0 0 10px; }
.nx-table tr.me td:last-child { border-radius: 0 10px 10px 0; }
.nx-table tr.skel td span { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #1d1e22, #26272c, #1d1e22); background-size: 200% 100%; animation: nxShimmer 1.2s linear infinite; }
@keyframes nxShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.nx-table td.empty { padding: 30px 8px; text-align: center; white-space: normal; }
.nx-table td.empty b { display: block; font-family: var(--nx-serif); font-weight: 500; font-size: 24px; color: var(--nx-ink); }
.nx-table td.empty span { display: block; margin-top: 6px; font-size: 14px; color: var(--nx-muted); }

.nx-toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translate(-50%, 10px); z-index: 3100; margin: 0; padding: 10px 16px; border-radius: 999px;
  background: var(--nx-bg-2); border: 1px solid var(--nx-rule-strong); color: var(--nx-ink); font-family: var(--nx-sans); font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; white-space: nowrap; }
.nx-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .nx-sheet, .nx-card, .nx-target.flash, .nx-table tr.skel td span { animation: none !important; }
  .nx-toast, .nx-btn, .nx-target-bar i, #sa-app .toolbtn, #sa-app .shiftBtn, .nx-switch::after, .nx-mode { transition: none !important; }
}


/* ---------- Placement and size for every screen ---------- */
/* One board width drives everything that hugs the board (readout, messages, target, SHIFT button). */
#sa-app .wrap { --bw: min(92vw, 520px); place-items: center !important; align-content: center; gap: clamp(6px, 1.4vh, 12px) !important; min-height: 100dvh !important;
  padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)) !important; }
#sa-app .game-card, #sa-app .msg-wrap, #sa-app .thumbbar, .nx-readout, .nx-target { width: var(--bw) !important; }
#sa-app .msg-wrap { min-height: 30px !important; }
#sa-app .typebar { font-size: clamp(16px, 2.4vw, 18px) !important; color: var(--nx-ink-2) !important; line-height: 1.35 !important; }
#sa-app .logo-tag { font-size: clamp(14px, 2.2vw, 16px) !important; }
@media (min-width: 700px) and (min-height: 760px) { #sa-app .wrap { --bw: min(92vw, 640px, calc((100dvh - 360px) * 1.625)); } }
/* Touch screens always get the big SHIFT button, whatever their width. */
@media (pointer: coarse) { #sa-app .thumbbar { display: block !important; } }
@media (max-height: 700px) and (orientation: portrait) { #sa-app .shiftBtn { padding: 30px 18px !important; } }
/* Phones on their side: the board on the left; the tools top right; the big SHIFT button bottom right, under the thumb. */
@media (orientation: landscape) and (max-height: 520px) {
  #sa-app .wrap { --bw: min(60vw, calc((100dvh - 92px) * 1.625)); grid-template-columns: var(--bw) minmax(200px, 280px); grid-template-rows: auto auto auto; column-gap: 20px; row-gap: 6px !important; justify-content: center; align-content: center; }
  #sa-app .msg-wrap, #sa-funfacts { display: none !important; }
  .nx-readout { grid-column: 1; grid-row: 1; }
  #sa-app .game-card { grid-column: 1; grid-row: 2; }
  .nx-target { grid-column: 1; grid-row: 3; }
  #sa-app .hud { grid-column: 2; grid-row: 3; }
  #sa-app .hud-tags { grid-column: 2; grid-row: 1; align-self: end; justify-content: flex-start !important; }
  #sa-app .toolbar { grid-column: 2; grid-row: 2; align-self: start; justify-content: flex-start !important; }
  #sa-app .thumbbar { grid-column: 2; grid-row: 2 / span 2; width: 100% !important; align-self: end; margin: 0 !important; }
  #sa-app .shiftBtn { padding: 38px 12px !important; }
  #sa-app .hud-tags { margin-top: 0 !important; gap: 6px !important; }
  #sa-app .toolbar, #sa-app .toolbar-top, #sa-app .toolbar-bottom { flex-wrap: wrap !important; overflow: visible !important; gap: 8px !important; margin-top: 8px !important; }
  #sa-app .toolbtn { width: 44px !important; height: 44px !important; min-width: 0 !important; padding: 0 !important; }
  #sa-app .toolbtn .tlabel { display: none !important; }
}
@media (max-height: 760px) { #sa-funfacts { display: none !important; } }
#sa-funfacts { position: static !important; transform: none !important; margin: 6px auto 0 !important; width: max-content; max-width: var(--bw, 92vw); text-align: center; }

/* The readout on the board's top edge: score left; HI, multiplier and About right. */
.nx-readout { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: -4px; padding: 0 4px; font-family: var(--nx-game); color: var(--nx-ink); }
.nx-r-lbl { display: block; font-family: var(--nx-sans); font-weight: 500; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--nx-muted); margin-bottom: 1px; }
.nx-r-score #sa-score { font-family: var(--nx-game) !important; font-weight: 800 !important; font-size: clamp(24px, 6.4vw, 34px) !important; line-height: 1; color: var(--nx-ink) !important; font-variant-numeric: tabular-nums; }
.nx-r-right { display: flex; align-items: flex-end; gap: 14px; }
.nx-r-hi #sa-best { font-family: var(--nx-game) !important; font-weight: 800 !important; font-size: clamp(18px, 4.6vw, 22px) !important; line-height: 1; color: var(--nx-ink-2) !important; font-variant-numeric: tabular-nums; }
.nx-r-mult { font-family: var(--nx-game); font-weight: 800; font-size: clamp(18px, 4.6vw, 22px); line-height: 1; color: #9fd8ff; font-variant-numeric: tabular-nums; display: inline-block; }
.nx-r-mult #sa-mult { color: inherit !important; font-weight: inherit !important; }
.nx-r-mult.pop { animation: nxPop .45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes nxPop { 40% { transform: scale(1.35); } }
#sa-rankpill { align-self: center; font-size: 12px !important; }
/* Analytics is one sheet now (#nx-progress), so the old game's tabbed panel never opens. */
#sa-analytics { display: none !important; }

/* Your progress: the recent games list, and the trend word beside each number. */
.nx-runs { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; }
.nx-runs li { display: grid; grid-template-columns: 1fr auto auto; align-items: baseline; gap: 14px;
  padding: 9px 0; border-top: 1px solid var(--nx-rule); font-size: 14px; }
.nx-runs li:first-child { border-top: 0; }
.nx-runs .when { color: var(--nx-ink-2); }
.nx-runs b { font-variant-numeric: tabular-nums; }
.nx-runs .fc { color: var(--nx-ink-2); font-variant-numeric: tabular-nums; min-width: 72px; text-align: right; }
.nx-runs .fc i { color: var(--nx-rule-strong); font-style: normal; }
.nx-runs .empty { color: var(--nx-ink-2); border-top: 0; }
.nx-word.up { color: #8e86ef; }
.nx-word.down { color: var(--nx-ink-2); }

/* Leaving the game: the site used to draw this outside the frame; the page carries it now. */
.nx-back { position: fixed; z-index: 30; top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left));
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px 6px 8px; border-radius: 999px;
  font-family: var(--nx-sans, system-ui); font-size: 12.5px; font-weight: 500; text-decoration: none;
  color: var(--nx-ink-2); background: var(--nx-surface); border: 1px solid var(--nx-rule-strong); }
.nx-back:hover { color: var(--nx-ink); border-color: var(--nx-ink-2); }
.nx-back:focus-visible { outline: 2px solid var(--nx-accent); outline-offset: 3px; }
@media (max-width: 520px) { .nx-back span { display: none; } }

.nx-about-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--nx-rule-strong); background: var(--nx-surface); color: var(--nx-ink); font-family: var(--nx-serif); font-size: 17px; cursor: pointer; display: grid; place-items: center; padding: 0; }
.nx-about-btn:hover { border-color: var(--nx-ink-2); }
.nx-about-btn:focus-visible { outline: 2px solid var(--nx-accent); outline-offset: 3px; }
/* The original score line, now empty, takes no space. */
#sa-app .hud > div:empty { display: none; }

/* The site's text-size setting reaches the sheets and the readout. */
.nx-card, .nx-readout { zoom: var(--nx-read, 1); }

/* ---------- About ---------- */
.nx-grab { width: 38px; height: 4px; border-radius: 4px; background: var(--nx-rule-strong); margin: -8px auto 10px !important; }
@media (min-width: 700px) and (min-height: 560px) { .nx-grab { display: none; } .nx-card.about { width: min(560px, calc(100vw - 48px)); } }
.nx-card.about .nx-title { font-size: 34px; letter-spacing: .02em; margin: 0 !important; }
.nx-lede { margin-top: 12px !important; font-size: 17px; line-height: 1.55; color: var(--nx-ink); max-width: 62ch; }
.nx-h3 { margin: 26px 0 0 !important; font-family: var(--nx-serif); font-weight: 500; font-size: 21px; }
.nx-body { margin-top: 12px !important; font-size: 16px; line-height: 1.55; color: var(--nx-ink-2); }
.nx-steps { list-style: none; counter-reset: step; margin: 12px 0 0 !important; padding: 0; display: grid; gap: 12px; }
.nx-steps li { counter-increment: step; display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: center; font-size: 16px; line-height: 1.5; }
.nx-steps li p { margin: 0; }
.nx-steps li p::before { content: counter(step) '. '; color: var(--nx-accent-ink); font-weight: 600; }
.nx-key { display: none; }
html.nx-keys .nx-key { display: inline; }
html.nx-keys .nx-touch { display: none; }
.nx-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px !important; }
.nx-mcard { padding: 14px; border-radius: 14px; background: var(--nx-bg-2); border: 1px solid var(--nx-rule); }
.nx-mcard b { font-family: var(--nx-serif); font-weight: 500; font-size: 19px; color: #9fd8ff; }
.nx-mcard.calm b { color: #ffb3c4; }
.nx-mcard p { margin: 4px 0 0; font-size: 15px; line-height: 1.45; color: var(--nx-ink-2); }
.nx-think { margin-top: 20px !important; border-top: 1px solid var(--nx-rule); padding-top: 14px; }
.nx-think summary { cursor: pointer; font-family: var(--nx-serif); font-size: 19px; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.nx-think summary::-webkit-details-marker { display: none; }
.nx-think summary::after { content: '+'; font-family: var(--nx-sans); color: var(--nx-accent-ink); font-size: 22px; }
.nx-think[open] summary::after { content: '\2212'; }
.nx-think summary:focus-visible { outline: 2px solid var(--nx-accent); outline-offset: 4px; border-radius: 6px; }
.nx-think ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.nx-think li { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; line-height: 1.5; color: var(--nx-ink-2); }
.nx-think svg { flex: none; width: 22px; height: 22px; margin-top: 1px; fill: none; stroke: var(--nx-accent-ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nx-made { margin-top: 22px !important; font-size: 13.5px; color: var(--nx-muted); }
/* The site's OpenCura wordmark: [ Open + bold violet Cura ], in Inter where available. */
.nx-oc { font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-weight: 500; letter-spacing: .02em; text-decoration: none; white-space: nowrap; }
.nx-oc i { font-style: normal; color: var(--nx-oc-violet, #8e86ef); }
.nx-oc .o { color: #d8d5cf; margin: 0 .3em; }
.nx-oc b { font-weight: 700; color: var(--nx-oc-violet, #8e86ef); }
.nx-oc:hover .o, .nx-oc:focus-visible .o { text-decoration: underline; text-underline-offset: 3px; }
.nx-oc:focus-visible { outline: 2px solid var(--nx-accent); outline-offset: 3px; border-radius: 4px; }
.nx-foot { margin-top: 6px !important; font-size: 13.5px; line-height: 1.5; color: var(--nx-muted); }
.nx-foot a { color: var(--nx-accent-ink); text-underline-offset: 3px; }

/* Tiny boards: the real board's navy, grid, dashed line, cyan block and pink blocks. */
.nx-mini { position: relative; width: 112px; height: 69px; border-radius: 9px; overflow: hidden; background-color: #131735;
  background-image: linear-gradient(rgba(127,166,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(127,166,255,.08) 1px, transparent 1px); background-size: 9px 9px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.09); }
.nx-mini::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed rgba(255,255,255,.18); }
.nx-mini i { position: absolute; display: block; }
.nx-mini .b { left: 14px; top: 13px; width: 9px; height: 9px; border-radius: 2.5px; background: #7fd0ff; }
.nx-mini .o { width: 10px; height: 14px; border-radius: 2.5px; background: #ff8aa7; left: 120%; }
.nx-mini .tap { right: 8px; bottom: 8px; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.7); opacity: 0; }
.nx-mini .t { left: 0; top: 0; height: 3px; width: 100%; background: #7fd0ff; transform-origin: left; }
.m1 .b { animation: nxGlide 2.4s ease-in-out infinite; }
.m1 .tap { animation: nxTap 1.2s ease-out infinite; }
@keyframes nxGlide { 0%, 45% { top: 13px; } 50%, 95% { top: 47px; } 100% { top: 13px; } }
@keyframes nxTap { 0%, 30% { opacity: 0; transform: scale(.5); } 40% { opacity: .9; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.5); } }
.m2 .b { animation: nxDodge 2.8s ease-in-out infinite; }
.m2 .o1 { top: 8px; animation: nxRun 2.8s linear infinite; }
.m2 .o2 { top: 45px; animation: nxRun 2.8s linear 1.4s infinite; }
@keyframes nxDodge { 0%, 18% { top: 13px; } 24%, 68% { top: 47px; } 74%, 100% { top: 13px; } }
@keyframes nxRun { 0% { left: 120%; } 55% { left: -20%; } 100% { left: -20%; } }
.m3 .t { animation: nxDrain 4s linear infinite; }
.m3 .b { animation: nxGlide 4s ease-in-out infinite; }
.m3 .o1 { top: 8px; animation: nxRun 4s linear 1s infinite; }
@keyframes nxDrain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .nx-mini i, .nx-r-mult.pop { animation: none !important; } .m2 .o1 { left: 70%; } .m3 .o1 { left: 70%; } .m3 .t { transform: scaleX(.6); } }
