/* ==============================================================================
   ClassKit Global - Binary Pixel Art & RLE Compression Studio Stylesheet
   Pure Vanilla CSS | A4 210mm x 297mm Vector Print Engine
   Supports 8x8, 12x12, 16x16 0/1 Bitmaps & Run-Length Encoding (RLE)
   Strict Rule 4 Compliance: Under 600 lines
   ============================================================================== */

:root {
  --pixel-wall-color: #0F172A;
  --pixel-border-thick: 2px solid #0F172A;
  --pixel-border-thin: 1px solid #CBD5E1;
  --pixel-indigo: #4F46E5;
  --pixel-indigo-soft: #EEF2FF;
}

/* ------------------------------------------------------------------------------
   1. Print Preview Area & A4 Sheet Engine
   ------------------------------------------------------------------------------ */
.print-pages-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}

.pixel-art-sheet {
  width: 210mm;
  height: 297mm;
  min-height: 297mm;
  max-height: 297mm;
  padding: 10mm 14mm 8mm 14mm;
  box-sizing: border-box;
  background: #FFFFFF;
  color: #0F172A;
  margin: 0 auto;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  page-break-after: always;
  break-after: page;
  position: relative;
  overflow: hidden;
}

.pixel-art-sheet.is-answer-key-page {
  border-top: 4px solid #2563EB;
}

/* ------------------------------------------------------------------------------
   2. Mission Guide Banner & Legend
   ------------------------------------------------------------------------------ */
.pixel-art-hero-banner {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.pixel-mission-text {
  font-size: 8pt;
  color: #334155;
  line-height: 1.45;
  flex: 1;
}

.pixel-mission-text strong {
  color: #0F172A;
  font-weight: 800;
}

.pixel-legend-card {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 7.5pt;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}

.pixel-legend-sample {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  box-sizing: border-box;
}

.pixel-legend-sample.empty {
  background: #FFFFFF;
  border: 1px solid #94A3B8;
}

.pixel-legend-sample.fill {
  background: #0F172A;
  border: 1px solid #0F172A;
}

/* ------------------------------------------------------------------------------
   3. Board Layout: Code Table + SVG Canvas Grid
   ------------------------------------------------------------------------------ */
.pixel-board-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.pixel-board-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: center;
  flex: 1;
}

/* Left: Code Table */
.pixel-code-table-box {
  background: #FFFFFF;
  border: 1.5px solid #0F172A;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 180mm;
}

.code-box-header {
  background: #0F172A;
  color: #FFFFFF;
  padding: 7px 10px;
  font-size: 8.5pt;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: -0.2px;
}

.code-box-badge {
  font-size: 7pt;
  background: rgba(255, 255, 255, 0.2);
  padding: 1px 6px;
  border-radius: 4px;
}

.pixel-code-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-around;
  padding: 4px 8px;
  background: #FAFAFA;
}

.pixel-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2.5px 0;
  border-bottom: 0.5px dashed #E2E8F0;
  font-family: 'Courier New', Courier, monospace;
}

.pixel-code-row:last-child {
  border-bottom: none;
}

.code-row-idx {
  font-size: 7.8pt;
  font-weight: 800;
  color: #64748B;
  min-width: 32px;
}

.code-row-val {
  font-size: 8.2pt;
  font-weight: 700;
  color: #0F172A;
  word-break: break-all;
}

/* Right: Canvas Grid Box */
.pixel-grid-box {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.pixel-grid-svg {
  width: 100%;
  max-width: 86mm;
  height: auto;
  aspect-ratio: 1 / 1;
}

/* ------------------------------------------------------------------------------
   4. Student Reflection & Debugging Box
   ------------------------------------------------------------------------------ */
.pixel-reflection-box {
  background: #F8FAFC;
  border: 1px dashed #CBD5E1;
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 10px;
}

.reflection-title {
  font-size: 7.5pt;
  font-weight: 800;
  color: #334155;
  margin-bottom: 4px;
}

.reflection-inputs {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 7.5pt;
  color: #475569;
}

.reflection-field {
  display: inline-block;
  min-width: 35mm;
  border-bottom: 1px solid #64748B;
  height: 3.5mm;
  vertical-align: bottom;
}

/* ------------------------------------------------------------------------------
   5. Teacher Answer Key Specifics
   ------------------------------------------------------------------------------ */
.pixel-answer-banner {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ans-banner-title {
  font-size: 8pt;
  color: #1E3A8A;
  font-weight: 700;
}

.ans-banner-badge {
  font-size: 8pt;
  font-weight: 800;
  color: #1D4ED8;
  background: #DBEAFE;
  padding: 2px 8px;
  border-radius: 4px;
}

.compression-stat-pill {
  font-size: 7.5pt;
  font-weight: 800;
  color: #047857;
  background: #D1FAE5;
  padding: 3px 8px;
  border-radius: 4px;
  border: 0.5px solid #A7F3D0;
}

/* ------------------------------------------------------------------------------
   6. Print Engine Optimizations (@media print)
   ------------------------------------------------------------------------------ */
@media print {
  body {
    background: #FFFFFF !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .studio-header,
  .studio-sidebar,
  .pro-modal-backdrop {
    display: none !important;
  }

  .studio-body {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .studio-viewport {
    padding: 0 !important;
    margin: 0 !important;
    background: #FFFFFF !important;
  }

  .a4-wrapper {
    transform: none !important;
  }

  .pixel-art-sheet {
    box-shadow: none !important;
    margin: 0 !important;
    page-break-after: always !important;
    break-after: page !important;
  }
}
