/* ── ОСНОВНИЙ КОНТЕЙНЕР ── */
.detective-wrap {
  margin: 0 auto;
  font-family: 'Georgia', serif;
  max-width: 100% !important;
}
.detective-intro {
  background: #f8f6f0;
  border-left: 4px solid #8b6914;
  padding: 1em 1.2em;
  margin-bottom: 1.5em;
  border-radius: 0 6px 6px 0;
  font-size: 0.95em;
  color: #444;
}

/* ── КАРТКА ВАРІАНТУ ── */
.variant-card {
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-bottom: 1.5em;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.variant-header {
  background: #2c3e50;
  color: #fff;
  padding: 0.7em 1.2em;
  display: flex;
  align-items: center;
  gap: 0.8em;
}
.variant-badge {
  background: #e67e22;
  color: #fff;
  font-size: 0.8em;
  font-weight: bold;
  padding: 2px 10px;
  border-radius: 12px;
  white-space: nowrap;
  font-family: sans-serif;
}
.variant-theme {
  font-size: 1em;
  font-style: italic;
  opacity: 0.9;
}

/* ── ТЕКСТ ── */
.detective-text {
  padding: 1.2em;
}
.text-label {
  font-size: 0.85em;
  color: #888;
  margin-bottom: 0.6em;
  font-family: sans-serif;
}
.corrupted-text {
  line-height: 1.8;
  color: #222;
  font-size: 1em;
}

/* ── КНОПКИ ── */
.show-answers-btn {
  display: block;
  margin: 0 1.2em 0.8em;
  background: #2c3e50;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 7px 18px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background 0.2s;
  font-family: sans-serif;
}
.show-answers-btn:hover { background: #1a252f; }
.show-answers-btn.open { background: #27ae60; }

.print-controls {
  padding: 0 1.2em 1em;
}
.print-single-btn {
  background: #fff;
  border: 1px solid #bbb;
  border-radius: 5px;
  padding: 5px 14px;
  cursor: pointer;
  font-size: 0.85em;
  color: #555;
  font-family: sans-serif;
}
.print-single-btn:hover { background: #f5f5f5; }

/* ── ТАБЛИЦЯ ВІДПОВІДЕЙ ── */
.answers-section {
  padding: 0.5em 1.2em 1em;
  background: #f9fdf9;
  border-top: 1px solid #e0ede0;
}
.errors-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
  font-family: sans-serif;
}
.errors-table th {
  background: #e8f4e8;
  color: #2e7d32;
  padding: 5px 8px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid #c8e6c9;
}
.errors-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}
.err-n { font-weight: bold; color: #888; width: 2em; }
.err-wrong { color: #c62828; text-decoration: line-through; }
.err-arrow { color: #aaa; width: 1.5em; }
.err-correct { color: #2e7d32; font-weight: 600; }
.err-hint { color: #777; font-style: italic; font-size: 0.85em; }
.type-badge {
  font-size: 0.75em;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  font-weight: 600;
  background: #e3f2fd;
  color: #1565c0;
}

/* ── НАВІГАЦІЙНІ ВКЛАДКИ ── */
.variant-tabs {
  display: flex;
  gap: 0.5em;
  margin-bottom: 1.2em;
  flex-wrap: wrap;
  font-family: sans-serif;
}
.tab-btn {
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 5px 14px;
  cursor: pointer;
  font-size: 0.85em;
  color: #555;
}
.tab-btn:hover { background: #e5e5e5; }
.tab-btn.active { background: #2c3e50; color: #fff; border-color: #2c3e50; }

/* ── ВЕРСІЯ ДЛЯ ДРУКУ ── */
.all-print-sections { display: none; }

@media print {
  .detective-intro, .variant-tabs, .show-answers-btn,
  .answers-section, .print-controls, .print-single-btn,
  #online-section { display: none !important; }

  .all-print-sections { display: block !important; }
  .print-card {
    page-break-after: always;
    padding: 1.5em;
    font-family: 'Times New Roman', serif;
  }
  .print-card:last-child { page-break-after: avoid; }
}

/* ── МОДАЛЬНЕ ВІКНО ДРУКУ ── */
#print-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2vh 1em;
  overflow-y: auto;
}
#print-modal {
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 820px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.35);
  margin: auto;
}
#print-modal-toolbar {
  background: #2c3e50;
  color: #fff;
  padding: 0.7em 1.2em;
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5em;
  font-family: sans-serif;
  font-size: 0.9em;
  position: sticky;
  top: 0;
  z-index: 10;
}
#print-modal-toolbar-left { flex: 1; min-width: 0; }
#print-modal-toolbar-right { display: flex; gap: 0.5em; flex-shrink: 0; }
.modal-btn {
  border: none;
  border-radius: 5px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.85em;
  font-family: sans-serif;
  font-weight: 600;
  transition: opacity 0.15s;
}
.modal-btn:hover { opacity: 0.85; }
.modal-btn-copy  { background: #3498db; color: #fff; }
.modal-btn-print { background: #27ae60; color: #fff; }
.modal-btn-close { background: #e74c3c; color: #fff; }

#print-modal-content {
  padding: 2em 2.5em;
  font-family: 'Times New Roman', serif;
  font-size: 12pt;
  line-height: 1.6;
  flex: 1;
  overflow-y: auto;
}

/* розділювач між варіантами у модалці */
#print-modal-content .print-card {
  border-bottom: 2px dashed #ccc;
  padding-bottom: 2em;
  margin-bottom: 2em;
}
#print-modal-content .print-card:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

/* ── РОЗДАТКОВИЙ МАТЕРІАЛ ── */
.print-card {
  font-family: 'Times New Roman', serif;
  font-size: 12pt;
  line-height: 1.6;
}
.print-card-header {
  border-bottom: 2px solid #000;
  padding-bottom: 0.5em;
  margin-bottom: 1em;
}
.print-card-title {
  font-size: 14pt;
  font-weight: bold;
  letter-spacing: 1px;
}
.print-card-subtitle {
  font-size: 11pt;
  color: #333;
  margin-top: 0.2em;
}
.print-card-variant {
  font-size: 10pt;
  color: #555;
  font-style: italic;
  margin-top: 0.2em;
}
.print-student-info {
  margin: 0.8em 0;
}
.print-field-row {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  margin-bottom: 0.4em;
  flex-wrap: wrap;
}
.print-label {
  font-size: 10pt;
  white-space: nowrap;
}
.print-line {
  flex: 1;
  border-bottom: 1px solid #000;
  min-width: 150px;
}
.print-line.short {
  flex: 0 0 80px;
  min-width: 80px;
}
.print-instruction {
  background: #f5f5f5;
  border: 1px solid #ccc;
  padding: 0.5em 0.8em;
  margin: 0.8em 0;
  font-size: 10pt;
  border-radius: 4px;
}
.print-text-block {
  margin: 1em 0;
  text-align: justify;
  line-height: 1.8;
  font-size: 11pt;
}
.print-answer-section {
  margin-top: 1em;
}
.print-answer-title {
  font-weight: bold;
  font-size: 10pt;
  margin-bottom: 0.4em;
}
.print-student-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10pt;
}
.print-student-table th {
  border: 1px solid #000;
  padding: 4px 6px;
  text-align: left;
  font-weight: bold;
  background: #f0f0f0;
}
.print-student-table td {
  border: 1px solid #000;
  padding: 8px 6px;
  min-height: 28px;
}
.ps-n { width: 2em; text-align: center; }
.ps-arrow { width: 2em; text-align: center; }