/* The theme (T439): Marathon's "graphic realism" with Cyberpunk's neo-militarism (docs/studies/orbit-identidade-visual.md).
   The reading comes before the effect: the light text on a dark neutral background, the accent only on what matters. */

@font-face { font-family: "Chakra Petch"; src: url("vendor/fonts/ChakraPetch-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Chakra Petch"; src: url("vendor/fonts/ChakraPetch-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Chakra Petch"; src: url("vendor/fonts/ChakraPetch-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Rajdhani"; src: url("vendor/fonts/Rajdhani-Medium.woff2") format("woff2"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "Rajdhani"; src: url("vendor/fonts/Rajdhani-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Rajdhani"; src: url("vendor/fonts/Rajdhani-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("vendor/fonts/JetBrainsMono-Variable.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

:root {
  /* T439, the identity of Marathon and Cyberpunk (docs/studies/orbit-identidade-visual.md): a neutral, cold base; one
     acid accent (the lime) for what matters now; the statuses in Marathon's set (orange, magenta, cyan, red) */
  --bg: #060708;
  --panel-rgb: 13, 14, 15;     /* the panels: neutral, almost black */
  --raise-rgb: 30, 33, 26;     /* what is raised over a panel (the selected, the answer) */
  --glass: rgba(var(--panel-rgb), 0.8);
  --glass-strong: rgba(var(--panel-rgb), 0.97);
  --accent-rgb: 198, 255, 26;
  --accent: rgb(var(--accent-rgb));
  --accent-2: rgba(var(--accent-rgb), 0.55);
  --accent-border: rgba(var(--accent-rgb), 0.32);
  --accent-faint: rgba(var(--accent-rgb), 0.11);
  --system: #3fe0ff;           /* the system's own lines and codes (the microtext) */
  --text: #eceae2;             /* the dirty white */
  --text-2: #abaca4;
  --text-3: #7f827b;           /* >= 4.5:1 on the background */
  --pending: #a3aaa6;
  --doing: #ff9a1f;
  --review: #ff4fd8;
  --done: #3fe0ff;
  --blocked: #ff3b4e;
  --wait: #ffcf3f;             /* T522: the amber of waiting (the hourglass, the line from a blocker still open) */
  --font: "Rajdhani", "Bahnschrift", "Segoe UI", system-ui, sans-serif;
  --display: "Chakra Petch", "Rajdhani", "Bahnschrift", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", "Consolas", ui-monospace, monospace;
  --bar-height: 0px;         /* T454: no bottom bar any more (the bar is the right column, --side) */
  --side: 264px;             /* T454: the bar's column on the right, on every mode */
  --character: 200px;        /* the character's space, at the top of the column (character/ may change) */
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* the panels' display does not beat hidden */
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font); font-weight: 500; }
body { background: radial-gradient(ellipse at 50% 45%, #15170f 0%, #0a0b0b 55%, var(--bg) 100%); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { fill: currentColor; flex: none; }

#stage { position: fixed; inset: 0; cursor: grab; }
#stage.dragging { cursor: grabbing; }
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.016) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

/* the display face (T439): the titles and the names, technical, with cut corners */
.ui h4, #panel h2, #panel h3, .brand, .place .t, .place .class-name, .label.center .name, .label.center .class-name,
.label.cat, .label.sub, #modes .mode, #selector header .title, #choices .question, #showcase h3, #viewer h3,
#projects h4, .status, .card-head .tid { font-family: var(--display); }
#panel h2 { text-transform: uppercase; letter-spacing: 0.02em; }
#modes .mode { text-transform: uppercase; letter-spacing: 0.12em; }

/* ---------- the graph's labels ---------- */
.label-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.label { position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; white-space: nowrap; }

.label.card {
  display: flex; align-items: baseline; gap: 0.4em;
  max-width: 20em; padding: 0.12em 0.4em; border-radius: 0.25em;
  font-size: 11px; line-height: 1.25; color: var(--text);
  background: rgba(var(--panel-rgb), 0.62);
  text-shadow: 0 0 4px #000, 0 0 2px #000;
}
.label.card .glyph { font-size: 0.95em; flex: none; }
.label.card .tid { font-family: var(--mono); font-size: 0.82em; color: var(--text-3); flex: none; }
.label.card .title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.label.card.l1 .title { white-space: nowrap; }
.label.card.l2 .title, .label.card.l3 .title { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.label.card.l3 .title { -webkit-line-clamp: 3; }
.label.card.under, .label.card.open { background: rgba(var(--raise-rgb), 0.92); outline: 1px solid var(--accent-2); box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.35); z-index: 99999 !important; }
.label.card.st-done .title { color: #bfe9f2; }

.st-pending { color: var(--pending); } .st-doing { color: var(--doing); } .st-review { color: var(--review); }
.st-done { color: var(--done); } .st-blocked { color: var(--blocked); }
.label.card .glyph, .status .glyph, #legend .glyph { text-shadow: 0 0 6px currentColor; }
.label.card.st-pending .glyph { color: var(--pending); } .label.card.st-doing .glyph { color: var(--doing); }
.label.card.st-review .glyph { color: var(--review); } .label.card.st-done .glyph { color: var(--done); }
.label.card.st-blocked .glyph { color: var(--blocked); }
/* T522: the waiting card (derived: a blocker still open) carries the amber hourglass beside its status */
.st-waiting { color: var(--wait); }
.label.card .wait { color: var(--wait); font-size: 0.95em; flex: none; text-shadow: 0 0 6px var(--wait); }
.label.card.waiting { box-shadow: inset 2px 0 0 var(--wait); }

.label.cat, .label.sub {
  display: flex; align-items: center; gap: 0.45em;
  padding: 0.34em 0.75em 0.34em 0.55em; border-radius: 0.45em;
  font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
  background: linear-gradient(180deg, rgba(var(--panel-rgb), 0.95), rgba(var(--panel-rgb), 0.95));
  border: 1px solid var(--accent-border);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.22), inset 0 0 10px rgba(var(--accent-rgb), 0.10);
}
.label.cat .text, .label.sub .text { max-width: 14em; overflow: hidden; text-overflow: ellipsis; } /* the ceiling: the chips do not touch */
.label.sub { font-weight: 500; border-style: dashed; background: rgba(var(--panel-rgb), 0.92); box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.15); }
.label.cat svg, .label.sub svg { width: max(1.4em, 18px); height: max(1.4em, 18px); color: var(--accent); filter: drop-shadow(0 0 2px rgba(var(--accent-rgb), 0.55)); } /* T497: never below 18 px (a safe, fixed size: the drawing keeps its detail) */
.label .n { font-family: var(--mono); font-size: 0.78em; color: var(--accent); font-weight: 400; padding-left: 0.2em; }
.label.cat.under, .label.sub.under { border-color: var(--accent); box-shadow: 0 0 22px rgba(var(--accent-rgb), 0.5); }

.label.center {
  display: flex; flex-direction: column; align-items: center; gap: 0.1em;
  padding: 0.5em 1.1em; border-radius: 0.6em; text-align: center;
  font-size: 16px; background: rgba(var(--panel-rgb), 0.86);
  border: 1px solid var(--accent); box-shadow: 0 0 26px rgba(var(--accent-rgb), 0.45), inset 0 0 16px rgba(var(--accent-rgb), 0.15);
}
.label.center .class-name { font-size: 0.6em; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent); }
.label.center .name { font-size: 1.25em; font-weight: 700; letter-spacing: 0.04em; }
.label.center .mid { font-family: var(--mono); font-size: 0.62em; color: var(--text-2); }
.cl-active { color: var(--doing) !important; } .cl-planned { color: var(--accent) !important; }
.cl-backlog { color: var(--review) !important; } .cl-closed { color: var(--done) !important; }

/* ---------- the interface ---------- */
.ui { position: fixed; z-index: 10; }
.ui h4 { margin: 14px 0 6px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase; color: var(--text-3); }

#left {
  top: 14px; left: 14px; bottom: calc(var(--bar-height) + 26px); width: 236px; padding: 12px 12px 10px;
  display: flex; flex-direction: column;
  background: var(--glass); border: 1px solid var(--accent-faint); border-radius: 10px;
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 13px; letter-spacing: 0.2em; color: var(--text-2); }
.brand .logo { color: var(--accent); font-size: 18px; text-shadow: 0 0 10px var(--accent); }
.brand b { color: var(--accent); }
.project { margin: 2px 0 0 26px; font-size: 11px; letter-spacing: 0.12em; color: var(--text-2); opacity: 0.8; }

.place {
  display: grid; grid-template-columns: 1fr auto; gap: 1px 8px; text-align: left; width: 100%;
  padding: 7px 9px; border-radius: 7px; border: 1px solid transparent; background: rgba(var(--accent-rgb), 0.04);
  transition: background 0.2s, border-color 0.2s;
}
.place .class-name { grid-column: 1 / 3; font-size: 9.5px; letter-spacing: 0.2em; text-transform: uppercase; }
.place .t { font-size: 14px; font-weight: 600; }
.place .m { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); align-self: center; }
.place .q { grid-column: 1 / 3; font-family: var(--mono); font-size: 10px; color: var(--text-3); }
.place .prog { grid-column: 1 / 3; display: flex; height: 3px; margin-top: 4px; border-radius: 2px; overflow: hidden; background: rgba(255, 255, 255, 0.06); }
.place .prog i { display: block; background: currentColor; }
.place.current { border-color: var(--accent-2); background: rgba(var(--accent-rgb), 0.12); box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.18), inset 3px 0 0 var(--accent); }
.place.under, .place:hover { background: rgba(var(--accent-rgb), 0.10); }

#categories { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; scrollbar-width: thin; }
.cat-item { display: flex; align-items: center; gap: 7px; padding: 4px 6px; border-radius: 5px; font-size: 12.5px; text-align: left; color: var(--text); }
.cat-item svg { width: 17px; height: 17px; color: var(--accent); }
.cat-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-item b { font-family: var(--mono); font-weight: 400; font-size: 11px; color: var(--text-3); }
.cat-item.sub { padding-left: 22px; font-size: 11.5px; color: var(--text-2); }
.cat-item.sub svg { width: 14px; height: 14px; }
.cat-item.under, .cat-item:hover { background: rgba(var(--accent-rgb), 0.10); }

#legend { display: flex; flex-wrap: wrap; gap: 4px 10px; padding-top: 8px; margin-top: 6px; border-top: 1px solid var(--accent-faint); font-size: 11px; }
#legend .glyph { margin-right: 4px; }

#top-right { top: 12px; right: calc(var(--side) + 30px); display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }
#fps { opacity: 0.75; }
#live.on { color: var(--done); }
#live.off { color: var(--blocked); }

#panel {
  top: 58px; right: calc(var(--side) + 28px); /* under the mode bar (T454: less room beside it) */ bottom: calc(var(--bar-height) + 26px); width: 420px; padding: 16px 18px 18px;
  overflow-y: auto; scrollbar-width: thin;
  background: var(--glass-strong); border: 1px solid var(--accent-border); border-radius: 10px;
  box-shadow: 0 0 30px rgba(var(--accent-rgb), 0.16), inset 0 0 22px rgba(var(--accent-rgb), 0.06);
  backdrop-filter: blur(8px);
  animation: panel-in 0.25s ease-out;
}
@keyframes panel-in { from { opacity: 0; transform: translateX(24px); } }
#panel .close { position: absolute; top: 12px; right: 12px; display: flex; align-items: center; gap: 4px; padding: 4px 9px 4px 6px; border: 1px solid var(--accent-border); border-radius: 6px; font-size: 12px; color: var(--text-2); }
#panel .close svg { width: 16px; height: 16px; }
#panel .close.under, #panel .close:hover { color: var(--text); border-color: var(--accent); }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-head .tid { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.status { display: inline-flex; gap: 5px; align-items: center; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; padding: 2px 8px; border: 1px solid currentColor; border-radius: 20px; }
#panel h2 { margin: 10px 0 8px; font-size: 20px; line-height: 1.25; font-weight: 600; }
.trail { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.trail svg { width: 17px; height: 17px; color: var(--accent); }
.trail .sep { color: var(--text-3); }
#panel section { margin-top: 12px; padding-left: 10px; border-left: 2px solid var(--accent-faint); }
#panel section.highlight { border-left-color: var(--accent-2); }
#panel section.closure { border-left-color: rgba(63, 224, 255, 0.5); }
/* T522: blocked is the impediment from outside: its reason whole, in the red; the relations as cards to open */
#panel section.blocked { border-left-color: var(--blocked); background: rgba(255, 59, 78, 0.07); padding: 6px 10px; }
#panel section.blocked h3 { color: var(--blocked); }
#panel .card-head .st-waiting { margin-left: 6px; }
#panel section.relations ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
#panel section.blocked-by { border-left-color: var(--wait); }
#panel section.blocks { border-left-color: rgba(255, 207, 63, 0.45); }
#panel section.related, #panel section.duplicate-of, #panel section.duplicates { border-left-style: dashed; }
#panel .rel { display: grid; grid-template-columns: auto auto 1fr; gap: 0 6px; align-items: baseline; width: 100%; text-align: left;
  padding: 3px 6px; border-radius: 5px; border: 1px solid transparent; background: rgba(255, 255, 255, 0.03); font-size: 13px; }
#panel button.rel:hover, #panel button.rel.under { border-color: var(--accent-2); background: rgba(var(--accent-rgb), 0.08); }
#panel .rel .glyph { text-shadow: 0 0 6px currentColor; }
#panel .rel .key { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); }
#panel .rel .title { color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#panel .rel .meta { grid-column: 2 / 4; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }
#panel .rel .meta .wait { color: var(--wait); font-weight: 400; }
#panel .rel.holds { border-color: rgba(255, 207, 63, 0.35); }
#panel .rel.other { opacity: 0.85; }
#panel .rel.other .key { color: var(--system); }
#panel .rel.gone { color: var(--text-3); font-style: italic; }
#panel h3 { margin: 0 0 3px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-3); }
#panel p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--text); }
#panel section.code p { font-family: var(--mono); font-size: 12.5px; color: var(--accent); word-break: break-all; }
.refs { margin: 0; padding: 0; list-style: none; font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.refs li::before { content: "↳ "; color: var(--text-3); }
.dates { margin-top: 16px; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }

/* T454: the bar is the right column, on every mode (sovereign: nothing of the modes covers it): the character at the
   top, the conversation in the middle (several lines now), the voice, the hand and the commands below */
#bar {
  right: 14px; top: 14px; bottom: 14px; width: var(--side); z-index: 15;
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px 12px 12px; background: rgba(var(--panel-rgb), 0.93); border: 1px solid var(--accent-faint); border-radius: 10px; backdrop-filter: blur(6px);
}
#character { order: 0; flex: none; width: 100%; height: var(--character); position: relative; border-radius: 8px; overflow: hidden; }
#character.empty {
  background: radial-gradient(circle at 50% 50%, rgba(var(--accent-rgb), 0.16), transparent 62%);
  border: 1px dashed var(--accent-faint);
}
#character.empty::after {
  content: ""; position: absolute; inset: 22%; border-radius: 50%;
  border: 1px solid var(--accent-2); box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.4), inset 0 0 8px rgba(var(--accent-rgb), 0.3);
  animation: breathe 3.2s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(0.82); opacity: 0.55; } }
