/* --- СТИЛІ ІНТЕРФЕЙСУ ГЕНЕРАТОРА --- */

/* Фільтри та сітка */
.filterBar {
  background: #fff;
  border: 1px solid rgba(22, 36, 41, 0.1);
  border-radius: 24px;
  padding: 1.2rem;
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 1rem;
  align-items: center;
  box-shadow: var(--shadow2);
  margin-bottom: 2rem;
}

.filterGroup {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.filterLabel {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  margin-left: 0.5rem;
}

.customSelect,
.searchInput {
  width: 100%;
  padding: 0.85rem 1.2rem;
  border-radius: 16px;
  border: 1px solid rgba(22, 36, 41, 0.15);
  background: #fff;
  font-family: inherit;
  color: var(--ink);
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(22, 36, 41, 0.03);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.customSelect {
  min-width: 140px;
  cursor: pointer;
}

.searchInput {
  cursor: text;
}

.customSelect:focus,
.searchInput:focus {
  outline: none;
  border-color: var(--p1);
  box-shadow: 0 0 0 3px rgba(72, 17, 191, 0.1);
}

/* Layout Grid */
.layoutGrid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
  align-items: start;
}

/* Sidebar */
.sidebar {
  background: #fff;
  border-radius: 24px;
  padding: 1.5rem;
  border: 1px solid rgba(22, 36, 41, 0.1);
  box-shadow: var(--shadow2);
  position: sticky;
  top: 100px;
}

.sidebarTitle {
  font-weight: 800;
  font-size: 1.2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(22, 36, 41, 0.08);
}

.sideNav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.navBtn {
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navBtn:hover {
  background: rgba(72, 17, 191, 0.04);
  color: var(--p1);
}

.navBtn.active {
  background: rgba(72, 17, 191, 0.08);
  color: var(--p1);
  font-weight: 740;
  border-color: rgba(72, 17, 191, 0.15);
}

/* Right Content Area */
.filtersArea {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.filterRowTop {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.searchRow {
  position: relative;
}

/* Task Grid */
.taskGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* Task Card */
.taskCard {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 1.2rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(22, 36, 41, 0.08);
  border-radius: 18px;
  padding: 1.2rem;
  transition: all 0.2s ease;
  opacity: 0;
  animation: fadeInUp 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.taskCard:hover {
  background: #fff;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(22, 36, 41, 0.08);
  border-color: rgba(72, 17, 191, 0.2);
}

.taskIcon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: rgba(10, 132, 255, 0.1);
  color: #0a84ff;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
}

.taskInfo h3 {
  margin: 0 0 0.3rem 0;
  font-size: 1.1rem;
  font-weight: 740;
}

.taskTags {
  display: flex;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.tag {
  background: rgba(22, 36, 41, 0.05);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-weight: 600;
}

/* Анімація появи */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.taskCard:nth-child(1) { animation-delay: 0ms; }
.taskCard:nth-child(2) { animation-delay: 60ms; }
.taskCard:nth-child(3) { animation-delay: 120ms; }
.taskCard:nth-child(4) { animation-delay: 180ms; }
.taskCard:nth-child(5) { animation-delay: 240ms; }
.taskCard:nth-child(6) { animation-delay: 300ms; }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2.5rem;
}

.pageBtn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(22, 36, 41, 0.15);
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}

.pageBtn:hover {
  border-color: rgba(72, 17, 191, 0.3);
  background: rgba(72, 17, 191, 0.05);
  transform: translateY(-2px);
}

.pageBtn.active {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 16px rgba(72, 17, 191, 0.2);
}

/* --- МОДАЛКА --- */
.modalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 36, 41, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  place-items: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  overflow-y: auto;
  padding: 20px;
}

.modalOverlay.active {
  display: grid;
  opacity: 1;
}

.modalCard {
  background: #fff;
  width: min(800px, 95vw);
  padding: 2rem;
  border-radius: 28px;
  box-shadow: var(--shadow);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.modalClose {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s;
}

.modalClose:hover {
  color: var(--ink);
}

.modalIcon {
  width: 80px;
  height: 80px;
  background: #fdf2f2;
  color: #e02424;
  font-size: 2.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 1.5rem;
}

/* Банер "Безкоштовна реєстрація" */
.promo-banner-small {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 1rem 1.5rem;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.promo-text {
  font-size: 0.95rem;
  line-height: 1.4;
}

.promo-text b {
  font-weight: 800;
  color: #ffd700;
}

.btn-promo {
  background: #fff;
  color: #764ba2;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.9rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-promo:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Сітка варіантів */
.variants-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.variant-card {
  border: 2px solid rgba(22, 36, 41, 0.1);
  border-radius: 18px;
  padding: 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s;
  background: #fafafa;
  position: relative;
}

.variant-card.active {
  background: #fff;
  border-color: var(--p1);
  box-shadow: 0 10px 30px rgba(72, 17, 191, 0.1);
}

.variant-icon {
  font-size: 2.5rem;
  color: var(--p1);
  margin-bottom: 0.5rem;
}

.variant-title {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--ink);
}

.variant-desc {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: auto;
}

.variant-card.empty {
  border-style: dashed;
  background: rgba(22, 36, 41, 0.03);
  cursor: pointer;
  justify-content: center;
  min-height: 250px;
}

.variant-card.empty:hover {
  background: rgba(72, 17, 191, 0.05);
  border-color: var(--p1);
}

.add-icon {
  font-size: 2rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  transition: transform 0.2s, color 0.2s;
}

.variant-card.empty:hover .add-icon {
  transform: scale(1.1);
  color: var(--p1);
}

/* Лоадер */
.loader-mini {
  width: 24px;
  height: 24px;
  border: 3px solid #ccc;
  border-top-color: var(--p1);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Error */
.error-msg {
  color: #dc3545;
  background: #f8d7da;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: center;
  border: 1px solid #f5c6cb;
}

/* SEO / text blocks */
.seoText {
  margin-top: 4rem;
  padding: 2.5rem;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 30px;
  border: 1px solid rgba(22, 36, 41, 0.06);
}

.seoText p {
  margin-bottom: 1rem;
  color: rgba(22, 36, 41, 0.75);
}

.text-content {
  max-width: 800px;
  margin: 0 auto;
  color: var(--ink);
  line-height: 1.6;
}

.text-content p {
  margin-bottom: 1.2rem;
  font-size: 1.05rem;
  color: rgba(22, 36, 41, 0.8);
}

.text-content strong {
  color: var(--p1);
}

/* Promo CTA */
.promoBanner {
  position: relative;
  background: var(--grad);
  border-radius: 32px;
  padding: clamp(2.5rem, 5vw, 4rem) 2rem;
  text-align: center;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(72, 17, 191, 0.25);
}

.promoBanner::before,
.promoBanner::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.promoBanner::before {
  width: 300px;
  height: 300px;
  top: -100px;
  left: -100px;
}

.promoBanner::after {
  width: 200px;
  height: 200px;
  bottom: -50px;
  right: -50px;
}

.promoBanner h2 {
  font-size: clamp(1.8rem, 2.5vw, 2.4rem);
  font-weight: 800;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.promoBanner p {
  font-size: 1.15rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 2rem;
}

.btn--white {
  background: #fff;
  color: var(--p1);
  border: none;
  font-weight: 750;
  padding: 1rem 2rem;
  font-size: 1.05rem;
}

.btn--white:hover {
  background: #f0f0f0;
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* Hero */
.heroArt {
  border-radius: var(--radius2);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(22, 36, 41, 0.1);
  box-shadow: var(--shadow2);
  padding: 1.1rem;
  display: grid;
  gap: 0.85rem;
}

.heroArt__img {
  position: relative;
  overflow: hidden;
  padding: 0;
  border-radius: 18px;
  border: 1px solid rgba(22, 36, 41, 0.1);
  background: rgba(255, 255, 255, 0.55);
}

.heroArt__img > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}

/* --- ДРУК / A4 --- */

/* Базовий контейнер аркуша (для preview + print) */
.sheet-a4 {
  display: none;
  background: #fff;
  width: 210mm;
  max-width: 210mm;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 20px;
  border: 1px solid #ccc;
  font-family: "Times New Roman", serif;
  color: #000;
}

/* Старий/новий набір класів шапки — підтримка обох шаблонів */
.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 2px solid #000;
  padding-bottom: 5px;
  margin-bottom: 15px;
}

.sheet-title {
  text-align: center;
  font-weight: bold;
  margin: 10px 0;
  font-size: 14px;
  text-transform: uppercase;
}

.header-info p {
  margin: 5px 0;
  font-size: 14pt;
  line-height: 1.4;
}

.header-left {
  flex-grow: 1;
}

.header-line {
  margin-bottom: 8px;
  font-size: 16px;
  font-style: italic;
}

.mark-box {
  border: 2px solid #000;
  width: 60px;
  height: 40px;
  position: relative;
  margin-left: 20px;
}

.mark-label {
  font-size: 10px;
  position: absolute;
  top: 2px;
  right: 2px;
  color: #555;
  text-transform: uppercase;
  font-weight: bold;
}

.work-title {
  text-align: center;
  font-weight: bold;
  font-size: 16pt;
  margin-bottom: 15px;
  text-transform: uppercase;
}

.work-topic {
  text-align: center;
  font-weight: bold;
  text-transform: uppercase;
  margin-bottom: 15px;
  font-size: 14px;
  border: 1px solid #000;
  padding: 5px;
  display: inline-block;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
}

/* Загальні елементи бланку */
.task-item,
.task-row {
  page-break-inside: avoid;
}

.task-item {
  margin-bottom: 15px;
  width: 100%;
}

.task-meta {
  font-weight: bold;
  margin-bottom: 4px;
  font-size: 12pt;
}

.task-content {
  font-size: 12pt;
  margin-bottom: 8px;
  line-height: 1.3;
}

.task-row {
  display: flex;
  margin-bottom: 12px;
}

.task-num {
  width: 25px;
  font-weight: bold;
  font-size: 16px;
  flex-shrink: 0;
}

.task-body {
  flex-grow: 1;
}

.task-question {
  margin-bottom: 5px;
  font-size: 15px;
  line-height: 1.2;
}

.task-points {
  font-size: 0.8em;
  color: #555;
  font-weight: normal;
}

/* Сітки */
.grid-box {
  border: 1px solid #ccc;
  width: 100%;
  background-image:
    linear-gradient(#ccc 1px, transparent 1px),
    linear-gradient(90deg, #ccc 1px, transparent 1px);
  background-size: 20px 20px;
}

.math-grid,
.math-grid-bg {
  width: 100%;
  border: 1px solid #aaa;
  background-image:
    linear-gradient(#add8e6 1px, transparent 1px),
    linear-gradient(90deg, #add8e6 1px, transparent 1px);
  background-size: 5mm 5mm;
  background-position: -1px -1px;
}

/* MCQ / тести */
.mcq-options,
.mcq-row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px 20px;
  margin-top: 5px;
}

.mcq-opt,
.mcq-option,
.mcq-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12pt;
}

.mcq-opt {
  flex: 1 0 45%;
  gap: 8px;
  font-size: 14px;
}

.box,
.checkbox,
.checkbox-square {
  width: 4mm;
  height: 4mm;
  border: 1px solid #000;
  display: inline-block;
  background: #fff;
  flex-shrink: 0;
}

/* Match */
.match-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 12pt;
}

.match-table td {
  border: none;
  padding: 4px 5px;
  vertical-align: middle;
}

.match-center,
.match-col-center {
  text-align: center;
  font-weight: bold;
  white-space: nowrap;
}

.match-col-left { width: 40%; text-align: left; }
.match-col-right { width: 50%; text-align: left; padding-left: 10px; }

.match-answer-box {
  display: inline-block;
  width: 6mm;
  height: 6mm;
  border: 1px solid #000;
  vertical-align: middle;
}

.match-container {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 5px;
}

.match-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.match-answer-area {
  border: 2px solid #000;
  padding: 5px;
  display: flex;
  gap: 10px;
}

.match-box-pair {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid #ccc;
}

.small-box {
  width: 5mm;
  height: 5mm;
  border: 1px solid #000;
}

/* Problem layout */
.problem-layout {
  display: flex;
  border: 1px solid #999;
}

.problem-given {
  width: 25%;
  border-right: 1px solid #999;
  padding: 5px;
  font-size: 11pt;
}

.problem-solve {
  width: 75%;
  background-image:
    linear-gradient(#ccc 1px, transparent 1px),
    linear-gradient(90deg, #ccc 1px, transparent 1px);
  background-size: 5mm 5mm;
}

/* Tasks wrapper */
.tasks-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Responsive */
@media (max-width: 900px) {
  .layoutGrid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    margin-bottom: 1.5rem;
  }

  .filterRowTop {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .filterBar {
    grid-template-columns: 1fr;
  }

  .taskCard {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 1rem;
  }

  .taskIcon {
    margin: 0 auto;
  }

  .taskTags {
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .variants-grid {
    grid-template-columns: 1fr;
  }
}

/* Unified print styles */
@media print {
  @page {
    size: A4;
    margin: 1cm;
  }

  body {
    margin: 0;
    padding: 0;
    background: #fff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body * {
    visibility: hidden;
    height: 0;
    overflow: hidden;
  }

  #printableArea,
  #printableArea * {
    visibility: visible;
    height: auto;
    overflow: visible;
  }

  #printableArea {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    display: block !important;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border: none;
    background: #fff;
    color: #000;
    font-family: "Times New Roman", serif;
    font-size: 14px;
  }

  .sheet-a4 {
    display: block !important;
    border: none;
    margin: 0;
    padding: 0;
    max-width: none;
    width: 100%;
  }

  .sheet-header { margin-bottom: 10px; }
  .sheet-title { margin: 10px 0; font-size: 14px; }
  .task-item { margin-bottom: 15px; }
  .grid-box { height: 80px !important; }
}

/* ===== SR.HTML-STYLE PDF SHEET (CANONICAL) ===== */
#printableArea.page {
  width: 210mm;
  min-height: 297mm;
  background: #fff;
  padding: 1cm;
  box-sizing: border-box;
  font-family: "Times New Roman", serif;
  font-size: 12px;
  color: #000;
  box-shadow: 0 0 6px rgba(0,0,0,0.4);
  display: none;
  overflow: hidden; /* максимум 1 сторінка */
}

/* Базові стилі еталону */
#printableArea .top-line {
  border-bottom: 1px solid #000;
  display: inline-block;
  height: 10px;
  min-width: 3cm;
  vertical-align: baseline;
}

#printableArea .header-row {
  width: 100%;
  margin-bottom: 0.5cm;
  font-size: 13px;
}
#printableArea .header-row span {
  margin-right: 0.5cm;
}

#printableArea h1 {
  text-align: center;
  margin: 0;
  font-size: 16px;
}
#printableArea h2 {
  text-align: center;
  margin: 1mm 0 0 0;
  font-size: 12px;
  font-weight: normal;
}

#printableArea .level-title {
  text-align: center;
  font-weight: bold;
  margin: 0.25cm 0 0 0;
}

