/* App sections: Puzzle Library and School now open inline instead of as full-screen overlays. */
body.library-open {
  overflow: auto;
}

.puzzle-library-overlay[hidden] {
  display: none;
}

.puzzle-library-overlay {
  position: static;
  inset: auto;
  z-index: auto;
  width: min(1180px, calc(100% - 28px));
  margin: 18px auto 28px;
  background: transparent;
  overflow: visible;
  padding: 0;
  scroll-margin-top: 96px;
}

.library-shell {
  width: 100%;
  height: auto;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto;
  gap: 14px;
}

.library-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.library-header h2 {
  margin: 2px 0 6px;
  font-size: clamp(1.45rem, 4vw, 2.15rem);
  letter-spacing: -0.04em;
}

.library-layout {
  min-height: 0;
  overflow: visible;
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(360px, 1.22fr);
  gap: 14px;
  align-items: start;
  padding-bottom: 4px;
}

.library-card {
  box-shadow: var(--shadow-soft);
}

.library-start-card {
  grid-column: 1 / -1;
}

.curated-library-card {
  grid-column: 1 / -1;
}

.library-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.library-daily-row {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.library-daily-card {
  width: 100%;
  border: 1px solid rgba(124, 58, 237, 0.22);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.library-daily-card:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 3px;
}

.library-daily-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 36px rgba(37, 99, 235, 0.14);
}

.library-daily-card .daily-prompt-button {
  pointer-events: none;
}

@media (max-width: 640px) {
  .library-daily-card {
    align-items: stretch;
  }

  .library-daily-card .daily-prompt-button {
    width: 100%;
    justify-content: center;
  }
}

.library-choice-card,
.library-puzzle-card {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 7px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  padding: 14px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.library-choice-card:hover,
.library-puzzle-card:hover,
.library-choice-card:focus-visible,
.library-puzzle-card:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.1);
  outline: none;
}

.library-choice-card strong,
.library-puzzle-card strong {
  color: var(--brand-deep);
  font-weight: 700;
}

.library-choice-card span,
.library-puzzle-summary,
.library-puzzle-meta {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.library-choice-card.featured-choice {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(16, 185, 129, 0.08));
  border-color: rgba(37, 99, 235, 0.24);
}

.library-choice-card.is-loading {
  border-color: rgba(37, 99, 235, 0.5);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(245, 158, 11, 0.1));
  cursor: wait;
}

.library-choice-card.is-loading strong::after {
  content: '';
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-left: 8px;
  border: 2px solid rgba(37, 99, 235, 0.3);
  border-top-color: var(--brand);
  border-radius: 999px;
  vertical-align: -0.12em;
  animation: library-card-spin 0.8s linear infinite;
}

@keyframes library-card-spin {
  to { transform: rotate(360deg); }
}

.library-filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(168px, auto);
  gap: 10px;
  margin-bottom: 16px;
  align-items: start;
}

.library-search-input,
.library-filter-select,
.library-filter-menu > summary,
.library-filter-panel {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 12px;
}

.library-filter-menu {
  position: relative;
  min-width: 0;
}

.library-filter-menu > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  min-height: 44px;
}

.library-filter-menu > summary::-webkit-details-marker {
  display: none;
}

.library-filter-menu > summary::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.16s ease;
}

.library-filter-menu[open] > summary::after {
  transform: rotate(225deg) translateY(-1px);
}

.library-filter-summary {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.library-filter-panel {
  position: absolute;
  z-index: 4;
  top: calc(100% + 8px);
  left: 0;
  display: grid;
  gap: 8px;
  min-width: min(320px, calc(100vw - 40px));
  max-width: min(420px, calc(100vw - 40px));
  max-height: min(420px, 58vh);
  box-sizing: border-box;
  overflow: auto;
  margin: 0;
  padding: 12px;
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.14);
}

.library-filter-panel legend {
  padding: 0;
}

.library-checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: flex-start;
  min-width: 0;
}

.library-checkbox-list label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  max-width: 100%;
  border: 1px solid rgba(122, 92, 58, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 6px 9px;
  user-select: none;
}

.library-checkbox-list input {
  flex: 0 0 auto;
  accent-color: var(--brand);
}

.manual-logic-detail .manual-candidate-line {
  margin-bottom: 0;
}

.manual-candidate-line span {
  color: var(--muted);
  font-weight: 700;
}

.library-search-input::placeholder {
  color: var(--muted);
  font-weight: 700;
}

.library-search-input:focus,
.library-filter-select:focus,
.library-filter-menu > summary:focus,
.library-filter-menu:focus-within > summary,
.library-filter-panel:focus-within {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

.library-puzzle-groups {
  display: grid;
  gap: 16px;
}

.library-difficulty-group {
  display: grid;
  gap: 10px;
}

.library-difficulty-group h3 {
  margin: 0;
  color: var(--brand-deep);
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.library-puzzle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

/* Keep the School access-preview badge showcase styled on /school even if marketing-only styles change later. */

.school-preview-badge-panel {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 22px;
  padding: clamp(16px, 3vw, 24px);
  background: radial-gradient(circle at 8% 10%, rgba(37, 99, 235, 0.12), transparent 34%), radial-gradient(circle at 90% 12%, rgba(16, 185, 129, 0.12), transparent 32%), #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.1);
}

.school-preview-badge-panel .badge-showcase-heading {
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  padding-bottom: 12px;
}

.school-preview-marketing-stack .badge-showcase-heading {
  display: grid;
  gap: 4px;
  padding: 2px 2px 0;
}

.school-preview-marketing-stack .badge-showcase-heading strong {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.school-preview-marketing-stack .badge-showcase-heading span {
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 700;
  line-height: 1.35;
}

.school-preview-marketing-stack .school-badge-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  min-width: 0;
}

.school-preview-marketing-stack .school-badge-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(122, 92, 58, 0.16);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 252, 244, 0.96), rgba(239, 247, 225, 0.82));
  box-shadow: 0 12px 24px rgba(91, 111, 74, 0.12);
}

