@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');
:root{font-family:Inter,system-ui,sans-serif;color:#221b39;background:#f8f6fc;font-synthesis:none;--ink:#221b39;--muted:#655b75;--border:#e2daec;--purple:#6943b8;--tint:#efe9f8;--accent:#c6ff4c}
*{box-sizing:border-box}body{margin:0}button,input,textarea,select{font:inherit}button,a,input,textarea,select{outline-offset:4px}button:focus-visible,a:focus-visible{outline:3px solid var(--purple)}button{cursor:pointer;border:1px solid var(--border);border-radius:12px;background:#fff;color:var(--ink);padding:12px 17px;min-height:44px;font-size:14px;font-weight:600}button:hover{background:var(--tint)}button:disabled{cursor:default;opacity:.55}button.primary{background:var(--ink);color:var(--accent);border-color:var(--ink)}button.primary:hover{background:#382d53}button.quiet{background:transparent;border-color:transparent}.text-button{border:0;background:none;padding:0;min-height:30px;font-size:14px;font-weight:600;color:var(--purple);text-align:left;cursor:pointer}.text-button:hover{background:none;text-decoration:underline}a{color:var(--purple);overflow-wrap:anywhere}p{line-height:1.5}h1,h2,h3,p{margin-top:0}h2{font-size:24px;line-height:1.45;margin-bottom:20px}h3{font-size:16px;line-height:1.5;margin-bottom:10px}.caption{font-size:14px;line-height:1.5}.muted{color:var(--muted)}[hidden]{display:none!important}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.header{max-width:1600px;margin:auto;display:flex;align-items:center;justify-content:space-between;padding:24px 36px;gap:16px}.brand{display:flex;align-items:center;gap:12px;color:var(--ink);text-decoration:none;font-size:14px;font-weight:600}.header-actions{display:flex;align-items:center;gap:12px;font-size:14px}.logo{position:relative;display:inline-block;flex-shrink:0;background:var(--ink);border-radius:50%;width:72px;height:72px;overflow:hidden}.logo.small{width:32px;height:32px}.logo img{position:absolute;object-fit:contain}.logo .vine{left:17.2%;top:17.7%;width:74.3%;height:60.7%}.logo .people{left:14.5%;top:20.4%;width:61.6%;height:51.2%}
main{max-width:1600px;margin:auto;padding:0 36px 28px}.home{width:min(880px,100%);margin:80px auto 0}.hero-logo{display:block;margin:0 auto 22px}.home h1{font-size:40px;font-weight:600;letter-spacing:-1px;line-height:1.45;text-align:center;margin:0 0 22px}.intro{text-align:center;font-size:16px;margin:0 0 24px;color:var(--muted)}.searchbox{background:#fff;border:1px solid var(--border);border-radius:24px;padding:22px;min-height:172px}.searchbox textarea{width:100%;height:64px;resize:vertical;border:0;line-height:1.5;background:transparent;color:var(--ink)}.searchbox textarea::placeholder{color:var(--muted)}.search-actions{display:flex;align-items:center;justify-content:space-between;gap:16px}.search-actions .primary{min-width:188px}.home-channels{margin:24px 0}.home-channels strong{font-size:14px}.channels{display:flex;gap:8px;flex-wrap:wrap;margin:14px 0 10px}.channels button.connected{background:var(--tint);border-color:transparent;color:var(--purple)}.channels button.unavailable{color:var(--muted)}.example{max-width:100%;line-height:1.5}.workspace-query{display:flex;align-items:center;gap:12px;max-width:1100px;margin-top:8px}.query{background:#fff;border:1px solid var(--border);border-radius:16px;padding:19px;flex:1;line-height:1.5}.workspace-grid{display:grid;grid-template-columns:minmax(0,1fr) 344px;gap:36px;margin-top:28px}.status-line{display:flex;align-items:center;gap:20px;min-height:44px;font-size:14px}.status-line strong{color:var(--purple)}.status-line button{margin-left:auto}.map-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:4px 0 12px}.scope{font-size:14px;color:var(--purple);padding:12px 16px;background:var(--tint);border-radius:12px}.map{height:620px;min-height:420px;overflow:hidden;position:relative;background-image:radial-gradient(#dfd5ec 1px,transparent 1px);background-size:30px 30px;border-radius:24px}.map svg{width:100%;height:100%;display:block}.map .branch{cursor:pointer}.map .branch:hover rect{stroke:var(--purple);stroke-width:2}.map text{font-family:Inter,system-ui,sans-serif}.map .edge{fill:none;stroke:#bda9d9;stroke-width:1.7}.map .edge.running{stroke:#8759cf;stroke-width:2.5;stroke-dasharray:8 5;animation:flow 2s linear infinite}.map-hint{margin:8px 20px}.results{background:#fff;border:1px solid var(--border);border-radius:20px;padding:20px;align-self:start;min-height:650px}.tabs{display:flex;gap:4px;margin:0 0 18px}.tabs button{padding:12px 10px;flex:1;white-space:nowrap}.tabs button[aria-selected=true]{background:var(--ink);color:var(--accent);border-color:var(--ink)}.card{border:1px solid var(--border);border-radius:16px;padding:18px;margin:0 0 16px;overflow-wrap:anywhere}.card.tint{background:var(--tint);border:0}.card p{font-size:14px;color:var(--muted);margin-bottom:12px}.card .tag{font-size:13px;font-weight:600;color:var(--purple);margin-bottom:10px}.card button{width:100%;margin-top:6px}.card .source{display:inline-block;margin-bottom:12px;font-size:14px}.event{padding:14px 0;border-bottom:1px solid var(--border)}.event p{font-size:14px;margin:6px 0}.event .tag{font-size:13px;color:var(--purple)}
dialog{position:fixed;inset:0 0 0 auto;margin:0;height:100dvh;max-height:100dvh;width:576px;max-width:100vw;border:0;color:var(--ink);padding:0;background:#fff}dialog::backdrop{background:rgb(34 27 57/.2)}.drawer-inner{padding:32px;overflow:auto;max-height:100dvh}.back{margin-bottom:28px}label.field{display:block;font-size:14px;color:var(--muted);margin:16px 0}.field input,.field select,.field textarea{display:block;width:100%;margin-top:8px;border:1px solid var(--border);border-radius:10px;padding:12px;background:#fff;color:var(--ink);line-height:1.5}.field textarea{min-height:180px;resize:vertical}.field input[type=checkbox]{width:auto;display:inline-block;margin-right:8px}.actions{display:flex;gap:10px;flex-wrap:wrap;margin:20px 0}.actions button{flex:1}.drawer-inner>.primary,.drawer-inner form>.primary{width:100%;margin:14px 0}.message{white-space:pre-wrap;line-height:1.6;background:var(--tint);padding:20px;border-radius:16px}.channel-card{display:flex;align-items:center;justify-content:space-between;gap:16px;background:#f8f6fc;border-radius:16px;padding:16px;margin:14px 0}.channel-card p{margin:4px 0;font-size:14px;color:var(--muted)}details{margin:18px 0}summary{cursor:pointer;font-size:14px;font-weight:600;padding:10px 0}.hint{background:var(--tint);padding:16px;border-radius:12px;font-size:14px;line-height:1.5}#notice{position:fixed;top:12px;left:50%;transform:translateX(-50%);z-index:10;max-width:90vw;padding:14px 20px;background:#fff;border:1px solid var(--purple);box-shadow:0 6px 30px #221b3920;border-radius:12px;font-size:14px}
@keyframes flow{to{stroke-dashoffset:-26}}@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
@media(min-width:1500px){.map{height:680px}}@media(max-width:1100px){.workspace-grid{gap:20px;grid-template-columns:minmax(0,1fr) 320px}.results{padding:16px}.map{height:560px}.status-line{flex-wrap:wrap;gap:8px}.header,main{padding-left:24px;padding-right:24px}}@media(max-width:760px){.header{padding:16px}.header-actions{gap:4px}.header-actions .muted{max-width:140px;font-size:12px}.home{margin-top:36px}.home h1{font-size:29px}.intro{font-size:15px}.hero-logo{width:64px;height:64px}main{padding:0 16px 24px}.searchbox{padding:16px}.search-actions .primary{min-width:0}.search-actions{gap:8px}.channels button{padding:10px 13px}.workspace-grid{display:flex;flex-direction:column;gap:20px;margin-top:20px}.results{min-height:0;width:100%}.map{height:460px}.map-toolbar{flex-wrap:wrap}.workspace-query{align-items:flex-start}.workspace-query>.quiet{padding:10px 4px;font-size:12px}.query{font-size:14px}.drawer-inner{padding:24px}.status-line button{margin-left:auto}}

.attach-button{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;padding:10px;background:transparent;border-color:transparent;color:var(--muted)}
.attach-button:hover{background:var(--tint);color:var(--purple)}
.home h1{margin-bottom:30px}.home-channels{margin-top:18px}
#attachment{display:flex;gap:8px;flex-wrap:wrap;margin:4px 0 12px}#attachment:empty{display:none}
.file-chip{display:flex;gap:8px;align-items:center;background:var(--tint);padding:7px 10px;border-radius:10px;font-size:13px;max-width:100%}.file-chip span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-chip button{padding:0;min-height:24px;width:24px;border:0;background:none}

#taskForm{line-height:1.45}
#taskForm fieldset{border:0;border-radius:16px;padding:20px;margin:24px 0;background:var(--tint)}
#taskForm legend{padding:0 8px;font-size:14px;font-weight:600;color:var(--purple)}
#taskForm .field input,#taskForm .field select,#taskForm .field textarea{border-radius:12px}
#drawerTitle{font-weight:600}
#taskForm select[multiple]{min-height:110px}
#taskForm select[multiple]:disabled{min-height:0}

/* D06 uses the existing Figma palette, cards and drawer. */
.search-progress{display:grid;grid-template-columns:repeat(3,minmax(110px,1fr)) minmax(220px,2fr);gap:12px;margin-top:24px}
.progress-item{display:flex;align-items:center;gap:12px;text-align:left;padding:16px 20px;background:#fff;border-radius:16px}
.progress-item strong{font-size:24px;font-weight:600;white-space:nowrap}
.progress-item span{font-size:13px;color:var(--muted);font-weight:400}
.progress-note{display:flex;flex-direction:column;justify-content:center;gap:7px;padding:16px 20px;border-radius:16px;background:var(--tint);font-size:14px;min-width:0;overflow-wrap:anywhere}
.progress-note .tag,.drawer-inner>.tag{color:var(--purple);font-size:13px;font-weight:600}
.progress-note .text-button{font-weight:500;min-height:24px}
.results .tabs{display:grid;grid-template-columns:1fr 1fr;gap:6px}
.results .tabs button{padding:11px 8px}
.card .unknown{padding:12px;background:var(--tint);border-radius:12px}
.direction-card p{line-height:1.5}
.hint p{margin:8px 0 0}
#resultList{min-width:0}
#resultList>details{border-top:1px solid var(--border);padding-top:10px}
@media(max-width:1100px){.search-progress{grid-template-columns:repeat(3,1fr)}.progress-note{grid-column:1/-1}.progress-item{padding:14px;gap:8px}}
@media(max-width:760px){.search-progress{gap:8px;margin-top:18px}.progress-item{flex-direction:column;align-items:flex-start;padding:12px;gap:4px}.progress-item strong{font-size:22px}.progress-item span{font-size:12px}.map{height:380px;min-height:320px}.workspace-grid{gap:16px}.results .tabs{grid-template-columns:repeat(2,minmax(0,1fr))}}

.mobile-map{display:none}
@media(max-width:760px){.map{height:auto;min-height:0;background:none}.map svg{display:none}.mobile-map{display:grid;gap:8px}.mobile-map button{display:flex;flex-direction:column;align-items:flex-start;gap:6px;text-align:left;font-weight:500;padding:14px 16px}.map-hint{margin:12px 0}}
@media(max-width:760px){.map-toolbar>div:not(.scope){display:none}}

.telegram-login {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.telegram-login p, .telegram-login .tabs, .telegram-login .field {
  margin: 0;
}
.telegram-login-methods button[aria-pressed=true] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--accent);
}
.telegram-login-steps {
  margin: 0;
  padding-left: 22px;
  font-size: 16px;
  line-height: 1.45;
}
.telegram-login-steps li + li {
  margin-top: 8px;
}
.telegram-qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px;
  border-radius: 16px;
  background: #f8f6fc;
  text-align: center;
}
.telegram-qr-card img {
  display: block;
  width: 220px;
  height: 220px;
  max-width: 100%;
  object-fit: contain;
  background: white;
}
.telegram-app-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.telegram-app-link:hover {
  background: var(--tint);
}
.telegram-login form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.telegram-login form > .primary {
  width: 100%;
  margin: 0;
}

/* Compact controls and state-driven search animation. */
.channels { gap: 8px; margin: 12px 0 0; }
.channels .channel-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 8px;
  border-radius: 12px;
}
.connection-dot {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--purple);
}
.workspace-query { max-width: none; }
.query { padding: 15px 18px; border-radius: 16px; }
.settings-icon { padding: 10px; display: flex; }
.workspace-grid { margin-top: 20px; gap: 24px; }
.search-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  min-height: 34px;
  font-size: 14px;
  color: var(--muted);
}
.search-progress .text-button { white-space: nowrap; font-size: 13px; }
.status-line { font-size: 14px; gap: 12px; }
.map-toolbar { margin: 0; min-height: 36px; }
.scope { padding: 0; background: none; color: var(--muted); font-size: 12px; }
.map-toolbar button { padding: 8px 10px; min-height: 36px; font-size: 12px; }
.map {
  height: 550px;
  min-height: 350px;
  background-image: radial-gradient(#e4ddec .8px,transparent .8px);
  background-size: 26px 26px;
}
.map-hint:empty { display: none; }
.results { min-height: 0; padding: 16px; border-radius: 18px; }
.results .tabs { margin-bottom: 16px; }
.results .tabs button { min-height: 38px; padding: 8px 6px; font-size: 13px; }
.empty-findings { padding: 24px 8px; text-align: center; font-size: 14px; }
.search-route { fill: none; stroke: #d9cfe8; stroke-width: 1.6; stroke-linejoin: round; }
.search-route.running { stroke: #9672cf; stroke-width: 2.2; }
.search-route.found { stroke: #91ae51; }
.search-route.done { opacity: .45; }
.search-signal {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 9 91;
  animation: searchTravel 2.8s linear infinite;
  filter: drop-shadow(0 0 3px #9fcf56);
}
.node-halo { fill: var(--tint); }
.node-dot { fill: #b8a5ce; }
.branch.running .node-dot { fill: var(--purple); }
.branch.running .node-halo { fill: #dfd2f5; }
.branch.found .node-dot, .found-dot { fill: #92b546; }
.node-label { fill: #fff; stroke: var(--border); stroke-width: 1; }
.node-text { fill: var(--ink); font-size: 14px; }
.branch.done { opacity: .65; }
.branch:hover, .branch:focus { opacity: 1; }
.branch { animation: pathAppear .5s ease-out both; outline: none; }
.branch:focus-visible .node-label { stroke: var(--purple); stroke-width: 3; }
.core-halo { fill: #eee7f6; opacity: .7; }
.core-orbit { fill: none; stroke: #bca3df; stroke-width: 1.5; stroke-dasharray: 4 9; }
.is-moving .core-halo { animation: corePulse 3s ease-in-out infinite; transform-origin: 500px 300px; }
.is-moving .core-orbit { animation: coreTurn 18s linear infinite; transform-origin: 500px 300px; }
.is-moving .core-light { animation: lightPulse 2s ease-in-out infinite; }
@keyframes searchTravel { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes corePulse { 50% { transform: scale(1.13); opacity: .35; } }
@keyframes coreTurn { to { transform: rotate(360deg); } }
@keyframes lightPulse { 50% { opacity: .55; } }
@keyframes pathAppear { from { opacity: 0; } }
@media(max-width:760px) {
  .workspace-grid { margin-top: 14px; }
  .map { height: auto; min-height: 0; background: none; }
  .map svg { display: block; height: 280px; }
  .map .node-label, .map .node-text { display: none; }
  .mobile-map { display: grid; gap: 6px; }
  .mobile-map button { padding: 10px 12px; font-size: 13px; }
  .mobile-map button .caption { font-size: 11px; }
  .search-progress { font-size: 12px; gap: 8px; }
  .channels .channel-icon { width: 40px; height: 40px; min-height: 40px; }
}
@media(prefers-reduced-motion:reduce) {
  .search-signal, .is-moving .core-halo, .is-moving .core-orbit,
  .is-moving .core-light, .branch { animation: none; }
  .search-signal { stroke-dasharray: none; opacity: .5; }
}

.search-particle {
  fill: var(--purple);
  stroke: #fff;
  stroke-width: 1.5;
  filter: drop-shadow(0 0 5px #9565ed);
  pointer-events: none;
}
.search-particle.secondary { fill: var(--accent); }
.search-route.running { stroke: #9265cc; stroke-width: 3; }
.search-signal { stroke-width: 5; animation-duration: 2.4s; }
.branch.running .node-halo {
  animation: nodePulse 1.8s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.core-wave { fill: none; stroke: #ad8bdc; stroke-width: 1.5; opacity: 0; }
.is-moving .core-wave {
  animation: searchWave 2.4s ease-out infinite;
  transform-origin: 500px 300px;
}
.is-waiting .core-halo { animation: corePulse 5s ease-in-out infinite; transform-origin: 500px 300px; }
.is-waiting .core-orbit { animation: coreTurn 30s linear infinite; transform-origin: 500px 300px; }
@keyframes searchWave { from { transform: scale(.65); opacity: .65; } to { transform: scale(1.9); opacity: 0; } }
@keyframes nodePulse { 50% { transform: scale(1.4); opacity: .6; } }
@media(prefers-reduced-motion:reduce) {
  .search-particle { display: none; }
  .core-wave, .is-waiting .core-halo, .is-waiting .core-orbit, .branch.running .node-halo { animation: none; }
}

.event-journal { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 16px; }
.journal-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.journal-heading h3 { margin: 0; }
.journal-heading button { font-size: 12px; }
.journal-entry { position: relative; border-left: 1px solid var(--border); margin-left: 4px; padding: 0 0 18px 16px; }
.journal-entry::before { content: ''; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--border); left: -4px; top: 5px; }
.journal-entry.unread::before { background: var(--purple); }
.journal-entry time { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.journal-entry button { font-size: 13px; line-height: 1.45; color: var(--ink); }
.journal-entry p { font-size: 12px; color: var(--muted); margin: 5px 0 0; overflow-wrap: anywhere; }

.event-journal { max-height: 420px; overflow: auto; }
.journal-heading { position: sticky; top: 0; background: white; z-index: 1; padding: 4px 0; }
