/* Picture Number Bead Practice Paper Styles */

body {
  background: #f0f2f5;
}

/* ── SCREEN STYLES ── */
.pp-hero {
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
  color: #fff;
  padding: 2rem 1rem 1.5rem;
  text-align: center;
}
.pp-hero h1 {
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
}
.pp-hero p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
}

.pp-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.pp-controls {
  background: #fff;
  border-radius: 12px;
  padding: 1.2rem 1.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.pp-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #4a90e2;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1.5px solid #dde3ec;
  background: #f5f8ff;
  transition:
    background 0.2s,
    border-color 0.2s;
  white-space: nowrap;
  margin-right: 0.5rem;
}
.pp-back-link:hover {
  background: #e8f0fe;
  border-color: #4a90e2;
  text-decoration: none;
}
.pp-controls label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #444;
}
.pp-controls select {
  padding: 8px 12px;
  border: 1.5px solid #dde3ec;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #333;
  background: #fafbfc;
}
.pp-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  transition: opacity 0.2s;
}
.pp-btn:hover {
  opacity: 0.85;
}
.pp-btn.generate {
  background: linear-gradient(135deg, #4a90e2, #357abd);
  color: #fff;
}
.pp-btn.print {
  background: linear-gradient(135deg, #27ae60, #1e8449);
  color: #fff;
}

/* ── PAPER SHEET ── */
.paper-sheet {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.paper-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #2c3e50;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.paper-header .school-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: #2c3e50;
}
.paper-header .paper-title {
  font-size: 0.9rem;
  color: #666;
}
.paper-meta {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
}
.paper-meta-item {
  border-bottom: 1px solid #999;
  padding-bottom: 2px;
}
.paper-meta-item span {
  color: #999;
  font-size: 0.75rem;
  display: block;
}

/* ── QUESTION GRID ── */
.questions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.2rem;
}
.question-card {
  border: 1.5px solid #dde3ec;
  border-radius: 10px;
  padding: 0.8rem;
  text-align: center;
  background: #fafbff;
}

/* Compact layout when grid has 4-5 columns (50-100 questions) */
.questions-grid[style*="repeat(4"] .question-card,
.questions-grid[style*="repeat(5"] .question-card {
  padding: 0.5rem 0.4rem;
  border-radius: 8px;
}
.questions-grid[style*="repeat(4"] .question-number,
.questions-grid[style*="repeat(5"] .question-number {
  font-size: 0.6rem;
  margin-bottom: 0.2rem;
}
.questions-grid[style*="repeat(4"] .number-display,
.questions-grid[style*="repeat(5"] .number-display {
  font-size: 1.2rem;
  margin: 0.15rem 0;
}
.questions-grid[style*="repeat(4"] .picture-area,
.questions-grid[style*="repeat(5"] .picture-area {
  font-size: 1.6rem;
  margin: 0.15rem 0;
}
.questions-grid[style*="repeat(5"] .aw-rod {
  transform: scale(0.75);
  transform-origin: top center;
  margin: -4px auto;
}
.question-number {
  font-size: 0.7rem;
  font-weight: 700;
  color: #4a90e2;
  text-align: left;
  margin-bottom: 0.4rem;
}
.picture-area {
  font-size: 2.5rem;
  margin: 0.3rem 0;
  line-height: 1;
}
.number-display {
  font-size: 1.6rem;
  font-weight: 800;
  color: #2c3e50;
  margin: 0.3rem 0;
}
.bead-area {
  margin: 0.5rem auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.bead-row {
  display: flex;
  gap: 4px;
  align-items: center;
}
.bead {
  width: 18px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid #999;
  display: inline-block;
}
.bead.filled {
  background: #2c3e50;
  border-color: #2c3e50;
}
.bead.empty {
  background: #fff;
}
.bead.heaven {
  background: #f0a500;
  border-color: #c8840a;
}
.bead.heaven-empty {
  background: #fff;
  border-color: #c8840a;
}
.rod-divider {
  width: 80px;
  height: 3px;
  background: #8b4513;
  border-radius: 2px;
  margin: 2px 0;
}
.answer-line {
  border-bottom: 1.5px solid #999;
  margin-top: 0.6rem;
  height: 20px;
  width: 80%;
  margin-left: auto;
  margin-right: auto;
}
.answer-label {
  font-size: 0.65rem;
  color: #999;
  margin-top: 2px;
}
.paper-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #dde3ec;
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #999;
}

/* ── PRINT STYLES ── */
@media print {
  body {
    background: #fff !important;
  }
  .pp-hero,
  .pp-controls,
  .pp-cta,
  .fixed-feedback-button,
  .fixed-kit-button,
  .fixed-trial-button,
  .scroll-to-top,
  .site-header,
  .site-footer {
    display: none !important;
  }
  .pp-container {
    padding: 0;
    max-width: 100%;
  }
  .paper-sheet {
    box-shadow: none;
    border-radius: 0;
    padding: 1.5cm 2cm;
    margin: 0;
    page-break-after: always;
  }
  .question-card {
    break-inside: avoid;
  }
  /* Compact print for 50-100 questions */
  .questions-grid[style*="repeat(4"] .question-card,
  .questions-grid[style*="repeat(5"] .question-card {
    padding: 0.3rem 0.25rem;
    border-width: 1px;
  }
  .questions-grid[style*="repeat(5"] .aw-rod {
    transform: scale(0.65);
    transform-origin: top center;
    margin: -8px auto;
  }
}

/* ── SHARED ABACUS WIDGET (aw-*) ── */
.aw-rod {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  position: relative;
  width: 32px;
  margin: 4px auto;
}
.aw-stick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #a07030;
  border-radius: 2px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 0;
}
.aw-bead {
  width: 26px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid #999;
  position: relative;
  z-index: 1;
}
.aw-heaven.aw-active {
  background: #f0a500;
  border-color: #c8840a;
}
.aw-heaven.aw-inactive {
  background: #fff;
  border-color: #c8840a;
}
.aw-earth.aw-active {
  background: #cc2222;
  border-color: #881111;
}
.aw-earth.aw-inactive {
  background: #fff;
  border-color: #cc2222;
}
.aw-bead.aw-blank {
  background: #f5f5f5;
  border-color: #ccc;
}
.aw-divider {
  width: 32px;
  height: 4px;
  background: #8b4513;
  border-radius: 2px;
  position: relative;
  z-index: 1;
  margin: 1px 0;
}
.aw-two-rod {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: flex-start;
}
.aw-rod-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.aw-rod-label {
  font-size: 0.55rem;
  color: #4a90e2;
  font-weight: 800;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Compact rods for 3-digit numbers */
.aw-two-rod .aw-rod-wrap:nth-child(3) ~ .aw-rod-wrap .aw-rod,
.aw-two-rod:has(.aw-rod-wrap:nth-child(3)) .aw-rod {
  transform: scale(0.85);
  transform-origin: top center;
}

/* Shared write box */
.aw-write-box {
  border: 2px solid #4a90e2;
  border-radius: 6px;
  height: 36px;
  width: 50px;
  margin: 4px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.aw-write-box span {
  font-size: 0.6rem;
  color: #bbb;
}