.school-preview-marketing-stack .school-badge-card.is-diploma {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(250, 245, 255, 0.98), rgba(239, 247, 225, 0.86));
  border-color: rgba(76, 45, 127, 0.26);
}

.school-preview-marketing-stack .school-badge-icon {
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #355332;
  background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.95), rgba(221, 235, 183, 0.95) 38%, rgba(91, 111, 74, 0.28));
  border: 1px solid rgba(91, 111, 74, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 10px 18px rgba(91, 111, 74, 0.16);
}

.school-preview-marketing-stack .school-badge-icon svg {
  width: 1.55rem;
  height: 1.55rem;
  fill: currentColor;
}

.school-preview-marketing-stack .school-badge-card.badge-level-intermediate .school-badge-icon {
  color: #1f4f5c;
  background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.95), rgba(205, 234, 241, 0.95) 38%, rgba(31, 79, 92, 0.25));
  border-color: rgba(31, 79, 92, 0.28);
}

.school-preview-marketing-stack .school-badge-card.badge-level-advanced .school-badge-icon {
  color: #6b4a16;
  background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.94), rgba(247, 225, 178, 0.96) 38%, rgba(107, 74, 22, 0.24));
  border-color: rgba(107, 74, 22, 0.28);
}

.school-preview-marketing-stack .school-badge-card.badge-level-expert .school-badge-icon {
  color: #6f2b2b;
  background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.9), rgba(244, 202, 190, 0.95) 38%, rgba(111, 43, 43, 0.26));
  border-color: rgba(111, 43, 43, 0.25);
}

.school-preview-marketing-stack .school-badge-card.badge-level-diploma .school-badge-icon {
  color: #4c2d7f;
  background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.95), rgba(224, 214, 255, 0.96) 38%, rgba(76, 45, 127, 0.28));
  border-color: rgba(76, 45, 127, 0.3);
}

.school-preview-marketing-stack .school-badge-card strong {
  display: block;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.15;
}

.school-preview-marketing-stack .school-badge-card small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 720px) {
  .school-preview-marketing-stack .school-badge-showcase {
    grid-template-columns: 1fr;
  }
}

.school-preview-landing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 0.42fr);
  gap: 16px;
  align-items: stretch;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 22px;
  padding: clamp(16px, 3vw, 24px);
  background: radial-gradient(circle at 12% 15%, rgba(37, 99, 235, 0.15), transparent 36%), radial-gradient(circle at 88% 10%, rgba(16, 185, 129, 0.13), transparent 35%), #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.1);
}

.school-preview-landing-copy h3 {
  margin: 12px 0 10px;
  color: var(--ink);
  font-size: clamp(1.55rem, 3vw, 2.45rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.school-preview-landing-copy p {
  max-width: 68ch;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.school-preview-award-card {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  border: 1px solid rgba(76, 45, 127, 0.18);
  border-radius: 22px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(250, 245, 255, 0.96), rgba(239, 247, 225, 0.78));
  text-align: center;
}

.school-preview-award-icon {
  width: 4.6rem;
  height: 4.6rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4c2d7f;
  background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.96), rgba(224, 214, 255, 0.96) 38%, rgba(76, 45, 127, 0.28));
  border: 1px solid rgba(76, 45, 127, 0.3);
  box-shadow: 0 18px 32px rgba(76, 45, 127, 0.16);
}

.school-preview-award-icon svg {
  width: 2.4rem;
  height: 2.4rem;
  fill: currentColor;
}

.school-preview-award-card strong {
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 700;
}

.school-preview-award-card span:last-child {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.42;
}

.school-preview-benefit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.school-preview-benefit-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 12px;
  align-items: start;
  border: 1px solid rgba(37, 99, 235, 0.13);
  border-radius: 20px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.88);
}

.school-preview-benefit-card > span {
  grid-row: 1 / span 2;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.school-preview-benefit-card strong {
  color: var(--ink);
  font-weight: 700;
  line-height: 1.2;
}

.school-preview-benefit-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.school-preview-benefit-card.is-wide {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .school-preview-landing,
  .school-preview-benefit-grid {
    grid-template-columns: 1fr;
  }
}

.school-coach-card {
  display: grid;
  gap: 12px;
  border-color: rgba(37, 99, 235, 0.2);
  background: radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.12), transparent 34%), radial-gradient(circle at 100% 15%, rgba(16, 185, 129, 0.11), transparent 32%), var(--surface);
}

.school-coach-card[hidden] {
  display: none;
}

.school-coach-body {
  display: grid;
  gap: 12px;
}

.school-coach-objective {
  margin: 0;
  color: var(--muted);
  line-height: 1.48;
}

.school-coach-progress {
  border: 1px solid rgba(37, 99, 235, 0.13);
  border-radius: 16px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.78);
}