#bar .row-2 { order: 1; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
#bar .row-1 { order: 2; flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; min-width: 0; }
#bar button { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 6px 8px; border: 1px solid var(--accent-faint); border-radius: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
#bar button svg { width: 17px; height: 17px; color: var(--accent); }
#bar button.under, #bar button:hover { color: var(--text); border-color: var(--accent-2); background: rgba(var(--accent-rgb), 0.08); }
#bar .buttons { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#bar .toggle[aria-pressed="true"] { color: var(--text); border-color: var(--done); background: rgba(63, 224, 255, 0.12); }
#bar .toggle[aria-pressed="true"] svg { color: var(--done); }
/* the voice (T354) that did not turn on: the reason is in the title and on the conversation line; the button stays marked until it connects */
#bar .toggle[data-reason] { border-color: var(--blocked); }
/* T509: the channel open while the space is held: the microphone in the owner's color (orange), breathing */
body.holding-talk #microphone { color: var(--text); border-color: var(--doing); background: rgba(255, 154, 31, 0.16); box-shadow: 0 0 0 1px var(--doing), 0 0 14px rgba(255, 154, 31, 0.45); animation: holding-talk 1.1s ease-in-out infinite; }
body.holding-talk #microphone svg { color: var(--doing); }
@keyframes holding-talk { 50% { box-shadow: 0 0 0 1px var(--doing), 0 0 4px rgba(255, 154, 31, 0.2); } }
@media (prefers-reduced-motion: reduce) { body.holding-talk #microphone { animation: none; } }
#bar .toggle[data-reason] svg { color: var(--blocked); }
#line { grid-column: 1 / -1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--accent-faint); border-radius: 6px; height: 31px; }
#line .prompt { font-family: var(--mono); font-size: 13px; color: var(--accent); }
#line input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font-family: var(--mono); font-size: 12.5px; }
#line input::placeholder { color: var(--text-3); }
#line:focus-within { border-color: var(--accent-2); }
#conversation { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 1.4; color: var(--text-3); overflow-y: auto; scrollbar-width: thin; }
#conversation .who { font-family: var(--mono); font-size: 11.5px; color: var(--accent); flex: none; }
#conversation .text { overflow-wrap: anywhere; }
#conversation[data-who] .text { color: var(--text); }
#conversation[data-who="you"] .who { color: var(--doing); }
#conversation.partial .text { color: var(--text-2); font-style: italic; }
#transcript { flex: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 11px; color: var(--text-3); transition: color 0.4s; }
#transcript.live { color: var(--accent); }
#help { flex: none; font-size: 11px; color: var(--text-3); white-space: normal; }

/* ---------- the place on the screen (a release; the backlog, fixed below it) and the selector of all ---------- */
#current { position: relative; border-color: var(--accent-faint); }
#current.current { border-color: var(--accent-2); background: rgba(var(--accent-rgb), 0.10); box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.16), inset 3px 0 0 var(--accent); }
/* the backlog: a place of its own (not a release): its magenta, a dashed edge, no class nor key */
.backlog-place { border: 1px dashed rgba(255, 79, 216, 0.38); background: rgba(255, 79, 216, 0.04); }
.backlog-place .class-name { color: var(--review); }
.backlog-place .t { font-size: 13px; }
.backlog-place .q { white-space: normal; }
#backlog-place { margin-top: 8px; }
.backlog-place.current { border-style: solid; border-color: rgba(255, 79, 216, 0.7); background: rgba(255, 79, 216, 0.10); box-shadow: 0 0 14px rgba(255, 79, 216, 0.2), inset 3px 0 0 var(--review); }
.backlog-place.under, .backlog-place:hover { background: rgba(255, 79, 216, 0.10); }
#selector .backlog-place { margin: 8px 0 2px; }
.label.center.place-backlog { border-color: var(--review); box-shadow: 0 0 26px rgba(255, 79, 216, 0.4), inset 0 0 16px rgba(255, 79, 216, 0.12); }
.label.center.place-backlog .name { color: var(--review); }
#current .switch { grid-column: 1 / 3; display: flex; align-items: center; gap: 6px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--accent-faint); font-size: 11.5px; color: var(--text-2); }
#current .switch svg { width: 15px; height: 15px; color: var(--accent); }
#current .switch .arrow { margin-left: auto; color: var(--accent); transition: transform 0.2s; }
#current.open .switch .arrow { transform: rotate(-90deg); }
#current.under, #current:hover { background: rgba(var(--accent-rgb), 0.16); }

#selector {
  top: 14px; left: 264px; width: min(700px, calc(100vw - 306px - var(--side))); max-height: calc(100vh - var(--bar-height) - 40px);
  display: flex; flex-direction: column; padding: 12px 14px 14px;
  background: var(--glass-strong); border: 1px solid var(--accent-border); border-radius: 10px;
  box-shadow: 0 0 34px rgba(var(--accent-rgb), 0.18), inset 0 0 22px rgba(var(--accent-rgb), 0.06);
  backdrop-filter: blur(8px);
  z-index: 20; animation: selector-in 0.2s ease-out;
}
@keyframes selector-in { from { opacity: 0; transform: translateX(-16px); } }
#selector header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
#selector header .title { font-size: 12px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--text-2); }
#selector header .title b { color: var(--accent); font-family: var(--mono); font-weight: 400; letter-spacing: 0; margin-left: 4px; }
#selector .close { display: flex; align-items: center; gap: 4px; padding: 4px 9px 4px 6px; border: 1px solid var(--accent-border); border-radius: 6px; font-size: 12px; color: var(--text-2); }
#selector .close svg { width: 16px; height: 16px; }
#selector .close.under, #selector .close:hover { color: var(--text); border-color: var(--accent); }
#selector .groups { overflow-y: auto; scrollbar-width: thin; display: flex; flex-direction: column; }
#selector .group-row { display: grid; grid-template-columns: 1fr 2fr; gap: 0 10px; } /* the active and the planned, side by side */
#selector .group h4 { margin: 12px 0 6px; }
#selector .group h4 b { font-family: var(--mono); font-weight: 400; color: var(--text-2); letter-spacing: 0; margin-left: 4px; }
#selector .items { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 10px; }
#selector .group-row .items { grid-template-columns: 1fr; }
#selector .group-row .gr-planned:nth-child(2) .items { grid-template-columns: repeat(2, 1fr); }
kbd { font-family: var(--mono); font-size: 10px; padding: 0 4px; border: 1px solid var(--accent-faint); border-radius: 3px; color: var(--text-2); }