#printableArea .task {
  margin-top: 0.25cm;
  page-break-inside: avoid;
}
#printableArea .task-title {
  margin-bottom: 2mm;
}
#printableArea .task-title b {
  font-weight: bold;
}
#printableArea .task-points-wrap {
  font-style: italic;
  font-weight: bold;
  color: #464141;
}

/* Підкреслення відповіді */
#printableArea .answer-underline {
  margin-top: 2mm;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 0.2cm;
}
#printableArea .answer-label {
  white-space: nowrap;
}
#printableArea .answer-line {
  width: 25%;
  min-width: 2cm;
}

/* Таблиці/клітинки */
#printableArea table {
  border-collapse: collapse;
}

#printableArea .grid-table {
  border-collapse: collapse;
  table-layout: fixed;
}
#printableArea .grid-table td {
  border: 1px solid #464141;
  width: 0.5cm;
  height: 0.5cm;
  padding: 0;
}
#printableArea .cell-small,
#printableArea .cell-medium,
#printableArea .cell-large {
  margin-top: 2mm;
  margin-bottom: 2mm;
  width: 100%;
}

/* MCQ */
#printableArea .mcq-table {
  width: 100%;
  margin-top: 2mm;
  border-collapse: collapse;
  table-layout: fixed;
}
#printableArea .mcq-table td {
  border: 1px solid #000;
  height: 1cm;
  vertical-align: middle;
  padding: 0 0.3cm;
  font-size: 13px;
}
#printableArea .mcq-option-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.2cm;
}
#printableArea .mcq-letter {
  font-weight: bold;
  margin-right: 0.2cm;
  white-space: nowrap;
}
#printableArea .mcq-text {
  flex: 1 1 auto;
  text-align: left;
}