.school-coach-progress-bar {
  position: relative;
  display: block;
  height: 30px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.school-coach-progress-segment {
  position: absolute;
  top: 0;
  bottom: 0;
  display: block;
  transition: left 180ms ease, width 180ms ease;
}

.school-coach-progress-givens {
  left: 0;
  width: 0%;
  background: rgba(37, 99, 235, 0.34);
}

.school-coach-progress-added {
  left: 0%;
  width: 0%;
  background: rgba(16, 185, 129, 0.58);
}

.school-coach-progress-seam-label,
.school-coach-progress-total {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 0 7px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.08);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.school-coach-progress-seam-label {
  left: 0%;
  transform: translate(-50%, -50%);
}

.school-coach-progress-total {
  right: 8px;
  transform: translateY(-50%);
}

.school-coach-prompt {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(16, 185, 129, 0.18);
  border-radius: 16px;
  padding: 12px;
  background: rgba(239, 247, 225, 0.66);
  color: var(--muted);
  line-height: 1.45;
}

.school-coach-prompt strong {
  color: var(--brand-deep);
  font-size: 0.95rem;
}

.school-coach-prompt span {
  display: block;
}

.school-coach-reveal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

.school-coach-reveal-count {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.school-overlay[hidden] {
  display: none;
}

.school-overlay {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.school-shell {
  width: min(1180px, 100%);
  height: auto;
  min-height: 100%;
  grid-template-rows: auto auto;
  overflow: visible;
}

.school-scroll-area {
  min-height: 0;
  overflow: visible;
  display: grid;
  gap: 14px;
  align-content: start;
  padding-bottom: 4px;
}

.school-overview-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.75fr) minmax(320px, 1.25fr);
  gap: 14px;
  align-items: stretch;
  min-height: 0;
}

.school-card {
  box-shadow: var(--shadow-soft);
}

.school-next-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(16, 185, 129, 0.08));
}

.school-next-card h3 {
  margin: 3px 0 6px;
  color: var(--brand-deep);
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.school-next-card p {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.42;
}

.school-track-browser {
  min-height: 0;
  overflow: visible;
}

.school-track-grid {
  display: grid;
  gap: 14px;
}

.school-track-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  padding: 14px;
}

.school-track-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.school-track-heading h3 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 1.05rem;
  letter-spacing: -0.025em;
}

.school-lesson-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.school-lesson-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  padding: 12px;
}

.school-lesson-card.is-complete {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.07);
}

.school-lesson-card.is-current {
  border-color: rgba(37, 99, 235, 0.38);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(16, 185, 129, 0.07));
}

.school-lesson-card.is-locked {
  opacity: 0.66;
  background: rgba(248, 250, 252, 0.85);
}

.school-lesson-card.is-locked strong,
.school-lesson-card.is-locked p,
.school-lesson-card.is-locked .library-puzzle-meta {
  color: var(--muted);
}

.school-lesson-card > div {
  min-width: 0;
}

.school-lesson-number {
  display: inline-flex;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.school-lesson-card strong {
  display: block;
  color: var(--brand-deep);
  font-weight: 700;
  line-height: 1.2;
}

.school-lesson-card p {
  margin: 6px 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.38;
}

.school-lesson-card .button {
  flex: 0 0 auto;
}

@media (max-width: 900px) {
  .school-overview-grid {
    grid-template-columns: 1fr;
  }

  .school-next-card,
  .school-lesson-card {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 900px) {
  .library-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .library-header {
    flex-direction: column;
    align-items: stretch;
  }

  .library-header .button {
    width: 100%;
  }

  .library-filter-bar {
    grid-template-columns: 1fr;
  }

  .library-filter-panel {
    position: static;
    left: auto;
    right: auto;
    max-width: 100%;
    max-height: 42vh;
    margin-top: 8px;
  }

  .library-action-grid,
  .library-puzzle-grid {
    grid-template-columns: 1fr;
  }
}



.school-lesson-content-teaser {
  color: var(--text);
  font-size: 0.86rem;
}

.school-lesson-skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.school-lesson-skill-list span {
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--brand-deep);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: 0.005em;
  padding: 6px 10px;
}

.school-coach-curriculum {
  display: grid;
  gap: 10px;
}

.school-coach-curriculum[hidden],
.school-coach-details-body[hidden] {
  display: none !important;
}

.school-coach-details {
  overflow: hidden;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.school-coach-details-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 12px 14px;
  color: var(--brand-deep);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.school-coach-details-toggle:hover,
.school-coach-details-toggle:focus-visible {
  background: rgba(37, 99, 235, 0.06);
}

.school-coach-details-toggle-copy {
  display: grid;
  gap: 3px;
}

.school-coach-details-toggle-copy strong {
  color: var(--brand-deep);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.16;
}

.school-coach-details-toggle-copy span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.25;
}

.school-coach-details-chevron {
  position: relative;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  background: rgba(239, 246, 255, 0.82);
}

.school-coach-details-chevron::before {
  content: '';
  position: absolute;
  top: 9px;
  left: 10px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--brand-deep);
  border-bottom: 2px solid var(--brand-deep);
  transform: rotate(45deg);
  transition: transform 160ms ease, top 160ms ease;
}

.school-coach-details.is-open .school-coach-details-chevron::before {
  top: 12px;
  transform: rotate(225deg);
}

.school-coach-details-body {
  display: grid;
  gap: 12px;
  border-top: 1px solid rgba(37, 99, 235, 0.12);
  padding: 12px 14px 14px;
}

.school-coach-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.school-coach-detail-card {
  display: grid;
  gap: 8px;
  align-content: start;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.9));
  padding: 12px;
}

.school-coach-curriculum-head > span,
.school-coach-teaching-profile > span,
.school-coach-content-block span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.school-coach-curriculum-head strong,
.school-coach-teaching-profile strong,
.school-coach-content-block strong {
  color: var(--brand-deep);
  font-size: 0.98rem;
  line-height: 1.22;
}

.school-coach-skill-list,
.school-coach-profile-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.school-coach-skill-list span,
.school-coach-profile-pills span {
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--brand-deep);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.22;
  padding: 6px 10px;
}

.school-coach-content-blocks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  align-items: stretch;
}

.school-coach-content-block {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-left: 4px solid rgba(37, 99, 235, 0.32);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  padding: 10px 11px;
}

.school-coach-content-block p,
.school-coach-teaching-profile p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.school-coach-overview-blocks .school-coach-content-block {
  min-height: 100%;
}

.school-coach-tip-block {
  margin-top: 10px;
}

.school-coach-tip-block .school-coach-content-block {
  border-left-color: rgba(124, 58, 237, 0.42);
}

