.plot-flow {
  display: grid;
  min-width: 0;
  gap: 11px;
}

.plot-flow .plot-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.plot-flow .plot-toolbar h2 { font-size: 20px; font-weight: 650; letter-spacing: -.025em; }
.plot-flow .plot-scope { color: var(--muted); font-size: 11px; }
.plot-flow .plot-toggle { min-height: 28px; padding: 3px 9px; font-size: 11px; }

.plot-flow .plot-scroll {
  min-width: 0;
  max-height: min(68vh, 680px);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: #f7f8f4;
  background-image: radial-gradient(#cbd5ca 1px, transparent 1px);
  background-size: 16px 16px;
  scrollbar-color: #a4b3a8 #eff1ec;
}

.plot-flow--screenplay .plot-scroll { max-height: min(62vh, 560px); }
.plot-flow .plot-graph { position: relative; width: var(--plot-graph-width); height: var(--plot-graph-height); }
.plot-flow .plot-connectors { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.plot-flow .plot-edge {
  fill: none;
  stroke: #7a887e;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.plot-flow .plot-edge--return { stroke: #957b5c; stroke-dasharray: 5 4; }
.plot-flow .plot-edge--conditional { stroke: #806293; }

.plot-flow .plot-edge-label {
  position: absolute;
  left: var(--plot-left);
  top: var(--plot-top);
  z-index: 1;
  transform: translate(-50%, -50%);
  max-width: 138px;
  overflow: hidden;
  padding: 3px 5px;
  border: 1px solid #e6d9c8;
  border-radius: 7px;
  color: #71583d;
  background: #fbf4e8;
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.plot-flow .plot-edge-label--conditional { border-color: #ded3e4; color: #674d7d; background: #f3ebf7; }
.plot-flow .plot-edge-label:hover { border-color: currentColor; }
.plot-flow--screenplay .plot-edge-label { max-width: 112px; }

.plot-flow .plot-point {
  --plot-accent: #587365;
  --plot-tint: #ecf3ee;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #d7ded5;
  border-left: 3px solid var(--plot-accent);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 2px 3px #27352e0d;
}
.plot-flow .plot-graph .plot-point {
  position: absolute;
  z-index: 2;
  left: var(--plot-left);
  top: var(--plot-top);
  width: var(--plot-width);
  height: var(--plot-card-height);
}
.plot-flow .plot-point--discovery { --plot-accent: #496f8a; --plot-tint: #e9f0f7; }
.plot-flow .plot-point--gain { --plot-accent: #346e63; --plot-tint: #e2efe9; }
.plot-flow .plot-point--choice { --plot-accent: #8b622e; --plot-tint: #f5eddd; }
.plot-flow .plot-point--transition { --plot-accent: #686e75; --plot-tint: #edf0f3; }
.plot-flow .plot-point:hover { border-color: var(--plot-accent); }
.plot-flow .plot-point.is-selected { border-color: var(--accent); outline: 1px solid var(--accent); outline-offset: 1px; }
.plot-flow .plot-point.is-selected .plot-point-select { background: #f5faf6; }
.plot-flow .plot-point-select {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  min-height: 0;
  width: 100%;
  min-width: 0;
  gap: 3px;
  padding: 9px 9px 6px;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: start;
  cursor: pointer;
}
.plot-flow .plot-point-select:focus-visible, .plot-flow .plot-group-toggle:focus-visible { outline-offset: -3px; }
.plot-flow--screenplay .plot-point-select { gap: 2px; padding: 7px 7px 5px; }
.plot-flow .plot-type {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 5px;
  color: var(--plot-accent);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.05;
}
.plot-flow .plot-type-icon {
  display: grid;
  flex: 0 0 18px;
  place-items: center;
  height: 18px;
  border-radius: 4px;
  background: var(--plot-tint);
  font-size: 13px;
}
.plot-flow .plot-start { margin-inline-start: auto; color: var(--muted); font-size: 9px; }
.plot-flow .plot-action,
.plot-flow .plot-story-title,
.plot-flow .plot-result {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
}
.plot-flow .plot-action { -webkit-line-clamp: 2; font-size: 14px; font-weight: 690; line-height: 1.14; }
.plot-flow--screenplay .plot-action { font-size: 13px; }
.plot-flow .plot-story-title { -webkit-line-clamp: 1; color: var(--muted); font-size: 10px; line-height: 1.22; }
.plot-flow .plot-result { -webkit-line-clamp: 3; align-self: start; color: #46544b; font-size: 11px; line-height: 1.25; }
.plot-flow--screenplay .plot-result { -webkit-line-clamp: 3; font-size: 10px; }
.plot-flow .plot-result b { color: var(--plot-accent); }
.plot-flow .plot-group-toggle {
  min-height: 25px;
  width: 100%;
  padding: 3px 8px;
  border: 0;
  border-top: 1px solid #e2e9e1;
  color: #485b4f;
  background: #f8faf6;
  font-size: 10px;
  text-align: start;
  cursor: pointer;
}
.plot-flow .plot-group-toggle:hover { background: var(--plot-tint); }

.plot-flow .plot-drafts { display: grid; gap: 6px; }
.plot-flow .plot-drafts h3 { color: var(--muted); font-size: 12px; font-weight: 650; }
.plot-flow .plot-draft-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 142px), 1fr)); gap: 6px; }
.plot-flow .plot-draft-list .plot-point { border-style: dashed; }
.plot-flow .plot-empty { padding: 14px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); font-size: 12px; }
.plot-flow .plot-next-stage { display: flex; justify-content: flex-end; }
.plot-flow .plot-next-stage .button { min-height: 28px; padding: 3px 9px; font-size: 11px; }
.plot-point:has(> .is-plot-highlighted) { outline: 2px solid var(--flow-highlight); outline-offset: 2px; }
.plot-edge.is-plot-highlighted { stroke: var(--flow-highlight); stroke-width: 3px; }
.plot-edge-label.is-plot-highlighted { outline: 2px solid var(--flow-highlight); }
