/* Creator Tree — shared viewer styles (editor + published pages). */
.ct-scene {
  --ct-branch: #6b4a2b; --ct-branch-hi: #b98a52; --ct-node: #3a2a1a; --ct-node-stroke: #e6b85c;
  --ct-leaf: #f2c45a; --ct-leaf2: #9fd36b; --ct-glow: #ffd27a; --ct-label: #f6ecd0; --ct-halo: #0b0f08;
  --ct-accent: #e6b85c; --ct-text: #f3ead2; --ct-muted: #bfb393;
  position: relative; overflow: hidden; color: var(--ct-text);
  background: #0b0f08;
}
.font-serif { font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif; }
.font-sans { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
.font-mono { font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace; }

.ct-particles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.ct-stage { position: absolute; inset: 0; z-index: 1; }
.ct-tree { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.ct-tree.is-dragging { cursor: grabbing; }

/* ---------- links ---------- */
.ct-link-main { fill: none; stroke: var(--ct-branch); stroke-linecap: round; stroke-linejoin: round; }
.ct-link-hi { fill: none; stroke: var(--ct-branch-hi); stroke-linecap: round; opacity: .55; }
.ct-link.to-project .ct-link-main { opacity: .9; }
.ct-link.is-private { opacity: .45 !important; }
.ct-link.is-private .ct-link-main { stroke-dasharray: 6 6; }

/* ---------- decor ---------- */
.ct-trunk { fill: var(--ct-branch); }
.ct-bark { fill: none; stroke: var(--ct-branch-hi); stroke-width: 2; opacity: .35; stroke-linecap: round; }
.ct-roots path { fill: none; stroke: var(--ct-branch); stroke-linecap: round; }
.ct-ground { fill: var(--ct-glow); opacity: .08; }
.ct-core-ring { fill: none; stroke: var(--ct-accent); stroke-width: 1.2; opacity: .22; }
.ct-core-ring-1 { stroke-dasharray: 4 10; }
.ct-core-ring-2 { stroke-dasharray: 1 14; opacity: .35; }

/* ---------- nodes ---------- */
.ct-node { cursor: pointer; outline: none; }
.ct-node:focus-visible .ct-sel-ring { opacity: 1; stroke: var(--ct-accent); stroke-dasharray: 3 4; }
.ct-sel-ring { fill: none; stroke: var(--ct-accent); stroke-width: 3; opacity: 0; transition: opacity .2s; }
.ct-node.is-selected .ct-sel-ring { opacity: 1; stroke-dasharray: 8 5; animation: ct-spin 6s linear infinite; transform-box: fill-box; transform-origin: center; }
.ct-node.is-private { opacity: .55; }
.ct-node.is-private .ct-branch-shape, .ct-node.is-private .ct-leaf-shape { stroke-dasharray: 4 3; }

.ct-root-glow { fill: var(--ct-glow); opacity: .14; }
.ct-root-ring { fill: var(--ct-node); stroke: var(--ct-accent); stroke-width: 4; }
.ct-initials { fill: var(--ct-accent); font-size: 34px; font-weight: 700; }

.ct-branch-shape { fill: var(--ct-node); stroke: var(--ct-node-stroke); stroke-width: 2.5; transition: transform .2s; }
.ct-branch-shape.has-color { fill-opacity: .9; stroke-opacity: 1; }
.ct-branch .ct-node-icon { color: var(--ct-node-stroke); }
.ct-branch .has-color ~ .ct-node-icon { color: #fff; }
.ct-node-emoji { fill: currentColor; }
.ct-node:hover .ct-branch-shape { stroke-width: 4; }
.ct-badge circle { fill: var(--ct-accent); stroke: var(--ct-halo); stroke-width: 2; }
.ct-badge text { fill: var(--ct-halo); font-size: 9px; font-weight: 700; font-family: system-ui, sans-serif; }

.ct-leaf { transform-box: fill-box; transform-origin: center; }
.ct-leaf-shape { fill: var(--ct-leaf); stroke: rgba(0,0,0,.25); stroke-width: .8; }
.ct-leaf-shape.alt { fill: var(--ct-leaf2); }
.ct-leaf-back { fill: var(--ct-leaf2); opacity: .85; }
.ct-leaf-detail { fill: none; stroke: rgba(0,0,0,.28); stroke-width: .9; stroke-linecap: round; }
.ct-leaf-icon { color: rgba(0,0,0,.72); }
.ct-thumb-ring { fill: var(--ct-halo); stroke: var(--ct-accent); stroke-width: 2; }
.ct-project:hover .ct-leaf { filter: brightness(1.18); }
.ct-project.no-link .ct-leaf { opacity: .7; }
.ct-project.has-pic .ct-thumb-ring { stroke-width: 3; filter: drop-shadow(0 2px 6px rgba(0,0,0,.45)); }
.ct-project.has-pic.no-link .ct-leaf { opacity: 1; }
.ct-decor { transition: transform .5s ease; }
@media (prefers-reduced-motion: reduce) { .ct-decor { transition: none; } }
.ct-link-badge circle { fill: var(--ct-accent); stroke: var(--ct-halo); stroke-width: 2; }
.ct-link-badge path, .ct-link-badge polyline, .ct-link-badge line { stroke: #14110d; }
.ct-row-link { margin-left: 6px; padding: 4px 10px; font-size: 13px; }
.ct-row-pic { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; display: block; }
/* drag & drop (editor) */
.ct-node.is-drag-src { opacity: .35; }
.ct-drag-ghost { pointer-events: none; opacity: .9; filter: drop-shadow(0 6px 12px rgba(0,0,0,.5)); }
.ct-node.is-drop-target .ct-sel-ring { opacity: 1; stroke: var(--ct-accent); stroke-width: 3; stroke-dasharray: 6 4; fill: none; }
.ct-node.is-drop-target { filter: brightness(1.25); }
.ct-tree.is-node-dragging, .ct-tree.is-node-dragging .ct-node { cursor: grabbing; }
.ct-tree.is-editing .ct-node:not(.ct-root) { cursor: grab; }

.ct-label { fill: var(--ct-label); font-size: 13px; paint-order: stroke; stroke: var(--ct-halo); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.ct-label-root { font-size: 19px; font-weight: 700; }
.ct-label-user { font-size: 12px; fill: var(--ct-muted); }
.ct-label-branch { font-size: 14px; font-weight: 700; letter-spacing: .01em; }
.depth-1 .ct-label-branch { font-size: 15.5px; }
.ct-label-project { font-size: 12.5px; }

/* ---------- theme personalities ---------- */
.theme-ancient .ct-root-ring { stroke-width: 5; }
.theme-ancient .ct-leaf-shape { fill: var(--ct-leaf); filter: drop-shadow(0 0 5px var(--ct-glow)); }
.anim-runes .ct-core-ring, .anim-runes .ct-root-glow { animation: ct-pulse 4s ease-in-out infinite; }
.anim-sway .ct-leaf, .anim-runes .ct-leaf, .anim-ember .ct-leaf { animation: ct-sway 4.5s ease-in-out infinite; }
.theme-forest .ct-leaf-shape { filter: drop-shadow(0 0 3px rgba(61,220,132,.5)); }
.theme-autumn .ct-leaf-shape { stroke: rgba(80,30,0,.4); }
.theme-cherry .ct-leaf-shape { stroke: rgba(224,90,134,.35); }
.theme-cherry .ct-leaf-detail { fill: #ffe066; stroke: none; }
.theme-cherry .ct-leaf-icon { color: #7a2a48; }
.theme-cherry .ct-label { stroke-width: 5px; }
.theme-crystal .ct-leaf-shape { fill-opacity: .82; stroke: #fff; stroke-opacity: .6; filter: drop-shadow(0 0 6px var(--ct-glow)); }
.theme-crystal .ct-leaf-detail { stroke: rgba(255,255,255,.7); }
.theme-crystal .ct-branch-shape { fill-opacity: .85; filter: drop-shadow(0 0 6px var(--ct-glow)); }
.anim-shimmer .ct-leaf { animation: ct-shimmer 3.2s ease-in-out infinite; }
.anim-shimmer .ct-core-ring { animation: ct-pulse 3s ease-in-out infinite; }
.theme-digital .ct-leaf-shape { fill: var(--ct-node); stroke: var(--ct-leaf); stroke-width: 1.6; }
.theme-digital .ct-leaf-shape.alt { stroke: var(--ct-leaf2); }
.theme-digital .ct-leaf-detail { stroke: var(--ct-leaf); stroke-width: 1.6; }
.theme-digital .ct-leaf-icon { color: var(--ct-leaf); }
.theme-digital .ct-branch-shape { filter: drop-shadow(0 0 5px var(--ct-glow)); }
.theme-digital .ct-label { letter-spacing: .03em; }
.anim-flow .ct-link-hi { stroke: #ffffff; opacity: .9; stroke-dasharray: 3 22; animation: ct-flow 1.6s linear infinite; }
.anim-flow .ct-core-ring-0 { animation: ct-spin 20s linear infinite; transform-box: fill-box; transform-origin: center; stroke-dasharray: 40 12; }
.theme-dark .ct-leaf-shape { filter: drop-shadow(0 0 6px rgba(255,59,59,.7)); stroke: rgba(0,0,0,.6); }
.theme-dark .ct-leaf-detail { fill: #ffd27a; stroke: none; opacity: .85; }
.anim-ember .ct-leaf-detail { animation: ct-flicker 1.8s ease-in-out infinite; }
.theme-minimal .ct-root-ring { stroke-width: 2; fill: #fff; stroke: var(--ct-text); }
.theme-minimal .ct-branch-shape { fill: #fff; stroke: var(--ct-text); stroke-width: 2; }
.theme-minimal .ct-branch .ct-node-icon { color: var(--ct-text); }
.theme-minimal .ct-leaf-shape { stroke: none; }
.theme-minimal .ct-leaf-icon { color: #fff; }
.theme-minimal .ct-label { stroke-width: 6px; }
.theme-minimal .ct-label-branch { font-weight: 600; }

@keyframes ct-spin { to { transform: rotate(360deg); } }
@keyframes ct-pulse { 0%, 100% { opacity: .12; } 50% { opacity: .32; } }
@keyframes ct-sway { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
@keyframes ct-shimmer { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.35) saturate(1.3); } }
@keyframes ct-flow { to { stroke-dashoffset: -25; } }
@keyframes ct-flicker { 0%, 100% { opacity: .9; } 40% { opacity: .45; } 70% { opacity: 1; } }

/* ---------- particles ---------- */
.ct-p { position: absolute; display: block; width: calc(6px * var(--s, 1)); height: calc(6px * var(--s, 1)); border-radius: 50%; opacity: 0; animation-iteration-count: infinite; animation-timing-function: linear; will-change: transform, opacity; }
.ct-p-mote { background: radial-gradient(circle, #fff4c4 0%, var(--ct-glow) 45%, transparent 70%); animation-name: ct-rise; }
.ct-p-firefly { background: radial-gradient(circle, #f4ffd6 0%, #b6ff7a 40%, transparent 70%); animation-name: ct-wander; animation-timing-function: ease-in-out; }
.ct-p-fall { width: calc(12px * var(--s, 1)); height: calc(9px * var(--s, 1)); border-radius: 80% 10% 80% 10%; background: var(--ct-leaf); animation-name: ct-fall; }
.ct-p-fall:nth-child(2n) { background: var(--ct-leaf2); }
.ct-p-petal { width: calc(10px * var(--s, 1)); height: calc(8px * var(--s, 1)); border-radius: 100% 0 100% 0; background: #ffb3c9; animation-name: ct-fall; }
.ct-p-petal:nth-child(3n) { background: #ffd6e3; }
.ct-p-shard { width: calc(5px * var(--s, 1)); height: calc(12px * var(--s, 1)); border-radius: 1px; background: linear-gradient(180deg, #fff, var(--ct-leaf)); transform: rotate(45deg); animation-name: ct-twinkle; animation-timing-function: ease-in-out; }
.ct-p-bit { width: auto; height: auto; border-radius: 0; font: 10px/1 ui-monospace, Consolas, monospace; color: var(--ct-glow); animation-name: ct-fall; }
.ct-p-bit::before { content: "1"; }
.ct-p-bit:nth-child(2n)::before { content: "0"; }
.ct-p-ember { background: radial-gradient(circle, #ffd27a 0%, #ff4d2e 45%, transparent 72%); animation-name: ct-rise; }
@keyframes ct-rise { 0% { transform: translate(0, 40px); opacity: 0; } 15% { opacity: .9; } 85% { opacity: .7; } 100% { transform: translate(var(--dx, 20px), -160px); opacity: 0; } }
@keyframes ct-wander { 0% { transform: translate(0, 0); opacity: 0; } 20% { opacity: 1; } 50% { transform: translate(var(--dx, 30px), -40px); opacity: .3; } 80% { opacity: 1; } 100% { transform: translate(0, -80px); opacity: 0; } }
@keyframes ct-fall { 0% { transform: translate(0, -60vh) rotate(0); opacity: 0; } 10% { opacity: .9; } 90% { opacity: .8; } 100% { transform: translate(var(--dx, 40px), 60vh) rotate(540deg); opacity: 0; } }
@keyframes ct-twinkle { 0%, 100% { opacity: 0; transform: rotate(45deg) scale(.6); } 50% { opacity: .9; transform: rotate(45deg) scale(1.1); } }
@media (prefers-reduced-motion: reduce) {
  .ct-scene *, .ct-scene *::before { animation: none !important; transition: none !important; }
}

/* ---------- list mode ---------- */
.ct-list { position: absolute; inset: 0; overflow: auto; padding: 24px 16px 120px; z-index: 1; -webkit-overflow-scrolling: touch; }
.ct-list > * { max-width: 820px; margin-left: auto; margin-right: auto; }
.ct-list-profile { display: flex; gap: 16px; align-items: center; padding: 18px; border-radius: 18px; background: color-mix(in srgb, var(--ct-halo) 70%, transparent); border: 1px solid color-mix(in srgb, var(--ct-accent) 35%, transparent); margin-bottom: 18px; backdrop-filter: blur(6px); }
.ct-list-profile.is-selected { outline: 2px solid var(--ct-accent); }
.ct-avatar { width: 72px; height: 72px; flex: none; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--ct-node); color: var(--ct-accent); font-size: 30px; font-weight: 700; border: 3px solid var(--ct-accent); }
.ct-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ct-list-profile-body { flex: 1; min-width: 0; }
.ct-list-name { margin: 0; font-size: 1.5rem; line-height: 1.2; overflow-wrap: anywhere; }
.ct-list-user { color: var(--ct-muted); font-size: .9rem; }
.ct-list-bio { margin: 6px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.ct-list-empty { text-align: center; color: var(--ct-muted); padding: 40px 0; }
.ct-list-tree, .ct-list-group { list-style: none; margin: 0; padding: 0; }
.ct-list-group { margin-left: 14px; padding-left: 14px; border-left: 2px solid color-mix(in srgb, var(--branch-color, var(--ct-branch)) 70%, transparent); }
.ct-li { margin: 6px 0; }
.ct-row { display: flex; align-items: center; gap: 6px; }
.ct-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--branch-color, var(--ct-accent)) 30%, transparent); background: color-mix(in srgb, var(--ct-halo) 62%, transparent); color: var(--ct-text); font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.ct-toggle:hover { border-color: var(--branch-color, var(--ct-accent)); }
.ct-toggle:focus-visible { outline: 2px solid var(--ct-accent); outline-offset: 2px; }
.ct-row-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: color-mix(in srgb, var(--branch-color, var(--ct-accent)) 30%, transparent); color: var(--ct-text); flex: none; }
.ct-row-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ct-row-count { font-weight: 400; font-size: .8rem; color: var(--ct-muted); white-space: nowrap; }
.ct-row-desc { margin: 4px 0 4px 52px; color: var(--ct-muted); font-size: .92rem; white-space: pre-line; overflow-wrap: anywhere; }
.ct-li.is-selected > .ct-row > .ct-toggle, .ct-li.is-selected > .ct-card { outline: 2px solid var(--ct-accent); outline-offset: 1px; }
.ct-li.is-private > .ct-row > .ct-toggle, .ct-li.is-private > .ct-card { border-style: dashed; opacity: .75; }
.ct-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 14px; background: color-mix(in srgb, var(--ct-halo) 72%, transparent); border: 1px solid color-mix(in srgb, var(--ct-text) 14%, transparent); }
.ct-card-thumb { width: 56px; height: 56px; flex: none; border-radius: 12px; overflow: hidden; display: grid; place-items: center; background: color-mix(in srgb, var(--ct-accent) 22%, transparent); color: var(--ct-text); }
.ct-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ct-card-body { flex: 1; min-width: 0; }
.ct-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ct-card-title { font-weight: 700; color: var(--ct-text); text-decoration: none; overflow-wrap: anywhere; }
a.ct-card-title:hover { text-decoration: underline; }
.ct-card-desc { margin: 4px 0 6px; font-size: .92rem; color: var(--ct-muted); white-space: pre-line; overflow-wrap: anywhere; }
.ct-card-foot { font-size: .85rem; }
.ct-open { display: inline-flex; align-items: center; gap: 6px; color: var(--ct-accent); text-decoration: none; font-weight: 600; overflow-wrap: anywhere; }
.ct-open:hover { text-decoration: underline; }
.ct-nolink { color: var(--ct-muted); font-style: italic; }
.ct-chip { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: .72rem; font-weight: 700; letter-spacing: .02em; background: color-mix(in srgb, var(--ct-accent) 22%, transparent); color: var(--ct-text); border: 1px solid color-mix(in srgb, var(--ct-accent) 40%, transparent); font-family: system-ui, sans-serif; }
.ct-chip-private { background: transparent; border-style: dashed; }
.ct-status-released { background: rgba(60, 200, 120, .25); border-color: rgba(60, 200, 120, .5); }
.ct-status-in-development, .ct-status-beta { background: rgba(240, 170, 40, .25); border-color: rgba(240, 170, 40, .5); }
.ct-status-archived { opacity: .7; }
.ct-emoji { line-height: 1; }
.ct-row-actions { display: flex; gap: 4px; flex: none; }
@media (max-width: 600px) {
  .ct-row { flex-wrap: wrap; }
  .ct-row > .ct-toggle { flex-basis: 100%; }
  .ct-row > .ct-row-actions { margin-left: auto; }
  .ct-card { flex-wrap: wrap; }
  .ct-card > .ct-row-actions { width: 100%; justify-content: flex-end; }
  .ct-list-group { margin-left: 6px; padding-left: 10px; }
  .ct-row-desc { margin-left: 8px; }
  .ct-list-profile { padding: 14px; }
  .ct-avatar { width: 56px; height: 56px; font-size: 24px; }
}

/* project popover (touch / keyboard) */
.ct-pop { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(440px, calc(100% - 32px)); z-index: 20; padding: 16px; border-radius: 18px; background: color-mix(in srgb, var(--ct-halo) 92%, transparent); border: 1px solid color-mix(in srgb, var(--ct-accent) 45%, transparent); color: var(--ct-text); box-shadow: 0 18px 50px rgba(0,0,0,.45); backdrop-filter: blur(10px); }
.ct-pop-head { display: flex; gap: 12px; align-items: center; }
.ct-pop h3 { margin: 0; font-size: 1.1rem; overflow-wrap: anywhere; flex: 1; }
.ct-pop p { margin: 8px 0 12px; color: var(--ct-muted); white-space: pre-line; overflow-wrap: anywhere; }
.ct-pop-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ct-pop-report, .ct-card-report { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; padding: 6px 10px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--ct-muted) 40%, transparent); background: transparent; color: var(--ct-muted); font: inherit; font-size: .8rem; cursor: pointer; }
.ct-pop-report:hover, .ct-card-report:hover { color: var(--ct-text); border-color: var(--ct-text); }
.ct-card-report { margin-left: 8px; padding: 3px 8px; }
.ct-pop-ext { margin: 10px 0 0; font-size: .78rem; color: var(--ct-muted); line-height: 1.4; }
.ct-link-badge-p circle { fill: var(--ct-halo); stroke: var(--ct-accent); stroke-width: 1.5; }
.ct-pop .ct-card-thumb { width: 48px; height: 48px; }
.ct-btn-link { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px; background: var(--ct-accent); color: var(--ct-halo); text-decoration: none; font-weight: 700; }
.ct-btn-link:hover { filter: brightness(1.08); }