/* Box */
#printableArea .box {
  display: inline-block;
  width: 0.5cm;
  height: 0.5cm;
  border: 1px solid #464141;
  box-sizing: border-box;
  flex-shrink: 0;
}

/* Match */
#printableArea .flex-row {
  display: flex;
  gap: 6mm;
  margin-top: 2mm;
  width: 100%;
}
#printableArea .match-left,
#printableArea .match-mid,
#printableArea .match-right {
  border: 1px solid #000;
  padding: 0;
  border-collapse: collapse;
  font-size: 13px;
}
#printableArea .match-left  { flex: 1.2; }
#printableArea .match-mid   { flex: 1.2; }
#printableArea .match-right { border-width: 1px 1px 0 1px; border-style: solid; }

#printableArea .match-left td,
#printableArea .match-mid td,
#printableArea .match-right td {
  border-bottom: 1px solid #000;
  padding: 0 6px;
  height: 1cm;
}

#printableArea .match-right td {
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1cm;
}
#printableArea .match-letter {
  font-weight: bold;
}

/* Geometry */
#printableArea .geom-row {
  display: flex;
  gap: 0.5cm;
  margin-top: 2mm;
}
#printableArea .geom-left {
  flex: 0 0 auto;
}
#printableArea .geom-right {
  flex: 1 1 auto;
  font-size: 13px;
}
#printableArea .geom-right p {
  margin: 0 0 2mm 0;
}