/* ---------- the fake cursor (the hand, simulated) ---------- */
#cursor { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; }
#cursor i {
  position: absolute; left: -15px; top: -15px; width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid #ffe08a; box-shadow: 0 0 12px rgba(255, 210, 110, 0.85), inset 0 0 6px rgba(255, 210, 110, 0.5);
  transition: transform 0.12s, background 0.12s;
}
#cursor i::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: #ffe08a; }
#cursor.holding i { transform: scale(0.62); background: rgba(255, 210, 110, 0.45); }
#cursor.rotating i { border-style: dashed; animation: spin 1s linear infinite; }
#cursor.click i { animation: click-pulse 0.22s ease-out; }
@keyframes click-pulse { 50% { transform: scale(0.55); background: rgba(255, 224, 138, 0.7); } }
@keyframes spin { to { transform: rotate(360deg); } }

#errors { position: fixed; left: 264px; top: 14px; z-index: 60; max-width: 50vw; margin: 0; padding: 8px 10px; font: 11px var(--mono); color: #fff; background: rgba(160, 20, 40, 0.92); border-radius: 6px; white-space: pre-wrap; }

/* ---------- the hand by the camera (T353): the panel with the video, the state, the calibration ---------- */
#bar button.subtle { padding: 3px 6px; border-style: dashed; font-size: 11px; color: var(--text-3); }
#hand-panel {
  right: calc(var(--side) + 28px); bottom: calc(var(--bar-height) + 26px); width: 232px; padding: 8px;
  display: flex; flex-direction: column; gap: 5px;
  background: var(--glass-strong); border: 1px solid var(--accent-border); border-radius: 10px;
  box-shadow: 0 0 22px rgba(var(--accent-rgb), 0.16); backdrop-filter: blur(6px); font-size: 11.5px;
}
body.with-panel #hand-panel { right: calc(var(--side) + 462px); } /* the open card takes the right */
/* the camera only feeds the reading (T369): its frame stays out of sight; the hands show as silhouettes instead */
#hand-panel .frame { position: fixed; left: -10000px; top: 0; width: 320px; height: 240px; overflow: hidden; pointer-events: none; }
#hand-overlay { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 6; } /* over the graph and its labels, under the interface and the cursor */
#hand-panel video, #hand-panel canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); } /* the mirror: the right hand on the right */
#hand-panel .state { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text); }
#hand-panel .state i { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); box-shadow: 0 0 6px currentColor; flex: none; }
#hand-panel .state .progress { margin-left: auto; font-family: var(--mono); font-weight: 400; color: var(--doing); }
#hand-panel[data-state="open"] .state i { background: var(--accent); }
#hand-panel:is([data-state="pinch"], [data-state="drag"], [data-state="two_hands"], [data-state="zoom"], [data-state="rotate"]) .state i { background: var(--doing); }
#hand-panel:is([data-state="no_hand"], [data-state="arming"], [data-state="loading"]) .state i { animation: breathe 1.6s ease-in-out infinite; background: var(--pending); }
#hand-panel[data-state="rest"] .state i { background: var(--text-3); }
#hand-panel[data-state="error"] .state i { background: var(--blocked); }
#hand-panel.calibrating { border-color: var(--doing); }
#hand-panel .note { color: var(--text-2); line-height: 1.3; }
#hand-panel .footer { display: flex; align-items: center; gap: 6px; min-height: 18px; }
#hand-panel .rate { flex: 1; min-width: 0; font-family: var(--mono); font-size: 10px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#hand-panel button { padding: 2px 7px; border: 1px solid var(--accent-faint); border-radius: 5px; font-size: 10.5px; color: var(--text-2); }
#hand-panel button.under, #hand-panel button:hover { color: var(--text); border-color: var(--accent-2); }

