/* the look — the project's own (sl.css: the warm canvas, white cards, the rounded face, brown in the dark) plus the map's layout
   and its few colours. Words live in tldr.json, values in settings.json. */
:root {
  --c-you: #3d6fc4; --c-world: #138a7e; --c-row: #7a52c7; --c-cron: #8a6a3f; --c-feedback: #d9480f; --c-example: #c2255c;
  --c-role: #2f8a4f; --c-on: #2f8a4f; --c-off: #a39c91; --live: #d63c3c;
  --machine: color-mix(in srgb, var(--surface) 70%, var(--bg)); --node: var(--card); --node-line: color-mix(in srgb, var(--ink) 22%, transparent);
}
/* always the project's brown: the page sets data-theme="dark" (sl.css's dark tokens) */
:root[data-theme="dark"] {
    --c-you: #8fb0de; --c-world: #4fc9b8; --c-row: #b49bff; --c-cron: #d2b48c; --c-feedback: #ff8a4c; --c-example: #f783ac;
    --c-role: #6fd08f; --c-on: #6fd08f; --c-off: #7b746a; --live: #ff6b6b;
    --machine: #221f1c; --node: var(--surface);
}
body.dash { min-height: 100vh; }
.dash .dhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s2) var(--s5); padding: var(--s4) var(--s5) var(--s3); }
.dash .dhead h1 { margin: 0; font-size: var(--t2); letter-spacing: .18em; }
.clock { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); }
.clock .when { font-family: var(--mono); font-size: clamp(17px, 3.2vw, 34px); white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.clock .live { display: inline-flex; align-items: center; gap: 8px; font-size: var(--t5); font-weight: 700; letter-spacing: .14em; color: var(--live); }
.clock .live i { width: 11px; height: 11px; border-radius: 50%; background: var(--live); animation: pulse 1.6s infinite; }
.clock .live.flash i { animation: flash .5s 4; }
.clock .live.stale { color: var(--muted); }
.clock .live.stale i { background: var(--muted); animation: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes flash { 0%, 100% { transform: scale(1); } 50% { transform: scale(2.2); } }
.dash .main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s4); padding: 0 var(--s5); align-items: start; }
.dash .card { margin: 0; padding: var(--s3) var(--s4); }
.map svg { width: 100%; height: auto; display: block; }
.feed { max-height: 720px; overflow: auto; }
.feed h2 { margin: var(--s1) 0 var(--s3); font-size: var(--t3); }
.feed ol { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 84px 1fr; gap: 6px; padding: 7px 6px; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer; border-radius: 10px; }
.feed li:hover, .feed li:focus-visible { background: var(--surface); outline: none; }
.feed li time { font-family: var(--mono); color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.feed li .k { font-weight: 700; }
.feed li .p { color: var(--ink-2); }
.feed li.new { animation: arrive 1.2s ease-out; }
.feed li.fb .k { color: var(--c-feedback); }
.feed li.ex .k { color: var(--c-example); }
@keyframes arrive { from { background: color-mix(in srgb, var(--accent) 22%, transparent); } to { background: transparent; } }
.feed .empty { color: var(--muted); font-size: 14px; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: var(--s2) 0 0; padding: var(--s2) var(--s1) 0; border-top: 1px solid var(--line); font-size: var(--t5); color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.legend .sw.role { width: 26px; height: 14px; border-radius: 999px; border: 2px dashed var(--c-role); background: color-mix(in srgb, var(--c-role) 14%, transparent); }
.legend .sw.sqe, .legend .sw.sqf, .legend .sw.sqd { width: 13px; height: 13px; border-radius: 3px; border: 2px solid var(--c-row); }
.legend .sw.sqf { background: linear-gradient(to top, var(--c-row) 50%, transparent 50%); }
.legend .sw.sqd { background: var(--c-row); }
.scrub { display: flex; align-items: center; gap: var(--s3); margin: var(--s4) var(--s5) 0 !important; }
.scrub button { border-radius: 999px; padding: 6px 14px; font-size: 14px; cursor: pointer; }
.scrub input { flex: 1; accent-color: var(--accent); }
.scrub .at { font-family: var(--mono); font-size: 13px; color: var(--ink-2); min-width: 150px; }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); padding: var(--s3) var(--s5) 0; font-size: var(--t5); color: var(--muted); }
.examples button { border-radius: 999px; padding: 5px 12px; cursor: pointer; border: 1.5px solid color-mix(in srgb, var(--c-example) 55%, transparent); color: var(--ink); background: var(--card); }
.examples button:hover { border-color: var(--c-example); }
.dash .links { display: flex; justify-content: center; padding: var(--s5) var(--s5) var(--s6); }
.dash .links nav { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s3); }
.dash .links a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }
.dash .links a:hover { color: var(--accent); }
.dash .links a svg { width: 16px; height: 16px; fill: currentColor; }
/* the map */
.machine rect { fill: var(--machine); stroke: var(--node-line); stroke-dasharray: 6 5; }
.machine text { fill: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .12em; }
.edge { fill: none; stroke: var(--node-line); stroke-width: 2; }
.fbarrow { fill: var(--c-feedback); }
.edge.fbk { marker-mid: url(#fbArrow); stroke: var(--c-feedback); stroke-opacity: .55; stroke-width: 2.5; stroke-dasharray: 7 5; }
.edge.on { stroke: var(--ink-2); stroke-width: 3.5; }
.edge.fbk.on { stroke: var(--c-feedback); stroke-opacity: 1; }
.edge.ex.on { stroke: var(--c-example); }
.elabel { fill: var(--muted); font-size: 12px; font-style: italic; }
.elabel.fbk { fill: var(--c-feedback); font-weight: 700; font-style: normal; letter-spacing: .08em; }
.node rect { fill: var(--node); stroke: var(--node-line); stroke-width: 1.5; }
.node.big rect { stroke-width: 2; }
.node.small text { font-size: 13px; }
.node text { fill: var(--ink); font-size: 14px; }
.node .ic { font-size: 18px; }
.node.big text.lb { font-weight: 700; letter-spacing: .1em; font-size: 15px; }
.node .num { font-size: 40px; font-weight: 700; font-family: var(--font); font-variant-numeric: tabular-nums; }
.node .numl { fill: var(--ink-2); font-size: 13px; }
.node.role rect { fill: color-mix(in srgb, var(--c-role) 13%, var(--node)); stroke: var(--c-role); stroke-width: 2.5; stroke-dasharray: 7 4; }
.node.role text.lb { fill: var(--c-role); font-weight: 800; letter-spacing: .12em; }
.node.role .sub { fill: var(--ink-2); font-size: 12px; }
.node.ap .state { font-size: 11px; font-weight: 800; letter-spacing: .1em; fill: var(--card); }
.node.ap .pill { fill: var(--c-off); }
.node.ap.on .pill { fill: var(--c-on); }
.node.ap:not(.on) text.lb { fill: var(--muted); }
.node, .machine { cursor: pointer; }
.node:hover rect, .node:focus-visible rect { stroke: var(--ink-2); }
.node.hit rect { stroke: var(--ink); stroke-width: 3; }
.node:focus, .machine:focus { outline: none; }
.sq { fill: transparent; stroke: var(--c-row); stroke-width: 2; transition: fill .6s; }
.sq-f { fill: var(--c-row); }
.sq.filling + .sq-f { animation: filling 1.4s ease-in-out infinite; }
@keyframes filling { 0%, 100% { opacity: .35; } 50% { opacity: .9; } }
.sq-c { fill: var(--card); font-size: 15px; font-weight: 800; pointer-events: none; }
.sqg.ex .sq { stroke: var(--c-example); } .sqg.ex .sq-f { fill: var(--c-example); }
.sqg.ping .sq { stroke-width: 4; }
.squares.dim .sqg:not(.ex) { opacity: .25; }
.squares.dim .sqg:not(.ex) .sq-f { animation: none; }
.dotg text { font-size: 13px; font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: var(--card); stroke-width: 5px; stroke-linejoin: round; }
.dot { stroke: var(--card); stroke-width: 2.5; }
.fly { position: fixed; width: 18px; height: 18px; border-radius: 50%; z-index: 20; pointer-events: none; transition: transform .9s cubic-bezier(.5, 0, .3, 1), opacity .9s; }
/* modal */
dialog { background: var(--card); color: var(--ink); border: 0; border-radius: var(--r-card); box-shadow: var(--shadow); max-width: 460px; width: calc(100% - 32px); padding: 22px 24px; }
dialog::backdrop { background: rgba(30, 25, 20, .45); }
dialog h2 { margin: 0 0 12px; font-size: 19px; }
dialog .tldr { font-size: 15.5px; line-height: 1.5; margin: 0 0 12px -4px; border-radius: 6px; padding: 2px 4px; }
dialog .tldr[contenteditable="true"] { outline: 1px dashed var(--line); }
dialog .tldr[contenteditable="true"]:focus { outline: 1px solid var(--accent); }
dialog .saved { font-size: 12px; color: var(--muted); min-height: 1em; }
dialog ul { margin: 0 0 12px; padding-left: 18px; color: var(--ink-2); font-size: 14px; }
dialog pre { white-space: pre-wrap; word-break: break-all; background: var(--surface); border-radius: 10px; padding: 10px; font-size: 12px; font-family: var(--mono); color: var(--ink-2); }
dialog .acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
dialog button { border-radius: 999px; padding: 8px 14px; font-size: 14px; cursor: pointer; }
dialog button:disabled { opacity: .45; cursor: default; }
dialog .close { float: right; margin: -6px -8px 0 0; background: none; border: none; font-size: 22px; color: var(--ink-2); }
@media (max-width: 820px) {
  .dash .main { grid-template-columns: 1fr; padding: 0 var(--s2); gap: var(--s3); }
  .dash .card { padding: var(--s2); }
  .feed { max-height: 50vh; padding: var(--s3) !important; }
  .dash .dhead { padding: var(--s3) var(--s3) var(--s2); }
  .scrub { margin: var(--s3) var(--s2) 0 !important; flex-wrap: wrap; }
  .scrub input { flex-basis: 100%; order: 3; }
  .examples { padding: var(--s3) var(--s2) 0; }
  .node .num { font-size: 34px; }
  .clock .when { font-size: 15.5px; }
}

/* the button that jumps to the live moment */
.scrub #golive { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; letter-spacing: .1em; font-size: 12px; color: var(--live); border: 1.5px solid var(--live); background: transparent; }
.scrub #golive i { width: 8px; height: 8px; border-radius: 50%; background: var(--live); }
.scrub #golive:hover { background: color-mix(in srgb, var(--live) 14%, transparent); }