/* Image choice */
#printableArea .image-choice-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 3mm;
  table-layout: fixed;
}
#printableArea .image-choice-table td {
  border: 1px solid #000;
  padding: 0;
  height: 6cm;
  vertical-align: bottom;
  position: relative;
}
#printableArea .choice-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  padding: 0.5cm 0.3cm 0.3cm 0.3cm;
  box-sizing: border-box;
}
#printableArea .choice-box {
  position: absolute;
  top: 0.3cm;
  right: 0.3cm;
}
#printableArea .choice-image {
  width: 100%;
  height: 4cm;
  border: 1px solid #000;
  box-sizing: border-box;
  margin-bottom: 0.3cm;
}
#printableArea .choice-label {
  font-weight: bold;
}

#printableArea .footer-mark {
  margin-top: 1cm;
  font-size: 13px;
}

/* Друк: показуємо тільки еталонний аркуш */
@media print {
  @page {
    size: A4;
    margin: 1cm;
  }

  body * {
    visibility: hidden !important;
  }

  #printableArea,
  #printableArea * {
    visibility: visible !important;
  }

  #printableArea.page {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: auto;
    min-height: auto;
    box-shadow: none;
    overflow: hidden;
  }
}

/* ===== FIX HEADER (як у sr.html) ===== */