/* the cursor's ring with the hand: its state (cursor.mjs, data-hand) */
#cursor:is([data-hand="no_hand"], [data-hand="arming"]) i { opacity: 0.45; border-style: dashed; }
#cursor[data-hand="rest"] i { opacity: 0.35; border-color: var(--text-3); box-shadow: none; }
#cursor:is([data-hand="zoom"], [data-hand="two_hands"]) i { border-color: var(--review); box-shadow: 0 0 12px rgba(255, 79, 216, 0.85); }

/* ---------- the interactive layer (T360): the agent's question as buttons, over any screen ---------- */
#choices {
  left: calc(50% - var(--side) / 2); bottom: 64px; transform: translateX(-50%); z-index: 30; min-width: 360px; max-width: min(760px, calc(100vw - var(--side) - 80px));
  padding: 16px 18px 12px; border-radius: 12px; text-align: center;
  background: rgba(var(--panel-rgb), 0.86); border: 1px solid var(--accent-2); box-shadow: 0 0 28px rgba(var(--accent-rgb), 0.28);
  backdrop-filter: blur(6px); animation: choices-in 0.18s ease-out;
}
#choices .question { margin: 0 0 12px; font-size: 16px; color: var(--text); }
#choices .options { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
#choices button {
  min-width: 120px; min-height: 56px; padding: 0 20px; border-radius: 10px; font-size: 16px; letter-spacing: 0.02em;
  color: var(--text); background: rgba(var(--accent-rgb), 0.1); border: 1px solid var(--accent-2); cursor: pointer;
}
#choices button:hover, #choices button.under { background: rgba(var(--accent-rgb), 0.24); box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.4); }
#choices button[data-tone="yes"] { border-color: var(--done); }
#choices button[data-tone="no"] { border-color: var(--blocked); }
#choices .hint { margin: 10px 0 0; font-size: 11.5px; color: var(--text-3); }
@keyframes choices-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- the stage (T361): the agent's piece over the screen, above the graph, under the interactive layer ---------- */
#showcase {
  left: calc(50% + (222px - var(--side)) / 2); top: 56px; transform: translateX(-50%); z-index: 25;
  width: min(820px, calc(100vw - 320px - var(--side))); max-height: calc(100vh - 56px - 250px); display: flex; flex-direction: column;
  border-radius: 12px; background: rgba(var(--panel-rgb), 0.9); border: 1px solid var(--accent-2); box-shadow: 0 0 28px rgba(var(--accent-rgb), 0.24);
  backdrop-filter: blur(6px); animation: choices-in 0.18s ease-out;
}
#showcase header { display: flex; align-items: center; gap: 12px; padding: 12px 16px 10px; border-bottom: 1px solid var(--accent-faint); }
#showcase h3 { flex: 1; margin: 0; font-size: 15px; letter-spacing: 0.04em; color: var(--text); }
#showcase .body { overflow: auto; padding: 14px 16px 16px; color: var(--text); font-size: 13px; }
#showcase svg { width: 100%; height: auto; display: block; }
/* the comparison */
#showcase table { width: 100%; border-collapse: collapse; }
#showcase th, #showcase td { padding: 7px 10px; border-bottom: 1px solid var(--accent-faint); text-align: left; vertical-align: top; }
#showcase thead th { color: var(--accent); font-weight: 600; font-size: 12px; letter-spacing: 0.05em; }
#showcase tbody th { color: var(--text-2); font-weight: 500; }
#showcase td.best { color: var(--done); background: rgba(63, 224, 255, 0.08); }
/* the timeline */
#showcase .timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--accent-border); }
#showcase .timeline li { position: relative; margin: 0 0 12px; padding-left: 12px; }
#showcase .timeline li::before { content: ""; position: absolute; left: -25px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--pending); box-shadow: 0 0 8px currentColor; }
#showcase .timeline li[data-status="done"]::before { background: var(--done); }
#showcase .timeline li[data-status="doing"]::before { background: var(--doing); }
#showcase .timeline li[data-status="risk"]::before { background: var(--blocked); }
#showcase .timeline .when { display: block; font: 11px var(--mono); color: var(--text-3); }
#showcase .timeline p { margin: 2px 0 0; color: var(--text-2); }
/* the chart and the diagram */
#showcase .grid { stroke: var(--accent-faint); }
#showcase .axis { stroke: var(--accent-border); }
#showcase .tick, #showcase .label, #showcase .link-label { fill: var(--text-3); font: 11px var(--mono); }
#showcase .s0 { fill: var(--accent); stroke: var(--accent); }
#showcase .s1 { fill: var(--doing); stroke: var(--doing); }
#showcase .s2 { fill: var(--review); stroke: var(--review); }
#showcase .s3 { fill: var(--done); stroke: var(--done); }
#showcase rect.s0, #showcase rect.s1, #showcase rect.s2, #showcase rect.s3 { stroke: none; opacity: 0.85; }
#showcase .line { fill: none; stroke-width: 2; }
#showcase .legend { display: flex; gap: 14px; margin: 8px 0 0; font-size: 12px; color: var(--text-2); }
#showcase .legend .key::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; background: currentColor; vertical-align: -1px; }
#showcase .legend .key.s0 { color: var(--accent); } #showcase .legend .key.s1 { color: var(--doing); }
#showcase .legend .key.s2 { color: var(--review); } #showcase .legend .key.s3 { color: var(--done); }
#showcase .legend .key { fill: none; stroke: none; }
#showcase .legend .unit { margin-left: auto; color: var(--text-3); }
#showcase .node rect { fill: rgba(var(--raise-rgb), 0.92); stroke: var(--accent-2); }
#showcase .node.decision rect { stroke: var(--doing); }
#showcase .node.start rect, #showcase .node.end rect { stroke: var(--done); }
#showcase .node text { fill: var(--text); font: 13px var(--font); }
#showcase .link { fill: none; stroke: var(--accent-border); stroke-width: 1.5; }
#showcase .link.back { stroke-dasharray: 4 3; }
#showcase .arrow { fill: var(--accent-2); }
/* the gallery */
#showcase .gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
#showcase figure { margin: 0; padding: 10px; border-radius: 8px; border: 1px solid var(--accent-faint); background: rgba(var(--raise-rgb), 0.5); }
#showcase figure img { width: 100%; max-height: 120px; object-fit: contain; margin-bottom: 8px; }
#showcase figcaption strong { display: block; color: var(--text); }
#showcase figcaption span { display: block; margin-top: 4px; color: var(--text-2); font-size: 12px; }
/* the decision (its buttons are the interactive layer's, below) */
#showcase .decision .question { margin: 0 0 12px; font-size: 15px; }
#showcase .decision .options { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
#showcase .option { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--accent-faint); background: rgba(var(--raise-rgb), 0.5); }
#showcase .option.recommended { border-color: var(--done); }
#showcase .option h4 { margin: 0 0 6px; font-size: 14px; }
#showcase .option .tag { font: 10px var(--mono); color: var(--done); text-transform: uppercase; letter-spacing: 0.08em; }
#showcase .option ul { margin: 6px 0 0; padding-left: 16px; }
#showcase .option li.pro::marker { content: "+  "; color: var(--done); }
#showcase .option li.con::marker { content: "−  "; color: var(--blocked); }
/* the free HTML: its own frame, white so it reads as apart from the app */
#showcase iframe.free { width: 100%; height: min(420px, calc(100vh - 400px)); border: 0; border-radius: 8px; background: #fff; }