.school-lesson-profile-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 9px 0 0;
}

.school-lesson-profile-list span {
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.92);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: 0.005em;
  padding: 6px 10px;
}


/* Milestone 21E: keep School lesson actions bottom-centered so card details can use full width. */
.school-lesson-card {
  flex-direction: column;
  align-items: stretch;
}

.school-lesson-card > div {
  width: 100%;
}

.school-lesson-card .button {
  align-self: center;
  margin-top: auto;
  min-width: 132px;
}


/* Milestone 23E: School introduction guide inside the School overlay. */
.school-intro-guide {
  margin-top: 16px;
}

.school-guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.school-guide-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.94));
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.school-guide-card strong {
  color: var(--brand-deep);
  font-weight: 700;
}

.school-guide-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.school-guide-mini-row {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--line-strong);
}

.school-guide-mini-row span,
.school-guide-color-legend span,
.school-guide-pattern-list span,
.school-guide-branch span {
  display: grid;
  place-items: center;
  min-height: 30px;
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.78rem;
}

.school-guide-mini-row .is-yellow,
.school-guide-color-legend .is-yellow,
.school-guide-branch .is-yellow {
  background-image: repeating-linear-gradient(135deg, var(--value-line) 0, var(--value-line) 5px, rgba(255,255,255,0.85) 5px, rgba(255,255,255,0.85) 10px);
}

.school-guide-color-legend .is-blue,
.school-guide-branch .is-blue {
  background-image: repeating-linear-gradient(135deg, var(--assist-line) 0, var(--assist-line) 5px, rgba(255,255,255,0.85) 5px, rgba(255,255,255,0.85) 10px);
}

.school-guide-color-legend .is-red,
.school-guide-branch .is-red {
  color: var(--bad-ink);
  border: 2px solid rgba(220, 38, 38, 0.3);
  background: rgba(254, 242, 242, 0.95);
}

.school-guide-color-legend,
.school-guide-pattern-list,
.school-guide-branch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.school-guide-color-legend span,
.school-guide-pattern-list span,
.school-guide-branch span {
  min-height: 34px;
  padding: 6px 9px;
}

.school-guide-candidate-cell {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 4px;
  align-items: center;
  padding: 10px;
  border: 2px solid var(--accent);
  border-radius: 14px;
  background: var(--surface);
}

.school-guide-candidate-cell span {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.75rem;
}

.school-guide-candidate-cell strong {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-deep);
}

@media (max-width: 980px) {
  .school-guide-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .school-guide-grid {
    grid-template-columns: 1fr;
  }
}

/* Milestone 23G: full School syllabus guide with Help-style pages. */
.school-syllabus-layout {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.school-syllabus-toc {
  position: sticky;
  top: 0;
  display: grid;
  gap: 6px;
  max-height: min(68vh, 680px);
  overflow: auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.school-syllabus-toc button {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 9px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.school-syllabus-toc button:hover,
.school-syllabus-toc button.is-active {
  border-color: rgba(37, 99, 235, 0.22);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.school-syllabus-main {
  min-width: 0;
}

.school-syllabus-status {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.school-syllabus-page {
  grid-template-columns: minmax(0, 0.98fr) minmax(300px, 0.92fr);
  gap: 18px;
  align-items: center;
  min-height: 410px;
}

.school-syllabus-page.is-active {
  display: grid;
}

.school-syllabus-page[hidden] {
  display: none;
}

.school-syllabus-copy h4 {
  margin: 4px 0 8px;
  color: var(--ink);
  font-size: clamp(1.2rem, 2.3vw, 1.65rem);
  letter-spacing: -0.03em;
}

.school-syllabus-copy p {
  color: var(--muted);
  line-height: 1.58;
}


.school-syllabus-proof-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.school-syllabus-proof-list li {
  position: relative;
  padding: 10px 12px 10px 34px;
  border: 1px solid rgba(215, 222, 234, 0.9);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.82);
  color: var(--muted);
  line-height: 1.45;
}

.school-syllabus-proof-list li::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 17px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent-strong);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.school-syllabus-proof-list strong {
  color: var(--ink);
}

.school-syllabus-visual {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(215, 222, 234, 0.95);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.96));
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.07);
}

.school-syllabus-visual .manual-board {
  width: min(100%, 330px);
}

.school-syllabus-visual .manual-cell.sudoku-cell-slot.has-candidates {
  font-size: 0;
}

.school-syllabus-visual .manual-cell.sudoku-cell-slot.has-candidates .candidate-grid {
  inset: 9%;
  font-size: clamp(0.46rem, 1.1vw, 0.72rem);
}

.school-syllabus-visual .manual-cell.sudoku-cell-slot.has-candidates .candidate-mark.is-visible {
  opacity: 1;
}

.school-syllabus-path {
  align-items: stretch;
}

.school-syllabus-cycle {
  display: grid;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.school-syllabus-cycle li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(215, 222, 234, 0.96);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.05);
}

.school-syllabus-cycle li > strong {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.95rem;
  font-weight: 700;
}

.school-syllabus-cycle li span {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.school-syllabus-cycle li b {
  color: var(--ink);
  font-size: 0.98rem;
}

.school-syllabus-path .manual-visual-note {
  width: 100%;
}

@media (max-width: 920px) {
  .school-syllabus-layout {
    grid-template-columns: 1fr;
  }

  .school-syllabus-toc {
    position: static;
    display: flex;
    flex-wrap: nowrap;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding-inline: 14px;
    scroll-padding-inline: 14px;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
  }

  .school-syllabus-toc button {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
    padding-inline: 14px;
  }

  .school-syllabus-page.is-active {
    grid-template-columns: 1fr;
  }
}

/* Milestone 23H regression repair: restore rich DB-first School overview details. */
.school-course-summary-card {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(245, 243, 255, 0.96), rgba(255, 255, 255, 0.95));
  box-shadow: inset 4px 0 0 rgba(124, 58, 237, 0.72);
  padding: 14px;
  color: var(--ink);
}

