/* webbooks.theme.css — Reader styles. Lean: one rule per concept. */

:root {
    /* ONE accent source (token audit): the reader's --wbk-accent DERIVES from
       --ui-primary, so it adapts to whatever system hosts it — Publon.Press
       blue on PP pages, ScholarCloud indigo when the reader is embedded in SC,
       the subject hue inside the NeuroCraft hub. The PP brand hue itself
       (--hp-hue-1) is set per-page in publonpress.brand.css, loaded ONLY on
       PP's own pages, so this shared file never clobbers a host's accent. */
    --wbk-text: #1a1a1a;
    --wbk-muted: #666;
    --wbk-accent: var(--ui-primary);
    --wbk-accent-bg: var(--ui-primary-100);
    --wbk-practice-bg: #FFF8E1;
    --wbk-practice-border: #F9A825;
    --wbk-error: #C62828;
    --wbk-page-max: 760px;
    /* Radius follows the hyper-parameter corner scale (sharp in a corner-scale:0
       host like ScholarCloud, rounded where the host scales up) — never a fixed
       px that ignores the design system. */
    --wbk-radius: var(--ui-radius-lg);
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, serif;
    color: var(--wbk-text);
    background: #FAFAFA;
    line-height: 1.6;
}

/* Reader-only narrow column. System page (index.html) uses no body class
   so it stays full-width via uiPageFrame. */
body.wbk-reader #app {
    max-width: var(--wbk-page-max);
    margin: 0 auto;
    padding: 32px 24px 80px;
}

/* ── System-page (index.html) design fixes ──────────────────────────────
   These rules are page-scoped (this stylesheet only loads on Publon.Press
   pages), so they tune the shared uiPageFrame without affecting other
   systems. */