/* ---------- the modes (T362): the bar at the top, and what leaves the screen outside the management ---------- */
#modes {
  top: 12px; left: calc(50% + (222px - var(--side)) / 2); transform: translateX(-50%); z-index: 12; display: flex; gap: 4px; padding: 4px;
  border-radius: 10px; background: var(--glass); border: 1px solid var(--accent-faint); backdrop-filter: blur(6px);
}
#modes .mode { min-height: 30px; padding: 4px 12px; font-size: 12px; letter-spacing: 0.04em; border-color: transparent; background: transparent; color: var(--text-2); }
#modes .mode[aria-pressed="true"] { color: var(--bg); background: var(--accent); border-color: var(--accent); font-weight: 600; }
body[data-mode]:not([data-mode="management"]) .vignette,
body[data-mode]:not([data-mode="management"]) #left,
body[data-mode]:not([data-mode="management"]) #selector,
body[data-mode]:not([data-mode="management"]) #panel,
body[data-mode]:not([data-mode="management"]) #bar .buttons [data-cmd="center"],
body[data-mode]:not([data-mode="management"]) #bar .buttons [data-cmd="zoom_in"],
body[data-mode]:not([data-mode="management"]) #bar .buttons [data-cmd="zoom_out"] { display: none !important; }
body[data-mode]:not([data-mode="management"]) #modes { left: calc(50% - (var(--side) + 14px) / 2); }
#mode-screen { position: fixed; left: 24px; right: calc(var(--side) + 38px); top: 58px; bottom: 24px; z-index: 9; }
#mode-screen[hidden] { display: none; }
/* a mode still to come */
/* the stage mode: the stage on the whole screen, the earlier pieces in a strip below */
#showcase.full {
  position: absolute; inset: 0; width: auto; max-height: none; transform: none; z-index: auto; animation: none;
  display: flex; flex-direction: column; border-radius: 14px;
  background: rgba(var(--panel-rgb), 0.72); border: 1px solid var(--accent-border); box-shadow: 0 0 40px rgba(var(--accent-rgb), 0.14);
}
#showcase.full header { padding: 14px 20px 12px; }
#showcase.full h3 { font-size: 18px; }
#showcase.full .body { flex: 1; min-height: 0; padding: 18px 22px; font-size: 15px; }
#showcase.full .body svg { max-height: calc(100vh - var(--bar-height) - 260px); }
#showcase.full iframe.free { height: 100%; min-height: 300px; }
#showcase.full .empty { height: 100%; display: flex; align-items: center; justify-content: center; margin: 0; color: var(--text-3); font-size: 15px; text-align: center; }
#showcase .history { display: flex; gap: 6px; padding: 10px 16px 12px; border-top: 1px solid var(--accent-faint); overflow-x: auto; }
#showcase .history button { flex: none; max-width: 220px; min-height: 30px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
#showcase .history button.now { color: var(--accent); border-color: var(--accent-2); }

/* ---------- the projects (T366): the header's name is the button; the list under it ---------- */
#project { display: block; margin: 2px 0 0 26px; padding: 0; min-height: 0; border: 0; background: none; text-align: left;
  font-size: 11px; letter-spacing: 0.12em; color: var(--text-2); opacity: 0.85; cursor: pointer; }
#project::after { content: " ▾"; color: var(--accent-2); }
#project:hover, #project.under { color: var(--accent); opacity: 1; }
#projects { left: 38px; top: 80px; z-index: 22; width: 236px; /* the viewport's, under the project's name (T453) */ padding: 10px; border-radius: 10px;
  background: rgba(var(--panel-rgb), 0.96); border: 1px solid var(--accent-2); box-shadow: 0 0 22px rgba(var(--accent-rgb), 0.22); }
#projects h4 { margin: 0 0 8px; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
#projects .project-item { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 8px;
  margin: 0 0 6px; padding: 8px 10px; text-align: left; }
#projects .project-item span { font: 10px var(--mono); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; }
#projects .project-item.active { border-color: var(--accent); }
#projects .project-item.active span { color: var(--done); }

/* the profile (T947): the account signed in and the sign out, beside the bar (its button is in it) */
#profile-panel { right: calc(var(--side) + 28px); bottom: 14px; z-index: 22; width: 260px; padding: 12px; border-radius: 10px;
  background: rgba(var(--panel-rgb), 0.96); border: 1px solid var(--accent-2); box-shadow: 0 0 22px rgba(var(--accent-rgb), 0.22); }
#profile-panel h4 { margin: 0 0 10px; font: 11px var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
#profile-panel .profile-who { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-width: 0; }
#profile-panel .profile-who img { width: 40px; height: 40px; border-radius: 50%; flex: none; }
#profile-panel .profile-who div { display: flex; flex-direction: column; min-width: 0; }
#profile-panel .profile-who strong { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#profile-panel .profile-who span { font: 11px var(--mono); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#profile-panel .profile-logout { display: flex; width: 100%; justify-content: center; align-items: center; gap: 6px; }
#profile-panel .profile-logout svg { width: 17px; height: 17px; color: var(--accent); }

/* ---------- the story mode (T363): the whole conversation, and the box to write to the agent ---------- */
#mode-screen .story { height: 100%; display: flex; flex-direction: column; gap: 10px; max-width: 920px; margin: 0 auto; }
#mode-screen .story .log { flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: 14px 18px; list-style: none;
  border-radius: 12px; background: rgba(var(--panel-rgb), 0.72); border: 1px solid var(--accent-faint); }
#mode-screen .story .log li { margin: 0 0 12px; max-width: 78%; }
#mode-screen .story .log li .who { display: block; font: 10px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 3px; }
#mode-screen .story .log li .text { padding: 9px 12px; border-radius: 10px; font-size: 14px; line-height: 1.45; color: var(--text);
  background: rgba(var(--raise-rgb), 0.7); border: 1px solid var(--accent-faint); }
