/* =========================================================================
   Editor, demo sandbox and read-only viewer
   ========================================================================= */

html.ft-editor-html, body.ft-editor-body { height: 100%; overflow: hidden; }
body.ft-editor-body { margin: 0; font-size: 15px; background: var(--ft-paper); overscroll-behavior: none; }
body.ft-editor-body .ft-toasts { bottom: 68px; }

.ft-editor {
	position: fixed; inset: 0;
	display: grid;
	grid-template-columns: 284px minmax(0, 1fr);
	grid-template-rows: 60px minmax(0, 1fr) 54px;
	grid-template-areas: "top top" "side canvas" "bottom bottom";
	transition: grid-template-columns 0.25s ease;
}
.ft-editor.side-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.ft-editor.side-collapsed .ft-ed-side { visibility: hidden; border: 0; }

/* ---------- Top bar ---------- */
.ft-ed-top { grid-area: top; display: flex; align-items: center; gap: 14px; padding: 0 14px; background: var(--ft-ink-deep); color: #fff; position: relative; z-index: 30; }
.ft-ed-brand { display: inline-flex; align-items: center; color: #fff; text-decoration: none; padding: 4px 6px; border-radius: 10px; min-width: 0; }
.ft-ed-brand:hover { background: rgba(255, 255, 255, 0.08); }
.ft-editor-logo { display:block; width:auto; max-width:clamp(120px, 16vw, 230px); object-fit:contain; object-position:left center; }
.ft-ed-name, .ft-viewer-title { font: 600 0.9375rem var(--ft-font-sans); color: #fff; background: transparent; border: 1.5px solid transparent; border-radius: 9px; padding: 7px 10px; min-width: 0; width: clamp(120px, 20vw, 280px); text-overflow: ellipsis; margin: 0; }
.ft-ed-name:hover:not([readonly]) { border-color: rgba(255, 255, 255, 0.25); }
.ft-ed-name:focus { outline: none; border-color: var(--ft-thread); background: rgba(255, 255, 255, 0.08); }
.ft-viewer-title { font-family: var(--ft-font-display); font-weight: 400; font-size: 1.5rem; letter-spacing: 0; width: auto; padding: 0 6px; overflow: hidden; white-space: nowrap; }
.ft-ed-menus { display: flex; gap: 2px; }
.ft-menu { position: relative; }
.ft-menu-btn { font: 600 0.875rem var(--ft-font-sans); color: rgba(255, 255, 255, 0.85); background: none; border: 0; padding: 8px 12px; border-radius: 9px; cursor: pointer; }
.ft-menu-btn:hover, .ft-menu.is-open > .ft-menu-btn { background: rgba(255, 255, 255, 0.12); color: #fff; }
.ft-menu-panel { display: none; position: absolute; left: 0; top: calc(100% + 6px); min-width: 240px; padding: 6px; background: #fff; color: var(--ft-ink); border: 1px solid var(--ft-line); border-radius: 14px; box-shadow: var(--ft-shadow-lg); z-index: 60; }
.ft-menu--right .ft-menu-panel { left: auto; right: 0; min-width: 190px; }
.ft-menu.is-open > .ft-menu-panel { display: block; }
.ft-menu-panel button, .ft-menu-panel a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: 9px; color: var(--ft-ink); font: 550 0.875rem var(--ft-font-sans); text-align: left; text-decoration: none; cursor: pointer; }
.ft-menu-panel button:hover, .ft-menu-panel a:hover { background: var(--ft-lilac); }
.ft-menu-panel button[hidden] { display: none; }
.ft-menu-panel kbd { margin-left: auto; font: 600 0.6875rem var(--ft-font-sans); color: var(--ft-muted); background: var(--ft-lilac); padding: 2px 7px; border-radius: 6px; }
.ft-menu-panel hr { border: 0; border-top: 1px solid var(--ft-line); margin: 6px 4px; }
.ft-ed-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.ft-ed-top .ft-btn--ghost { --btn-fg: #fff; --btn-bd: rgba(255, 255, 255, 0.28); }
.ft-ed-top .ft-btn--ghost:hover { background: rgba(255, 255, 255, 0.1); border-color: #fff; }
.ft-ed-top .ft-btn--primary { --btn-bg: #fff; --btn-fg: var(--ft-ink); }
.ft-ed-top .ft-btn--primary[data-action="share"] { background: #fff; color: #241b3b; border-color: rgba(255,255,255,.92); }
.ft-ed-top .ft-btn--primary[data-action="share"] .ft-icon { color: #241b3b; stroke: currentColor; }
.ft-ed-top .ft-btn--primary:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); }
.ft-viewer-privacy { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; color: rgba(255, 255, 255, 0.75); }

.ft-gen-select { min-height: 38px; padding: 0 30px 0 12px; border: 1.5px solid rgba(255, 255, 255, 0.28); border-radius: 10px; background: rgba(255, 255, 255, 0.06) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 14px; -webkit-appearance: none; appearance: none; color: #fff; font: 600 0.8125rem var(--ft-font-sans); cursor: pointer; }
.ft-gen-select:hover { border-color: #fff; }
.ft-gen-select option { color: var(--ft-ink); background: #fff; }
.ft-viewer .ft-gen-select { border-color: rgba(255, 255, 255, 0.3); }

/* ---------- Theme picker ---------- */
.ft-menu-btn--dark { color: rgba(255, 255, 255, 0.85); }
.ft-menu-btn--dark:hover, .ft-menu.is-open > .ft-menu-btn--dark { background: rgba(255, 255, 255, 0.12); color: #fff; }
.ft-theme-panel { min-width: 208px; padding: 6px; }
.ft-theme-option { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: left; font: 600 0.875rem var(--ft-font-sans); color: var(--ft-ink); }
.ft-theme-option:hover { background: var(--ft-lilac); }
.ft-theme-option[aria-checked="true"] { background: var(--ft-lilac); }
.ft-theme-swatch { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; width: 30px; height: 30px; border-radius: 9px; overflow: hidden; border: 1px solid rgba(0, 0, 0, 0.12); flex: none; }
.ft-theme-swatch span:nth-child(1) { grid-column: 1 / span 2; }
.ft-theme-option-label { flex: 1; }
.ft-theme-option-check { width: 16px; height: 16px; color: var(--ft-ink); opacity: 0; flex: none; }
.ft-theme-option[aria-checked="true"] .ft-theme-option-check { opacity: 1; }

/* Canvas backdrop per theme: the SVG itself carries its own fill for exports,
   this only sets the live-view backdrop so scrolled-past empty canvas matches. */
.ft-ed-canvas { background:#f7f5fa; transition:background-color .25s ease; }
.ft-editor[data-theme="botanical"] .ft-ed-canvas { background:#f7f2e7; }
.ft-editor[data-theme="botanical"] .ft-ed-top { background: #2c2113; }
.ft-editor[data-theme="botanical"] .ft-ed-bottom, .ft-editor[data-theme="botanical"] .ft-ed-side { background: #fffaf0; border-color: #d9c8a0; }
.ft-editor[data-theme="botanical"] .ft-tool:first-child { background: #2c3a24; }
.ft-editor[data-theme="botanical"] .ft-tool:first-child .ft-icon { color: #e7d9b8; }
.ft-editor[data-theme="ink"] .ft-ed-canvas { background:#f7f7f5; }
.ft-editor[data-theme="aurora"] .ft-ed-canvas { background-color: #eef7f8; background-image: radial-gradient(rgba(16, 42, 67, 0.12) 1px, transparent 1.3px), radial-gradient(circle at 82% 12%, rgba(34, 184, 167, 0.10), transparent 34%); background-size: 24px 24px, cover; }
.ft-editor[data-theme="heritage"] .ft-ed-canvas { background:#f3ead8; }
.ft-editor[data-theme="midnight"] .ft-ed-canvas { background-color: #15111f; background-image: radial-gradient(rgba(255, 255, 255, 0.10) 1px, transparent 1.3px); background-size: 24px 24px; }
.ft-editor[data-theme="midnight"] .ft-ed-bottom, .ft-editor[data-theme="midnight"] .ft-ed-side { background: #1b1729; border-color: #332c47; }
.ft-editor[data-theme="midnight"] .ft-bottom-btn, .ft-editor[data-theme="midnight"] .ft-zoom-label, .ft-editor[data-theme="midnight"] .ft-side-title, .ft-editor[data-theme="midnight"] .ft-sel-head strong { color: #ece7f7; }
.ft-editor[data-theme="midnight"] .ft-zoom { background: #262038; }
.ft-editor[data-theme="midnight"] .ft-search input { background: #262038; border-color: #3c3352; color: #ece7f7; }
.ft-editor[data-theme="midnight"] .ft-tool { background: #262038; color: #ece7f7; }
.ft-editor[data-theme="midnight"] .ft-tool:first-child { background: #e8b923; color: #1b1729; }
.ft-editor[data-theme="midnight"] .ft-tool:first-child .ft-icon { color: #1b1729; }
.ft-editor[data-theme="midnight"] .ft-side-block { border-color: #332c47; }

/* Theme-safe interaction contrast: generic light hover styles must not wash out
   controls on Midnight surfaces. */
.ft-editor[data-theme="midnight"] .ft-tool:hover:not(:disabled) {
	background: #332b49;
	border-color: #6a5c88;
	color: #fff;
}
.ft-editor[data-theme="midnight"] .ft-tool:first-child:hover:not(:disabled) {
	background: #f3c63a;
	border-color: #f3c63a;
	color: #1b1729;
}
.ft-editor[data-theme="midnight"] .ft-tool:first-child:hover:not(:disabled) .ft-icon { color: #1b1729; }

/* Status pill (top and bottom) */
.ft-status { font-size: 0.8125rem; font-weight: 600; padding: 5px 12px; border-radius: 999px; white-space: nowrap; color: rgba(255, 255, 255, 0.8); }
.ft-status:empty { display: none; }
.ft-status a { color: inherit; text-decoration-color: var(--ft-thread); }
.ft-status[data-state="saving"] { color: rgba(255, 255, 255, 0.7); }
.ft-status[data-state="saved-drive"] { color: #7fe0b7; background: rgba(127, 224, 183, 0.12); }
.ft-status[data-state="saved-local"], .ft-status[data-state="demo"] { background: rgba(255, 255, 255, 0.1); }
.ft-status[data-state="error"], .ft-status[data-state="offline"], .ft-status[data-state="reauth"], .ft-status[data-state="limit"] { color: #1c1200; background: var(--ft-thread); }
.ft-status--bottom { display: none; margin-left: auto; color: var(--ft-ink-soft); }
.ft-status--bottom[data-state="saved-drive"] { color: var(--ft-meadow); background: var(--ft-meadow-soft); }
.ft-status--bottom[data-state="saved-local"], .ft-status--bottom[data-state="demo"] { background: var(--ft-lilac); }
.ft-status--bottom[data-state="saving"] { color: var(--ft-muted); }

/* ---------- Sidebar ---------- */
.ft-ed-side { grid-area: side; background: #fff; border-right: 1px solid var(--ft-line); overflow-y: auto; overflow-x: hidden; z-index: 10; }
.ft-side-block { padding: 20px 18px; border-bottom: 1px solid var(--ft-line); }
.ft-side-title { font: 700 0.75rem var(--ft-font-sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ft-muted); margin: 0 0 14px; }
.ft-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ft-tool { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 12px; background: var(--ft-paper); border: 1.5px solid transparent; border-radius: 12px; font: 600 0.875rem var(--ft-font-sans); color: var(--ft-ink); cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.15s; }
.ft-tool:hover:not(:disabled) { background: #fff; border-color: var(--ft-ink); transform: translateY(-1px); }
.ft-tool:disabled { opacity: 0.4; cursor: not-allowed; }
.ft-tool .ft-icon { width: 20px; height: 20px; color: var(--ft-ink-soft); }
.ft-tool:first-child { grid-column: 1 / -1; background: var(--ft-ink); color: #fff; }
.ft-tool:first-child .ft-icon { color: var(--ft-thread); }
.ft-tool:first-child:hover { background: var(--ft-ink); border-color: var(--ft-ink); }
.ft-side-hint { font-size: 0.8125rem; color: var(--ft-muted); margin: 14px 0 0; line-height: 1.5; }
.ft-side-limit { margin: 14px 0 0; padding: 10px 12px; background: #fff4cf; border-radius: 10px; font-size: 0.8125rem; color: #5b4200; }
.ft-side-limit a { font-weight: 700; }
.ft-sel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ft-sel-avatar { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; overflow: hidden; font-weight: 700; flex: none; }
.ft-sel-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ft-sel-head strong { display: block; font-size: 1.0625rem; line-height: 1.25; }
.ft-sel-head span:not(.ft-sel-avatar) { font-size: 0.8125rem; color: var(--ft-muted); }
.ft-sel-facts { margin: 0; display: grid; gap: 10px; font-size: 0.8125rem; }
.ft-sel-facts dt { font-weight: 700; color: var(--ft-muted); font-size: 0.75rem; }
.ft-sel-facts dd { margin: 1px 0 0; color: var(--ft-ink); }
.ft-sel-bio { font-size: 0.8125rem; color: var(--ft-ink-soft); line-height: 1.55; margin: 14px 0 0; white-space: pre-wrap; }
.ft-sel-bio:empty { display: none; }
.ft-sel-actions { display: flex; gap: 8px; margin-top: 16px; }

/* ---------- Canvas ---------- */
.ft-ed-canvas { grid-area: canvas; position: relative; overflow: hidden; background-color: #f1eef8; background-image: radial-gradient(rgba(36, 27, 59, 0.18) 1px, transparent 1.3px); background-size: 24px 24px; }
.ft-ed-stage { position: absolute; inset: 0; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.ft-ed-stage.is-panning { cursor: grabbing; }
.ft-ed-stage svg { display: block; width: 100%; height: 100%; }

.ft-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 12px; background: rgba(241, 238, 248, 0.9); font-weight: 600; z-index: 20; }
.ft-loading[hidden], .ft-empty-canvas[hidden], .ft-floatbar[hidden] { display: none !important; }
.ft-empty-canvas { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 4; padding: 20px; }
.ft-empty-canvas > div { pointer-events: auto; text-align: center; max-width: 380px; background: #fff; border: 1px solid var(--ft-line); border-radius: 26px; padding: 32px 28px; box-shadow: var(--ft-shadow-md); display: grid; gap: 12px; justify-items: center; }
.ft-empty-canvas h2 { font-size: 2.2rem; margin: 0; }
.ft-empty-canvas p { margin: 0; color: var(--ft-ink-soft); }

.ft-floatbar { position: absolute; left: 0; top: 0; z-index: 8; display: flex; align-items: center; gap: 2px; padding: 5px; background: var(--ft-ink-deep); border-radius: 14px; box-shadow: 0 12px 34px rgba(23, 15, 42, 0.38); white-space: nowrap; will-change: transform; }
.ft-floatbar button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border: 0; background: none; color: #fff; border-radius: 10px; font: 600 0.8125rem var(--ft-font-sans); cursor: pointer; }
.ft-floatbar button:hover { background: rgba(255, 255, 255, 0.14); }
.ft-floatbar button .ft-icon { width: 17px; height: 17px; color: var(--ft-thread); }
.ft-floatbar button.is-danger .ft-icon { color: #ff9a8c; }
.ft-floatbar-sep { width: 1px; align-self: stretch; margin: 4px 3px; background: rgba(255, 255, 255, 0.2); }

.ft-blocking { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: var(--ft-paper); padding: 24px; text-align: center; }
.ft-blocking > div { max-width: 460px; }
.ft-blocking h2 { font-size: 2.4rem; }
.ft-blocking p { color: var(--ft-ink-soft); }
.ft-blocking .ft-row-actions { justify-content: center; }

/* ---------- Bottom bar ---------- */
.ft-ed-bottom { grid-area: bottom; display: flex; align-items: center; gap: 8px; padding: 0 14px; background: #fff; border-top: 1px solid var(--ft-line); z-index: 20; }
.ft-zoom { display: inline-flex; align-items: center; gap: 2px; background: var(--ft-paper); border-radius: 12px; padding: 3px; }
.ft-zoom-label { min-width: 52px; text-align: center; font-weight: 700; font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.ft-bottom-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 0; background: none; border-radius: 10px; font: 600 0.8125rem var(--ft-font-sans); color: var(--ft-ink-soft); cursor: pointer; }
.ft-bottom-btn:hover { background: var(--ft-lilac); color: var(--ft-ink); }
.ft-bottom-btn .ft-icon { width: 17px; height: 17px; }

.ft-search { position: relative; display: flex; align-items: center; margin-left: 10px; flex: 0 1 300px; }
.ft-search > .ft-icon { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--ft-muted); pointer-events: none; }
.ft-search input { width: 100%; min-height: 38px; padding: 0 12px 0 36px; border: 1.5px solid var(--ft-line); border-radius: 11px; background: var(--ft-paper); font: 500 0.875rem var(--ft-font-sans); color: var(--ft-ink); }
.ft-search input:focus { outline: none; background: #fff; border-color: var(--ft-ink); box-shadow: 0 0 0 4px rgba(242, 179, 0, 0.35); }
.ft-search-results { position: absolute; bottom: calc(100% + 8px); left: 0; width: min(340px, 90vw); margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--ft-line); border-radius: 14px; box-shadow: var(--ft-shadow-lg); z-index: 50; }
.ft-search-results li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: 0.875rem; }
.ft-search-results li.is-active, .ft-search-results li:hover { background: var(--ft-lilac); }
.ft-search-results li span { color: var(--ft-muted); font-size: 0.8125rem; }
.ft-search-results li.is-empty { color: var(--ft-muted); cursor: default; }
.ft-search-results li.is-empty:hover { background: none; }

/* ---------- Person dialog ---------- */
.ft-person-grid { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 20px; align-items: start; }
.ft-photo-field { display: grid; gap: 8px; justify-items: center; }
.ft-photo-drop { position: relative; display: grid; place-items: center; width: 112px; height: 112px; border-radius: 50%; border: 2px dashed var(--ft-line-strong); background: var(--ft-paper); cursor: pointer; overflow: hidden; color: var(--ft-muted); padding: 0; }
.ft-photo-drop:hover { border-color: var(--ft-ink); color: var(--ft-ink); }
.ft-photo-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ft-photo-drop span { display: grid; place-items: center; gap: 2px; font-weight: 600; }
.ft-photo-drop .ft-icon { width: 26px; height: 26px; }
.ft-fields { display: grid; gap: 14px; }
#ft-person-form .ft-dialog-actions { position: sticky; bottom: -1px; background: linear-gradient(#fff0, #fff 30%); padding-top: 14px; }

.ft-form-divider { border: 0; border-top: 1px solid var(--ft-line); margin: 6px 0 2px; }
.ft-story-head { margin: 0 0 2px; }
.ft-story-head h3 { font-size: 1.375rem; margin: 0 0 2px; }
.ft-story-head p { margin: 0; font-size: 0.8125rem; color: var(--ft-muted); }

.ft-gallery { display: flex; flex-wrap: wrap; gap: 8px; }
.ft-gallery-thumb { position: relative; width: 72px; height: 72px; border-radius: 12px; overflow: hidden; border: 1px solid var(--ft-line); flex: none; }
.ft-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ft-gallery-remove { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(23, 15, 42, 0.65); color: #fff; display: grid; place-items: center; cursor: pointer; }
.ft-gallery-remove:hover { background: var(--ft-danger); }
.ft-gallery-add { width: 72px; height: 72px; border-radius: 12px; border: 2px dashed var(--ft-line-strong); background: var(--ft-paper); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ft-muted); cursor: pointer; font: 600 0.6875rem var(--ft-font-sans); flex: none; }
.ft-gallery-add:hover { border-color: var(--ft-ink); color: var(--ft-ink); }
.ft-gallery-add .ft-icon { width: 18px; height: 18px; }

.ft-sel-gallery { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ft-sel-gallery img { width: 52px; height: 52px; border-radius: 9px; object-fit: cover; border: 1px solid var(--ft-line); }

/* ---------- Timeline ---------- */
.ft-dialog--timeline { width:min(1180px,calc(100vw - 26px)); max-width:1180px; }
.ft-timeline-form { height:min(90vh,820px); max-height:820px; overflow:hidden; display:grid; grid-template-rows:auto minmax(0,1fr) auto; background:linear-gradient(180deg,#fffefc 0%,#f9f7fb 100%); border-radius:24px; }
.ft-timeline-shell { position:relative; min-width:0; min-height:0; margin:10px 0 4px; display:grid; grid-template-columns:52px minmax(0,1fr) 52px; align-items:stretch; }
.ft-timeline-list { width:100%; min-width:0; min-height:0; height:100%; box-sizing:border-box; margin:0; overflow-x:auto; overflow-y:hidden; padding:0 4px; scrollbar-width:thin; scrollbar-color:rgba(74,55,112,.28) transparent; scroll-behavior:smooth; overscroll-behavior-x:contain; }
.ft-timeline-list::-webkit-scrollbar { height:8px; }
.ft-timeline-list::-webkit-scrollbar-thumb { background:rgba(74,55,112,.24); border-radius:999px; }
.ft-timeline-nav { align-self:center; justify-self:center; z-index:5; width:42px; height:42px; border-radius:50%; border:1px solid rgba(74,55,112,.20); background:rgba(255,255,255,.94); color:var(--ft-ink); display:grid; place-items:center; cursor:pointer; box-shadow:0 8px 22px rgba(36,27,59,.12); transition:transform .16s ease,background .16s ease,opacity .16s ease,box-shadow .16s ease; }
.ft-timeline-nav svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
.ft-timeline-nav:hover:not(:disabled) { transform:scale(1.08); background:#fff; box-shadow:0 10px 26px rgba(36,27,59,.18); }
.ft-timeline-nav:disabled { opacity:.28; cursor:default; box-shadow:none; }
.ft-timeline-stage { position:relative; width:max-content; min-width:100%; height:100%; min-height:0; box-sizing:border-box; padding:4px 0; border:0; border-radius:0; background:transparent; box-shadow:none; }
.ft-timeline-stage::before { content:none; }
.ft-timeline-track { position:relative; display:flex; align-items:center; gap:38px; width:max-content; min-width:100%; height:100%; min-height:0; box-sizing:border-box; padding:0 122px; }
.ft-timeline-track::before { content:""; position:absolute; left:122px; right:122px; top:50%; height:3px; transform:translateY(-50%); border-radius:999px; background:linear-gradient(90deg,rgba(98,75,49,.64),rgba(98,75,49,.42)); box-shadow:0 1px 0 rgba(255,255,255,.75); }
.ft-timeline-entry { position:relative; flex:0 0 196px; width:196px; height:100%; min-height:0; }
.ft-timeline-card-wrap { position:absolute; left:0; width:100%; display:grid; justify-items:center; }
.ft-timeline-entry--top .ft-timeline-card-wrap { top:0; bottom:auto; height:calc(50% - 32px); align-content:end; overflow:hidden; padding-top:4px; box-sizing:border-box; }
.ft-timeline-entry--bottom .ft-timeline-card-wrap { top:calc(50% + 32px); bottom:0; height:calc(50% - 32px); align-content:start; overflow:hidden; padding-bottom:4px; box-sizing:border-box; }
.ft-timeline-card { position:relative; width:100%; display:grid; gap:7px; justify-items:center; text-align:center; border:0; background:transparent; padding:0; overflow:visible; transition:transform .22s ease,filter .22s ease; }
.ft-timeline-entry--top:hover .ft-timeline-card { transform:translateY(-4px); }
.ft-timeline-entry--bottom:hover .ft-timeline-card { transform:translateY(4px); }
.ft-timeline-media { width:clamp(100px,11.5vh,132px); display:grid; grid-template-columns:1fr; gap:5px; align-items:stretch; }
.ft-timeline-media.is-pair { width:clamp(118px,13vh,148px); grid-template-columns:1fr 1fr; }
.ft-timeline-photo { min-width:0; width:100%; padding:6px; background:linear-gradient(180deg,#fff,#f7f1e7); border:1px solid rgba(174,150,117,.44); border-radius:14px; cursor:zoom-in; box-shadow:0 9px 22px rgba(36,27,59,.10); transition:transform .18s ease,box-shadow .18s ease; }
.ft-timeline-photo img { width:100%; aspect-ratio:1/1; object-fit:cover; display:block; border-radius:9px; border:1px solid rgba(74,55,112,.10); }
.ft-timeline-photo:hover { transform:translateY(-2px) rotate(-1deg); box-shadow:0 13px 28px rgba(36,27,59,.15); }
.ft-timeline-body { min-width:0; width:100%; display:grid; gap:5px; justify-items:center; }
.ft-timeline-date { display:grid; justify-items:center; margin:1px 0 2px; }
.ft-timeline-year { display:inline-flex; align-items:center; justify-content:center; min-height:22px; padding:3px 10px; border-radius:999px; background:#f2ede6; font:800 .66rem var(--ft-font-sans); color:#6d6057; letter-spacing:.07em; text-transform:uppercase; white-space:nowrap; }
.ft-timeline-text { margin:0; font:700 .94rem/1.3 var(--ft-font-sans); color:var(--ft-ink); max-width:96%; }
.ft-timeline-people { margin:0; font:700 .7rem/1.35 var(--ft-font-sans); color:var(--ft-meadow); letter-spacing:.02em; }
.ft-timeline-desc { margin:0; font-size:.75rem; line-height:1.45; color:var(--ft-ink-soft); max-width:95%; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.ft-timeline-read-story { border:0; background:none; padding:1px 2px; color:var(--ft-purple); font:750 .69rem var(--ft-font-sans); cursor:pointer; text-decoration:none; }
.ft-timeline-read-story:hover { text-decoration:underline; }
.ft-timeline-card-actions { display:flex; align-items:center; justify-content:center; gap:5px; margin-top:2px; }
.ft-timeline-card-action { margin:0; width:30px; height:30px; }
.ft-timeline-stem { position:absolute; left:50%; width:2px; height:32px; transform:translateX(-50%); background:linear-gradient(180deg,rgba(96,72,46,.52),rgba(96,72,46,.28)); }
.ft-timeline-entry--top .ft-timeline-stem { top:calc(50% - 32px); }
.ft-timeline-entry--bottom .ft-timeline-stem { top:50%; }
.ft-timeline-marker { position:absolute; z-index:3; left:50%; top:50%; transform:translate(-50%,-50%); width:20px; height:20px; border-radius:50%; background:#fff; box-shadow:0 0 0 5px rgba(255,255,255,.92),0 7px 14px rgba(36,27,59,.10); display:grid; place-items:center; overflow:hidden; font:800 .55rem var(--ft-font-sans); color:var(--ft-purple); }
.ft-timeline-marker::before { content:""; position:absolute; inset:3px; border-radius:50%; background:var(--ft-lilac); border:2px solid var(--ft-ink); }
.ft-timeline-marker.has-portrait { width:38px; height:38px; border:3px solid #fff; box-shadow:0 0 0 2px rgba(74,55,112,.20),0 8px 18px rgba(36,27,59,.16); }
.ft-timeline-marker.has-portrait::before,.ft-timeline-marker.has-initials::before { display:none; }
.ft-timeline-marker.has-portrait img { width:100%; height:100%; object-fit:cover; display:block; }
.ft-timeline-marker.has-initials { width:30px; height:30px; border:2px solid #fff; background:var(--ft-lilac); }
.ft-timeline-entry--birth .ft-timeline-marker:not(.has-portrait):not(.has-initials)::before { background:var(--ft-meadow-soft); border-color:var(--ft-meadow); }
.ft-timeline-entry--death .ft-timeline-marker:not(.has-portrait):not(.has-initials)::before { background:#ece7f2; border-color:var(--ft-muted); }
.ft-timeline-entry--event .ft-timeline-marker::before { background:#fdefc4; border-color:var(--ft-thread-deep); }
.ft-timeline-entry:hover .ft-timeline-marker { animation:ftTimelineBounce .45s ease; }
@keyframes ftTimelineBounce { 0%{transform:translate(-50%,-50%) scale(1)} 35%{transform:translate(-50%,calc(-50% - 5px)) scale(1.08)} 70%{transform:translate(-50%,-50%) scale(.98)} 100%{transform:translate(-50%,-50%) scale(1)} }
.ft-timeline-empty { text-align:center; color:var(--ft-muted); padding:36px 10px; margin:0; }
#ft-timeline-add { justify-self:start; margin-top:6px; }

@media(max-width:900px){
  .ft-dialog--timeline{width:min(980px,calc(100vw - 18px))}
  .ft-timeline-form{height:auto;max-height:92vh;display:block;overflow:auto}
  .ft-timeline-shell{display:block;margin:10px 0 4px}
  .ft-timeline-nav{display:none}
  .ft-timeline-list{height:auto;max-height:63vh;overflow-y:auto;overflow-x:hidden;padding-inline:0}
  .ft-timeline-stage{min-height:0;padding:2px 0}
  .ft-timeline-track{display:grid;width:100%;gap:14px;min-width:0;min-height:0;padding:0}
  .ft-timeline-track::before{display:none}
  .ft-timeline-entry{position:relative;width:auto;flex:auto;height:auto;display:grid;grid-template-columns:42px minmax(0,1fr);gap:10px;align-items:start;padding-bottom:4px}
  .ft-timeline-entry::before{content:"";position:absolute;left:19px;top:-12px;bottom:-16px;width:2px;background:linear-gradient(var(--ft-line-strong),var(--ft-line));}
  .ft-timeline-entry:first-child::before{top:22px}.ft-timeline-entry:last-child::before{bottom:calc(100% - 22px)}
  .ft-timeline-card-wrap{position:relative;top:auto!important;bottom:auto!important;left:auto;width:auto;justify-items:stretch;grid-column:2}
  .ft-timeline-card{justify-items:stretch;text-align:left}
  .ft-timeline-card.has-media{display:grid;grid-template-columns:92px minmax(0,1fr);gap:12px;align-items:center}
  .ft-timeline-media,.ft-timeline-media.is-pair{width:92px}
  .ft-timeline-body{justify-items:start}.ft-timeline-date{justify-items:start}
  .ft-timeline-card-actions{justify-content:flex-start}.ft-timeline-read-story{justify-self:start}
  .ft-timeline-marker,.ft-timeline-marker.has-portrait,.ft-timeline-marker.has-initials{position:relative;left:auto;top:auto;transform:none;margin:14px 0 0;grid-column:1;grid-row:1}
  .ft-timeline-entry:hover .ft-timeline-marker{animation:none}.ft-timeline-stem{display:none}
  .ft-timeline-text,.ft-timeline-desc,.ft-timeline-people{max-width:none}
}
@media(max-width:680px){
  .ft-timeline-list{max-height:63vh;padding-inline:0}
  .ft-timeline-card.has-media{grid-template-columns:78px minmax(0,1fr)}
  .ft-timeline-media,.ft-timeline-media.is-pair{width:78px}
  .ft-timeline-photo{padding:5px;border-radius:11px}
  .ft-timeline-text{font-size:.87rem}
}

@media(min-width:901px) and (max-height:760px){
  .ft-timeline-form{height:94vh;max-height:94vh}
  .ft-timeline-shell{margin-top:6px}
  .ft-timeline-track{padding-top:2px;padding-bottom:2px}
  .ft-timeline-entry--top .ft-timeline-card-wrap{top:0;bottom:auto;height:calc(50% - 28px);align-content:end;overflow:hidden;padding-top:2px}
  .ft-timeline-entry--bottom .ft-timeline-card-wrap{top:calc(50% + 28px);bottom:0;height:calc(50% - 28px);align-content:start;overflow:hidden;padding-bottom:2px}
  .ft-timeline-stem{height:28px}
  .ft-timeline-entry--top .ft-timeline-stem{top:calc(50% - 28px)}
  .ft-timeline-media{width:clamp(88px,10vh,108px)}.ft-timeline-media.is-pair{width:clamp(104px,12vh,126px)}
  .ft-timeline-card{gap:5px}.ft-timeline-body{gap:4px}
  .ft-timeline-year{min-height:20px;padding:2px 8px;font-size:.61rem}
  .ft-timeline-text{font-size:.84rem;line-height:1.24}.ft-timeline-desc{font-size:.68rem;line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
  .ft-timeline-card-action{width:28px;height:28px}
}

/* Full event story: keeps variable-length descriptions out of the fixed-height horizontal timeline. */
.ft-dialog--timeline-story { width:min(760px,calc(100vw - 28px)); max-width:760px; }
.ft-timeline-story { max-height:min(86vh,760px); overflow:auto; padding:26px; background:#fff; border-radius:22px; }
.ft-timeline-story .ft-dialog-head { align-items:flex-start; margin-bottom:16px; }
.ft-timeline-story-date { display:inline-flex; align-items:center; min-height:23px; padding:3px 10px; margin-bottom:7px; border-radius:999px; background:#f2ede6; color:#6d6057; font:800 .68rem var(--ft-font-sans); letter-spacing:.07em; text-transform:uppercase; }
.ft-timeline-story h2 { margin:0; font-size:clamp(1.35rem,2.3vw,2rem); }
.ft-timeline-story-people { margin:7px 0 0; color:var(--ft-meadow); font:700 .79rem/1.4 var(--ft-font-sans); }
.ft-timeline-story-photo { display:block; width:min(100%,680px); max-height:46vh; object-fit:contain; margin:0 auto 18px; border-radius:17px; background:#f7f3ed; border:1px solid rgba(174,150,117,.34); box-shadow:0 12px 30px rgba(36,27,59,.10); }
.ft-timeline-story-copy { margin:0; white-space:pre-wrap; color:var(--ft-ink-soft); font:500 .96rem/1.7 var(--ft-font-sans); }
@media(max-width:680px){.ft-timeline-story{padding:18px}.ft-timeline-story-photo{max-height:38vh}.ft-dialog--timeline-story{width:calc(100vw - 18px)}}

/* Event editor: a compact story-card composer, inspired by printed family timelines. */
.ft-dialog--event { width:min(760px,calc(100vw - 28px)); max-width:760px; }
.ft-event-form { max-height:min(88vh,760px); overflow:auto; }
.ft-event-grid { display:grid;grid-template-columns:minmax(0,1.25fr) minmax(220px,.75fr);gap:20px;align-items:start; }
.ft-event-fields { display:grid;gap:13px;min-width:0; }
.ft-event-photo-panel { position:sticky;top:0;display:grid;gap:8px; }
.ft-event-photo-label { font:750 .76rem var(--ft-font-sans);color:var(--ft-ink); }
.ft-event-photo-drop { width:100%;aspect-ratio:4/3;border:1.5px dashed var(--ft-line-strong);border-radius:18px;background:linear-gradient(145deg,#faf8fd,#fffdf8);padding:0;overflow:hidden;cursor:pointer;color:var(--ft-muted);transition:border-color .18s ease,transform .18s ease,box-shadow .18s ease; }
.ft-event-photo-drop:hover { border-color:var(--ft-purple);box-shadow:0 8px 22px rgba(36,27,59,.08);transform:translateY(-1px); }
.ft-event-photo-drop img { width:100%;height:100%;object-fit:cover;display:block; }
#ft-event-photo-empty { height:100%;padding:22px 16px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:7px; }
#ft-event-photo-empty .ft-icon { width:30px;height:30px;color:var(--ft-meadow); }
#ft-event-photo-empty strong { color:var(--ft-ink);font-size:.88rem; }
#ft-event-photo-empty small { max-width:190px;line-height:1.35;font-size:.7rem; }
.ft-event-people { display:flex;flex-wrap:wrap;gap:7px;max-height:116px;overflow:auto;padding:2px; }
.ft-event-person-chip { display:inline-flex;align-items:center;gap:7px;border:1px solid var(--ft-line);border-radius:999px;padding:4px 9px 4px 5px;background:#fff;cursor:pointer;font:650 .72rem var(--ft-font-sans);transition:.15s ease; }
.ft-event-person-chip:hover { border-color:var(--ft-purple); }
.ft-event-person-chip:has(input:checked) { border-color:var(--ft-meadow);background:var(--ft-meadow-soft);box-shadow:inset 0 0 0 1px var(--ft-meadow); }
.ft-event-person-chip input { position:absolute;opacity:0;pointer-events:none; }
.ft-event-person-avatar { width:25px;height:25px;border-radius:50%;display:grid;place-items:center;overflow:hidden;background:var(--ft-lilac);color:var(--ft-purple);font-size:.64rem;font-weight:800;flex:none; }
.ft-event-person-avatar img { width:100%;height:100%;object-fit:cover; }

/* Full photograph preview stays inside the viewport and always exposes a close control. */
.ft-photo-viewer-dialog { width:min(920px,calc(100vw - 28px));max-width:920px;padding:0!important;background:transparent!important;border:0!important;box-shadow:none!important;overflow:visible!important; }
.ft-photo-viewer { position:relative;display:grid;gap:0;background:#171320;border-radius:20px;padding:12px;box-shadow:0 28px 80px rgba(12,8,20,.42);max-height:calc(100vh - 40px);max-height:calc(100dvh - 40px); }
.ft-photo-viewer img { display:block;max-width:100%;width:auto;max-height:calc(100vh - 110px);max-height:calc(100dvh - 110px);height:auto;margin:auto;border-radius:13px;object-fit:contain;background:#0f0c15; }
.ft-photo-viewer-close { position:absolute;z-index:2;top:20px;right:20px;width:38px;height:38px;border-radius:50%;border:1px solid rgba(255,255,255,.35);background:rgba(20,15,30,.72);color:#fff;display:grid;place-items:center;cursor:pointer;backdrop-filter:blur(8px); }
.ft-photo-viewer-close:hover { background:#fff;color:var(--ft-ink); }
.ft-photo-viewer-caption { color:#fff;text-align:center;padding:10px 14px 2px;font:650 .8rem var(--ft-font-sans); }

@media(max-width:680px){
  .ft-dialog--event{width:calc(100vw - 18px)}.ft-event-form{max-height:92vh}.ft-event-grid{grid-template-columns:1fr}.ft-event-photo-panel{position:static;order:-1}.ft-event-photo-drop{aspect-ratio:16/7;max-height:180px}.ft-event-people{max-height:100px}.ft-dialog-actions{position:sticky;bottom:-1px;background:#fff;padding-top:10px;z-index:3}
}

/* ---------- Viewer specifics ---------- */
.ft-viewer .ft-ed-top { gap: 12px; }
.ft-viewer-missing { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.ft-viewer-missing > div { max-width: 460px; display: grid; gap: 12px; justify-items: center; }
.ft-viewer-missing h1 { font-size: 3rem; margin: 8px 0 0; }
.ft-viewer-missing p { color: var(--ft-ink-soft); margin: 0 0 8px; }
.is-readonly .ft-floatbar { display: none !important; }

@media print {
	.ft-editor { display: none; }
}


/* Person media memories — editor-only scope; does not touch tree SVG classes. */
.ft-media-memory-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin:14px 0}
.ft-media-memory{border:1px solid var(--ft-line);border-radius:14px;padding:14px;background:var(--ft-paper)}
.ft-media-memory p{margin:5px 0 10px;color:var(--ft-muted);font-size:.78rem;line-height:1.45}
.ft-media-memory audio,.ft-media-memory video{display:block;width:100%;max-height:180px;margin:8px 0 10px;border-radius:10px}
.ft-sel-media{display:grid;gap:8px;margin-top:12px}.ft-sel-media audio,.ft-sel-media video{width:100%;max-height:180px;border-radius:10px;background:#111}
@media(max-width:620px){.ft-media-memory-grid{grid-template-columns:1fr}}
.ft-editor[data-theme="portrait"] .ft-ed-canvas{background:#f7f5f0}
.ft-editor[data-theme="royal"] .ft-ed-canvas{background:#fffdf8}
.ft-editor[data-theme="lineage"] .ft-ed-canvas{background:#fff;background-image:none}

/* v11: visual theme gallery. Scoped entirely to the editor theme menu. */
.ft-theme-panel{width:min(720px,calc(100vw - 32px));max-height:min(72vh,640px);overflow:auto;padding:14px}
.ft-theme-gallery-head{display:flex;flex-direction:column;gap:2px;padding:2px 3px 12px}.ft-theme-gallery-head strong{font:700 .95rem var(--ft-font-sans);color:var(--ft-ink)}.ft-theme-gallery-head span{font:500 .75rem var(--ft-font-sans);color:var(--ft-muted)}
.ft-theme-gallery{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.ft-theme-card{position:relative;display:grid;grid-template-columns:112px minmax(0,1fr) 18px;align-items:center;gap:12px;padding:9px;border:1px solid var(--ft-border);background:#fff;border-radius:14px;min-height:86px}.ft-theme-card:hover{background:#fff;border-color:rgba(36,27,59,.28);box-shadow:0 8px 22px rgba(36,27,59,.09);transform:translateY(-1px)}.ft-theme-card[aria-checked="true"]{background:#fff;border-color:var(--ft-purple);box-shadow:0 0 0 2px rgba(74,55,112,.10)}
.ft-theme-card-meta{display:flex;flex-direction:column;gap:4px;min-width:0}.ft-theme-card-meta strong{font:700 .84rem var(--ft-font-sans);color:var(--ft-ink)}.ft-theme-card-meta small{font:500 .69rem/1.3 var(--ft-font-sans);color:var(--ft-muted)}
.ft-theme-preview{position:relative;display:block;width:112px;height:66px;border:1px solid rgba(0,0,0,.08);border-radius:10px;overflow:hidden;background:var(--tp-bg)}.ft-theme-preview .tp-line{position:absolute;display:block;background:var(--tp-line);opacity:.72}.ft-theme-preview .tp-line--v{width:2px;height:25px;left:55px;top:22px}.ft-theme-preview .tp-line--h{height:2px;width:58px;left:27px;top:46px}.ft-theme-preview .tp-node{position:absolute;display:block;width:22px;height:16px;border:2px solid var(--tp-ring);background:var(--tp-card);border-radius:5px;box-shadow:0 2px 4px rgba(0,0,0,.08)}.ft-theme-preview .tp-node--a{left:45px;top:7px}.ft-theme-preview .tp-node--b{left:17px;top:43px}.ft-theme-preview .tp-node--c{right:17px;top:43px}.ft-theme-preview--botanical .tp-line{background:#6b4a2f;border-radius:99px}.ft-theme-preview--botanical .tp-line--v{width:5px;transform:rotate(-7deg)}.ft-theme-preview--botanical .tp-line--h{height:4px;border-radius:50%;transform:rotate(-3deg)}.ft-theme-preview--botanical:after{content:"";position:absolute;inset:5px 12px 24px;border-radius:50%;background:radial-gradient(circle at 25% 65%,#73945f 0 6px,transparent 7px),radial-gradient(circle at 45% 30%,#547b46 0 8px,transparent 9px),radial-gradient(circle at 70% 55%,#8ba276 0 7px,transparent 8px);opacity:.55}.ft-theme-preview--lineage .tp-node,.ft-theme-preview--portrait .tp-node,.ft-theme-preview--royal .tp-node,.ft-theme-preview--bands .tp-node{width:20px;height:20px;border-radius:50%}.ft-theme-preview--lineage .tp-node--b{border-color:#4dbb78}.ft-theme-preview--lineage .tp-node--c{border-color:#f4ad42}.ft-theme-preview--bands{background:linear-gradient(to bottom,#eef7fb 0 33%,#fff 33% 66%,#eef9f5 66%)}.ft-theme-preview--heritage{background:linear-gradient(100deg,#efe3c9,#f7f0e1 48%,#eadbbd)}.ft-theme-preview--royal{background:linear-gradient(135deg,#fffdf8,#f8f0df)}.ft-theme-preview--midnight{border-color:#3c3352}.ft-theme-preview--aurora{background:radial-gradient(circle at 80% 20%,#d9f4ef,transparent 45%),#f4f8f8}
@media(max-width:680px){.ft-theme-gallery{grid-template-columns:1fr}.ft-theme-panel{width:min(390px,calc(100vw - 20px))}}

/* v11: selected relative reads as a compact profile, without touching tree nodes. */
.ft-side-person{background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(250,248,253,.98))}.ft-side-person .ft-side-title{letter-spacing:.08em}.ft-sel-head{padding:4px 0 14px;border-bottom:1px solid var(--ft-border)}.ft-sel-avatar{width:58px;height:58px;box-shadow:0 0 0 4px #fff,0 5px 18px rgba(36,27,59,.12)}.ft-sel-avatar img{width:100%;height:100%;object-fit:cover;border-radius:inherit}.ft-sel-head strong{font-size:1rem}.ft-sel-facts{margin-top:14px}.ft-sel-bio:not(:empty){padding:11px 12px;border-radius:11px;background:#fff;border:1px solid var(--ft-border);line-height:1.5}.ft-sel-gallery{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin-top:10px}.ft-sel-gallery img{aspect-ratio:1;object-fit:cover;width:100%;border-radius:9px;border:1px solid var(--ft-border)}.ft-sel-media{display:grid;gap:8px;margin-top:10px}.ft-sel-media audio,.ft-sel-media video{width:100%;max-height:170px;border-radius:10px;background:#111}.ft-sel-actions{padding-top:12px;margin-top:12px;border-top:1px solid var(--ft-border)}


/* v12: large-tree overview navigator. Scoped to the editor only. */
.ft-minimap{position:absolute;right:18px;bottom:72px;width:190px;height:126px;padding:8px 8px 22px;background:rgba(255,255,255,.9);border:1px solid rgba(45,36,64,.16);border-radius:14px;box-shadow:0 12px 32px rgba(28,22,42,.14);backdrop-filter:blur(12px);z-index:8;cursor:pointer;overflow:hidden}
.ft-minimap:hover,.ft-minimap:focus-visible{border-color:rgba(45,36,64,.38);box-shadow:0 14px 38px rgba(28,22,42,.2);outline:none}
.ft-minimap-art{width:100%;height:100%;overflow:hidden;pointer-events:none}
.ft-minimap-art svg{width:100%;height:100%;display:block}
.ft-minimap>span{position:absolute;left:10px;bottom:5px;font-size:10px;font-weight:750;letter-spacing:.06em;text-transform:uppercase;color:var(--ft-muted)}
@media(max-width:900px){.ft-minimap{width:138px;height:92px;right:10px;bottom:68px}}
@media(max-width:640px){.ft-minimap{display:none}}


/* v13 presentation controls + accessibility pass. All selectors remain editor-scoped. */
.ft-theme-controls{border-top:1px solid rgba(36,27,59,.12);margin-top:12px;padding:14px 3px 3px;display:grid;gap:10px}.ft-theme-controls-title{font:800 .86rem var(--ft-font-sans);color:var(--ft-ink)}.ft-theme-controls>label,.ft-theme-control-grid label{display:grid;gap:5px;font:700 .72rem var(--ft-font-sans);color:var(--ft-muted)}.ft-theme-controls input[type=text],.ft-theme-controls select{width:100%;border:1px solid #cfc8df;border-radius:9px;padding:8px 9px;background:#fff;color:#241b3b;font:600 .8rem var(--ft-font-sans)}.ft-theme-control-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px 14px}.ft-theme-control-grid input[type=range]{width:100%;accent-color:#5b4a86}.ft-theme-checks{display:flex;flex-wrap:wrap;gap:8px 14px}.ft-theme-checks label{font:650 .75rem var(--ft-font-sans);color:var(--ft-ink);display:flex;gap:6px;align-items:center}.ft-branch-root-note{font:600 .7rem var(--ft-font-sans);color:var(--ft-muted)}.ft-editor:not(.ft-theme-is-botanical) .ft-foliage-control{opacity:.48}.ft-editor :is(button,a,input,select,textarea,[tabindex]):focus-visible{outline:3px solid var(--ft-thread)!important;outline-offset:2px!important}.ft-theme-option:focus-visible{outline-offset:-2px!important}.ft-ed-stage .ft-card:focus-visible .ft-card-ring{stroke:var(--ft-thread)!important;stroke-width:4!important}.ft-editor [aria-disabled=true]{opacity:.55}.ft-editor .ft-menu-panel [role=menuitem]:focus-visible{background:#eee9f8;color:#241b3b}.ft-editor[data-theme=midnight] .ft-theme-controls-title,.ft-editor[data-theme=midnight] .ft-theme-controls label,.ft-editor[data-theme=midnight] .ft-theme-checks label,.ft-editor[data-theme=midnight] .ft-branch-root-note{color:#ece7f7}.ft-editor[data-theme=midnight] .ft-theme-controls input[type=text],.ft-editor[data-theme=midnight] .ft-theme-controls select{background:#262038;border-color:#4a4064;color:#fff}@media(max-width:640px){.ft-theme-control-grid{grid-template-columns:1fr}}@media(prefers-reduced-motion:reduce){.ft-editor *,.ft-editor *::before,.ft-editor *::after{scroll-behavior:auto!important;animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important}}

/* Clear separation between editing tools and presentation controls. */
.ft-side-section-head{margin-bottom:14px}.ft-side-section-head .ft-side-title{margin:2px 0 5px;color:var(--ft-ink);font-size:.92rem;letter-spacing:0;text-transform:none}.ft-side-section-head p{margin:0;color:var(--ft-muted);font-size:.76rem;line-height:1.45}.ft-side-kicker{display:inline-block;font:800 .65rem var(--ft-font-sans);letter-spacing:.1em;text-transform:uppercase;color:var(--ft-meadow)}
.ft-theme-gallery-head{display:grid;gap:3px;margin:0 2px 12px}.ft-theme-gallery-head strong{font-size:.95rem}.ft-theme-gallery-head span{font-size:.75rem;color:var(--ft-muted);line-height:1.4}.ft-theme-safety-note{margin:12px 3px 2px;padding:10px 12px;border-radius:10px;background:var(--ft-paper);color:var(--ft-muted);font-size:.72rem;line-height:1.45}.ft-theme-safety-note strong{color:var(--ft-ink)}
.ft-theme-controls-intro{margin:-4px 0 2px;color:var(--ft-muted);font-size:.74rem;line-height:1.45}.ft-control-help{font-weight:500;color:var(--ft-muted);font-size:.68rem;line-height:1.3}.ft-theme-control-grid label{align-content:start}.ft-theme-controls input[type=range],.ft-theme-controls select{margin-top:2px}.ft-theme-checks{padding-top:2px}.ft-branch-root-note{display:block;padding:9px 10px;border-radius:9px;background:var(--ft-paper);line-height:1.45}

/* Theme-specific editor environments: the canvas and chrome reinforce each design rather than feeling recoloured. */
.ft-editor[data-theme="ink"] .ft-ed-top{background:#151515}.ft-editor[data-theme="ink"] .ft-ed-canvas{background-color:#f7f7f5;background-image:linear-gradient(rgba(0,0,0,.035) 1px,transparent 1px),linear-gradient(90deg,rgba(0,0,0,.035) 1px,transparent 1px);background-size:32px 32px}.ft-editor[data-theme="ink"] .ft-ed-bottom,.ft-editor[data-theme="ink"] .ft-ed-side{background:#fbfbf9;border-color:#cfcfca}
.ft-editor[data-theme="heritage"] .ft-ed-top{background:#29352d}.ft-editor[data-theme="heritage"] .ft-ed-canvas{background-color:#f3ead8;background-image:repeating-linear-gradient(0deg,rgba(111,87,53,.025) 0,rgba(111,87,53,.025) 1px,transparent 1px,transparent 7px)}.ft-editor[data-theme="heritage"] .ft-tool:first-child{background:#334c3b}.ft-editor[data-theme="heritage"] .ft-tool:first-child .ft-icon{color:#d0a06d}
.ft-editor[data-theme="portrait"] .ft-ed-top{background:#202b35}.ft-editor[data-theme="portrait"] .ft-ed-canvas{background-color:#f7f5f0;background-image:radial-gradient(circle at 50% 25%,rgba(185,147,90,.07),transparent 36%)}.ft-editor[data-theme="portrait"] .ft-tool:first-child{background:#27333d}.ft-editor[data-theme="portrait"] .ft-tool:first-child .ft-icon{color:#c6a46d}
.ft-editor[data-theme="royal"] .ft-ed-top{background:#521e20}.ft-editor[data-theme="royal"] .ft-ed-canvas{background-color:#fffdf8;background-image:radial-gradient(circle at 50% 0,rgba(212,167,44,.08),transparent 36%)}.ft-editor[data-theme="royal"] .ft-tool:first-child{background:#7f1d1d}.ft-editor[data-theme="royal"] .ft-tool:first-child .ft-icon{color:#f0c95c}
.ft-editor[data-theme="lineage"] .ft-ed-top{background:#17383f}.ft-editor[data-theme="lineage"] .ft-ed-canvas{background-color:#fff;background-image:radial-gradient(circle at 18% 20%,rgba(59,158,208,.055),transparent 30%),radial-gradient(circle at 82% 76%,rgba(77,187,120,.05),transparent 32%)}.ft-editor[data-theme="lineage"] .ft-tool:first-child{background:#246b75}.ft-editor[data-theme="lineage"] .ft-tool:first-child .ft-icon{color:#bfe9dc}
.ft-editor[data-theme="bands"] .ft-ed-top{background:#183e61}.ft-editor[data-theme="bands"] .ft-ed-canvas{background:#f8fafb;background-image:none}.ft-editor[data-theme="bands"] .ft-tool:first-child{background:#176d66}.ft-editor[data-theme="bands"] .ft-tool:first-child .ft-icon{color:#dff6ef}

/* A first-use state that teaches the first interaction instead of presenting an empty canvas. */
.ft-empty-canvas>.ft-empty-card{max-width:500px;padding:34px 34px 30px;gap:11px}.ft-empty-kicker{font:800 .69rem var(--ft-font-sans);letter-spacing:.1em;text-transform:uppercase;color:var(--ft-meadow)}.ft-empty-tree{position:relative;width:150px;height:80px;margin-bottom:2px}.ft-empty-node{position:absolute;width:38px;height:24px;border:2px solid var(--ft-ink);border-radius:9px;background:#fff;box-shadow:0 4px 10px rgba(36,27,59,.08)}.ft-empty-node--top{left:56px;top:0}.ft-empty-node--left{left:18px;bottom:0}.ft-empty-node--right{right:18px;bottom:0}.ft-empty-line{position:absolute;background:var(--ft-thread);border-radius:999px}.ft-empty-line--stem{left:74px;top:24px;width:2px;height:23px}.ft-empty-line--branch{left:37px;top:45px;width:76px;height:2px}.ft-empty-steps{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;margin:4px 0 5px}.ft-empty-steps span{display:inline-flex;align-items:center;gap:6px;padding:6px 9px;border-radius:999px;background:var(--ft-paper);color:var(--ft-ink-soft);font-size:.72rem;font-weight:650}.ft-empty-steps b{display:grid;place-items:center;width:19px;height:19px;border-radius:50%;background:var(--ft-ink);color:#fff;font-size:.65rem}.ft-editor[data-theme="midnight"] .ft-empty-canvas>.ft-empty-card{background:#221c33;border-color:#3c3352}.ft-editor[data-theme="midnight"] .ft-empty-canvas h2,.ft-editor[data-theme="midnight"] .ft-empty-kicker{color:#f4f1fa}.ft-editor[data-theme="midnight"] .ft-empty-canvas p{color:#ab9fc7}.ft-editor[data-theme="midnight"] .ft-empty-steps span{background:#2b2440;color:#c8bddf}
@media(max-width:640px){.ft-empty-canvas>.ft-empty-card{padding:26px 20px;max-width:94vw}.ft-empty-canvas h2{font-size:1.85rem}.ft-empty-steps{display:grid;width:100%}.ft-empty-steps span{justify-content:flex-start}}

/* Timeline workspace: an alternate full-canvas view inside the editor. */
.ft-timeline-workspace[hidden]{display:none!important}
.ft-timeline-workspace{position:absolute;inset:0;z-index:12;display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:14px;padding:24px 28px 20px;background:linear-gradient(180deg,#fffdfa 0%,#f8f6fb 100%);overflow:hidden}
.ft-timeline-workspace-head{display:flex;align-items:flex-start;justify-content:space-between;gap:24px}
.ft-timeline-workspace-head h2{margin:2px 0 3px;font:700 clamp(1.7rem,2.3vw,2.35rem)/1.05 var(--ft-font-serif);color:var(--ft-ink)}
.ft-timeline-workspace-head p{margin:0;color:var(--ft-muted);font-size:.86rem}
.ft-timeline-workspace-kicker{display:block;font:800 .66rem var(--ft-font-sans);letter-spacing:.12em;text-transform:uppercase;color:var(--ft-meadow)}
.ft-timeline-workspace-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.ft-timeline-workspace-body{position:relative;min-width:0;min-height:0;display:grid;grid-template-columns:52px minmax(0,1fr) 52px;align-items:stretch}
.ft-timeline-workspace .ft-timeline-list{height:100%;max-height:none;min-height:0;margin:0;padding:0;overflow-x:auto;overflow-y:hidden;scroll-behavior:smooth;scrollbar-width:thin;overscroll-behavior-inline:contain}
.ft-timeline-workspace .ft-timeline-stage{height:100%;min-height:0}
.ft-timeline-workspace .ft-timeline-nav{position:relative;left:auto;right:auto;top:auto;transform:none;align-self:center;justify-self:center;z-index:4}
.ft-timeline-workspace .ft-timeline-nav:hover:not(:disabled){transform:scale(1.08)}
.ft-ed-canvas.is-timeline-view .ft-ed-stage,
.ft-ed-canvas.is-timeline-view .ft-minimap,
.ft-ed-canvas.is-timeline-view .ft-empty-canvas,
.ft-ed-canvas.is-timeline-view .ft-floatbar,
.ft-ed-canvas.is-timeline-view .ft-loading{display:none!important}
@media(min-width:901px){
.ft-editor.is-timeline-mode{grid-template-rows:60px minmax(0,1fr) 0}
}
.ft-editor.is-timeline-mode .ft-ed-bottom{display:none}
.ft-editor.is-timeline-mode .ft-ed-side{opacity:.55;pointer-events:none}
.ft-editor.is-timeline-mode .ft-gen-select,
.ft-editor.is-timeline-mode [data-action="timeline"]{opacity:.65}
@media(max-width:900px){
  .ft-timeline-workspace{padding:16px max(14px,env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));gap:10px}
  .ft-timeline-workspace-head{align-items:flex-start;gap:12px}
  .ft-timeline-workspace-head h2{font-size:1.65rem}
  .ft-timeline-workspace-actions{gap:6px}
  .ft-editor.is-timeline-mode .ft-ed-side{display:none}
  .ft-editor.is-timeline-mode{grid-template-columns:minmax(0,1fr);grid-template-areas:"top" "canvas" "bottom"}
}
@media(max-width:700px){
  .ft-timeline-workspace-head{display:grid;grid-template-columns:1fr;gap:10px}
  .ft-timeline-workspace-actions{justify-content:flex-start;width:100%}
  .ft-timeline-workspace-actions .ft-btn{min-height:44px}
  .ft-timeline-workspace-body{display:block;overflow:hidden}
  .ft-timeline-workspace .ft-timeline-list{height:100%;overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain}
  .ft-timeline-workspace .ft-timeline-nav{display:none}
}
@media(max-width:480px){
  .ft-timeline-workspace{padding-top:12px}
  .ft-timeline-workspace-head h2{font-size:1.45rem}
  .ft-timeline-workspace-head p{font-size:.78rem;line-height:1.35}
  .ft-timeline-workspace-actions{display:grid;grid-template-columns:1fr 1fr}
  .ft-timeline-workspace-actions .ft-btn{width:100%;justify-content:center;padding-inline:10px}
}
@media(max-height:520px) and (orientation:landscape) and (max-width:900px){
  .ft-timeline-workspace{padding-top:8px;gap:7px}
  .ft-timeline-workspace-head{display:flex;align-items:center;gap:10px}
  .ft-timeline-workspace-head p,.ft-timeline-workspace-kicker{display:none}
  .ft-timeline-workspace-head h2{font-size:1.25rem;margin:0}
  .ft-timeline-workspace-actions{margin-left:auto;flex-wrap:nowrap}
  .ft-timeline-workspace-actions .ft-btn{min-height:40px;padding-block:7px}
}
@media(min-width:901px){
.ft-editor.is-timeline-mode{grid-template-columns:0 minmax(0,1fr)}
}
.ft-editor.is-timeline-mode .ft-ed-side{opacity:0;overflow:hidden;pointer-events:none}

/* Launch presentation controls: connector weight readout + independent timeline palette. */
.ft-range-control{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:9px}.ft-range-control input[type=range]{min-width:0}.ft-range-control output{min-width:42px;text-align:right;color:var(--ft-ink);font:800 .7rem var(--ft-font-sans);font-variant-numeric:tabular-nums}

/* Timeline themes reuse the selected family-tree palette without changing tree data. */
.ft-timeline-workspace,.ft-dialog--timeline,.ft-dialog--timeline-story{--ft-tl-bg:#f7f5fa;--ft-tl-surface:#fff;--ft-tl-ink:#241b3b;--ft-tl-muted:#6b6384;--ft-tl-line:#c88700;--ft-tl-line-soft:#c88700;--ft-tl-accent:#f2b300;--ft-tl-border:#dcd6ea}
.ft-timeline-workspace{background:var(--ft-tl-bg);color:var(--ft-tl-ink)}
.ft-timeline-workspace-head h2,.ft-dialog--timeline .ft-dialog-head h2,.ft-timeline-story h2{color:var(--ft-tl-ink)}
.ft-timeline-workspace-head p,.ft-dialog--timeline .ft-dialog-sub,.ft-timeline-empty{color:var(--ft-tl-muted)}
.ft-timeline-workspace-kicker,.ft-timeline-people,.ft-timeline-story-people{color:var(--ft-tl-accent)}
.ft-dialog--timeline .ft-timeline-form{background:var(--ft-tl-bg);color:var(--ft-tl-ink)}
.ft-timeline-track::before{background:linear-gradient(90deg,var(--ft-tl-line),var(--ft-tl-line-soft));opacity:.7}
.ft-timeline-stem{background:linear-gradient(180deg,var(--ft-tl-line),var(--ft-tl-line-soft));opacity:.62}
.ft-timeline-photo{background:var(--ft-tl-surface);border-color:var(--ft-tl-border)}
.ft-timeline-photo img{border-color:var(--ft-tl-border)}
.ft-timeline-year,.ft-timeline-story-date{background:var(--ft-tl-surface);color:var(--ft-tl-muted);border:1px solid var(--ft-tl-border)}
.ft-timeline-text,.ft-timeline-story-copy{color:var(--ft-tl-ink)}
.ft-timeline-desc{color:var(--ft-tl-muted)}
.ft-timeline-read-story{color:var(--ft-tl-line)}
.ft-timeline-nav{background:var(--ft-tl-surface);border-color:var(--ft-tl-border);color:var(--ft-tl-ink)}
.ft-timeline-nav:hover:not(:disabled){background:var(--ft-tl-surface)}
.ft-timeline-marker{background:var(--ft-tl-surface);color:var(--ft-tl-ink);box-shadow:0 0 0 5px var(--ft-tl-bg),0 7px 14px rgba(20,15,34,.12)}
.ft-timeline-marker::before{background:var(--ft-tl-accent);border-color:var(--ft-tl-line)}
.ft-timeline-marker.has-portrait{border-color:var(--ft-tl-surface);box-shadow:0 0 0 2px var(--ft-tl-border),0 8px 18px rgba(20,15,34,.16)}
.ft-timeline-marker.has-initials{border-color:var(--ft-tl-surface);background:var(--ft-tl-border)}
.ft-timeline-entry--birth .ft-timeline-marker:not(.has-portrait):not(.has-initials)::before,.ft-timeline-entry--death .ft-timeline-marker:not(.has-portrait):not(.has-initials)::before,.ft-timeline-entry--event .ft-timeline-marker::before{background:var(--ft-tl-surface);border-color:var(--ft-tl-accent)}
.ft-timeline-story{background:var(--ft-tl-surface);color:var(--ft-tl-ink);border:1px solid var(--ft-tl-border)}
.ft-timeline-story-photo{background:var(--ft-tl-bg);border-color:var(--ft-tl-border)}
.ft-timeline-workspace .ft-btn--ghost{background:var(--ft-tl-surface);border-color:var(--ft-tl-border);color:var(--ft-tl-ink)}
.ft-timeline-workspace .ft-btn--primary{background:var(--ft-tl-ink);border-color:var(--ft-tl-ink);color:var(--ft-tl-surface)}
@media(max-width:900px){.ft-timeline-entry::before{background:linear-gradient(var(--ft-tl-line),var(--ft-tl-line-soft))}}

/* Small visual signatures make timeline choices feel like themes, not only recolours. */
[data-timeline-theme="botanical"] .ft-timeline-photo{border-radius:20px 8px 20px 8px}
[data-timeline-theme="botanical"] .ft-timeline-photo img{border-radius:15px 5px 15px 5px}
[data-timeline-theme="ink"] .ft-timeline-photo,[data-timeline-theme="ink"] .ft-timeline-nav,[data-timeline-theme="ink"] .ft-timeline-story{box-shadow:none;border-width:2px}
[data-timeline-theme="ink"] .ft-timeline-photo,[data-timeline-theme="ink"] .ft-timeline-photo img{border-radius:3px}
[data-timeline-theme="royal"] .ft-timeline-year,[data-timeline-theme="royal"] .ft-timeline-story-date{letter-spacing:.11em}
[data-timeline-theme="midnight"] .ft-timeline-photo{box-shadow:0 10px 28px rgba(0,0,0,.34)}
.ft-timeline-card-action{color:var(--ft-tl-ink);border-color:transparent}
.ft-timeline-card-action:hover{background:var(--ft-tl-surface);border-color:var(--ft-tl-border)}
