    *, *::before, *::after { box-sizing: border-box; }

    body {
      font-family: 'Source Serif 4', Georgia, serif;
      font-size: 19px;
      line-height: 1.75;
      color: #111;
      background: #fff;
      margin: 0;
      padding: 0;
    }

    /* ── Masthead ── */
    header {
      border-top: 4px solid #111;
      border-bottom: 1px solid #111;
      text-align: center;
      padding: 40px 24px 32px;
    }

    .dropcap{
      float: left;
      font-size: 3.6em;
      line-height: 0.85;
      padding: 0.08em 0.12em 0 0;
      font-weight: 700;
    }

    .kicker {
      font-family: 'Source Serif 4', Georgia, serif;
      font-size: 12px;
      font-weight: 600;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      color: #777;
      margin: 0 0 18px;
    }

    h1 {
      font-family: 'Playfair Display', Georgia, serif;
      font-size: clamp(2.8rem, 7vw, 5rem);
      font-weight: 900;
      line-height: 1.0;
      margin: 0 0 20px;
      letter-spacing: -0.03em;
    }

    .subtitle {
      font-style: italic;
      color: #555;
      font-size: 1.1rem;
      line-height: 1.5;
      max-width: 540px;
      margin: 0 auto 20px;
    }

    .byline {
      font-size: 12px;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: #aaa;
      border-top: 1px solid #e0e0e0;
      padding-top: 16px;
      margin-top: 8px;
    }

    /* ── Table of Contents ── */
    nav {
      max-width: 700px;
      margin: 32px auto 0;
      padding: 0 24px;
    }

    .toc {
      border: 1px solid #e0e0e0;
      padding: 20px 28px;
      border-radius: 2px;
    }

    .toc-title {
      font-size: 11px;
      font-weight: 600;
      letter-spacing: 0.15em;
      text-transform: uppercase;
      color: #888;
      margin: 0 0 12px;
    }

    .toc ol {
      margin: 0;
      padding-left: 0;
      list-style: none;
      font-size: 0.95rem;
      line-height: 2;
      color: #333;
    }

    .toc a {
      color: #111;
      text-decoration: none;
      border-bottom: 1px solid transparent;
      transition: border-color 0.15s;
    }

    .toc a:hover { border-bottom-color: #111; }

    .toc-book + .toc-book {
      border-top: 1px solid #ebebeb;
      margin-top: 16px;
      padding-top: 16px;
    }

    .toc-book-label {
      font-size: 11px;
      font-weight: 600;
      letter-spacing: 0.15em;
      text-transform: uppercase;
      color: #555;
      margin: 0 0 8px;
    }

    details.toc-book > summary {
      list-style: none;
      cursor: pointer;
      user-select: none;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    details.toc-book > summary::-webkit-details-marker { display: none; }
    details.toc-book > summary::marker { display: none; }

    details.toc-book > summary::after {
      content: '+';
      font-size: 14px;
      font-weight: 400;
      color: #aaa;
      letter-spacing: 0;
      text-transform: none;
      font-family: 'Source Serif 4', Georgia, serif;
    }

    details.toc-book[open] > summary::after {
      content: '−';
    }

    details.toc-book > ol {
      margin-top: 8px;
    }

    .toc-book--soon .toc-book-label {
      color: #bbb;
    }

    .toc-book-soon {
      font-size: 0.88rem;
      font-style: italic;
      color: #bbb;
      margin: 0;
      line-height: 1.5;
    }

    .toc a.is-current {
      border-bottom-color: #111;
      text-decoration: underline;
      text-underline-offset: 5px;
      text-decoration-thickness: 1px;
    }

    /* ── Main content ── */
    main {
      max-width: 700px;
      margin: 0 auto;
      padding: 0 24px 100px;
    }

    /* ── Sections ── */
    section {
      padding-top: 56px;
    }

    section + section {
      border-top: 1px solid #e0e0e0;
      margin-top: 56px;
    }

    .section-label {
      font-size: 11px;
      font-weight: 600;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      color: #999;
      margin: 0 0 10px;
    }

    h2 {
      font-family: 'Playfair Display', Georgia, serif;
      font-size: 2.1rem;
      font-weight: 700;
      line-height: 1.15;
      margin: 0 0 24px;
      letter-spacing: -0.015em;
    }

    h3 {
      font-family: 'Playfair Display', Georgia, serif;
      font-size: 1.25rem;
      font-weight: 700;
      margin: 40px 0 12px;
      letter-spacing: -0.01em;
    }

    p {
      margin: 0 0 22px;
    }

    code {
      font-family: 'Source Code Pro', 'Courier New', monospace;
      font-size: 0.84em;
      background: #f2f2f2;
      padding: 2px 6px;
      border-radius: 3px;
    }

    /* ── Callout ── */
    .callout {
      background: #faf9f5;
      border-left: 3px solid #111;
      padding: 14px 20px;
      margin: 28px 0;
      font-size: 0.93rem;
      line-height: 1.65;
      color: #444;
    }

    .callout strong { color: #111; }

    /* ── Chapter banners ── */
    .chapter-banner {
      border-top: 3px solid #111;
      border-bottom: 1px solid #111;
      margin: 64px 0 0;
      padding: 28px 0 24px;
    }

    .chapter-banner .chapter-number {
      font-size: 11px;
      font-weight: 600;
      letter-spacing: 0.2em;
      text-transform: uppercase;
      color: #999;
      margin: 0 0 8px;
    }

    .chapter-banner h2 {
      font-family: 'Playfair Display', Georgia, serif;
      font-size: 2.4rem;
      font-weight: 900;
      margin: 0 0 10px;
      letter-spacing: -0.02em;
    }

    .chapter-banner .chapter-desc {
      font-style: italic;
      color: #666;
      font-size: 1rem;
      margin: 0;
    }

    /* ── End of chapter navigation ── */
    .chapter-next {
      border-top: 3px solid #111;
      border-bottom: 1px solid #111;
      margin: 72px 0 8px;
      padding: 34px 0 30px;
      text-align: center;
    }

    .chapter-next .chapter-number {
      font-size: 11px;
      font-weight: 600;
      letter-spacing: 0.2em;
      text-transform: uppercase;
      color: #999;
      margin: 0 0 10px;
    }

    .chapter-next h2 {
      font-family: 'Playfair Display', Georgia, serif;
      font-size: clamp(2.7rem, 6vw, 3.8rem);
      font-weight: 900;
      margin: 0 0 12px;
      letter-spacing: -0.02em;
      line-height: 1.04;
    }

    .chapter-next h2 a {
      color: #111;
      text-decoration: none;
      border-bottom: 1px solid transparent;
      transition: border-color 0.15s;
    }

    .chapter-next h2 a:hover {
      border-bottom-color: #111;
    }

    .chapter-next .chapter-desc {
      font-style: italic;
      color: #666;
      font-size: 1rem;
      margin: 0;
    }

    .chapter-next-links {
      margin-top: 16px;
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      gap: 20px;
      flex-wrap: wrap;
    }

    .chapter-next-links a {
      font-family: 'Playfair Display', Georgia, serif;
      font-size: clamp(1.35rem, 3.2vw, 2rem);
      font-weight: 700;
      color: #111;
      text-decoration: none;
      border-bottom: 1px solid transparent;
      letter-spacing: -0.01em;
      transition: border-color 0.15s;
    }

    .chapter-next-links a:hover {
      border-bottom-color: #111;
    }

    /* ── Exercises ── */
    .exercise {
      margin: 48px 0 0;
      padding-top: 40px;
      border-top: 1px solid #e0e0e0;
    }

    .exercise:first-of-type {
      border-top: none;
      padding-top: 40px;
    }

    .exercise-header {
      display: flex;
      align-items: baseline;
      gap: 16px;
      margin-bottom: 14px;
    }

    .exercise-number {
      font-family: 'Playfair Display', Georgia, serif;
      font-size: 2rem;
      font-weight: 700;
      color: #ddd;
      line-height: 1;
      flex-shrink: 0;
    }

    .exercise-prompt {
      font-size: 1.05rem;
      font-weight: 600;
      color: #111;
      margin: 0;
      line-height: 1.4;
    }

    .exercise-hint {
      font-size: 0.9rem;
      color: #888;
      margin: 0 0 16px;
      font-style: italic;
    }

    /* ── Code Cells ── */
    .cell {
      margin: 28px 0;
      border: 1px solid #ccc;
      border-radius: 3px;
      overflow: hidden;
    }

    .cell-label {
      background: #f5f5f5;
      border-bottom: 1px solid #ddd;
      padding: 7px 14px;
      font-family: 'Source Code Pro', monospace;
      font-size: 10.5px;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: #888;
      user-select: none;
    }

    .editor-shell {
      position: relative;
      background: #fefefe;
      overflow: hidden;
    }

    .code-highlight {
      position: absolute;
      inset: 0;
      margin: 0;
      padding: 16px 18px;
      font-family: 'Source Code Pro', 'Courier New', monospace;
      font-size: 13.5px;
      line-height: 1.65;
      white-space: pre-wrap;
      word-break: break-word;
      color: #111;
      pointer-events: none;
      z-index: 1;
    }

    .code-highlight .tok-comment { color: #2e9f54; }
    .code-highlight .tok-string { color: #d87a16; }
    .code-highlight .tok-number { color: #63a9ff; }
    .code-highlight .tok-variable { color: #2c6dfc; }

    textarea {
      display: block;
      width: 100%;
      border: none;
      outline: none;
      resize: none;
      overflow: hidden;
      padding: 16px 18px;
      font-family: 'Source Code Pro', 'Courier New', monospace;
      font-size: 13.5px;
      line-height: 1.65;
      color: #111;
      caret-color: #111;
      background: #fefefe;
      tab-size: 4;
      position: relative;
      z-index: 2;
    }

    .editor-shell textarea.is-syntax-active {
      color: transparent;
      background: transparent;
    }

    textarea::placeholder {
      color: #bbb;
      font-style: italic;
    }

    .cell-controls {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 14px;
      background: #f8f8f8;
      border-top: 1px solid #e8e8e8;
    }

    .btn-run {
      background: #111;
      color: #fff;
      border: none;
      padding: 7px 20px;
      font-family: 'Source Serif 4', Georgia, serif;
      font-size: 12.5px;
      font-weight: 600;
      border-radius: 2px;
      cursor: pointer;
      letter-spacing: 0.03em;
      transition: background 0.15s;
    }

    .btn-run:hover { background: #333; }
    .btn-run:disabled { background: #777; cursor: default; }

    .btn-clear {
      background: none;
      color: #888;
      border: 1px solid #ccc;
      padding: 6px 16px;
      font-family: 'Source Serif 4', Georgia, serif;
      font-size: 12.5px;
      border-radius: 2px;
      cursor: pointer;
      transition: border-color 0.15s, color 0.15s;
    }

    .btn-clear:hover { border-color: #888; color: #333; }

    .btn-download {
      background: none;
      color: #888;
      border: 1px solid #ccc;
      padding: 6px 16px;
      font-family: 'Source Serif 4', Georgia, serif;
      font-size: 12.5px;
      border-radius: 2px;
      cursor: pointer;
      transition: border-color 0.15s, color 0.15s;
    }

    .btn-download:hover { border-color: #888; color: #333; }
    .btn-download:disabled { opacity: 0.5; cursor: default; }

    .run-status {
      font-size: 12px;
      color: #aaa;
      font-style: italic;
      margin-left: 4px;
    }

    pre.out {
      margin: 0;
      padding: 14px 18px;
      font-family: 'Source Code Pro', 'Courier New', monospace;
      font-size: 13px;
      line-height: 1.6;
      background: #111;
      color: #e8e8e8;
      border-top: 1px solid #2a2a2a;
      white-space: pre-wrap;
      word-break: break-word;
    }

    pre.out:empty { display: none; }
    pre.out.is-error { color: #ff7b7b; }

    /* ── HTML/CSS playground ── */
    .web-cell-grid {
      display: grid;
      gap: 12px;
      grid-template-columns: 1fr;
      padding: 12px;
      background: #fcfcfc;
      border-bottom: 1px solid #ececec;
    }

    .web-editor {
      border: 1px solid #e3e3e3;
      border-radius: 2px;
      overflow: hidden;
      background: #fff;
    }

    .web-editor-label {
      margin: 0;
      padding: 6px 10px;
      font-family: 'Source Code Pro', monospace;
      font-size: 10.5px;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: #888;
      border-bottom: 1px solid #ececec;
      background: #fafafa;
    }

    .web-editor textarea {
      min-height: 130px;
      background: #fff;
      color: #111;
    }

    .web-preview-wrap {
      border-top: 1px solid #ececec;
      background: #f9f9f9;
      padding: 12px;
    }

    .web-preview-wrap.is-empty { display: none; }

    .web-preview-title {
      margin: 0 0 8px;
      font-family: 'Source Code Pro', monospace;
      font-size: 11px;
      color: #777;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .web-preview {
      display: block;
      width: 100%;
      border: 1px solid #ddd;
      border-radius: 2px;
      background: #fff;
      overflow: hidden;
    }

    /* ── Terminal playground ── */
    .terminal-wrap {
      padding: 12px;
      border-top: 1px solid #ececec;
      background: #f8f8f8;
    }

    .terminal-screen {
      margin: 0;
      min-height: 170px;
      max-height: 340px;
      overflow: auto;
      padding: 14px 16px;
      background: #0b0f0c;
      color: #87f5a1;
      font-family: 'Source Code Pro', 'Courier New', monospace;
      font-size: 13px;
      line-height: 1.55;
      border: 1px solid #1f2a22;
      border-radius: 2px;
      white-space: pre-wrap;
      word-break: break-word;
    }

    .terminal-input-wrap {
      margin-top: 10px;
      display: grid;
      gap: 8px;
      grid-template-columns: auto 1fr;
      align-items: start;
    }

    .terminal-prompt {
      margin: 7px 0 0;
      font-family: 'Source Code Pro', monospace;
      font-size: 12px;
      color: #3f3f3f;
      letter-spacing: 0.04em;
    }

    .terminal-input {
      min-height: 44px;
      border: 1px solid #d4d4d4;
      border-radius: 2px;
      padding: 10px 12px;
      font-family: 'Source Code Pro', 'Courier New', monospace;
      font-size: 13px;
      line-height: 1.45;
      resize: vertical;
      background: #fff;
      color: #111;
    }

    .terminal-note {
      margin: 10px 0 0;
      font-size: 12px;
      color: #8b8b8b;
      font-style: italic;
    }

    /* ── Loading banner ── */
    #loading-banner {
      position: fixed;
      bottom: 0; left: 0; right: 0;
      background: #111;
      color: #e8e8e8;
      text-align: center;
      padding: 13px 20px;
      font-family: 'Source Serif 4', Georgia, serif;
      font-size: 14px;
      letter-spacing: 0.02em;
      z-index: 999;
    }

    #loading-banner span {
      display: inline-block;
      animation: pulse 1.5s ease-in-out infinite;
    }

    @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

    /* ── Footer ── */
    footer {
      text-align: center;
      border-top: 1px solid #e0e0e0;
      padding: 28px 24px;
      font-size: 13px;
      color: #bbb;
      font-style: italic;
    }

    @media (min-width: 860px) {
      .web-cell-grid {
        grid-template-columns: 1fr 1fr;
      }
    }
