.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.controls-card {
  border-radius: var(--radius-lg);
  padding: 26px;
  margin-bottom: 24px;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
}

.control-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  color: var(--muted);
}

.control-field input[type="text"],
.control-field select {
  background: var(--surface-soft);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 16px;
  font-size: 1rem;
}

.control-field input[type="text"]:focus,
.control-field select:focus {
  outline: none;
  border-color: var(--accent);
}

.control-field-checkbox {
  justify-content: flex-end;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 0.92rem;
  cursor: pointer;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.control-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 22px;
}

/* ── The worksheet itself — styled to look like paper even on screen ── */
.worksheet-sheet {
  background: #fdfcf8;
  color: #1a1a2e;
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  box-shadow: var(--shadow);
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 2px solid #1a1a2e;
  padding-bottom: 14px;
  margin-bottom: 6px;
}

.sheet-header h2 {
  margin: 0;
  font-size: 1.6rem;
}

.sheet-fields {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.fill-line {
  display: inline-block;
  min-width: 140px;
  border-bottom: 1px solid #1a1a2e;
  margin-left: 6px;
}

.sheet-instructions {
  margin: 14px 0 22px;
  color: #4a4a5e;
  font-size: 0.92rem;
}

.exercise-grid {
  display: grid;
  grid-template-columns: repeat(var(--worksheet-columns, 2), 1fr);
  gap: 22px 18px;
}

.exercise-item {
  border: 1px solid #d8d4c8;
  border-radius: 12px;
  padding: 10px 12px 14px;
  break-inside: avoid;
}

.exercise-number {
  font-weight: 800;
  font-size: 0.85rem;
  color: #6a6a80;
  margin-bottom: 2px;
}

.exercise-staff {
  display: flex;
  justify-content: center;
}

.exercise-staff svg {
  max-width: 100%;
  height: auto;
}

.exercise-answer-line {
  margin-top: 4px;
  border-bottom: 1px solid #8a8698;
  height: 1.4em;
}

.answer-key {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 2px dashed #8a8698;
}

.answer-key h3 {
  margin: 0 0 12px;
}

.answer-key-list {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px 12px;
  padding-left: 0;
  list-style: none;
  font-weight: 700;
}

.answer-key-list li {
  display: flex;
  gap: 6px;
}

.answer-key-list .answer-index {
  color: #6a6a80;
  font-weight: 600;
}

@media (max-width: 760px) {
  .worksheet-sheet {
    padding: 24px 18px;
  }

  .exercise-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .answer-key-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Print ─────────────────────────────────────────────────────── */
@media print {
  .app-nav,
  .topbar,
  .no-print {
    display: none !important;
  }

  body {
    background: white !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .worksheet-sheet {
    box-shadow: none !important;
    color: #000;
  }

  .exercise-item {
    border-color: #999;
  }

  .answer-key {
    page-break-before: always;
    border-top: none;
    padding-top: 0;
  }
}
