/* ===================== AnalyzeLab · black & white ===================== */
:root {
  --bg: #000000;
  --fg: #ffffff;
  --muted: #8a8a8a;
  --dim: #3a3a3a;
  --line: #222222;
  --panel: #0c0c0c;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  overflow: hidden;
}

/* subtle film grain / vignette for depth */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 100;
  background: radial-gradient(120% 120% at 50% 30%, transparent 55%, rgba(0,0,0,.85) 100%);
  mix-blend-mode: multiply;
}

/* ---------- view system ---------- */
.view {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .5s ease, transform .5s ease, visibility .5s;
  padding: 24px;
}
.view.active { opacity: 1; visibility: visible; transform: none; }

/* ---------- buttons ---------- */
.cta {
  font-family: var(--sans); font-size: 16px; font-weight: 600;
  color: #000; background: #fff; border: none; border-radius: 100px;
  padding: 14px 30px; cursor: pointer; letter-spacing: .3px;
  transition: transform .12s ease, box-shadow .3s ease;
  box-shadow: 0 0 0 rgba(255,255,255,0);
}
.cta:hover { transform: translateY(-2px); box-shadow: 0 8px 40px rgba(255,255,255,.18); }
.cta:active { transform: translateY(0); }
.cta:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }
.back, .summary {
  background: none; border: none; color: var(--muted); font-size: 14px;
  cursor: pointer; font-family: var(--sans);
}
.back:hover { color: var(--fg); }

/* ---------- HOME ---------- */
.home-inner { text-align: center; max-width: 620px; animation: rise .8s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; } }
.mark {
  font-size: 64px; line-height: 1; margin-bottom: 10px;
  animation: spinpulse 6s ease-in-out infinite;
}
@keyframes spinpulse {
  0%,100% { transform: rotate(0) scale(1); text-shadow: 0 0 30px rgba(255,255,255,.35); }
  50% { transform: rotate(180deg) scale(1.08); text-shadow: 0 0 60px rgba(255,255,255,.6); }
}
.title { font-size: 68px; margin: 0; letter-spacing: -1px; font-weight: 800; }
.subtitle { color: var(--muted); font-size: 18px; line-height: 1.6; margin: 18px auto 34px; max-width: 500px; }
.home-foot { margin-top: 40px; color: var(--dim); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; }

/* ---------- INPUT ---------- */
.input-inner { width: 100%; max-width: 640px; animation: rise .6s ease; }
.back { margin-bottom: 20px; }
.view-input h2 { font-size: 36px; margin: 0 0 6px; }
.lead { color: var(--muted); font-size: 15px; margin: 0 0 24px; line-height: 1.5; }

