:root {
  --bg: #06101d;
  --panel: rgba(10, 24, 43, .9);
  --panel-2: rgba(14, 32, 57, .96);
  --text: #f7fbff;
  --muted: #a7b8cc;
  --line: #64a8ff;
  --line-red: #ff4055;
  --red: #e21b2d;
  --red-2: #ff5868;
  --white: #fff;
  --shadow: rgba(0, 0, 0, .38);
  --scale: 1;
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    radial-gradient(circle at 14% 5%, rgba(226,27,45,.22), transparent 26%),
    radial-gradient(circle at 90% 0%, rgba(69,137,222,.2), transparent 24%),
    linear-gradient(180deg, #071321 0%, #050b14 100%);
  overflow-x: hidden;
}
button, input { font: inherit; }
button { cursor: pointer; }

.skip-link { position:absolute; left:-999px; top:0; z-index:1000; background:#fff; color:#06101d; padding:8px 12px; border-radius:10px; }
.skip-link:focus { left:12px; top:12px; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
.hidden { display: none !important; }

.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(520px, 1.5fr);
  gap: 16px;
  padding: 14px 18px 10px;
  background: linear-gradient(180deg, rgba(5,12,22,.98), rgba(5,12,22,.78));
  border-bottom: 1px solid rgba(190,215,245,.15);
  backdrop-filter: blur(14px);
}
.brand__kicker { color: var(--red-2); text-transform: uppercase; letter-spacing: .18em; font-size: 11px; font-weight: 800; }
.brand h1 { margin: 4px 0 3px; font-size: clamp(23px, 2.4vw, 34px); line-height: 1.03; }
.brand p { margin: 0; color: var(--muted); font-size: 14px; }
.controls { display: grid; gap: 8px; align-content: start; }
.controls input[type="search"] {
  width: 100%; min-height: 38px; border-radius: 12px; border: 1px solid rgba(190,215,245,.18);
  background: rgba(4, 10, 19, .82); color: var(--text); padding: 9px 12px; outline: none;
}
.controls input[type="search"]:focus { box-shadow: 0 0 0 2px rgba(255,255,255,.85); }
.toolbar-actions, .chip-row { display:flex; flex-wrap:wrap; gap:7px; align-items:center; }
.btn, .chip {
  border: 1px solid rgba(190,215,245,.18); color: var(--text); background: rgba(17,38,68,.92);
  border-radius: 999px; padding: 8px 12px; min-height: 36px; transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.btn:hover, .chip:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.4); }
.btn--accent { background: linear-gradient(180deg, rgba(226,27,45,.95), rgba(145,18,30,.95)); }
.btn--ghost { background: rgba(8,19,34,.66); }
.btn--small { min-height: 32px; padding: 6px 10px; font-size: 13px; }
.chip { display:inline-flex; gap:7px; align-items:center; font-size: 13px; color: #d7e5f5; }
.chip[aria-pressed="true"] { background: rgba(226,27,45,.24); border-color: rgba(255,88,104,.72); color:#fff; }
.chip__count { color: var(--muted); font-size: 12px; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 14px;
  padding: 12px 18px 20px;
  align-items: start;
}
.map-card, .drawer, .diagnostics {
  background: var(--panel); border: 1px solid rgba(190,215,245,.14); border-radius: 22px; box-shadow: 0 18px 46px var(--shadow);
}
.map-card { position: relative; overflow: hidden; min-height: calc(100vh - 126px); }
.map-status {
  position: absolute; left: 14px; top: 12px; z-index: 12; max-width: calc(100% - 28px);
  color: #d9e8fa; background: rgba(3,9,17,.72); border: 1px solid rgba(190,215,245,.14);
  border-radius: 999px; padding: 7px 11px; font-size: 13px; pointer-events: none;
}
.viewport {
  min-height: calc(100vh - 126px);
  height: calc(100vh - 126px);
  overflow: auto;
  cursor: grab;
  touch-action: pan-x pan-y;
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
    radial-gradient(circle at center, rgba(33,74,122,.24), transparent 44%);
  background-size: 48px 48px, 48px 48px, auto;
}
.viewport.is-dragging { cursor: grabbing; user-select: none; }
.board {
  position: relative;
  width: 1500px;
  height: 900px;
  transform-origin: 0 0;
  zoom: var(--scale);
}
.board[data-mode="focus"] { width: 1680px; height: 1080px; }
.connectors { position:absolute; inset:0; width:100%; height:100%; overflow:visible; z-index:1; pointer-events:none; }
.nodes-layer { position:absolute; inset:0; z-index:2; }

.mind-node {
  position: absolute;
  display: grid;
  gap: 6px;
  width: 230px;
  min-height: 88px;
  padding: 13px 14px;
  border-radius: 18px;
  border: 1px solid rgba(190,215,245,.22);
  background: linear-gradient(180deg, rgba(15,34,60,.96), rgba(8,18,32,.96));
  color: var(--text);
  box-shadow: 0 12px 28px rgba(0,0,0,.27), inset 0 1px 0 rgba(255,255,255,.04);
  text-align: left;
  outline: none;
}
.mind-node:hover, .mind-node:focus-visible { border-color: rgba(255,255,255,.58); box-shadow: 0 0 0 2px rgba(255,255,255,.15), 0 16px 36px rgba(0,0,0,.35); }
.mind-node.is-selected { border-color: #fff; box-shadow: 0 0 0 3px rgba(226,27,45,.42), 0 16px 36px rgba(0,0,0,.36); }
.mind-node.is-muted { opacity: .22; }
.node-root {
  width: 282px; min-height: 116px; place-content: center; text-align: center;
  border: 2px solid rgba(255,255,255,.78);
  background: radial-gradient(circle at 50% 10%, rgba(255,255,255,.12), transparent 42%), linear-gradient(180deg, #e21b2d, #8f111d);
}
.node-direction { width: 252px; }
.board[data-mode="overview"] .node-direction { height: 172px; overflow: hidden; }
.board[data-mode="overview"] .node-direction .node-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.node-direction .node-title { font-size: 18px; }
.node-current { background: linear-gradient(180deg, rgba(28,60,101,.98), rgba(12,28,50,.98)); }
.node-target { background: linear-gradient(180deg, rgba(250,252,255,.99), rgba(218,230,243,.98)); color: #071321; border-color: rgba(226,27,45,.35); }
.node-stage { background: linear-gradient(180deg, rgba(17,36,63,.98), rgba(9,20,36,.98)); border-color: rgba(100,168,255,.36); }
.node-milestone { width: 238px; min-height: 76px; background: rgba(12,25,45,.96); border-color: rgba(255,64,85,.38); }
.node-task { width: 248px; min-height: 68px; background: rgba(8,18,32,.92); border-style: dashed; }
.node-label { color: var(--muted); text-transform: uppercase; letter-spacing: .11em; font-size: 10px; font-weight: 800; }
.node-title { font-weight: 800; font-size: 16px; line-height: 1.16; }
.node-text { color: #c4d3e4; font-size: 13px; line-height: 1.35; }
.node-target .node-text, .node-target .node-label { color: #33485f; }
.node-badges { display:flex; flex-wrap:wrap; gap:5px; }
.badge { display:inline-flex; border:1px solid rgba(190,215,245,.18); border-radius:999px; padding:3px 7px; color:#dce9f7; background:rgba(3,9,17,.45); font-size:11px; }
.node-target .badge { color: #13243a; border-color: rgba(19,36,58,.18); }

.drawer { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; padding: 16px; }
.drawer h2 { margin: 0; font-size: 21px; line-height: 1.15; }
.drawer h3 { margin: 15px 0 7px; font-size: 15px; }
.drawer p { margin: 0; color: #cbd9e8; line-height: 1.48; }
.drawer__empty { color: #cbd9e8; }
.drawer__head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; }
.drawer__eyebrow { color: var(--red-2); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 800; margin-bottom: 5px; }
.drawer__meta { display:flex; flex-wrap:wrap; gap:6px; margin: 12px 0; }
.drawer__summary { margin-bottom: 12px !important; }
.list { margin: 0; padding-left: 18px; color: #cbd9e8; }
.list li + li { margin-top: 6px; }
.drawer-stages { display:grid; gap:8px; }
.drawer-stage { border:1px solid rgba(190,215,245,.14); border-radius:14px; padding:10px; background:rgba(4,11,20,.5); }
.drawer-stage strong { display:block; margin-bottom:4px; }
.diagnostics { margin: 0 18px 18px; padding: 12px 14px; color: #cbd9e8; white-space: pre-wrap; }

.connector-main { stroke: rgba(255,255,255,.64); stroke-width: 5; fill: none; stroke-linecap: round; }
.connector-branch { stroke: var(--line); stroke-width: 4; fill: none; stroke-linecap: round; }
.connector-red { stroke: var(--line-red); stroke-width: 3; fill: none; stroke-linecap: round; stroke-dasharray: 8 8; }
.connector-muted { stroke: rgba(190,215,245,.36); stroke-width: 2.5; fill: none; stroke-linecap: round; }

@media (max-width: 1180px) {
  .topbar { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr; }
  .drawer { position: static; max-height: none; }
  .map-card, .viewport { min-height: 68vh; height: 68vh; }
}
@media (max-width: 720px) {
  .topbar { padding: 10px 10px 8px; gap: 9px; }
  .brand h1 { font-size: 24px; }
  .brand p { font-size: 13px; }
  .layout { padding: 10px; }
  .toolbar-actions, .chip-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .toolbar-actions::-webkit-scrollbar, .chip-row::-webkit-scrollbar { display:none; }
  .btn, .chip { flex: 0 0 auto; padding: 7px 10px; min-height: 34px; }
  .controls input[type="search"] { min-height: 36px; }
  .map-card, .viewport { min-height: 72vh; height: 72vh; }
  .board { width: 1360px; height: 920px; }
  .board[data-mode="focus"] { width: 1600px; height: 1100px; }
  .drawer { padding: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
