/* ── Grade 2 Math — Shared Practice Sheet Styles ───────────────────
   Each HTML file sets CSS custom properties on :root to theme it.
   Required variables: --accent, --accent-bg, --heading-color,
   --title-color, --answer-key-color
   Optional: --page-gap (default 12px), --page-padding (default 12mm 16mm)

   Math components:
   - .problem-grid / .problem-grid-2 / .problem-grid-3 / .problem-card
   - .vertical-grid / .vertical-problem for column arithmetic
   - .tf-grid / .tf-card / .tf-circles / .tf-circle for quick choice cards
   - .word-problem-list for printed question lists (always use with <ul>)
   - .tip-box for hints and reminders
   - .number-line for simple number strips
   - .match-container / .match-col / .match-item / .match-dots for draw-a-line matching
   - .place-value-grid / .pv-card / .pv-table for place-value and mini tables
   - .sort-cols / .sort-cols-3 / .sort-col / .sort-slot for printed sort-and-write activities
   - .label-row / .label-chip for word banks or category labels
   - .attr-table as a generic attribute table alias matching .pv-table styling
   - .ruler for inline SVG ruler containers and .draw-box for free-draw spaces
   - .coin-row for rows of inline coin icons in money activities
   - .blank-unit wraps a blank + trailing unit (e.g. ¢) so they stay on one
     line inside flex-column contexts like .word-problem-list li
   ─────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Comic Sans MS', 'Chalkboard SE', cursive; background: #fcfaff; color: #333; }

.page { width: 210mm; min-height: 297mm; margin: 0 auto 10mm; padding: var(--page-padding, 12mm 16mm); background: #fff; border: 1px solid #ddd; page-break-after: always; display: flex; flex-direction: column; gap: var(--page-gap, 12px); }
.page-header { text-align: center; }
.page-header h1 { font-size: var(--h1-size, 20px); color: var(--heading-color); }
.page-header p, .page-num { font-size: 11px; color: #777; }
.page-header .page-sub { font-size: 12px; color: #999; }
.page-num { text-align: right; margin-top: -8px; }

.exercise { border: 2px solid var(--accent); border-radius: 12px; padding: 10px 14px; background: var(--accent-bg); }
.exercise-title { font-size: 13px; font-weight: bold; color: var(--title-color); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.exercise-title .badge { background: var(--accent); color: #fff; border-radius: 20px; padding: 1px 9px; font-size: 11px; }
.exercise-instruction { font-size: 11px; color: #555; margin-bottom: 8px; font-style: italic; }

.problem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.problem-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.problem-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.problem-card { background: #fff; border: 2px dashed var(--accent); border-radius: 10px; padding: 10px; text-align: center; font-size: 22px; font-weight: bold; color: var(--heading-color); min-height: 60px; display: flex; align-items: center; justify-content: center; }

.blank { display: inline-block; border-bottom: 2px solid #333; width: 40px; height: 22px; }
.blank-wide { display: inline-block; border-bottom: 2px solid #333; width: 80px; height: 22px; }
.blank-unit { display: inline-block; white-space: nowrap; }
.fill-box { display: inline-block; width: 42px; height: 34px; border-bottom: 3px solid #333; text-align: center; font-size: 18px; margin: 0 3px; }

.vertical-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.vertical-problem { background: #fff; border: 2px solid var(--accent); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; align-items: flex-end; font-size: 22px; font-weight: bold; color: var(--heading-color); }
.vertical-problem .vp-op { display: flex; gap: 6px; }
.vertical-problem .vp-line { width: 100%; border-top: 2px solid #333; margin: 4px 0; }
.vertical-problem .vp-ans { min-height: 28px; }

.tf-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tf-card { background: #fff; border: 2px solid var(--accent); border-radius: 10px; padding: 8px 12px; font-size: 16px; font-weight: bold; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tf-circles { display: flex; gap: 6px; flex-wrap: wrap; }
.tf-circle { width: 28px; height: 28px; border: 2px solid var(--title-color); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: bold; color: var(--title-color); }

.word-problem-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.word-problem-list li { font-size: 14px; padding: 8px 10px; border-left: 4px solid var(--accent); background: var(--wp-bg, #f7f1ff); border-radius: 4px; display: flex; flex-direction: column; gap: 4px; }
.wp-answer { font-size: 13px; color: #555; }

.tip-box { background: var(--tip-bg, #ede7f6); border: 2px solid var(--accent); border-radius: 10px; padding: 10px 14px; font-size: 12px; color: var(--title-color); margin-bottom: 4px; }
.tip-box strong { color: var(--heading-color); }

.number-line { display: flex; align-items: center; justify-content: center; gap: 0; margin: 10px 0; }
.nl-num { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: bold; border: 1.5px solid var(--accent); background: var(--accent-bg); }
.nl-num:first-child { border-radius: 8px 0 0 8px; }
.nl-num:last-child { border-radius: 0 8px 8px 0; }

.match-container { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: start; }
.match-col { display: flex; flex-direction: column; gap: 8px; }
.match-item { background: #fff; border: 2px solid var(--accent); border-radius: 8px; padding: 6px 12px; font-size: 16px; font-weight: bold; text-align: center; }
.match-dots { display: flex; flex-direction: column; gap: 17px; align-items: center; justify-content: center; padding-top: 4px; }
.match-dots span { width: 10px; height: 10px; border: 2px solid var(--title-color); border-radius: 50%; display: block; }

.place-value-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pv-card { background: #fff; border: 2px solid var(--accent); border-radius: 10px; padding: 10px; text-align: center; }
.pv-card .pv-problem { font-size: 16px; font-weight: bold; color: var(--heading-color); margin-bottom: 8px; }
.pv-table, .attr-table { width: 100%; border-collapse: collapse; background: #fff; }
.pv-table th, .attr-table th { font-size: 11px; color: var(--title-color); border-bottom: 2px solid var(--accent); padding: 4px 6px; background: rgba(255,255,255,0.75); }
.pv-table td, .attr-table td { font-size: 18px; font-weight: bold; color: var(--heading-color); padding: 6px; text-align: center; border-bottom: 1px dashed #ccc; }
.pv-table .pv-blank { border-bottom: 2px solid #333; display: inline-block; width: 24px; height: 18px; }
.attr-table td:first-child, .attr-table th:first-child { text-align: left; font-size: 14px; }

.sort-cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.sort-cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sort-col { border: 2px solid var(--accent); border-radius: 8px; padding: 8px; background: #fff; }
.sort-col h4 { font-size: 12px; color: var(--title-color); text-align: center; margin-bottom: 4px; }
.sort-slot { border-bottom: 1.5px solid var(--title-color); height: 22px; margin-bottom: 8px; }
.sort-slot:last-child { margin-bottom: 0; }

.label-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: #fff; border: 1.5px dashed var(--accent); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; }
.label-chip { border: 1.5px solid var(--accent); border-radius: 14px; padding: 2px 10px; font-size: 12px; color: var(--title-color); background: var(--accent-bg); }

.ruler { background: #fff; border: 2px solid var(--accent); border-radius: 10px; padding: 8px; }
.draw-box { height: 54px; border: 2px dashed var(--accent); border-radius: 10px; background: #fff; margin-top: 6px; }
.compare-row { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 10px; align-items: center; background: #fff; border: 2px dashed var(--accent); border-radius: 10px; padding: 8px 10px; }
.compare-choices { display: flex; gap: 6px; }
.order-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.order-list li { background: #fff; border: 2px dashed var(--accent); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.icon-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.icon-card { background: #fff; border: 2px dashed var(--accent); border-radius: 10px; padding: 10px; text-align: center; }
.icon-card svg { display: block; margin: 0 auto 6px; }
.object-note { font-size: 11px; color: #666; }
.coin-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.answer-key { margin-top: auto; border-top: 2px dashed #ccc; padding-top: 6px; font-size: 10px; color: #888; }
.answer-key strong { color: var(--answer-key-color, var(--title-color)); }

@page { size: A4; margin: 0; }
@media print { body { background: #fff; } .page { border: none; margin: 0; min-height: auto; } .page:last-child { page-break-after: avoid; } }
