:root {
  color-scheme: dark;
  --bg: #080d19;
  --surface: rgba(14, 22, 39, 0.88);
  --surface-strong: #111b2f;
  --surface-soft: rgba(255, 255, 255, 0.04);
  --line: rgba(170, 195, 232, 0.14);
  --line-strong: rgba(170, 195, 232, 0.28);
  --text: #f7f9fc;
  --muted: #91a2bc;
  --muted-strong: #c0cad8;
  --accent: #72ddf7;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 8%, rgba(38, 153, 255, 0.14), transparent 28%),
    radial-gradient(circle at 88% 90%, rgba(168, 85, 247, 0.12), transparent 31%),
    var(--bg);
  color: var(--text);
  font-family: Manrope, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, a { font: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.ambient { position: fixed; z-index: -1; width: 430px; height: 430px; border-radius: 50%; filter: blur(110px); opacity: .15; pointer-events: none; }
.ambient-blue { top: -260px; left: 18%; background: #218bff; }
.ambient-violet { right: -240px; bottom: -250px; background: #a855f7; }

.app-shell { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; min-height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px clamp(20px, 3vw, 48px); border-bottom: 1px solid var(--line); background: rgba(8, 13, 25, .72); backdrop-filter: blur(18px); }
.brand { display: inline-flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid rgba(114, 221, 247, .35); border-radius: 14px; background: linear-gradient(145deg, rgba(114,221,247,.18), rgba(168,85,247,.15)); color: #e3fbff; font-size: 1.12rem; font-weight: 800; box-shadow: inset 0 1px rgba(255,255,255,.14), 0 12px 32px rgba(0,0,0,.24); }
.brand span:last-child { display: grid; gap: 1px; }
.brand small { color: var(--muted); font-size: .65rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.brand strong { font-size: 1.18rem; letter-spacing: -.04em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.live-status { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted-strong); font-size: .7rem; font-weight: 700; }
.live-status i { width: 7px; height: 7px; border-radius: 50%; background: #61e7a8; box-shadow: 0 0 12px rgba(97,231,168,.7); }
.icon-button { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line-strong); border-radius: 11px; background: rgba(255,255,255,.04); color: var(--text); cursor: pointer; }

.breadcrumbs { display: flex; align-items: center; gap: 8px; min-height: 48px; overflow-x: auto; padding: 8px clamp(20px, 3vw, 48px); border-bottom: 1px solid var(--line); background: rgba(10,17,31,.68); scrollbar-width: none; }
.breadcrumbs::-webkit-scrollbar { display: none; }
.breadcrumbs button { flex: 0 0 auto; padding: 6px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: .72rem; font-weight: 700; cursor: pointer; }
.breadcrumbs button[aria-current="page"] { background: rgba(114,221,247,.1); color: #dffaff; }
.breadcrumb-separator { color: #50617a; }

.workspace { display: grid; grid-template-columns: minmax(0,1fr); min-height: 0; padding: 14px clamp(14px,2vw,28px); }
.canvas-panel { min-height: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow),inset 0 1px rgba(255,255,255,.035); backdrop-filter: blur(18px); }
.canvas-panel { display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.canvas-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: .65rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.canvas-heading h1 { max-width: 760px; margin: 0; font-size: clamp(1.3rem, 2.1vw, 1.9rem); line-height: 1.15; letter-spacing: -.045em; }
.canvas-heading p:last-child { max-width: 760px; margin: 8px 0 0; color: var(--muted-strong); font-size: .77rem; line-height: 1.55; }
.level-indicator { display: flex; flex: 0 0 auto; gap: 5px; padding-top: 5px; }
.level-indicator i { width: 18px; height: 4px; border-radius: 99px; background: rgba(255,255,255,.09); }
.level-indicator i.is-active { background: var(--accent); box-shadow: 0 0 10px rgba(114,221,247,.45); }

.journey { position: relative; display: grid; min-height: 480px; place-items: center; overflow-x: auto; overflow-y: hidden; padding: 38px 34px; background: linear-gradient(rgba(125,151,190,.035) 1px, transparent 1px), linear-gradient(90deg,rgba(125,151,190,.035) 1px,transparent 1px), radial-gradient(circle at center,rgba(34,139,255,.075),transparent 48%); background-size: 36px 36px,36px 36px,auto; scrollbar-color: #34435a transparent; }
.journey-grid { position: relative; z-index: 1; display: grid; width: 100%; min-width: calc(var(--step-count) * 170px); grid-template-columns: repeat(var(--step-count), minmax(150px,1fr)); gap: clamp(12px,1.5vw,21px); align-items: stretch; }
.journey-grid.is-short { width: min(620px,100%); min-width: 0; }
.journey-line { position: absolute; z-index: 0; top: 50%; right: 8%; left: 8%; height: 1px; background: linear-gradient(90deg,transparent,rgba(114,221,247,.5) 12%,rgba(168,85,247,.45) 88%,transparent); }
.journey-line::after { position: absolute; right: 0; top: -3px; width: 7px; height: 7px; border-top: 1px solid var(--accent); border-right: 1px solid var(--accent); content: ""; transform: rotate(45deg); }

.flow-card { position: relative; display: grid; grid-template-rows: 1fr auto; min-height: 250px; overflow: hidden; border: 1px solid color-mix(in srgb,var(--node-color) 28%,var(--line)); border-radius: 17px; background: linear-gradient(155deg,color-mix(in srgb,var(--node-color) 7%,transparent),rgba(12,20,35,.96) 46%); box-shadow: 0 16px 44px rgba(0,0,0,.24); transition: transform 180ms ease,border-color 180ms ease,box-shadow 180ms ease; }
.flow-card::before { position: absolute; inset: 0 0 auto; height: 3px; background: var(--node-color); box-shadow: 0 0 18px color-mix(in srgb,var(--node-color) 60%,transparent); content: ""; }
.flow-card.is-actor { background: linear-gradient(155deg,color-mix(in srgb,var(--node-color) 12%,transparent),rgba(12,20,35,.96) 52%); }
.flow-card.is-decision { border-style: dashed; }
.flow-card.is-product { box-shadow: 0 16px 44px rgba(0,0,0,.24),inset 0 0 32px color-mix(in srgb,var(--node-color) 6%,transparent); }
.flow-card.is-result { border-width: 2px; }
.flow-card:hover, .flow-card.is-selected { transform: translateY(-5px); border-color: color-mix(in srgb,var(--node-color) 65%,white 5%); box-shadow: 0 20px 55px rgba(0,0,0,.34),0 0 35px color-mix(in srgb,var(--node-color) 10%,transparent); }
.card-select { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto 1fr; gap: 12px; width: 100%; padding: 19px 16px 14px; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.node-icon, .detail-icon { display: grid; place-items: center; border: 1px solid color-mix(in srgb,var(--node-color) 42%,transparent); background: color-mix(in srgb,var(--node-color) 12%,transparent); color: color-mix(in srgb,var(--node-color) 84%,white); font-weight: 800; }
.node-icon { width: 40px; height: 40px; border-radius: 12px; font-size: .67rem; }
.card-index { align-self: center; justify-self: end; color: color-mix(in srgb,var(--node-color) 62%,var(--muted)); font-size: .65rem; font-weight: 800; letter-spacing: .12em; }
.card-copy { display: flex; grid-column: 1 / -1; flex-direction: column; }
.card-copy small { color: var(--node-color); font-size: .58rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.card-copy strong { margin-top: 7px; font-size: clamp(.92rem,1.2vw,1.08rem); line-height: 1.2; letter-spacing: -.035em; }
.card-copy span { margin-top: 10px; color: var(--muted); font-size: .68rem; line-height: 1.55; }
.expand-button { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 15px; border: 0; border-top: 1px solid var(--line); background: rgba(255,255,255,.025); color: var(--muted-strong); cursor: pointer; }
.expand-button span { color: var(--node-color); font-size: .7rem; letter-spacing: .15em; }
.expand-button em { font-size: .64rem; font-style: normal; font-weight: 800; text-transform: uppercase; }
.expand-button:hover { background: color-mix(in srgb,var(--node-color) 9%,transparent); color: var(--text); }
.end-label { display: flex; min-height: 48px; align-items: center; justify-content: center; gap: 8px; border: 0; border-top: 1px solid var(--line); background: rgba(255,255,255,.025); color: var(--muted-strong); font-size: .62rem; font-weight: 800; text-transform: uppercase; cursor: pointer; }
.end-label:hover { background: color-mix(in srgb,var(--node-color) 9%,transparent); color: var(--text); }
.mobile-back { display: none; }

.empty-state button { display: flex; width: 100%; min-height: 45px; align-items: center; justify-content: center; margin-top: 17px; padding: 0 14px; border: 1px solid rgba(114,221,247,.32); border-radius: 11px; background: rgba(114,221,247,.1); color: #e6fbff; font-size: .7rem; font-weight: 800; cursor: pointer; }

.empty-state { display: grid; width: min(430px,100%); justify-items: center; padding: 30px; border: 1px solid color-mix(in srgb,var(--node-color) 30%,var(--line)); border-radius: 18px; background: rgba(13,21,37,.92); text-align: center; }
.empty-state strong { margin-top: 16px; font-size: 1rem; }
.empty-state p { margin: 8px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.55; }
.empty-state button { justify-content: center; }

footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 10px clamp(20px,3vw,48px) 16px; color: #61718a; font-size: .58rem; }
.module-identity {
  display: flex;
  width: 100vw;
  min-height: 123px;
  align-items: center;
  justify-content: flex-start;
  margin-left: calc(50% - 50vw);
  padding: 24px 20px;
  overflow: hidden;
  border-bottom: 1px solid rgba(78, 157, 224, 0.14);
  background: linear-gradient(105deg, #082838 0%, #101b27 48%, #21181b 100%);
  box-shadow: none;
}

.module-identity .module-text-lockup {
  align-items: center;
  text-align: center;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.38);
}

.module-identity .module-text-lockup small { text-align: center; }
.module-text-lockup { display:inline-flex; flex-direction:column; align-items:stretch; margin:0; color:#29a8ff; font-family:Montserrat,Manrope,sans-serif; line-height:1; text-align:center; text-transform:uppercase; }
.module-text-lockup strong { font-size:clamp(2rem,4vw,3.7rem); font-weight:600; letter-spacing:.08em; }
.module-text-lockup small { margin-top:.5rem; color:#a9c8dd; font-size:clamp(.68rem,1.2vw,.9rem); font-weight:300; letter-spacing:.34em; text-align:center; }
.toast { position: fixed; z-index: 50; right: 20px; bottom: 20px; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: #152239; color: var(--text); font-size: .7rem; opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity 160ms ease,transform 160ms ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1120px) {
  .journey-line { display: none; }
}

@media (max-width: 900px) {
  .journey { min-height: auto; }
}

@media (max-width: 680px) {
  .app-shell { display: block; }
  .topbar { padding: 14px 16px; }
  .live-status { display: none; }
  .breadcrumbs { position: sticky; z-index: 10; top: 0; min-height: 45px; padding: 7px 12px; backdrop-filter: blur(18px); }
  .workspace { display: flex; flex-direction: column; padding: 0; }
  .canvas-panel { border-right: 0; border-left: 0; border-radius: 0; box-shadow: none; }
  .canvas-heading { padding: 21px 18px 18px; }
  .canvas-heading h1 { font-size: 1.42rem; }
  .canvas-heading p:last-child { font-size: .73rem; }
  .level-indicator { padding-top: 3px; }
  .level-indicator i { width: 11px; }
  .journey { display: block; min-height: 0; padding: 18px 14px 22px; background-size: 28px 28px,28px 28px,auto; }
  .journey-grid, .journey-grid.is-short { display: grid; width: 100%; min-width: 0; grid-template-columns: 1fr; gap: 11px; }
  .flow-card { min-height: 0; grid-template-columns: minmax(0,1fr) 54px; grid-template-rows: auto; border-radius: 15px; }
  .flow-card:hover, .flow-card.is-selected { transform: none; }
  .card-select { grid-template-columns: 40px minmax(0,1fr); grid-template-rows: auto; align-items: center; gap: 12px; padding: 15px 12px; }
  .card-index { display: none; }
  .card-copy { grid-column: auto; }
  .card-copy small { font-size: .54rem; }
  .card-copy strong { margin-top: 4px; font-size: .92rem; }
  .card-copy span { display: none; }
  .expand-button { display: grid; min-height: 100%; place-items: center; padding: 0; border-top: 0; border-left: 1px solid var(--line); }
  .expand-button em { display: none; }
  .end-label { min-height: 100%; padding: 0 8px; border-top: 0; border-left: 1px solid var(--line); font-size: 0; }
  .end-label span { font-size: .9rem; }
  .mobile-back { display: block; width: 100%; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.035); color: var(--muted-strong); font-size: .68rem; font-weight: 700; }
  footer { display: none; }
  .toast { right: 14px; bottom: 14px; left: 14px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
