/* Linkstorm - ink and signal-lime control-room aesthetic */
:root {
  --ink: #0b0d11;
  --ink-2: #12151b;
  --ink-3: #181c24;
  --line: #242a35;
  --line-soft: #1c212b;
  --text: #e8ebef;
  --text-dim: #9aa3b2;
  --text-faint: #626c7d;
  --signal: #c7f23f;
  --signal-dim: #98b834;
  --cyan: #4fd6e0;
  --amber: #f0b23c;
  --coral: #f06b5e;
  --green: #5fd49a;
  --shadow: 0 24px 60px -20px rgba(0,0,0,0.7);
  --display: 'Bricolage Grotesque', sans-serif;
  --body: 'IBM Plex Sans', sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--body);
  background:
    radial-gradient(1200px 700px at 78% -8%, rgba(199,242,63,0.06), transparent 60%),
    radial-gradient(900px 600px at 8% 4%, rgba(79,214,224,0.05), transparent 55%),
    var(--ink);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.muted { color: var(--text-dim); font-size: 0.9rem; }
.num { text-align: right; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; padding: 0.9rem 1.6rem;
  border-bottom: 1px solid var(--line);
  background: rgba(11,13,17,0.82); backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: baseline; gap: 0.55rem; }
.brand-mark {
  font-family: var(--display); font-weight: 800; font-size: 1.35rem;
  width: 1.9rem; height: 1.9rem; display: grid; place-items: center;
  background: var(--signal); color: var(--ink); border-radius: 7px;
  transform: translateY(2px);
}
.brand-name { font-family: var(--display); font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; }
.brand-tag { font-family: var(--mono); font-size: 0.7rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.12em; }
.tabs { display: flex; gap: 0.3rem; }
.tab {
  font-family: var(--body); font-size: 0.88rem; font-weight: 500;
  color: var(--text-dim); background: transparent; border: 1px solid transparent;
  padding: 0.5rem 0.95rem; border-radius: 8px; cursor: pointer; transition: all 0.15s;
}
.tab:hover { color: var(--text); background: var(--ink-2); }
.tab.active { color: var(--ink); background: var(--signal); font-weight: 600; }

main { max-width: 1080px; margin: 0 auto; padding: 2.6rem 1.6rem 4rem; position: relative; z-index: 2; }
.panel { display: none; animation: fade 0.35s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- hero / tester ---------- */
.hero { max-width: 760px; }
.eyebrow {
  font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--signal); margin-bottom: 1rem;
}
h1 {
  font-family: var(--display); font-weight: 800; font-size: clamp(2.2rem, 5.5vw, 3.7rem);
  line-height: 1.02; letter-spacing: -0.03em; margin-bottom: 1.1rem;
}
.lede { font-size: 1.08rem; color: var(--text-dim); max-width: 620px; margin-bottom: 2rem; }

.tester-input { display: flex; gap: 0.6rem; max-width: 640px; }
.tester-input input {
  flex: 1; font-family: var(--mono); font-size: 0.95rem;
  background: var(--ink-2); border: 1px solid var(--line); color: var(--text);
  padding: 0.95rem 1.1rem; border-radius: 11px; outline: none; transition: border 0.15s;
}
.tester-input input:focus { border-color: var(--signal); }
.tester-input input::placeholder { color: var(--text-faint); }

.btn-primary {
  font-family: var(--body); font-weight: 600; font-size: 0.95rem;
  background: var(--signal); color: var(--ink); border: none;
  padding: 0.95rem 1.5rem; border-radius: 11px; cursor: pointer; white-space: nowrap;
  transition: transform 0.12s, box-shadow 0.15s; box-shadow: 0 0 0 0 rgba(199,242,63,0.5);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px -8px rgba(199,242,63,0.6); }
.btn-primary:disabled { opacity: 0.5; cursor: wait; transform: none; }
.btn-ghost {
  font-family: var(--body); font-weight: 500; font-size: 0.84rem;
  background: var(--ink-2); color: var(--text); border: 1px solid var(--line);
  padding: 0.55rem 1rem; border-radius: 9px; cursor: pointer; transition: all 0.15s;
}
.btn-ghost:hover { border-color: var(--signal); color: var(--signal); }

.error { color: var(--coral); font-size: 0.88rem; margin-top: 0.8rem; min-height: 1rem; }

