/* Optional practice controls use the site's shared light and dark tokens. */
.lab {
  min-width: 0;
  margin: 24px 0;
  padding: var(--space-16);
  border-radius: var(--r-card);
  background: var(--fill);
  color: var(--ink);
}
.lab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  max-width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-tile);
  background: var(--tile);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.25;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.lab-button:hover { background: var(--fill); }
.lab-button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.lab-button:disabled { opacity: 0.5; cursor: default; }
.lab-primary {
  min-height: 60px; padding-inline: var(--space-24); border: 0;
  border-radius: 999px; background: var(--cta); color: var(--on-cta);
  font-size: 20px; font-weight: 600;
}
.lab-primary:hover { background: var(--cta); }
.lab-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.lab-gap-strip { display: flex; align-items: center; justify-content: center; gap: 2px; }
.lab-gap-mark { display: flex; align-items: center; justify-content: center; width: 16px; flex: 0 0 16px; }
.lab-gap-toggle { min-width: 54px; padding: 8px 2px; font-size: 14px; }
.lab-gap-answer { display: block; font-size: 30px; line-height: 1.2; }
.lab-gap-reading { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 18px; margin-top: 20px; }
.lab-reveal-words { display: flex; flex-wrap: wrap; gap: 18px; }
.lab-reveal-word { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.lab-reveal-letter { flex-direction: column; gap: 12px; min-width: 52px; padding: 12px 8px; }
.lab-reveal-letter .code { --u: 4px; }
.lab-reveal-letter strong { font-size: 22px; }
.lab-character-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); gap: 8px; }
.lab-character-grid .lab-button { padding: 8px; }
.lab-letter-detail { margin-block: 20px; }
.lab-letter-detail p:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.lab-selected-letter { font-size: 30px; }
.lab-rhythm { display: flex; width: 100%; height: 20px; margin-top: 16px; }
.lab-part { min-width: 0; flex: 1 1 0; background: var(--ink); }
.lab-part.lab-dash { flex-grow: 3; }
.lab-part.lab-gap { background: var(--panel); }
.lab-options { min-width: 0; margin: 0 0 16px; padding: 0; border: 0; }
.lab-options legend { font-weight: 600; }
.lab-options .lab-actions { margin-top: 8px; }
.lab-input-label { display: block; margin-top: 20px; margin-bottom: 8px; font-weight: 600; }
.lab textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--bg);
  color: var(--ink);
  resize: vertical;
}
.article .lab-word-results { margin-top: 12px; padding-left: 24px; overflow-wrap: anywhere; }
.lab-copy-answer { overflow-wrap: anywhere; font-weight: 600; }
.article .lab-note { color: var(--sec); font-size: 15px; }
.lab-sort { margin-top: 24px; }
.lab-frequency { margin: var(--space-24) 0; min-width: 0; padding: var(--space-16); border-radius: var(--r-card); background: var(--fill); }
.article .lab-chart-title { font-weight: 600; margin-bottom: 12px; }
.lab-frequency-svg { width: 100%; max-width: 360px; height: auto; margin-inline: auto; overflow: visible; }
.lab-chart-grid { stroke: var(--line); stroke-width: 1; }
.lab-chart-tick, .lab-chart-axis { fill: var(--sec); font-size: 14px; font-family: var(--font); }
.lab-chart-dot { fill: var(--tile); stroke: var(--bg); stroke-width: 2; }
.lab-chart-letter { fill: var(--ink); font-size: 16px; font-weight: 650; font-family: var(--font); pointer-events: none; }
.lab-chart-common .lab-chart-dot { fill: var(--y); }
.lab-chart-common .lab-chart-letter { fill: var(--on-y); }
.lab-chart-long .lab-chart-dot { fill: var(--ink); }
.lab-chart-long .lab-chart-letter { fill: var(--bg); }
.lab-chart-hit { fill: transparent; pointer-events: all; }
.lab-chart-point[role="button"] { cursor: pointer; outline: none; }
.lab-chart-point.is-selected .lab-chart-dot, .lab-chart-point:focus-visible .lab-chart-dot { stroke: var(--sec); stroke-width: 3; }
.article .lab-legend { display: flex; flex-wrap: wrap; gap: 10px 18px; padding: 0; list-style: none; }
.article .lab-legend li { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; }
.lab-marker { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; min-height: 24px; padding: 2px 4px; border-radius: 12px; font-size: 12px; font-weight: 650; }
.lab-marker-common { background: var(--y); color: var(--on-y); }
.lab-marker-long { background: var(--ink); color: var(--bg); }
.lab-marker-neutral { background: var(--tile); color: var(--ink); }
/* Caption appearance is shared in article.css. */
@media (prefers-reduced-motion: reduce) {
  .lab *, .lab-frequency * { animation: none !important; transition: none !important; scroll-behavior: auto; }
}
