@layer notebook-source {

    .notebook-content {
      --bg-page: #f8fafc;
      --bg-surface: #ffffff;
      --bg-code: #0f172a;
      --bg-code-out: #f1f5f9;
      --bg-callout: #eff6ff;
      --border-callout: #3b82f6;
      --bg-warn: #fefce8;
      --border-warn: #eab308;
      --text-primary: #0f172a;
      --text-secondary: #475569;
      --text-code: #e2e8f0;
      --border-subtle: #e2e8f0;
      --accent: #2563eb;
      --accent-hover: #1d4ed8;
      --badge-bg: #dbeafe;
      --badge-text: #1e40af;
      --cell-prompt: #64748b;
      --success-bg: #dcfce7;
      --success-border: #16a34a;
      --success-text: #14532d;
      --error-bg: #fee2e2;
      --error-border: #dc2626;
      --error-text: #7f1d1d;
      --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    }

    .notebook-content {
      --bg-page: #0b1120;
      --bg-surface: #111827;
      --bg-code: #030712;
      --bg-code-out: #1e293b;
      --bg-callout: #172554;
      --border-callout: #60a5fa;
      --bg-warn: #422006;
      --border-warn: #facc15;
      --text-primary: #f1f5f9;
      --text-secondary: #94a3b8;
      --text-code: #e2e8f0;
      --border-subtle: #1f2937;
      --accent: #3b82f6;
      --accent-hover: #60a5fa;
      --badge-bg: #1e3a8a;
      --badge-text: #bfdbfe;
      --cell-prompt: #94a3b8;
      --success-bg: #052e16;
      --success-border: #22c55e;
      --success-text: #bbf7d0;
      --error-bg: #450a0a;
      --error-border: #ef4444;
      --error-text: #fecaca;
      --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    }

    .notebook-content * {
      box-sizing: border-box;
    }

    .notebook-content {
      margin: 0;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
      background-color: var(--bg-page);
      color: var(--text-primary);
      line-height: 1.65;
      transition: background-color 0.2s ease, color 0.2s ease;
    }

    .notebook-content .layout {
      display: grid;
      grid-template-columns: 270px 1fr;
      max-width: 1380px;
      margin: 0 auto;
      min-height: 100vh;
    }

    /* Sidebar Navigation */
    .notebook-content .sidebar {
      position: sticky;
      top: 0;
      height: 100vh;
      overflow-y: auto;
      padding: 1.75rem 1.25rem;
      border-right: 1px solid var(--border-subtle);
      background-color: var(--bg-surface);
    }

    .notebook-content .sidebar-brand {
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      font-size: 0.78rem;
      font-weight: 700;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--accent);
      margin-bottom: 0.45rem;
    }

    .notebook-content .sidebar-title {
      font-size: 1.02rem;
      font-weight: 700;
      margin: 0 0 1.25rem 0;
      line-height: 1.35;
    }

    .notebook-content .toc-label {
      font-size: 0.74rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--text-secondary);
      margin-bottom: 0.6rem;
    }

    .notebook-content .toc-list {
      list-style: none;
      padding: 0;
      margin: 0 0 1.75rem 0;
    }

    .notebook-content .toc-list li {
      margin-bottom: 0.42rem;
    }

    .notebook-content .toc-list a {
      display: block;
      text-decoration: none;
      color: var(--text-secondary);
      font-size: 0.87rem;
      padding: 0.3rem 0.55rem;
      border-radius: 6px;
      transition: all 0.15s ease;
    }

    .notebook-content .toc-list a:hover {
      background-color: var(--badge-bg);
      color: var(--badge-text);
    }

    .notebook-content .theme-btn {
      width: 100%;
      padding: 0.55rem 0.85rem;
      border: 1px solid var(--border-subtle);
      border-radius: 8px;
      background-color: var(--bg-page);
      color: var(--text-primary);
      font-size: 0.85rem;
      font-weight: 600;
      cursor: pointer;
      transition: border-color 0.15s ease;
    }

    .notebook-content .theme-btn:hover {
      border-color: var(--accent);
    }

    /* Main Notebook Workspace */
    .notebook-content .notebook {
      padding: 2rem 2.75rem 4rem 2.75rem;
      max-width: 990px;
    }

    .notebook-content .nb-header {
      background-color: var(--bg-surface);
      border: 1px solid var(--border-subtle);
      border-radius: 12px;
      padding: 1.75rem 2rem;
      margin-bottom: 1.75rem;
      box-shadow: var(--shadow-sm);
    }

    .notebook-content .meta-strip {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
      margin-bottom: 0.9rem;
    }

    .notebook-content .badge {
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      font-size: 0.75rem;
      font-weight: 600;
      padding: 0.25rem 0.65rem;
      border-radius: 999px;
      background-color: var(--badge-bg);
      color: var(--badge-text);
    }

    .notebook-content .badge.verified {
      background-color: var(--success-bg);
      color: var(--success-text);
    }

    .notebook-content h1 {
      font-size: 1.82rem;
      line-height: 1.25;
      margin: 0 0 0.65rem 0;
      letter-spacing: -0.02em;
    }

    .notebook-content .subtitle {
      margin: 0;
      color: var(--text-secondary);
      font-size: 0.99rem;
    }

    /* Notebook Cells */
    .notebook-content .cell {
      display: grid;
      grid-template-columns: 78px 1fr;
      gap: 0.75rem;
      margin-bottom: 1.65rem;
      align-items: start;
    }

    .notebook-content .cell-prompt {
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      font-size: 0.77rem;
      color: var(--cell-prompt);
      text-align: right;
      padding-top: 1.15rem;
      user-select: none;
    }

    .notebook-content .cell-body {
      background-color: var(--bg-surface);
      border: 1px solid var(--border-subtle);
      border-radius: 10px;
      padding: 1.5rem 1.75rem;
      box-shadow: var(--shadow-sm);
      overflow-x: auto;
    }

    .notebook-content .cell-body h2 {
      margin-top: 0;
      font-size: 1.32rem;
      border-bottom: 1px solid var(--border-subtle);
      padding-bottom: 0.5rem;
      margin-bottom: 1rem;
    }

    .notebook-content .cell-body h3 {
      font-size: 1.06rem;
      margin-top: 1.35rem;
      margin-bottom: 0.5rem;
    }

    .notebook-content p {
      margin-top: 0;
      margin-bottom: 0.95rem;
    }

    .notebook-content ul, .notebook-content ol {
      margin-top: 0;
      margin-bottom: 1rem;
      padding-left: 1.4rem;
    }

    .notebook-content li {
      margin-bottom: 0.42rem;
    }

    .notebook-content a.cite {
      color: var(--accent);
      text-decoration: none;
      font-weight: 600;
      font-size: 0.85em;
    }

    .notebook-content a.cite:hover {
      text-decoration: underline;
    }

    /* Callouts & Formula Blocks */
    .notebook-content .callout {
      background-color: var(--bg-callout);
      border-left: 4px solid var(--border-callout);
      padding: 1rem 1.2rem;
      border-radius: 0 8px 8px 0;
      margin: 1.1rem 0;
    }

    .notebook-content .callout.warn {
      background-color: var(--bg-warn);
      border-left-color: var(--border-warn);
    }

    .notebook-content .callout-title {
      font-weight: 700;
      margin-bottom: 0.35rem;
      font-size: 0.95rem;
    }

    .notebook-content .math-block {
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      background-color: var(--bg-code-out);
      border: 1px solid var(--border-subtle);
      padding: 0.95rem 1.15rem;
      border-radius: 8px;
      font-size: 0.88rem;
      overflow-x: auto;
      margin: 1rem 0;
      line-height: 1.55;
    }

    /* Tables */
    .notebook-content table {
      width: 100%;
      border-collapse: collapse;
      margin: 1.1rem 0;
      font-size: 0.89rem;
    }

    .notebook-content th, .notebook-content td {
      border: 1px solid var(--border-subtle);
      padding: 0.65rem 0.85rem;
      text-align: left;
      vertical-align: top;
    }

    .notebook-content th {
      background-color: var(--bg-code-out);
      font-weight: 700;
    }

    /* Code Cells */
    .notebook-content .code-wrapper {
      position: relative;
      margin: 0.75rem 0;
    }

    .notebook-content .code-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      background-color: #1e293b;
      color: #cbd5e1;
      padding: 0.45rem 0.9rem;
      border-radius: 8px 8px 0 0;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      font-size: 0.78rem;
    }

    .notebook-content .copy-btn {
      background-color: #334155;
      color: #f8fafc;
      border: none;
      border-radius: 4px;
      padding: 0.25rem 0.6rem;
      font-size: 0.74rem;
      cursor: pointer;
    }

    .notebook-content .copy-btn:hover {
      background-color: #475569;
    }

    .notebook-content pre {
      margin: 0;
      background-color: var(--bg-code);
      color: var(--text-code);
      padding: 1rem 1.15rem;
      border-radius: 0 0 8px 8px;
      overflow-x: auto;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      font-size: 0.83rem;
      line-height: 1.55;
    }

    .notebook-content code {
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      background-color: var(--bg-code-out);
      padding: 0.12rem 0.36rem;
      border-radius: 4px;
      font-size: 0.86em;
    }

    .notebook-content pre code {
      background-color: transparent;
      padding: 0;
      font-size: inherit;
    }

    .notebook-content .code-output {
      margin-top: 0.65rem;
      background-color: var(--bg-code-out);
      border: 1px solid var(--border-subtle);
      border-left: 3px solid #64748b;
      border-radius: 6px;
      padding: 0.85rem 1rem;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      font-size: 0.82rem;
      white-space: pre-wrap;
    }

    /* SVG Diagram Box */
    .notebook-content .diagram-box {
      border: 1px solid var(--border-subtle);
      border-radius: 8px;
      padding: 1rem;
      background-color: #ffffff;
      color: #0f172a;
      margin: 1.1rem 0;
      overflow-x: auto;
    }

    /* Interactive Quiz */
    .notebook-content .quiz-card {
      border: 1px solid var(--border-subtle);
      border-radius: 10px;
      padding: 1.2rem 1.35rem;
      margin-bottom: 1.15rem;
      background-color: var(--bg-page);
    }

    .notebook-content .quiz-q-title {
      font-weight: 700;
      margin-bottom: 0.75rem;
      font-size: 0.97rem;
    }

    .notebook-content .quiz-options {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }

    .notebook-content .quiz-option {
      display: flex;
      align-items: flex-start;
      gap: 0.6rem;
      padding: 0.6rem 0.85rem;
      border: 1px solid var(--border-subtle);
      border-radius: 7px;
      background-color: var(--bg-surface);
      cursor: pointer;
      font-size: 0.91rem;
      transition: border-color 0.15s ease, background-color 0.15s ease;
    }

    .notebook-content .quiz-option:hover {
      border-color: var(--accent);
    }

    .notebook-content .quiz-option input[type="radio"] {
      margin-top: 0.25rem;
      accent-color: var(--accent);
    }

    .notebook-content .quiz-option.correct {
      background-color: var(--success-bg);
      border-color: var(--success-border);
      color: var(--success-text);
      font-weight: 600;
    }

    .notebook-content .quiz-option.correct-hint {
      border-color: var(--success-border);
      border-width: 2px;
    }

    .notebook-content .quiz-option.incorrect {
      background-color: var(--error-bg);
      border-color: var(--error-border);
      color: var(--error-text);
    }

    .notebook-content .quiz-explanation {
      display: none;
      margin-top: 0.8rem;
      padding: 0.75rem 0.95rem;
      border-radius: 6px;
      background-color: var(--bg-callout);
      border-left: 3px solid var(--border-callout);
      font-size: 0.88rem;
    }

    .notebook-content .quiz-controls {
      display: flex;
      flex-wrap: wrap;
      gap: 0.75rem;
      margin-top: 1.25rem;
      align-items: center;
    }

    .notebook-content .btn-primary {
      background-color: var(--accent);
      color: #ffffff;
      border: none;
      border-radius: 8px;
      padding: 0.65rem 1.25rem;
      font-size: 0.92rem;
      font-weight: 600;
      cursor: pointer;
    }

    .notebook-content .btn-primary:hover {
      background-color: var(--accent-hover);
    }

    .notebook-content .btn-secondary {
      background-color: transparent;
      color: var(--text-primary);
      border: 1px solid var(--border-subtle);
      border-radius: 8px;
      padding: 0.65rem 1.1rem;
      font-size: 0.92rem;
      font-weight: 600;
      cursor: pointer;
    }

    .notebook-content .btn-secondary:hover {
      border-color: var(--accent);
    }

    .notebook-content #quiz-score-banner {
      display: none;
      margin-top: 1.25rem;
      padding: 1rem 1.25rem;
      border-radius: 8px;
      font-weight: 700;
      font-size: 1rem;
      border: 1px solid var(--border-callout);
      background-color: var(--bg-callout);
    }

    .notebook-content .ref-list {
      padding-left: 1.35rem;
      font-size: 0.9rem;
    }

    .notebook-content .ref-list li {
      margin-bottom: 0.65rem;
    }

    .notebook-content .ref-list a {
      color: var(--accent);
      word-break: break-all;
    }

    @media (max-width: 900px) {
      .notebook-content .layout {
        grid-template-columns: 1fr;
      }
      .notebook-content .sidebar {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
      }
      .notebook-content .notebook {
        padding: 1.25rem;
      }
      .notebook-content .cell {
        grid-template-columns: 1fr;
      }
      .notebook-content .cell-prompt {
        text-align: left;
        padding-top: 0;
      }
    }
  
}

@layer notebook-source {
}