/* ---------- tester result ---------- */
.result { margin-top: 2.6rem; animation: fade 0.4s ease; }
.score-block {
  display: flex; gap: 2.4rem; align-items: center; flex-wrap: wrap;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 16px;
  padding: 1.8rem 2rem; box-shadow: var(--shadow);
}
.ring-wrap { position: relative; width: 140px; height: 140px; flex-shrink: 0; }
.ring { transform: rotate(-90deg); width: 140px; height: 140px; }
.ring-track { fill: none; stroke: var(--line); stroke-width: 11; }
.ring-fill {
  fill: none; stroke: var(--signal); stroke-width: 11; stroke-linecap: round;
  stroke-dasharray: 377; stroke-dashoffset: 377; transition: stroke-dashoffset 1s cubic-bezier(0.2,0.8,0.2,1), stroke 0.5s;
}
.ring-centre { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-score { font-family: var(--display); font-weight: 800; font-size: 2.6rem; line-height: 1; }
.ring-grade { font-family: var(--mono); font-size: 0.85rem; color: var(--text-dim); letter-spacing: 0.1em; }
.score-meta { flex: 1; min-width: 280px; }
.score-url { font-family: var(--mono); font-size: 0.82rem; color: var(--cyan); word-break: break-all; margin-bottom: 1rem; }
.pillars { display: grid; gap: 0.7rem; }
.pillar { }
.pillar-top { display: flex; justify-content: space-between; font-size: 0.82rem; margin-bottom: 0.25rem; }
.pillar-top span:last-child { font-family: var(--mono); color: var(--text-dim); }
.pillar-track { height: 6px; background: var(--line); border-radius: 4px; overflow: hidden; }
.pillar-bar { height: 100%; background: var(--signal); border-radius: 4px; transition: width 0.8s ease; }

.stat-row { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.2rem; }
.stat {
  flex: 1; min-width: 120px; background: var(--ink-2); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 0.9rem 1.1rem;
}
.stat-val { font-family: var(--display); font-weight: 800; font-size: 1.7rem; }
.stat-label { font-size: 0.75rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }

.findings { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.2rem; margin-top: 1.6rem; }
.findings h3 { font-family: var(--display); font-weight: 600; font-size: 1.05rem; margin-bottom: 0.8rem; }
.issue {
  background: var(--ink-2); border: 1px solid var(--line-soft); border-left: 3px solid var(--amber);
  border-radius: 10px; padding: 0.85rem 1rem; margin-bottom: 0.7rem;
}
.issue.high { border-left-color: var(--coral); }
.issue.medium { border-left-color: var(--amber); }
.issue.low { border-left-color: var(--cyan); }
.issue-pillar { font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); }
.issue-msg { font-size: 0.92rem; margin: 0.2rem 0 0.35rem; }
.issue-fix { font-size: 0.84rem; color: var(--text-dim); }
.issue-examples { font-family: var(--mono); font-size: 0.74rem; color: var(--text-faint); margin-top: 0.4rem; }
.wins { list-style: none; }
.wins li {
  font-size: 0.88rem; color: var(--text-dim); padding: 0.55rem 0 0.55rem 1.4rem;
  border-bottom: 1px solid var(--line-soft); position: relative;
}
.wins li::before { content: ''; position: absolute; left: 0; top: 0.95rem; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

/* ---------- section heads ---------- */
.section-head { margin-bottom: 1.8rem; max-width: 720px; }
.section-head h2 { font-family: var(--display); font-weight: 800; font-size: clamp(1.6rem, 3.5vw, 2.3rem); letter-spacing: -0.02em; margin-bottom: 0.6rem; }
.section-head p { color: var(--text-dim); }

/* ---------- crawl form ---------- */
.crawl-form { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; }
.crawl-form > input[type=text] {
  flex: 1; min-width: 260px; font-family: var(--mono); font-size: 0.95rem;
  background: var(--ink-2); border: 1px solid var(--line); color: var(--text);
  padding: 0.9rem 1.1rem; border-radius: 11px; outline: none;
}
.crawl-form > input[type=text]:focus { border-color: var(--signal); }
.inline-field { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-dim); }
.inline-field input { width: 84px; font-family: var(--mono); background: var(--ink-2); border: 1px solid var(--line); color: var(--text); padding: 0.6rem 0.7rem; border-radius: 9px; }
.checkbox { display: flex; align-items: center; gap: 0.45rem; font-size: 0.85rem; color: var(--text-dim); cursor: pointer; }
.checkbox input { accent-color: var(--signal); width: 16px; height: 16px; }

/* ---------- progress ---------- */
.progress-card { margin-top: 1.6rem; background: var(--ink-2); border: 1px solid var(--line); border-radius: 14px; padding: 1.3rem 1.5rem; }
.progress-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; font-size: 0.92rem; }
.progress-head span:first-child { font-weight: 600; }
.progress-track { height: 8px; background: var(--line); border-radius: 5px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--signal-dim), var(--signal)); border-radius: 5px; transition: width 0.5s ease; }
.progress-note { font-size: 0.8rem; color: var(--text-faint); margin-top: 0.6rem; }