.school-module-summary-card strong,
.school-track-module-card strong,
.school-lesson-content-list strong {
  color: #4c1d95;
  font-weight: 700;
}

.school-module-summary-card p,
.school-track-module-card p,
.school-lesson-content-list p,
.school-lesson-review-note {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.school-course-summary-stats,
.school-module-summary-list,
.school-track-module-list,
.school-lesson-content-list {
  display: grid;
  gap: 8px;
}

.school-course-summary-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.school-course-summary-stats span {
  border: 1px solid rgba(124, 58, 237, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  padding: 9px 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.school-course-summary-stats strong {
  display: block;
  color: #4c1d95;
  font-size: 1.1rem;
  line-height: 1;
}

.school-module-summary-card,
.school-track-module-card,
.school-lesson-content-list article {
  border: 1px solid rgba(215, 222, 234, 0.86);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
}

.school-module-summary-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.school-track-module-list {
  margin: 10px 0 12px;
}

.school-track-module-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.school-track-module-card > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.school-lesson-content-list {
  margin-top: 10px;
}

.school-lesson-review-note,
.school-lesson-assignment-note {
  border-left: 3px solid rgba(124, 58, 237, 0.48);
  padding-left: 9px;
}

.school-next-card-rich {
  align-items: start;
}

@media (max-width: 680px) {
  .school-course-summary-stats {
    grid-template-columns: 1fr;
  }

  .school-module-summary-card,
  .school-track-module-card {
    display: grid;
  }
}

/* Hardening polish: make the signed-in School overview easier to scan and keep locked lessons readable. */
.school-intro-guide {
  margin-top: 0;
}

.school-track-heading h3 {
  margin: 0 0 6px;
  font-size: 1.18rem;
}

.school-track-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.school-track-section-list {
  display: grid;
  gap: 14px;
}

.school-track-module-section {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 15px;
}

.school-track-module-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(215, 222, 234, 0.82);
}

.school-track-module-heading strong {
  display: block;
  color: var(--ink);
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.school-track-module-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.school-track-module-heading > span {
  flex: 0 0 auto;
  border: 1px solid rgba(124, 58, 237, 0.16);
  border-radius: 999px;
  background: rgba(245, 243, 255, 0.84);
  color: #4c1d95;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 9px;
}

.school-lesson-list {
  grid-template-columns: 1fr;
  gap: 12px;
}

.school-lesson-card {
  gap: 14px;
  padding: 15px;
  border-radius: 18px;
}

.school-lesson-main {
  display: grid;
  gap: 8px;
  width: 100%;
}

.school-lesson-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.school-lesson-status-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  padding: 6px 9px;
}

.school-lesson-card.is-complete .school-lesson-status-pill {
  border-color: rgba(34, 197, 94, 0.22);
  background: rgba(34, 197, 94, 0.1);
  color: #15803d;
}

.school-lesson-card.is-locked {
  opacity: 1;
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.55);
  background: rgba(248, 250, 252, 0.92);
}

.school-lesson-card.is-locked .school-lesson-status-pill {
  border-color: rgba(100, 116, 139, 0.22);
  background: rgba(241, 245, 249, 0.95);
  color: #475569;
}

.school-lesson-card.is-locked strong,
.school-lesson-card.is-locked p,
.school-lesson-card.is-locked .library-puzzle-meta,
.school-lesson-card.is-locked .school-lesson-title,
.school-lesson-card.is-locked .school-lesson-objective {
  color: var(--ink);
}

.school-lesson-title {
  font-size: 1.02rem;
}

.school-lesson-objective {
  margin: 0;
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.48;
}

.school-lesson-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.school-lesson-detail-grid p {
  margin: 0;
  border: 1px solid rgba(215, 222, 234, 0.88);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  padding: 9px 10px;
}

.school-lesson-detail-grid strong {
  display: inline;
  color: var(--brand-deep);
}

.school-lesson-pill-groups {
  display: grid;
  gap: 7px;
}

.school-lesson-card .button {
  align-self: flex-start;
  margin-top: 2px;
  min-width: 132px;
}

@media (max-width: 680px) {
  .school-track-module-heading,
  .school-lesson-card-header {
    display: grid;
  }

  .school-track-module-heading > span,
  .school-lesson-status-pill {
    justify-self: start;
  }

  .school-lesson-card .button {
    align-self: stretch;
  }
}


/* Hardening polish: flatten School track cards and make curriculum chips readable. */
.school-track-grid {
  gap: 14px;
}

.school-track-module-title {
  color: var(--ink);
}

.school-next-card-rich .school-lesson-skill-list span,
.school-next-card-rich .school-lesson-profile-list span {
  font-size: 0.86rem;
  padding: 7px 11px;
}

.school-lesson-card.is-locked .school-lesson-skill-list span,
.school-lesson-card.is-locked .school-lesson-profile-list span {
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
}

/* Library account gate and progress states. */
.library-curated-cta {
  margin: 0;
}

.library-curated-cta .button {
  align-self: center;
  white-space: nowrap;
}

.library-curated-upgrade-cta {
  border: 1px solid rgba(124, 58, 237, 0.28);
  background: radial-gradient(circle at 12% 0%, rgba(124, 58, 237, 0.18), transparent 36%), radial-gradient(circle at 90% 10%, rgba(245, 158, 11, 0.18), transparent 34%), #fff;
  box-shadow: 0 20px 48px rgba(76, 29, 149, 0.16);
}

.library-curated-upgrade-cta h3 {
  color: var(--brand-deep);
  font-size: clamp(1.18rem, 2vw, 1.55rem);
}

.library-curated-upgrade-cta p {
  max-width: 58rem;
}

.library-puzzle-card-in_progress {
  border-color: rgba(245, 158, 11, 0.38);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(255, 255, 255, 0.92));
}

