/* Shared geometry and semantic styling. No movie-specific colours live in HTML.
   Override --type-TYPE-fill / --type-TYPE-accent in either theme to colour an
   event type globally; otherwise character role supplies its fill and accent. */
*{box-sizing:border-box}html,body{margin:0;height:100%;overflow:hidden}body{background:var(--chart-bg);color:var(--chart-ink);font:16px/1.4 system-ui,sans-serif}button,a,summary{-webkit-tap-highlight-color:transparent}a{color:var(--chart-muted)}button,summary{cursor:pointer}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.chart-toolbar{height:48px;display:flex;align-items:center;gap:14px;padding:0 16px;border-bottom:1px solid var(--chart-border);background:var(--chart-panel)}.movie-back{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-decoration:none;font-size:14px;margin-right:auto}#chart-theme{flex:none;border:1px solid var(--chart-border);border-radius:6px;background:var(--chart-bg);color:var(--chart-ink);padding:5px 10px;font:inherit;font-size:13px}.chart-credit{position:relative;flex:none}.chart-credit summary{list-style:none;border:1px solid currentColor;border-radius:50%;width:18px;height:18px;font:600 13px/16px Georgia,serif;text-align:center}.chart-credit summary::-webkit-details-marker{display:none}.chart-credit>div{position:absolute;z-index:10;right:0;top:30px;width:min(320px,85vw);background:var(--chart-panel);padding:14px;border:1px solid var(--chart-border);border-radius:8px;font-size:12px}
#chart-scroll{width:100%;height:calc(100dvh - 48px);overflow:auto;scrollbar-color:var(--chart-muted) var(--chart-bg);background:var(--chart-bg)}#plot-chart{position:relative;background-image:linear-gradient(var(--chart-grid) 1px,transparent 1px),linear-gradient(90deg,var(--chart-grid) 1px,transparent 1px);background-size:24px 24px}.chart-links{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible}.chart-edge{fill:none;stroke:var(--link-stroke,var(--chart-link));stroke-width:var(--link-width,1.7px);stroke-dasharray:var(--link-dash,none);stroke-linecap:round;stroke-linejoin:round}.chart-arrow{fill:var(--link-stroke,var(--chart-link))}.chart-edge-label{position:absolute;color:var(--chart-link);font:12px/1.25 system-ui;text-align:center;display:flex;align-items:center;justify-content:center;pointer-events:none}
.chart-node{position:absolute;display:block;border:1px solid var(--event-accent,var(--role-accent));border-radius:8px;background:var(--event-fill,var(--role-fill));color:var(--chart-ink);box-shadow:0 3px 10px #0001;padding:0;text-align:left;font:18px/22px system-ui;cursor:pointer}.chart-node:focus-visible{outline:3px solid var(--chart-ink);outline-offset:3px}.chart-type{position:absolute;top:8px;left:11px;right:10px;display:flex;align-items:center;gap:7px;font:600 11px/16px system-ui;letter-spacing:.055em;text-transform:uppercase;color:var(--event-accent,var(--role-accent))}.chart-type svg{width:16px;height:16px;flex:none}.chart-label{position:absolute;top:33px;bottom:9px;left:11px;right:11px;overflow-wrap:break-word;white-space:pre-wrap}.chart-node.has-context .chart-label{bottom:29px}.chart-context{position:absolute;bottom:8px;left:11px;right:11px;font:500 10px/14px system-ui;text-transform:capitalize}.chart-node[data-threat=emergency]{outline:2px solid var(--chart-danger);outline-offset:-2px}
#event-notes{position:fixed;z-index:20;left:12px;bottom:12px;width:min(420px,calc(100vw - 24px));max-height:45dvh;overflow:auto;background:var(--chart-panel);color:var(--chart-ink);border:1px solid var(--chart-border);border-radius:9px;padding:16px 40px 12px 16px;box-shadow:0 5px 24px #0003;font-size:14px}#event-notes[hidden]{display:none}#event-notes p{margin:8px 0 0}#close-notes{position:absolute;right:8px;top:5px;border:0;background:none;color:var(--chart-ink);font-size:24px}
.chart-node[data-role="protagonist"]{--role-fill:var(--role-protagonist-fill);--role-accent:var(--role-protagonist-accent)}
.chart-node[data-role="co_lead"]{--role-fill:var(--role-co_lead-fill);--role-accent:var(--role-co_lead-accent)}
.chart-node[data-role="supporting_1"]{--role-fill:var(--role-supporting_1-fill);--role-accent:var(--role-supporting_1-accent)}
.chart-node[data-role="supporting_2"]{--role-fill:var(--role-supporting_2-fill);--role-accent:var(--role-supporting_2-accent)}
.chart-node[data-role="supporting_other"]{--role-fill:var(--role-supporting_other-fill);--role-accent:var(--role-supporting_other-accent)}
.chart-node[data-role="opposition"]{--role-fill:var(--role-opposition-fill);--role-accent:var(--role-opposition-accent)}
.chart-node[data-role="collective"]{--role-fill:var(--role-collective-fill);--role-accent:var(--role-collective-accent)}
.chart-node[data-role="world"]{--role-fill:var(--role-world-fill);--role-accent:var(--role-world-accent)}
.chart-node[data-event-type="setup"]{--event-fill:var(--type-setup-fill,var(--role-fill));--event-accent:var(--type-setup-accent,var(--role-accent))}
.chart-node[data-event-type="goal"]{--event-fill:var(--type-goal-fill,var(--role-fill));--event-accent:var(--type-goal-accent,var(--role-accent))}
.chart-node[data-event-type="plan"]{--event-fill:var(--type-plan-fill,var(--role-fill));--event-accent:var(--type-plan-accent,var(--role-accent))}
.chart-node[data-event-type="decision"]{--event-fill:var(--type-decision-fill,var(--role-fill));--event-accent:var(--type-decision-accent,var(--role-accent))}
.chart-node[data-event-type="action"]{--event-fill:var(--type-action-fill,var(--role-fill));--event-accent:var(--type-action-accent,var(--role-accent))}
.chart-node[data-event-type="journey"]{--event-fill:var(--type-journey-fill,var(--role-fill));--event-accent:var(--type-journey-accent,var(--role-accent))}
.chart-node[data-event-type="encounter"]{--event-fill:var(--type-encounter-fill,var(--role-fill));--event-accent:var(--type-encounter-accent,var(--role-accent))}
.chart-node[data-event-type="relationship"]{--event-fill:var(--type-relationship-fill,var(--role-fill));--event-accent:var(--type-relationship-accent,var(--role-accent))}
.chart-node[data-event-type="communication"]{--event-fill:var(--type-communication-fill,var(--role-fill));--event-accent:var(--type-communication-accent,var(--role-accent))}
.chart-node[data-event-type="conflict"]{--event-fill:var(--type-conflict-fill,var(--role-fill));--event-accent:var(--type-conflict-accent,var(--role-accent))}
.chart-node[data-event-type="obstacle"]{--event-fill:var(--type-obstacle-fill,var(--role-fill));--event-accent:var(--type-obstacle-accent,var(--role-accent))}
.chart-node[data-event-type="clue"]{--event-fill:var(--type-clue-fill,var(--role-fill));--event-accent:var(--type-clue-accent,var(--role-accent))}
.chart-node[data-event-type="revelation"]{--event-fill:var(--type-revelation-fill,var(--role-fill));--event-accent:var(--type-revelation-accent,var(--role-accent))}
.chart-node[data-event-type="deception"]{--event-fill:var(--type-deception-fill,var(--role-fill));--event-accent:var(--type-deception-accent,var(--role-accent))}
.chart-node[data-event-type="betrayal"]{--event-fill:var(--type-betrayal-fill,var(--role-fill));--event-accent:var(--type-betrayal-accent,var(--role-accent))}
.chart-node[data-event-type="crisis"]{--event-fill:var(--type-crisis-fill,var(--role-fill));--event-accent:var(--type-crisis-accent,var(--role-accent))}
.chart-node[data-event-type="setback"]{--event-fill:var(--type-setback-fill,var(--role-fill));--event-accent:var(--type-setback-accent,var(--role-accent))}
.chart-node[data-event-type="loss"]{--event-fill:var(--type-loss-fill,var(--role-fill));--event-accent:var(--type-loss-accent,var(--role-accent))}
.chart-node[data-event-type="rescue"]{--event-fill:var(--type-rescue-fill,var(--role-fill));--event-accent:var(--type-rescue-accent,var(--role-accent))}
.chart-node[data-event-type="reversal"]{--event-fill:var(--type-reversal-fill,var(--role-fill));--event-accent:var(--type-reversal-accent,var(--role-accent))}
.chart-node[data-event-type="transformation"]{--event-fill:var(--type-transformation-fill,var(--role-fill));--event-accent:var(--type-transformation-accent,var(--role-accent))}
.chart-node[data-event-type="resolution"]{--event-fill:var(--type-resolution-fill,var(--role-fill));--event-accent:var(--type-resolution-accent,var(--role-accent))}
.chart-node[data-event-type="aftermath"]{--event-fill:var(--type-aftermath-fill,var(--role-fill));--event-accent:var(--type-aftermath-accent,var(--role-accent))}

#event-notes.notes-tooltip{width:min(380px,calc(100vw - 24px));padding-right:16px}#event-notes.notes-tooltip #close-notes{display:none}.chart-node[data-placement="shared"]{border-style:dashed}

/* Relationship styles are shared by every chart; models supply semantic IDs only. */
.chart-link-style[data-link-kind="sequence"]{--link-stroke:var(--chart-link);--link-width:var(--link-sequence-width,1.7px);--link-dash:var(--link-sequence-dash,none)}
.chart-link-style[data-link-kind="causes"]{--link-stroke:var(--link-causes-color);--link-width:var(--link-causes-width,2.6px);--link-dash:var(--link-causes-dash,none)}
.chart-link-style[data-link-kind="enables"]{--link-stroke:var(--link-enables-color);--link-width:var(--link-enables-width,2.2px);--link-dash:var(--link-enables-dash,12 6)}
.chart-link-style[data-link-kind="prevents"]{--link-stroke:var(--link-prevents-color);--link-width:var(--link-prevents-width,2.2px);--link-dash:var(--link-prevents-dash,4 4)}
.chart-link-style[data-link-kind="reveals"]{--link-stroke:var(--link-reveals-color);--link-width:var(--link-reveals-width,2.2px);--link-dash:var(--link-reveals-dash,1 5)}
.chart-link-hit{fill:none;stroke:transparent;stroke-width:var(--link-hit-width,18px);pointer-events:stroke;cursor:help;outline:none}
.chart-link-hit:focus-visible{stroke:var(--link-stroke);stroke-opacity:.12}
.chart-edge.is-selected{filter:drop-shadow(0 0 2px var(--link-stroke,var(--chart-link)))}
@media(pointer:coarse){.chart-link-hit{stroke-width:var(--link-touch-hit-width,28px)}}

/* Server-rendered notes remain usable with JavaScript disabled. */
.chart-fallback-notes{display:none;position:absolute;top:calc(100% + 8px);left:0;width:320px;max-width:85vw;padding:14px;border:1px solid var(--chart-border);border-radius:8px;background:var(--chart-panel);color:var(--chart-ink);font:14px/1.5 system-ui;z-index:20;white-space:normal}
.chart-node:hover,.chart-node:focus{z-index:2}.chart-node:hover .chart-fallback-notes,.chart-node:focus .chart-fallback-notes{display:block}
.chart-home{font-size:14px}button.movie-back{border:0;background:none;color:var(--chart-ink);font:inherit;font-size:14px;padding:0}
