/* Quick-fire numeracy game (#numeracy). */
.ng { max-width: 640px; width: 100%; margin: 0 auto; }
.ng-h { font-size: 1.2rem; margin: 26px 0 10px; }
.ng-opts { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ng-opts.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ng-opt {
  font: inherit; font-weight: 700; font-size: 1.15rem; color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: 12px; padding: 14px 12px; cursor: pointer; text-align: center;
  display: grid; gap: 4px; align-content: start; transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.ng-opt b { font-size: 1.25rem; }
.ng-opt small { font-weight: 400; font-size: 0.85rem; color: var(--ink-2); line-height: 1.3; }
.ng-opt .ng-best { font-weight: 700; color: var(--pen); }
.ng-opt:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--hi); }
.ng-opt[aria-pressed="true"] { background: var(--ink); color: var(--paper); box-shadow: 4px 4px 0 var(--hi); transform: translate(-2px, -2px); }
.ng-opt[aria-pressed="true"] small { color: #d7def0; }
.ng-opt[aria-pressed="true"] .ng-best { color: var(--hi); }
.ng-note { margin-top: 14px; padding: 10px 14px; background: #fffbe0; border-left: 6px solid var(--hi); border-radius: 4px 10px 10px 4px; font-size: 0.95rem; }
.ng-go { display: block; width: 100%; margin-top: 24px; font-size: 1.5rem; padding: 14px; border-radius: 14px; animation: ng-breathe 2.2s ease-in-out infinite; }
@keyframes ng-breathe { 50% { transform: scale(1.025); box-shadow: 0 0 0 6px var(--pen-soft); } }

/* Playing */
.ng-bar { height: 14px; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; background: var(--paper); }
.ng-fill { height: 100%; background: var(--pen); transform-origin: left; transition: transform .1s linear, background .3s; }
.ng-play.late .ng-fill { background: var(--warn); }
.ng-top { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; font-weight: 700; font-size: 1.3rem; }
.ng-play.late .ng-time { color: var(--warn); animation: ng-pulse 1s ease-in-out infinite; }
@keyframes ng-pulse { 50% { transform: scale(1.15); } }
.ng-time { display: inline-block; }
.ng-score { display: inline-block; }
.ng-score.pop { animation: ng-pop .35s ease; }
@keyframes ng-pop { 40% { transform: scale(1.35); color: var(--good); } }
.ng-q { min-height: 150px; display: flex; align-items: center; justify-content: center; text-align: center; margin-top: 16px; overflow: hidden; }
.ng-q .ng-sum { font-size: clamp(2.3rem, 9vw, 3.4rem); font-weight: 700; white-space: nowrap; }
.ng-q .fr { font-size: 0.75em; }
.ng-sum.in { animation: ng-in .28s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes ng-in { from { opacity: 0; transform: translateX(40px) scale(.9); } }
.ng-count { font-size: 5rem; font-weight: 700; color: var(--pen); animation: ng-zoom .65s ease-out; }
@keyframes ng-zoom { from { transform: scale(2.2); opacity: 0; } 40% { opacity: 1; } to { transform: scale(.9); } }
.ng-in { position: relative; display: flex; gap: 10px; justify-content: center; align-items: center; }
.ng-ans {
  font: inherit; font-size: 2rem; font-weight: 700; text-align: center; width: 100%; max-width: 280px;
  padding: 8px 14px; border: 3px solid var(--ink); border-radius: 14px; background: var(--paper); color: var(--ink); caret-color: var(--pen);
}
.ng-ans:focus { outline: none; box-shadow: 4px 4px 0 var(--hi); }
.ng-play .ng-ans.bad { border-color: var(--warn); background: var(--warn-soft); animation: ng-shake .35s; }
@keyframes ng-shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.ng-skip { flex: none; }
.ng-tick { position: absolute; left: 50%; top: 50%; font-size: 3rem; font-weight: 700; color: var(--good); pointer-events: none; animation: ng-tick .6s ease-out forwards; }
@keyframes ng-tick { from { transform: translate(-50%, -50%) scale(.5); opacity: 1; } to { transform: translate(-50%, -160%) scale(1.4); opacity: 0; } }
.ng-play:has(.ng-tick) .ng-ans:not(.bad) { border-color: var(--good); }
.ng-tip { text-align: center; color: var(--ink-2); font-size: 0.9rem; margin-top: 12px; }

/* Phone keypad */
.ng-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.ng-pad button { font: inherit; font-size: 1.6rem; font-weight: 700; padding: 10px 0; border: 2px solid var(--ink); border-radius: 12px; background: var(--paper); color: var(--ink); -webkit-tap-highlight-color: transparent; }
.ng-pad button:active { background: var(--hi); transform: scale(.94); }
.ng-pad button.fn { background: var(--pen-soft); font-size: 1.2rem; }
.ng-pad button[data-k="space"] { grid-column: span 2; }

/* Results */
.ng-end { text-align: center; position: relative; }
.ng-up { font-size: 1.5rem; font-weight: 700; color: var(--ink-2); animation: ng-in .4s ease; }
.ng-big { font-size: 6rem; font-weight: 700; line-height: 1; margin-top: 6px; color: var(--pen); animation: ng-zoom .6s ease-out; }
.ng-sub { color: var(--ink-2); margin-top: 4px; }
.ng-rec { display: inline-block; margin-top: 14px; font-weight: 700; padding: 6px 14px; border-radius: 999px; background: var(--pen-soft); }
.ng-rec.new { background: var(--hi); animation: ng-pop .5s ease .4s both; }
.ng-btns { display: flex; justify-content: center; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.ng-btns .btn { font-size: 1.15rem; padding: 12px 26px; }
.ng-end .ng-h { margin-top: 32px; }
.ng-miss { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; text-align: left; }
.ng-miss li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; border: 2px solid var(--line); border-radius: 12px; background: var(--paper); flex-wrap: wrap; }
.ng-miss .ng-sum { font-size: 1.3rem; white-space: nowrap; }
.ng-miss b { color: var(--good); }
.ng-miss small { color: var(--ink-2); }
.ng-bit { position: absolute; top: 40px; width: 9px; height: 14px; border-radius: 2px; pointer-events: none; animation: ng-fall 1.5s ease-in forwards; }
@keyframes ng-fall { from { transform: translate(0, -20px) rotate(0); opacity: 1; } to { transform: translate(var(--dx), 360px) rotate(var(--r)); opacity: 0; } }

/* Homepage card */
.ng-home { display: flex; align-items: center; gap: 16px; margin-top: 18px; padding: 16px 20px; border: 2px solid var(--ink); border-radius: 12px; background: var(--hi); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.15rem; transition: transform .12s ease, box-shadow .12s ease; }
.ng-home:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--ink); }
.ng-home small { display: block; font-weight: 400; font-size: 0.9rem; color: var(--ink-2); }
.ng-home .ng-ico { font-size: 1.9rem; animation: ng-tock 1s steps(2) infinite; }
.ng-home .arrow { margin-left: auto; font-size: 1.4rem; }
@keyframes ng-tock { 50% { transform: rotate(-12deg); } }

@media (max-width: 560px) {
  .ng-opts { grid-template-columns: 1fr; }
  .ng-opt.lv { grid-template-columns: auto 1fr; text-align: left; align-items: baseline; column-gap: 12px; }
  .ng-opt.lv small { grid-column: 2; }
  .ng-opt.lv .ng-best { grid-column: 2; }
  .ng-q { min-height: 110px; margin-top: 8px; }
  main:has(.ng-play) { padding-top: 16px; }
}
@media (prefers-reduced-motion: reduce) { .ng *, .ng-home * { animation: none !important; } }