.library-puzzle-card-completed {
  border-color: rgba(16, 185, 129, 0.38);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(255, 255, 255, 0.92));
}

.library-puzzle-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.library-puzzle-progress {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.15;
  padding: 4px 8px;
}

.library-puzzle-progress-not_started {
  border: 1px solid rgba(122, 92, 58, 0.16);
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
}

.library-puzzle-progress-in_progress {
  border: 1px solid rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.13);
  color: #92400e;
}

.library-puzzle-progress-completed {
  border: 1px solid rgba(16, 185, 129, 0.28);
  background: rgba(16, 185, 129, 0.13);
  color: #047857;
}

@media (max-width: 680px) {
  .library-curated-cta {
    display: grid;
  }

  .library-curated-cta .button {
    width: 100%;
  }
}

/* Library spacing polish for signed-out curated CTA.
   Use a vertical flex stack in the locked state so desktop grid row sizing cannot leave
   an oversized empty band between Start a new puzzle and the Library preview. */
.library-layout.is-curated-locked,
.library-layout[data-curated-locked="true"] {
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
  row-gap: 14px !important;
}

.library-layout.is-curated-locked > .library-card,
.library-layout[data-curated-locked="true"] > .library-card {
  width: 100%;
}

.library-layout.is-curated-locked > .library-start-card,
.library-layout[data-curated-locked="true"] > .library-start-card {
  margin-bottom: 0 !important;
}

.library-layout.is-curated-locked > .curated-library-card,
.library-layout[data-curated-locked="true"] > .curated-library-card {
  margin-top: 0 !important;
}

.curated-library-card.is-curated-locked .panel-heading.compact {
  margin-bottom: 10px;
}

.curated-library-card.is-curated-locked .library-puzzle-groups {
  gap: 10px;
}

/* Shared Daily Master the Grid bubble states for Tools and Puzzle Library. */
.library-daily-card[hidden] {
  display: none !important;
}

.library-daily-card.is-playing-daily,
.library-daily-card.is-daily-completed,
.library-daily-card:disabled {
  cursor: default;
}

.library-daily-card.is-daily-completed:hover,
.library-daily-card:disabled:hover {
  transform: none;
  box-shadow: 0 18px 32px rgba(37, 99, 235, 0.10);
}

.daily-prompt-card.is-daily-resume .daily-prompt-button {
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.18);
}

/* School dashboard polish: make actionable lesson cards share one clean layout. */
.school-lesson-card,
.school-next-card.school-lesson-card {
  display: block;
  border: 1px solid rgba(215, 222, 234, 0.92);
  border-radius: 20px;
  background: var(--surface);
  padding: 16px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.school-next-card.school-lesson-card,
.school-lesson-card.is-current:not(.is-locked) {
  border-color: rgba(37, 99, 235, 0.28);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(16, 185, 129, 0.07), rgba(255, 255, 255, 0.96));
}

.school-lesson-card.is-complete:not(.is-current) {
  border-color: rgba(34, 197, 94, 0.28);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.09), rgba(255, 255, 255, 0.96));
}

.school-lesson-card.is-locked {
  opacity: 1;
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.55);
  background: rgba(248, 250, 252, 0.92);
  box-shadow: none;
}

.school-lesson-card.is-locked strong,
.school-lesson-card.is-locked p,
.school-lesson-card.is-locked .library-puzzle-meta,
.school-lesson-card.is-locked .school-lesson-title,
.school-lesson-card.is-locked .school-lesson-objective {
  color: var(--ink);
}

.school-lesson-main {
  display: grid;
  gap: 11px;
  min-width: 0;
  width: 100%;
}

.school-lesson-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
}

.school-lesson-heading-copy {
  min-width: 0;
}

.school-lesson-number {
  display: inline-flex;
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.school-lesson-title {
  display: block;
  color: var(--brand-deep);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.18;
}

.school-next-track-label {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.2;
}

.school-lesson-card-action {
  display: flex;
  justify-content: flex-end;
}

.school-lesson-card-action .button {
  margin: 0;
  min-width: 116px;
  white-space: nowrap;
}

.school-lesson-objective {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.48;
}

.school-lesson-detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.school-lesson-detail-grid p,
.school-lesson-content-list article {
  margin: 0;
  border: 1px solid rgba(215, 222, 234, 0.86);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.78);
  padding: 10px 11px;
}

.school-lesson-detail-grid strong,
.school-lesson-content-list strong {
  color: var(--brand-deep);
}

.school-lesson-content-list {
  display: grid;
  gap: 8px;
  margin-top: 0;
}

.school-lesson-content-list p,
.school-lesson-review-note {
  margin: 4px 0 0;
  line-height: 1.45;
}

.school-lesson-review-note {
  border-left: 3px solid rgba(124, 58, 237, 0.42);
  color: var(--muted);
  padding-left: 10px;
}

.school-lesson-pill-groups {
  display: grid;
  gap: 8px;
}

.school-lesson-status-pill {
  border: 1px solid rgba(100, 116, 139, 0.22);
  border-radius: 999px;
  background: rgba(241, 245, 249, 0.95);
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  padding: 7px 10px;
  white-space: nowrap;
}

@media (max-width: 680px) {
  .school-lesson-card-header {
    grid-template-columns: 1fr;
  }

  .school-lesson-card-action {
    justify-content: stretch;
  }

  .school-lesson-card-action .button {
    width: 100%;
  }
}

/* App page refactor: former overlay surfaces now behave like first-class app pages. */
body.app-section-active .primary-workspace,
body.app-section-active .app-daily-strip {
  display: none;
}

body.app-section-active {
  overflow: auto;
}

