.py-section-breadcrumb { margin-bottom: 14px; }
.py-quiz-results { margin: 28px 0; padding: 28px; border: 1px solid #ddd6fe; border-radius: 20px; background: linear-gradient(135deg,#f5f0ff,#eff6ff 60%,#ecfdf5); box-shadow: 0 8px 24px #6435d612; }
.py-quiz-result-heading { display: flex; align-items: center; gap: 14px; }
.py-quiz-result-icon { display: grid; place-items: center; width: 48px; height: 48px; flex-shrink: 0; border-radius: 14px; color: #fff; background: linear-gradient(135deg,#7c3aed,#2563eb); font-size: 26px; }
.py-quiz-result-heading p { margin: 0; color: #64548b; font-size: .85rem; }
.py-quiz-result-heading h3 { margin: 2px 0 0; color: #5225ad; font-size: 1.35rem; line-height: 1.3; }
.py-quiz-score-row { display: flex; align-items: center; justify-content: center; gap: 24px; margin: 26px 0; }
.py-quiz-score-ring { position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 116px; height: 116px; flex-shrink: 0; border-radius: 50%; background: conic-gradient(#7c3aed var(--quiz-score,0%),#e2dcf5 0); }
.py-quiz-score-ring::before { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: #fff; z-index: -1; }
.py-quiz-score-ring strong { font-size: 1.7rem; color: #6d28d9; line-height: 1.2; }
.py-quiz-score-ring span, .py-quiz-score-row p { color: #59677d; font-size: .8rem; margin: 4px 0 0; }
.py-quiz-fraction { font-size: 1.8rem; color: #283b67; }
.py-quiz-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.py-quiz-stats > div { padding: 14px 6px; border-radius: 12px; text-align: center; }
.py-quiz-stats strong { display: block; color: inherit; font-size: 1.5rem; line-height: 1.3; }
.py-quiz-stats span { font-size: .75rem; }
.py-quiz-stat-correct { background: #d1fae5; color: #065f46; }
.py-quiz-stat-wrong { background: #ffe4e6; color: #9f1239; }
.py-quiz-stat-remaining { background: #dbeafe; color: #1e40af; }
.py-quiz-results [data-quiz-summary] { margin: 20px 0; font-size: .85rem; color: #475569; line-height: 1.65; }
.py-quiz-result-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.py-quiz-result-actions .btn { min-height: 44px; justify-content: center; line-height: 1.4; text-align: center; }
@media(max-width:540px) {
  .py-quiz-results { padding: 20px 14px; border-radius: 16px; }
  .py-quiz-result-heading h3 { font-size: 1.15rem; }
  .py-quiz-score-row { gap: 16px; }
  .py-quiz-score-ring { width: 100px; height: 100px; }
  .py-quiz-stats { gap: 6px; }
  .py-quiz-stats span { font-size: .7rem; }
  .py-quiz-result-actions .btn { width: 100%; }
}
.py-fundamentals.py-drawer-ready { padding-left: 0; }
.py-fundamentals.py-drawer-ready .py-fundamentals-sidebar {
  position: fixed; top: var(--nav-h); bottom: 0; left: 0; z-index: 600;
  width: min(350px, calc(100vw - 32px)); min-width: 0; height: auto; max-height: none;
  padding: 0; overflow-y: auto; background: var(--surface);
  transform: translateX(-100%); visibility: hidden;
}
.py-drawer-ready.py-contents-open .py-fundamentals-sidebar { transform: translateX(0); visibility: visible; }
.py-fundamentals.py-drawer-ready:not(.py-contents-open) .py-fundamentals-sidebar { display: none; }
.py-contents-overlay:not([hidden]) { position: fixed; inset: 0; z-index: 598; background: rgba(15,23,42,.4); }
.py-drawer-ready .py-contents-toggle { display: flex; width: 44px; height: 44px; }
.py-drawer-ready .idocs-sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.py-contents-close { flex-shrink: 0; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); font-size: 24px; cursor: pointer; }
.py-drawer-ready .py-fundamentals-lesson, .py-drawer-ready .py-fundamentals-lesson [id] { scroll-margin-top: calc(var(--nav-h) + var(--py-nav-height, 100px) + 16px); }
.py-progress-note { color: var(--text-3); font-size: .85rem; margin: 16px 0; }
.py-completion-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 24px; }
.py-lesson-completed::after { content: '✓'; color: var(--green); margin-left: auto; }
html:has(.py-fundamentals) { scroll-behavior: auto; }
.py-fundamentals-reading { flex: 1; min-width: 0; padding: 0 32px 48px; }
.py-fundamentals-reading .idocs-header-dark { margin-bottom: 28px; }
.py-fundamentals-sidebar { width: 350px; }
.py-learning-body { display: flex; flex: 1; min-width: 0; align-items: flex-start; }
.py-page-toc { position: sticky; top: calc(var(--nav-h) + 16px); flex: 0 0 220px; max-height: calc(100vh - var(--nav-h) - 32px); overflow-y: auto; padding: 20px 16px; border-left: 1px solid var(--border); background: var(--surface); font-size: .85rem; }
.py-page-toc[hidden] { display: none; }
.py-page-toc summary { font-weight: 700; cursor: pointer; color: var(--text); }
.py-page-toc-title { color: var(--text-3); margin: 14px 0; overflow-wrap: anywhere; }
.py-page-toc ul { list-style: none; padding: 0; margin: 0; }
.py-page-toc a { display: block; padding: 7px 10px; border-left: 2px solid transparent; color: var(--text-2); line-height: 1.5; overflow-wrap: anywhere; }
.py-page-toc a:hover, .py-page-toc a[aria-current] { color: var(--purple); border-left-color: var(--purple); background: var(--purple-bg); }
.py-page-toc .py-page-toc-subheading { padding-left: 22px; }
@media (min-width: 901px) {
  .py-fundamentals { --py-sidebar-width: 350px; padding-left: var(--py-sidebar-width); }
  .py-fundamentals .py-fundamentals-sidebar { position: fixed; top: var(--nav-h); bottom: 0; left: 0; z-index: 10; width: var(--py-sidebar-width); min-width: 0; height: auto; }
  body.db-logged-in .py-fundamentals { --py-sidebar-width: 220px; }
}
@media (min-width: 901px) and (max-width: 1200px) {
  .py-fundamentals { --py-sidebar-width: 240px; }
  .py-page-toc { flex-basis: 190px; padding: 16px 12px; }
  .py-fundamentals-reading { padding-right: 20px; padding-left: 20px; }
}
@media (max-width: 900px) {
  .py-learning-body { flex-direction: column; width: 100%; }
  .py-page-toc { order: -1; position: static; flex: none; width: 100%; max-height: 280px; border-left: 0; border-bottom: 1px solid var(--border); }
  .py-learning-body > .py-fundamentals-reading { width: 100%; }
}
.py-fundamentals-nav summary { position: static; list-style: none; }
.py-fundamentals-nav summary::-webkit-details-marker { display: none; }
.py-fundamentals-nav summary::after { content: "›"; margin-left: auto; }
.py-fundamentals-nav details[open] > summary::after, .py-fundamentals-nav[open] > summary::after { transform: rotate(90deg); }
.py-fundamentals-nav > summary { color: var(--purple); }
.py-fundamentals-chapters, .py-fundamentals-lessons { list-style: none; margin: 0; padding: 0 8px; }
.py-fundamentals-lessons { padding-left: 18px; }
.py-fundamentals-nav .idocs-nav-link { white-space: normal; }
.py-fundamentals-lesson { padding: 28px 0; border-top: 1px solid var(--border); }
.py-lesson-pagination a { min-width: 0; overflow-wrap: anywhere; }
@media (min-width: 901px) {
  .py-lesson-pagination .idocs-next { grid-column: 2; }
}
.py-fundamentals-title { font-size: 1.65rem; color: var(--purple); margin-bottom: 24px; }
.py-fundamentals-lesson, .py-fundamentals-lesson [id] { scroll-margin-top: calc(var(--nav-h) + 20px); }
.py-fundamentals a:focus-visible, .py-fundamentals summary:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
@media (max-width: 900px) {
  .py-fundamentals { flex-direction: column; }
  .py-fundamentals .py-fundamentals-sidebar { position: sticky; top: var(--nav-h); z-index: 10; width: 100%; min-width: 0; height: auto; max-height: 36vh; transform: none; padding: 0; border-bottom: 1px solid var(--border); }
  .py-fundamentals-reading { width: 100%; padding: 20px 18px 40px; }
  .py-fundamentals-lesson, .py-fundamentals-lesson [id] { scroll-margin-top: calc(var(--nav-h) + 36vh + 20px); }
}
.py-section-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }
.py-section .sec-hd { gap: 16px; flex-wrap: wrap; }
.py-section-lessons > a { min-width: 0; }
.py-section-lesson-title { color: var(--text); font-size: 1.05rem; line-height: 1.5; margin-bottom: 10px; }
.py-section-description { color: var(--text-3); font-size: .85rem; line-height: 1.65; margin-bottom: 18px; }
.py-section-lesson-link { margin-top: auto; }
.py-section-overview { margin-top: 32px; padding: 20px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.py-section-overview summary { cursor: pointer; color: var(--purple); font-weight: 700; }
.py-section-overview .prose { margin-top: 18px; }
.py-learning-routes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 14px; margin: 20px 0; }
.py-learning-routes section { border: 1px solid var(--border, #c8d9ea); padding: 20px; border-radius: 12px; min-width: 0; }
.py-learning-routes h3 { margin-top: 0; }
.py-learning-routes a { font-weight: 700; }
.py-learning-routes a:focus-visible { outline: 3px solid #b46a00; outline-offset: 4px; }
.py-roadmap { --py-ink: var(--text); --py-muted: var(--text-2); --py-blue: var(--purple); color: var(--py-ink); margin: 24px 0; }
.py-roadmap .py-roadmap-path { position: relative; isolation: isolate; display: flex; flex-direction: column; gap: 18px; list-style: none; margin: 0 auto; max-width: 1000px; padding: 18px; border-radius: 20px; background: #eaf3fa; overflow: hidden; }
.py-roadmap-path::before { content: ""; position: absolute; z-index: -1; inset: 0; background: url("../images/python-road.svg") center / 100% 100% no-repeat; opacity: .65; }
.py-roadmap .py-roadmap-node { width: 85%; max-width: 760px; box-sizing: border-box; padding: 16px 20px; margin: 0; border: 1px solid #bfd1e2; border-radius: 16px; background: #fff; box-shadow: 0 6px 18px #10213f0d; min-width: 0; }
.py-roadmap-node:nth-child(even) { align-self: flex-end; }
.py-roadmap-node { position: relative; }
.py-roadmap-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-lg); }
.py-roadmap-node details { position: relative; z-index: 1; }
.py-roadmap-node:has(.py-roadmap-link:focus-visible) { outline: 3px solid var(--purple); outline-offset: 4px; }
.py-roadmap .py-roadmap-node:hover { border-color: var(--purple-muted); box-shadow: var(--sh-hover); }
.prose .py-roadmap .py-roadmap-node h3 { color: var(--py-ink); margin: 6px 0 8px; padding: 0; border: 0; font-size: 1.2rem; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.prose .py-roadmap .py-roadmap-node p { margin: 0 0 8px; line-height: 1.5; }
.py-roadmap-node p, .py-roadmap-node li { color: var(--py-muted); font-size: .9rem; line-height: 1.65; }
.py-roadmap-step { color: var(--py-blue); font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.prose .py-roadmap .py-roadmap-link { display: inline-block; margin-top: 10px; color: #fff; background: var(--py-blue); padding: 8px 14px; border-radius: 8px; font-weight: 700; text-decoration: none; line-height: 1.4; }
.py-roadmap summary { cursor: pointer; color: var(--py-ink); font-weight: 700; padding: 4px 0; }
.py-roadmap a:focus-visible, .py-roadmap summary:focus-visible, .py-section a:focus-visible { outline: 3px solid #b46a00; outline-offset: 4px; }
@media (max-width: 820px) {
  .py-roadmap .py-roadmap-path { padding: 14px; gap: 16px; }
  .py-roadmap-path::before { display: none; }
  .py-roadmap .py-roadmap-node { width: 100%; }
}
.py-roadmap .py-roadmap-path { background-color: var(--purple-bg); border-radius: var(--r-lg); }
.py-roadmap .py-roadmap-node { border-color: var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--sh-card); }
.py-roadmap a:focus-visible, .py-roadmap summary:focus-visible, .py-section a:focus-visible, .py-section summary:focus-visible, .py-learning-routes a:focus-visible { outline-color: var(--purple); }
@media (max-width: 900px) { .py-section-lessons { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 580px) {
  .py-section-lessons { grid-template-columns: minmax(0, 1fr); }
  .py-section .sec { padding: 32px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .py-section .iprep-scenario-card, .py-section .post-card, .py-section .ipcard-logo { animation: none; transition: none; }
}
