/* The graph is the full play page, including device safe areas. */
.mivo-play-design #script-workspace > .script-play-shell.is-world-graph-page {
    position:fixed;inset:0;width:100%;height:100%;height:100dvh;max-width:none;margin:0;padding:0;overflow:hidden
}
.mivo-play-design .is-world-graph-page[data-play-tab=world]>.sw-graph-page {
    height:100%;max-width:none;gap:0;padding:0;overflow:hidden
}
.sw-graph-back {display:inline-flex;align-items:center;justify-content:center;flex:none}
.sw-graph-back svg {width:18px;height:18px}
.sw-graph,.sw-graph *,.sw-graph-entry{box-sizing:border-box}
.sw-graph{
    --graph-ink:var(--main-color,#322b25);--graph-muted:var(--muted-color,#766c60);
    --graph-paper:var(--main-bg-color,#fffdfa);--graph-accent:#985b22;--graph-warm:#c5a57c;
    --graph-board:#f7f4eb;
    --graph-rule:#dfd3bd;
    --graph-tone:var(--graph-accent);position:relative;display:flex;flex-direction:column;width:100%;height:100%;
    --play-safe-top:var(--mivo-cutout-top,env(safe-area-inset-top,0px));--script-edge-base:var(--graph-paper);
    background-color:var(--graph-board);background-image:radial-gradient(#e4daca .8px,transparent 1px);background-image:radial-gradient(color-mix(in srgb,var(--graph-warm) 35%,transparent) .8px,transparent 1px);background-size:23px 23px;
    color:var(--graph-ink);isolation:isolate
}
@supports (color:color-mix(in srgb,white,black)){
    .sw-graph{--graph-board:color-mix(in srgb,var(--graph-paper) 88%,#d2bd94);--graph-rule:color-mix(in srgb,var(--graph-paper) 57%,var(--graph-warm))}
}
.sw-graph [data-tone=family]{--graph-tone:#d97706}.sw-graph [data-tone=romance]{--graph-tone:#db2777}
.sw-graph [data-tone=ally]{--graph-tone:#059669}.sw-graph [data-tone=neutral]{--graph-tone:#4f46e5}
.sw-graph [data-tone=tension]{--graph-tone:#ea580c}.sw-graph [data-tone=hostile]{--graph-tone:#dc2626}
.sw-graph-entry{position:relative}
.sw-graph-entry .sw-degree{min-width:17px;height:17px;padding:0 4px;line-height:17px;border-radius:12px;background:var(--focus-color);color:#fff;font:600 10px/17px system-ui}
.sw-graph-entry .sw-sync-dot{position:absolute;right:1px;top:1px;width:7px;height:7px;border-radius:50%;background:var(--focus-color);box-shadow:0 0 0 2px var(--main-bg-color)}
.sw-graph-bar,.sw-graph-tools{position:relative;z-index:3;flex:none;display:flex;align-items:center;gap:10px;padding-inline:max(16px,var(--mivo-cutout-left,env(safe-area-inset-left,0px))) max(16px,var(--mivo-cutout-right,env(safe-area-inset-right,0px)))}
.sw-graph-bar{justify-content:space-between;padding-top:calc(var(--play-safe-top) + 10px);padding-bottom:6px}
.sw-graph-title,.sw-graph-actions,.sw-inspector-heading,.sw-inspector-footer,.sw-person-summary{display:flex;align-items:center;gap:8px}
.sw-graph-title{min-width:0}.sw-graph-title>svg{flex:none;width:34px;height:34px;margin:0;padding:7px;border:1px solid var(--graph-rule);border-radius:12px;color:var(--graph-accent);background:var(--graph-board)}
.sw-graph-title h1,.sw-graph-sheet h3{margin:0;font-size:16px;line-height:1.25;color:inherit}.sw-graph-title small{display:block;white-space:nowrap;font-size:11px;color:var(--graph-muted)}
.sw-graph :is(.but,.sw-icon),.sw-graph-more>summary{
    margin:0;padding:5px 10px;min-height:30px;line-height:1.3;border:1px solid var(--graph-rule);border-radius:12px;
    background:var(--graph-paper);color:var(--graph-ink);font-size:12px;box-shadow:none;cursor:pointer
}
.sw-graph :is(.but,.sw-icon):disabled{opacity:.52;cursor:default}
.sw-graph :is(.but.c-theme,.but[aria-pressed=true]){background:var(--graph-board);border-color:var(--graph-accent);color:var(--graph-accent)}
.sw-graph .sw-icon,.sw-graph-more>summary{display:grid;place-items:center;padding:0;width:34px;height:34px;min-width:32px}
.sw-graph :is(.sw-icon,.sw-graph-more>summary) svg{display:block;width:16px;height:16px;margin:0;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round;stroke-linecap:round}
.sw-graph-actions>.sw-icon,.sw-graph-hint>.sw-icon,.sw-inspector-heading>.sw-icon,.sw-graph-sheet>header>.sw-icon {flex:none;border-radius:50%}
.sw-graph-actions{flex:none;gap:6px}.sw-graph-actions>.but{min-height:34px;font-weight:600;white-space:nowrap}
.sw-graph-more{position:relative}.sw-graph-more>summary{list-style:none}.sw-graph-more>summary::-webkit-details-marker{display:none}
.sw-graph-menu,.sw-hits{position:absolute;z-index:9;display:grid;gap:2px;padding:6px;border:1px solid var(--graph-rule);border-radius:12px;box-shadow:0 5px 22px #24170d24;background:var(--graph-paper)}
.sw-graph-menu{right:0;top:calc(100% + 5px);min-width:max-content}
.sw-graph :is(.sw-graph-menu,.sw-hits)>.but{text-align:left;background:transparent;border-color:transparent}
.sw-graph :is(.sw-graph-menu,.sw-hits)>.but:hover{background:var(--graph-board)}
.sw-graph-tools{padding-bottom:9px;z-index:2;border-bottom:1px solid var(--graph-rule)}
.sw-graph .sw-search{position:relative;flex:0 1 318px;width:auto;min-width:130px;margin:0;border:1px solid var(--graph-rule);border-radius:11px;background:var(--graph-board)}
.sw-graph .sw-search input{height:32px;min-height:0;color:var(--graph-ink);background:transparent;border:0;font-size:13px}
.sw-hits{left:max(16px,var(--mivo-cutout-left,env(safe-area-inset-left,0px)));top:calc(100% - 7px);min-width:160px;max-width:min(320px,calc(100vw - 32px));max-height:36dvh;overflow:auto}
.sw-hits:empty{display:none}.sw-hits small{padding:5px;color:var(--graph-muted)}
.sw-filters{display:flex;gap:5px;min-width:0;overflow-x:auto}
.sw-filters>.but,.sw-tone-choices>.but{display:inline-flex;flex:none;align-items:center;justify-content:center;gap:4px;border-radius:99px;min-height:27px;white-space:nowrap}
.sw-graph [data-tone].but::before{content:'';display:inline-block;width:6px;height:6px;border-radius:50%;background:var(--graph-tone)}
.sw-canvas{
    flex:1;min-height:0;position:relative;overflow:hidden;touch-action:none;isolation:isolate;cursor:grab
}
.sw-stage{position:absolute;left:50%;top:50%;width:0;height:0;transform-origin:0 0}
.sw-lines{max-width:none;max-height:none;position:absolute;left:0;top:0;width:1px;height:1px;overflow:visible;pointer-events:none}
.sw-lines line{stroke:var(--graph-tone);stroke-width:2;pointer-events:stroke;cursor:pointer}
.sw-lines .sw-player-line{stroke-dasharray:5 4}.sw-lines .sw-connector{stroke:var(--graph-accent);stroke-dasharray:4 3;pointer-events:none}
.sw-node-wrap{position:absolute;width:0;height:0;z-index:2;touch-action:none;color:var(--graph-tone)}
.sw-node-wrap.is-dim,.sw-edge.is-dim,.sw-lines line.is-dim{opacity:.17}
.sw-node{position:absolute;left:0;top:0;display:flex;flex-direction:column;align-items:center;gap:5px;width:125px;padding:0;transform:translate(-50%,-33px);border:0;background:transparent;color:var(--graph-ink);font:inherit;text-align:center;cursor:grab;user-select:none;touch-action:none}
.sw-node-face{position:relative;display:grid;place-items:center;width:66px;height:66px;border:2px solid var(--graph-tone);border:2px solid color-mix(in srgb,var(--graph-tone) 64%,var(--graph-paper));border-radius:50%;background:var(--graph-paper);box-shadow:0 1px 3px #38281428}
.sw-node-photo{display:grid;place-items:center;width:100%;height:100%;border-radius:inherit;object-fit:cover;color:var(--graph-tone);background:var(--graph-paper);background:color-mix(in srgb,var(--graph-paper) 90%,var(--graph-tone));font-size:25px}
.sw-node-crop{display:block;position:absolute;inset:0;overflow:hidden;border-radius:inherit;pointer-events:none}
.sw-graph .sw-node-crop>.sw-node-photo{width:100%;height:100%;object-fit:cover;border-radius:inherit}
.sw-graph .sw-node-crop>.sw-portrait-avatar{position:absolute;inset:0;object-position:center 12%;transform:scale(1.45);transform-origin:center 13%}
.sw-portrait-avatar{object-position:center 12%}
.sw-node.is-player,.sw-node-wrap.is-player .sw-node{cursor:pointer}.sw-node-wrap.is-player .sw-node-face{border-color:var(--graph-accent)}
.sw-node-wrap.is-hit .sw-node-face{outline:3px solid var(--graph-tone);outline-offset:4px}
.sw-node-face .sw-degree,.sw-hero-label{display:grid;place-items:center;position:absolute;min-width:17px;height:17px;padding:0 3px;border-radius:12px;border:1px solid var(--graph-tone);color:var(--graph-tone);background:var(--graph-paper);font:700 11px/1 system-ui}
.sw-node-face .sw-degree{right:-9px;top:-2px}.sw-hero-label{left:50%;bottom:-7px;transform:translateX(-50%);white-space:nowrap;background:var(--graph-accent);color:#fff;border-color:var(--graph-accent)}
.sw-node-label{display:grid;gap:1px;max-width:125px;min-width:65px;padding:5px 9px;border:1px solid var(--graph-rule);border-radius:10px;background:var(--graph-paper);box-shadow:0 1px 3px #38281422}
.sw-node-label strong,.sw-node-label small{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.4;font-size:12px}
.sw-node-label small{font-size:10px;color:var(--graph-muted)}.is-player .sw-node-label{margin-top:4px;min-width:0}
.sw-port{position:absolute;left:20px;top:13px;width:23px;height:23px;padding:0;border:0;background:transparent;touch-action:none;cursor:crosshair}
.sw-port::after{content:'';position:absolute;inset:7px;border:1px solid var(--graph-tone);border-radius:100%;background:var(--graph-paper);opacity:.58}
.sw-node-wrap:hover .sw-port::after,.sw-port:focus-visible::after{opacity:1;background:var(--graph-tone)}
.sw-edge{position:absolute;z-index:1;transform:translate(-50%,-50%);max-width:140px;padding:2px 8px;border:1px solid var(--graph-tone);border:1px solid color-mix(in srgb,var(--graph-tone) 65%,var(--graph-paper));border-radius:99px;background:var(--graph-paper);color:var(--graph-tone);font-family:inherit;font-size:11px;font-weight:600;line-height:1.35;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}
.sw-edge.is-selected{background:var(--graph-tone);color:#fff;border-color:var(--graph-tone);z-index:3}
.sw-zoom{position:absolute;z-index:3;top:14px;left:max(14px,var(--mivo-cutout-left,var(--mivo-cutout-left,env(safe-area-inset-left,0px))));display:grid;border:1px solid var(--graph-rule);border-radius:6px;overflow:hidden;box-shadow:0 1px 4px #38281416}
.sw-zoom>.but,.sw-zoom>.sw-icon{display:grid;place-items:center;width:29px;min-width:0;min-height:29px;height:29px;padding:0;border-radius:0;border:0;font-size:17px;background:var(--graph-paper)}
.sw-zoom>:not(:last-child){border-bottom:1px solid var(--graph-rule)}
.sw-graph-hint,.sw-graph-status,.sw-graph-inspector{position:absolute;z-index:4;bottom:max(20px,var(--mivo-cutout-bottom,env(safe-area-inset-bottom)));left:50%;transform:translateX(-50%);width:min(512px,calc(100% - 24px));margin:0;background:var(--graph-paper);border:1px solid var(--graph-rule);border-radius:15px;padding:14px 16px;box-shadow:0 5px 18px #3828141f;color:var(--graph-ink);cursor:auto}
.sw-graph-hint{display:flex;gap:12px;align-items:center;justify-content:space-between}.sw-graph-hint small{font-size:12px;line-height:1.6}
.sw-graph .sw-graph-hint .sw-icon,.sw-graph .sw-inspector-heading .sw-icon,.sw-graph-sheet header .sw-icon{flex:none;border:0;background:transparent}
.sw-graph-status{z-index:5;bottom:auto;top:14px;width:max-content;max-width:calc(100% - 96px);padding:6px 12px;font-size:12px}
.sw-graph-inspector{border-color:color-mix(in srgb,var(--graph-tone) 44%,var(--graph-paper));max-height:38vh;max-height:min(38dvh,320px);overflow:auto;overscroll-behavior:contain}
.sw-graph-inspector[hidden],.sw-graph-hint[hidden],.sw-graph-status[hidden],.sw-graph [hidden]{display:none!important}
.sw-inspector-heading{font-size:14px;flex-wrap:wrap;gap:6px}.sw-inspector-heading>.sw-icon{margin-left:auto}
.sw-inspector-heading small,.sw-inspector-footer small,.sw-person-summary,.sw-related-list small{color:var(--graph-muted);font-size:12px}
.sw-inspector-photo{width:33px;height:33px;object-fit:cover;border-radius:50%;font-size:15px}
.sw-tone-label{padding:3px 8px;border-radius:99px;background:color-mix(in srgb,var(--graph-tone) 12%,var(--graph-paper));color:var(--graph-tone);font-size:12px;overflow-wrap:anywhere}
.sw-graph-inspector p{font-size:13px;line-height:1.6;margin:7px 0 13px;white-space:pre-wrap}.sw-inspector-footer{justify-content:flex-end}.sw-inspector-footer small{margin-right:auto}
.sw-person-summary{margin-top:8px;flex-wrap:wrap}.sw-person-summary>.but{margin-left:auto}.sw-related-list{display:flex;gap:5px;flex-wrap:wrap;margin-top:10px}
.sw-sheet-overlay{position:absolute;z-index:7;inset:0;display:grid;place-items:center;padding:max(12px,env(safe-area-inset-top)) max(12px,var(--mivo-cutout-right,env(safe-area-inset-right,0px))) max(12px,env(safe-area-inset-bottom)) max(12px,var(--mivo-cutout-left,env(safe-area-inset-left,0px)));background:#201c166e}
.sw-graph-sheet{display:flex;flex-direction:column;width:min(448px,100%);max-height:100%;min-height:0;background:var(--graph-paper);border:1px solid var(--graph-rule);border-radius:16px;box-shadow:0 18px 60px #20140938;overflow:hidden}
.sw-graph-sheet>header,.sw-sheet-footer{display:flex;flex:none;align-items:center;justify-content:space-between;gap:10px;padding:10px 14px;border-bottom:1px solid var(--graph-rule)}
.mivo-play-design .sw-graph-page .sw-graph .but{background:var(--graph-paper);color:var(--graph-ink);border-color:var(--graph-rule)}
.mivo-play-design .sw-graph-page .sw-graph .but[aria-pressed=true]{background:var(--graph-board);color:var(--graph-accent);border-color:var(--graph-accent)}
.mivo-play-design .sw-graph-page .sw-graph .sw-sheet-footer .c-theme,.mivo-play-design .sw-graph-page .sw-graph .sw-inspector-footer .c-theme{background:var(--graph-accent);color:#fff;border-color:var(--graph-accent)}
.sw-graph-sheet>header h3{font-size:15px}.sw-sheet-body{display:grid;align-content:start;gap:10px;min-height:0;padding:14px 16px;overflow:auto;overscroll-behavior:contain}
.sw-sheet-body strong,.sw-sheet-body p,.sw-sheet-body .script-field{margin:0;font-size:13px}
.sw-sheet-body :is(.script-input,textarea){width:100%;min-width:0;margin:0;min-height:34px;background:var(--graph-board);border:1px solid var(--graph-rule);border-radius:10px;color:var(--graph-ink);font-size:13px}
.sw-sheet-body textarea{min-height:60px;resize:vertical}.sw-endpoints{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);gap:6px;align-items:end}.sw-endpoints>.but{min-height:34px}
.sw-current-relation,.sw-edge-fields{position:relative}.sw-current-relation{display:flex;align-items:center;justify-content:space-between;gap:5px;padding:5px 8px;background:var(--graph-board);border-radius:9px}
.sw-current-relation small,.sw-sheet-note{font-size:11px;color:var(--graph-muted)}.sw-current-relation>.but{flex:none}
.sw-edge-fields{display:grid;gap:3px}.sw-edge-fields>.but{justify-self:end;color:var(--graph-accent);border:0;background:transparent;padding:2px 0;min-height:22px}
.sw-presets{display:flex;flex-wrap:wrap;gap:4px}.sw-presets>.but{padding:2px 8px;min-height:22px;border-radius:99px;font-size:11px}
.sw-tone-choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}.sw-tone-choices>.but:first-child{grid-column:1/-1;justify-self:start}
.sw-sheet-footer{justify-content:flex-end;border:0;border-top:1px solid var(--graph-rule)}.sw-sheet-footer>.but{min-height:32px}
.sw-sheet-footer>.c-theme{background:var(--graph-accent);color:#fff}
.sw-graph :is(.sw-filters,.sw-hits,.sw-graph-inspector,.sw-sheet-body){scrollbar-width:none}.sw-graph :is(.sw-filters,.sw-hits,.sw-graph-inspector,.sw-sheet-body)::-webkit-scrollbar{display:none}
@media(max-width:640px){
    .sw-graph-bar,.sw-graph-tools{padding-inline:max(9px,var(--mivo-cutout-left,env(safe-area-inset-left,0px))) max(9px,var(--mivo-cutout-right,env(safe-area-inset-right,0px)))}
    .sw-graph-bar{gap:4px}.sw-graph-actions{gap:3px}.sw-graph-actions>.but{padding-inline:6px;font-size:11px}
    .sw-graph-title{gap:5px}.sw-graph-title>svg{width:28px;height:28px;padding:5px}.sw-graph-title h1{font-size:14px}
    .sw-graph-title small{font-size:10px}.sw-graph-actions .sw-icon,.sw-graph-more>summary{width:32px;min-width:32px;height:32px}
    .sw-graph-tools{flex-wrap:wrap;gap:5px}.sw-graph .sw-search{flex:1 1 100%}.sw-filters{width:100%}.sw-hits{left:9px;top:32px}
    .sw-filters>.but{font-size:11px;padding:4px 7px}.sw-zoom{top:8px;left:max(8px,var(--mivo-cutout-left,env(safe-area-inset-left,0px)))}
    .sw-graph-hint,.sw-graph-inspector{padding:9px 11px}
}