.app-page-heading,
.library-header,
.manual-header {
  display: grid;
  gap: 7px;
  padding: 0 2px 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.app-page-heading h2,
.library-header h2,
.manual-header h2 {
  margin: 0;
  font-size: clamp(1.30rem, 2.2vw, 1.85rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.app-page-heading p,
.library-header p,
.manual-header p {
  margin: 0;
  max-width: 76ch;
  color: var(--muted);
  line-height: 1.5;
}

.app-section-panel,
.puzzle-library-overlay,
.user-manual,
.account-overlay {
  position: static;
  inset: auto;
  z-index: auto;
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto 36px;
  padding: 0;
  background: transparent;
  overflow: visible;
  scroll-margin-top: 98px;
}

.user-manual {
  height: auto;
  min-height: 0;
}

.manual-shell,
.library-shell,
.account-shell {
  height: auto;
  min-height: 0;
  max-height: none;
}

.manual-layout {
  min-height: 0;
  overflow: visible;
}

.manual-main {
  min-height: 0;
  overflow: visible;
}

.account-dialog-header {
  display: none;
}

@media (max-width: 720px) {
  .app-section-panel,
  .puzzle-library-overlay,
  .user-manual,
  .account-overlay {
    width: min(100% - 18px, 1180px);
    margin-top: 0;
    scroll-margin-top: 86px;
  }

  .app-page-heading h2,
  .library-header h2,
  .manual-header h2 {
    font-size: clamp(1.25rem, 6.5vw, 1.65rem);
  }
}

/* Multi-page shell refinement: page titles live in the first white card, not as floating overlay headers. */
.card-page-heading {
  align-items: flex-start;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.20);
}

.card-page-heading > div {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.card-page-heading h2 {
  margin: 0;
  font-size: clamp(1.30rem, 2.2vw, 1.85rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.card-page-heading p {
  margin: 0;
  max-width: 76ch;
  color: var(--muted);
  line-height: 1.48;
}

.manual-page-title-card {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  margin-bottom: 14px;
}

.manual-shell {
  grid-template-rows: minmax(0, 1fr);
}

@media (max-width: 720px) {
  .card-page-heading {
    gap: 10px;
  }

  .card-page-heading h2 {
    font-size: clamp(1.25rem, 6.5vw, 1.65rem);
  }
}

/* OCR page layout overrides must load after generic card page heading rules. */
.app-page-ocr .app-scan-card {
  display: grid;
  gap: 14px;
}

.app-page-ocr .scan-page-card {
  padding: 18px 20px;
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
}

.app-page-ocr .scan-page-heading {
  align-items: center;
  margin: 0;
  padding: 0;
  border: 0;
}

.app-page-ocr .scan-page-heading h2 {
  font-size: clamp(1.45rem, 2.2vw, 2.05rem);
}

.app-page-ocr .scan-page-heading .section-helper {
  font-size: 1rem;
}

.app-page-ocr .scan-page-actions[hidden] {
  display: none;
}

.app-page-ocr .scan-access-cta {
  padding: 20px;
  border-radius: 24px;
  grid-template-columns: minmax(0, 1fr) auto;
  background: radial-gradient(circle at 8% 0%, rgba(124, 58, 237, 0.11), transparent 34%), radial-gradient(circle at 94% 0%, rgba(16, 185, 129, 0.10), transparent 36%), rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
}

.app-page-ocr .scan-access-cta-copy {
  display: grid;
  gap: 7px;
  max-width: 760px;
}

.app-page-ocr .scan-access-cta h3 {
  margin: 0;
  font-size: clamp(1.12rem, 1.8vw, 1.35rem);
}

.app-page-ocr .scan-access-cta p {
  max-width: 72ch;
  font-weight: 650;
}

.app-page-ocr .scan-import-layout {
  grid-template-columns: minmax(280px, 0.78fr) minmax(360px, 1.22fr);
}

.app-page-ocr .scan-import-source,
.app-page-ocr .scan-import-review {
  align-self: start;
  box-shadow: var(--shadow-soft);
}

@media (max-width: 760px) {
  .app-page-ocr .scan-page-card,
  .app-page-ocr .scan-access-cta {
    border-radius: 20px;
    padding: 16px;
  }

  .app-page-ocr .scan-page-heading {
    align-items: flex-start;
  }

  .app-page-ocr .scan-access-cta,
  .app-page-ocr .scan-import-layout {
    grid-template-columns: 1fr;
  }
}

/* True MPA width normalization: standalone app pages now use the same desktop span as play.php. */
.app-section-panel,
.puzzle-library-overlay,
.user-manual,
.account-overlay {
  width: 100%;
  margin-top: 0;
}

.manual-shell,
.library-shell,
.account-shell,
.saved-puzzles-shell,
.stats-shell {
  width: 100%;
}

.school-lesson-card-details[hidden] {
  display: none !important;
}

.school-lesson-card-action {
  align-items: flex-end;
  flex-direction: column;
  gap: 8px;
}

.school-lesson-card-toggle {
  min-width: 132px;
  padding: 7px 11px;
  font-size: 0.76rem;
}

.school-lesson-card-details {
  display: grid;
  gap: 8px;
}

@media (max-width: 680px) {
  .school-lesson-card-action {
    align-items: stretch;
  }
}

/* MPA school overview readability pass: compact, tiled lesson cards on desktop. */
@media (min-width: 1060px) {
  .school-lesson-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }
}

.school-lesson-card,
.school-next-card.school-lesson-card {
  padding: 14px;
}

.school-lesson-main {
  gap: 8px;
}

.school-lesson-card-header {
  gap: 10px;
}

.school-lesson-number {
  margin-bottom: 4px;
}

.school-lesson-title {
  font-size: 1.02rem;
  line-height: 1.14;
}

.school-lesson-objective {
  margin-top: 2px;
  font-size: 0.90rem;
  line-height: 1.34;
}

.school-lesson-card-action {
  gap: 6px;
}

.school-lesson-card-action .button {
  min-height: 40px;
}

.school-lesson-card-toggle {
  min-width: 128px;
}

@media (min-width: 1060px) {
  .school-lesson-card-header {
    grid-template-columns: 1fr;
  }

  .school-lesson-card-action {
    align-items: stretch;
  }

  .school-lesson-card-action .button,
  .school-lesson-status-pill {
    width: 100%;
  }
}

/* Keep the featured Next Lesson card distinct from the compact tiled track cards. */
.school-next-card.school-lesson-card.is-featured {
  padding: 18px;
}

.school-next-card.school-lesson-card.is-featured .school-lesson-main {
  gap: 12px;
}

.school-next-card.school-lesson-card.is-featured .school-lesson-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 18px;
}

.school-next-card.school-lesson-card.is-featured .school-lesson-card-action {
  align-items: flex-end;
  justify-content: flex-start;
}

.school-next-card.school-lesson-card.is-featured .school-lesson-card-action .button {
  width: auto;
  min-width: 146px;
  padding-left: 24px;
  padding-right: 24px;
}

.school-next-card.school-lesson-card.is-featured .school-lesson-objective {
  margin-top: 0;
}

@media (max-width: 680px) {
  .school-next-card.school-lesson-card.is-featured .school-lesson-card-header {
    grid-template-columns: 1fr;
  }

  .school-next-card.school-lesson-card.is-featured .school-lesson-card-action {
    align-items: stretch;
  }

  .school-next-card.school-lesson-card.is-featured .school-lesson-card-action .button {
    width: 100%;
  }
}

.puzzle-score-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
}

.puzzle-score-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.96);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  padding: 5px 8px;
}

