/* Number Words Match (Math, counting piece 6). Numbers on the left, groups on the right, one row each; lines are drawn over the gap. Every tap target is 44 px or more. */
.nw-intro { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.nw-piko { width: 84px; height: auto; flex: none; }
.nw-screen h1 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); margin: 4px 0 6px; }
.nw-screen .game-topbar .btn { min-height: 44px; min-width: 44px; }
.nw-prompt { margin: 0 0 12px; color: var(--muted); font-weight: 800; text-align: center; }
.nw-play { background: var(--paper); border: 2px solid var(--border); border-radius: 18px; padding: 16px; }
.nw-board { position: relative; display: grid; row-gap: 10px; }
.nw-board[data-nw-count="20"] { row-gap: 8px; }
.nw-lines { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; overflow: visible; }
.nw-line { stroke-width: 6; stroke-linecap: round; fill: none; }
.nw-line-ok { stroke: var(--green-dark); }
.nw-line-shown { stroke: #f2b705; stroke-width: 8; }
.nw-line-drag { stroke: var(--blue-action); stroke-dasharray: 2 12; stroke-width: 8; }
.nw-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(70px, 1fr) minmax(0, 1fr); align-items: stretch; }
.nw-level-blocks .nw-row { grid-template-columns: minmax(0, 1.3fr) minmax(50px, .6fr) minmax(0, 2.6fr); }
.nw-num, .nw-grp { position: relative; display: flex; align-items: center; min-height: 56px; margin: 0; border: 3px solid var(--border); border-radius: 14px; background: white; font: inherit; color: var(--ink); cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.nw-num { justify-content: center; padding: 6px 10px; font-weight: 900; font-size: 1.6rem; line-height: 1.1; text-align: center; }
.nw-numtext { overflow-wrap: anywhere; }
.nw-digit { display: block; width: 100%; text-align: center; font-weight: 900; font-size: 1.9rem; line-height: 1; pointer-events: none; }
.nw-level-digits .nw-grp { justify-content: center; }
.nw-board[data-nw-count="20"] .nw-num, .nw-board[data-nw-count="20"] .nw-grp { min-height: 46px; }
.nw-grp { justify-content: flex-start; padding: 6px 10px; touch-action: pan-y; }
.nw-grpinner { display: block; min-width: 0; }
.nw-grp .ns-blocks { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 14px; pointer-events: none; }
.nw-grp .ns-group { display: inline-flex; flex-wrap: wrap; align-items: flex-end; gap: 3px; }
.nw-grp .ns-block { display: block; }
.nw-grp .ns-unit, .nw-hint-blocks .ns-unit { min-width: 7px; min-height: 7px; }   /* a unit is a few pixels at true size: keep it big enough to count */
.nw-num:hover:not(:disabled), .nw-grp:hover:not(:disabled), .nw-num:focus-visible, .nw-grp:focus-visible { border-color: var(--blue-action); background: var(--sky); }
.nw-selected { border-color: var(--blue-action); background: var(--sky); box-shadow: 0 0 0 4px rgba(37, 99, 235, .35); }
.nw-lifted { opacity: .6; }
.nw-done { border-color: var(--green-dark); background: #e6f6ec; cursor: default; opacity: 1; }
.nw-shown { border-color: #f2b705; background: #fff8dc; }
.nw-num:disabled, .nw-grp:disabled { color: var(--ink); }
.nw-mark { position: absolute; top: -10px; right: -8px; width: 26px; height: 26px; line-height: 26px; border-radius: 50%; background: var(--green-dark); color: white; font-size: 1rem; font-weight: 900; text-align: center; }
.nw-shown .nw-mark { background: #7a5a00; }
.nw-mark-bad { background: #c4001f; }
/* A wrong match is loud: thick red border, red tint, a cross badge on both pieces (not colour alone), a red message box, a short shake. It stays until the next tap. */
.nw-bad { border-color: #c4001f; background: #fff0f0; border-width: 5px; animation: nw-shake .4s; }
/* r2b: the message strip is in the page flow ABOVE the board (it used to be pinned over the bottom rows). Its height is reserved so the board never jumps. */
.nw-foot { margin: 0 0 12px; padding: 0 0 8px; min-height: 5.2em; border-bottom: 2px solid var(--border); }
.nw-tip { margin: 4px 0 0; font-weight: 700; font-size: .95rem; color: var(--muted); }
.nw-linked { border-color: var(--blue-action); background: var(--sky); }   /* delayed mode: a placed line looks neutral (blue), never green or red */
.nw-line-pending { stroke: var(--blue-action); stroke-width: 6; }
.nw-feedback { min-height: 2.6em; margin: 0 0 6px; text-align: center; font-weight: 800; font-size: 1.15rem; }
.nw-feedback:empty { min-height: 0; margin: 0; }
.nw-feedback-wrong { padding: 8px 14px; border: 3px solid #c4001f; border-radius: 14px; background: #fff0f0; color: #8a0018; }
.nw-earned { margin: 0 0 8px; text-align: center; font-weight: 900; color: var(--green-dark); font-size: 1.2rem; }
.nw-round-done { margin: 4px 0 2px; text-align: center; }
.nw-round-line { margin: 0 0 8px; text-align: center; font-weight: 800; font-size: 1.15rem; }
.nw-actions { display: flex; justify-content: center; }
.nw-action { min-width: 170px; min-height: 56px; font-size: 1.2rem; }
.nw-levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.nw-level { min-height: 56px; font-size: 1.1rem; }
.nw-end { text-align: center; }
.nw-end-piko { width: 140px; height: auto; }
.nw-total { font-size: 1.6rem; font-weight: 900; color: var(--green-dark); margin: 6px 0 14px; }
.nw-hint-row { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; }
.nw-hint-used { margin: 0; font-size: 1.4rem; font-weight: 900; }
.nw-hint-text, .nw-help-text { font-size: 1.3rem; font-weight: 700; line-height: 1.5; max-width: 46em; }
.nw-hint-blocks { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; margin: 10px 0; }
.nw-hint-blocks .ns-blocks { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 14px; }
.nw-hint-blocks .ns-group { display: inline-flex; align-items: flex-end; gap: 3px; }
.nw-hint-line { margin: 0; font-size: 1.3rem; font-weight: 900; }
@keyframes nw-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .nw-bad { animation: none; } }
@media (max-width: 800px) {
  .nw-piko { width: 56px; }
  .nw-play { padding: 8px; }
  .nw-board { row-gap: 8px; }
  .nw-board[data-nw-count="20"] { row-gap: 6px; }
  .nw-row { grid-template-columns: minmax(0, 1.2fr) minmax(24px, .5fr) minmax(0, 1fr); }
  .nw-level-blocks .nw-row { grid-template-columns: minmax(0, 1.2fr) minmax(20px, .3fr) minmax(0, 2.4fr); }
  .nw-num { padding: 4px 4px; font-size: 1.05rem; }
  .nw-digit { font-size: 1.5rem; }
  .nw-grp { padding: 4px 6px; }
  .nw-grp .ns-blocks { gap: 4px 8px; }
  .nw-feedback { font-size: .98rem; min-height: 0; }
  .nw-foot { padding: 0 0 4px; margin: 0 0 8px; min-height: 6em; }
  .nw-tip { font-size: .85rem; }
  .nw-action { min-height: 48px; }
  .nw-earned { margin: 0 0 4px; font-size: 1rem; }
  .nw-round-done { font-size: 1.2rem; }
  .nw-round-line { font-size: 1rem; margin-bottom: 4px; }
  .nw-line { stroke-width: 5; }
}
