/* =========================================================
   LEARNING REWIRED LAB — LEARNING SYSTEMS QUEST  (v2 light)
   Design Lab detail page
   URL: /resource-lab/learning-systems-quest/
   Depends on: /global.css, /assets/css/lab-detail.css

   Direction: light editorial framing + dark interactive stage.
   Three dark elements: the quest stage, the code card, the closing band.
   ========================================================= */

.learning-systems-quest-page {
  --lsq-ink: #0f172a;
  --lsq-muted: #475569;
  --lsq-faint: #64748b;
  --lsq-line: #e7ecf2;
  --lsq-line-strong: #dbe3ec;
  --lsq-panel: #ffffff;
  --lsq-panel-soft: #f8fafc;
  --lsq-accent: #6d4aff;
  --lsq-accent-deep: #5b34c9;
  --lsq-accent-soft: rgba(109, 74, 255, 0.08);

  /* dark-stage tokens */
  --lsq-deep: #0b1224;
  --lsq-stage-line: rgba(148, 163, 184, 0.16);
  --lsq-stage-soft: rgba(255, 255, 255, 0.04);
  --lsq-stage-ink: #ffffff;
  --lsq-stage-muted: rgba(226, 232, 240, 0.82);
  --lsq-stage-faint: rgba(226, 232, 240, 0.72);
  --lsq-accent-light: #c4b5fd;
  --lsq-meter: #7c5cff;

  position: relative;
  width: 100%;
  overflow: visible;
  color: var(--lsq-ink);
}

.learning-systems-quest-page *,
.learning-systems-quest-page *::before,
.learning-systems-quest-page *::after {
  box-sizing: border-box;
}

.learning-systems-quest-page h1,
.learning-systems-quest-page h2,
.learning-systems-quest-page h3,
.learning-systems-quest-page p,
.learning-systems-quest-page blockquote {
  margin: 0;
}

.learning-systems-quest-page a {
  color: inherit;
}

.learning-systems-quest-page button {
  font: inherit;
}

/* =========================================================
   Shared shell corrections
   ========================================================= */

.learning-systems-quest-page .resource-detail-inner,
.learning-systems-quest-page .dld-shell {
  width: min(1080px, calc(100% - 40px));
  max-width: 1080px;
  margin-inline: auto;
}

.learning-systems-quest-page .resource-detail-hero {
  max-width: 1080px;
  margin: 0 auto clamp(2rem, 5vw, 3.5rem);
}

.learning-systems-quest-page .resource-detail-hero h1,
.learning-systems-quest-page .lsq-resource-title {
  max-width: 14ch;
  padding: 0;
  overflow: visible;
}

.learning-systems-quest-page .resource-detail-gradient {
  display: inline-block;
  padding: 0;
  color: var(--lsq-accent);
  background: none;
  -webkit-text-fill-color: var(--lsq-accent);
}

/* =========================================================
   Page article rhythm
   ========================================================= */

.lsq-article {
  display: grid;
  gap: clamp(2.5rem, 5vw, 4rem);
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}

.lsq-section {
  width: 100%;
  margin: 0 auto;
}