.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.preset {
  background: var(--panel); border: 1px solid var(--line); color: var(--fg);
  border-radius: 100px; padding: 8px 16px; cursor: pointer; font-size: 13px;
  transition: border-color .2s, background .2s;
}
.preset:hover { border-color: #fff; }
.preset[data-kind="attack"] { border-style: dashed; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 28px; }
.fields label {
  display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600;
}
.fields label span { color: var(--muted); font-weight: 400; font-size: 11px; }
.fields label.wide { grid-column: 1 / -1; }
.fields input {
  background: #060606; border: 1px solid var(--line); color: #fff;
  border-radius: 10px; padding: 12px 14px; font-family: var(--mono); font-size: 14px;
  transition: border-color .2s;
}
.fields input:focus { outline: none; border-color: #fff; }

/* ---------- MODE SELECT ---------- */
.mode-inner { width: 100%; max-width: 720px; animation: rise .6s ease; }
.mode-inner h2 { font-size: 36px; margin: 0 0 6px; }
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.mode-card {
  text-align: left; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 26px 22px; cursor: pointer; color: var(--fg);
  font-family: var(--sans); transition: border-color .2s, transform .12s, box-shadow .3s;
}
.mode-card:hover { border-color: #fff; transform: translateY(-3px); box-shadow: 0 10px 40px rgba(255,255,255,.08); }
.mode-ico { font-size: 34px; line-height: 1; margin-bottom: 14px; }
.mode-title { font-size: 19px; font-weight: 700; margin-bottom: 6px; }
.mode-desc { color: var(--muted); font-size: 13px; line-height: 1.5; }

/* ---------- ADD TO INVENTORY ---------- */
.inv-inner {
  width: 100%; max-width: 640px; animation: rise .6s ease;
  overflow-y: auto; max-height: 92vh;
  padding-left: 14px;              /* room for the left-side scrollbar */
  direction: rtl;                  /* moves the scrollbar to the LEFT edge */
  scrollbar-width: thin;           /* Firefox */
  scrollbar-color: var(--line) transparent;
}
.inv-inner > * { direction: ltr; } /* keep all content left-to-right */
/* blend the scrollbar into the black background (WebKit/Blink) */
.inv-inner::-webkit-scrollbar { width: 8px; }
.inv-inner::-webkit-scrollbar-track { background: transparent; }
.inv-inner::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.inv-inner::-webkit-scrollbar-thumb:hover { background: var(--dim); }
.inv-inner h2 { font-size: 34px; margin: 0 0 6px; }

.dropzone {
  border: 1.5px dashed var(--line); border-radius: 14px; padding: 30px 20px;
  text-align: center; cursor: pointer; transition: border-color .2s, background .2s;
  margin-bottom: 22px;
}
.dropzone:hover, .dropzone.drag { border-color: #fff; background: #060606; }
.dropzone.busy { border-style: solid; opacity: .7; cursor: default; }
.dz-ico { font-size: 26px; margin-bottom: 8px; }
.dz-main { font-size: 15px; font-weight: 600; }
.dz-main span { color: var(--muted); font-weight: 400; }
.dz-hint { color: var(--muted); font-size: 12px; margin-top: 6px; }

.inv-company, .company-pick {
  display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600;
  margin-bottom: 22px;
}
.inv-company span, .company-pick span { color: var(--muted); font-weight: 400; font-size: 11px; }
.inv-company input, .company-pick select {
  background: #060606; border: 1px solid var(--line); color: #fff;
  border-radius: 10px; padding: 12px 14px; font-family: var(--mono); font-size: 14px;
}
.inv-company input:focus, .company-pick select:focus { outline: none; border-color: #fff; }

.manual { border-top: 1px solid var(--line); padding-top: 18px; margin-bottom: 18px; }
.manual-head { font-size: 12px; text-transform: uppercase; letter-spacing: 2px; color: var(--muted); margin-bottom: 12px; }
.manual-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.manual-fields input {
  background: #060606; border: 1px solid var(--line); color: #fff;
  border-radius: 10px; padding: 10px 12px; font-family: var(--mono); font-size: 13px;
}
.manual-fields input:focus { outline: none; border-color: #fff; }
.add-row {
  background: none; border: 1px solid var(--line); color: var(--fg); border-radius: 100px;
  padding: 8px 16px; cursor: pointer; font-size: 13px; transition: border-color .2s;
}
.add-row:hover { border-color: #fff; }

.staged { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.staged-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
}
.staged-row .sr-main { font-size: 13px; }
.staged-row .sr-sub { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.staged-row .sr-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; }
.staged-row .sr-del:hover { color: #fff; }
.staged-empty { color: var(--dim); font-size: 13px; }
.inv-msg { margin-top: 14px; font-size: 13px; color: var(--muted); font-family: var(--mono); min-height: 18px; }
.inv-msg.ok { color: #fff; }

/* ---------- RUN / ORCHESTRATION ---------- */
.view-run { flex-direction: column; }
.run-head { text-align: center; margin-bottom: 4px; }
.run-title { font-size: 26px; font-weight: 700; }
.run-sub { color: var(--muted); font-size: 14px; margin-top: 4px; min-height: 20px; }

.stage { width: 100%; max-width: 820px; flex: 1; display: flex; align-items: center; justify-content: center; }
#graph { width: 100%; height: 60vh; max-height: 560px; display: block; touch-action: none; cursor: grab; }

/* central sphere + particles */
.core-sphere { animation: breathe 5s ease-in-out infinite; transform-origin: center; }
@keyframes breathe { 0%,100% { opacity: .85; } 50% { opacity: 1; } }
.core-rim { fill: none; stroke: rgba(79,157,255,.25); stroke-width: 1; }
.particle { fill: #4f9dff; opacity: .85; filter: drop-shadow(0 0 4px rgba(79,157,255,.9)); }

/* graph node styling (SVG) */
.node-ring { fill: #060606; stroke: var(--dim); stroke-width: 1.5; transition: stroke .3s, filter .3s; }
.node.active .node-ring { stroke: #4f9dff; filter: drop-shadow(0 0 16px rgba(79,157,255,.9)); }
.node-core { fill: #4f9dff; opacity: .10; transition: opacity .3s, r .3s; }
.node.active .node-core { opacity: .55; }
.node-label { fill: var(--fg); font-family: var(--sans); font-size: 13px; font-weight: 600; text-anchor: middle; }
.node-sub { fill: var(--muted); font-family: var(--sans); font-size: 10px; text-anchor: middle; }
.edge { stroke: var(--line); stroke-width: 1.2; transition: stroke .3s, stroke-width .3s; }
.edge.hot { stroke: #4f9dff; stroke-width: 2; filter: drop-shadow(0 0 6px rgba(79,157,255,.7)); }
.dot { fill: #4f9dff; filter: drop-shadow(0 0 7px rgba(79,157,255,1)); }

.ticker {
  width: 100%; max-width: 760px; min-height: 46px; margin: 6px 0 14px;
  text-align: center; color: var(--muted); font-size: 14px; font-family: var(--mono);
  transition: color .3s;
}
.ticker .live { color: #fff; }
.reveal { animation: rise .5s ease; }

/* ---------- RESULT ---------- */
.result-inner { width: 100%; max-width: 640px; text-align: center; animation: rise .6s ease; overflow-y: auto; max-height: 92vh; }
.verdict { padding: 20px 0 26px; }
.verdict-icon {
  font-size: 76px; line-height: 1; width: 130px; height: 130px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 3px solid #fff;
}
.verdict-word { font-size: 46px; font-weight: 800; letter-spacing: 4px; }
.verdict-sub { color: var(--muted); font-size: 15px; margin-top: 8px; }

/* NOT SAFE = inverted block, still monochrome */
.verdict.danger .verdict-icon { background: #fff; color: #000; }
.verdict.danger .verdict-word { }
.verdict.warn .verdict-icon { border-style: dashed; }

.explain { text-align: left; border-top: 1px solid var(--line); margin-top: 6px; }
.explain h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 2px; color: var(--muted);
  margin: 24px 0 8px;
}
.explain-body { font-size: 15px; line-height: 1.6; color: #e8e8e8; }
.explain-body strong { color: #fff; }
.explain-body .none { color: var(--dim); }

.steps-detail { text-align: left; margin: 26px 0; border-top: 1px solid var(--line); padding-top: 12px; }
.steps-detail summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.trace-step { border-left: 2px solid var(--dim); padding: 8px 12px; margin: 8px 0; }
.trace-step .who { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.trace-step .what { font-size: 13px; margin-top: 3px; line-height: 1.5; }
.trace-step .kv { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: pre-wrap; word-break: break-word; }

@media (max-width: 560px) {
  .title { font-size: 48px; }
  .fields, .mode-cards, .manual-fields { grid-template-columns: 1fr; }
  .verdict-word { font-size: 36px; }
}