/* §7 — footer accent matches the blue brand (frame default was a red stripe). */
.ui-pageframe-footer { border-top-color: var(--ui-primary, #0e84d8); }

/* §4 — fill the viewport: the stage was flex:0 1 auto inside a display:block
   body and sized to content, leaving a tall white gap above the footer. Make
   the body a flex column so the stage can grow, then let its content pane fill. */
.ui-pageframe-body { display: flex; flex-direction: column; min-height: 0; }
.ui-pageframe-stage { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
/* the generic .ui wrapper between the stage and the control-stage is display:block,
   which stops the control-stage's flex-grow — make it a flex column so the grow
   chain reaches the content panels. */
.ui-pageframe-stage > * { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

.wbk-header {
    border-bottom: 1px solid #E0E0E0;
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.wbk-title { font-size: 2rem; margin: 0 0 4px 0; }
.wbk-subtitle { color: var(--wbk-muted); margin: 0 0 8px 0; font-size: 1.1rem; }
.wbk-meta { color: var(--wbk-muted); font-size: 0.9rem; margin: 0; }

.wbk-chapter {
    margin: 32px 0;
}
.wbk-chapter-title {
    font-size: 1.5rem;
    border-bottom: 2px solid var(--wbk-accent);
    padding-bottom: 6px;
    margin: 0 0 16px 0;
}

.wbk-section {
    margin: 16px 0;
}
.wbk-section-title {
    font-size: 1.2rem;
    margin: 16px 0 8px 0;
    color: var(--wbk-accent);
}

.wbk-block {
    margin: 12px 0;
}

.wbk-markdown { font-family: Georgia, 'Source Serif 4', 'Times New Roman', serif; font-size: 1.0625rem; line-height: 1.72; }
.wbk-markdown p { margin: 0 0 1.1em; }
.wbk-markdown code {
    background: #f0f0f0;
    padding: 1px 6px;
    border-radius: var(--ui-radius-sm);
    font-size: 0.9em;
}
.wbk-markdown pre {
    background: #1e1e1e;
    color: #eee;
    padding: 12px;
    border-radius: var(--wbk-radius);
    overflow-x: auto;
}
.wbk-markdown blockquote {
    border-left: 4px solid var(--wbk-accent);
    margin: 12px 0;
    padding: 4px 16px;
    background: var(--wbk-accent-bg);
}

.wbk-practice {
    background: var(--wbk-practice-bg);
    border: 1px solid var(--wbk-practice-border);
    border-radius: var(--wbk-radius);
    padding: 16px 20px;
    margin: 16px 0;
}
.wbk-practice-tag {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--wbk-practice-border);
    margin-bottom: 8px;
}
.wbk-practice-prompt {
    font-size: 1.05rem;
    margin-bottom: 12px;
}
.wbk-practice-solution {
    margin: 12px 0;
}
.wbk-practice-solution summary {
    cursor: pointer;
    color: var(--wbk-accent);
    font-weight: 600;
}
.wbk-practice-answer {
    margin-top: 8px;
    padding: 12px;
    background: white;
    border-radius: var(--ui-radius-sm);
    border-left: 3px solid var(--wbk-accent);
}

.wbk-btn, .wbk-btn-ghost {
    background: var(--wbk-accent);
    color: white;
    border: 0;
    padding: 8px 16px;
    border-radius: var(--wbk-radius);
    cursor: pointer;
    font-size: 0.9rem;
}
.wbk-btn-ghost {
    background: transparent;
    color: var(--wbk-accent);
    border: 1px solid var(--wbk-accent);
    padding: 4px 12px;
    margin-top: 8px;
}
.wbk-btn:hover, .wbk-btn-ghost:hover { opacity: 0.85; }

.wbk-footer {
    margin-top: 48px;
    padding-top: 16px;
    border-top: 1px solid #E0E0E0;
    text-align: center;
}

.wbk-error {
    color: var(--wbk-error);
    background: #FFEBEE;
    border-radius: var(--ui-radius-sm);
    padding: 8px;
    font-family: monospace;
    font-size: 0.9rem;
}

.wbk-loading {
    color: var(--wbk-muted);
    text-align: center;
    padding: 48px;
}


/* ──────────────────────────────────────────────────────────────────────
   Library tab — book cards (used by class.PublonPress.js PPLibraryTab)
   ────────────────────────────────────────────────────────────────────── */

/* Book tree — rendered via the canonical TreeLayout (.ui-bind-tree-*).
   Layout chrome / twisty / icons all come from class.ui.css; only
   minor accent tuning lives here. */
.pp-detail-cover { box-shadow: 2px 2px 8px rgba(0,0,0,.15); }

/* Planned Substrate Mathematics volumes — visible in the tree to advertise
   the series structure, but non-clickable until their JSON files exist. */
.pp-vol-planned .ui-bind-tree-label { color: var(--ui-text-muted, #999); font-style: italic; }
.pp-vol-planned .ui-bind-tree-icon  { opacity: 0.4; }
.pp-vol-planned { cursor: default !important; }
.pp-vol-planned:hover { background: transparent !important; }


.pp-book-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 120ms, box-shadow 160ms;
}
.pp-book-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.pp-book-band { height: 4px; width: 100%; }
.pp-book-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.pp-book-title { font-weight: 600; font-size: 0.95rem; line-height: 1.3; color: var(--wbk-text); }
.pp-book-meta { font-size: 0.75rem; color: var(--wbk-muted); }
.pp-book-open { font-size: 0.8rem; margin-top: 4px; font-weight: 500; }


/* ──────────────────────────────────────────────────────────────────────
   Studio — three-pane editor (class.PublonPressStudio.js)
   ────────────────────────────────────────────────────────────────────── */

.pp-studio-toolbar { background: rgba(255,255,255,0.9); padding: 4px 10px; border-radius: var(--ui-radius-md);
                     box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.pp-studio-tree { font-size: 0.85rem; }
.pp-tree-chapter, .pp-tree-section, .pp-tree-block {
    padding: 6px 8px; border-radius: var(--ui-radius-sm); cursor: pointer; line-height: 1.4;
    color: var(--wbk-text); transition: background 100ms;
}
.pp-tree-chapter:hover, .pp-tree-section:hover, .pp-tree-block:hover { background: #f5f5f5; }
.pp-tree-active { background: var(--wbk-accent-bg) !important; color: var(--wbk-accent); font-weight: 600; }
.pp-tree-chapter-head { display: flex; align-items: center; gap: 6px; }
.pp-tree-block-type { font-family: ui-monospace, monospace; font-size: 0.78rem; color: var(--wbk-muted); }

.pp-label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--wbk-muted);
            text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.pp-input { width: 100%; padding: 8px 10px; border: 1px solid #d0d0d0; border-radius: var(--ui-radius-sm);
            font-size: 0.9rem; box-sizing: border-box; }
.pp-input:focus { outline: none; border-color: var(--wbk-accent); box-shadow: 0 0 0 3px var(--wbk-accent-bg); }
.pp-textarea { resize: vertical; line-height: 1.5; }

.pp-preview-host { background: white; border-radius: var(--ui-radius-md); padding: 12px;
                   box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.pp-preview-host .wbk-frame { height: auto; }


/* ──────────────────────────────────────────────────────────────────────
   Extra block types — callout / code / toggle / image / table / wordbank
   ────────────────────────────────────────────────────────────────────── */

.wbk-callout { border-radius: var(--wbk-radius); padding: 12px 16px; margin: 12px 0;
               border-left: 4px solid var(--wbk-accent); background: var(--wbk-accent-bg); }
.wbk-callout-warning { border-left-color: #F9A825; background: #FFF8E1; }
.wbk-callout-danger  { border-left-color: #C62828; background: #FFEBEE; }
.wbk-callout-success { border-left-color: #2E7D32; background: #E8F5E9; }
.wbk-callout-title { margin-bottom: 4px; }

.wbk-code { background: #1e1e1e; color: #eee; border-radius: var(--wbk-radius); margin: 12px 0;
            overflow: hidden; }
.wbk-code-lang { background: rgba(255,255,255,.06); color: #aaa; padding: 4px 12px;
                 font-family: ui-monospace, monospace; font-size: 0.75rem; text-transform: uppercase; }
.wbk-code-pre { margin: 0; padding: 12px 16px; overflow-x: auto; font-family: ui-monospace, monospace; font-size: 0.85rem; }
.wbk-code-title { background: #2a2a2a; color: #fff; padding: 6px 16px; font-weight: 600; font-size: 0.85rem; }
.wbk-explorer-title { font-weight: 600; font-size: 1rem; margin-bottom: 4px; }
.wbk-explorer-caption { font-size: 0.85rem; color: var(--wbk-muted); margin-bottom: 8px; }
.wbk-explorer-params { display: block; margin: 6px 0; padding: 4px 8px; background: white; border-radius: var(--ui-radius-sm);
                       font-family: ui-monospace, monospace; font-size: 0.82rem; }
.wbk-quiz-set { margin: 16px 0; }
.wbk-quiz-set-title { font-weight: 600; color: var(--wbk-accent); margin-bottom: 8px;
                      padding-bottom: 4px; border-bottom: 1px solid var(--wbk-accent-bg); }
.wbk-quiz-item { margin: 10px 0; }

/* Fork chapter button — sits next to the chapter title in the reader's
   main pane. Subtle until hovered. */
.wbk-chapter-title-row { display: flex; align-items: flex-start; gap: 12px; }
.wbk-chapter-title-row .wbk-chapter-title { flex: 1; min-width: 0; }
.wbk-chapter-actions { display: flex; gap: 6px; flex-shrink: 0; margin-top: 8px; }
.wbk-fork-btn, .wbk-export-btn, .wbk-lineage-btn {
    background: transparent; color: var(--wbk-accent);
    border: 1px solid var(--wbk-accent-bg);
    padding: 6px 12px; border-radius: var(--ui-radius-sm); cursor: pointer;
    font-size: 0.82rem; font-weight: 600;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background 120ms, border-color 120ms;
}
.wbk-fork-btn:hover, .wbk-export-btn:hover, .wbk-lineage-btn:hover { background: var(--wbk-accent-bg); border-color: var(--wbk-accent); }
.wbk-fork-btn i, .wbk-export-btn i, .wbk-lineage-btn i { font-size: 0.78rem; }
.wbk-fork-note {
    background: #E8F5E9; border-left: 4px solid #2E7D32; color: #1B5E20;
    padding: 10px 14px; border-radius: var(--ui-radius-sm); margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px; font-size: 0.92rem;
}
.wbk-fork-note i { color: #2E7D32; }

/* Gantt plugin — minimal frame for the inline SVG renderer. */
.wbk-gantt { margin: 16px 0; padding: 12px; border: 1px solid var(--wbk-accent-bg);
              border-radius: var(--wbk-radius); background: #fff; }
.wbk-gantt-title { font-weight: 600; color: var(--wbk-accent); margin-bottom: 8px;
                    padding-bottom: 4px; border-bottom: 1px solid var(--wbk-accent-bg); }
.wbk-gantt-svg { display: block; }

.wbk-toggle details { border: 1px solid var(--wbk-accent-bg); border-radius: var(--wbk-radius); padding: 8px 12px; }
.wbk-toggle summary { cursor: pointer; font-weight: 600; color: var(--wbk-accent); }
.wbk-toggle-body { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--wbk-accent-bg); }

.wbk-reference { border-left: 3px solid var(--wbk-muted); padding: 6px 14px; background: #fafafa;
                 font-size: 0.92rem; color: var(--wbk-muted); }

.wbk-table { border-collapse: collapse; margin: 12px 0; width: 100%; }
.wbk-table th, .wbk-table td { border: 1px solid #ddd; padding: 6px 10px; text-align: left; }
.wbk-table th { background: #f5f5f5; }
.wbk-caption { font-size: 0.85rem; color: var(--wbk-muted); margin-top: 4px; font-style: italic; }

.wbk-image-img { max-width: 100%; height: auto; border-radius: var(--wbk-radius); }
.wbk-drawing svg { max-width: 100%; }
.wbk-equation { padding: 8px 0; text-align: center; }

.wbk-wordbank { background: #F3E5F5; border-radius: var(--wbk-radius); padding: 12px 16px; margin: 12px 0; }
.wbk-wordbank-tag { font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
                    letter-spacing: 0.06em; color: #6A1B9A; margin-bottom: 8px; }
.wbk-wordbank-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.wbk-wordbank-pill { background: white; border: 1px solid #9C27B0; color: #6A1B9A;
                     padding: 4px 12px; border-radius: 100px; font-size: 0.88rem; }

.wbk-experiment { background: #E0F2F1; border-left: 4px solid #00897B; border-radius: var(--wbk-radius);
                  padding: 12px 16px; margin: 12px 0; }
.wbk-experiment-tag { font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
                      letter-spacing: 0.06em; color: #00695C; margin-bottom: 6px; }
.wbk-experiment-title { margin-bottom: 6px; }

.wbk-explorer { background: #F5F5F5; border-radius: var(--wbk-radius); padding: 12px 16px; margin: 12px 0; }
.wbk-explorer-tag { font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
                    letter-spacing: 0.06em; color: #555; margin-bottom: 6px; }
.wbk-explorer-spec { background: white; padding: 8px; border-radius: var(--ui-radius-sm); font-size: 0.8rem; overflow: auto; }

.wbk-shape3d-placeholder { background: #FFF3E0; border-radius: var(--wbk-radius); padding: 16px;
                           text-align: center; color: #E65100; }

.wbk-note { font-size: 0.78rem; color: var(--wbk-muted); margin-top: 4px; font-style: italic; }

/* My-shelf tabset (I-polish): the shelf renders as a tabset-at-top-of-stage,
   each section a paned body — not a flat list on the page background. */
.pp-shelf-pane { padding: 14px 16px; flex: 1 1 auto; min-height: 0; overflow: auto; }
.pp-shelf-list { margin: 0 0 12px; padding-left: 18px; }
.pp-shelf-list li { padding: 3px 0; }

/* DC1 — Library / Catalog control-stage as hairline panes, not bordered white
   cards floating on a grey page (design §4 panes-not-cards · §35 no inline
   styles · §7 tokens not hex). The reader/accordion mount inside unchanged. */
.pp-controlstage        { display: flex; flex: 1; min-height: 540px; }
.pp-controlstage-control{ flex: 0 0 340px; overflow: auto; display: flex; flex-direction: column;
                          border-right: 1px solid var(--ui-gray-200, #e5e7eb); }
.pp-controlstage-stage  { flex: 1; overflow: auto; padding: 20px; }

/* Template-picker tiles (Editor new-book / insert-block modals) — DC1: tokens,
   no call-site hex; hover/active is CSS, not JS handlers. */
.pp-tpl-modal { min-width: min(520px, 86vw); }
.pp-tpl-list  { display: flex; flex-direction: column; gap: var(--ui-space-2); }
.pp-tpl-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ui-space-1); }
.pp-tpl-cat   { font-size: var(--ui-text-xs); font-weight: var(--ui-font-semibold); text-transform: uppercase; letter-spacing: .04em; color: var(--ui-fg-muted); margin-top: var(--ui-space-2); }
.pp-tpl-tile  { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--ui-bg-elev); border: 1px solid var(--ui-border); border-radius: var(--ui-radius-md); cursor: pointer; text-align: left; font: inherit; color: var(--ui-fg, inherit); transition: background var(--ui-transition-fast), border-color var(--ui-transition-fast); }
.pp-tpl-tile:hover { background: var(--ui-bg-muted); border-color: var(--ui-primary); }
.pp-tpl-tile-compact { padding: 9px 11px; font-size: var(--ui-text-sm); gap: 10px; }
.pp-tpl-ic    { color: var(--ui-primary); width: 24px; text-align: center; font-size: 1.3rem; flex: 0 0 auto; }
.pp-tpl-tile-compact .pp-tpl-ic { width: 18px; font-size: 1rem; }
.pp-tpl-label { font-weight: var(--ui-font-semibold); }
.pp-tpl-desc  { font-size: var(--ui-text-xs); color: var(--ui-fg-muted); margin-top: 2px; }

/* Editor form fields (DC1): a monospace code textarea + a dashed note box —
   tokens only, no call-site style. */
.pp-editor-code { font-family: var(--ui-font-mono); line-height: 1.5; resize: vertical; }
.pp-editor-note { background: var(--ui-bg-muted); border: 1px dashed var(--ui-border); border-radius: var(--ui-radius-md); padding: 8px; line-height: 1.4; }

/* Share modal access-rule row (DC1): a hairline bordered row, tokens only. */
.pp-share-rule { border: 1px solid var(--ui-border); border-radius: var(--ui-radius-md); padding: 6px 10px; }

/* Editor stage body + status toast (DC1): tokens only, no inline style. */
.pp-editor-stage-body { flex: 1; min-height: 0; overflow: auto; padding: 18px; background: var(--ui-bg-elev); }
.pp-editor-host-rel { position: relative; }
.pp-editor-toast { position: absolute; top: 62px; right: 24px; z-index: 10; padding: 8px 14px; border-radius: var(--ui-radius-md); font-size: var(--ui-text-sm); box-shadow: var(--ui-shadow-sm); display: flex; gap: 8px; align-items: center; }
.pp-editor-toast-success { background: var(--ui-success-100); color: var(--ui-success); }
.pp-editor-toast-warn    { background: var(--ui-warn-100);    color: var(--ui-warn); }
.pp-editor-toast-error   { background: var(--ui-danger-100);  color: var(--ui-danger); }

/* ─────────────────────────────────────────────────────────────────────────
   Create tab (class.PublonPressCreate.js) — a calm two-pane composer.
   Left: inline-editable block canvas. Right: live reader preview.
   ───────────────────────────────────────────────────────────────────────── */
.ppc-root { display:flex; flex-direction:column; flex:1; min-height:0; background:var(--ui-bg-sunken,#f4f6f9); }

/* top bar */
.ppc-top { display:flex; align-items:center; gap:16px; padding:14px 20px;
    background:var(--ui-bg-elev,#fff); border-bottom:1px solid var(--ui-border,#e7e9ee); }
.ppc-top-lead { display:flex; align-items:center; gap:14px; flex:1; min-width:0; }
.ppc-top-mark { font-size:1.15rem; color:var(--wbk-accent); opacity:.9; }
.ppc-top-titles { display:flex; flex-direction:column; gap:1px; flex:1; min-width:0; }
.ppc-title-input { border:0; background:transparent; font-size:1.35rem; font-weight:700;
    color:var(--wbk-text); padding:2px 0; outline:none; letter-spacing:-0.01em; }
.ppc-title-input::placeholder { color:#c2c7d0; font-weight:600; }
.ppc-sub-input { border:0; background:transparent; font-size:0.9rem; color:var(--wbk-muted);
    padding:1px 0; outline:none; }
.ppc-sub-input::placeholder { color:#cbd0d8; }
.ppc-top-actions { display:flex; align-items:center; gap:8px; }
.ppc-saved-note { font-size:0.76rem; color:#9aa1ac; margin-right:6px; transition:color .2s; white-space:nowrap; }
.ppc-saved-flash { color:var(--wbk-accent); font-weight:600; }
.ppc-btn { display:inline-flex; align-items:center; gap:7px; border-radius:var(--ui-radius-md,8px);
    font-size:0.84rem; font-weight:600; padding:8px 14px; cursor:pointer; border:1px solid transparent;
    transition:all .15s; white-space:nowrap; }
.ppc-btn i { font-size:0.82rem; }
.ppc-btn-ghost { background:transparent; color:var(--wbk-muted); border-color:var(--ui-border,#e0e3e9); }
.ppc-btn-ghost:hover { background:var(--ui-bg-muted,#f5f6f8); color:var(--wbk-text); }
.ppc-btn-primary { background:var(--wbk-accent); color:#fff; box-shadow:0 1px 2px rgba(23,109,207,.25); }
.ppc-btn-primary:hover { filter:brightness(1.06); box-shadow:0 3px 10px rgba(23,109,207,.3); transform:translateY(-1px); }

/* split */
.ppc-split { display:flex; flex:1; min-height:0; }
.ppc-compose { flex:0 0 48%; max-width:48%; overflow-y:auto; padding:22px 26px 120px;
    display:flex; flex-direction:column; }
.ppc-preview-wrap { flex:1; min-width:0; overflow-y:auto; background:var(--ui-bg-sunken,#eef1f5);
    padding:28px 26px 80px; border-left:1px solid var(--ui-border,#e7e9ee); }
.ppc-preview-page { background:#fff; max-width:var(--wbk-page-max,760px); margin:0 auto;
    border-radius:12px; box-shadow:0 1px 3px rgba(20,30,50,.06), 0 8px 30px rgba(20,30,50,.06);
    padding:38px 44px 48px; min-height:200px; }

/* block card */
.ppc-block { background:var(--ui-bg-elev,#fff); border:1px solid var(--ui-border,#e7e9ee);
    border-radius:12px; margin:0; box-shadow:0 1px 2px rgba(20,30,50,.03); transition:border-color .15s, box-shadow .15s; }
.ppc-block:hover { border-color:#d3d9e2; box-shadow:0 2px 8px rgba(20,30,50,.06); }
.ppc-block:focus-within { border-color:var(--wbk-accent); box-shadow:0 0 0 3px var(--wbk-accent-bg,rgba(23,109,207,.12)); }
.ppc-block-head { display:flex; align-items:center; justify-content:space-between; padding:8px 12px 4px; }
.ppc-block-kind { display:inline-flex; align-items:center; gap:7px; font-size:0.72rem; font-weight:700;
    text-transform:uppercase; letter-spacing:0.04em; color:#9aa1ac; }
.ppc-block-kind i { color:var(--wbk-accent); opacity:.75; font-size:0.78rem; }
.ppc-block-ctrls { display:flex; gap:2px; opacity:0; transition:opacity .15s; }
.ppc-block:hover .ppc-block-ctrls, .ppc-block:focus-within .ppc-block-ctrls { opacity:1; }
.ppc-icon-btn { border:0; background:transparent; color:#aab0ba; cursor:pointer; width:26px; height:26px;
    border-radius:6px; font-size:0.78rem; transition:all .12s; }
.ppc-icon-btn:hover:not(:disabled) { background:var(--ui-bg-muted,#f0f2f5); color:var(--wbk-text); }
.ppc-icon-btn:disabled { opacity:.3; cursor:default; }
.ppc-block-body { padding:0 12px 12px; }

/* editors */
.ppc-ta, .ppc-line { width:100%; box-sizing:border-box; border:1px solid transparent; border-radius:8px;
    font:inherit; font-size:0.95rem; color:var(--wbk-text); background:transparent; padding:8px 10px;
    outline:none; resize:none; line-height:1.55; transition:background .12s; }
.ppc-ta:hover, .ppc-line:hover { background:var(--ui-bg-muted,#f7f8fa); }
.ppc-ta:focus, .ppc-line:focus { background:var(--ui-bg-muted,#f5f7fa); }
.ppc-ta::placeholder, .ppc-line::placeholder { color:#b7bdc7; }
.ppc-mono { font-family:"SF Mono",ui-monospace,Menlo,Consolas,monospace; font-size:0.88rem; }
.ppc-line-sub { font-size:0.86rem; }
.ppc-field-col { display:flex; flex-direction:column; gap:6px; }
.ppc-field-label { font-size:0.7rem; font-weight:700; text-transform:uppercase; letter-spacing:0.04em;
    color:#aab0ba; padding:4px 2px 0; }
.ppc-tone-row { display:flex; gap:6px; padding:2px 2px 4px; }
.ppc-tone { border:1px solid var(--ui-border,#e0e3e9); background:#fff; border-radius:20px; font-size:0.76rem;
    font-weight:600; color:var(--wbk-muted); padding:4px 12px; cursor:pointer; transition:all .12s; }
.ppc-tone.on { background:var(--wbk-accent); border-color:var(--wbk-accent); color:#fff; }

/* quiz choices */
.ppc-choices { display:flex; flex-direction:column; gap:5px; }
.ppc-choice { display:flex; align-items:center; gap:6px; }
.ppc-choice-mark { border:0; background:transparent; cursor:pointer; color:#c2c7d0; font-size:1rem; padding:4px; }
.ppc-choice-mark.on { color:var(--wbk-accent); }
.ppc-add-choice { align-self:flex-start; border:0; background:transparent; color:var(--wbk-accent);
    font-size:0.82rem; font-weight:600; cursor:pointer; padding:4px 2px; }
.ppc-add-choice:hover { text-decoration:underline; }

/* add-block row */
.ppc-add-row { display:flex; justify-content:center; padding:6px 0; position:relative; }
.ppc-add-row::before { content:''; position:absolute; top:50%; left:0; right:0; height:1px;
    background:linear-gradient(90deg,transparent,var(--ui-border,#e3e6ec),transparent); opacity:0; transition:opacity .15s; }
.ppc-add-row:hover::before { opacity:1; }
.ppc-add { display:inline-flex; align-items:center; gap:6px; border:1px solid var(--ui-border,#e3e6ec);
    background:var(--ui-bg-elev,#fff); color:#aab0ba; border-radius:20px; font-size:0.78rem; font-weight:600;
    padding:5px 14px; cursor:pointer; z-index:1; transition:all .14s; }
.ppc-add:hover { color:var(--wbk-accent); border-color:var(--wbk-accent); box-shadow:0 2px 8px rgba(23,109,207,.15); }

/* palette popover */
.ppc-palette { position:fixed; z-index:1000; width:300px; max-height:70vh; overflow-y:auto;
    background:#fff; border:1px solid var(--ui-border,#e3e6ec); border-radius:14px;
    box-shadow:0 12px 40px rgba(20,30,50,.16); padding:6px; }
.ppc-palette-item { display:flex; align-items:flex-start; gap:11px; width:100%; text-align:left; border:0;
    background:transparent; border-radius:9px; padding:10px 11px; cursor:pointer; transition:background .1s; }
.ppc-palette-item:hover { background:var(--wbk-accent-bg,#eaf2fd); }
.ppc-palette-item > i { color:var(--wbk-accent); font-size:0.95rem; width:20px; text-align:center; margin-top:2px; }
.ppc-palette-name { font-size:0.9rem; font-weight:600; color:var(--wbk-text); }
.ppc-palette-hint { font-size:0.76rem; color:var(--wbk-muted); line-height:1.35; margin-top:1px; }

/* empty state */
.ppc-empty { display:flex; flex-direction:column; align-items:center; text-align:center; padding:56px 20px 20px; margin:auto 0; }
.ppc-empty-mark { width:64px; height:64px; border-radius:18px; display:flex; align-items:center; justify-content:center;
    background:var(--wbk-accent-bg,#eaf2fd); color:var(--wbk-accent); font-size:1.6rem; margin-bottom:18px; }
.ppc-empty-title { font-size:1.5rem; font-weight:700; color:var(--wbk-text); letter-spacing:-0.01em; }
.ppc-empty-sub { font-size:0.92rem; color:var(--wbk-muted); max-width:380px; margin:8px 0 26px; line-height:1.55; }
.ppc-starter-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; width:100%; max-width:420px; }
.ppc-starter { display:flex; flex-direction:column; align-items:flex-start; gap:3px; text-align:left;
    border:1px solid var(--ui-border,#e3e6ec); background:var(--ui-bg-elev,#fff); border-radius:12px;
    padding:16px 16px 14px; cursor:pointer; transition:all .15s; }
.ppc-starter:hover { border-color:var(--wbk-accent); box-shadow:0 4px 14px rgba(23,109,207,.12); transform:translateY(-2px); }
.ppc-starter > i { color:var(--wbk-accent); font-size:1.15rem; margin-bottom:8px; }
.ppc-starter-name { font-size:0.95rem; font-weight:600; color:var(--wbk-text); }
.ppc-starter-sub { font-size:0.78rem; color:var(--wbk-muted); }

/* preview empty */
.ppc-preview-empty { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px;
    color:#b7bdc7; text-align:center; padding:60px 20px; font-size:0.92rem; }
.ppc-preview-empty i { font-size:2rem; opacity:.6; }

/* full-preview overlay */
.ppc-overlay { position:fixed; inset:0; z-index:2000; background:rgba(20,28,44,.5); backdrop-filter:blur(3px);
    display:flex; justify-content:center; overflow-y:auto; padding:40px 20px; }
.ppc-overlay-sheet { position:relative; width:100%; max-width:820px; margin:auto 0; }
.ppc-overlay-close { position:absolute; top:-8px; right:0; z-index:1; background:#fff !important; }
.ppc-overlay-page { margin-top:36px; }

@media (max-width:900px) {
    .ppc-split { flex-direction:column; }
    .ppc-compose { flex:none; max-width:100%; }
    .ppc-preview-wrap { border-left:0; border-top:1px solid var(--ui-border,#e7e9ee); }
}

/* ── Collections curator (.ppcol-*) — three-pane visual curator ───────────── */
.ppcol-root { flex:1; min-height:0; display:flex; flex-direction:column; background:var(--ui-bg-sunken,#eef1f5); }
.ppcol-top { display:flex; align-items:center; gap:16px; padding:14px 20px; background:var(--ui-bg-elev,#fff); border-bottom:1px solid var(--ui-border,#e7e9ee); flex:none; }
.ppcol-top-titles { display:flex; flex-direction:column; gap:3px; flex:1; min-width:0; }
.ppcol-title-input { font-size:1.15rem; font-weight:700; border:0; outline:0; background:transparent; color:var(--ui-text,#1a2130); padding:0; }
.ppcol-title-input::placeholder { color:var(--ui-gray-300,#c3cad6); }
.ppcol-sub-input { font-size:0.86rem; border:0; outline:0; background:transparent; color:var(--ui-text-muted,#6b7688); padding:0; }
.ppcol-top-actions { display:flex; align-items:center; gap:8px; flex:none; }
.ppcol-saved-note { font-size:0.76rem; color:var(--ui-text-muted,#8a94a6); margin-right:6px; white-space:nowrap; }
.ppcol-btn { display:inline-flex; align-items:center; gap:7px; padding:8px 14px; border-radius:var(--ui-radius-lg,8px); font-size:0.85rem; font-weight:600; border:1px solid var(--ui-border,#e7e9ee); background:#fff; color:var(--ui-text,#26303f); cursor:pointer; transition:background 100ms, border-color 100ms, transform 100ms; }
.ppcol-btn:hover { transform:translateY(-1px); }
.ppcol-btn-ghost:hover { border-color:#176DCF; color:#176DCF; }
.ppcol-btn-primary { background:#176DCF; border-color:#176DCF; color:#fff; }
.ppcol-btn-primary:hover { background:#1560b8; }

.ppcol-body { flex:1; min-height:0; display:flex; }
.ppcol-pane { display:flex; flex-direction:column; min-width:0; min-height:0; border-right:1px solid var(--ui-border,#e7e9ee); }
.ppcol-browse { flex:0 0 27%; }
.ppcol-build  { flex:0 0 31%; background:var(--ui-bg,#fbfcfe); }
.ppcol-preview-wrap { flex:1; border-right:0; }
.ppcol-pane-head { padding:12px 16px 10px; border-bottom:1px solid var(--ui-border,#eef1f5); flex:none; background:#fff; }
.ppcol-pane-title { font-size:0.9rem; font-weight:700; color:var(--ui-text,#26303f); }
.ppcol-pane-hint { font-size:0.72rem; color:var(--ui-text-muted,#8a94a6); margin-top:2px; }
.ppcol-scroll { flex:1; min-height:0; overflow-y:auto; padding:10px 12px; }
.ppcol-empty-note, .ppcol-loading-note { font-size:0.82rem; color:var(--ui-text-muted,#8a94a6); padding:12px 6px; }

/* browse rows */
.ppcol-brow-book { margin-bottom:2px; }
.ppcol-brow-row { display:flex; align-items:center; gap:4px; padding:4px 4px; border-radius:6px; }
.ppcol-brow-row:hover { background:var(--ui-bg-sunken,#f0f3f8); }
.ppcol-brow-row-sub { padding-left:10px; }
.ppcol-brow-row-sec { padding-left:26px; }
.ppcol-caret { border:0; background:transparent; color:var(--ui-text-muted,#9aa4b4); cursor:pointer; width:20px; flex:none; font-size:0.7rem; padding:2px; }
.ppcol-brow-label { flex:1; min-width:0; display:flex; align-items:baseline; gap:8px; border:0; background:transparent; text-align:left; cursor:pointer; padding:2px 0; color:var(--ui-text,#28313f); }
.ppcol-brow-title { font-size:0.83rem; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ppcol-brow-meta { font-size:0.68rem; color:var(--ui-text-muted,#9aa4b4); flex:none; }
.ppcol-brow-sectitle { flex:1; min-width:0; font-size:0.78rem; color:var(--ui-text-muted,#66707f); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ppcol-add-btn { flex:none; display:inline-flex; align-items:center; gap:4px; padding:2px 8px; font-size:0.7rem; font-weight:600; color:#176DCF; background:#eef5fd; border:1px solid #d6e6f8; border-radius:999px; cursor:pointer; opacity:0; transition:opacity 100ms; }
.ppcol-brow-row:hover .ppcol-add-btn { opacity:1; }
.ppcol-add-btn:hover { background:#176DCF; color:#fff; }
.ppcol-add-sec { padding:2px 6px; }
.ppcol-brow-kids, .ppcol-brow-sections { border-left:2px solid var(--ui-border,#eef1f5); margin-left:9px; }

/* build (collection) items */
.ppcol-addnote { width:100%; justify-content:center; margin-bottom:10px; }
.ppcol-build-empty { text-align:center; padding:34px 18px; color:var(--ui-text-muted,#8a94a6); }
.ppcol-build-empty i { font-size:1.8rem; opacity:.5; }
.ppcol-build-empty-title { font-weight:700; color:var(--ui-text,#3a4353); margin-top:10px; }
.ppcol-build-empty-sub { font-size:0.82rem; margin-top:5px; line-height:1.5; }
.ppcol-item { display:flex; gap:9px; padding:9px 10px; background:#fff; border:1px solid var(--ui-border,#e7e9ee); border-radius:var(--ui-radius-lg,8px); margin-bottom:7px; }
.ppcol-item-note { background:#fffdf5; border-color:#f0e6c8; }
.ppcol-item-num { flex:none; width:20px; height:20px; border-radius:999px; background:var(--ui-bg-sunken,#eef1f5); color:var(--ui-text-muted,#6b7688); font-size:0.7rem; font-weight:700; display:flex; align-items:center; justify-content:center; }
.ppcol-item-main { flex:1; min-width:0; }
.ppcol-item-kind { display:inline-block; font-size:0.62rem; letter-spacing:0.06em; text-transform:uppercase; font-weight:700; color:#176DCF; background:#eef5fd; padding:1px 6px; border-radius:4px; }
.ppcol-item-text { font-size:0.86rem; font-weight:600; color:var(--ui-text,#28313f); margin-top:3px; line-height:1.25; }
.ppcol-item-src { font-size:0.72rem; color:var(--ui-text-muted,#9aa4b4); margin-top:2px; }
.ppcol-note-title { width:100%; margin-top:6px; padding:5px 8px; font-size:0.82rem; font-weight:600; border:1px solid var(--ui-border,#e7e9ee); border-radius:6px; outline:0; }
.ppcol-note-ta { width:100%; margin-top:5px; min-height:52px; padding:6px 8px; font-size:0.82rem; font-family:inherit; border:1px solid var(--ui-border,#e7e9ee); border-radius:6px; outline:0; resize:vertical; }
.ppcol-item-ctrls { flex:none; display:flex; flex-direction:column; gap:3px; }
.ppcol-icon-btn { border:0; background:transparent; color:var(--ui-text-muted,#9aa4b4); cursor:pointer; padding:3px 5px; border-radius:5px; font-size:0.78rem; }
.ppcol-icon-btn:hover { background:var(--ui-bg-sunken,#eef1f5); color:#176DCF; }

/* preview */
.ppcol-preview-scroll { padding:20px 18px 60px; background:var(--ui-bg-sunken,#eef1f5); }
.ppcol-preview-page { background:#fff; max-width:var(--wbk-page-max,760px); margin:0 auto; border-radius:12px; box-shadow:0 1px 3px rgba(20,30,50,.06), 0 8px 30px rgba(20,30,50,.06); padding:8px 0; min-height:200px; }
.ppcol-preview-empty { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; color:#b7bdc7; text-align:center; padding:60px 20px; font-size:0.92rem; }
.ppcol-preview-empty i { font-size:2rem; opacity:.6; }
.ppcol-json-dump { width:100%; min-height:420px; font-family:monospace; font-size:0.74rem; border:0; outline:0; padding:14px; resize:vertical; }

@media (max-width:1100px) {
    .ppcol-body { flex-direction:column; overflow-y:auto; }
    .ppcol-pane { flex:none !important; border-right:0; border-bottom:1px solid var(--ui-border,#e7e9ee); }
    .ppcol-scroll { max-height:340px; }
}

/* ── Collection detail landing card (Library) ─────────────────────────────── */
.pp-col-head { display:flex; align-items:flex-start; gap:16px; margin-bottom:18px; }
.pp-col-icon { font-size:2.4rem; color:#176DCF; margin-top:4px; }
.pp-col-badge { font-size:0.64rem; letter-spacing:0.1em; font-weight:700; color:#176DCF; }
.pp-col-title { font-size:1.5rem; font-weight:700; color:var(--ui-text,#1a2130); line-height:1.2; margin-top:2px; }
.pp-col-sub { font-size:0.95rem; color:var(--ui-text-muted,#6b7688); margin-top:4px; }
.pp-col-author { font-size:0.82rem; color:var(--ui-text-muted,#9aa4b4); margin-top:4px; }
.pp-col-open { display:inline-flex; align-items:center; gap:9px; padding:11px 20px; background:#176DCF; color:#fff; font-weight:600; font-size:0.95rem; border-radius:var(--ui-radius-lg,8px); text-decoration:none; box-shadow:0 2px 10px rgba(21,101,192,.28); transition:background 120ms, transform 120ms; }
.pp-col-open:hover { background:#1560b8; transform:translateY(-1px); }
.pp-col-contents-h { margin:22px 0 8px; font-size:0.78rem; font-weight:600; letter-spacing:0.04em; text-transform:uppercase; color:var(--ui-text-muted,#8a94a6); }
.pp-col-list { list-style:none; padding:0; margin:0; }
.pp-col-item { display:flex; align-items:center; gap:10px; padding:8px 12px; border:1px solid var(--ui-border,#e7e9ee); border-radius:8px; margin-bottom:6px; font-size:0.88rem; background:#fff; }
.pp-col-note { background:#fffdf5; border-color:#f0e6c8; color:var(--ui-text-muted,#66707f); }
.pp-col-note i { color:#c79a2b; }
.pp-col-kind { font-size:0.62rem; letter-spacing:0.05em; text-transform:uppercase; font-weight:700; color:#176DCF; background:#eef5fd; padding:2px 8px; border-radius:4px; }
.pp-col-src { color:var(--ui-text-muted,#8a94a6); font-size:0.82rem; }
.pp-tier-item:hover { background:var(--ui-bg-sunken,#f0f3f8); }

/* Featured-series band — flagship collections at the top of the control column. */
.pp-series-band { display:flex; flex-direction:column; gap:8px; padding:14px 12px 16px; border-bottom:1px solid var(--ui-gray-200,#e5e7eb); background:linear-gradient(180deg,#f7f9fc 0%,#fff 100%); }
.pp-series-band-head { display:flex; align-items:center; gap:7px; font-size:0.66rem; font-weight:700; letter-spacing:0.12em; text-transform:uppercase; color:var(--ui-text-muted,#8a94a6); }
.pp-series-band-head i { color:#C79A44; }
.pp-series-card { display:flex; align-items:center; gap:11px; padding:11px 12px; background:#fff; border:1px solid var(--ui-border,#e7e9ee); border-left:4px solid #176DCF; border-radius:var(--ui-radius-lg,8px); text-decoration:none; color:inherit; box-shadow:var(--ui-shadow-sm,0 1px 2px rgba(16,24,40,.06)); transition:box-shadow 130ms, transform 130ms, border-color 130ms; }
.pp-series-card:hover { box-shadow:0 8px 20px rgba(23,45,86,.14); transform:translateY(-2px); border-left-color:#0f4fa3; }
.pp-series-card:nth-of-type(2) { border-left-color:#8a4bbf; }
.pp-series-card:nth-of-type(3) { border-left-color:#0d9488; }
.pp-series-card-icon { flex:0 0 auto; width:36px; height:36px; display:inline-flex; align-items:center; justify-content:center; border-radius:var(--ui-radius-lg,8px); background:#eef5fd; color:#176DCF; font-size:1rem; }
.pp-series-card:nth-of-type(2) .pp-series-card-icon { background:#f4ecfa; color:#8a4bbf; }
.pp-series-card:nth-of-type(3) .pp-series-card-icon { background:#e6f6f4; color:#0d9488; }
.pp-series-card-body { display:flex; flex-direction:column; gap:2px; min-width:0; flex:1; }
.pp-series-card-title { font-weight:600; font-size:0.9rem; line-height:1.25; color:var(--ui-text,#1a2333); }
.pp-series-card-sub { font-size:0.74rem; line-height:1.35; color:var(--ui-text-muted,#8a94a6); overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.pp-series-card-meta { display:inline-flex; align-items:center; gap:5px; margin-top:3px; font-size:0.7rem; font-weight:600; color:#176DCF; }
.pp-series-card:nth-of-type(2) .pp-series-card-meta { color:#8a4bbf; }
.pp-series-card:nth-of-type(3) .pp-series-card-meta { color:#0d9488; }
.pp-series-card-go { flex:0 0 auto; color:var(--ui-text-muted,#b3bccb); font-size:0.8rem; transition:transform 130ms; }
.pp-series-card:hover .pp-series-card-go { transform:translateX(3px); }