.puzzle-score-chip span {
  color: inherit;
  font-size: inherit;
  line-height: 1;
}

.puzzle-score-chip strong {
  color: inherit !important;
  font-size: inherit;
  line-height: 1;
}

.puzzle-score-chip-green {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.24);
  color: #15803d;
}

.puzzle-score-chip-yellow-green {
  background: rgba(132, 204, 22, 0.14);
  border-color: rgba(132, 204, 22, 0.28);
  color: #4d7c0f;
}

.puzzle-score-chip-yellow {
  background: rgba(234, 179, 8, 0.14);
  border-color: rgba(234, 179, 8, 0.28);
  color: #854d0e;
}

.puzzle-score-chip-orange {
  background: rgba(249, 115, 22, 0.14);
  border-color: rgba(249, 115, 22, 0.28);
  color: #9a3412;
}

.puzzle-score-chip-red {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.24);
  color: #b91c1c;
}

.status-score-chip-row {
  justify-content: flex-start;
  margin-left: 0;
  margin-top: 10px;
}

.status-score-chip-row .puzzle-score-chip {
  font-size: 0.72rem;
}

@media (max-width: 720px) {
  .status-score-chip-row {
    width: 100%;
  }
}

/* Score chips shown in the Status heading and Daily Master the Grid CTA share the Library card treatment. */
.status-heading .status-score-chip-row {
  justify-content: flex-end;
  margin-left: auto;
  margin-top: 0;
}

.status-heading .status-score-chip-row[hidden] {
  display: none;
}

.status-heading .status-score-chip-row .puzzle-score-chip {
  font-size: 0.72rem;
}

.daily-prompt-rating {
  display: block;
}

.daily-prompt-rating[hidden] {
  display: none;
}

.daily-prompt-rating .puzzle-score-chip-row,
.daily-prompt-copy .daily-prompt-rating .puzzle-score-chip-row,
.daily-prompt-copy span.daily-prompt-rating .puzzle-score-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 0;
}

.daily-prompt-rating .puzzle-score-chip,
.daily-prompt-copy .daily-prompt-rating .puzzle-score-chip,
.daily-prompt-copy span.daily-prompt-rating .puzzle-score-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  padding: 5px 8px;
}

.daily-prompt-rating .puzzle-score-chip span,
.daily-prompt-rating .puzzle-score-chip strong,
.daily-prompt-copy .daily-prompt-rating .puzzle-score-chip span,
.daily-prompt-copy .daily-prompt-rating .puzzle-score-chip strong {
  color: inherit;
  font-size: inherit;
  line-height: 1;
}

.daily-prompt-rating .puzzle-score-chip-green,
.daily-prompt-copy .daily-prompt-rating .puzzle-score-chip-green {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.24);
  color: #15803d;
}

.daily-prompt-rating .puzzle-score-chip-yellow-green,
.daily-prompt-copy .daily-prompt-rating .puzzle-score-chip-yellow-green {
  background: rgba(132, 204, 22, 0.14);
  border-color: rgba(132, 204, 22, 0.28);
  color: #4d7c0f;
}

.daily-prompt-rating .puzzle-score-chip-yellow,
.daily-prompt-copy .daily-prompt-rating .puzzle-score-chip-yellow {
  background: rgba(234, 179, 8, 0.14);
  border-color: rgba(234, 179, 8, 0.28);
  color: #854d0e;
}

.daily-prompt-rating .puzzle-score-chip-orange,
.daily-prompt-copy .daily-prompt-rating .puzzle-score-chip-orange {
  background: rgba(249, 115, 22, 0.14);
  border-color: rgba(249, 115, 22, 0.28);
  color: #9a3412;
}

.daily-prompt-rating .puzzle-score-chip-red,
.daily-prompt-copy .daily-prompt-rating .puzzle-score-chip-red {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.24);
  color: #b91c1c;
}

@media (max-width: 720px) {
  .status-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-heading .status-score-chip-row {
    justify-content: flex-start;
    margin-left: 0;
    width: 100%;
  }
}