#printableArea .header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10mm;
  width: 100%;
  margin: 0 0 6mm 0;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

#printableArea .header-row > span {
  display: inline-flex;
  align-items: baseline;
  gap: 2mm;
  margin: 0; /* прибираємо старі margin-right */
  white-space: nowrap;
}

/* Прізвище — займає весь вільний простір */
#printableArea .header-row > span:first-child {
  flex: 1 1 auto;
}

/* Клас і дата — фіксована ширина як у еталоні */
#printableArea .header-row > span:nth-child(2),
#printableArea .header-row > span:nth-child(3) {
  flex: 0 0 auto;
}

/* Лінії в шапці */
#printableArea .top-line {
  display: inline-block;
  vertical-align: baseline;
  border-bottom: 1px solid #000;
  height: 0;              /* критично: прибирає "провал" вниз */
  line-height: 1;
  min-width: 0;
}

/* Конкретні ширини полів у шапці (під еталон) */
#printableArea .header-row > span:first-child .top-line { width: 8.5cm !important; }
#printableArea .header-row > span:nth-child(2) .top-line { width: 1.2cm !important; }
#printableArea .header-row > span:nth-child(3) .top-line { width: 3.0cm !important; }

/* На друк не даємо шапці зламатися */
@media print {
  #printableArea .header-row {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

#printableArea .header-row {
  gap: 6mm; /* було 10mm */
}

#printableArea .header-row > span {
  gap: 1.5mm;
}

/* Було 8.5cm — занадто довге */
#printableArea .header-row > span:first-child .top-line { width: 6.8cm !important; }

