.instruction-section {
  /* margin, padding, border, background are delegated to Card.css */
}

.instruction-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  margin: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.instruction-text {
  margin: 0 0 12px 0;
  font-family: inherit;
  font-size: 16px;
  white-space: pre-wrap;
  line-height: 1.6;
  color: var(--fg);
}

.instruction-figure {
  margin: 12px 0;
  text-align: center;
}

.instruction-figure-img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  mix-blend-mode: multiply;
}

:root.dark-mode .instruction-figure-img {
  filter: invert(100%);
  mix-blend-mode: screen;
}

.instruction-figure figcaption {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-top: 4px;
}

.instruction-figure-placeholder {
  margin: 8px 0;
  padding: 8px;
  background: var(--eval-bg);
  color: var(--fg-muted);
  font-size: 15px;
  font-style: italic;
  border: 1px dashed var(--input-border);
  border-radius: 4px;
}

.instruction-markdown {
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg);
  margin-bottom: 12px;
}

.instruction-markdown p {
  margin: 0 0 8px 0;
}

.instruction-markdown h2,
.instruction-markdown h3,
.instruction-markdown h4 {
  margin: 12px 0 6px 0;
  color: var(--fg);
}

.instruction-markdown ol,
.instruction-markdown ul {
  margin: 0 0 8px 0;
  padding-left: 1.5em;
}

.instruction-markdown li {
  margin-bottom: 4px;
}

.instruction-markdown table {
  border-collapse: collapse;
  font-size: 15px;
  margin: 8px auto;
  width: 100%;
}

.instruction-markdown th,
.instruction-markdown td {
  border: 2px solid var(--border-color);
  padding: 6px 10px;
  text-align: left;
  color: var(--fg);
}

.instruction-markdown th {
  background: var(--eval-bg);
  font-weight: 600;
}

.blank-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4em;
  border-bottom: 1.5px solid var(--fg);
  vertical-align: bottom;
  position: relative;
}

.blank-placeholder,
.blank-label {
  font-weight: bold;
  color: var(--fg);
  pointer-events: none;
}

.blank-label {
  font-size: 1em;
  font-weight: bold;
  border-bottom: 1.5px solid currentColor;
  padding: 0 1em;
}

.instruction-markdown u,
.instruction-text u {
  text-decoration: none;
  border-bottom: 1.5px solid currentColor;
  display: inline;
  font-weight: bold;
}

.underline-label {
  vertical-align: baseline;
  margin-right: 0.1em;
  color: var(--fg-muted);
}

.instruction-table {
  margin: 12px 0;
  overflow-x: auto;
}

.instruction-table figcaption {
  font-size: 0.9rem;
  color: var(--fg-muted);
  margin-bottom: 6px;
}

.instruction-table table {
  border-collapse: collapse;
  font-size: 15px;
  width: 100%;
}

.instruction-table th,
.instruction-table td {
  border: 2px solid var(--border-color);
  padding: 6px 10px;
  text-align: left;
  color: var(--fg);
}

.instruction-table th {
  background: var(--eval-bg);
  font-weight: 600;
}

.ref-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1.5px solid currentColor;
  font-weight: bold;
  cursor: pointer;
}

.ref-link:hover {
  opacity: 0.7;
}

@keyframes ref-highlight {
  0% {
    background-color: rgba(212, 207, 213, 0.3);
    outline: 2px solid var(--secondary);
  }
  70% {
    background-color: rgba(212, 207, 213, 0.3);
    outline: 2px solid var(--secondary);
  }
  100% {
    background-color: transparent;
    outline: 2px solid transparent;
  }
}

.ref-target-highlight {
  animation: ref-highlight 1.8s ease-out forwards;
  border-radius: 2px;
}

@media (max-width: 768px) {
  .instruction-markdown table,
  .instruction-table table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
