/* Rocket Nonograms. Scoped to .ng. The board is one canvas (games/nonograms/game.js reads the --c-* colours). */
.ng { --bg: #060b18; --panel: #0b1328; --edge: #22345a; --line: #1c2b4a; --muted: #8aa3c4; --text: #dfe9ff; --strong: #fff; --accent: #55d6ff; --warm: #ffd166; --bad: #ff6b81; --good: #5ee6a8;
  --btn: #0f1a35; --btn-edge: #2a3b5f; --chip: #22345a; --sheet: #0d1630; --cover: rgba(8,13,28,0.95); --ink-on-warm: #1a1200;
  /* canvas colours */
  --c-board: #0a1226; --c-cell: #0e1a35; --c-cell2: #0c1730; --c-grid: #1d2c4c; --c-grid5: #4a6898; --c-fill: #dbe8ff; --c-fill2: #b7cdf5; --c-cross: #6d84ad; --c-dot: #8aa3c4;
  --c-clue: #e6efff; --c-clue-done: #4b5f84; --c-clue-bg: #0b1428; --c-clue-hot: #16294d; --c-hot: rgba(85,214,255,0.10); --c-cursor: #55d6ff; --c-bad: #ff6b81; --c-hint: #ffd166; --c-pulse: rgba(255,209,102,0.55);
  --ng-bs: min(100%, 560px);
  position: relative; max-width: 1040px; margin: 0 auto; padding: 4px 0 8px; color: var(--text);
  display: grid; gap: 10px; justify-content: center; align-content: start;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.ng.ng-light { --bg: #f3f0e8; --panel: #fffdf8; --edge: #d8d1c2; --line: #e2dccf; --muted: #6d6a7c; --text: #23253a; --strong: #11131f; --accent: #1a7fc4; --warm: #e0a400; --bad: #d63a55; --good: #1f9d64;
  --btn: #fffdf8; --btn-edge: #d8d1c2; --chip: #ebe5d8; --sheet: #fffdf8; --cover: rgba(250,247,240,0.96); --ink-on-warm: #2a1d00;
  --c-board: #ece6d9; --c-cell: #fbf9f4; --c-cell2: #f5f1e8; --c-grid: #ddd5c5; --c-grid5: #9b9180; --c-fill: #2b3150; --c-fill2: #464e73; --c-cross: #a39b8b; --c-dot: #8c8576;
  --c-clue: #22253a; --c-clue-done: #bdb5a5; --c-clue-bg: #f6f2ea; --c-clue-hot: #e3ecf6; --c-hot: rgba(26,127,196,0.08); --c-cursor: #1a7fc4; --c-bad: #d63a55; --c-hint: #e0a400; --c-pulse: rgba(224,164,0,0.45);
  background: var(--bg); border-radius: 12px; }
.ng [hidden] { display: none !important; }
.ng button { font-family: inherit; line-height: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.ng :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ng-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout: portrait stacks, landscape puts the panel beside the board ---------- */
.ng-port { grid-template-columns: var(--ng-bs); grid-template-areas: "head" "info" "board" "tools"; }
.ng-land { grid-template-columns: var(--ng-bs) var(--ng-pw, 300px); grid-template-rows: auto auto auto minmax(0, 1fr); grid-template-areas: "board head" "board info" "board tools" "board side"; column-gap: 20px; row-gap: 12px; }
.ng-head { grid-area: head; } .ng-info { grid-area: info; } .ng-boardwrap { grid-area: board; } .ng-tools { grid-area: tools; }
.ng.ng-fit { max-width: none; height: 100%; margin: 0; padding: 6px 4px; align-content: center; overflow: hidden; border-radius: 0; }
.ng-fit.ng-port { gap: 8px; grid-template-rows: auto auto minmax(0, 1fr) auto; grid-template-areas: "head" "info" "board" "tools"; align-content: stretch; }
.ng-fit.ng-port .ng-boardwrap { height: 100%; }

/* ---------- header ---------- */
.ng-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ng-game { display: inline-flex; align-items: center; gap: 4px; height: 40px; padding: 0 10px 0 14px; border-radius: 999px; border: 1px solid var(--btn-edge); background: var(--panel); color: var(--strong); font-weight: 750; font-size: 15px; cursor: pointer; min-width: 0; transition: border-color .15s, background-color .15s; }
.ng-game-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ng-game svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .ng-game:hover { border-color: var(--accent); } .ng-daily:hover { border-color: var(--warm); } }
.ng-daily { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--warm) 45%, transparent); background: color-mix(in srgb, var(--warm) 8%, transparent); color: var(--warm); font-weight: 700; font-size: 14px; cursor: pointer; flex: none; transition: border-color .15s, background-color .15s, color .15s; }
.ng-daily svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ng-daily[aria-pressed="true"] { background: var(--warm); color: var(--ink-on-warm); border-color: var(--warm); }
.ng-dot { position: absolute; top: 5px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px var(--bg); }
.ng-icons { display: flex; gap: 0; margin-left: auto; flex: none; }
.ng-ibtn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; transition: background-color .15s, color .15s; }
@media (hover: hover) { .ng-ibtn:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--strong); } }
.ng-ibtn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- info row ---------- */
.ng-info { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; font-size: 13.5px; color: var(--muted); padding: 0 2px; min-width: 0; }
.ng-level { font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ng-mistakes { font-variant-numeric: tabular-nums; display: inline-block; white-space: nowrap; }
.ng-mistakes.has { color: var(--bad); font-weight: 650; }
.ng-clock { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.ng-time { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--strong); font-size: 15px; min-width: 3.2em; text-align: right; }
.ng-notimer .ng-time { visibility: hidden; }
.ng-pause { width: 40px; height: 40px; margin: -4px -4px -4px 0; display: grid; place-items: center; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.ng-pause svg { width: 18px; height: 18px; fill: currentColor; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ng-pause:disabled { opacity: 0.3; cursor: default; }
@media (hover: hover) { .ng-pause:hover:not(:disabled) { background: color-mix(in srgb, var(--text) 8%, transparent); } }

/* ---------- board ---------- */
.ng-boardwrap { position: relative; width: var(--ng-bs); height: var(--ng-bh, var(--ng-bs)); border-radius: 12px; overflow: hidden; background: var(--c-board); }
.ng-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; outline: none; }
.ng-canvas:focus-visible { box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--accent) 60%, transparent); }
.ng-won .ng-boardwrap { box-shadow: 0 0 0 2px var(--warm), 0 0 44px color-mix(in srgb, var(--warm) 30%, transparent); transition: box-shadow .6s; }
.ng-zoom { position: absolute; right: 8px; bottom: 8px; z-index: 3; display: flex; gap: 2px; padding: 3px; border-radius: 14px; background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--edge); box-shadow: 0 6px 18px rgba(0,0,0,0.3); }
.ng-zoom button { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--text); cursor: pointer; }
.ng-zoom button:active { background: color-mix(in srgb, var(--text) 12%, transparent); }
.ng-zoom button:disabled { opacity: 0.35; }
.ng-zoom svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ng-cover { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: var(--cover); text-align: center; animation: ng-fade .2s ease; }
.ng-cover > div { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ng-cover b { font-size: 20px; color: var(--strong); }
.ng-loading { background: color-mix(in srgb, var(--cover) 88%, transparent); }
.ng-loading b { font-size: 15px; color: var(--muted); font-weight: 600; }
.ng-spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--chip); border-top-color: var(--accent); animation: ng-spin .8s linear infinite; }
.ng-tip { position: absolute; left: 8px; right: 8px; top: 8px; z-index: 5; background: #f7f9fc; color: #0b1328; border-radius: 14px; padding: 10px 40px 10px 14px; font-size: 14px; line-height: 1.42; box-shadow: 0 10px 30px rgba(0,0,0,0.45); animation: ng-tip .26s cubic-bezier(.2,.8,.2,1); }
.ng-light .ng-tip { background: #23253a; color: #f6f3ec; }
.ng-tip.low { top: auto; bottom: 8px; }
.ng-tip b { display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #8a6200; margin-bottom: 2px; }
.ng-light .ng-tip b { color: #ffd166; }
.ng-tip .ng-tip-x { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: inherit; opacity: 0.6; cursor: pointer; font-size: 18px; line-height: 30px; padding: 0; }
.ng-tip.coach { border: 2px solid var(--warm); }
.ng-tip { pointer-events: none; } .ng-tip .ng-tip-x { pointer-events: auto; }   /* taps go through a tip to the board under it */
.ng-toast { position: absolute; width: max-content; left: 50%; top: 42%; transform: translate(-50%, -6px); background: #f7f9fc; color: #0b1328; font-weight: 700; font-size: 14px; padding: 9px 16px; border-radius: 999px; pointer-events: none; opacity: 0; z-index: 6; max-width: 92%; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.ng-light .ng-toast { background: #23253a; color: #f6f3ec; }
.ng-toast.show { animation: ng-toast 2s ease forwards; }

/* ---------- tools ---------- */
.ng-tools { display: grid; grid-template-columns: minmax(0, 3fr) repeat(3, minmax(0, 1fr)); gap: 6px; align-items: stretch; }
.ng-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; padding: 3px; border-radius: 14px; background: var(--panel); border: 1px solid var(--edge); }
.ng-mode { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 50px; padding: 2px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; transition: background-color .15s, color .15s; }
.ng-mode svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.ng-mode svg .solid { fill: currentColor; stroke: none; }
.ng-mode[aria-checked="true"] { background: var(--accent); color: #04121c; }
.ng-light .ng-mode[aria-checked="true"] { color: #fff; }
@media (hover: hover) { .ng-mode:hover:not([aria-checked="true"]) { color: var(--strong); background: color-mix(in srgb, var(--text) 6%, transparent); } }
.ng-tool { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; padding: 4px 2px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 650; cursor: pointer; touch-action: none; transition: background-color .15s, color .15s, opacity .15s; }
.ng-tool svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .ng-tool:hover:not(:disabled) { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--strong); } }
.ng-tool:active:not(:disabled) { transform: scale(0.95); }
.ng-tool:disabled { opacity: 0.32; cursor: default; }
.ng-badge { position: absolute; top: 4px; left: calc(50% + 7px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--warm); color: var(--ink-on-warm); font: 800 11px/17px system-ui, sans-serif; font-style: normal; text-align: center; box-shadow: 0 0 0 2px var(--bg); }
.ng-tool:disabled .ng-badge { background: var(--chip); color: var(--muted); }
#ng-hint { color: var(--warm); }
.ng-is-paused .ng-tools, .ng-busy .ng-tools { opacity: 0.4; pointer-events: none; }
.ng-land .ng-tools { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ng-land .ng-modes { grid-column: 1 / -1; }

/* ---------- buttons ---------- */
.ng-btn { min-height: 46px; min-width: 104px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--btn-edge); background: transparent; color: var(--text); font-weight: 700; font-size: 14.5px; cursor: pointer; transition: background-color .15s, border-color .15s, transform .12s; }
@media (hover: hover) { .ng-btn:hover:not(:disabled) { border-color: var(--muted); background: color-mix(in srgb, var(--text) 4%, transparent); } }
.ng-btn:active:not(:disabled) { transform: scale(0.97); }
.ng-btn-primary { background: var(--warm); color: var(--ink-on-warm); border-color: var(--warm); }
@media (hover: hover) { .ng-btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--warm) 80%, #fff); border-color: color-mix(in srgb, var(--warm) 80%, #fff); } }

/* ---------- sheets ---------- */
.ng-scrim { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(2,4,10,0.62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: ng-fade .2s ease; }
.ng-scrim.out { animation: ng-fade .17s ease reverse forwards; }
.ng-sheet { position: relative; width: 100%; max-width: 480px; max-height: min(88vh, 780px); overflow: auto; overscroll-behavior: contain; background: var(--sheet); border: 1px solid var(--edge); border-radius: 20px; padding: 22px 22px 20px; box-shadow: 0 30px 80px rgba(0,0,0,0.6); color: var(--text); animation: ng-sheet .28s cubic-bezier(.2,.8,.2,1); }
.ng-sheet.ng-sheet-album { max-width: 640px; }
.ng-scrim.out .ng-sheet { animation: ng-sheet .17s ease reverse forwards; }
.ng-sheet:focus { outline: none; }
.ng-x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--text) 9%, transparent); color: var(--text); cursor: pointer; z-index: 2; }
.ng-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
@media (hover: hover) { .ng-x:hover { background: color-mix(in srgb, var(--text) 16%, transparent); } }
.ng-sheet-title { margin: 0 44px 6px 0; font-size: 22px; font-weight: 800; color: var(--strong); letter-spacing: -0.01em; }
.ng-sheet-title.ng-center { margin: 4px 0 0; }
.ng-center { text-align: center; }
.ng-sub { margin: 0 0 12px; color: var(--muted); font-size: 14.5px; }
.ng-h4 { margin: 18px 0 8px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 750; }
.ng-fine { margin: 14px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.ng-sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.ng-sheet-actions .ng-btn { flex: 1 1 0; min-width: 0; }
.ng-sheet-result .ng-sheet-actions { position: sticky; bottom: -20px; z-index: 1; margin: 18px -22px -20px; padding: 10px 22px 16px; background: var(--sheet); }
.ng-sheet-actions .ng-btn-primary { flex-basis: 100%; }

.ng-card { display: flex; align-items: center; gap: 12px; width: 100%; margin: 10px 0 0; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--btn-edge); background: var(--panel); color: var(--text); text-align: left; cursor: pointer; transition: border-color .15s, background-color .15s; }
.ng-card.daily { border-color: color-mix(in srgb, var(--warm) 45%, transparent); background: color-mix(in srgb, var(--warm) 7%, var(--panel)); }
@media (hover: hover) { .ng-card:hover { border-color: var(--accent); } .ng-card.daily:hover { border-color: var(--warm); } }
.ng-card.cur { box-shadow: inset 0 0 0 1px var(--warm); }
.ng-card-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--warm); display: grid; place-items: center; flex: none; }
.ng-card-icon.alt { background: var(--accent); }
.ng-card-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--ink-on-warm); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ng-card-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.ng-card-text b { font-size: 15.5px; color: var(--strong); } .ng-card-text small { font-size: 12.5px; color: var(--muted); }
.ng-card-state { font-size: 12.5px; font-weight: 700; color: var(--muted); text-align: right; flex: none; max-width: 42%; }
.ng-card-state.ok { color: var(--good); }
.ng-sizes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; padding: 3px; border-radius: 14px; background: var(--panel); border: 1px solid var(--edge); }
.ng-size { min-height: 44px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-weight: 750; font-size: 14px; cursor: pointer; font-variant-numeric: tabular-nums; }
.ng-size[aria-checked="true"] { background: var(--accent); color: #04121c; }
.ng-light .ng-size[aria-checked="true"] { color: #fff; }
.ng-levels { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.ng-lv { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 12px 14px; min-height: 88px; border-radius: 14px; border: 1px solid var(--btn-edge); background: var(--panel); color: var(--text); text-align: left; cursor: pointer; transition: border-color .15s, background-color .15s, opacity .15s; }
@media (hover: hover) { .ng-lv:hover:not(:disabled) { border-color: var(--accent); } }
.ng-lv:disabled { opacity: 0.4; cursor: default; }
.ng-lv.cur { border-color: var(--accent); }
.ng-lv b { font-size: 16px; color: var(--strong); }
.ng-lv small { font-size: 12px; color: var(--muted); line-height: 1.35; }
.ng-lv em { font-style: normal; font-size: 11.5px; color: var(--warm); font-weight: 650; margin-top: 2px; }
.ng-pips { display: inline-flex; gap: 3px; margin-bottom: 2px; }
.ng-pips i { width: 14px; height: 4px; border-radius: 2px; background: var(--chip); }
.ng-pips i.on { background: var(--accent); }

/* result */
.ng-res-pic { display: block; margin: 0 auto 8px; border-radius: 12px; box-shadow: 0 10px 34px rgba(0,0,0,0.45); image-rendering: pixelated; animation: ng-pop .5s cubic-bezier(.2,1.4,.4,1) both; }
.ng-res-name { margin: 2px 0 0; text-align: center; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--warm); font-weight: 800; }
.ng-res-time { margin: 2px 0 2px; text-align: center; font-size: 40px; font-weight: 800; color: var(--strong); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ng-res-stats { display: flex; justify-content: center; gap: 8px; margin: 14px 0 0; }
.ng-res-stats > div { flex: 1 1 0; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; text-align: center; }
.ng-res-stats b { display: block; font-size: 19px; color: var(--strong); font-variant-numeric: tabular-nums; }
.ng-res-stats span { font-size: 11.5px; color: var(--muted); }
.ng-board-list { margin: 12px 0 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ng-board-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 14px; border-bottom: 1px solid var(--line); }
.ng-board-list li:last-child { border-bottom: 0; }
.ng-board-list li.me { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.ng-board-list .r { width: 2.2em; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.ng-board-list .n { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--strong); }
.ng-board-list .t { font-weight: 750; font-variant-numeric: tabular-nums; }
.ng-board-empty { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.ng-table-wrap { overflow-x: auto; margin-top: 14px; }
.ng-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.ng-table th, .ng-table td { padding: 9px 6px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ng-table th:first-child { text-align: left; color: var(--strong); }
.ng-table thead th { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.ng-table small { color: var(--muted); }
.ng-help { margin: 0; padding: 0 0 0 18px; display: grid; gap: 8px; font-size: 14.5px; line-height: 1.45; }
.ng-help b { color: var(--strong); }
.ng-help-demo { display: block; margin: 4px auto 12px; max-width: 100%; }
.ng-set { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; }
.ng-set > span { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.ng-set b { font-size: 15px; color: var(--strong); } .ng-set small { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.ng-set input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ng-sw { flex: none; width: 46px; height: 28px; border-radius: 14px; background: var(--chip); position: relative; transition: background-color .15s; }
.ng-sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); transition: left .15s; }
.ng-set input:checked + .ng-sw { background: #2ec27e; }
.ng-set input:checked + .ng-sw::after { left: 21px; }
.ng-set input:focus-visible + .ng-sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.ng-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--panel); border: 1px solid var(--edge); flex: none; }
.ng-seg button { min-height: 34px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 700; font-size: 13px; cursor: pointer; }
.ng-seg button[aria-checked="true"] { background: var(--accent); color: #04121c; }
.ng-light .ng-seg button[aria-checked="true"] { color: #fff; }

/* album */
.ng-album-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 44px 4px 0; }
.ng-album-count { font-size: 13px; color: var(--muted); font-weight: 650; white-space: nowrap; }
.ng-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 10px; margin: 0 -4px; scrollbar-width: none; }
.ng-tabs::-webkit-scrollbar { display: none; }
.ng-tab { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--btn-edge); background: var(--panel); color: var(--muted); font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; }
.ng-tab[aria-selected="true"] { background: var(--accent); color: #04121c; border-color: var(--accent); }
.ng-light .ng-tab[aria-selected="true"] { color: #fff; }
.ng-tab small { font-weight: 650; opacity: 0.8; }
.ng-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.ng-pic { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; text-align: left; color: var(--text); transition: border-color .15s, transform .12s; min-width: 0; }
@media (hover: hover) { .ng-pic:hover { border-color: var(--accent); } }
.ng-pic:active { transform: scale(0.97); }
.ng-pic canvas { width: 100%; aspect-ratio: 1; border-radius: 8px; image-rendering: pixelated; display: block; }
.ng-pic b { font-size: 12px; color: var(--strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.ng-pic small { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; gap: 4px; white-space: nowrap; }
.ng-pic.locked b { color: var(--muted); }
.ng-pic.cur { border-color: var(--warm); }
.ng-pic .ng-pic-tick { position: absolute; top: 9px; right: 9px; width: 18px; height: 18px; border-radius: 50%; background: var(--good); display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0,0,0,0.4); }
.ng-pic .ng-pic-tick svg { width: 12px; height: 12px; fill: none; stroke: #062014; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ng-view { text-align: center; }
.ng-view canvas { width: min(100%, 300px); aspect-ratio: 1; border-radius: 14px; image-rendering: pixelated; box-shadow: 0 10px 30px rgba(0,0,0,0.4); }

@keyframes ng-fade { from { opacity: 0; } }
@keyframes ng-sheet { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
@keyframes ng-up { from { transform: translateY(100%); } }
@keyframes ng-spin { to { transform: rotate(360deg); } }
@keyframes ng-tip { from { opacity: 0; transform: translateY(-6px); } }
@keyframes ng-pop { from { opacity: 0; transform: scale(0.6) rotate(-4deg); } }
@keyframes ng-toast { 0% { opacity: 0; transform: translate(-50%, -6px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -4px); } }
@media (prefers-reduced-motion: reduce) { .ng *, .ng-scrim, .ng-sheet { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

.ng-tighthead .ng-daily span { display: none; }
.ng-tighthead .ng-daily { width: 40px; padding: 0; justify-content: center; }
.ng-tighthead .ng-head { gap: 6px; } .ng-tighthead .ng-ibtn { width: 34px; } .ng-tighthead .ng-game { padding: 0 6px 0 11px; font-size: 14px; }   /* a long title (25×25 · Expert) fits a 390px phone */

/* ---------- small screens ---------- */
@media (max-width: 520px) {
  .ng-scrim { align-items: flex-end; padding: 0; }
  .ng-sheet, .ng-sheet.ng-sheet-album { max-width: none; border-radius: 22px 22px 0 0; max-height: 90vh; padding: 20px 16px calc(18px + env(safe-area-inset-bottom, 0px)); animation-name: ng-up; border-bottom: 0; }
  .ng-scrim.out .ng-sheet { animation-name: ng-up; }
  .ng-daily span { display: none; }
  .ng-daily { width: 40px; padding: 0; justify-content: center; }
  .ng-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
  .ng-tool span, .ng-mode span { font-size: 11px; }
}
@media (max-width: 360px) { .ng-levels { grid-template-columns: 1fr; } .ng-ibtn { width: 36px; } }
@media (max-height: 500px) {
  .ng-land { row-gap: 8px; }
  .ng-land .ng-tool { min-height: 46px; font-size: 11px; }
  .ng-land .ng-mode { min-height: 44px; }
  .ng-land .ng-tool svg { width: 21px; height: 21px; }
}

/* landscape: the head wraps so the puzzle name is never cut, and tips sit in the side panel instead of over the board */
.ng-land .ng-head { flex-wrap: wrap; row-gap: 8px; }
.ng-land .ng-game { flex: 1 1 0; justify-content: space-between; }
.ng-land .ng-icons { width: 100%; justify-content: space-between; margin-left: 0; }
.ng-land > .ng-tip { position: relative; left: auto; right: auto; top: auto; bottom: auto; grid-area: side; align-self: start; }