/* Клас лишаємо коротким */
#printableArea .header-row > span:nth-child(2) .top-line { width: 1.1cm !important; }

/* Дату трохи компактніше, але достатньо */
#printableArea .header-row > span:nth-child(3) .top-line { width: 2.6cm !important; }
/* --- Ліміт генерацій (вчитель) --- */
.dailyLimitInline,
.dailyLimitModal {
  background: #fff;
  border: 1px solid rgba(72, 17, 191, 0.14);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: 0 4px 12px rgba(22, 36, 41, 0.03);
}

.dailyLimitModal {
  background: rgba(252, 250, 255, 0.95);
}

.limitCard {
  display: grid;
  gap: 8px;
}

.limitCard__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.limitCard__title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.limitCard__value {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.limitCard__value strong {
  color: var(--p1);
}

.limitCard__bar {
  width: 100%;
  height: 10px;
  background: rgba(72, 17, 191, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.limitCard__fill {
  height: 100%;
  background: var(--grad);
  width: 0%;
  transition: width .2s ease;
}

.limitCard__note {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.limitCard--exhausted {
  border-color: rgba(240,107,100,.35);
}

.limitCard--exhausted .limitCard__fill {
  width: 100% !important;
}

.variant-card.disabled {
  border-style: dashed;
  background: rgba(22, 36, 41, 0.03);
  opacity: .85;
  justify-content: center;
  min-height: 250px;
  cursor: not-allowed;
}

.variant-card.disabled .variant-title {
  color: var(--muted);
}

.variant-card.disabled .variant-desc {
  margin-bottom: 0;
}

.ctaBanner {
  border-radius: 22px;
  padding: 32px 28px;
  background: linear-gradient(135deg, rgba(72,17,191,.08), rgba(9,166,3,.05));
  border: 1px solid rgba(72,17,191,.18);
  text-align: center;
  display: grid;
  gap: 16px;
  place-items: center;
}
.ctaBanner__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text-title, var(--ink));
  margin: 0;
}
.ctaBanner__text {
  font-size: 16px;
  color: var(--color-text-body, var(--muted));
  line-height: 1.5;
  max-width: 600px;
  margin: 0;
}
.ctaBanner__features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 700px;
  margin-top: 8px;
}
.ctaFeature {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(229,223,241,.9);
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text-title, var(--ink));
  text-align: left;
}
.ctaFeature__icon {
  font-size: 20px;
  flex-shrink: 0;
}

/* Student-style daily limit block (applied to teacher generator too) */
.limitPromo {
  background: #f3f2f8;
  border: 1px solid #e7e4f2;
  border-radius: 0;
  padding: 14px 16px 14px;
  display: grid;
  gap: 10px;
}
.dailyLimitInline .limitPromo,
.dailyLimitModal .limitPromo {
  border-radius: 0;
}
.limitPromo__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.limitPromo__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 800;
  color: #4f46e5;
  line-height: 1.15;
}
.limitPromo__bolt {
  font-size: 18px;
  line-height: 1;
}
.limitPromo__count {
  font-weight: 800;
  font-size: 18px;
  color: #111827;
}
.limitPromo__bar {
  width: 100%;
  height: 10px;
  background: #f1d6d6;
  border-radius: 999px;
  overflow: hidden;
}
.limitPromo__barFill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: #f44336;
}
.limitPromo__cta {
  border: 1px solid #cfc3f2;
  background: #ece8f6;
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.limitPromo__btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 999px;
  min-height: 44px;
  padding: 0 20px;
  background: linear-gradient(180deg, #7c4dff, #6a3eea);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(106, 62, 234, .22);
}
.limitPromo__btn:hover { filter: brightness(.98); }
.limitPromo__ctaText {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  color: #2c2b33;
  font-weight: 500;
}
.limitPromo__ctaText b,
.limitPromo__ctaText strong { font-weight: 800; }
.limitPromo__note {
  margin: 0;
  font-size: 12px;
  color: #6b7280;
}
.limitPromo.is-exhausted .limitPromo__bar {
  background: #f4caca;
}
.limitPromo.is-exhausted .limitPromo__cta {
  border-color: #d9c9fb;
  background: #efeafd;
}
@media (max-width: 680px) {
  .limitPromo__cta {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .limitPromo__btn { width: 100%; }
}
