.lab {
  --lab-accent: #34765c;
  --lab-accent-dark: #245640;
  --lab-ink: #243a32;
  --lab-muted: #5c6e65;
  --lab-border: #d8e2dc;
  --lab-soft: #f3f7f3;
  --lab-danger: #8b492e;
  box-sizing: border-box;
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--lab-border);
  border-radius: 22px;
  background: #fff;
  color: var(--lab-ink);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.lab *, .lab *::before, .lab *::after { box-sizing: border-box; }
.lab [hidden] { display: none !important; }
.lab button, .lab input, .lab select, .lab textarea { font: inherit; }
.lab-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.lab-kicker { color: var(--lab-accent-dark); font-size: .76em; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.lab-badge { display: inline-flex; padding: 4px 10px; border-radius: 999px; background: #edf2ed; color: #53655b; font-size: .76em; font-weight: 650; }
.lab-badge-success { background: #e4f1e7; color: #245640; }
.lab-question { margin: 0 0 10px; color: var(--lab-ink); font-size: clamp(1.2em, 2.5vw, 1.45em); font-weight: 700; line-height: 1.38; letter-spacing: -.015em; }
.lab-instructions { margin: 0 0 22px; color: var(--lab-muted); font-size: .92em; }
.lab-body { min-width: 0; }
.lab-note { margin: 0; color: var(--lab-muted); }
.lab-options { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
.lab-option { display: flex; align-items: flex-start; gap: 12px; min-width: 0; padding: 16px 18px; border: 1px solid var(--lab-border); border-radius: 13px; background: #fff; cursor: pointer; transition: background-color 120ms ease, border-color 120ms ease; }
.lab-option:hover { border-color: #91b29f; background: #f8faf7; }
.lab-option-selected { border-color: var(--lab-accent); background: #f0f6f0; }
.lab-option:focus-within, .lab-self-check:focus-within { outline: 3px solid #34765c; outline-offset: 3px; }
.lab-choice-input { flex: 0 0 auto; width: 20px; height: 20px; margin: .2em 0 0; accent-color: var(--lab-accent); cursor: pointer; }
.lab-option-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; gap: 4px; }
.lab-option-text { white-space: pre-wrap; }
.lab-answer-status { display: block; width: fit-content; margin-top: 3px; color: var(--lab-muted); font-size: .78em; font-weight: 650; line-height: 1.45; }
.lab-answer-correct { border-color: #85ab91 !important; background: #f1f7f0 !important; }
.lab-answer-correct .lab-answer-status { color: #2e6044; }
.lab-answer-incorrect { border-color: #c7a587 !important; background: #fdf8f1 !important; }
.lab-answer-incorrect .lab-answer-status { color: var(--lab-danger); }
.lab-compare { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.lab-compare-card { padding: 20px 18px; }
.lab-compare-title { display: block; margin-bottom: 5px; font-weight: 750; }
.lab-compare-text { display: block; color: #3e5148; white-space: pre-wrap; font-size: .94em; line-height: 1.65; }
.lab-sort-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.lab-sort-row { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 14px; border: 1px solid var(--lab-border); border-radius: 13px; background: #fbfcfa; }
.lab-sort-number { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 32px; width: 32px; height: 32px; border: 1px solid #dce5dd; border-radius: 10px; background: #fff; color: var(--lab-accent-dark); font-size: .85em; font-weight: 750; }
.lab-sort-copy { flex: 1; min-width: 0; }
.lab-sort-text { display: block; white-space: pre-wrap; font-size: .94em; }
.lab-sort-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.lab-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; border: 1px solid var(--lab-border); border-radius: 10px; background: #fff; color: var(--lab-accent-dark); font-weight: 650; font-size: .9em; line-height: 1.4; text-align: center; cursor: pointer; transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease; }
.lab-button:hover { border-color: #8da997; background: #f0f5ef; }
.lab-button:active { background: #e4ede3; }
.lab-button-primary { border-color: var(--lab-accent); background: var(--lab-accent); color: #fff; box-shadow: 0 2px 3px #244c3210; }
.lab-button-primary:hover { border-color: var(--lab-accent-dark); background: var(--lab-accent-dark); }
.lab-button-primary:active { background: #1e4936; }
.lab-button-quiet { min-height: 42px; padding: 8px 12px; background: #f7f9f5; font-size: .85em; }
.lab-move-button { min-height: 44px; padding: 7px 10px; font-size: .76em; white-space: nowrap; }
.lab-button:disabled { border-color: #e2e7e1; background: #f4f6f2; color: #9aa49b; cursor: default; box-shadow: none; }
.lab-button[aria-disabled="true"] { border-color: var(--lab-border); background: #f4f6f2; color: var(--lab-muted); box-shadow: none; }
.lab-button:focus-visible, .lab-select:focus-visible, .lab-textarea:focus-visible, .lab-choice-input:focus-visible { outline: 3px solid var(--lab-accent); outline-offset: 3px; }
.lab-classify-list { display: grid; gap: 10px; }
.lab-classify-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, .65fr); align-items: start; gap: 18px; padding: 16px 18px; border: 1px solid var(--lab-border); border-radius: 13px; background: #fbfcfa; }
.lab-classify-label { padding-top: 9px; font-size: .94em; cursor: pointer; white-space: pre-wrap; }
.lab-classify-control { min-width: 0; }
.lab-select { display: block; width: 100%; min-height: 44px; padding: 8px 32px 8px 11px; border: 1px solid #bacdbd; border-radius: 9px; background-color: #fff; color: var(--lab-ink); font-size: .88em !important; cursor: pointer; }
.lab-source { margin-bottom: 20px; padding: 18px 20px; border-left: 3px solid #a8bdab; border-radius: 0 12px 12px 0; background: var(--lab-soft); }
.lab-source-label, .lab-explanation-label { color: var(--lab-muted); font-size: .75em; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.lab-source-text { margin: 7px 0 0; color: #3e5148; white-space: pre-wrap; font-size: .95em; }
.lab-field-label { display: block; margin-bottom: 8px; font-size: .93em; font-weight: 700; }
.lab-textarea { display: block; width: 100%; min-height: 168px; max-height: 70vh; padding: 14px 16px; border: 1px solid #b5c8b9; border-radius: 12px; background: #fff; color: var(--lab-ink); line-height: 1.65; resize: vertical; }
.lab-textarea::placeholder { color: #7a897e; }
.lab-field-note { margin: 8px 0 22px; color: var(--lab-muted); font-size: .78em; line-height: 1.55; }
.lab-self-checks { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.lab-self-check-title { padding: 0; margin-bottom: 10px; color: var(--lab-ink); font-size: .94em; font-weight: 750; }
.lab-self-check { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid #e1e8df; border-radius: 11px; background: #f8faf6; cursor: pointer; }
.lab-self-check-done { border-color: #a7bea9; background: #f0f6ec; }
.lab-check-label { font-size: .92em; font-weight: 600; }
.lab-check-hint { color: var(--lab-muted); font-size: .8em; line-height: 1.5; }
.lab-hint-wrap { margin: 0 0 22px; }
.lab-hint { margin-top: 12px; padding: 16px 18px; border-left: 3px solid #91ad98; border-radius: 0 12px 12px 0; background: var(--lab-soft); }
.lab-hint-title { margin: 0 0 8px; font-size: .94em; }
.lab-hint-criterion { margin: 0; font-size: .92em; font-weight: 650; }
.lab-hint-detail { margin: 5px 0 0; color: #3e5148; font-size: .9em; white-space: pre-wrap; }
.lab-hint-note { margin: 10px 0 0; color: var(--lab-muted); font-size: .78em; line-height: 1.55; }
.lab-sample-wrap { margin-top: 18px; }
.lab-sample-guidance { margin: 8px 0 0; color: var(--lab-muted); font-size: .8em; line-height: 1.55; }
.lab-sample { margin-top: 12px; padding: 18px 20px; border: 1px dashed #a7bda8; border-radius: 13px; background: #f6f8f1; }
.lab-sample-title { margin: 0 0 9px; font-size: .94em; font-weight: 750; }
.lab-sample-text { margin: 0; color: #3d5143; font-size: .92em; white-space: pre-wrap; }
.lab-sample-note { margin: 12px 0 0; color: var(--lab-muted); font-size: .78em; line-height: 1.55; }
.lab-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 20px; margin-top: 24px; padding-top: 20px; border-top: 1px solid #e6ece4; }
.lab-attempts { color: var(--lab-muted); font-size: .78em; }
.lab-feedback { margin-top: 18px; padding: 18px 20px; border: 1px solid var(--lab-border); border-radius: 13px; background: var(--lab-soft); }
.lab-feedback-success { border-color: #a2c4a9; background: #edf6eb; }
.lab-feedback-retry { border-color: #d6c4aa; background: #fcf8ef; }
.lab-feedback-edited { padding: 12px 16px; background: #f4f7f2; }
.lab-feedback-title { margin: 0 0 6px; color: var(--lab-ink); font-size: 1em; font-weight: 750; }
.lab-feedback-message { margin: 0; color: #4c6052; font-size: .87em; }
.lab-explanation { margin-top: 15px; padding-top: 12px; border-top: 1px solid #71816c26; }
.lab-explanation p { margin: 5px 0 0; color: #3c5141; font-size: .92em; white-space: pre-wrap; }
.lab-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 680px) {
  .lab-compare { grid-template-columns: 1fr; }
  .lab-classify-row { grid-template-columns: 1fr; gap: 10px; }
  .lab-classify-label { padding-top: 0; }
  .lab-sort-row { flex-wrap: wrap; gap: 10px; }
  .lab-sort-copy { flex-basis: calc(100% - 44px); }
  .lab-sort-actions { width: 100%; justify-content: flex-end; }
  .lab-move-button { min-width: 85px; }
}

@media (max-width: 380px) {
  .lab { padding: 17px 14px; border-radius: 16px; }
  .lab-option, .lab-classify-row { padding: 13px; }
  .lab-footer .lab-button-primary { width: 100%; }
  .lab-header { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .lab *, .lab *::before, .lab *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media (forced-colors: active) {
  .lab-option-selected, .lab-self-check-done { outline: 2px solid Highlight; outline-offset: -3px; }
  .lab-answer-correct, .lab-answer-incorrect { border: 2px solid CanvasText !important; }
  .lab-button-primary { border: 2px solid ButtonText; }
}