/* ---------- analysis ---------- */
.analysis { margin-top: 2rem; }
.filters { display: flex; flex-wrap: wrap; gap: 0.9rem; align-items: end; margin-bottom: 1.5rem; padding: 1rem 1.2rem; background: var(--ink-2); border: 1px solid var(--line-soft); border-radius: 12px; }
.filters label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.76rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
select { font-family: var(--body); font-size: 0.88rem; background: var(--ink-3); border: 1px solid var(--line); color: var(--text); padding: 0.5rem 0.7rem; border-radius: 9px; outline: none; min-width: 150px; }
select:focus { border-color: var(--signal); }
.data-badge { font-family: var(--mono); font-size: 0.74rem; color: var(--text-faint); margin-left: auto; align-self: center; }
.data-badge.live { color: var(--signal); }

.audit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.9rem; margin-bottom: 2rem; }
.audit-card { background: var(--ink-2); border: 1px solid var(--line-soft); border-radius: 13px; padding: 1.2rem 1.3rem; }
.audit-card .big { font-family: var(--display); font-weight: 800; font-size: 2.1rem; line-height: 1; }
.audit-card .lbl { font-size: 0.78rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 0.35rem; }
.audit-card.alert .big { color: var(--coral); }
.audit-card .list { margin-top: 0.8rem; max-height: 140px; overflow-y: auto; }
.audit-card .list a { display: block; font-family: var(--mono); font-size: 0.74rem; color: var(--cyan); text-decoration: none; padding: 0.2rem 0; border-bottom: 1px solid var(--line-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-card .list a:hover { color: var(--signal); }

/* ---------- opportunities table ---------- */
.opps-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.opps-head h3 { font-family: var(--display); font-weight: 600; font-size: 1.25rem; }
.count { font-family: var(--mono); font-size: 0.85rem; color: var(--text-faint); font-weight: 400; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
thead th { text-align: left; font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); padding: 0.8rem 1rem; background: var(--ink-3); border-bottom: 1px solid var(--line); }
thead th.num { text-align: right; }
tbody td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:hover { background: var(--ink-2); }
tbody tr:last-child td { border-bottom: none; }
.cell-url { font-family: var(--mono); font-size: 0.76rem; color: var(--text); word-break: break-all; }
.cell-url .ttl { display: block; color: var(--text-faint); font-family: var(--body); font-size: 0.74rem; margin-top: 0.15rem; }
.relevance { display: inline-block; font-family: var(--mono); padding: 0.15rem 0.5rem; border-radius: 6px; background: rgba(199,242,63,0.12); color: var(--signal); }
.anchors { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.anchor-chip { font-family: var(--mono); font-size: 0.72rem; background: var(--ink-3); border: 1px solid var(--line); color: var(--text-dim); padding: 0.1rem 0.45rem; border-radius: 6px; }

/* ---------- data cards ---------- */
.data-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.data-card { background: var(--ink-2); border: 1px solid var(--line); border-radius: 15px; padding: 1.5rem 1.6rem; }
.data-card h3 { font-family: var(--display); font-weight: 600; font-size: 1.15rem; margin-bottom: 0.9rem; }
.data-card label { display: block; font-size: 0.78rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; margin: 0.9rem 0 0.3rem; }
.data-card select, .data-card input[type=text], .data-card input[type=date] {
  width: 100%; font-family: var(--body); font-size: 0.88rem; background: var(--ink-3);
  border: 1px solid var(--line); color: var(--text); padding: 0.55rem 0.7rem; border-radius: 9px; outline: none;
}
.gsc-row { display: flex; gap: 0.6rem; }
.gsc-row > * { flex: 1; }
.file-drop {
  display: grid; place-items: center; min-height: 90px; margin-top: 0.6rem;
  border: 1.5px dashed var(--line); border-radius: 12px; color: var(--text-dim);
  font-size: 0.9rem; cursor: pointer; transition: all 0.15s; text-align: center; padding: 1rem;
}
.file-drop:hover { border-color: var(--signal); color: var(--signal); }
.csv-stat { font-size: 0.95rem; margin: 1rem 0 0.4rem; }
.data-badge.pill, .status-pill {
  display: inline-block; font-family: var(--mono); font-size: 0.74rem;
  padding: 0.2rem 0.6rem; border-radius: 20px; border: 1px solid var(--line);
}
.status-pill.ok { color: var(--green); border-color: rgba(95,212,154,0.4); }
.status-pill.off { color: var(--text-faint); }
.btn-google {
  display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem;
  font-family: var(--body); font-weight: 600; font-size: 0.9rem;
  background: var(--text); color: var(--ink); border: none; padding: 0.7rem 1.2rem;
  border-radius: 10px; cursor: pointer; text-decoration: none;
}

.foot {
  max-width: 1080px; margin: 0 auto; padding: 2rem 1.6rem 3rem; position: relative; z-index: 2;
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--line); margin-top: 2rem;
  color: var(--text-faint); font-size: 0.8rem;
}
.foot .mono { font-size: 0.72rem; }

@media (max-width: 760px) {
  .topbar { flex-direction: column; gap: 0.8rem; align-items: flex-start; }
  .findings { grid-template-columns: 1fr; }
  .data-cards { grid-template-columns: 1fr; }
  .brand-tag { display: none; }
}