#mode-screen .story .log li .text p { margin: 0 0 6px; white-space: pre-wrap; }
#mode-screen .story .log li .text p:last-child { margin-bottom: 0; }
#mode-screen .story .log li .text ul, #mode-screen .story .log li .text ol { margin: 4px 0 6px; padding-left: 20px; }
#mode-screen .story .log li .text code { font: 12.5px var(--mono); padding: 1px 4px; border-radius: 4px; background: rgba(0, 0, 0, 0.35); }
#mode-screen .story .log li .text pre { margin: 6px 0; padding: 8px 10px; border-radius: 6px; overflow-x: auto;
  background: rgba(0, 0, 0, 0.4); font: 12.5px/1.45 var(--mono); }
#mode-screen .story .log li .text pre code { padding: 0; background: none; }
#mode-screen .story .log li[data-who="you"] { margin-left: auto; text-align: right; }
#mode-screen .story .log li[data-who="you"] .text { background: rgba(var(--accent-rgb), 0.12); border-color: var(--accent-border); text-align: left; }
#mode-screen .story .log li[data-who="system"] { max-width: 100%; }
#mode-screen .story .log li[data-who="system"] .text { background: none; border: 0; padding: 0; color: var(--text-3); font-size: 12px; }
#mode-screen .story .log li.partial .text { opacity: 0.6; }
/* T376: the agent's tools in the conversation, one line each, what they returned folded */
#mode-screen .story .log li[data-who="tool"] { max-width: 100%; margin: -6px 0 8px; }
#mode-screen .story .log li[data-who="tool"] .who { display: none; }
#mode-screen .story .log li[data-who="tool"] summary { cursor: pointer; font: 11.5px var(--mono); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mode-screen .story .log li[data-who="tool"] pre { margin: 4px 0 0 14px; max-height: 220px; overflow: auto; padding: 6px 8px; border-radius: 6px;
  font: 11.5px/1.4 var(--mono); color: var(--text-2); background: rgba(0, 0, 0, 0.35); white-space: pre-wrap; word-break: break-all; }
#mode-screen .story .log li.empty { max-width: 100%; color: var(--text-3); text-align: center; margin-top: 30%; }
#mode-screen .story-form { display: flex; gap: 8px; }
#mode-screen .story-form input { flex: 1; min-height: 42px; padding: 0 14px; border-radius: 10px; font: 14px var(--font); color: var(--text);
  background: rgba(var(--panel-rgb), 0.9); border: 1px solid var(--accent-border); }
#mode-screen .story-form button { min-width: 96px; }

/* ---------- the attachments (T367): the card's panel and the viewer ---------- */
#panel .attachments .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
#panel .attachment { display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-height: 0; padding: 6px; text-align: left; }
#panel .attachment img { width: 100%; height: 64px; object-fit: cover; border-radius: 4px; background: rgba(0, 0, 0, 0.3); }
#panel .attachment .kind { display: flex; align-items: center; justify-content: center; height: 64px; border-radius: 4px;
  font: 11px var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); background: rgba(var(--accent-rgb), 0.08); }
#panel .attachment .name { font-size: 11px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#viewer { left: calc(50% - var(--side) / 2); top: 50%; transform: translate(-50%, -50%); z-index: 33; width: min(980px, calc(100vw - 80px - var(--side)));
  max-height: calc(100vh - var(--bar-height) - 60px); display: flex; flex-direction: column; border-radius: 12px;
  background: rgba(var(--panel-rgb), 0.97); border: 1px solid var(--accent-2); box-shadow: 0 0 34px rgba(var(--accent-rgb), 0.25); }
#viewer header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--accent-faint); }
#viewer h3 { flex: 1; margin: 0; font-size: 14px; letter-spacing: 0.04em; }
#viewer .body { flex: 1; min-height: 0; overflow: auto; padding: 14px; display: flex; align-items: center; justify-content: center; }
#viewer img, #viewer video { max-width: 100%; max-height: calc(100vh - var(--bar-height) - 160px); border-radius: 6px; background: #000; }
#viewer audio { width: 100%; }
#viewer pre { align-self: stretch; margin: 0; white-space: pre-wrap; font: 12.5px var(--mono); color: var(--text); }
#viewer a { color: var(--accent); }

/* the tab that stepped aside: the Orbit is open in another tab (one connected at a time) */
.tab-elsewhere { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(6, 7, 8, 0.88); color: var(--text); font-size: 16px; }
.tab-elsewhere button { padding: 8px 18px; border: 1px solid var(--accent-border); border-radius: 8px; background: var(--glass); color: var(--accent); font: inherit; cursor: pointer; }

/* ---------- the frames (T441, docs/studies/orbit-identidade-visual.md): neo-militarism with Marathon's marks ----------
   the cut corners (the diagonal drawn), the corner brackets, the hazard stripes, and the microtext of real data
   (hud.mjs writes data-micro). The decorative stays below what is read: thinner, dimmer, in the system's color. */
:root { --cut: 14px; --cut-s: 7px; --hazard: repeating-linear-gradient(-45deg, var(--accent) 0 5px, transparent 5px 10px);
  /* the same diagonals and brackets as background layers, for the panels that scroll (a ::before inside would take room) */
  --fui-layers:
    linear-gradient(to bottom left, transparent calc(50% - 0.75px), var(--accent-2) calc(50% - 0.75px), var(--accent-2) calc(50% + 0.75px), transparent calc(50% + 0.75px)) top right / var(--cut) var(--cut) no-repeat,
    linear-gradient(to top right, transparent calc(50% - 0.75px), var(--accent-2) calc(50% - 0.75px), var(--accent-2) calc(50% + 0.75px), transparent calc(50% + 0.75px)) bottom left / var(--cut) var(--cut) no-repeat,
    linear-gradient(var(--accent), var(--accent)) top left / 12px 2px no-repeat, linear-gradient(var(--accent), var(--accent)) top left / 2px 12px no-repeat,
    linear-gradient(var(--accent), var(--accent)) bottom right / 12px 2px no-repeat, linear-gradient(var(--accent), var(--accent)) bottom right / 2px 12px no-repeat; }
#mode-screen .story .log { background: var(--fui-layers), rgba(var(--panel-rgb), 0.72); }
#left, #panel, #bar, #selector, #choices, #showcase, #viewer, #projects, #hand-panel,
#mode-screen .story .log {
  border-radius: 0;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}
/* the diagonals of the cut corners, and the brackets on the two square corners */
#left::before, #panel::before, #bar::before, #selector::before, #choices::before, #showcase::before, #viewer::before,
#projects::before, #hand-panel::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background:
    linear-gradient(to bottom left, transparent calc(50% - 0.75px), var(--accent-2) calc(50% - 0.75px), var(--accent-2) calc(50% + 0.75px), transparent calc(50% + 0.75px)) top right / var(--cut) var(--cut) no-repeat,
    linear-gradient(to top right, transparent calc(50% - 0.75px), var(--accent-2) calc(50% - 0.75px), var(--accent-2) calc(50% + 0.75px), transparent calc(50% + 0.75px)) bottom left / var(--cut) var(--cut) no-repeat,
    linear-gradient(var(--accent), var(--accent)) top left / 12px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) top left / 2px 12px no-repeat,
    linear-gradient(var(--accent), var(--accent)) bottom right / 12px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) bottom right / 2px 12px no-repeat;
}
#mode-screen .story .log { position: relative; }
/* the microtext: the system's small line, top right, inside the cut */
#left::after, #panel::after, #selector::after, #choices::after, #mode-screen::after {
  content: attr(data-micro); position: absolute; top: 3px; right: calc(var(--cut) + 6px); z-index: 2; pointer-events: none;
  font: 500 8.5px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--system); opacity: 0.55; white-space: nowrap;
}
#mode-screen::after { top: -16px; right: 2px; }
#panel::after { right: auto; left: 20px; top: 5px; } /* the close button is on the right */
/* the cut on the small pieces: the buttons, the chips, the mode bar */
#bar button, #modes, #modes .mode, #choices button, #panel .close, #selector .close, .place, #line, .status,
.label.cat, .label.sub, .label.center, .label.card.under, .label.card.open, #mode-screen .story-form input, #mode-screen .story-form button {
  border-radius: 0;
  clip-path: polygon(0 0, calc(100% - var(--cut-s)) 0, 100% var(--cut-s), 100% 100%, var(--cut-s) 100%, 0 calc(100% - var(--cut-s)));
}
/* the hazard stripes: over what asks for attention (the question to the owner, the legend's rule) */
#choices { padding-top: 22px; }
#choices .question::before { content: ""; display: block; height: 4px; margin: -10px auto 12px; width: 120px; background: var(--hazard); opacity: 0.85; }
#legend { border-top: 0; position: relative; }
#legend::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--hazard); opacity: 0.35; }
/* a ruler under the brand: Marathon's printed marks */
.brand { position: relative; padding-bottom: 6px; }
.brand::after { content: ""; position: absolute; left: 26px; right: 0; bottom: 0; height: 4px;
  background: repeating-linear-gradient(90deg, var(--accent-border) 0 1px, transparent 1px 6px); }

