:root {
  --ink: #1f2328;
  --muted: #5d6670;
  --line: #d9dde2;
  --bg: #f3f4f6;
  --paper: #ffffff;
  --bar: #2b2d31;
  --accent: #d62828;
  --accent-soft: #fdecec;
  --purple: #5b2a86;
  --purple-soft: #f1eaf8;
  --blue: #0b6bcb;
  --blue-soft: #e8f2fc;
  --green: #2e7d32;
  --green-soft: #eaf5eb;
  --orange: #c4560f;
  --orange-soft: #fdf0e6;
  --mark: #fff176;
  --radius: 10px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }

/* ---------- App shell ---------- */
:root {
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --violet: #7c3aed;
  --g50: #f8fafc; --g100: #f1f5f9; --g200: #e2e8f0; --g300: #cbd5e1; --g400: #94a3b8;
  --g500: #64748b; --g600: #475569; --g700: #334155; --g800: #1e293b; --g900: #0f172a;
  --danger: #dc2626; --danger-50: #fef2f2;
  --app-bg: #fafafb;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 3px rgba(15, 23, 42, .05), 0 10px 30px -10px rgba(15, 23, 42, .12);
  --shadow-lg: 0 2px 6px rgba(15, 23, 42, .04), 0 30px 60px -20px rgba(49, 46, 129, .28);
  --ring: 0 0 0 4px rgba(99, 102, 241, .16);
  --serif: "Instrument Serif", Georgia, serif;
}
body { background: var(--app-bg); font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; color: var(--g900); -webkit-font-smoothing: antialiased; min-height: 100vh; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
main { position: relative; z-index: 1; }

/* ambient background (home only) */
.bg-glow { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0; transition: opacity .4s; }
body.is-home .bg-glow { opacity: 1; }
.bg-glow::before { content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(900px 520px at 50% -8%, rgba(99, 102, 241, .20), transparent 62%),
    radial-gradient(620px 420px at 88% 6%, rgba(251, 191, 36, .14), transparent 60%),
    radial-gradient(620px 420px at 8% 18%, rgba(236, 72, 153, .10), transparent 60%); }
.bg-glow::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(15, 23, 42, .07) 1px, transparent 1px); background-size: 22px 22px; -webkit-mask-image: linear-gradient(#000, transparent 70%); mask-image: linear-gradient(#000, transparent 70%); }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; height: 64px; padding: 0 28px; background: rgba(250, 250, 251, .72); backdrop-filter: saturate(1.8) blur(14px); -webkit-backdrop-filter: saturate(1.8) blur(14px); border-bottom: 1px solid transparent; transition: border-color .2s; }
body.is-workspace .topbar { border-bottom-color: var(--g200); background: rgba(255, 255, 255, .8); }
/* the blur behind the two sticky bars is re-computed on every scroll frame over a large page: on many GPUs that makes scrolling stutter.
   In the workspace they are almost opaque anyway, so use a plain background there. */
body.is-workspace .topbar { background: rgba(255, 255, 255, .97); backdrop-filter: none; -webkit-backdrop-filter: none; }
body.is-workspace .toolbar { background: rgba(250, 250, 251, .97); backdrop-filter: none; -webkit-backdrop-filter: none; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--g900); }
.logo { width: 30px; height: 30px; object-fit: contain; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.brand-name b { color: var(--brand); }
@media (max-width: 560px) { body.is-workspace .brand-name b { display: none; } .brand-name { font-size: 15.5px; } }
.topbar-right { display: flex; align-items: center; gap: 10px; }
body:not(.is-workspace) .only-workspace { display: none; }
.terms-check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 14px; text-align: left; font-size: 13.5px; line-height: 1.5; color: var(--g700); cursor: pointer; }
.terms-check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); flex: none; }
.terms-check a { color: var(--brand-600); font-weight: 600; }
.terms-check.nudge { animation: nudge .5s ease; }
@keyframes nudge { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 60% { transform: translateX(6px); } }
.gsi-slot.locked { position: relative; opacity: .5; }
.gsi-slot.locked::after { content: ""; position: absolute; inset: 0; cursor: not-allowed; }
.send-note { margin: 8px 2px 0; font-size: 12.5px; color: var(--g500); }
.send-note a { color: var(--brand-600); }
.site-foot { display: flex; justify-content: center; gap: 10px; padding: 18px 16px 28px; font-size: 13px; color: var(--g400); }
.site-foot a { color: var(--g500); text-decoration: none; }
.site-foot a:hover { color: var(--g900); text-decoration: underline; }
body.is-workspace .site-foot { display: none; }
.signin .fine a { color: var(--brand-600); }
.lang-select { height: 34px; padding: 0 28px 0 12px; border: 1px solid var(--g200); border-radius: 999px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center / 12px; color: var(--g700); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; appearance: none; -webkit-appearance: none; box-shadow: var(--shadow-sm); }
.lang-select:hover { border-color: var(--g300); color: var(--g900); }
.lang-select:focus-visible { outline: none; box-shadow: var(--ring); }
.publisher { display: flex; align-items: center; height: 64px; padding-left: 14px; margin-left: 4px; border-left: 1px solid var(--g200); }
.publisher img { display: block; height: 50px; width: auto; }
body.is-home .publisher { border-left: 0; }
@media (max-width: 560px) { .publisher { padding-left: 8px; } .publisher img { height: 40px; } }
.status { font-size: 12.5px; font-weight: 500; padding: 5px 10px; border-radius: 999px; background: var(--danger-50); color: var(--danger); border: 1px solid #fecaca; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-size: 14px; font-weight: 600; border-radius: 12px; padding: 10px 16px; border: 1px solid transparent; background: none; color: var(--g700); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, color .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-sm { padding: 8px 12px; font-size: 13.5px; border-radius: 10px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-primary { color: #fff; background: linear-gradient(180deg, #5b54ee, var(--brand-600)); box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 8px 20px -6px rgba(79, 70, 229, .55); }
.btn-primary:hover { background: linear-gradient(180deg, #5149e6, #3b32c0); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-primary.loading .ic { display: none; }
.btn-primary.loading::before { content: ""; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.btn-dark { background: var(--g900); color: #fff; }
.btn-dark:hover { background: var(--g800); }
.btn-soft { background: var(--g100); color: var(--g700); }
.btn-soft:hover { background: var(--g200); color: var(--g900); }
.btn-link { color: var(--brand); padding: 6px 4px; }
.btn-link:hover { color: var(--brand-600); }
.btn-link .ic { width: 16px; height: 16px; transition: transform .15s; }
.btn-link:hover .ic { transform: translateX(3px); }

/* ================= HOME ================= */
.home { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 48px; align-items: start; max-width: 1360px; min-height: calc(100vh - 64px); margin: 0 auto; padding: clamp(28px, 9vh, 112px) 40px 40px; }
.home-main { min-width: 0; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.75); border: 1px solid var(--g200); box-shadow: var(--shadow-sm); font-size: 13px; font-weight: 600; color: var(--brand); }
.eyebrow .ic { width: 15px; height: 15px; }
.home-main h1 { margin: 18px 0 14px; font-size: clamp(34px, 4.1vw, 56px); line-height: 1.06; font-weight: 800; letter-spacing: -.035em; color: var(--g900); text-wrap: balance; }
.home-main h1 em { font-family: "Caveat", cursive; font-style: normal; font-weight: 700; font-size: 1.22em; line-height: .9; letter-spacing: 0; color: #1a2e05; padding: 0 .12em; margin: 0 -.04em; background: linear-gradient(transparent 52%, #bef264 52%, #bef264 90%, transparent 90%); -webkit-box-decoration-break: clone; box-decoration-break: clone; white-space: nowrap; }
.lead b { color: var(--g800); font-weight: 600; }
.lead { max-width: 580px; margin: 0 0 24px; font-size: clamp(15px, 1.25vw, 17px); line-height: 1.6; color: var(--g500); }

/* composer */
.composer { position: relative; padding: 12px 12px 10px; background: #fff; border: 1px solid rgba(15, 23, 42, .08); border-radius: 22px; box-shadow: var(--shadow-lg); transition: box-shadow .2s, border-color .2s; }
.composer:focus-within { border-color: rgba(99, 102, 241, .45); box-shadow: var(--shadow-lg), var(--ring); }
.composer textarea#text-input { width: 100%; min-height: 86px; max-height: 300px; padding: 8px 10px 4px; border: 0; outline: none; resize: vertical; font: inherit; font-size: 16px; line-height: 1.55; color: var(--g900); background: transparent; box-shadow: none; }
.composer textarea#text-input::placeholder { color: var(--g400); }
.drop-overlay { position: absolute; inset: 6px; z-index: 5; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 2px dashed var(--brand); border-radius: 18px; background: rgba(238, 242, 255, .94); color: var(--brand); font-weight: 600; font-size: 15px; }
.drop-overlay .ic { width: 28px; height: 28px; }
.composer.over .drop-overlay { display: flex; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0 4px; }
.chips:not(:empty) { padding-bottom: 6px; }
.chip { display: flex; align-items: center; gap: 10px; max-width: 280px; padding: 7px 8px; border: 1px solid var(--g200); border-radius: 12px; background: var(--g50); font-size: 13px; animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.file-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #fee2e2; color: #dc2626; flex: none; }
.file-ic.img { background: #d1fae5; color: #059669; }
.file-ic.ppt { background: #ffedd5; color: #ea580c; }
.file-ic .ic { width: 16px; height: 16px; }
.file-meta { min-width: 0; flex: 1; line-height: 1.25; }
.file-meta b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta small { color: var(--g500); }
.chip button { display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 6px; background: none; color: var(--g400); cursor: pointer; }
.chip button .ic { width: 15px; height: 15px; }
.chip button:hover { background: var(--g200); color: var(--g800); }

.composer-bar { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--g100); }
.attach { cursor: pointer; }
.mode-switch { display: flex; padding: 3px; gap: 2px; background: var(--g100); border-radius: 11px; }
.mode-switch label { position: relative; cursor: pointer; }
.mode-switch input { position: absolute; opacity: 0; pointer-events: none; }
.mode-switch label:has(input[value="rapido"]) { --mk: #fde047; }
.mode-switch label:has(input[value="padrao"]) { --mk: #bef264; }
.mode-switch label:has(input[value="completo"]) { --mk: #f9a8d4; }
.mode-switch span { position: relative; z-index: 0; display: block; padding: 6px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--g500); transition: color .15s; }
.mode-switch span::before { content: ""; position: absolute; z-index: -1; inset: 14% -2px 6% -2px; background: var(--mk); border-radius: 3px 10px 4px 12px; transform: rotate(-4deg) skewX(-12deg) scaleX(.2); opacity: 0; transform-origin: left center; transition: transform .28s cubic-bezier(.3,1.4,.5,1), opacity .2s; }
.mode-switch label:hover span { color: var(--g900); }
.mode-switch label:hover span::before { opacity: .4; transform: rotate(-4deg) skewX(-12deg) scaleX(1); }
.mode-switch input:checked + span { color: #1a2e05; }
.mode-switch input:checked + span::before { opacity: 1; transform: rotate(-4deg) skewX(-12deg) scaleX(1); }
.mode-switch input:checked + span { font-weight: 700; }
.mode-switch input:focus-visible + span { box-shadow: var(--ring); }
.mode-switch input:disabled + span { opacity: .4; cursor: not-allowed; }
#btn-generate { margin-left: auto; padding: 10px 16px; border-radius: 13px; font-size: 15px; }
#btn-generate .ic { width: 17px; height: 17px; }
#btn-generate { flex: none; }
.gen-cost { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .22); letter-spacing: .2px; }
.gen-cost[hidden] { display: none; }
.popover > summary span { display: none; }  /* Settings shows as an icon (title + aria-label "Settings") */
.composer-bar { min-width: 0; }
.mode-hint { margin: 14px 0 0; padding: 11px 14px; min-height: 20px; font-size: 14.5px; line-height: 1.55; color: var(--g700); background: rgba(255, 255, 255, .8); border: 1px solid var(--g200); border-radius: 12px; }
.mode-hint { display: grid; }
.mode-hint .mh { grid-area: 1 / 1; visibility: hidden; }
.mode-hint[data-mode="rapido"] .mh[data-m="rapido"], .mode-hint[data-mode="padrao"] .mh[data-m="padrao"], .mode-hint[data-mode="completo"] .mh[data-m="completo"] { visibility: visible; }
.mode-hint b { color: var(--g900); font-weight: 700; }

/* settings popover */
.popover { position: relative; }
.popover > summary { list-style: none; }
.popover > summary::-webkit-details-marker { display: none; }
.popover[open] > summary { background: var(--g200); color: var(--g900); }
.popover-panel { position: absolute; left: 0; top: calc(100% + 10px); z-index: 20; width: 340px; padding: 16px; background: #fff; border: 1px solid var(--g200); border-radius: 16px; box-shadow: 0 20px 50px -12px rgba(15,23,42,.25); }
.popover.up .popover-panel { top: auto; bottom: calc(100% + 10px); }
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--g700); margin-bottom: 6px; }
.field-label i { font-style: normal; font-weight: 400; color: var(--g400); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row .field { margin-bottom: 0; }
.popover textarea, .popover select { width: 100%; font: inherit; font-size: 14px; padding: 9px 11px; border: 1px solid var(--g300); border-radius: 10px; background: #fff; color: var(--g900); }
.popover textarea { resize: vertical; }
.popover textarea:focus, .popover select:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.switches { display: grid; gap: 2px; margin-bottom: 14px; }
.switch { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13.5px; color: var(--g700); cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.track { position: relative; width: 34px; height: 20px; border-radius: 999px; background: var(--g300); transition: background .15s; flex: none; }
.track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

.alert { display: flex; gap: 10px; margin: 12px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--danger-50); border: 1px solid #fecaca; color: #991b1b; font-size: 14px; line-height: 1.45; }
.alert::before { content: "!"; display: grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; }
.features { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 22px 0 0; padding: 0; font-size: 13px; color: var(--g600); }
.features li { display: flex; align-items: center; gap: 6px; }
.features .ic { width: 15px; height: 15px; color: #16a34a; }

/* example preview (right column) */
/* The example panel keeps its place: it is pinned to the top (not centred against the left column, which grows
   when files, notices or errors appear) and stays in view while the left column scrolls. */
.home-preview { min-width: 0; position: sticky; top: 76px; align-self: start; }
.preview-card { background: rgba(255,255,255,.7); border: 1px solid var(--g200); border-radius: 24px; box-shadow: var(--shadow-lg); padding: 10px; backdrop-filter: blur(6px); }
.preview-tabs { display: flex; gap: 2px; padding: 3px; margin-bottom: 10px; background: var(--g100); border-radius: 13px; }
.ptab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--g500); background: none; border: 0; border-radius: 10px; padding: 8px 10px; cursor: pointer; white-space: nowrap; }
.ptab .ic { width: 16px; height: 16px; }
.ptab:hover { color: var(--g900); }
.ptab.active { background: #fff; color: var(--g900); box-shadow: var(--shadow-sm); }
.ptab.active .ic { color: var(--brand); }
.ptab:focus-visible { outline: none; box-shadow: var(--ring); }
.preview-stage { position: relative; display: block; width: 100%; height: clamp(360px, calc(100vh - 290px), 600px); overflow: hidden; padding: 0; border: 1px solid var(--g200); border-radius: 16px; background: #fff; cursor: zoom-in; }
.preview-stage::after { content: ""; position: absolute; z-index: 1; inset: auto 0 0; height: 90px; background: linear-gradient(transparent, #fff); pointer-events: none; }
.preview-stage:focus-visible { outline: none; box-shadow: var(--ring); }
.thumb-inner { position: absolute; top: 0; left: 0; text-align: left; width: 1000px; transform: scale(var(--s, .5)); transform-origin: top left; pointer-events: none; border: 0 !important; box-shadow: none !important; border-radius: 0 !important; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; } }
.preview-stage .thumb-inner { animation: none; will-change: transform; }
.preview-stage .mm { overflow: visible; }
.preview-caption { position: absolute; left: 12px; bottom: 12px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(15, 23, 42, .86); color: #fff; font-size: 12.5px; font-weight: 600; letter-spacing: .1px; box-shadow: 0 8px 20px -8px rgba(15,23,42,.5); opacity: 0; transform: translateY(6px); transition: opacity .35s, transform .35s; pointer-events: none; }
.preview-caption::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #a5b4fc; box-shadow: 0 0 0 3px rgba(165,180,252,.25); }
.preview-caption.show { opacity: 1; transform: none; }
.preview-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 6px 2px; font-size: 12.5px; color: var(--g500); }

@media (max-width: 1100px) {
  .home { grid-template-columns: 1fr; gap: 36px; min-height: 0; padding: 32px 24px 56px; max-width: 760px; }
  .home-preview { position: static; }
  .preview-stage { height: 420px; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 16px; }
  .home { padding: 24px 16px 48px; }
  .composer { border-radius: 20px; padding: 10px; }
  .composer-bar { flex-wrap: wrap; }
  .mode-switch { order: -1; flex: 1 1 100%; }
  .mode-switch label { flex: 1; text-align: center; }
  .attach span, .popover > summary span { display: none; }
  #btn-generate { flex: 1; }
  .popover-panel { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; width: auto; }
  .ptab { font-size: 12.5px; padding: 8px 6px; gap: 5px; }
  .ptab .ic { display: none; }
  .preview-stage { height: 340px; }
}

/* ---------- Account: credits chip, avatar menu ---------- */
.account { display: flex; align-items: center; gap: 8px; }
.lib-btn .ic { width: 16px; height: 16px; }
@media (max-width: 900px) { .lib-btn span { display: none; } }
.credits-chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--g200); background: #fff; font: inherit; font-size: 13px; font-weight: 600; color: var(--g700); cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm); }
.credits-chip .ic { width: 16px; height: 16px; color: #ca8a04; }
.credits-chip:hover { border-color: var(--g300); color: var(--g900); }
.credits-chip.basic, .credits-chip.pro { border-color: #c7d2fe; background: var(--brand-50); color: var(--brand-600); }
.credits-chip.basic .ic, .credits-chip.pro .ic { color: var(--brand); }
@media (max-width: 760px) { .credits-chip span { display: none; } .credits-chip { padding: 0 9px; } }
.btn-upgrade { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 16px 0 13px; border: 0; border-radius: 999px; overflow: hidden; cursor: pointer; font: inherit; font-size: 14px; font-weight: 700; color: #fff; white-space: nowrap;
  background: linear-gradient(120deg, #4f46e5, #7c3aed 55%, #db2777);
  box-shadow: 0 6px 18px -6px rgba(124, 58, 237, .65), inset 0 1px 0 rgba(255,255,255,.25); transition: transform .15s, box-shadow .15s; }
.btn-upgrade .ic { width: 16px; height: 16px; }
.btn-upgrade small { font-size: 12px; font-weight: 600; opacity: .85; padding-left: 8px; margin-left: 1px; border-left: 1px solid rgba(255,255,255,.35); }
.btn-upgrade::after { content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent); transform: skewX(-20deg); animation: shine 4.5s ease-in-out infinite; }
@keyframes shine { 0%, 70% { left: -60%; } 100% { left: 130%; } }
.btn-upgrade:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -8px rgba(124, 58, 237, .8), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-upgrade:focus-visible { outline: none; box-shadow: var(--ring), 0 6px 18px -6px rgba(124, 58, 237, .65); }
@media (prefers-reduced-motion: reduce) { .btn-upgrade::after { animation: none; display: none; } }
@media (max-width: 760px) { .btn-upgrade small { display: none; } .btn-upgrade { padding: 0 13px; } }
.acct-menu > summary.acct-trigger { list-style: none; display: inline-flex; align-items: center; gap: 4px; height: 38px; padding: 2px 9px 2px 2px; border: 1px solid var(--g200); border-radius: 999px; background: #fff; cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .15s, background .15s; }
.acct-menu > summary.acct-trigger:hover, .acct-menu[open] > summary.acct-trigger { border-color: var(--g300); background: var(--g50); }
.acct-menu > summary.acct-trigger:focus-visible { outline: none; box-shadow: var(--ring); }
.acct-trigger .avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; background: var(--brand); color: #fff; font-weight: 700; font-size: 14px; }
.acct-trigger .caret { width: 14px; height: 14px; color: var(--g500); transition: transform .15s; }
.acct-menu[open] .caret { transform: rotate(180deg); }
.acct-menu > summary::-webkit-details-marker { display: none; }
.acct-trigger img { width: 100%; height: 100%; object-fit: cover; }
.plans-manage { position: absolute; top: 14px; left: 14px; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border: 1px solid var(--g200); border-radius: 999px; background: #fff; color: var(--g700); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.plans-manage:hover { background: var(--g50); color: var(--g900); border-color: var(--g300); }
.plans-manage .ic { width: 15px; height: 15px; }
@media (max-width: 760px) { .plans-manage { position: static; margin: 0 0 10px; } }
.plan-pending { margin: 6px 0 0; font-size: 12.5px; font-weight: 600; color: var(--brand-600); }
.acct-head { padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--g100); }
.acct-head b { display: block; font-size: 14px; }
.acct-head small { color: var(--g500); font-size: 12.5px; }
.muted { color: var(--g500); }

/* chips state while uploading */
.chip.uploading .file-meta small { color: var(--brand); }
.chip.uploading .file-ic { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.chip.error { border-color: #fecaca; background: var(--danger-50); }
.chip.error .file-meta small { color: var(--danger); white-space: normal; }
.mode-switch label.locked span::after { content: ""; display: inline-block; width: 11px; height: 11px; margin-left: 5px; vertical-align: -1px; background: currentColor; opacity: .55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat; }
.lock-note { font-weight: 600; }
.limit-note { display: flex; align-items: center; gap: 12px; margin: 12px 0 0; padding: 12px 14px; border-radius: 14px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 13.5px; line-height: 1.45; }
.limit-note[hidden] { display: none; }
.limit-note b { color: #78350f; }
.btn-upgrade-sm { flex: none; height: 32px; padding: 0 13px 0 11px; font-size: 13px; }
.mode-switch label.locked span { display: inline-flex; align-items: center; }
.modal-x:focus { outline: none; }
.modal-x:focus-visible { box-shadow: var(--ring); }


/* ---------- Dialogs ---------- */
.modal { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 28px; border: 0; border-radius: 22px; background: #fff; color: var(--g900); box-shadow: 0 30px 80px -20px rgba(15, 23, 42, .45); overflow-x: hidden; overflow-y: auto; }
.modal::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); }
.modal[open] { animation: modal-in .2s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-sm { width: min(420px, calc(100vw - 32px)); }
.confirm-body { margin: 0 0 22px; line-height: 1.55; font-size: 14.5px; }
.confirm-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.confirm-actions .btn { flex: 1 1 170px; height: auto; min-height: 40px; padding-top: 9px; padding-bottom: 9px; white-space: normal; text-align: center; line-height: 1.25; }
.modal-lg { width: min(1000px, calc(100vw - 32px)); }
.modal h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.02em; }
.modal-x { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border: 0; border-radius: 10px; background: var(--g100); color: var(--g600); font-size: 22px; line-height: 1; cursor: pointer; }
.modal-x:hover { background: var(--g200); color: var(--g900); }
.signin { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding-top: 6px; }
.signin-logo { height: 45px; width: auto; }
.signin p { margin: 0; }
.gsi-slot { min-height: 44px; display: flex; justify-content: center; margin: 8px 0 2px; }
.signin-error { color: var(--danger); font-size: 13.5px; }
.fine { font-size: 12px; color: var(--g400); max-width: 320px; }

.plans-head { text-align: center; margin-bottom: 22px; }
.plans-head .muted { margin: 0 0 14px; }
.plans-toggles { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.seg-mini { display: inline-flex; gap: 2px; padding: 3px; background: var(--g100); border-radius: 10px; }
.seg-mini button { font: inherit; font-size: 13px; font-weight: 600; border: 0; background: none; color: var(--g500); padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.seg-mini button.active { background: #fff; color: var(--g900); box-shadow: var(--shadow-sm); }
.seg-mini i { font-style: normal; color: #16a34a; margin-left: 2px; }
.seg-mini button { display: inline-flex; align-items: center; gap: 7px; }
.seg-mini button:focus { outline: none; }
.seg-mini button:focus-visible { box-shadow: var(--ring); }
.save-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #16a34a; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .1px; box-shadow: 0 2px 8px -2px rgba(22, 163, 74, .6); }
#plan-interval button[data-v="year"]:not(.active) { color: var(--g800); }
#plan-interval button[data-v="year"]:not(.active) .save-badge { animation: nudge 2.8s ease-in-out infinite; }
@keyframes nudge { 0%, 80%, 100% { transform: none; } 88% { transform: translateY(-2px) scale(1.06); } }
@media (prefers-reduced-motion: reduce) { #plan-interval .save-badge { animation: none !important; } }
.plans-note { margin: 14px auto 0; max-width: 620px; padding: 10px 14px; border-radius: 12px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 14px; }
.plans-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 820px) { .plans-grid { grid-template-columns: 1fr; } }
.plan-card { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 22px; border: 1px solid var(--g200); border-radius: 18px; background: #fff; }
.plan-card.featured { border: 2px solid var(--brand); box-shadow: 0 20px 40px -20px rgba(79, 70, 229, .45); }
.plan-tag { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); padding: 3px 12px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; white-space: nowrap; }
.plan-card h3 { margin: 0; font-size: 17px; }
.price b { font-size: 32px; font-weight: 800; letter-spacing: -.03em; }
.price small { color: var(--g500); font-size: 14px; margin-left: 3px; }
.price-note { margin-top: -8px; font-size: 12.5px; color: #16a34a; font-weight: 600; min-height: 17px; }
.plan-card ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 9px; font-size: 13.5px; color: var(--g600); }
.plan-card li { position: relative; padding-left: 22px; line-height: 1.4; }
.plan-card li::before { content: ""; position: absolute; left: 0; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #dcfce7; box-shadow: inset 0 0 0 4px #dcfce7; }
.plan-card li::after { content: ""; position: absolute; left: 4px; top: 6px; width: 6px; height: 3px; border-left: 2px solid #16a34a; border-bottom: 2px solid #16a34a; transform: rotate(-45deg); }
.plan-card li b { color: var(--g900); }
.plan-card li i { color: var(--g400); font-style: normal; }
.plans-foot { margin: 18px 0 0; text-align: center; font-size: 12.5px; color: var(--g500); line-height: 1.6; }

.library-list, .recent-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.library-list li, .recent-list li { display: flex; align-items: center; gap: 6px; border: 1px solid var(--g200); border-radius: 12px; background: #fff; transition: border-color .15s, background .15s; }
.library-list li:hover, .recent-list li:hover { border-color: var(--brand); background: var(--brand-50); }
.library-list li.muted, .recent-list li.muted { border: 0; background: none; padding: 10px 2px; }
.library-list li, .recent-list li { min-width: 0; max-width: 100%; }
.lib-open { flex: 1; min-width: 0; overflow: hidden; display: block; text-align: left; padding: 11px 14px; border: 0; background: none; font: inherit; cursor: pointer; }
.lib-open b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-open small { display: block; color: var(--g500); font-size: 12.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-edit { width: 100%; font: inherit; font-size: 14.5px; font-weight: 700; padding: 4px 8px; border: 1px solid var(--brand); border-radius: 8px; box-shadow: var(--ring); }
.lib-actions { display: flex; gap: 2px; padding-right: 8px; }
.lib-act { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: var(--g500); cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 700; }
.lib-act .ic { width: 16px; height: 16px; }
.lib-act:hover { background: #fff; color: var(--g900); }
.lib-act.danger:hover, .lib-act.confirm { color: #fff; background: var(--danger); }
.recents { margin-top: 22px; }
.recents-head { display: flex; align-items: center; justify-content: space-between; }
.recents-head h3 { margin: 0; font-size: 14px; font-weight: 700; color: var(--g700); }
.recent-list { margin-top: 10px; gap: 6px; }
.recent-list .lib-open { padding: 9px 12px; }
.recent-list .lib-open b { font-size: 14px; }

/* ================= LOADING ================= */
.loading { max-width: 780px; margin: 0 auto; padding: 56px 24px; }
.loading-card { background: #fff; border: 1px solid var(--g200); border-radius: 24px; box-shadow: var(--shadow-lg); padding: 28px; }
.loading-head { display: flex; align-items: center; gap: 14px; }
.loading-head b { display: block; font-size: 16px; }
.loading-head small { font-size: 13px; color: var(--g500); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--brand-100); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 20px 0 24px; }
.loading-steps li { font-size: 12.5px; color: var(--g400); padding: 5px 10px 5px 26px; border-radius: 999px; background: var(--g50); border: 1px solid var(--g200); position: relative; }
.loading-steps li::before { content: ""; position: absolute; left: 9px; top: 50%; width: 9px; height: 9px; margin-top: -4.5px; border-radius: 50%; border: 2px solid var(--g300); }
.loading-steps li.done { color: var(--g700); }
.loading-steps li.done::before { border-color: #16a34a; background: #16a34a; }
.loading-steps li.active { color: var(--brand); border-color: var(--brand-100); background: var(--brand-50); font-weight: 600; }
.loading-steps li.active::before { border-color: var(--brand); border-top-color: transparent; animation: spin .8s linear infinite; }
.sk { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--g100) 25%, var(--g50) 50%, var(--g100) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-title { height: 26px; width: 55%; margin-bottom: 12px; }
.sk-line { height: 12px; width: 90%; margin-bottom: 8px; }
.sk-line.short { width: 60%; }
.sk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.sk-card { height: 110px; border-radius: 12px; }
.sk-card.wide { grid-column: 1 / -1; height: 150px; }

/* ================= WORKSPACE ================= */
.workspace { max-width: 1320px; margin: 0 auto; padding: 0 24px 64px; }
body.is-home .workspace { padding: 0; }
.toolbar { position: sticky; top: 64px; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0 -24px 22px; padding: 10px 24px; background: rgba(250, 250, 251, .86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--g200); }
.tool-group { display: flex; align-items: center; gap: 8px; }
.tool-label { position: relative; z-index: 0; padding: 2px 7px; font-size: 12px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: #1a2e05; white-space: nowrap; }
.tool-label::before { content: ""; position: absolute; z-index: -1; inset: 10% -1px 4% -1px; background: var(--mk, #bef264); border-radius: 3px 9px 4px 10px; transform: rotate(-4deg) skewX(-12deg); }
.tool-label.l-format { --mk: #bef264; }
.tool-label.l-style { --mk: #fde047; }
.tool-label.l-color { --mk: #f9a8d4; }
/* toolbar: controls on the first line, the summary's name on its own line below */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.toolbar > .tool-group { order: 1; }
.toolbar > .toolbar-right { order: 1; margin-left: auto; }
.toolbar > .toolbar-title { order: 2; flex: 1 1 100%; }
.toolbar > .toolbar-title { min-width: 0; padding: 2px 2px 0; font-size: 15px; font-weight: 700; color: var(--g800); line-height: 1.35; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 2px; padding: 3px; background: var(--g100); border-radius: 12px; }
.tab { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13.5px; font-weight: 600; border: 0; background: none; padding: 7px 11px; border-radius: 9px; cursor: pointer; color: var(--g500); }
.tab .ic { width: 16px; height: 16px; }
.tab:hover { color: var(--g900); }
.tab.active { background: #fff; color: var(--g900); box-shadow: var(--shadow-sm); }
.tab.active .ic { color: var(--brand); }
.tab:focus-visible { outline: none; box-shadow: var(--ring); }
.toolbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }

@media (max-width: 760px) {
  .toolbar { grid-template-columns: 1fr; justify-items: start; }
  .toolbar-right { justify-content: flex-start; flex-wrap: wrap; }
}
@media (max-width: 560px) {
  .workspace { padding: 0 12px 48px; }
  .toolbar { margin: 0 -12px 16px; padding: 8px 12px; }
  .tab span { display: none; }
  #btn-print { padding: 8px 10px; }
}
.themes { display: flex; align-items: center; gap: 6px; padding-right: 10px; margin-right: 2px; border-right: 1px solid var(--g200); }
.themes button { width: 17px; height: 17px; border-radius: 50%; border: 2px solid #fff; background: var(--c); cursor: pointer; box-shadow: 0 0 0 1px var(--g300); padding: 0; }
.themes button.active { box-shadow: 0 0 0 2px var(--c); }
.themes.faint button { opacity: .3; filter: saturate(.5); }
.themes.faint .tool-label { opacity: .5; }
.themes.faint button.active { box-shadow: 0 0 0 1px var(--g300); }
.themes.faint button:hover { opacity: .75; filter: none; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 280px; padding: 6px; background: #fff; border: 1px solid var(--g200); border-radius: 14px; box-shadow: 0 20px 50px -12px rgba(15,23,42,.25); }
.menu-list button, .menu-list a { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: 10px; background: none; font: inherit; font-size: 13.5px; color: var(--g900); text-align: left; cursor: pointer; text-decoration: none; }
.menu-list button:hover, .menu-list a:hover { background: var(--g100); }
.menu-list .ic { margin-top: 1px; color: var(--g500); }
.menu-list b { display: block; font-weight: 600; }
.menu-list small { display: block; font-size: 12px; color: var(--g500); }
#pdf-links:not(:empty) { padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--g100); }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 12px; background: var(--g900); color: #fff; font-size: 13.5px; box-shadow: 0 16px 40px -10px rgba(15,23,42,.45); animation: toast-in .25s ease-out; }
.toast[popover] { inset: auto auto 24px 50%; margin: 0; border: 0; overflow: visible; width: max-content; height: auto; }
@keyframes toast-in { from { transform: translate(-50%, 10px); opacity: 0; } }

/* ---------- Shared content ---------- */
.view { background: var(--paper); border: 1px solid #e2e8f0; border-radius: 16px; padding: 32px 36px; box-shadow: 0 1px 3px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.05); overflow-wrap: break-word; }
@media (max-width: 600px) { .view { padding: 18px 14px; } }
mark { background-color: var(--mark); color: inherit; font-weight: 600; padding: 0 2px; border-radius: 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

/* figures cropped from the original material */
figure { margin: 0; }
.blk.fig, .d-fig { text-align: center; }
.blk.fig img, .d-fig img { max-width: 100%; max-height: 380px; height: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.blk.fig figcaption, .d-fig figcaption { font-weight: 700; font-size: 13px; margin-top: 6px; color: var(--purple); }
.blk.fig p, .d-fig p { text-align: left; margin-top: 6px; }
.d-fig { margin: 14px 0; break-inside: avoid; }
.fig-missing { padding: 24px; border: 2px dashed var(--line); border-radius: 6px; color: var(--muted); font-size: 13px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th { background: var(--bar); color: #fff; text-align: left; padding: 8px 10px; }
table.tbl td { border: 1px solid var(--line); padding: 7px 10px; vertical-align: top; }
table.tbl th, table.tbl td { overflow-wrap: normal; word-break: normal; hyphens: manual; } /* columns size to whole words */
table.tbl tr:nth-child(even) td { background: #f8f9fa; }
.tbl-wrap { overflow-x: auto; }
.flow-svg { overflow-x: auto; text-align: center; }
.flow-svg svg { max-width: 100%; height: auto; }

/* ---------- Visual scheme ---------- */
.s-title { border-left: 8px solid var(--accent); padding: 4px 0 4px 16px; margin-bottom: 20px; }
.s-subject { text-transform: uppercase; font-size: 12px; letter-spacing: 1.5px; color: var(--accent); font-weight: 700; }
.s-title h1 { margin: 4px 0 8px; font-size: 28px; line-height: 1.2; }
.s-overview { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; }

.s-keypoints { background: var(--accent-soft); border: 2px solid var(--accent); border-radius: var(--radius); padding: 12px 18px; margin-bottom: 24px; }
.s-keypoints h3 { margin: 0 0 6px; color: var(--accent); font-size: 14px; text-transform: uppercase; letter-spacing: 1px; }
.s-keypoints ol { margin: 0; padding-left: 20px; line-height: 1.6; }

.s-section { margin-bottom: 26px; break-inside: auto; }
.s-bar { display: flex; align-items: center; gap: 10px; background: var(--bar); color: #fff; font-size: 16px; text-transform: uppercase; letter-spacing: .8px; padding: 9px 14px; margin: 0 0 12px; border-radius: 4px; }
.s-num { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 50%; background: var(--accent); font-size: 13px; }
.s-blocks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .s-blocks { grid-template-columns: 1fr; } }
.blk { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; font-size: 14px; line-height: 1.5; break-inside: avoid; position: relative; }
.blk.wide { grid-column: 1 / -1; }
.blk h4 { margin: 0 0 6px; font-size: 14px; }
.blk p { margin: 0 0 6px; }
.blk ul, .blk ol { margin: 4px 0 0; padding-left: 20px; }
.blk.imp-high { border-left: 4px solid var(--orange); }
.blk.imp-critical { border: 2px solid var(--accent); }
.badge { position: absolute; top: -9px; right: 10px; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--accent); color: #fff; }
.badge.high { background: var(--orange); }

.blk.def { display: grid; grid-template-columns: minmax(90px, 32%) 1fr; padding: 0; }
.def-term { background: var(--purple); color: #fff; font-weight: 700; padding: 12px; display: flex; align-items: center; border-radius: 6px 0 0 6px; }
.def-body { padding: 12px 14px; }
.blk.warn { border: 2px solid var(--accent); background: #fff; }
.blk.warn .tag, .blk.tip .tag, .blk.example .tag { display: inline-block; font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 4px; }
.blk.warn .tag { color: var(--accent); }
.blk.tip { background: var(--green-soft); border-color: #b9dcbb; }
.blk.tip .tag { color: var(--green); }
.blk.example { background: var(--blue-soft); border: 1px dashed var(--blue); }
.blk.example .tag { color: var(--blue); }
.blk.list { background: #fafafa; }
.blk.list h4, .blk.steps h4, .blk.table h4, .blk.flow h4 { color: var(--purple); text-transform: uppercase; font-size: 13px; letter-spacing: .5px; }

.steps-row { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0 !important; margin: 6px 0 0; counter-reset: st; }
.steps-row li { counter-increment: st; flex: 1 1 140px; background: var(--purple-soft); border: 1px solid #d6c4ea; border-radius: 8px; padding: 8px 10px 8px 40px; position: relative; }
.steps-row li::before { content: counter(st); position: absolute; left: 8px; top: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--purple); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }

.s-questions .q { border: 1px solid var(--line); border-left: 4px solid var(--purple); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; font-size: 14px; line-height: 1.5; break-inside: avoid; }
.s-questions .qq { font-weight: 600; display: flex; gap: 8px; }
.s-questions .qn { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--purple); color: #fff; font-size: 12px; }
.s-questions .a { margin: 6px 0 0 30px; color: var(--muted); }
.s-questions .a b { color: var(--green); }
.uncertain { margin-top: 20px; font-size: 13px; background: #fff8e1; border: 1px solid #f3d27a; border-radius: 8px; padding: 10px 14px; }
.uncertain h3 { margin: 0 0 4px; font-size: 13px; }

/* ---------- Organized document ---------- */
.doc { max-width: 820px; margin: 0 auto; font-size: 15.5px; line-height: 1.65; font-family: Georgia, "Times New Roman", serif; }
.doc h1 { font-family: "Segoe UI", system-ui, sans-serif; font-size: 28px; margin: 0 0 4px; line-height: 1.25; }
.doc .d-subject { font-family: "Segoe UI", system-ui, sans-serif; color: var(--accent); font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700; }
.doc .d-overview { font-style: italic; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.doc h2 { font-family: "Segoe UI", system-ui, sans-serif; font-size: 20px; border-bottom: 3px solid var(--accent); padding-bottom: 4px; margin: 30px 0 12px; break-after: avoid; }
.doc h3 { font-family: "Segoe UI", system-ui, sans-serif; font-size: 16px; margin: 18px 0 6px; color: var(--purple); break-after: avoid; }
.doc .term { color: var(--purple); }
.doc .callout { border-left: 5px solid var(--accent); background: var(--accent-soft); padding: 10px 14px; margin: 12px 0; border-radius: 0 8px 8px 0; break-inside: avoid; }
.doc .callout.tip { border-color: var(--green); background: var(--green-soft); }
.doc .callout.example { border-color: var(--blue); background: var(--blue-soft); }
.doc .callout b.lbl { font-family: "Segoe UI", system-ui, sans-serif; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.doc .keybox { border: 2px solid var(--bar); border-radius: 8px; padding: 10px 18px; margin: 16px 0; break-inside: avoid; }
.doc .keybox h3 { margin-top: 4px; color: var(--ink); }
.doc .crit { background: var(--accent-soft); border-radius: 4px; padding: 0 3px; }
.doc .tbl-wrap, .doc .flow-svg { margin: 10px 0; font-family: "Segoe UI", system-ui, sans-serif; }
.doc .qa li { margin-bottom: 8px; }
.doc .qa .ans { color: var(--muted); }

/* ---------- Mind map (hand-made study scheme look) ---------- */

.mapa {
  --m-hand: "Patrick Hand", "Segoe Print", "Comic Sans MS", cursive;
  --m-caps: "Patrick Hand SC", "Patrick Hand", "Segoe Print", cursive;
  --m-script: "Caveat", "Segoe Script", cursive;
  font-family: var(--m-hand); font-size: 17px; line-height: 1.45; color: #3a3a3a; background: #fffdf8;
}
.mapa mark { background: none; color: var(--m-dark); font-weight: 700; padding: 0; }
.mapa p { margin: 2px 0 6px; }

/* central map */
.m-map { display: grid; grid-template-columns: 1fr minmax(230px, .85fr) 1fr; gap: 44px 40px; align-items: center; margin: 6px 0 40px; break-inside: avoid; page-break-inside: avoid; }
.m-center { position: relative; text-align: center; padding: 50px 26px; }
.m-center::before { content: ""; position: absolute; inset: 16% 2%; background: var(--m-soft); border-radius: 46% 54% 42% 58% / 58% 44% 56% 42%; transform: rotate(-3deg); }
.m-center > :not(.m-arrow) { position: relative; }
.m-subject { font-family: var(--m-caps); color: var(--m-accent); letter-spacing: 1px; font-size: 15px; }
.m-title { word-break: keep-all; overflow-wrap: normal; hyphens: none; font-family: var(--m-script); font-weight: 700; color: var(--m-dark); line-height: .95; margin: 4px 0 2px; }
.m-title-l { font-size: 64px; }
.m-title-m { font-size: 50px; }
.m-title-s { font-size: 40px; }
.m-title-xs { font-size: 32px; }
.m-title-xxs { font-size: 24px; }
.m-squiggle { width: 70%; height: 12px; }
.m-squiggle path { fill: none; stroke: var(--m-accent); stroke-width: 3; stroke-linecap: round; }
.m-arrow { position: absolute; width: 58px; height: 26px; transform: translate(-50%, -50%) rotate(var(--rot)) translateX(34px); }
.m-arrow svg { width: 100%; height: 100%; overflow: visible; }
.m-arrow path { fill: none; stroke: #4a4a4a; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.m-arrow[data-dir="T"], .m-arrow[data-dir="B"] { width: 44px; transform: translate(-50%, -50%) rotate(var(--rot)) translateX(14px); }
.m-arrow[data-dir="R"] { left: 100%; top: 50%; }
.m-arrow[data-dir="L"] { left: 0; top: 50%; }
.m-arrow[data-dir="T"] { left: 50%; top: 0; }
.m-arrow[data-dir="B"] { left: 50%; top: 100%; }
.m-arrow[data-dir="TL"] { left: 8%; top: 8%; }
.m-arrow[data-dir="TR"] { left: 92%; top: 8%; }
.m-arrow[data-dir="BL"] { left: 8%; top: 92%; }
.m-arrow[data-dir="BR"] { left: 92%; top: 92%; }
.m-node { text-align: center; }
.m-pill { display: inline-block; font-family: var(--m-script); font-weight: 700; font-size: 27px; line-height: 1.2; padding: 2px 18px; border-radius: 14px; color: #3a3a3a; transform: rotate(-1.5deg); }
.m-node ul { list-style: none; padding: 0; margin: 6px 0 0; font-size: 15.5px; line-height: 1.35; color: #555; }
.m-node li + li { margin-top: 4px; }

/* labels & sections */
.m-label { display: inline-block; font-family: var(--m-caps); font-weight: 400; font-size: 25px; letter-spacing: .5px; color: var(--m-dark); background: var(--m-label); border-right: 7px double var(--m-accent); border-radius: 3px 2px 2px 8px; padding: 0 12px; margin: 0 0 12px; transform: rotate(-.8deg); break-after: avoid; page-break-after: avoid; }
.m-keys { border: 2px dashed var(--m-accent); border-radius: 14px; padding: 12px 20px 8px; margin-bottom: 30px; break-inside: avoid; }
.m-keys ol { margin: 0; padding-left: 22px; }
.m-keys li::marker { color: var(--m-accent); font-weight: 700; }
.m-sec { margin-bottom: 28px; }
.m-blocks { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 30px; }
.m-blk { position: relative; padding: 2px 4px; break-inside: avoid; page-break-inside: avoid; }
.m-blk.wide { grid-column: 1 / -1; }
.m-sub { display: inline-block; font-family: var(--m-caps); color: var(--m-dark); font-size: 19px; border-bottom: 2px solid var(--m-label); margin-bottom: 4px; }
.m-ul { list-style: none; padding-left: 4px; margin: 2px 0; }
.m-ul li { position: relative; padding-left: 18px; }
.m-ul li::before { content: "•"; position: absolute; left: 2px; top: -2px; color: var(--m-accent); font-weight: 700; font-size: 20px; }
.m-ul.m-hook li::before { content: "↳"; font-size: 17px; top: 0; }
.m-term { color: var(--m-dark); font-weight: 700; text-decoration: underline; text-decoration-color: var(--m-accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.m-to { color: var(--m-accent); font-weight: 700; }
.m-chevrons { display: flex; flex-wrap: wrap; gap: 8px 0; margin: 6px 0; }
.m-chevrons span { flex: 0 1 auto; min-width: 110px; text-align: center; font-family: var(--m-caps); font-size: 15px; line-height: 1.2; background: var(--m-soft); padding: 9px 24px 9px 28px; margin-right: -4px; clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%, 14px 50%); display: flex; align-items: center; justify-content: center; }
.m-chevrons span:first-child { padding-left: 16px; clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%); }
.m-chevrons span:nth-child(even) { background: var(--m-label); }
.m-warning { border: 2px dashed #c0392b; border-radius: 12px; padding: 16px 14px 8px; margin-top: 10px; }
.m-stamp { position: absolute; top: -13px; left: 14px; background: #fffdf8; color: #c0392b; border: 2px solid #c0392b; font-family: var(--m-caps); font-size: 15px; padding: 0 8px; border-radius: 4px; transform: rotate(-3deg); }
.m-tip { background: #fff4a8; padding: 10px 14px; transform: rotate(-1deg); box-shadow: 2px 3px 6px rgba(0,0,0,.12); }
.m-note-h { font-family: var(--m-caps); color: #8a6d00; }
.m-example p { color: #555; }
.m-ex { color: var(--m-accent); }
.m-decore { position: absolute; top: -12px; right: 0; z-index: 1; background: #2b2b2b; color: #fff; font-family: var(--m-caps); font-size: 12px; padding: 1px 9px; border-radius: 999px; transform: rotate(4deg); }
.m-figure { justify-self: center; position: relative; background: #fff; padding: 12px 12px 8px; box-shadow: 0 2px 10px rgba(0,0,0,.15); transform: rotate(-.6deg); max-width: 560px; margin: 10px auto; text-align: center; }
.m-figure::before { content: ""; position: absolute; top: -11px; left: 50%; width: 96px; height: 22px; background: rgba(255, 228, 140, .8); transform: translateX(-50%) rotate(-3deg); }
.m-figure img { max-width: 100%; max-height: 340px; }
.m-figure figcaption { font-family: var(--m-script); font-weight: 700; font-size: 24px; color: var(--m-dark); }
.m-figure p { text-align: left; font-size: 15.5px; }
.mapa table.tbl { font-size: 15.5px; }
.mapa table.tbl th { background: var(--m-label); color: var(--m-dark); font-family: var(--m-caps); font-weight: 400; font-size: 16px; }
.mapa table.tbl td { border-color: #e4e0d5; }
.mapa table.tbl td:first-child { font-family: var(--m-caps); color: var(--m-dark); }
.mapa table.tbl tr:nth-child(even) td { background: #faf7ef; }
.m-q { margin-bottom: 10px; break-inside: avoid; }
.m-q > b { color: var(--m-accent); }
.m-a { color: #666; margin-left: 18px; }
@media screen and (max-width: 760px) {
  .mapa:not(.sheets) .m-map { grid-template-columns: 1fr; gap: 18px; }
  .mapa:not(.sheets) .m-map > * { grid-area: auto !important; }
  .mapa:not(.sheets) .m-center { order: -1; padding: 30px 16px; }
  .mapa:not(.sheets) .m-arrow { display: none; }
  .mapa:not(.sheets) .m-blocks { grid-template-columns: 1fr; }
  .mapa:not(.sheets) .m-title-l { font-size: 50px; }
}

/* ---------- Look switch (clean / hand-drawn) ---------- */
.look-switch { display: flex; gap: 2px; padding: 3px; background: var(--g100); border-radius: 11px; }
.look-switch button { white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: 13px; font-weight: 600; color: var(--g500); background: none; border: 0; border-radius: 8px; padding: 6px 9px; cursor: pointer; }
.look-switch button .ic { width: 15px; height: 15px; }
.look-switch button:hover { color: var(--g900); }
.look-switch button.active { background: #fff; color: var(--g900); box-shadow: var(--shadow-sm); }
.look-switch button.active .ic { color: var(--brand); }
.look-switch button:focus-visible { outline: none; box-shadow: var(--ring); }
@media (max-width: 900px) { .look-switch span { display: none; } }

/* ---------- Real mind map: horizontal tree ---------- */
.tree { --line: #94a3b8; }
.mm { overflow-x: auto; padding: 6px 2px 14px; }
.mm-branch, .mm-kids > li { display: flex; align-items: center; }
.mm-kids { position: relative; display: flex; flex-direction: column; justify-content: center; list-style: none; margin: 0; padding: 0 0 0 26px; }
.mm-kids::before { content: ""; position: absolute; left: 0; top: 50%; width: 26px; border-top: 2px solid var(--bc, var(--line)); }
.mm-kids > li { position: relative; padding: 5px 0 5px 22px; }
.mm-kids > li::before { content: ""; position: absolute; left: 0; top: 50%; width: 22px; border-top: 2px solid var(--bc, var(--line)); }
.mm-kids > li::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 2px solid var(--bc, var(--line)); }
.mm-kids > li:first-child::before, .mm-kids > li:last-child::before { display: none; }
.mm-kids > li:first-child::after { top: 50%; width: 22px; border-top: 2px solid var(--bc, var(--line)); border-top-left-radius: 14px; }
.mm-kids > li:last-child::after { bottom: 50%; width: 22px; border-bottom: 2px solid var(--bc, var(--line)); border-bottom-left-radius: 14px; }
.mm-kids > li:only-child::after { display: none; }
.mm-kids > li:only-child::before { display: block; }
.mm-node { flex: none; font-size: 13.5px; line-height: 1.38; border-radius: 10px; }
.mm-node.root { max-width: 200px; padding: 16px 18px; border-radius: 18px; background: var(--g900); color: #fff; font-size: 21px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; text-align: center; box-shadow: 0 10px 24px -10px rgba(15,23,42,.5); }
.mm-node.root small { display: block; margin-bottom: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: #a5b4fc; }
.mm-node.l1 { max-width: 190px; padding: 9px 12px; font-size: 14.5px; font-weight: 700; color: var(--bc); background: color-mix(in srgb, var(--bc) 10%, #fff); border: 2px solid var(--bc); }
.mm-node.l2 { max-width: 220px; padding: 7px 10px; font-weight: 600; color: var(--g900); background: #fff; border: 1.5px solid color-mix(in srgb, var(--bc) 40%, #fff); }
.mm-node.l2.crit { border-color: var(--bc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bc) 18%, transparent); }
.mm-node.l2.k-warning { border-color: #ef4444; color: #b91c1c; }
.mm-node.l2.k-tip { background: #fffbeb; border-color: #fcd34d; }
.mm-node.l3 { min-width: 150px; max-width: 330px; padding: 3px 4px; color: var(--g600); }
.mm-fig { display: block; max-width: 210px; max-height: 150px; margin-top: 6px; border-radius: 6px; border: 1px solid var(--g200); background: #fff; }
.tree mark { background: color-mix(in srgb, var(--bc, #fde047) 16%, #fff); }

/* tall trees: the root follows the scroll so the centre of the map is always visible */
.mm.tall .mm-branch > .mm-node.root { position: sticky; top: calc(40vh - 40px); align-self: flex-start; }
.mm.tall .mm-branch > .mm-kids::before { display: none; }
.mm.tall .mm-branch > .mm-node.root::after { content: ""; position: absolute; left: 100%; top: 50%; width: 26px; border-top: 2px solid var(--line); }
.mm-branch > .mm-node.root { position: relative; }

/* hand-drawn look for the tree */
.tree.hand { background: #fffdf8; font-family: var(--m-hand, "Patrick Hand", "Segoe Print", cursive); }
.tree.hand mark { background: none; color: var(--bc); font-weight: 700; }
.tree.hand .mm-kids::before, .tree.hand .mm-kids > li::before, .tree.hand .mm-kids > li::after { border-width: 2.5px; }
.tree.hand .mm-node { font-size: 15.5px; }
.tree.hand .mm-node.root { background: var(--m-soft); color: var(--m-dark); font-family: var(--m-script, "Caveat", cursive); font-size: 34px; font-weight: 700; letter-spacing: 0; line-height: 1; border-radius: 46% 54% 44% 56% / 56% 44% 56% 44%; padding: 26px 22px; box-shadow: none; transform: rotate(-2deg); }
.tree.hand .mm-node.root small { font-family: var(--m-caps, "Patrick Hand SC", cursive); font-size: 13px; color: var(--m-accent); letter-spacing: .5px; }
.tree.hand .mm-node.l1 { font-family: var(--m-script, "Caveat", cursive); font-size: 24px; line-height: 1.05; color: #333; background: var(--bt, #eee); border: 0; border-radius: 12px; padding: 6px 14px; transform: rotate(-1.2deg); }
.tree.hand .mm-node.l2 { font-family: var(--m-caps, "Patrick Hand SC", cursive); font-weight: 400; font-size: 16px; color: #333; background: transparent; border: 0; border-bottom: 2.5px solid var(--bc); border-radius: 0; padding: 2px 4px; }
.tree.hand .mm-node.l2.crit::after { content: "MEMORIZE!"; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: #2b2b2b; color: #fff; font-size: 10px; vertical-align: 2px; }
.tree.hand .mm-node.l2.k-warning { color: #c0392b; border-bottom-style: dashed; border-color: #c0392b; }
.tree.hand .mm-node.l2.k-tip { background: #fff4a8; border: 0; padding: 4px 8px; transform: rotate(-1deg); box-shadow: 1px 2px 4px rgba(0,0,0,.1); }
.tree.hand .mm-node.l3 { color: #444; max-width: 270px; }
.tree.hand .mm-node.l2 { max-width: 200px; }
.tree.hand .mm-node.l2.crit { box-shadow: none; }
.tree.hand .mm-node.l1 { max-width: 175px; }
.tree.hand .mm-fig { border: 6px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.18); transform: rotate(-1deg); }

/* hand-drawn look for the document */
.doc.hand { font-family: var(--m-hand, "Patrick Hand", "Segoe Print", cursive); font-size: 18px; line-height: 1.5; background: #fffdf8; color: #3a3a3a; }
.doc.hand h1 { font-family: var(--m-script, "Caveat", cursive); font-size: 50px; font-weight: 700; color: var(--m-dark); line-height: 1; }
.doc.hand .d-subject { font-family: var(--m-caps, "Patrick Hand SC", cursive); color: var(--m-accent); }
.doc.hand .d-overview { font-style: normal; border-bottom: 2px dashed var(--m-label); }
.doc.hand h2 { display: inline-block; font-family: var(--m-caps, "Patrick Hand SC", cursive); font-weight: 400; font-size: 24px; color: var(--m-dark); background: var(--m-label); border: 0; border-right: 7px double var(--m-accent); border-radius: 3px 2px 2px 8px; padding: 0 12px; transform: rotate(-.8deg); }
.doc.hand h3 { font-family: var(--m-script, "Caveat", cursive); font-size: 26px; color: var(--m-dark); }
.doc.hand mark { background: none; color: var(--m-dark); font-weight: 700; }
.doc.hand .term { color: var(--m-dark); text-decoration: underline; text-decoration-color: var(--m-accent); text-underline-offset: 3px; }
.doc.hand .keybox { border: 2px dashed var(--m-accent); border-radius: 14px; }
.doc.hand .keybox h3 { color: var(--m-dark); }
.doc.hand .callout { background: transparent; border: 2px dashed #c0392b; border-radius: 12px; }
.doc.hand .callout.tip { background: #fff4a8; border: 0; transform: rotate(-.5deg); box-shadow: 2px 3px 6px rgba(0,0,0,.1); }
.doc.hand .callout.example { border-color: var(--m-accent); }
.doc.hand .callout b.lbl { font-family: var(--m-caps, "Patrick Hand SC", cursive); font-size: 15px; }
.doc.hand .crit { background: var(--m-soft); }
.doc.hand table.tbl th { background: var(--m-label); color: var(--m-dark); font-family: var(--m-caps, "Patrick Hand SC", cursive); font-weight: 400; }

/* ---------- Print / PDF ---------- */
.mm-print { display: none; }
.mm-one-loading { display: flex; align-items: center; gap: 14px; max-width: 560px; margin: 60px auto; padding: 20px 22px; border: 1px solid var(--g200); border-radius: 16px; background: #fff; font-family: Inter, system-ui, sans-serif; }
.mm-one-loading b { display: block; font-size: 15px; color: var(--g900); }
.mm-one-loading small { display: block; margin-top: 3px; font-size: 13px; color: var(--g500); line-height: 1.45; }
#tree-mode[hidden], #tree-model[hidden], #tree-bg-wrap[hidden] { display: none; }
.tm-bg { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--g600); cursor: pointer; }
.mm-model-view { display: flex; justify-content: center; padding: 6px 0 18px; }
.mm-model-card { width: min(100%, 940px); background: #fffdf8; border-radius: 14px; box-shadow: 0 6px 22px -10px rgba(15, 23, 42, .3); overflow: hidden; }
.mm-size { margin-left: 2px; }
@media print {
  @page { size: A4; margin: 12mm 11mm; }
  body { background: #fff; }
  .no-print, .panel { display: none !important; }
  .workspace { max-width: none; padding: 0; }
  .view { box-shadow: none; padding: 0; border: 0; border-radius: 0; }
  .view[hidden] { display: none !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Schemes: two newspaper-style columns. Blocks fill one column, then the next, so different block
     heights never leave holes; wide blocks (tables, flows, figures, steps) span the full width. */
  .s-blocks, .m-blocks { display: block; column-count: 2; column-gap: 20px; orphans: 2; widows: 2; }
  .s-blocks > .blk, .m-blocks > .m-blk { display: block; width: auto; margin: 0 0 12px; break-inside: avoid; }
  .s-blocks > .blk.def { display: grid; }
  .s-blocks > .wide, .m-blocks > .wide { column-span: all; }
  /* long lists and warnings may continue on the next page instead of jumping and leaving a gap */
  .blk.warn, .blk.list, .blk.text, .m-blk.m-list, .m-blk.m-text { break-inside: auto; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
  .s-bar, .m-label, .m-sub, .blk h4 { break-after: avoid; page-break-after: avoid; }
  table.tbl tr, li, .d-fig, .doc .callout, .doc .keybox, .flow-svg, .m-q, .s-questions .q { break-inside: avoid; }
  .blk.fig img, .d-fig img, .m-figure img { max-height: 70mm; }
  .m-blocks > .m-figure.wide { max-width: 120mm; margin: 6px auto 14px; }
  .badge { top: 4px; right: 6px; }

  /* Sketch notes on paper: nothing may be cut, covered or left alone at a page edge.
     - Headings are real blocks here (inline-blocks ignore "keep with next"), so a title always travels with its content.
     - The little tags (WATCH OUT!, MEMORIZE!) are part of the flow instead of hanging outside their block, so a
       page break can never slice them or throw them over the text of the previous block.
     - Short boxes (warnings, tips, examples, definitions) are never split across pages. */
  .m-label, .m-sub { display: table; break-after: avoid; page-break-after: avoid; }
  .m-stamp { position: static; display: inline-block; margin: 0 0 6px 4px; transform: rotate(-2deg); }
  .m-decore { position: static; float: right; margin: 0 0 2px 8px; }
  .m-warning { padding-top: 10px; margin-top: 4px; }
  .m-blk.m-warning, .m-blk.m-tip, .m-blk.m-example, .m-blk.m-definition { break-inside: avoid; page-break-inside: avoid; }
  .m-qsec { break-inside: avoid; page-break-inside: avoid; }       /* the review questions stay together on one page */
  .flow-svg svg { max-height: 235mm; width: auto; }                  /* a tall flowchart is scaled to fit one page */

  /* Sketch notes: a compact central map so the key points fit on the first page */
  .mapa { background: #fffdf8; font-size: 14.5px; }
  .m-map { grid-template-columns: 1fr 180px 1fr; gap: 16px 22px; margin: 0 0 14px; }
  .m-center { padding: 24px 8px; }
  .m-arrow { width: 38px; height: 18px; transform: translate(-50%, -50%) rotate(var(--rot)) translateX(18px); }
  .m-arrow[data-dir="T"], .m-arrow[data-dir="B"] { width: 30px; transform: translate(-50%, -50%) rotate(var(--rot)) translateX(8px); }
  .m-title-l { font-size: 40px; }
  .m-title-m { font-size: 32px; }
  .m-title-s { font-size: 26px; }
  .m-title-xs { font-size: 21px; }
  .m-title-xxs { font-size: 16px; }
  .m-pill { font-size: 18px; padding: 1px 12px; }
  .m-node ul { font-size: 12px; }
  .m-label { font-size: 20px; }
  .m-keys { break-inside: auto; margin-bottom: 18px; }
  .m-sec { margin-bottom: 18px; }
  .m-blocks > .m-blk { font-size: 14.5px; }

  /* Mind map: instead of slicing one huge tree across pages, print an overview (one page)
     followed by one tree per section, each scaled to the paper */
  .tree.model-mode .mm-model-card { width: 100%; box-shadow: none; border-radius: 0; }
  .tree .mm-screen { display: none; }
  .tree.one-page .mm-one .mm { overflow: visible; zoom: var(--fit, .8); break-inside: avoid; }
  .tree .mm-print { display: block; }
  .mm-print .mm { overflow: visible; padding: 0; }
  .mm-print .mm-overview { zoom: .8; break-after: page; }
  .mm-print .mm-overview .mm-node.l2 { max-width: 260px; }
  .mm-print .mm-sec { zoom: .84; margin: 0 0 26px; break-inside: avoid; }
  .mm-print .mm-sec .mm-branch { align-items: center; }
  /* on paper the root is never "sticky": it stays centred against its branches */
  .mm.tall .mm-branch > .mm-node.root { position: relative; top: auto; align-self: center; }
  .mm.tall .mm-branch > .mm-node.root::after { display: none; }
  .mm.tall .mm-branch > .mm-kids::before { display: block; }
  .mm-kids > li { break-inside: avoid; }
}

/* ---------- Exported HTML ---------- */
body.export { background: var(--bg); padding: 20px 16px; }
body.export .view { max-width: 1000px; margin: 0 auto; }

/* mind map root: wrap only between words, never inside a word */
.mm-node.root { overflow-wrap: normal; word-break: keep-all; hyphens: none; width: min-content; min-width: 150px; max-width: 280px; }

/* ---------- Sketch skin (modern): bold ink outlines, flat vivid colour, sticker-like cards, rounded fonts ----------
   The same scheme (same HTML) as the hand-drawn look, drawn differently. Works in the flowing view and on the sheets. */
.mapa.sk2 {
  --ink: #1c1c28;
  --m-hand: "Nunito", "Segoe UI", system-ui, sans-serif;
  --m-caps: "Lilita One", "Nunito", "Segoe UI", system-ui, sans-serif;
  --m-script: "Lilita One", "Nunito", "Segoe UI", system-ui, sans-serif;
  font-size: 16px; font-weight: 600; line-height: 1.4; color: var(--ink);
  background-color: #fff; background-image: radial-gradient(#d9deea 1.3px, transparent 1.3px); background-size: 22px 22px;
}
.mapa.sk2 .sheet-page { background-color: #fff; background-image: radial-gradient(#d9deea 1.3px, transparent 1.3px); background-size: 22px 22px; }
.mapa.sk2 mark { color: var(--ink); font-weight: 800; background: linear-gradient(transparent 56%, var(--m-label) 56%); padding: 0 1px; }
.mapa.sk2 .m-label { display: inline-block; font-family: var(--m-caps); font-weight: 400; font-size: 22px; letter-spacing: .3px; color: var(--ink); background: var(--m-label);
  border: 3px solid var(--ink); border-radius: 999px; padding: 0 18px 2px; box-shadow: 3px 3px 0 var(--ink); transform: rotate(-1deg); margin: 0 0 12px; }
.mapa.sk2 .m-sub { font-family: var(--m-caps); font-size: 18px; color: var(--ink); border-bottom: 3px solid var(--m-accent); }

/* cards */
.mapa.sk2 .m-blk:not(.m-figure) { background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 10px 14px; box-shadow: 4px 4px 0 var(--ink); }
.mapa.sk2 .m-blk.m-warning { background: #fff1f0; box-shadow: 4px 4px 0 #e5484d; padding-top: 18px; margin-top: 0; }
.mapa.sk2 .m-stamp { top: -15px; left: 12px; background: #e5484d; color: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 0 12px 1px; font-family: var(--m-caps); font-size: 14px; letter-spacing: .5px; transform: rotate(-3deg); }
.mapa.sk2 .m-blk.m-tip { background: #fff3a8; transform: none; box-shadow: 4px 4px 0 var(--ink); }
.mapa.sk2 .m-note-h { color: var(--ink); font-family: var(--m-caps); }
.mapa.sk2 .m-blk.m-example { background: var(--m-soft); }
.mapa.sk2 .m-example p { color: var(--ink); }
.mapa.sk2 .m-ex { color: var(--m-dark); font-weight: 800; }
.mapa.sk2 .m-term { display: inline-block; font-family: var(--m-caps); font-weight: 400; color: var(--ink); background: var(--m-label); border: 2px solid var(--ink); border-radius: 999px; padding: 0 12px; text-decoration: none; margin-right: 2px; }
.mapa.sk2 .m-to { color: var(--m-accent); }
.mapa.sk2 .m-ul:not(.m-hook) li::before { content: ""; top: 7px; left: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--m-accent); border: 2px solid var(--ink); box-sizing: border-box; font-size: 0; }
.mapa.sk2 .m-decore { background: var(--ink); border: 2px solid var(--ink); font-family: var(--m-caps); font-size: 12px; letter-spacing: .6px; }
.mapa.sk2 .m-keys { background: var(--m-soft); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 4px 4px 0 var(--ink); padding: 14px 22px 10px; }
.mapa.sk2 .m-keys li::marker { color: var(--m-accent); font-weight: 900; }
.mapa.sk2 .m-figure { background: #fff; border: 3px solid var(--ink); border-radius: 16px; box-shadow: 4px 4px 0 var(--ink); transform: none; }
.mapa.sk2 .m-figure::before { display: none; }
.mapa.sk2 .m-figure figcaption { font-family: var(--m-caps); font-weight: 400; color: var(--ink); font-size: 20px; }
.mapa.sk2 table.tbl { border: 3px solid var(--ink); border-collapse: separate; border-spacing: 0; border-radius: 12px; overflow: hidden; }
.mapa.sk2 table.tbl th { background: var(--m-label); color: var(--ink); font-family: var(--m-caps); font-weight: 400; border: 0; border-bottom: 3px solid var(--ink); }
.mapa.sk2 table.tbl td { border: 0; border-bottom: 1.5px solid #cfd3e0; }
.mapa.sk2 table.tbl td:first-child { font-family: var(--m-caps); font-weight: 400; color: var(--ink); }
.mapa.sk2 table.tbl tr:nth-child(even) td { background: var(--m-soft); }
.mapa.sk2 .m-q { background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 8px 12px; box-shadow: 3px 3px 0 var(--ink); margin-bottom: 12px; }
.mapa.sk2 .m-q > b { color: var(--m-accent); font-family: var(--m-caps); font-weight: 400; }
.mapa.sk2 .m-a { color: var(--m-dark); font-weight: 700; }
.mapa.sk2 .uncertain { background: #fff3a8; border: 3px solid var(--ink); border-radius: 14px; }

/* the central map */
.mapa.sk2 .m-center::before { background: var(--m-label); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.mapa.sk2 .m-subject { font-family: var(--m-caps); color: var(--ink); letter-spacing: 1px; }
.mapa.sk2 .m-title { font-family: var(--m-script); font-weight: 400; color: var(--ink); text-shadow: 2px 2px 0 rgba(255, 255, 255, .75); }
.mapa.sk2 .m-squiggle path { stroke: var(--ink); }
.mapa.sk2 .m-pill { font-family: var(--m-caps); font-weight: 400; color: var(--ink); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); border-radius: 999px; transform: rotate(-1deg); }
.mapa.sk2 .m-node ul { color: var(--ink); font-weight: 700; }
.mapa.sk2 .m-arrow path { stroke: var(--ink); stroke-width: 3; }
.mapa.sk2 .m-chevrons span { font-family: var(--m-caps); }


/* ---------- Section title styles (editor > Models): the same title drawn eight ways. Colours follow the theme / the piece's colours. ---------- */
.mapa .m-label.m-hv { position: relative; display: inline-flex; align-items: center; max-width: 100%; font-family: var(--m-caps); font-weight: 700; font-size: 21px; letter-spacing: .04em; line-height: 1.15;
  text-transform: uppercase; color: var(--m-dark); background: none; border: 0; border-radius: 0; box-shadow: none; padding: 0; margin: 0; transform: none; filter: none; clip-path: none; }
.mapa .m-hv .m-hv-t { display: block; }
.mapa .m-label.m-hv.m-hv-pill { background: var(--m-soft); border: 2px solid var(--m-accent); border-radius: 999px; padding: 3px 26px 3px 4px; }
.mapa .m-label.m-hv.m-hv-pill:not(:has(.m-hv-badge)) { padding-left: 22px; }
.mapa .m-label.m-hv.m-hv-pill .m-hv-badge { background: var(--m-dark); color: #fff; border-radius: 999px; padding: 4px 16px; margin-right: 14px; }
.mapa .m-label.m-hv.m-hv-pill::before, .mapa .m-label.m-hv.m-hv-pill::after { content: ""; position: absolute; right: -18px; height: 3px; background: var(--m-accent); border-radius: 2px; }
.mapa .m-label.m-hv.m-hv-pill::before { top: 3px; width: 11px; transform: rotate(-40deg); }
.mapa .m-label.m-hv.m-hv-pill::after { top: 16px; width: 13px; transform: rotate(-8deg); }
.mapa .m-label.m-hv.m-hv-brush { padding: 9px 38px; background: var(--m-label);
  clip-path: polygon(0 30%, 2% 12%, 6% 20%, 11% 6%, 17% 14%, 24% 4%, 32% 12%, 40% 2%, 50% 10%, 58% 3%, 67% 12%, 76% 4%, 85% 13%, 93% 6%, 98% 18%, 100% 34%, 97% 52%, 100% 70%, 96% 88%, 90% 96%, 83% 90%, 75% 98%, 66% 90%, 57% 97%, 48% 90%, 40% 98%, 31% 91%, 23% 97%, 15% 90%, 8% 96%, 3% 86%, 0 72%, 3% 55%); }
.mapa .m-label.m-hv.m-hv-frame { gap: 14px; padding: 9px 22px; background: var(--m-soft); border: 2px solid var(--m-dark); border-radius: 12px; box-shadow: inset 0 0 0 4px var(--m-soft), inset 0 0 0 5.5px var(--m-accent); }
.mapa .m-label.m-hv.m-hv-frame::before, .mapa .m-label.m-hv.m-hv-frame::after { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--m-dark); }
.mapa .m-label.m-hv.m-hv-ribbon .m-hv-badge { position: relative; z-index: 1; background: var(--m-dark); color: #fff; padding: 9px 28px 9px 30px; clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 50%, 100% 100%, 0 100%, 14px 50%); }
.mapa .m-label.m-hv.m-hv-ribbon .m-hv-t { background: var(--m-label); padding: 9px 36px 9px 26px; margin-left: -14px; clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%); }
.mapa .m-label.m-hv.m-hv-ribbon:not(:has(.m-hv-badge)) .m-hv-t { margin-left: 0; padding-left: 32px; clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%, 14px 50%); }
.mapa .m-label.m-hv.m-hv-ribbon::after { content: "\00bb\00bb\00bb"; margin-left: 10px; color: var(--m-accent); font-weight: 900; letter-spacing: -3px; font-size: 1.3em; }
.mapa .m-label.m-hv.m-hv-note { padding: 10px 30px 10px 40px; background-color: #fffdf3; border: 1px solid rgba(120, 110, 80, .3); box-shadow: 0 2px 5px rgba(0, 0, 0, .18);
  background-image: linear-gradient(rgba(120, 110, 80, .12) 1px, transparent 1px), linear-gradient(90deg, rgba(120, 110, 80, .12) 1px, transparent 1px); background-size: 14px 14px; }
.mapa .m-label.m-hv.m-hv-note::before { content: ""; position: absolute; left: 11px; top: 50%; width: 10px; height: 28px; margin-top: -14px; background: radial-gradient(circle at 50% 50%, #fff 3px, #c9c3ad 3.5px, #c9c3ad 4.6px, transparent 5px) 0 0 / 10px 14px repeat-y; }
.mapa .m-label.m-hv.m-hv-note::after { content: ""; position: absolute; right: -12px; top: -9px; width: 52px; height: 17px; background: var(--m-label); opacity: .85; transform: rotate(32deg); }
.mapa .m-label.m-hv.m-hv-cloud { padding: 11px 32px; background: var(--m-soft); border-radius: 26px;
  filter: drop-shadow(2px 0 0 var(--m-accent)) drop-shadow(-2px 0 0 var(--m-accent)) drop-shadow(0 2px 0 var(--m-accent)) drop-shadow(0 -2px 0 var(--m-accent)); }
.mapa .m-label.m-hv.m-hv-cloud::before, .mapa .m-label.m-hv.m-hv-cloud::after { content: ""; position: absolute; left: 16px; right: 16px; height: 9px; background: radial-gradient(circle at 50% 100%, var(--m-soft) 7.5px, transparent 8px) 0 0 / 18px 9px repeat-x; }
.mapa .m-label.m-hv.m-hv-cloud::before { top: -8px; }
.mapa .m-label.m-hv.m-hv-cloud::after { bottom: -8px; transform: scaleY(-1); }
.mapa .m-label.m-hv.m-hv-banner { padding: 10px 42px; background: var(--m-dark); color: #fff; clip-path: polygon(0 0, 100% 0, calc(100% - 16px) 50%, 100% 100%, 0 100%, 16px 50%); }
.mapa .m-label.m-hv.m-hv-banner::before { content: ""; position: absolute; inset: 5px 26px; border: 1.5px dashed rgba(255, 255, 255, .7); border-radius: 3px; pointer-events: none; }
.mapa .m-label.m-hv.m-hv-underline { padding: 2px 4px; }
.mapa .m-label.m-hv.m-hv-underline::before, .mapa .m-label.m-hv.m-hv-underline::after { content: "//"; color: var(--m-accent); font-weight: 900; letter-spacing: -2px; margin: 0 12px; font-size: 1.15em; }
.mapa .m-label.m-hv.m-hv-underline .m-hv-t { text-decoration: underline; text-decoration-color: var(--m-accent); text-decoration-thickness: 3px; text-underline-offset: 7px; }
.mapa.sk2 .m-label.m-hv { font-weight: 400; }   /* Lilita One is already a heavy face */


/* ---------- Sketch skin on the document and the mind map (same ink outlines, vivid colour and rounded fonts as the scheme) ---------- */
.doc.sk2, .tree.sk2 {
  --ink: #1c1c28;
  --m-hand: "Nunito", "Segoe UI", system-ui, sans-serif;
  --m-caps: "Lilita One", "Nunito", "Segoe UI", system-ui, sans-serif;
  --m-script: "Lilita One", "Nunito", "Segoe UI", system-ui, sans-serif;
}
.doc.hand.sk2 { font-family: var(--m-hand); font-size: 16px; font-weight: 600; line-height: 1.5; color: var(--ink); background: #fff radial-gradient(#d9deea 1.3px, transparent 1.3px) 0 0 / 22px 22px; }
.tree.hand.sk2 { font-family: var(--m-hand); font-weight: 600; color: var(--ink); background: #fff radial-gradient(#d9deea 1.3px, transparent 1.3px) 0 0 / 22px 22px; }
.sheets.doc.sk2 .sheet-page, .sheets.tree.sk2 .sheet-page { background: #fff radial-gradient(#d9deea 1.3px, transparent 1.3px) 0 0 / 22px 22px; }
.doc.hand.sk2 mark, .tree.hand.sk2 mark { color: var(--ink); font-weight: 800; background: linear-gradient(transparent 56%, var(--m-label) 56%); padding: 0 1px; }
.doc.hand.sk2 h1 { font-family: var(--m-script); font-weight: 400; font-size: 46px; color: var(--ink); line-height: 1.05; }
.doc.hand.sk2 .d-subject { font-family: var(--m-caps); color: var(--ink); letter-spacing: 1px; }
.doc.hand.sk2 .d-overview { font-weight: 600; border-bottom: 3px dashed var(--m-label); }
.doc.hand.sk2 h2 { font-family: var(--m-caps); font-weight: 400; font-size: 22px; color: var(--ink); background: var(--m-label); border: 3px solid var(--ink); border-radius: 999px; padding: 0 18px 2px; box-shadow: 3px 3px 0 var(--ink); transform: rotate(-1deg); }
.doc.hand.sk2 h3 { font-family: var(--m-caps); font-weight: 400; font-size: 20px; color: var(--ink); display: inline-block; border-bottom: 3px solid var(--m-accent); }
.doc.hand.sk2 .term { color: var(--ink); text-decoration-color: var(--m-accent); text-decoration-thickness: 3px; }
.doc.hand.sk2 .crit { background: var(--m-soft); }
.doc.hand.sk2 .keybox { background: var(--m-soft); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 4px 4px 0 var(--ink); }
.doc.hand.sk2 .keybox h3 { color: var(--ink); }
.doc.hand.sk2 .callout { background: #fff1f0; border: 3px solid var(--ink); border-radius: 16px; box-shadow: 4px 4px 0 #e5484d; transform: none; }
.doc.hand.sk2 .callout.tip { background: #fff3a8; border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); transform: none; }
.doc.hand.sk2 .callout.example { background: var(--m-soft); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.doc.hand.sk2 .callout b.lbl { font-family: var(--m-caps); font-weight: 400; color: var(--ink); }
.doc.hand.sk2 table.tbl { border: 3px solid var(--ink); border-collapse: separate; border-spacing: 0; border-radius: 12px; overflow: hidden; }
.doc.hand.sk2 table.tbl th { background: var(--m-label); color: var(--ink); font-family: var(--m-caps); font-weight: 400; border: 0; border-bottom: 3px solid var(--ink); }
.doc.hand.sk2 table.tbl td { border: 0; border-bottom: 1.5px solid #cfd3e0; }
.doc.hand.sk2 table.tbl tr:nth-child(even) td { background: var(--m-soft); }
.tree.hand.sk2 .mm-kids::before, .tree.hand.sk2 .mm-kids > li::before, .tree.hand.sk2 .mm-kids > li::after { border-width: 3px; }
.tree.hand.sk2 .mm-node.root { background: var(--m-label); color: var(--ink); font-family: var(--m-script); font-weight: 400; font-size: 30px; border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); transform: none; }
.tree.hand.sk2 .mm-node.root small { font-family: var(--m-caps); color: var(--ink); letter-spacing: 1px; }
.tree.hand.sk2 .mm-node.l1 { font-family: var(--m-script); font-weight: 400; font-size: 20px; color: var(--ink); background: var(--bt, #eee); border: 3px solid var(--ink); border-radius: 999px; box-shadow: 3px 3px 0 var(--ink); transform: none; padding: 5px 16px; }
.tree.hand.sk2 .mm-node.l2 { font-family: var(--m-hand); font-weight: 700; font-size: 15px; color: var(--ink); background: #fff; border: 2.5px solid var(--ink); border-radius: 12px; box-shadow: 2px 2px 0 var(--ink); padding: 3px 10px; }
.tree.hand.sk2 .mm-node.l2.crit { background: var(--m-soft); }
.tree.hand.sk2 .mm-node.l2.crit::after { background: var(--ink); }
.tree.hand.sk2 .mm-node.l3 { font-family: var(--m-hand); font-weight: 600; font-size: 14px; color: var(--ink); }

/* a change of style is a soft cross-fade of the page, not a flash */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .24s; animation-timing-function: ease; }
@media (prefers-reduced-motion: reduce) { ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }


/* the toolbar stays on ONE line whatever the width (the layout editor's sidebar takes 320px): labels give way before anything wraps */
.toolbar { container-type: inline-size; container-name: tb; }
.toolbar > .tool-group { flex: 0 0 auto; }
@media (min-width: 761px) { .toolbar > .toolbar-right { flex: 0 1 auto; min-width: 0; flex-wrap: nowrap; } }
@container tb (max-width: 1180px) { .tool-label { display: none; } .themes { padding-right: 8px; } }
@container tb (max-width: 1040px) { .look-switch span { display: none; } }
@container tb (max-width: 900px) { .editor-toggle .ed-tt { display: none; } .editor-toggle { padding: 6px 10px; } }
@container tb (max-width: 860px) { .tab span { display: none; } }
.editor-toggle { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.editor-toggle .ic { width: 16px; height: 16px; }

/* "Customize": the editor's door. Gradient outline, brighter than the other buttons but lighter than PDF (the main action) */
.editor-toggle:not(.active) { font-weight: 700; color: #5b45d6; border: 2px solid transparent; padding: 6px 13px;
  background: linear-gradient(#fff, #fff) padding-box, linear-gradient(120deg, #4f46e5, #7c3aed 55%, #db2777) border-box;
  box-shadow: 0 6px 18px -9px rgba(124, 58, 237, .65); transition: box-shadow .15s, transform .15s, color .15s; }
.editor-toggle:not(.active) .ic { color: #7c3aed; }
.editor-toggle:not(.active):hover { color: #fff; background: linear-gradient(120deg, #4f46e5, #7c3aed 55%, #db2777) border-box; box-shadow: 0 10px 22px -8px rgba(124, 58, 237, .8); transform: translateY(-1px); }
.editor-toggle:not(.active):hover .ic { color: #fff; }
.editor-toggle:not(.active):focus-visible { outline: none; box-shadow: var(--ring); }
@media (prefers-reduced-motion: reduce) { .editor-toggle { transition: none; } .editor-toggle:not(.active):hover { transform: none; } }


/* plans: what "Customize" (the layout editor) includes */
.plan-cz { margin-top: 6px;  padding: 12px 12px 10px; border: 2px solid transparent; border-radius: 14px;
  background: linear-gradient(#fff, #fff) padding-box, linear-gradient(120deg, #4f46e5, #7c3aed 55%, #db2777) border-box; }
.plan-czh { display: flex; align-items: center; gap: 7px; }
.plan-czh svg { width: 17px; height: 17px; fill: none; stroke: #7c3aed; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.plan-czh b { font-size: 13.5px; font-weight: 800; background: linear-gradient(120deg, #4f46e5, #7c3aed 55%, #db2777); -webkit-background-clip: text; background-clip: text; color: transparent; }
.plan-cz p { margin: 4px 0 8px; font-size: 12px; line-height: 1.45; color: var(--g500); }
.plan-card .plan-cz ul { margin: 0; gap: 7px; font-size: 12.5px; }
.plan-card .plan-cz li { padding-left: 22px; }
.plan-card .plan-cz li::before, .plan-card .plan-cz li::after { content: none; }
.plan-cz li svg { position: absolute; left: 0; top: 1px; width: 15px; height: 15px; fill: none; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.plan-cz li.cz-ok svg { stroke: #16a34a; }
.plan-cz li.cz-part svg { stroke: #d97706; }
.plan-cz li.cz-no svg { stroke: var(--g400); }
.plan-cz li em { display: inline-block; margin-left: 2px; padding: 0 6px; border-radius: 999px; background: #fef3c7; color: #92400e; font: 700 10.5px/1.6 Inter, system-ui, sans-serif; font-style: normal; white-space: nowrap; }
.plan-cz li.cz-ok em { background: #dcfce7; color: #166534; }

/* plans window with the editor: compact cards, one line per feature, no scrolling on a normal screen */
.plans-grid.compact { gap: 14px; }
.plans-grid.compact .plan-card { padding: 16px 20px 14px; gap: 8px; }
.plans-grid.compact .plan-card ul { gap: 7px; margin-top: 2px; font-size: 13px; }
.plans-grid.compact .plan-card li { line-height: 1.35; }
.plans-grid.compact .price-note { min-height: 0; }
.plan-card .plan-cz { padding: 10px 12px 9px; }
.plan-card .plan-cz p { margin: 3px 0 7px; font-size: 11.5px; }
.plan-card .plan-cz ul { gap: 6px; font-size: 12.5px; margin-top: 8px; }
.plan-card .plan-cz p + ul { margin-top: 0; }
.plan-card .plan-cz li { display: flex; align-items: center; gap: 7px; padding-left: 0; line-height: 1.25; }
.plan-cz li svg { position: static; flex: none; }
.plan-cz li span { flex: 1; min-width: 0; }
.plan-cz li em { flex: none; margin-left: 0; }

/* the Export menu: a label next to the dots, and the highlighted-PDF entry is always listed */
#export-menu > summary { display: inline-flex; align-items: center; gap: 6px; }
@container tb (max-width: 1180px) { .tb-export { display: none; } }
.menu-list .menu-off { display: flex; align-items: flex-start; gap: 10px; padding: 10px; font-size: 13.5px; opacity: .55; cursor: default; }
.menu-list .menu-off .ic { margin-top: 1px; color: var(--g500); }

/* changing the format: the bars stay put, only the content cross-fades */
#toolbar { view-transition-name: app-toolbar; }
.ed-side { view-transition-name: app-sidebar; }
::view-transition-group(app-toolbar), ::view-transition-group(app-sidebar) { animation-duration: .2s; }
@supports not (view-transition-name: x) {
  .view:not([hidden]) { animation: view-in .22s ease both; }
  @keyframes view-in { from { opacity: 0; } to { opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) { .view:not([hidden]) { animation: none; } }

/* home preview: the second small mind map sits below the first */
.thumb-gap { height: 260px; }       /* far enough that the next map never peeks into the scene */
.preview-stage .thumb-inner.tree { padding: 24px 0; }
