/* Keep the Math Games collection in the same graphite family as Kakooma. */
@import url('kakooma.css');

.brand { min-width: 0; }
.brand h1 { overflow-wrap: anywhere; }
.menu-host { flex: 0 0 auto; margin-left: 12px; }
.catalog-intro { padding: 26px 0 20px; }
.catalog-intro h2 { font-size: 1.6rem; margin-bottom: 8px; }
.catalog-intro p { color: var(--muted); max-width: 40ch; }
.game-catalog { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; padding-bottom: 22px; }
.game-link { display: flex; flex-direction: column; padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); text-decoration: none; }
.game-link:hover { border-color: var(--accent); }
.game-link h2 { font-size: 1.5rem; margin: 14px 0 6px; }
.game-link p { color: var(--muted); font-size: 1rem; }
.game-link .game-tags { margin-top: auto; padding-top: 16px; font-size: .875rem; font-weight: 600; }
.game-preview { min-height: 76px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; background: var(--tile); border-radius: 8px; padding: 10px; font-family: var(--font-display); font-size: 1.6rem; }
.preview-tile { min-width: 36px; padding: 2px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; text-align: center; }
.preview-sum { color: var(--success); }
.preview-crossed { text-decoration: line-through; opacity: .4; }
.preview-family { display: flex; flex-direction: column; align-items: center; font-size: .875rem; font-family: var(--font-body); }
.preview-family strong { font-family: var(--font-display); font-size: 1.6rem; line-height: 1.2; }
.preview-family.red { border-bottom: 3px solid #b94b4b; }
.preview-family.blue { border-bottom: 3px solid #4079b5; }
.preview-family.green { border-bottom: 3px solid #398363; }
.preview-word { font: 1.1rem var(--font-body); }
.collection-note { padding: 2px 0 10px; color: var(--muted); font-size: .875rem; }
.math-meta { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: .875rem; margin: 8px 0; }
.math-meta .settings-summary { font-size: .875rem; }
.math-game .stat-value { overflow-wrap: anywhere; }
.math-game .round-header { margin-bottom: 16px; }
.math-game .round-header p { font-size: 1rem; }
.puzzle-stage { position: relative; margin: 8px auto 0; max-width: 460px; }
.puzzle-board { min-height: 300px; }
.puzzle-board.concealed { visibility: hidden; }
.math-game .board-cover { inset: 0; min-height: 300px; }
.math-game .board-cover h3 { max-width: 22ch; }
.math-game .game-panel { margin-top: 20px; }
.math-game .feedback { min-height: 64px; max-width: 460px; margin: auto; }
.selection-summary { min-height: 26px; color: var(--muted); font-size: .875rem; text-align: center; }
.math-game .game-actions { max-width: 460px; margin: auto; }
.hint-row { display: flex; justify-content: center; min-height: 44px; margin-top: 8px; }
.text-button { border: 0; background: none; padding: 10px; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; color: var(--muted); }
.math-choice { min-width: 0; min-height: 64px; padding: 8px; background: var(--tile); border: 1px solid var(--border); border-bottom-width: 3px; border-radius: 10px; }
.math-choice:hover:not(:disabled) { background: var(--tile-hover); }
.math-choice:disabled { opacity: 1; }
.math-choice.selected { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--surface); }
.math-choice.selected::after { content: '✓'; position: absolute; right: 6px; top: 2px; font: 1rem var(--font-body); }
.math-choice.hint { background: var(--hint-bg); border-color: var(--hint); }
.math-choice.correct { background: var(--success-bg); border-color: var(--success); }
.math-choice:focus-visible { outline: 3px solid var(--hint); outline-offset: 3px; }
.target-display { display: flex; align-items: center; justify-content: center; gap: 24px; margin: 8px 0 10px; min-height: 68px; }
.target-number { display: flex; flex-direction: column; align-items: center; }
.target-number strong { font: 2rem var(--font-display); }
.dice-group { display: flex; gap: 10px; }
.die { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 4px; width: 52px; height: 52px; padding: 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.pip { border-radius: 50%; background: var(--text); }
.pip.empty { visibility: hidden; }
.dice-placeholder { color: var(--muted); }
.limbo-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; max-width: 360px; margin: auto; }
.limbo-grid .math-choice { grid-column: span 2; position: relative; min-height: 60px; font-family: var(--font-display); font-size: 1.8rem; }
.limbo-grid .math-choice:nth-child(5) { grid-column: 2 / span 2; }
.limbo-grid .math-choice:nth-child(8) { grid-column: 3 / span 2; }
.limbo-grid .math-choice:nth-child(10) { grid-column: 4 / span 2; }
.limbo-grid .crossed-off { opacity: .35; text-decoration: line-through; background: var(--page); }
.numskill-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 370px; margin: auto; }
.numskill-grid .math-choice { min-height: 96px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; border-top: 4px solid var(--family); }
.math-choice[data-color="red"] { --family: #b94b4b; }
.math-choice[data-color="blue"] { --family: #4079b5; }
.math-choice[data-color="green"] { --family: #398363; }
.color-label { text-transform: capitalize; font-size: .875rem; overflow-wrap: anywhere; max-width: 100%; }
.card-value { font: 2rem var(--font-display); }
.numtanga-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: 12px; }
.matching-card { min-width: 0; padding: 12px 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.matching-card h3 { font-size: 1.1rem; margin-bottom: 12px; }
.matching-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.matching-card .math-choice { min-height: 104px; position: relative; padding: 10px 4px; }
.representation { display: flex; justify-content: center; align-items: center; min-height: 70px; overflow-wrap: anywhere; }
.number-word { font-size: 1rem; max-width: 100%; }
.counting-dots { display: grid; grid-template-columns: repeat(5, 7px); gap: 4px; }
.counting-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text); }
.fraction-value, .money-value { font-size: 1.15rem; font-weight: 600; }
.fraction-bar { display: flex; width: 100%; max-width: 100px; height: 26px; border: 1px solid var(--text); }
.fraction-part { flex: 1; border-right: 1px solid var(--text); }
.fraction-part:last-child { border-right: 0; }
.fraction-part.filled { background: var(--text); border-right-color: var(--surface); }
.coin-group { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.coin { display: inline-block; border: 1px solid var(--muted); border-radius: 50%; padding: 2px; font-size: .875rem; line-height: 1.2; background: var(--surface); }
.math-game .result-equation { font-family: var(--font-body); font-size: 1.1rem; }
@media (max-width: 400px) {
  .game-catalog { gap: 12px; }
  .game-link { padding: 16px; }
  .math-game .game-panel { margin-top: 16px; }
  .math-game .round-header h2 { font-size: 1.65rem; }
  .numskill-grid { gap: 8px; }
  .numskill-grid .math-choice { min-height: 88px; }
  .matching-card { padding: 10px 6px; }
  .matching-card-grid { gap: 6px; }
  .matching-card .math-choice { min-height: 96px; }
  .limbo-grid { gap: 6px; }
}