/* ---------- the scene breathes with the voice (T444, pulse.mjs: --voice 0..1, data-voice owner|agent) ---------- */
:root { --voice: 0; --voice-rgb: var(--accent-rgb); }
:root[data-voice="owner"] { --voice-rgb: 255, 154, 31; }
#bar { box-shadow: inset 0 0 calc(22px * var(--voice)) rgba(var(--voice-rgb), calc(0.35 * var(--voice))); } /* inside: the cut corners clip what is outside */
.label.center { filter: drop-shadow(0 0 calc(22px * var(--voice)) rgba(var(--voice-rgb), calc(0.7 * var(--voice)))); }
#left::after, #panel::after, #selector::after, #choices::after, #mode-screen::after { opacity: calc(0.55 + 0.45 * var(--voice)); }

/* ---------- T461: the lock-on and the card's reveal ---------- */
/* the lock-on: four brackets close on the label in focus (labels.mjs .locked), then stay, breathing */
.label.locked { overflow: visible; clip-path: none !important; } /* the brackets are its frame while locked (T441's cut would clip them) */
.label.locked::before, .label.locked::after {
  content: ""; position: absolute; inset: -7px; pointer-events: none;
  border: 2px solid var(--accent); animation: lock-on 0.42s cubic-bezier(0.2, 0.9, 0.2, 1) both, lock-breathe 2.6s ease-in-out 0.42s infinite;
  -webkit-mask: linear-gradient(#000 0 0) top left / 10px 10px no-repeat, linear-gradient(#000 0 0) top right / 10px 10px no-repeat,
                linear-gradient(#000 0 0) bottom left / 10px 10px no-repeat, linear-gradient(#000 0 0) bottom right / 10px 10px no-repeat;
          mask: linear-gradient(#000 0 0) top left / 10px 10px no-repeat, linear-gradient(#000 0 0) top right / 10px 10px no-repeat,
                linear-gradient(#000 0 0) bottom left / 10px 10px no-repeat, linear-gradient(#000 0 0) bottom right / 10px 10px no-repeat;
}
.label.locked::after { inset: -13px; border-width: 1px; opacity: 0.45; animation-delay: 0.06s, 0.5s; }
@keyframes lock-on { from { transform: scale(1.9); opacity: 0; } 60% { opacity: 1; } to { transform: scale(1); opacity: 1; } }
@keyframes lock-breathe { 50% { transform: scale(1.06); } }
/* the card's reveal: the panel opens as a scan from its top, the cut corners kept, with a brief flare */
#panel.reveal { animation: panel-scan 0.38s cubic-bezier(0.3, 0.8, 0.3, 1) both, panel-flare 0.5s ease-out both; }
@keyframes panel-scan {
  from { clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% var(--cut), var(--cut) var(--cut), 0 var(--cut)); }
  to { clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut))); }
}
@keyframes panel-flare { from { filter: brightness(1.9) saturate(1.3); } to { filter: none; } }
@media (prefers-reduced-motion: reduce) { .label.locked::before, .label.locked::after, #panel.reveal { animation: none; } }
/* T541: the agent points at a button it names (pointing.mjs): the lock-on's brackets close on it over the page (the bar's
   cut corners would clip them inside it), then breathe until they go; the button itself raised */
.point-ring { position: fixed; pointer-events: none; z-index: 100000; }
.point-ring::before, .point-ring::after {
  content: ""; position: absolute; inset: -7px; border: 2px solid var(--accent); box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.45);
  animation: lock-on 0.42s cubic-bezier(0.2, 0.9, 0.2, 1) both, lock-breathe 1.3s ease-in-out 0.42s infinite;
  -webkit-mask: linear-gradient(#000 0 0) top left / 12px 12px no-repeat, linear-gradient(#000 0 0) top right / 12px 12px no-repeat,
                linear-gradient(#000 0 0) bottom left / 12px 12px no-repeat, linear-gradient(#000 0 0) bottom right / 12px 12px no-repeat;
          mask: linear-gradient(#000 0 0) top left / 12px 12px no-repeat, linear-gradient(#000 0 0) top right / 12px 12px no-repeat,
                linear-gradient(#000 0 0) bottom left / 12px 12px no-repeat, linear-gradient(#000 0 0) bottom right / 12px 12px no-repeat;
}
.point-ring::after { inset: -14px; border-width: 1px; opacity: 0.5; animation-delay: 0.06s, 0.5s; }
.pointed { color: var(--text) !important; border-color: var(--accent) !important; background: rgba(var(--accent-rgb), 0.18) !important; }
@media (prefers-reduced-motion: reduce) { .point-ring::before, .point-ring::after { animation: none; } }

/* ---------- T473: the agent's attention (the labels it looks at; a place elsewhere) ---------- */
.label.attended { color: #e6fbff; text-shadow: 0 0 8px rgba(63, 224, 255, 0.95), 0 0 2px #000; box-shadow: 0 0 16px rgba(63, 224, 255, 0.35);
  transition: box-shadow 0.3s, text-shadow 0.3s; } /* T473: only a glow on the card the signal reaches */
#attention-elsewhere { margin: 6px 0 0; padding: 4px 8px; font: 500 10.5px var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--system); border-left: 2px solid var(--system); background: rgba(63, 224, 255, 0.07); animation: breathe 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { #attention-elsewhere { animation: none; } }

/* ---------- T475: the signal lost (a piece really down) and back ---------- */
body.signal-lost #stage, body.signal-lost #mode-screen, body.signal-lost #left { filter: saturate(0.2) contrast(1.15) brightness(0.85); transition: filter 0.3s; }
body.signal-lost::after {
  content: ""; position: fixed; inset: 0; z-index: 65; pointer-events: none; opacity: 0.16; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 3px);
  animation: signal-noise 0.18s steps(4) infinite;
}
@keyframes signal-noise { 0% { background-position: 0 0, 0 0; } 25% { background-position: -60px 40px, 0 1px; } 50% { background-position: 50px -30px, 0 2px; } 75% { background-position: -20px -70px, 0 1px; } }
#signal { position: fixed; top: 56px; left: 50%; transform: translateX(calc(-50% - var(--side) / 2)); z-index: 66; pointer-events: none;
  padding: 6px 16px; font: 600 12px var(--mono); letter-spacing: 0.2em; text-transform: uppercase; border: 1px solid currentColor; background: rgba(6, 7, 8, 0.85); }
#signal.lost { color: var(--blocked); animation: signal-blink 1.1s steps(2) infinite; }
#signal.back { color: var(--system); animation: signal-flash 1.4s ease-out both; }
@keyframes signal-blink { 50% { opacity: 0.35; } }
@keyframes signal-flash { 0% { opacity: 0; filter: brightness(2.5); } 15% { opacity: 1; } 80% { opacity: 1; filter: none; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { body.signal-lost::after, #signal.lost, #signal.back { animation: none; } }

/* ---------- T476: the place's climate (climate.mjs): the edges tinted by its health, lightly ---------- */
:root { --amb-rgb: 198, 255, 26; --amb-a: 0; }
#ambient { position: fixed; inset: 0; z-index: 4; pointer-events: none; mix-blend-mode: screen; transition: opacity 1.2s, background 1.2s;
  background: radial-gradient(ellipse at 50% 50%, transparent 45%, rgba(var(--amb-rgb), var(--amb-a)) 100%),
              radial-gradient(ellipse at 50% 120%, rgba(var(--amb-rgb), calc(var(--amb-a) * 0.8)) 0%, transparent 55%); }
body.amb-pulse #ambient { animation: amb-pulse 3.4s ease-in-out infinite; }
@keyframes amb-pulse { 50% { opacity: 0.45; } }
body[data-mode]:not([data-mode="management"]) #ambient { opacity: 0.5; }
@media (prefers-reduced-motion: reduce) { body.amb-pulse #ambient { animation: none; } }

/* ---------- T477: the space between the modes: the graph recedes with the camera and fades out entirely ---------- */
#stage { transition: filter 0.7s ease, opacity 0.7s ease; }
body[data-mode]:not([data-mode="management"]) #stage { pointer-events: none; opacity: 0; filter: blur(5px) saturate(0.6); } /* T477 (the owner): it goes to the back, the camera moves away, and it disappears: no residue under the mode (the face's membrane is the only background) */
body[data-mode]:not([data-mode="management"]) .label-layer { opacity: 0; transition: opacity 0.3s; }

/* ---------- T478: the project's jump: a tunnel of light streaks while the graph collapses and the new one arrives ---------- */
body.warping::before {
  content: ""; position: fixed; inset: -20%; z-index: 6; pointer-events: none; mix-blend-mode: screen;
  background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(var(--accent-rgb), 0.0) 0deg 3deg, rgba(var(--accent-rgb), 0.22) 3deg 3.6deg, rgba(var(--accent-rgb), 0) 3.6deg 9deg);
  -webkit-mask: radial-gradient(circle at 50% 50%, transparent 8%, #000 40%, transparent 75%); mask: radial-gradient(circle at 50% 50%, transparent 8%, #000 40%, transparent 75%);
  animation: warp-tunnel 1.3s cubic-bezier(0.5, 0, 0.3, 1) both;
}
@keyframes warp-tunnel { 0% { opacity: 0; transform: scale(0.4) rotate(0deg); } 25% { opacity: 1; } 100% { opacity: 0; transform: scale(2.2) rotate(14deg); } }
@media (prefers-reduced-motion: reduce) { body.warping::before { animation: none; display: none; } }

/* ---------- T479: the card as its node's hologram: the line of light, the panel projected in perspective ---------- */
#tether { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 9; pointer-events: none; opacity: 0; transition: none; overflow: visible; }
#tether.on { opacity: 1; transition: opacity 0.35s; } /* the entry fades in; the exit is at once, with the card (no line left floating) */
#tether polyline { fill: none; stroke-linejoin: round; }
#tether .glow { stroke: rgba(var(--accent-rgb), 0.28); stroke-width: 6; filter: blur(3px); }
#tether .line { stroke: var(--accent); stroke-width: 1.4; stroke-dasharray: 6 4; animation: tether-flow 0.9s linear infinite; }
#tether circle { fill: var(--accent); }
#tether .ring { fill: none; stroke: var(--accent-2); stroke-width: 1.2; animation: lock-breathe 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes tether-flow { to { stroke-dashoffset: -20; } }
/* T479 (the owner): the panel is a hologram: the whole of it, frame and content, leans toward the side its card came from */
body.with-panel #panel { transform-origin: right center; backface-visibility: hidden; }
body.with-panel #panel[data-from="left"] { transform: perspective(1400px) rotateY(-6deg); }
body.with-panel #panel[data-from="right"] { transform: perspective(1400px) rotateY(5deg) rotateZ(-0.4deg); transform-origin: left center; }
/* T479 (the owner): a card from the graph's right opens on the screen's left, beside the categories' menu */
#panel[data-from="right"] { left: 264px; right: auto; animation-name: panel-in-left; }
#panel[data-from="right"].reveal { animation: panel-scan 0.38s cubic-bezier(0.3, 0.8, 0.3, 1) both, panel-flare 0.5s ease-out both; }
@keyframes panel-in-left { from { opacity: 0; transform: translateX(-24px); } }
body.with-panel:has(#panel[data-from="right"]) #hand-panel { right: calc(var(--side) + 28px); }
@media (prefers-reduced-motion: reduce) { #tether .line, #tether .ring { animation: none; } }

/* ---------- T480: the voice's wave around the full-screen modes' frames (mode_wave.mjs draws it) ---------- */
#mode-wave { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 11; pointer-events: none; }

/* ---------- T497: the categories' icons whole: the labels' cut follows their size (the zoom), the icon never squashed ---------- */
.label.cat, .label.sub, .label.center, .label.card.under, .label.card.open {
  --cut-l: 0.42em; /* the cut in the label's own size: at a far zoom it shrinks with it, it never eats the icon */
  clip-path: polygon(0 0, calc(100% - var(--cut-l)) 0, 100% var(--cut-l), 100% 100%, var(--cut-l) 100%, 0 calc(100% - var(--cut-l)));
}
.label.cat, .label.sub { padding-left: 0.72em; }
.label.cat svg, .label.sub svg, #panel .trail svg { flex: none; aspect-ratio: 1 / 1; }

/* ---------- T484: the hand's light: the trail (hand_trail.mjs) and the pinch's ripple ---------- */
#hand-trail { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 49; pointer-events: none; }
.hand-ripple { position: fixed; z-index: 49; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; pointer-events: none;
  border: 2px solid #ffe08a; box-shadow: 0 0 14px rgba(255, 210, 110, 0.8); animation: hand-ripple 0.85s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
@keyframes hand-ripple { to { transform: scale(9); opacity: 0; border-width: 1px; } }
@media (prefers-reduced-motion: reduce) { .hand-ripple { animation-duration: 0.01s; } }

/* T941: the screen of who is not in (login.html): only the Google button, in the Orbit's look */
body.login { display: grid; place-items: center; min-height: 100vh; margin: 0; background: var(--bg); color: var(--text); }
.login-box { display: grid; gap: 18px; justify-items: center; padding: 40px 48px; border: 1px solid var(--accent-border);
  background: var(--accent-faint); clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px); }
.login-box h1 { margin: 0; letter-spacing: 0.2em; text-transform: uppercase; font-size: 18px; color: var(--accent); }
.login-google { padding: 12px 22px; border: 1px solid var(--accent); color: var(--accent); text-decoration: none;
  letter-spacing: 0.08em; text-transform: uppercase; font-size: 13px; }
.login-google:hover, .login-google:focus-visible { background: var(--accent); color: var(--bg); outline: none; }
.login-refused { margin: 0; color: #ff8a7a; }

/* T971: the welcome (welcome.html): an account with no project yet, in the login's look */
.welcome-box { max-width: 520px; text-align: center; }
.welcome-box h2 { margin: 0; font-size: 20px; font-weight: 500; }
.welcome-box p { margin: 0; line-height: 1.5; }
.welcome-form { display: grid; gap: 10px; justify-items: center; width: 100%; }
.welcome-form input { width: min(100%, 320px); padding: 10px 12px; border: 1px solid var(--accent-border); background: var(--bg);
  color: var(--text); font: inherit; }
.welcome-form input:focus-visible { outline: 1px solid var(--accent); }
.welcome-form button { background: none; font: inherit; cursor: pointer; }
.welcome-form button:disabled { opacity: 0.5; cursor: wait; }
.welcome-agent { font-size: 13px; opacity: 0.75; }
