/* ==============================================================================
   ClassKit Global - Balance Scale Algebra Studio Stylesheet
   Pure Vanilla CSS | A4 210mm x 297mm Vector Print Engine
   Supports Substitution, Elimination & 3-Variable System Equilibrium Puzzles
   1-Up Wide & 2-Up Paper-Saving Layouts + Complete Step-by-Step Answer Keys
   ============================================================================== */

:root {
  --scale-metal-dark: #1E293B;
  --scale-beam-color: #334155;
  --scale-pan-color: #64748B;
  --scale-brass-gold: #D97706;
  --scale-brass-bg: linear-gradient(135deg, #FDE68A 0%, #F59E0B 50%, #D97706 100%);
  --scale-ans-blue: #2563EB;
  --scale-ans-green: #059669;
}

/* ------------------------------------------------------------------------------
   1. A4 Printable Sheet Engine (Portrait 210mm x 297mm)
   ------------------------------------------------------------------------------ */
.scale-sheet {
  width: 210mm;
  height: 297mm;
  min-height: 297mm;
  max-height: 297mm;
  box-sizing: border-box;
  padding: 10mm 14mm 8mm 14mm;
  background: #FFFFFF;
  color: #0F172A;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
  margin-bottom: 24px;
}



/* ------------------------------------------------------------------------------
   3. Vector Balance Scales Diagram Engine
   ------------------------------------------------------------------------------ */
.scales-grid-container {
  display: grid;
  gap: 3mm;
  width: 100%;
}

.scales-grid-container.count-3 {
  grid-template-columns: repeat(3, 1fr);
}

.scales-grid-container.count-4 {
  grid-template-columns: repeat(2, 1fr);
}

.balance-card-box {
  background: #FFFFFF;
  border: 1.4px solid #CBD5E1;
  border-radius: 2mm;
  padding: 2.5mm 3mm 2mm 3mm;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.balance-card-box.is-mission-card {
  border: 1.8px solid #D97706;
  background: #FFFBEB;
}

.scale-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5mm;
}

.scale-badge-title {
  font-size: 7.5pt;
  font-weight: 900;
  color: #1E293B;
  background: #F1F5F9;
  padding: 0.4mm 1.8mm;
  border-radius: 0.8mm;
  border: 0.5px solid #CBD5E1;
}

.balance-card-box.is-mission-card .scale-badge-title {
  background: #F59E0B;
  color: #FFFFFF;
  border-color: #D97706;
}

/* Vector Scale Assembly */
.scale-assembly-wrap {
  width: 100%;
  height: 28mm;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.scale-fulcrum-post {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 3.5mm;
  height: 18mm;
  background: #334155;
  border-radius: 1mm 1mm 0 0;
}

.scale-fulcrum-post::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 14mm;
  height: 2mm;
  background: #1E293B;
  border-radius: 0.8mm;
}

.scale-horizontal-beam {
  position: absolute;
  top: 9mm;
  left: 5%;
  right: 5%;
  height: 2mm;
  background: #334155;
  border-radius: 1mm;
}

.scale-beam-pivot {
  position: absolute;
  top: 8mm;
  left: 50%;
  transform: translateX(-50%);
  width: 4mm;
  height: 4mm;
  border-radius: 50%;
  background: #D97706;
  border: 1px solid #B45309;
  z-index: 2;
}

/* Hanging Pans */
.hanging-pan-left, .hanging-pan-right {
  position: absolute;
  top: 10mm;
  width: 44%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hanging-pan-left { left: 4%; }
.hanging-pan-right { right: 4%; }

.pan-cords-line {
  width: 100%;
  height: 6.5mm;
  position: relative;
}

.pan-cords-line::before, .pan-cords-line::after {
  content: '';
  position: absolute;
  top: 0;
  width: 0.8px;
  height: 6.5mm;
  background: #94A3B8;
}

.pan-cords-line::before { left: 20%; transform: rotate(12deg); }
.pan-cords-line::after { right: 20%; transform: rotate(-12deg); }

.pan-metal-dish {
  width: 82%;
  height: 3.2mm;
  background: #64748B;
  border-radius: 0 0 4mm 4mm;
  border-top: 1.5px solid #334155;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

/* Items & Weights Placed on the Pans */
.pan-items-shelf {
  position: absolute;
  bottom: 3.2mm;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1mm;
  flex-wrap: wrap;
  width: 100%;
}

.item-token-icon {
  font-size: 13pt;
  line-height: 1;
  user-select: none;
}

.item-count-multiplier {
  font-size: 7.5pt;
  font-weight: 900;
  color: #0F172A;
  margin-left: 0.5mm;
}

/* Brass Weight Cylinder */
.brass-weight-cylinder {
  background: var(--scale-brass-bg);
  border: 1px solid #B45309;
  border-radius: 1mm;
  padding: 1.2mm 2.2mm;
  font-size: 8pt;
  font-weight: 900;
  color: #78350F;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.6), 0 1px 2px rgba(0,0,0,0.2);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.brass-weight-cylinder.is-question {
  background: #FFF1F2;
  border-color: #E11D48;
  color: #E11D48;
  font-size: 9.5pt;
  font-weight: 900;
}

/* ------------------------------------------------------------------------------
   4. Logical Deduction Log Box
   ------------------------------------------------------------------------------ */
.deduction-log-section {
  width: 100%;
  margin-top: 2.5mm;
  border: 1.4px solid #0F172A;
  border-radius: 2mm;
  padding: 2.5mm 3.5mm;
  box-sizing: border-box;
  background: #FAFAFA;
}

.log-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px dashed #CBD5E1;
  padding-bottom: 1.5mm;
  margin-bottom: 2mm;
}

.log-title {
  font-size: 8.5pt;
  font-weight: 900;
  color: #0F172A;
  display: flex;
  align-items: center;
  gap: 1.5mm;
}

.log-subtitle {
  font-size: 7pt;
  color: #64748B;
}

.log-step-lines {
  display: flex;
  flex-direction: column;
  gap: 2.2mm;
}

.log-step-item {
  display: flex;
  align-items: baseline;
  gap: 2mm;
  font-size: 8pt;
  font-weight: 700;
  color: #334155;
}

.step-num-pill {
  font-size: 6.8pt;
  font-weight: 900;
  background: #0F172A;
  color: #FFFFFF;
  padding: 0.3mm 1.5mm;
  border-radius: 0.8mm;
  line-height: 1.2;
  flex-shrink: 0;
}

.step-writing-line {
  flex: 1;
  border-bottom: 1px dashed #94A3B8;
  min-height: 4.5mm;
}

/* Answer Key Mode Solution Boxes */
.show-solutions .step-writing-line,
.scale-sheet.answer-sheet .step-writing-line {
  border-bottom: none;
  color: var(--scale-ans-blue);
  font-weight: 800;
  font-size: 8pt;
  line-height: 1.4;
}

.solution-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 1.5mm;
  padding: 2mm 3mm;
  margin-top: 2.5mm;
}

.unit-weight-tag {
  font-size: 8.5pt;
  font-weight: 900;
  color: #1D4ED8;
}

/* ------------------------------------------------------------------------------
   5. Layout Specifics (1-Up vs 2-Up)
   ------------------------------------------------------------------------------ */
.layout-content-1up {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.layout-content-2up {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.puzzle-unit-2up {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 125mm;
}

.puzzle-unit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.2mm;
  border-bottom: 1.2px solid #0F172A;
  margin-bottom: 1.5mm;
}

.puzzle-unit-title {
  font-size: 10pt;
  font-weight: 800;
  color: #0F172A;
}

.puzzle-unit-meta {
  font-size: 7.2pt;
  color: #64748B;
  font-weight: 600;
}

.cut-line-horizontal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2mm;
  color: #94A3B8;
  font-size: 7.5pt;
  font-weight: 700;
  margin: 2mm 0;
  user-select: none;
}

.cut-line-horizontal::before, .cut-line-horizontal::after {
  content: '';
  flex: 1;
  border-bottom: 1px dashed #CBD5E1;
}

/* ------------------------------------------------------------------------------
   6. Sheet Footer & PRO Modal
   ------------------------------------------------------------------------------ */
.sheet-footer-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #CBD5E1;
  padding-top: 2mm;
  margin-top: 2mm;
  font-size: 7.2pt;
  color: #64748B;
  font-weight: 500;
}

.footer-brand-tag {
  font-weight: 700;
  color: #0F172A;
}

/* ------------------------------------------------------------------------------
   7. Sheet Print Engine Rules (@media print)
   ------------------------------------------------------------------------------ */
@media print {
  .scale-sheet {
    width: 210mm !important;
    height: 297mm !important;
    min-height: 297mm !important;
    max-height: 297mm !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
  }

  .scale-sheet.answer-sheet {
    page-break-before: always !important;
  }
}