.lsq-content-narrow {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.lsq-section-inner,
.lsq-game-shell {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}

.lsq-kicker {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 1.125rem;
  padding: 0.4rem 0.75rem;
  border: 0;
  border-radius: 999px;
  background: var(--lsq-accent-soft);
  color: var(--lsq-accent-deep);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  line-height: 1;
  text-transform: uppercase;
}

.lsq-content-narrow h2,
.lsq-section-header h2,
.lsq-game-header h2,
.lsq-result-panel h2,
.lsq-closing-card h2 {
  max-width: 22ch;
  margin: 0 0 1.125rem;
  color: var(--lsq-ink);
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lsq-content-narrow p,
.lsq-section-header p,
.lsq-game-header p,
.lsq-result-panel p,
.lsq-closing-card p {
  max-width: 66ch;
  color: var(--lsq-muted);
  font-size: clamp(1rem, 1.35vw, 1.05rem);
  line-height: 1.7;
}

.lsq-content-narrow p + p {
  margin-top: 1.125rem;
}

/* =========================================================
   Opening section  (light)
   ========================================================= */

.lsq-opening-section,
.lsq-teaches-section,
.lsq-build-section {
  max-width: 920px;
  padding: clamp(1.75rem, 4vw, 2.375rem);
  border: 1px solid var(--lsq-line);
  border-radius: var(--lsq-radius, 20px);
  background: var(--lsq-panel-soft);
  box-shadow: none;
}

.lsq-opening-lede {
  color: var(--lsq-ink) !important;
  font-size: clamp(1.25rem, 2.4vw, 1.7rem) !important;
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.03em;
}

.lsq-opening-section blockquote {
  max-width: 24ch;
  margin: clamp(1.25rem, 3vw, 1.75rem) 0;
  padding: 0;
  border: 0;
  color: var(--lsq-accent);
  font-size: clamp(1.9rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

/* =========================================================
   Game section  —  DARK STAGE
   ========================================================= */

.lsq-game-section,
.lsq-design-section,
.lsq-starter-section,
.lsq-related-section,
.lsq-closing-section {
  max-width: 1080px;
}

.lsq-game-shell {
  position: relative;
  overflow: hidden;
  padding: clamp(1.5rem, 3.5vw, 2.5rem);
  border: 1px solid var(--lsq-stage-line);
  border-radius: 24px;
  background: var(--lsq-deep);
  box-shadow: 0 34px 80px rgba(8, 15, 40, 0.34);
  color: var(--lsq-stage-muted);
}

.lsq-game-shell::after {
  content: "";
  position: absolute;
  right: -120px;
  top: -120px;
  width: 340px;
  height: 340px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(109, 74, 255, 0.28), transparent 68%);
  pointer-events: none;
}

.lsq-game-shell > * {
  position: relative;
}

.lsq-game-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 1.75rem;
}

.lsq-game-shell .lsq-kicker {
  background: rgba(109, 74, 255, 0.16);
  color: var(--lsq-accent-light);
}

.lsq-game-header h2 {
  color: var(--lsq-stage-ink);
  max-width: 24ch;
}

.lsq-game-header p:not(.lsq-kicker) {
  max-width: 60ch;
  color: var(--lsq-stage-faint);
}

.lsq-stage-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 1rem;
  border: 1px solid var(--lsq-stage-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--lsq-stage-ink);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

/* =========================================================
   Dashboard  (dark)
   ========================================================= */

.lsq-dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.375rem;
}

.lsq-meter-card {
  padding: 0.875rem;
  border: 1px solid var(--lsq-stage-line);
  border-radius: 14px;
  background: var(--lsq-stage-soft);
  box-shadow: none;
}

.lsq-meter-label {
  display: flex;
  justify-content: space-between;
  gap: 0.875rem;
  align-items: baseline;
  margin-bottom: 0.625rem;
}

.lsq-meter-label span {
  color: rgba(196, 181, 253, 0.85);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lsq-meter-label strong {
  color: var(--lsq-stage-ink);
  font-size: 1rem;
  line-height: 1;
}

.lsq-meter-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.lsq-meter-fill {
  width: 50%;
  height: 100%;
  border-radius: 999px;
  background: var(--lsq-meter);
  transition: width 0.5s ease;
}

/* =========================================================
   Play area  (dark)
   ========================================================= */

.lsq-play-area {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 1rem;
  align-items: start;
}

.lsq-scenario-card,
.lsq-feedback,
.lsq-result-panel,
.lsq-choice-card,
.lsq-choice-grid button {
  border: 1px solid var(--lsq-stage-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: none;
}

.lsq-scenario-card {
  padding: clamp(1.25rem, 3vw, 1.625rem);
}

.lsq-scenario-label,
.lsq-feedback-kicker {
  margin: 0 0 0.75rem;
  color: var(--lsq-accent-light);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.lsq-scenario-card h3,
.lsq-feedback h3 {
  margin: 0 0 0.75rem;
  color: var(--lsq-stage-ink);
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  line-height: 1.18;
  letter-spacing: -0.025em;
  font-weight: 800;
}

.lsq-scenario-card p:not(.lsq-scenario-label),
.lsq-feedback p:not(.lsq-feedback-kicker) {
  color: var(--lsq-stage-muted);
  font-size: 0.97rem;
  line-height: 1.62;
}

.lsq-choice-grid {
  display: grid;
  gap: 0.75rem;
}

.lsq-choice-card,
.lsq-choice-grid button {
  display: block;
  width: 100%;
  padding: 1rem 1.125rem;
  color: var(--lsq-stage-muted);
  text-align: left;
  cursor: pointer;
  border-radius: 14px;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.lsq-choice-card:hover,
.lsq-choice-grid button:hover {
  transform: translateY(-1px);
  border-color: var(--lsq-accent);
  background: rgba(109, 74, 255, 0.1);
}

.lsq-choice-card.selected,
.lsq-choice-grid button.selected,
.lsq-choice-grid button.is-selected {
  border-color: var(--lsq-accent);
  background: rgba(109, 74, 255, 0.14);
}

.lsq-choice-card strong,
.lsq-choice-grid button strong {
  display: block;
  margin-bottom: 0.375rem;
  color: var(--lsq-stage-ink);
  font-size: 1rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
  font-weight: 700;
}

.lsq-choice-card span,
.lsq-choice-grid button span {
  display: block;
  color: var(--lsq-stage-faint);
  font-size: 0.92rem;
  line-height: 1.5;
}

.lsq-feedback {
  grid-column: 1 / -1;
  padding: clamp(1.25rem, 3vw, 1.625rem);
  background: rgba(109, 74, 255, 0.1);
  border-color: rgba(109, 74, 255, 0.32);
}

.lsq-feedback .lsq-button {
  margin-top: 1.25rem;
}

.lsq-result-panel {
  display: none;
  margin-top: 1.125rem;
  padding: clamp(1.5rem, 4vw, 2rem);
}

.lsq-result-panel.show,
.lsq-result-panel.is-visible {
  display: block;
}

.lsq-result-panel h2 {
  color: var(--lsq-stage-ink);
}

.lsq-result-panel > p {
  color: var(--lsq-stage-muted);
}

.lsq-result-grid {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 1.125rem;
  align-items: stretch;
  margin: 1.5rem 0;
}

.lsq-result-score,
.lsq-result-copy {
  border: 1px solid var(--lsq-stage-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.lsq-result-score {
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 1.25rem;
  text-align: center;
}

.lsq-result-score strong {
  display: block;
  color: var(--lsq-stage-ink);
  font-size: clamp(2.75rem, 6vw, 3.5rem);
  line-height: 0.9;
  letter-spacing: -0.05em;
}

.lsq-result-score span {
  display: block;
  margin-top: 0.625rem;
  color: rgba(196, 181, 253, 0.85);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.lsq-result-copy {
  padding: 1.5rem;
}

.lsq-result-copy h3 {
  margin: 0 0 0.75rem;
  color: var(--lsq-accent-light);
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 800;
}

.lsq-result-copy p {
  color: var(--lsq-stage-muted);
  line-height: 1.62;
}

/* =========================================================
   Buttons
   ========================================================= */

.lsq-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1.375rem;
  border-radius: 11px;
  border: 0;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none !important;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    background 0.2s ease;
}

.lsq-button:hover {
  transform: translateY(-2px);
}

.lsq-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.lsq-button-primary,
.lsq-button-primary:visited {
  background: var(--lsq-accent);
  color: #ffffff !important;
  box-shadow: 0 12px 24px rgba(109, 74, 255, 0.34);
}

.lsq-button-secondary,
.lsq-button-secondary:visited {
  border: 1px solid var(--lsq-stage-line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--lsq-stage-ink) !important;
  box-shadow: none;
}

.learning-systems-quest-page .resource-detail-btn.secondary {
  border-color: var(--lsq-line);
  background: #ffffff;
  color: var(--lsq-ink) !important;
  box-shadow: none;
}

/* =========================================================
   Design / related / starter sections  (light)
   ========================================================= */

.lsq-design-section,
.lsq-starter-section,
.lsq-related-section {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.lsq-section-header {
  max-width: 840px;
  margin: 0 0 1.75rem;
}

.lsq-design-section .lsq-section-header,
.lsq-starter-section .lsq-section-header,
.lsq-related-section .lsq-section-header {
  margin-left: 0;
  margin-right: 0;
  text-align: left;
}

.lsq-design-grid,
.lsq-related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

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

.lsq-design-card,
.lsq-related-card {
  padding: 1.5rem;
  border: 1px solid var(--lsq-line);
  border-radius: 16px;
  background: var(--lsq-panel);
  box-shadow: none;
}

.lsq-design-card span,
.lsq-related-card span {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 0.625rem;
  padding: 0;
  border-radius: 0;
  background: none;
  color: var(--lsq-accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.lsq-design-card h3,
.lsq-related-card h3 {
  margin: 0 0 0.5rem;
  color: var(--lsq-ink);
  font-size: 1.15rem;
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 700;
}

.lsq-design-card p,
.lsq-related-card p {
  margin: 0;
  color: var(--lsq-muted);
  font-size: 0.94rem;
  line-height: 1.6;
}

.lsq-related-card {
  display: block;
  text-decoration: none;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.lsq-related-card:hover {
  transform: translateY(-3px);
  border-color: var(--lsq-accent-light);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.10);
}

.lsq-related-card strong {
  display: inline-flex;
  margin-top: 0.875rem;
  color: var(--lsq-accent);
  font-size: 0.9rem;
  font-weight: 700;
}

/* =========================================================
   Starter code  (dark accent)
   ========================================================= */

.lsq-code-card {
  overflow: hidden;
  border: 1px solid var(--lsq-stage-line);
  border-radius: 16px;
  background: var(--lsq-deep);
  box-shadow: 0 24px 56px rgba(8, 15, 40, 0.28);
}

.lsq-code-card pre {
  margin: 0;
  max-height: 560px;
  overflow: auto;
  padding: clamp(1.125rem, 3vw, 1.625rem);
  color: #cbd5e1;
  font-size: 0.84rem;
  line-height: 1.7;
}

.lsq-code-card code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

/* =========================================================
   Closing  (dark band)
   ========================================================= */

.lsq-closing-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.5rem);
  border: 0;
  border-radius: 24px;
  background: var(--lsq-deep);
  box-shadow: none;
  text-align: center;
}

.lsq-closing-card::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -80px;
  transform: translateX(-50%);
  width: 420px;
  height: 300px;
  background: radial-gradient(circle, rgba(109, 74, 255, 0.3), transparent 70%);
  pointer-events: none;
}

.lsq-closing-card h2 {
  position: relative;
  margin: 0 auto 0;
  max-width: 20ch;
  color: var(--lsq-stage-ink);
}

.lsq-closing-card p {
  position: relative;
  max-width: 60ch;
  margin: 1.125rem auto 0;
  color: var(--lsq-stage-faint);
}

.lsq-closing-card .resource-detail-actions {
  position: relative;
  justify-content: center;
  margin-top: 1.75rem;
}

.lsq-closing-card .resource-detail-btn.secondary {
  border: 1px solid var(--lsq-stage-line) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  color: #ffffff !important;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1100px) {
  .lsq-dashboard {
    grid-template-columns: repeat(2, 1fr);
  }

  .lsq-play-area {
    grid-template-columns: 1fr;
  }

  .lsq-related-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .learning-systems-quest-page .resource-detail-inner,
  .learning-systems-quest-page .dld-shell {
    width: min(100% - 32px, 1080px);
  }

  .lsq-article {
    gap: 2.5rem;
  }

  .lsq-opening-section,
  .lsq-teaches-section,
  .lsq-build-section,
  .lsq-game-shell,
  .lsq-closing-card {
    padding: 1.25rem;
    border-radius: 18px;
  }

  .lsq-game-header {
    grid-template-columns: 1fr;
  }

  .lsq-dashboard,
  .lsq-design-grid,
  .lsq-related-grid,
  .lsq-result-grid {
    grid-template-columns: 1fr;
  }

  .lsq-code-card pre {
    font-size: 12px;
  }

  .lsq-button,
  .learning-systems-quest-page .resource-detail-btn {
    width: 100%;
  }

  .lsq-closing-card .resource-detail-actions {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lsq-button,
  .lsq-choice-card,
  .lsq-choice-grid button,
  .lsq-related-card,
  .lsq-meter-fill {
    transition: none;
  }

  .lsq-button:hover,
  .lsq-choice-card:hover,
  .lsq-choice-grid button:hover,
  .lsq-related-card:hover {
    transform: none;
  }
}
