.learning-lab {
  --lab-bg: #f7f2e8;
  --lab-panel: #fffdf9;
  --lab-ink: #19163d;
  --lab-muted: #585175;
  --lab-line: #ddd3e8;
  margin: 0;
  color: var(--lab-ink);
  background: radial-gradient(ellipse at 35% 0, #ffe8f0, transparent 42rem), var(--lab-bg);
  font: 400 1rem/1.45 Fredoka, system-ui, sans-serif;
}
html:is([data-theme="dark"],[data-dark]) .learning-lab {
  --lab-bg: #171423;
  --lab-panel: #241e36;
  --lab-ink: #fff5ff;
  --lab-muted: #d6c9e8;
  --lab-line: #574674;
  background: radial-gradient(ellipse at 35% 0, #382241, transparent 42rem), var(--lab-bg);
}
.learning-lab *, .learning-lab *::before, .learning-lab *::after { box-sizing: border-box; }
.learning-lab [hidden] { display: none !important; }
.lab { width: min(100% - 32px, 1060px); margin-inline: auto; padding: 16px 0 72px; }
.lab-header { text-align: center; padding: 6px 0 24px; }
.lab-header h1 { font-size: clamp(2.65rem, 8vw, 5.75rem); line-height: 1; margin: 12px 0 8px; letter-spacing: -.045em; }
.lab-header h1 span { color: #ffda43; -webkit-text-stroke: 2px #19163d; paint-order: stroke fill; }
.lab-header p { color: var(--lab-muted); margin: 0; font-size: clamp(1rem, 2.2vw, 1.3rem); }
.lab h2, .lab h3 { line-height: 1.15; }
.lab-prompt {
  width: fit-content;
  margin: 10px auto 16px;
  border-radius: 99px;
  padding: 8px 20px;
  background: linear-gradient(95deg, #fff0bb, #ffcce6);
  color: #19163d;
  font-size: 1.15rem;
}
.lab-media { margin-top: 25px; }
.lab-media .lab-prompt { background: linear-gradient(95deg, #ead8ff, #bdeaff); }
.lab-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.lab-tile {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 92px;
  flex: 0 1 128px;
  gap: 4px;
  padding: 8px;
  border: 1px solid #19163d40;
  border-radius: 19px;
  background: linear-gradient(145deg, #ffffff82, transparent 76%), var(--tile, #f2e5ff);
  color: #19163d;
  text-decoration: none;
  font-weight: 650;
  text-align: center;
  box-shadow: 0 3px 0 #19163d26;
}
.lab-tile span { font-size: 1.9rem; line-height: 1.15; }
.lab-tile[aria-current] { outline: 2px solid var(--lab-ink); outline-offset: 2px; }
.lab-section-header { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 16px; }
.lab-section-header h2 { margin: 0 auto 0 0; }
.lab-results, .lab-personal { margin-top: 32px; border-top: 1px solid var(--lab-line); padding-top: 20px; }
.lab-count, .lab-personal > p { color: var(--lab-muted); }
.lab-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 225px), 1fr)); gap: 14px; }
.lab-card {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  border: 1px solid var(--lab-line);
  border-radius: 20px;
  overflow: hidden;
  background: var(--lab-panel);
}
.lab-cover {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 123px;
  background: radial-gradient(circle at 52% 54%, #ffffffbf, transparent 58%), var(--tile);
  color: #19163d;
}
.lab-cover span { font-size: 3.1rem; filter: drop-shadow(0 4px 9px #19163d33); }
.lab-cover small { position: absolute; right: 10px; bottom: 8px; font-weight: 650; }
.lab-card-copy { display: flex; flex-direction: column; align-items: start; padding: 14px; }
.lab-card-copy h3 { margin: 3px 0 0; font-size: 1.2rem; }
.lab-resource-meta, .lab-description { color: var(--lab-muted); margin: 6px 0; }
.lab-card-copy .lab-pill { margin-top: auto; }
.lab-pill, .lab input, .lab select, .lab-detail :is(textarea, select) {
  min-height: 44px;
  border: 1px solid var(--lab-line);
  border-radius: 12px;
  background: var(--lab-panel);
  color: var(--lab-ink);
  padding: 8px 12px;
  font: inherit;
}
.lab-pill { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; text-decoration: none; font-weight: 600; }
.lab-library, .lab-detail .lab-primary { background: #e9dcff; color: #302252; border-color: #c5adef; }
.lab :focus-visible, .lab-detail :focus-visible { outline: 2px solid #9468e8; outline-offset: 3px; }
.lab :is(input, select), .lab-detail select { max-width: 100%; }
.lab :is(.lab-section-header, .lab-playlist-form) label { display: grid; gap: 3px; }
.lab-playlist-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin: 12px 0; }
.lab-choose-list { display: inline-block; margin: 0 8px 14px 0; }
.lab-detail {
  color: var(--lab-ink);
  background: var(--lab-panel);
  border: 1px solid var(--lab-line);
  border-radius: 24px;
  padding: 20px;
  max-height: calc(100dvh - 36px);
  width: min(550px, 100% - 28px);
  overflow: auto;
}
.lab-detail::backdrop { background: #130b258c; }
.lab-detail h2 { font-size: clamp(1.5rem, 5vw, 2.15rem); line-height: 1.15; margin: 8px 0; }
.lab-detail .lab-close { float: right; min-width: 44px; justify-content: center; }
.lab-detail .lab-detail-tools { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.lab-detail label, .lab-detail textarea { display: block; width: 100%; }
.lab-detail textarea { margin-top: 5px; min-height: 105px; resize: vertical; }
.lab-detail :is(.lab-detail-playlists, .lab-detail-note) { margin: 12px 0; }
.lab-detail .lab-detail-playlists select { margin-top: 5px; width: 100%; }
.lab-message:empty { display: none; }
@media (hover:hover) and (prefers-reduced-motion:no-preference) {
  .lab-tile, .lab-pill { transition: transform .16s ease; }
  .lab-tile:hover, .lab-pill:hover { transform: translateY(-2px); }
}
@media (max-width: 520px) {
  .lab { width: calc(100% - 24px); padding-top: 6px; }
  .lab-tile { flex-basis: calc((100% - 20px) / 3); min-height: 83px; font-size: .93rem; }
  .lab-section-header label { flex: 1 1 180px; min-width: 0; }
}
.lab-detail [aria-pressed="true"] { background: #d6f3dd; color: #173e28; border-color: #83ba91; }
.lab-detail-playlists > button { margin-top: 8px; }
.lab-pill:disabled { opacity: .55; cursor: default; }

.lab-header-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
