/* Grade 1 interactive lesson widgets — designed to sit inside the notebook
   theme (paper background, ink strokes, mono labels). */

.g1-lesson { padding: 0 0 10px; }
.g1-stage {
  position: relative;
  background: var(--paper-card);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow-note);
  margin: 0 0 22px;
}
.g1-svg {
  display: block;
  width: 100%;
  height: auto;
  background: transparent;
  touch-action: manipulation;
}
.g1-svg text {
  font-family: var(--font-mono);
  font-size: 15px;
  fill: var(--ink);
}
.g1-svg .g1-label { font-weight: 700; }
.g1-svg .g1-faint { fill: var(--ink-soft); }
.g1-svg .g1-note { fill: var(--ink-faint); font-size: 13px; }
.g1-svg .g1-gridline { stroke: rgba(44, 43, 41, .14); stroke-width: 1; }
.g1-svg .g1-axis { stroke: var(--ink); stroke-width: 2; }

.g1-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px dashed var(--line);
}
.g1-controls .chip { font-size: .95rem; }
.g1-chip-label { font-family: var(--font-mono); font-size: 13px; color: var(--ink-soft); margin-right: 4px; }
.g1-readout {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--red-ink);
}
.g1-feedback {
  margin: 0;
  padding: 12px 16px;
  border-left: 4px solid var(--red-ink);
  background: rgba(255, 221, 89, .2);
  font-size: 15px !important;
  line-height: 1.6;
}
.g1-balance-shell { position: relative; }
.g1-new-puzzle {
  border-color: var(--red-ink) !important;
  background: var(--red-ink) !important;
  color: var(--paper) !important;
  font-weight: 700;
  box-shadow: 3px 3px 0 rgba(44, 43, 41, .16);
}
.g1-new-puzzle:hover,
.g1-new-puzzle:focus-visible {
  background: var(--ink) !important;
  border-color: var(--ink) !important;
  color: var(--paper) !important;
}
.g1-balance-answer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin: 12px 16px 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue-ink);
  background: rgba(26, 64, 102, .08);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
}
#balanceAnswer[hidden] { display: none; }
.g1-balance-answer-label {
  color: var(--blue-ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.g1-balance-answer strong { color: var(--ink); }
.g1-feedback.g1-feedback-win {
  border-left-color: var(--blue-ink);
  background: rgba(26, 64, 102, .1);
}
.g1-feedback.g1-feedback-wrong {
  border-left-color: var(--red-ink);
  background: rgba(156, 59, 53, .1);
}
.g1-check-answer {
  border-color: var(--blue-ink) !important;
  color: var(--blue-ink) !important;
  font-weight: 700;
}
.g1-check-answer:hover,
.g1-check-answer:focus-visible {
  background: var(--blue-ink) !important;
  color: var(--paper) !important;
}
.g1-controls .g1-control-locked {
  cursor: not-allowed;
  opacity: .48;
}
.g1-balance-cursor-note {
  position: fixed;
  z-index: 100;
  max-width: 300px;
  padding: 9px 12px;
  border: 1px solid var(--ink);
  background: var(--paper-card);
  box-shadow: 4px 4px 0 rgba(44, 43, 41, .16);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  pointer-events: none;
}
#balanceCursorNote[hidden] { display: none; }
.g1-balance-win {
  animation: g1-balance-celebrate .9s cubic-bezier(.2, .85, .35, 1.2);
}
.g1-balance-win::before {
  position: absolute;
  z-index: 2;
  top: 20px;
  right: 24%;
  color: var(--red-ink);
  content: "✦   ✧   ✦";
  font-family: var(--font-text);
  font-size: 24px;
  letter-spacing: 10px;
  pointer-events: none;
  animation: g1-balance-sparkle .9s ease-out both;
}
.g1-balance-win .geom-stage-card {
  box-shadow: 0 0 0 3px rgba(156, 59, 53, .18), 6px 6px 0 rgba(44, 43, 41, .1);
}
@keyframes g1-balance-celebrate {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-5px) scale(1.012); }
  58% { transform: translateY(1px) scale(.998); }
  82% { transform: translateY(-2px) scale(1.006); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes g1-balance-sparkle {
  0% { opacity: 0; transform: translateY(10px) scale(.65) rotate(-8deg); }
  35% { opacity: 1; transform: translateY(-2px) scale(1.1) rotate(4deg); }
  100% { opacity: 0; transform: translateY(-20px) scale(1.25) rotate(8deg); }
}
@media (prefers-reduced-motion: reduce) {
  .g1-balance-win,
  .g1-balance-win::before { animation: none; }
}

/* Big tap targets for small hands */
.g1-svg .g1-tap { cursor: pointer; }
.g1-svg .g1-tap:hover { filter: brightness(.93); }

/* Shared mini-panel styling used inside lesson bodies */
.g1-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 22px 0; }
@media (max-width: 760px) { .g1-cards { grid-template-columns: 1fr; } }
.g1-mini {
  border: 1px solid var(--ink);
  background: var(--paper-card);
  box-shadow: 4px 4px 0 rgba(44, 43, 41, .08);
  padding: 18px 20px;
}
.g1-mini h3 { margin: 0 0 8px; font-size: 1.25rem; }
.g1-mini p { margin: 0; }

.g1-quiz-options { display: flex; flex-wrap: wrap; gap: 10px; }
.g1-quiz-options .chip { font-size: 1.05rem; padding: 8px 16px; }
.g1-quiz-options .chip.correct { background: var(--ink); color: var(--paper); }
.g1-quiz-options .chip.wrong { background: var(--red-ink); color: var(--paper); }

/* Balance scale */
.g1-balance-frame { fill: none; stroke: var(--ink); stroke-width: 2.5; }
.g1-balance-needle { stroke: var(--red-ink); stroke-width: 3; transition: transform .5s cubic-bezier(.34,1.4,.5,1); transform-origin: 320px 330px; }
.g1-pan { fill: rgba(250, 247, 239, .9); stroke: var(--ink); stroke-width: 2; }
.g1-block { stroke: var(--ink); stroke-width: 1.5; }
.g1-block-1 { fill: #f3c969; }
.g1-block-2 { fill: #b7c68b; }
.g1-block-3 { fill: #e0946f; }

/* 120 chart */
.g1-chart-cell {
  stroke: rgba(44, 43, 41, .22);
  stroke-width: 1;
  fill: rgba(250, 247, 239, .75);
  cursor: pointer;
}
.g1-chart-cell:hover { fill: var(--yellow-mark); }
.g1-tap.g1-counted .g1-chart-cell { fill: rgba(183, 198, 139, .42); stroke: var(--blue-ink); stroke-width: 1.4; }
.g1-tap.g1-counted .g1-num { fill: var(--blue-ink); font-weight: 700; }
.g1-tap.g1-live { transform-box: fill-box; transform-origin: center; animation: g1-chart-hop .42s cubic-bezier(.2, .85, .35, 1.2); }
.g1-tap.g1-live .g1-chart-cell { fill: var(--yellow-mark); stroke: var(--ink); stroke-width: 1.8; }
.g1-tap.g1-live .g1-num { fill: var(--red-ink); font-weight: 700; }
@keyframes g1-chart-hop {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-5px) scale(1.08); }
  100% { transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .g1-tap.g1-live { animation: none; }
}

/* Place value mats */
.g1-mat { fill: rgba(250, 247, 239, .6); stroke: var(--ink); stroke-width: 1.5; }
.g1-place-shell { position: relative; }
.g1-addition-shell { position: relative; }
.g1-addition-new {
  min-width: 128px;
  border-color: var(--red-ink) !important;
  background: var(--red-ink) !important;
  color: var(--paper) !important;
  font-weight: 700;
  box-shadow: 3px 3px 0 rgba(44, 43, 41, .16);
}
.g1-addition-new:hover,
.g1-addition-new:focus-visible {
  border-color: var(--ink) !important;
  background: var(--ink) !important;
  color: var(--paper) !important;
}
.g1-addition-stage {
  padding: 10px 16px 14px;
  background-color: var(--paper-card);
}
.g1-addition-stage .geom-stage-svg { aspect-ratio: 760 / 300; }
.g1-addition-equation { fill: var(--ink); font-family: var(--font-text); font-size: 30px; font-weight: 700; }
.g1-addition-directions {
  margin: 12px 16px 0;
  padding: 12px 14px;
  border-left: 4px solid var(--blue-ink);
  background: rgba(26, 64, 102, .08);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
}
.g1-addition-directions strong { color: var(--ink); }
.g1-addition-make {
  border-color: var(--blue-ink) !important;
  color: var(--blue-ink) !important;
  font-weight: 700;
}
.g1-addition-make:hover,
.g1-addition-make:focus-visible {
  background: var(--blue-ink) !important;
  color: var(--paper) !important;
}
.g1-addition-step {
  margin: 18px 16px 0;
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
}
.g1-addition-board {
  margin: 0 12px;
  padding: 12px 10px 16px;
  border: 2px solid var(--ink);
  background: rgba(250, 247, 239, .72);
}
.g1-addition-frame { fill: rgba(250, 247, 239, .72); stroke: var(--ink); stroke-width: 1.8; }
.g1-addition-frame-complete { fill: rgba(183, 198, 139, .28); stroke: var(--blue-ink); stroke-width: 3; }
.g1-addition-loose-box { fill: rgba(250, 247, 239, .46); stroke: var(--ink); stroke-width: 1.8; }
.g1-addition-label { fill: var(--ink-soft); font-family: var(--font-mono); font-size: 15px; }
.g1-addition-blue-loose { cursor: grab; transition: transform .16s ease, filter .16s ease; }
.g1-addition-blue-loose:focus,
.g1-addition-blue-loose:hover,
.g1-addition-selected { filter: drop-shadow(0 0 5px rgba(177, 73, 67, .7)); stroke: var(--red-ink); stroke-width: 3; cursor: grabbing; }
.g1-addition-drag-ghost { pointer-events: none; opacity: .9; filter: drop-shadow(0 5px 5px rgba(44, 43, 41, .28)); }
.g1-addition-target-cell { stroke: var(--blue-ink); stroke-width: 2.5; stroke-dasharray: 4 3; cursor: pointer; }
.g1-addition-ten-callout { fill: var(--blue-ink); font-family: var(--font-text); font-size: 25px; font-weight: 700; }
.g1-addition-left-callout { fill: var(--red-ink); font-family: var(--font-mono); font-size: 16px; font-weight: 700; }
.g1-addition-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; min-height: 50px; margin: 14px 16px 0; }
.g1-addition-choice { min-width: 52px; min-height: 44px; padding: 8px 16px; border-color: var(--blue-ink) !important; color: var(--blue-ink) !important; font-size: 1.05rem; font-weight: 700; }
.g1-addition-choice:hover,
.g1-addition-choice:focus-visible { background: var(--blue-ink) !important; color: var(--paper) !important; }
.g1-addition-equation-area { margin: 14px 16px 0; }
.g1-addition-equation-build { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 28px; color: var(--ink); font-family: var(--font-mono); font-size: 1rem; font-weight: 700; }
.g1-addition-equation-box { display: inline-grid; min-width: 30px; padding: 2px 7px; border-bottom: 2px solid var(--red-ink); color: var(--red-ink); text-align: center; }
.g1-addition-copy { margin-top: 14px; }
@media (max-width: 700px) {
  .g1-addition-step { font-size: 1rem; }
  .g1-addition-equation-build { font-size: .9rem; }
}
.g1-place-new {
  min-width: 148px;
  border-color: var(--red-ink) !important;
  background: var(--red-ink) !important;
  color: var(--paper) !important;
  font-weight: 700;
  box-shadow: 3px 3px 0 rgba(44, 43, 41, .16);
}
.g1-place-new:hover,
.g1-place-new:focus-visible {
  border-color: var(--ink) !important;
  background: var(--ink) !important;
  color: var(--paper) !important;
}
.g1-place-stage {
  padding: 10px 16px 14px;
  background-color: var(--paper-card);
}
.g1-place-stage .geom-stage-svg { aspect-ratio: 720 / 470; }
.g1-place-target { fill: rgba(183, 198, 139, .3); stroke: var(--blue-ink); stroke-width: 1.5; }
.g1-place-target-text { fill: var(--ink); font-family: var(--font-mono); font-size: 22px; font-weight: 700; }
.g1-mat-tens { fill: rgba(201, 176, 106, .16); stroke: #8d6f2e; stroke-width: 2; }
.g1-mat-ones { fill: rgba(157, 180, 198, .16); stroke: var(--blue-ink); stroke-width: 2; }
.g1-rod { fill: #c9b06a; stroke: var(--ink); stroke-width: 1.2; }
.g1-cube { fill: #c9b06a; stroke: var(--ink); stroke-width: 1; }
.g1-place-shell .g1-rod { fill: #d3b873; stroke: #725d2b; stroke-width: 1.6; }
.g1-place-shell .g1-cube { fill: #9db4c6; stroke: #38566e; stroke-width: 1.5; }
.g1-compare-shell { position: relative; }
.g1-compare-mode {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(250, 247, 239, .48);
  backdrop-filter: blur(2px);
}
#cmpMode[hidden] { display: none; }
.g1-compare-mode-card {
  width: min(560px, 100%);
  padding: 28px;
  border: 1px solid var(--ink);
  background: rgba(250, 247, 239, .86);
  box-shadow: 6px 6px 0 rgba(44, 43, 41, .12);
  text-align: center;
}
.g1-compare-mode-card h2 { margin: 8px 0 10px; font-size: clamp(26px, 4vw, 36px); }
.g1-compare-mode-card p { margin: 0 auto 20px; max-width: 44ch; color: var(--ink-soft); line-height: 1.6; }
.g1-compare-mode-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.g1-compare-mode-button {
  min-width: 160px;
  border-color: var(--red-ink) !important;
  background: var(--red-ink) !important;
  color: var(--paper) !important;
  font-weight: 700;
}
.g1-compare-mode-button:hover,
.g1-compare-mode-button:focus-visible { border-color: var(--ink) !important; background: var(--ink) !important; }
.g1-start-shell { position: relative; }
.g1-start-overlay {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(250, 247, 239, .48);
  backdrop-filter: blur(2px);
}
.g1-start-overlay[hidden] { display: none; }
.g1-start-card {
  width: min(500px, 100%);
  padding: 28px;
  border: 1px solid var(--ink);
  background: rgba(250, 247, 239, .88);
  box-shadow: 6px 6px 0 rgba(44, 43, 41, .12);
  text-align: center;
}
.g1-start-card h2 { margin: 8px 0 10px; font-size: clamp(26px, 4vw, 36px); }
.g1-start-card p { margin: 0 auto 20px; max-width: 42ch; color: var(--ink-soft); line-height: 1.6; }
.g1-start-button {
  min-width: 160px;
  border-color: var(--red-ink) !important;
  background: var(--red-ink) !important;
  color: var(--paper) !important;
  font-weight: 700;
}
.g1-start-button:hover,
.g1-start-button:focus-visible { border-color: var(--ink) !important; background: var(--ink) !important; }
.g1-start-card.is-loading .g1-start-button {
  cursor: wait;
  opacity: .58;
}
.g1-compare-mode-card.is-loading .g1-compare-mode-button {
  cursor: wait;
  opacity: .58;
}
.g1-voice-loader {
  display: flex;
  min-height: 42px;
  margin: 0 auto 18px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--red-ink);
  font-family: var(--font-mono);
  font-size: 13px;
}
.g1-voice-loader[hidden] { display: none; }
.g1-voice-loader-dots { display: inline-flex; align-items: center; gap: 5px; }
.g1-voice-loader-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red-ink);
  animation: g1-voice-loading .9s ease-in-out infinite alternate;
}
.g1-voice-loader-dots i:nth-child(2) { animation-delay: .15s; }
.g1-voice-loader-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes g1-voice-loading {
  from { opacity: .3; transform: translateY(2px) scale(.82); }
  to { opacity: 1; transform: translateY(-3px) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  .g1-voice-loader-dots i { animation: none; opacity: .75; }
}
.g1-hear-again {
  display: inline-flex;
  min-width: 132px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-color: var(--blue-ink) !important;
  background: var(--blue-ink) !important;
  color: var(--paper) !important;
  font-family: var(--font-mono);
  font-size: 13px !important;
  font-weight: 700;
  box-shadow: 3px 3px 0 rgba(44, 43, 41, .14);
}
.g1-hear-again:hover:not(:disabled),
.g1-hear-again:focus-visible:not(:disabled) {
  border-color: var(--ink) !important;
  background: var(--ink) !important;
  color: var(--paper) !important;
  transform: translateY(-1px);
}
.g1-hear-again:disabled {
  cursor: not-allowed;
  opacity: .46;
}
.g1-hear-again.is-playing { cursor: wait; opacity: .72; }
.g1-hear-again-icon {
  display: inline-grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
}
@media (max-width: 620px) {
  .g1-hear-again { min-width: 122px; }
}
.g1-compare-controls { justify-content: center; align-items: center; }
.g1-compare-choose-controls,
.g1-compare-make-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.g1-compare-choose-controls[hidden],
.g1-compare-make-controls[hidden] { display: none; }
.g1-compare-new {
  min-width: 118px;
  border-color: var(--red-ink) !important;
  background: var(--red-ink) !important;
  color: var(--paper) !important;
  font-weight: 700;
  box-shadow: 3px 3px 0 rgba(44, 43, 41, .16);
}
.g1-compare-new:hover,
.g1-compare-new:focus-visible {
  border-color: var(--ink) !important;
  background: var(--ink) !important;
  color: var(--paper) !important;
}
.g1-compare-exit {
  min-width: 112px;
  border-color: var(--ink) !important;
  background: transparent !important;
  color: var(--ink) !important;
  font-weight: 700;
}
.g1-compare-exit:hover,
.g1-compare-exit:focus-visible {
  background: var(--ink) !important;
  color: var(--paper) !important;
}
.g1-compare-exit-confirm { z-index: 40; }
.g1-compare-exit-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.g1-compare-stay,
.g1-compare-confirm-exit {
  min-width: 130px;
  font-weight: 700;
}
.g1-compare-confirm-exit {
  border-color: var(--red-ink) !important;
  background: var(--red-ink) !important;
  color: var(--paper) !important;
}
.g1-compare-stage {
  padding: 10px 16px 14px;
  background-color: var(--paper-card);
}
.g1-compare-stage .geom-stage-svg { aspect-ratio: 720 / 470; }
.g1-compare-mat-left { fill: rgba(201, 176, 106, .12); stroke: #8d6f2e; stroke-width: 2; }
.g1-compare-mat-right { fill: rgba(157, 180, 198, .12); stroke: var(--blue-ink); stroke-width: 2; }
.g1-compare-clickable { cursor: pointer; outline: none; }
.g1-compare-clickable:hover .g1-mat,
.g1-compare-clickable:focus .g1-mat { filter: brightness(.97); stroke-width: 3; }
.g1-compare-target-delta {
  fill: var(--blue-ink);
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
}
.g1-compare-target-symbol {
  fill: var(--red-ink);
  font-family: var(--font-text);
  font-size: 64px;
  font-weight: 700;
}
.g1-compare-shell .g1-rod { fill: #d3b873; stroke: #725d2b; stroke-width: 1.6; }
.g1-compare-shell .g1-cube { fill: #9db4c6; stroke: #38566e; stroke-width: 1.5; }
.g1-compare-win { animation: g1-compare-celebrate .9s cubic-bezier(.2, .85, .35, 1.2); }
.g1-compare-wrong { animation: g1-compare-shake .38s ease; }
.g1-compare-win::before {
  position: absolute;
  z-index: 2;
  top: 24px;
  right: 22%;
  color: var(--red-ink);
  content: "✦   ✧   ✦";
  font-family: var(--font-text);
  font-size: 24px;
  letter-spacing: 10px;
  pointer-events: none;
  animation: g1-compare-sparkle .9s ease-out both;
}
@keyframes g1-compare-celebrate {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-5px) scale(1.012); }
  58% { transform: translateY(1px) scale(.998); }
  82% { transform: translateY(-2px) scale(1.006); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes g1-compare-sparkle {
  0% { opacity: 0; transform: translateY(10px) scale(.65) rotate(-8deg); }
  35% { opacity: 1; transform: translateY(-2px) scale(1.1) rotate(4deg); }
  100% { opacity: 0; transform: translateY(-20px) scale(1.25) rotate(8deg); }
}
@keyframes g1-compare-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@media (prefers-reduced-motion: reduce) {
  .g1-compare-win,
  .g1-compare-win::before,
  .g1-compare-wrong { animation: none; }
}
.g1-place-win {
  animation: g1-place-celebrate .9s cubic-bezier(.2, .85, .35, 1.2);
}
.g1-place-wrong { animation: g1-place-shake .38s ease; }
.g1-place-win::before {
  position: absolute;
  z-index: 2;
  top: 24px;
  right: 22%;
  color: var(--red-ink);
  content: "✦   ✧   ✦";
  font-family: var(--font-text);
  font-size: 24px;
  letter-spacing: 10px;
  pointer-events: none;
  animation: g1-place-sparkle .9s ease-out both;
}
@keyframes g1-place-celebrate {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-5px) scale(1.012); }
  58% { transform: translateY(1px) scale(.998); }
  82% { transform: translateY(-2px) scale(1.006); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes g1-place-sparkle {
  0% { opacity: 0; transform: translateY(10px) scale(.65) rotate(-8deg); }
  35% { opacity: 1; transform: translateY(-2px) scale(1.1) rotate(4deg); }
  100% { opacity: 0; transform: translateY(-20px) scale(1.25) rotate(8deg); }
}
@keyframes g1-place-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@media (prefers-reduced-motion: reduce) {
  .g1-place-win,
  .g1-place-win::before,
  .g1-place-wrong { animation: none; }
}
.g1-rod-ghost, .g1-cube-ghost { fill: rgba(201, 176, 106, .35); stroke: rgba(44, 43, 41, .35); stroke-width: 1; stroke-dasharray: 4 3; }

/* Ten frame */
.g1-cell { fill: rgba(250, 247, 239, .85); stroke: var(--ink); stroke-width: 1.5; }
.g1-dot { fill: var(--red-ink); }
.g1-dot-2 { fill: var(--blue-ink); }

/* Clock */
.g1-clock-shell { position: relative; }
.g1-clock-game {
  width: min(900px, 100%);
  margin: 0 auto;
}
.g1-clock-question {
  margin: 4px 0 12px;
  padding: 13px 18px;
  border-left: 4px solid var(--red-ink);
  background: rgba(156, 59, 53, .07);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(16px, 2.4vw, 21px);
  font-weight: 700;
  text-align: center;
}
.g1-clock-stage {
  width: min(620px, 100%);
  margin: 0 auto;
  padding: 8px 10px;
  background-color: var(--paper-card);
}
.g1-clock-stage .geom-stage-svg { aspect-ratio: 520 / 400; }
.g1-clock-face {
  fill: rgba(250, 247, 239, .96);
  stroke: var(--ink);
  stroke-width: 3;
  filter: drop-shadow(5px 6px 0 rgba(44, 43, 41, .08));
}
.g1-clock-tick { stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
.g1-clock-number {
  fill: var(--ink);
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
}
.g1-hour-hand {
  stroke: var(--ink);
  stroke-width: 8;
  stroke-linecap: round;
}
.g1-minute-hand {
  stroke: var(--red-ink);
  stroke-width: 5;
  stroke-linecap: round;
}
.g1-clock-center { fill: var(--red-ink); }
.g1-clock-pin { fill: var(--paper-card); }
.g1-clock-controls {
  justify-content: center;
  padding: 15px 10px 10px;
  border-top: 0;
}
.g1-clock-adjust-row {
  display: flex;
  flex: 1 0 100%;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.g1-clock-adjust-row .chip {
  min-width: 142px;
  font-weight: 700;
}
.g1-clock-controls .g1-check-answer {
  min-width: 156px;
  margin-top: 2px;
}
.g1-clock-controls .g1-readout {
  flex: 1 0 100%;
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-weight: 700;
  text-align: center;
}
.g1-clock-feedback {
  min-height: 58px;
  margin: 2px 0 0;
}
.g1-clock-new {
  min-width: 118px;
  border-color: var(--red-ink) !important;
  background: var(--red-ink) !important;
  color: var(--paper) !important;
  font-weight: 700;
  box-shadow: 3px 3px 0 rgba(44, 43, 41, .16);
}
.g1-clock-new:hover,
.g1-clock-new:focus-visible {
  border-color: var(--ink) !important;
  background: var(--ink) !important;
  color: var(--paper) !important;
}
.g1-clock-win { animation: g1-clock-celebrate .9s cubic-bezier(.2, .85, .35, 1.2); }
.g1-clock-win::before {
  position: absolute;
  z-index: 3;
  top: 22px;
  right: 22%;
  color: var(--red-ink);
  content: "✦   ✧   ✦";
  font-family: var(--font-text);
  font-size: 24px;
  letter-spacing: 10px;
  pointer-events: none;
  animation: g1-clock-sparkle .9s ease-out both;
}
.g1-clock-wrong { animation: g1-clock-shake .38s ease; }
@keyframes g1-clock-celebrate {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-5px) scale(1.012); }
  58% { transform: translateY(1px) scale(.998); }
  82% { transform: translateY(-2px) scale(1.006); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes g1-clock-sparkle {
  0% { opacity: 0; transform: translateY(10px) scale(.65) rotate(-8deg); }
  35% { opacity: 1; transform: translateY(-2px) scale(1.1) rotate(4deg); }
  100% { opacity: 0; transform: translateY(-20px) scale(1.25) rotate(8deg); }
}
@keyframes g1-clock-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@media (max-width: 720px) {
  .g1-clock-game { width: 100%; }
  .g1-clock-stage { padding: 5px; }
  .g1-clock-adjust-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g1-clock-adjust-row .chip { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .g1-clock-win,
  .g1-clock-win::before,
  .g1-clock-wrong { animation: none; }
}

/* Length rail */
.g1-rail { stroke: var(--ink); stroke-width: 2.5; }
.g1-obj { stroke: var(--ink); stroke-width: 1.6; }
.g1-length-shell { position: relative; }
.g1-length-question {
  margin: 4px 0 12px;
  padding: 13px 18px;
  border-left: 4px solid var(--red-ink);
  background: rgba(156, 59, 53, .07);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(16px, 2.4vw, 21px);
  font-weight: 700;
  text-align: center;
}
.g1-length-stage {
  padding: 8px 14px 10px;
  background-color: var(--paper-card);
}
.g1-length-stage .geom-stage-svg { aspect-ratio: 720 / 320; }
.g1-length-choice-card {
  fill: rgba(250, 247, 239, .7);
  stroke: rgba(44, 43, 41, .28);
  stroke-width: 1.4;
  transition: fill .16s ease, stroke .16s ease;
}
.g1-length-object {
  cursor: pointer;
  outline: none;
}
.g1-length-object:hover .g1-length-choice-card,
.g1-length-object:focus .g1-length-choice-card {
  fill: rgba(157, 180, 198, .13);
  stroke: var(--blue-ink);
  stroke-width: 2.2;
}
.g1-length-object.is-locked { cursor: default; }
.g1-length-object.is-correct .g1-length-choice-card {
  fill: rgba(183, 198, 139, .2);
  stroke: #60743a;
  stroke-width: 2.5;
}
.g1-length-object.is-wrong .g1-length-choice-card {
  fill: rgba(156, 59, 53, .09);
  stroke: var(--red-ink);
  stroke-width: 2.3;
}
.g1-length-object-name {
  fill: var(--ink);
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
}
.g1-length-art-main {
  stroke: var(--ink);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.g1-length-art-detail {
  fill: none;
  stroke: rgba(44, 43, 41, .5);
  stroke-width: 1.4;
}
.g1-length-pencil-eraser { fill: #d9898a; }
.g1-length-pencil-wood { fill: #e6c699; }
.g1-length-pencil-lead { fill: var(--ink); }
.g1-length-crayon-wrapper {
  fill: rgba(250, 247, 239, .55);
  stroke: rgba(44, 43, 41, .45);
  stroke-width: 1.2;
}
.g1-length-animal-body {
  fill: none;
  stroke-width: 17;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.g1-length-animal-eye { fill: var(--ink); }
.g1-length-snake-tongue {
  fill: none;
  stroke: var(--red-ink);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.g1-length-worm-segment { stroke-width: 1.1; }
.g1-length-worm-smile {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.2;
  stroke-linecap: round;
}
.g1-length-scarf-fringe {
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linecap: round;
}
.g1-length-scarf-stripe {
  stroke: rgba(250, 247, 239, .7);
  stroke-width: 7;
}
.g1-length-ribbon-tail {
  fill: none;
  stroke-width: 13;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.g1-length-vehicle-window {
  fill: #e4f0f5;
  stroke: var(--ink);
  stroke-width: 1.2;
  stroke-linejoin: round;
}
.g1-length-vehicle-wheel { fill: #3c3b39; stroke-width: 1.2; }
.g1-length-truck-panel {
  stroke: rgba(44, 43, 41, .45);
  stroke-width: 1.5;
}
.g1-length-start-mark {
  stroke: var(--red-ink);
  stroke-width: 2;
  stroke-dasharray: 5 4;
}
.g1-length-end-mark {
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-dasharray: 3 3;
  pointer-events: none;
}
.g1-length-common-line {
  stroke: var(--red-ink);
  stroke-width: 2.4;
  stroke-dasharray: 7 6;
  pointer-events: none;
}
.g1-length-start-caption {
  fill: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 13px;
}
.g1-length-result-mark {
  fill: #60743a;
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
}
.g1-length-controls {
  min-height: 48px;
  justify-content: center;
}
.g1-length-controls .g1-readout { margin-left: 0; }
.g1-length-feedback { min-height: 58px; }
.g1-length-new {
  min-width: 118px;
  border-color: var(--red-ink) !important;
  background: var(--red-ink) !important;
  color: var(--paper) !important;
  font-weight: 700;
  box-shadow: 3px 3px 0 rgba(44, 43, 41, .16);
}
.g1-length-new:hover,
.g1-length-new:focus-visible {
  border-color: var(--ink) !important;
  background: var(--ink) !important;
  color: var(--paper) !important;
}
.g1-length-win { animation: g1-length-celebrate .9s cubic-bezier(.2, .85, .35, 1.2); }
.g1-length-wrong { animation: g1-length-shake .38s ease; }
.g1-length-win::before {
  position: absolute;
  z-index: 2;
  top: 22px;
  right: 22%;
  color: var(--red-ink);
  content: "✦   ✧   ✦";
  font-family: var(--font-text);
  font-size: 24px;
  letter-spacing: 10px;
  pointer-events: none;
  animation: g1-length-sparkle .9s ease-out both;
}
@keyframes g1-length-celebrate {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-5px) scale(1.012); }
  58% { transform: translateY(1px) scale(.998); }
  82% { transform: translateY(-2px) scale(1.006); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes g1-length-sparkle {
  0% { opacity: 0; transform: translateY(10px) scale(.65) rotate(-8deg); }
  35% { opacity: 1; transform: translateY(-2px) scale(1.1) rotate(4deg); }
  100% { opacity: 0; transform: translateY(-20px) scale(1.25) rotate(8deg); }
}
@keyframes g1-length-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@media (max-width: 720px) {
  .g1-length-stage { padding: 5px 6px 7px; }
  .g1-length-object-name { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .g1-length-win,
  .g1-length-win::before,
  .g1-length-wrong { animation: none; }
}

/* Ordering by size */
.g1-order-shell { position: relative; }
.g1-order-question {
  margin: 4px 0 12px;
  padding: 13px 18px;
  border-left: 4px solid var(--red-ink);
  background: rgba(156, 59, 53, .07);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(16px, 2.4vw, 21px);
  font-weight: 700;
  text-align: center;
}
.g1-order-stage {
  padding: 8px 12px 10px;
  background-color: var(--paper-card);
  touch-action: none;
  user-select: none;
}
.g1-order-stage .geom-stage-svg { aspect-ratio: 760 / 430; }
.g1-order-column-title {
  fill: var(--ink);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
}
.g1-order-tray-card {
  fill: rgba(250, 247, 239, .72);
  stroke: rgba(44, 43, 41, .3);
  stroke-width: 1.4;
}
.g1-order-object-name {
  fill: var(--ink);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
}
.g1-order-draggable {
  cursor: grab;
  outline: none;
  touch-action: none;
}
.g1-order-draggable:active { cursor: grabbing; }
.g1-order-draggable:hover .g1-length-art-main,
.g1-order-draggable:focus .g1-length-art-main { stroke-width: 2.6; }
.g1-order-draggable.is-dragging { opacity: .28; }
.g1-order-drag-ghost {
  filter: drop-shadow(4px 5px 3px rgba(44, 43, 41, .22));
  opacity: .94;
  pointer-events: none;
}
.g1-order-drop-box {
  fill: rgba(157, 180, 198, .07);
  stroke: rgba(44, 43, 41, .4);
  stroke-width: 1.6;
  stroke-dasharray: 7 5;
  transition: fill .14s ease, stroke .14s ease;
}
.g1-order-drop-box.is-ready { fill: rgba(232, 201, 122, .12); }
.g1-order-drop-box.is-drag-over {
  fill: rgba(183, 198, 139, .25);
  stroke: #60743a;
  stroke-width: 2.5;
  stroke-dasharray: none;
}
.g1-order-drop-box.is-filled {
  fill: rgba(183, 198, 139, .14);
  stroke: #60743a;
  stroke-dasharray: none;
}
.g1-order-drop-group { outline: none; }
.g1-order-drop-group:focus .g1-order-drop-box {
  stroke: var(--blue-ink);
  stroke-width: 2.4;
}
.g1-order-slot-label {
  fill: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
}
.g1-order-placed-note {
  fill: #60743a;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
}
.g1-order-drag-hint {
  fill: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 13px;
}
.g1-order-controls { justify-content: center; }
.g1-order-controls .g1-readout { margin-left: 0; }
.g1-order-feedback { min-height: 58px; }
.g1-order-new {
  min-width: 126px;
  border-color: var(--red-ink) !important;
  background: var(--red-ink) !important;
  color: var(--paper) !important;
  font-weight: 700;
  box-shadow: 3px 3px 0 rgba(44, 43, 41, .16);
}
.g1-order-new:hover,
.g1-order-new:focus-visible {
  border-color: var(--ink) !important;
  background: var(--ink) !important;
  color: var(--paper) !important;
}
.g1-order-win { animation: g1-order-celebrate .9s cubic-bezier(.2, .85, .35, 1.2); }
.g1-order-wrong { animation: g1-order-shake .38s ease; }
.g1-order-win::before {
  position: absolute;
  z-index: 2;
  top: 22px;
  right: 22%;
  color: var(--red-ink);
  content: "✦   ✧   ✦";
  font-family: var(--font-text);
  font-size: 24px;
  letter-spacing: 10px;
  pointer-events: none;
  animation: g1-order-sparkle .9s ease-out both;
}
@keyframes g1-order-celebrate {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-5px) scale(1.012); }
  58% { transform: translateY(1px) scale(.998); }
  82% { transform: translateY(-2px) scale(1.006); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes g1-order-sparkle {
  0% { opacity: 0; transform: translateY(10px) scale(.65) rotate(-8deg); }
  35% { opacity: 1; transform: translateY(-2px) scale(1.1) rotate(4deg); }
  100% { opacity: 0; transform: translateY(-20px) scale(1.25) rotate(8deg); }
}
@keyframes g1-order-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@media (max-width: 720px) {
  .g1-order-stage { padding: 5px 4px 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .g1-order-win,
  .g1-order-win::before,
  .g1-order-wrong { animation: none; }
}

/* Tally */
.g1-tally-shell { position: relative; }
.g1-tally-game {
  width: min(940px, 100%);
  margin: 0 auto;
}
.g1-tally-mode-options,
.g1-tally-tutorial-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.g1-tally-tutorial-start {
  min-width: 160px;
  border-color: var(--blue-ink) !important;
  color: var(--blue-ink) !important;
  font-weight: 700;
}
.g1-tally-tutorial-start:hover,
.g1-tally-tutorial-start:focus-visible {
  background: var(--blue-ink) !important;
  color: var(--paper) !important;
}
.g1-tally-tutorial-overlay {
  position: absolute;
  z-index: 42;
  inset: 0;
  display: grid;
  place-items: start center;
  padding: 22px;
  background: rgba(250, 247, 239, .78);
  backdrop-filter: blur(3px);
  overflow-y: auto;
}
.g1-tally-tutorial-overlay[hidden] { display: none; }
.g1-tally-tutorial-card {
  position: relative;
  width: min(980px, 100%);
  padding: 24px;
  border: 1px solid var(--ink);
  background: var(--paper-card);
  box-shadow: 8px 8px 0 rgba(44, 43, 41, .14);
}
.g1-tally-tutorial-card h2 {
  margin: 6px 42px 8px 0;
  font-size: clamp(24px, 4vw, 34px);
}
.g1-tally-tutorial-card > p {
  margin: 0 42px 14px 0;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 14px;
}
.g1-tally-tutorial-close {
  position: absolute;
  top: 12px;
  right: 14px;
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--red-ink);
  place-items: center;
  font: 700 24px/1 var(--font-mono);
  cursor: pointer;
}
.g1-tally-tutorial-close:hover,
.g1-tally-tutorial-close:focus-visible {
  background: var(--red-ink);
  color: var(--paper);
}
.g1-tally-tutorial-stage {
  width: min(840px, 100%);
  margin: 0 auto 14px;
  padding: 5px;
}
.g1-tally-tutorial-stage .geom-stage-svg { aspect-ratio: 760 / 420; }
.g1-tally-tutorial-stage .g1-tally-row {
  cursor: default;
  pointer-events: none;
}
.g1-tally-question {
  margin: 4px 0 12px;
  padding: 13px 18px;
  border-left: 4px solid var(--red-ink);
  background: rgba(156, 59, 53, .07);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(15px, 2.2vw, 20px);
  font-weight: 700;
  text-align: center;
}
.g1-tally-stage {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 6px 8px;
  background-color: var(--paper-card);
}
.g1-tally-stage .geom-stage-svg { aspect-ratio: 760 / 350; }
.g1-tally-stage .g1-tally-row { cursor: default; }
.g1-tally-row {
  cursor: pointer;
  outline: none;
}
.g1-tally-row-card {
  fill: rgba(250, 247, 239, .76);
  stroke: rgba(44, 43, 41, .48);
  stroke-width: 1.5;
  transition: fill .16s ease, stroke .16s ease;
}
.g1-tally-row:hover .g1-tally-row-card,
.g1-tally-row:focus .g1-tally-row-card {
  fill: rgba(157, 180, 198, .13);
  stroke: var(--blue-ink);
  stroke-width: 2.2;
}
.g1-tally-row.is-correct .g1-tally-row-card {
  fill: rgba(183, 198, 139, .22);
  stroke: #60743a;
  stroke-width: 2.4;
}
.g1-tally-row.is-wrong .g1-tally-row-card {
  fill: rgba(156, 59, 53, .1);
  stroke: var(--red-ink);
  stroke-width: 2.4;
}
.g1-tally-row.is-full { cursor: default; }
.g1-tally-label-card {
  stroke: rgba(44, 43, 41, .5);
  stroke-width: 1.4;
}
.g1-tally-shell .g1-tally-category {
  fill: var(--ink);
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
}
.g1-tally { stroke: var(--ink); stroke-width: 4.5; stroke-linecap: round; }
.g1-tally-band { stroke: var(--red-ink); stroke-width: 4.5; stroke-linecap: round; }
.g1-tally-shell .g1-tally-count {
  fill: var(--red-ink);
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
}
.g1-tally-minus { cursor: pointer; outline: none; }
.g1-tally-minus-card {
  fill: rgba(250, 247, 239, .92);
  stroke: var(--ink);
  stroke-width: 1.4;
}
.g1-tally-minus:hover .g1-tally-minus-card,
.g1-tally-minus:focus .g1-tally-minus-card {
  fill: rgba(156, 59, 53, .1);
  stroke: var(--red-ink);
  stroke-width: 2;
}
.g1-tally-shell .g1-tally-minus-label {
  fill: var(--red-ink);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  pointer-events: none;
}
.g1-tally-demo-check {
  fill: var(--blue-ink);
  stroke: var(--ink);
  stroke-width: 1.5;
}
.g1-tally-shell .g1-tally-demo-check-label {
  fill: var(--paper-card);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
}
.g1-tally-demo-pointer {
  filter: drop-shadow(2px 3px 0 rgba(44, 43, 41, .16));
  pointer-events: none;
}
.g1-tally-pointer-arrow {
  fill: var(--paper-card);
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linejoin: round;
}
.g1-tally-pointer-pulse {
  fill: rgba(156, 59, 53, .08);
  stroke: var(--red-ink);
  stroke-width: 2;
  opacity: .4;
}
.g1-tally-demo-pointer.is-clicking .g1-tally-pointer-arrow {
  transform-box: fill-box;
  transform-origin: 0 0;
  animation: g1-tally-pointer-click .24s ease;
}
.g1-tally-demo-pointer.is-clicking .g1-tally-pointer-pulse {
  animation: g1-tally-pointer-pulse .35s ease-out;
}
.g1-tally-controls {
  justify-content: center;
  padding: 14px 10px 10px;
  border-top: 0;
}
.g1-tally-options {
  display: flex;
  flex: 1 0 100%;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.g1-tally-choice {
  min-width: 104px;
  font-weight: 700;
}
.g1-tally-choice.has-icon {
  display: inline-flex;
  min-width: 86px;
  min-height: 66px;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  line-height: 1;
}
.g1-tally-choice.has-tie-icons {
  min-width: 150px;
  gap: 8px;
}
.g1-tally-choice-icon {
  display: block;
  width: 64px;
  height: 52px;
  overflow: visible;
  pointer-events: none;
}
.g1-tally-choice-icon--tie {
  width: auto;
  max-width: 152px;
}
.g1-tally-tie-label {
  color: inherit;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}
.g1-tally-choice.is-selected {
  border-color: var(--blue-ink) !important;
  background: rgba(26, 64, 102, .1) !important;
  color: var(--blue-ink) !important;
  box-shadow: inset 0 0 0 1px var(--blue-ink);
}
.g1-tally-choice.correct {
  border-color: var(--blue-ink) !important;
  background: var(--blue-ink) !important;
  color: var(--paper) !important;
}
.g1-tally-choice.wrong {
  border-color: var(--red-ink) !important;
  background: rgba(156, 59, 53, .12) !important;
  color: var(--red-ink) !important;
}
.g1-tally-controls .g1-check-answer {
  border-color: var(--blue-ink) !important;
  background: var(--blue-ink) !important;
  color: var(--paper) !important;
  font-weight: 700;
  box-shadow: 3px 3px 0 rgba(44, 43, 41, .16);
}
.g1-tally-controls .g1-check-answer:hover,
.g1-tally-controls .g1-check-answer:focus-visible {
  border-color: var(--ink) !important;
  background: var(--ink) !important;
  color: var(--paper) !important;
}
.g1-tally-controls .g1-readout {
  flex: 1 0 100%;
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-weight: 700;
  text-align: center;
}
.g1-tally-feedback {
  min-height: 58px;
  margin: 2px 0 0;
}
.g1-tally-new {
  min-width: 124px;
  border-color: var(--red-ink) !important;
  background: var(--red-ink) !important;
  color: var(--paper) !important;
  font-weight: 700;
  box-shadow: 3px 3px 0 rgba(44, 43, 41, .16);
}
.g1-tally-new:hover,
.g1-tally-new:focus-visible {
  border-color: var(--ink) !important;
  background: var(--ink) !important;
  color: var(--paper) !important;
}
.g1-tally-win { animation: g1-tally-celebrate .8s cubic-bezier(.2, .85, .35, 1.2); }
.g1-tally-win::before {
  position: absolute;
  z-index: 3;
  top: 22px;
  right: 22%;
  color: var(--red-ink);
  content: "✦   ✧   ✦";
  font-family: var(--font-text);
  font-size: 24px;
  letter-spacing: 10px;
  pointer-events: none;
  animation: g1-tally-sparkle .8s ease-out both;
}
.g1-tally-wrong { animation: g1-tally-shake .38s ease; }
@keyframes g1-tally-celebrate {
  0% { transform: translateY(0) scale(1); }
  32% { transform: translateY(-4px) scale(1.01); }
  68% { transform: translateY(1px) scale(.998); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes g1-tally-sparkle {
  0% { opacity: 0; transform: translateY(9px) scale(.65); }
  38% { opacity: 1; transform: translateY(-2px) scale(1.08); }
  100% { opacity: 0; transform: translateY(-18px) scale(1.2); }
}
@keyframes g1-tally-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@keyframes g1-tally-pointer-click {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(.78); }
}
@keyframes g1-tally-pointer-pulse {
  0% { opacity: .7; transform: scale(.55); }
  100% { opacity: 0; transform: scale(1.55); }
}
@media (max-width: 720px) {
  .g1-tally-stage { padding: 4px 3px; }
  .g1-tally-controls { align-items: stretch; }
  .g1-tally-controls .chip { flex: 1 1 150px; }
  .g1-tally-tutorial-overlay { padding: 10px; }
  .g1-tally-tutorial-card { padding: 18px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .g1-tally-win,
  .g1-tally-win::before,
  .g1-tally-wrong,
  .g1-tally-demo-pointer.is-clicking .g1-tally-pointer-arrow,
  .g1-tally-demo-pointer.is-clicking .g1-tally-pointer-pulse { animation: none; }
}

/* Picture graph */
.g1-picture-shell { position: relative; }
.g1-picture-game {
  width: min(940px, 100%);
  margin: 0 auto;
}
.g1-picture-question {
  margin: 4px 0 12px;
  padding: 13px 18px;
  border-left: 4px solid var(--red-ink);
  background: rgba(156, 59, 53, .07);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(15px, 2.2vw, 20px);
  font-weight: 700;
  text-align: center;
}
.g1-picture-stage {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 6px 8px;
  background-color: var(--paper-card);
}
.g1-picture-stage .geom-stage-svg { aspect-ratio: 760 / 340; }
.g1-picture-row {
  cursor: pointer;
  outline: none;
}
.g1-picture-row-card {
  fill: rgba(250, 247, 239, .76);
  stroke: rgba(44, 43, 41, .46);
  stroke-width: 1.5;
  transition: fill .16s ease, stroke .16s ease;
}
.g1-picture-row:hover .g1-picture-row-card,
.g1-picture-row:focus .g1-picture-row-card {
  fill: rgba(157, 180, 198, .13);
  stroke: var(--blue-ink);
  stroke-width: 2.2;
}
.g1-picture-label-card {
  fill-opacity: .35;
  stroke: rgba(44, 43, 41, .5);
  stroke-width: 1.4;
}
.g1-picture-shell .g1-picture-label {
  fill: var(--ink);
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
}
.g1-picture-shell .g1-picture-count {
  fill: var(--red-ink);
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
}
.g1-picture-icon {
  opacity: .9;
  transition: opacity .14s ease, filter .14s ease;
}
.g1-picture-icon.is-counted {
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(26, 64, 102, .28));
}
.g1-picture-icon.is-current {
  transform-box: fill-box;
  transform-origin: center;
  animation: g1-picture-count-pop .3s ease;
}
.g1-apple-body {
  fill: #dc684c;
  stroke: var(--ink);
  stroke-width: 1.5;
}
.g1-fruit-stem {
  fill: none;
  stroke: #765035;
  stroke-width: 4;
  stroke-linecap: round;
}
.g1-fruit-leaf {
  fill: #73925f;
  stroke: #4f7043;
  stroke-width: 1;
}
.g1-fruit-highlight {
  fill: none;
  stroke: rgba(255, 245, 225, .6);
  stroke-width: 2.4;
  stroke-linecap: round;
}
.g1-banana-body {
  fill: #f0c957;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linejoin: round;
}
.g1-banana-ridge {
  fill: none;
  stroke: #c79b35;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.g1-banana-tip {
  fill: none;
  stroke: #765035;
  stroke-width: 4;
  stroke-linecap: round;
}
.g1-banana-highlight { fill: rgba(255, 244, 180, .48); }
.g1-grape-berry {
  fill: #9569ae;
  stroke: #684c78;
  stroke-width: 1;
}
.g1-grape-berry.berry-1 { fill: #a87abe; }
.g1-grape-berry.berry-2 { fill: #875d9e; }
.g1-orange-body {
  fill: #e99a45;
  stroke: var(--ink);
  stroke-width: 1.5;
}
.g1-orange-dimple { fill: rgba(170, 103, 36, .55); }
.g1-strawberry-body {
  fill: #d95d55;
  stroke: var(--ink);
  stroke-width: 1.5;
}
.g1-strawberry-cap {
  fill: #6f955a;
  stroke: #4f7043;
  stroke-width: 1;
}
.g1-strawberry-seed { fill: #f4d67a; }
.g1-pear-body {
  fill: #a9bd67;
  stroke: var(--ink);
  stroke-width: 1.5;
}
.g1-watermelon-rind {
  fill: #6b985d;
  stroke: var(--ink);
  stroke-width: 1.5;
}
.g1-watermelon-flesh {
  fill: #df6a65;
  stroke: #f1d6a5;
  stroke-width: 4;
}
.g1-watermelon-seed { fill: #3b342e; }
.g1-picture-controls {
  justify-content: center;
  padding: 14px 10px 10px;
  border-top: 0;
}
.g1-picture-options {
  display: flex;
  flex: 1 0 100%;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.g1-picture-choice {
  min-width: 108px;
  font-weight: 700;
}
.g1-picture-choice.correct {
  border-color: var(--blue-ink) !important;
  background: var(--blue-ink) !important;
  color: var(--paper) !important;
}
.g1-picture-choice.wrong {
  border-color: var(--red-ink) !important;
  background: rgba(156, 59, 53, .12) !important;
  color: var(--red-ink) !important;
}
.g1-picture-controls .g1-readout {
  flex: 1 0 100%;
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-weight: 700;
  text-align: center;
}
.g1-picture-feedback {
  min-height: 58px;
  margin: 2px 0 0;
}
.g1-picture-new {
  min-width: 122px;
  border-color: var(--red-ink) !important;
  background: var(--red-ink) !important;
  color: var(--paper) !important;
  font-weight: 700;
  box-shadow: 3px 3px 0 rgba(44, 43, 41, .16);
}
.g1-picture-new:hover,
.g1-picture-new:focus-visible {
  border-color: var(--ink) !important;
  background: var(--ink) !important;
  color: var(--paper) !important;
}
.g1-picture-win { animation: g1-picture-celebrate .85s cubic-bezier(.2, .85, .35, 1.2); }
.g1-picture-win::before {
  position: absolute;
  z-index: 3;
  top: 22px;
  right: 22%;
  color: var(--red-ink);
  content: "✦   ✧   ✦";
  font-family: var(--font-text);
  font-size: 24px;
  letter-spacing: 10px;
  pointer-events: none;
  animation: g1-picture-sparkle .85s ease-out both;
}
.g1-picture-wrong { animation: g1-picture-shake .38s ease; }
@keyframes g1-picture-count-pop {
  0% { transform: translateY(4px) scale(.78); }
  65% { transform: translateY(-3px) scale(1.12); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes g1-picture-celebrate {
  0% { transform: translateY(0) scale(1); }
  32% { transform: translateY(-4px) scale(1.01); }
  68% { transform: translateY(1px) scale(.998); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes g1-picture-sparkle {
  0% { opacity: 0; transform: translateY(9px) scale(.65); }
  38% { opacity: 1; transform: translateY(-2px) scale(1.08); }
  100% { opacity: 0; transform: translateY(-18px) scale(1.2); }
}
@keyframes g1-picture-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@media (max-width: 720px) {
  .g1-picture-stage { padding: 4px 3px; }
  .g1-picture-choice { flex: 1 1 130px; }
}
@media (prefers-reduced-motion: reduce) {
  .g1-picture-icon.is-current,
  .g1-picture-win,
  .g1-picture-win::before,
  .g1-picture-wrong { animation: none; }
}

/* Graphs */
.g1-bar-shell { position: relative; }
.g1-bar-game { display: grid; gap: 14px; }
.g1-bar-question {
  padding: 16px 20px;
  border-left: 4px solid var(--red-ink);
  background: rgba(169, 61, 55, .065);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: clamp(17px, 2.3vw, 22px);
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}
.g1-bar-stage {
  position: relative;
  overflow: hidden;
  padding: 8px 12px;
  background-color: var(--paper-card);
}
.g1-bar-stage .geom-stage-svg {
  display: block;
  width: min(100%, 920px);
  margin-inline: auto;
  aspect-ratio: 760 / 370;
}
.g1-bar-title {
  fill: var(--ink);
  font-family: var(--font-text);
  font-size: 19px;
  font-weight: 700;
}
.g1-bar-gridline {
  stroke: rgba(44, 43, 41, .14);
  stroke-width: 1;
}
.g1-bar-axis {
  stroke: var(--ink);
  stroke-width: 2.2;
}
.g1-bar-scale,
.g1-bar-value {
  fill: var(--ink-soft);
  font-family: var(--font-text);
  font-size: 13px;
  font-weight: 700;
}
.g1-bar-column { cursor: pointer; outline: none; }
.g1-bar-rect {
  stroke: rgba(44, 43, 41, .72);
  stroke-width: 1.8;
  transition: filter .16s ease, stroke-width .16s ease, transform .16s ease;
  transform-box: fill-box;
  transform-origin: bottom;
}
.g1-bar-column:hover .g1-bar-rect,
.g1-bar-column:focus-visible .g1-bar-rect {
  filter: saturate(1.12) brightness(1.03);
  stroke-width: 3;
}
.g1-bar-column.active .g1-bar-rect { stroke: var(--red-ink); stroke-width: 3; }
.g1-bar-category-mark { pointer-events: none; }
.g1-bar-controls {
  justify-content: center;
  gap: 12px;
  margin-top: 0;
}
.g1-bar-options {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.g1-bar-choice {
  min-width: 92px;
  min-height: 62px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
}
.g1-bar-choice.has-icon { min-width: 104px; padding: 4px 14px; }
.g1-bar-choice-icon { width: 68px; height: 54px; overflow: visible; }
.g1-bar-number-choice { font-size: 20px; }
.g1-bar-tie-choice { min-width: 142px; font-weight: 700; }
.g1-bar-choice.correct {
  border-color: var(--blue-ink) !important;
  background: var(--blue-ink) !important;
  color: var(--paper) !important;
}
.g1-bar-choice.wrong {
  border-color: var(--red-ink) !important;
  background: #f4d9d5 !important;
  color: #7f2623 !important;
}
.g1-bar-feedback { min-height: 58px; margin-top: 0; text-align: center; }
.g1-bar-new {
  border-color: var(--red-ink) !important;
  background: var(--red-ink) !important;
  color: #fffaf2 !important;
}
.g1-bar-new:hover,
.g1-bar-new:focus-visible {
  border-color: var(--ink) !important;
  background: var(--ink) !important;
}
.g1-bar-win .g1-bar-stage { animation: g1-bar-celebrate .72s ease; }
.g1-bar-win .g1-bar-stage::after {
  position: absolute;
  z-index: 3;
  top: 22px;
  right: 18%;
  color: var(--red-ink);
  content: "✦   ✧   ✦";
  font-family: var(--font-text);
  font-size: 24px;
  letter-spacing: 9px;
  pointer-events: none;
  animation: g1-bar-sparkle .85s ease-out both;
}
.g1-bar-wrong { animation: g1-bar-shake .38s ease; }
@keyframes g1-bar-celebrate {
  0% { transform: translateY(0) scale(1); }
  36% { transform: translateY(-4px) scale(1.008); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes g1-bar-sparkle {
  0% { opacity: 0; transform: translateY(9px) scale(.65); }
  40% { opacity: 1; transform: translateY(-2px) scale(1.08); }
  100% { opacity: 0; transform: translateY(-18px) scale(1.2); }
}
@keyframes g1-bar-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@media (max-width: 720px) {
  .g1-bar-stage { padding: 4px 2px; }
  .g1-bar-choice { flex: 1 1 80px; min-width: 0; }
  .g1-bar-question { padding: 13px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .g1-bar-rect,
  .g1-bar-win .g1-bar-stage,
  .g1-bar-win .g1-bar-stage::after,
  .g1-bar-wrong { animation: none; transition: none; }
}

/* Pattern strip */
.g1-shape { stroke: var(--ink); stroke-width: 1.6; }
.g1-shape-1 { fill: #f3c969; }
.g1-shape-2 { fill: #9db4c6; }
.g1-shape-3 { fill: #e0946f; }
.g1-pattern-slot { fill: rgba(44, 43, 41, .05); stroke: rgba(44, 43, 41, .35); stroke-width: 1.5; stroke-dasharray: 5 4; }

.g1-pattern-shell { position: relative; }
.g1-pattern-stage {
  padding: 10px 18px 14px;
  background-color: var(--paper-card);
}
.g1-pattern-stage .geom-stage-svg { aspect-ratio: 720 / 300; }
.g1-pattern-choice-row {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}
.g1-pattern-controls {
  align-items: center;
  justify-content: center;
  column-gap: 20px;
}
.g1-pattern-controls .g1-quiz-options {
  justify-content: flex-start;
}
.g1-pattern-controls .g1-readout { margin-left: 0; }
.g1-pattern-new {
  min-width: 138px;
  border-color: var(--red-ink) !important;
  background: var(--red-ink) !important;
  color: var(--paper) !important;
  font-weight: 700;
  box-shadow: 3px 3px 0 rgba(44, 43, 41, .16);
}
.g1-pattern-new:hover,
.g1-pattern-new:focus-visible {
  border-color: var(--ink) !important;
  background: var(--ink) !important;
  color: var(--paper) !important;
}
.g1-quiz-options .g1-shape-choice {
  display: inline-grid;
  width: 52px;
  min-width: 52px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  place-items: center;
  align-items: center;
  justify-items: center;
  line-height: 0;
}
.g1-shape-choice-icon {
  display: block;
  width: 34px;
  height: 34px;
  pointer-events: none;
}
.g1-pattern-choice-locked { opacity: .45; }
.g1-pattern-win {
  animation: g1-pattern-celebrate .9s cubic-bezier(.2, .85, .35, 1.2);
}
.g1-pattern-win::before {
  position: absolute;
  z-index: 2;
  top: 18px;
  right: 22%;
  color: var(--red-ink);
  content: "✦   ✧   ✦";
  font-family: var(--font-text);
  font-size: 24px;
  letter-spacing: 10px;
  pointer-events: none;
  animation: g1-pattern-sparkle .9s ease-out both;
}
.g1-pattern-win .g1-shape {
  stroke: var(--blue-ink);
  stroke-width: 2.4;
}
@keyframes g1-pattern-celebrate {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-5px) scale(1.012); }
  58% { transform: translateY(1px) scale(.998); }
  82% { transform: translateY(-2px) scale(1.006); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes g1-pattern-sparkle {
  0% { opacity: 0; transform: translateY(10px) scale(.65) rotate(-8deg); }
  35% { opacity: 1; transform: translateY(-2px) scale(1.1) rotate(4deg); }
  100% { opacity: 0; transform: translateY(-20px) scale(1.25) rotate(8deg); }
}
@media (max-width: 720px) {
  .g1-pattern-stage { padding: 6px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .g1-pattern-win,
  .g1-pattern-win::before { animation: none; }
}

/* Story / part-whole */
.g1-story-shell { position: relative; }
.g1-story-stage {
  padding: 10px 18px 8px;
  background-color: var(--paper-card);
}
.g1-story-stage .geom-stage-svg { aspect-ratio: 720 / 470; }
.g1-story-shell .g1-svg text { font-size: 17px; }
.g1-story-shell .g1-svg .g1-label { font-size: 32px; }
.g1-story-shell .g1-svg .g1-note { font-size: 18px; }
.g1-circle-soft { fill: rgba(255, 221, 89, .35); stroke: var(--ink); stroke-width: 1.6; }
.g1-circle-missing { fill: rgba(250, 247, 239, .9); stroke: var(--red-ink); stroke-width: 2.4; stroke-dasharray: 8 6; }
.g1-arrow { stroke: var(--ink); stroke-width: 2; fill: none; }
.g1-story-choice-row {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}
.g1-story-controls { align-items: center; }
.g1-story-controls .g1-quiz-options { justify-content: flex-start; }
.g1-story-new {
  min-width: 132px;
  border-color: var(--red-ink) !important;
  background: var(--red-ink) !important;
  color: var(--paper) !important;
  font-weight: 700;
  box-shadow: 3px 3px 0 rgba(44, 43, 41, .16);
}
.g1-story-new:hover,
.g1-story-new:focus-visible {
  border-color: var(--ink) !important;
  background: var(--ink) !important;
  color: var(--paper) !important;
}
.g1-story-controls .g1-quiz-options .chip {
  min-width: 42px;
  min-height: 42px;
  font-weight: 700;
}
.g1-story-controls .g1-quiz-options .chip.g1-story-choice-locked { opacity: .45; }
.g1-story-win {
  animation: g1-story-celebrate .9s cubic-bezier(.2, .85, .35, 1.2);
}
.g1-story-win::before {
  position: absolute;
  z-index: 2;
  top: 18px;
  right: 22%;
  color: var(--red-ink);
  content: "✦   ✧   ✦";
  font-family: var(--font-text);
  font-size: 24px;
  letter-spacing: 10px;
  pointer-events: none;
  animation: g1-story-sparkle .9s ease-out both;
}
.g1-story-win .g1-circle-soft {
  fill: rgba(183, 198, 139, .42);
  stroke: var(--blue-ink);
}
@keyframes g1-story-celebrate {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-5px) scale(1.012); }
  58% { transform: translateY(1px) scale(.998); }
  82% { transform: translateY(-2px) scale(1.006); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes g1-story-sparkle {
  0% { opacity: 0; transform: translateY(10px) scale(.65) rotate(-8deg); }
  35% { opacity: 1; transform: translateY(-2px) scale(1.1) rotate(4deg); }
  100% { opacity: 0; transform: translateY(-20px) scale(1.25) rotate(8deg); }
}
@media (max-width: 720px) {
  .g1-story-stage { padding: 6px 8px; }
  .g1-story-choice-row { align-items: flex-start; flex-direction: column; }
  .g1-story-controls { align-items: stretch; }
  .g1-story-controls .g1-quiz-options { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .g1-story-win,
  .g1-story-win::before { animation: none; }
}

/* Generic live number */
.g1-big-num { font-family: var(--font-mono); font-size: 34px; font-weight: 700; fill: var(--red-ink); }
