@import url("./lineage-board.css");

body:has(.lineage-editor) { min-height:100svh; background:var(--pm-canvas); }
#studio-main:has(.lineage-editor) { padding-top:12px; }
#studio-main:has(.lineage-editor) .project-save-state,
.lineage-editor { width:100%; max-width:840px; min-width:0; margin:0 auto; }
.lineage-editor { color:var(--pm-ink); font-family:var(--pm-font); }
.lineage-editor [hidden] { display:none !important; }
.lg-sr { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.lg-heading,.lg-tools,.lg-dialog-head,.lg-dialog-foot,.lg-identity,.lg-favorite,.lg-placement,.lg-placement>div {
  display:flex; align-items:center; gap:8px;
}
.lg-heading { padding:8px 0 14px; border-bottom:1px solid var(--pm-line); }
.lg-heading>button,.lg-menu summary,.lg-tools>button,.lineage-editor dialog button { min-height:44px; border-radius:9px; }
.lg-heading [data-lg=back],.lg-menu summary,.lg-tools [data-lg=undo],.lg-dialog-head button { flex:none; width:44px; padding:0; font-size:22px; }
.lg-heading input { width:0; min-width:0; flex:1; padding:6px 3px; font:710 clamp(18px,3vw,27px)/1.4 var(--pm-font); color:inherit; letter-spacing:-.045em; border:0; border-radius:5px; background:transparent; }
.lg-heading input:hover,.lg-heading input:focus { background:#fff; }
.lg-heading [data-lg=png] { flex:none; padding-inline:14px; background:var(--pm-ink); color:#fff; border-color:var(--pm-ink); font-weight:600; }
.lg-menu { position:relative; }
.lg-menu summary { display:grid; place-items:center; cursor:pointer; list-style:none; background:#fff; border:1px solid var(--pm-line); }
.lg-menu summary::-webkit-details-marker { display:none; }
.lg-menu>div { position:absolute; top:calc(100% + 5px); right:0; z-index:5; width:180px; padding:5px; border:1px solid var(--pm-line); border-radius:10px; background:#fff; box-shadow:0 6px 24px #49323d11; }
.lg-menu button { width:100%; justify-content:flex-start; border:0; }
.lg-menu button:hover { background:var(--pm-canvas); }
.lg-tools { padding:16px 0 0; }
.lg-tools [data-lg=undo] { margin-left:auto; background:transparent; border-color:transparent; }
.lg-tools [data-lg=undo] svg { width:19px; height:19px; pointer-events:none; }
.lineage-editor button:not([data-person],[data-resize-person]),.lineage-editor summary,.lineage-editor a { touch-action:manipulation; }
.lg-hint { margin:10px 1px 16px; color:var(--pm-muted); font-size:14px; line-height:1.6; word-break:keep-all; }
.lg-sheet { min-width:0; background:white; padding:clamp(12px,2.5vw,30px) 10px; border:1px solid var(--pm-line); border-radius:18px; box-shadow:0 4px 20px #4e323a06; }
.lg-blank { padding:90px 8px; text-align:center; color:var(--pm-muted); font-weight:600; }
.lg-placement { position:sticky; top:max(8px,env(safe-area-inset-top)); z-index:3; justify-content:space-between; flex-wrap:wrap; gap:4px 10px; padding:8px 12px; margin-bottom:12px; border:1px solid #e6c7d1; border-radius:12px; background:#fff9fb; box-shadow:0 3px 12px #64334b0d; font-size:14px; overflow-wrap:anywhere; }
.lg-placement>div { gap:5px; }
.lg-placement button { padding:4px 9px; font-size:13px; }
.lg-placement [data-lg=root] { color:var(--pm-accent); }
.lg-tray-panel { margin:12px 0; }
.lg-tray-panel h2 { margin:0; font-size:15px; font-weight:640; }
.lg-tray-panel [data-lg=count] { margin-left:3px; color:var(--pm-muted); font-size:12px; }
.lg-tray { display:flex; gap:8px; overflow-x:auto; padding:6px 3px; }
.lg-tray button { display:flex; flex-direction:column; flex:none; justify-content:flex-start; align-items:center; gap:3px; min-width:72px; max-width:116px; padding:8px; border-radius:10px; font-size:12px; touch-action:pan-x; user-select:none; }
.lg-tray-name,.lg-tray-work { max-width:100%; text-overflow:ellipsis; overflow:hidden; white-space:nowrap; }
.lg-tray-work,.lg-optional { font-size:12px; color:var(--pm-muted); font-weight:400; }
.lg-tools + .lg-hint[hidden] ~ .lg-sheet { margin-top:14px; }
.lg-face { display:grid; place-items:center; width:38px; height:38px; border-radius:50%; overflow:hidden; }
.lg-face img { width:100%; height:100%; object-fit:cover; pointer-events:none; }
.lg-face svg { width:70%; height:70%; fill:currentColor; }
.lineage-editor [data-person].is-target .lineage-face { outline:3px solid var(--pm-accent); outline-offset:3px; }
.lg-ghost { position:fixed; z-index:20; pointer-events:none; transform:translate(-50%,-115%); border-radius:16px; background:#fff; border:1px solid #e4c9d3; padding:7px 11px; color:var(--pm-accent); font-size:13px; box-shadow:0 3px 14px #68344926; }
.lg-status { color:var(--pm-muted); margin:12px 0 0; font-size:13px; line-height:1.6; }
.lg-status:empty { display:none; }
.lineage-editor dialog { width:min(380px,calc(100vw - 24px)); max-height:calc(100dvh - 24px); padding:20px; overflow:auto; color:inherit; border:1px solid var(--pm-line); border-radius:16px; box-shadow:0 12px 42px #46313a22; }
.lineage-editor dialog::backdrop { background:#30272970; }
.lineage-editor dialog form { display:grid; gap:15px; }
.lineage-editor dialog label { font-size:14px; font-weight:580; }
.lg-dialog-head,.lg-dialog-foot { justify-content:space-between; }
.lg-dialog-head h2 { margin:0; font-size:20px; letter-spacing:-.04em; }
.lg-dialog-head button { border:0; font-size:26px; }
.lg-dialog-foot { padding-top:14px; border-top:1px solid var(--pm-line); }
.lg-quiet { color:var(--pm-muted); border:0; }
.lg-identity { gap:14px; }
.lg-identity label { flex:1; min-width:0; }
.lineage-editor dialog input:not([type=checkbox]) { display:block; width:100%; margin-top:6px; min-height:44px; border:1px solid var(--pm-line); border-radius:8px; padding:8px 10px; font:inherit; font-size:16px; }
.lg-identity [data-lg=change-photo] { position:relative; display:grid; place-items:center; width:96px; height:96px; flex:none; padding:0; border:0; background:transparent; }
.lg-identity .lg-face { width:var(--edit-diameter); height:var(--edit-diameter); }
.lg-size { display:flex; align-items:center; gap:4px; font-size:14px; }
.lg-size > span { margin-right:auto; font-weight:580; }
.lg-size button { width:44px; padding:0; font-size:20px; }
.lg-size output { min-width:58px; text-align:center; font-variant-numeric:tabular-nums; }
.lg-photo-mark { position:absolute; right:-2px; bottom:-2px; color:white; background:var(--pm-accent); border:2px solid white; border-radius:50%; width:23px; height:23px; font-weight:650; }
.lg-favorite { min-height:42px; }
.lg-favorite input { width:18px; height:18px; accent-color:var(--pm-accent); }
.lineage-editor [data-lg=move] { justify-content:space-between; }
.lineage-editor [data-lg=move] span { color:var(--pm-accent); }
.lineage-editor dialog.lg-png { width:min(760px,calc(100vw - 24px)); }
.lg-png img { display:block; max-width:100%; max-height:calc(100dvh - 190px); margin:12px auto; object-fit:contain; border:1px solid var(--pm-line); }
.lg-png .lg-dialog-foot { justify-content:flex-end; }
.lg-face.is-square { border-radius:8%; }
.lg-frame-tools,.lg-frame-tools label,.lg-zoom { display:flex; align-items:center; gap:8px; }
.lg-frame-tools { justify-content:space-between; flex-wrap:wrap; }
.lg-frame-tools select { min-height:42px; padding:4px 8px; border:1px solid var(--pm-line); border-radius:7px; background:#fff; font:inherit; }
.lineage-editor dialog .lg-zoom input[type=range] { flex:1; width:0; margin:0; padding:0; accent-color:var(--pm-accent); }
.lg-zoom output { min-width:4ch; text-align:right; }
.lg-frame-stage { position:relative; width:min(100%,260px,44dvh); margin:14px auto; aspect-ratio:1; border-radius:50%; overflow:hidden; background:#eef0f2; touch-action:none; cursor:grab; }
.lg-frame-stage.is-square { border-radius:8%; }
.lg-frame-stage:active { cursor:grabbing; }
.lg-frame-stage img { position:absolute; max-width:none; max-height:none; pointer-events:none; user-select:none; }
.lineage-editor [data-frame=status],.lineage-editor [data-lg=png-count] { margin:10px 0; font-size:14px; }
.lineage-editor [data-lg=frame-dialog] .lg-dialog-foot { margin-top:10px; }
.lineage-editor .lg-identity .lg-face { width:max(54px,var(--edit-diameter)); height:max(54px,var(--edit-diameter)); }
@media(max-width:600px) {
  #studio-main:has(.lineage-editor) { padding:8px 12px 40px; }
  .lg-heading { gap:5px; padding-bottom:10px; }
  .lg-heading [data-lg=png] { padding:6px 10px; }
  .lg-tools { padding-top:10px; }
  .lg-hint { margin:9px 1px 12px; font-size:13px; }
  .lg-sheet { padding:8px 2px; border-radius:15px; }
}
