/* Sherlock LG — dark, quiet, fast. */

:root {
  --bg: #0a0d14;
  --bg-2: #0e131d;
  --panel: rgba(19, 25, 38, 0.72);
  --panel-solid: #131926;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.26);
  --text: #e6edf7;
  --muted: #8b98ad;
  --accent: #5eead4;
  --accent-2: #38bdf8;
  --found: #34d399;
  --found-bg: rgba(52, 211, 153, 0.1);
  --missing: #64748b;
  --problem: #fbbf24;
  --danger: #f87171;
  --radius: 16px;
  --shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.9);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(56, 189, 248, 0.16), transparent 60%),
    radial-gradient(760px 460px at 92% 4%, rgba(94, 234, 212, 0.13), transparent 62%),
    radial-gradient(1000px 700px at 50% 118%, rgba(99, 102, 241, 0.12), transparent 65%),
    var(--bg);
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(16px, 4vw, 34px);
  padding-top: calc(14px + env(safe-area-inset-top, 0px)); /* iPhone notch in standalone mode */
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(10, 13, 20, 0.72);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--accent);
  background: linear-gradient(150deg, rgba(94, 234, 212, 0.18), rgba(56, 189, 248, 0.1));
  border: 1px solid rgba(94, 234, 212, 0.3);
}

.brand-name { font-weight: 650; letter-spacing: -0.01em; font-size: 16px; }
.brand-name em { font-style: normal; color: var(--accent); }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.pill {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.07);
  padding: 5px 11px;
  border-radius: 999px;
  white-space: nowrap;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.16s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }

/* ---------- layout ---------- */
main {
  width: min(1140px, 100% - clamp(24px, 5vw, 56px));
  margin: 0 auto;
  padding: clamp(30px, 6vh, 66px) 0 calc(40px + env(safe-area-inset-bottom, 0px));
}

.hero { margin-bottom: clamp(22px, 4vh, 34px); }

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(30px, 6vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 720;
}

.grad {
  background: linear-gradient(92deg, var(--accent) 0%, var(--accent-2) 60%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sub {
  margin: 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: clamp(14px, 1.6vw, 16.5px);
  line-height: 1.6;
}

/* ---------- search card ---------- */
.search-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(14px, 2.4vw, 20px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(6, 9, 15, 0.75);
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  padding: 8px 8px 8px 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.input-row:focus-within {
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.1);
}

.input-icon { color: var(--muted); display: grid; place-items: center; }

#username {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font-size: clamp(16px, 2vw, 19px);
  font-family: var(--mono);
  letter-spacing: 0.01em;
  padding: 9px 4px;
}
#username::placeholder { color: #55617a; }

.hunt-btn {
  border: 0;
  cursor: pointer;
  border-radius: 10px;
  padding: 11px 26px;
  font-size: 15px;
  font-weight: 660;
  color: #04211c;
  background: linear-gradient(135deg, var(--accent) 0%, #7dd3fc 100%);
  box-shadow: 0 8px 22px -10px rgba(94, 234, 212, 0.85);
  transition: transform 0.14s ease, filter 0.14s ease, opacity 0.14s ease;
  white-space: nowrap;
}
.hunt-btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.hunt-btn:active { transform: translateY(0); }
.hunt-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.hunt-btn.wide { width: 100%; margin-top: 6px; }

.hunt-btn.is-hunting {
  background: linear-gradient(135deg, #34d399, #38bdf8);
  color: #04211c;
}
.hunt-btn.is-hunting .hunt-label::after {
  content: "";
  display: inline-block;
  width: 6px;
  margin-left: 8px;
  animation: dots 1.1s steps(4, end) infinite;
}
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.opts {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 13px;
  padding: 0 3px;
  flex-wrap: wrap;
}

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 38px;
  height: 21px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  border: 1px solid var(--line-strong);
  position: relative;
  transition: 0.18s ease;
  flex: none;
}
.switch .knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: 0.18s ease;
}
.switch input:checked + .track { background: rgba(94, 234, 212, 0.35); border-color: rgba(94, 234, 212, 0.6); }
.switch input:checked + .track .knob { transform: translateX(17px); background: var(--accent); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.25); }
.switch-text { font-size: 13.5px; color: var(--muted); }

.spacer { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }

.key-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.key-row label { font-size: 13px; color: var(--muted); }
.key-row input {
  flex: 1;
  background: rgba(6, 9, 15, 0.75);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  padding: 9px 12px;
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
}
.key-row input:focus { border-color: rgba(94, 234, 212, 0.55); }

.notice {
  margin-top: 13px;
  padding: 11px 14px;
  border-radius: 11px;
  font-size: 14px;
  line-height: 1.5;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
}
.notice.info {
  background: rgba(56, 189, 248, 0.09);
  border-color: rgba(56, 189, 248, 0.32);
  color: #bae6fd;
}

/* ---------- stats ---------- */
.stats { margin-top: 22px; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }

.chip {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.chip-num { font-size: 21px; font-weight: 700; font-family: var(--mono); letter-spacing: -0.02em; }
.chip-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.chip-found .chip-num { color: var(--found); }
.chip-problem .chip-num { color: var(--problem); }

.progress {
  margin-top: 12px;
  height: 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
}
.bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s ease;
}
.bar::after { content: ""; }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 26px;
}

.tabs { display: flex; gap: 7px; flex-wrap: wrap; }

.tab {
  border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.06);
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  cursor: pointer;
  transition: 0.15s ease;
  display: inline-flex;
  gap: 7px;
  align-items: center;
}
.tab:hover { color: var(--text); border-color: var(--line-strong); }
.tab.is-on {
  background: rgba(94, 234, 212, 0.13);
  border-color: rgba(94, 234, 212, 0.45);
  color: var(--accent);
}
.tab-n {
  font-family: var(--mono);
  font-size: 11.5px;
  background: rgba(0, 0, 0, 0.32);
  padding: 1px 6px;
  border-radius: 6px;
}

.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.filter-input {
  background: rgba(6, 9, 15, 0.7);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 13.5px;
  outline: none;
  width: 150px;
}
.filter-input:focus { border-color: rgba(94, 234, 212, 0.5); }

.ghost-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 9px;
  padding: 8px 13px;
  font-size: 13.5px;
  cursor: pointer;
  transition: 0.15s ease;
}
.ghost-btn:hover:not(:disabled) { color: var(--text); border-color: var(--line-strong); }
.ghost-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.install-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
  border-color: rgba(94, 234, 212, 0.42);
  background: rgba(94, 234, 212, 0.1);
  font-weight: 620;
}
.install-btn:hover:not(:disabled) {
  color: var(--accent);
  background: rgba(94, 234, 212, 0.18);
  border-color: var(--accent);
}

/* ---------- results ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 11px;
  margin-top: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px 14px;
  border-radius: 13px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  animation: pop 0.28s ease both;
  min-height: 96px;
}
@keyframes pop { from { opacity: 0; transform: translateY(7px) scale(0.985); } to { opacity: 1; transform: none; } }

.card:hover { transform: translateY(-2px); border-color: var(--line-strong); }

.card.found {
  order: -1;
  background: linear-gradient(160deg, rgba(52, 211, 153, 0.13), rgba(19, 25, 38, 0.9));
  border-color: rgba(52, 211, 153, 0.42);
}
.card.found:hover { border-color: rgba(52, 211, 153, 0.75); }

.card.missing { opacity: 0.62; }
.card.missing:hover { opacity: 1; }

.card.problem { border-color: rgba(251, 191, 36, 0.3); }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.card-site {
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* The URL Sherlock actually checked — the point of the whole card. */
.card-url {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.45;
  color: #86a3c4;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card.found .card-url { color: #7ee7c7; }

.card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  min-height: 16px;
}

.card-ms { font-family: var(--mono); font-size: 11px; color: #5c6a80; }

.card-http {
  font-family: var(--mono);
  font-size: 10.5px;
  color: #6b7c95;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}
.card-http:empty { display: none; }

.status {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 650;
  white-space: nowrap;
  flex: none;
}
.status.found { background: rgba(52, 211, 153, 0.18); color: var(--found); }
.status.missing { background: rgba(100, 116, 139, 0.2); color: #94a3b8; }
.status.problem { background: rgba(251, 191, 36, 0.15); color: var(--problem); }

.card-go {
  margin-left: auto;
  color: var(--found);
  opacity: 0.45;
  transform: translateX(-3px);
  transition: 0.16s ease;
  font-size: 13px;
  flex: none;
}
.card.missing .card-go { color: var(--muted); }
.card:hover .card-go { opacity: 1; transform: none; }

.card-detail {
  margin-top: 8px;
  font-size: 12px;
  color: var(--problem);
  opacity: 0.85;
  line-height: 1.4;
  word-break: break-word;
}



/* ---------- empty / footer ---------- */
.empty {
  text-align: center;
  padding: clamp(40px, 9vh, 78px) 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  margin-top: 18px;
}
.empty-mark { color: #2f3b4f; margin-bottom: 14px; }
.empty-title { margin: 0 0 6px; font-size: 17px; font-weight: 620; }
.empty-text { margin: 0; color: var(--muted); font-size: 14px; }

.foot {
  width: min(1140px, 100% - clamp(24px, 5vw, 56px));
  margin: 10px auto 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}
.foot a { color: var(--accent); text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.dot { opacity: 0.5; }

/* ---------- dialog ---------- */
dialog {
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--panel-solid);
  color: var(--text);
  padding: 0;
  width: min(520px, calc(100vw - 32px));
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.9);
}
dialog::backdrop { background: rgba(3, 6, 12, 0.72); backdrop-filter: blur(3px); }
.dialog-inner { padding: 24px; }
.dialog-inner h2 { margin: 0 0 12px; font-size: 20px; letter-spacing: -0.02em; }
.dialog-inner p { color: var(--muted); font-size: 14.5px; line-height: 1.65; margin: 0 0 12px; }
.dialog-inner strong { color: var(--text); }
.facts { list-style: none; padding: 0; margin: 0 0 14px; border-top: 1px solid var(--line); }
.facts li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.facts span { color: var(--muted); }
.facts b { font-weight: 600; text-align: right; }
.fine { font-size: 13px !important; opacity: 0.8; }

.hidden { display: none !important; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .hero h1 { font-size: clamp(28px, 8vw, 38px); }
  .input-row { flex-wrap: wrap; padding: 10px; }
  #username { order: 2; width: 100%; flex: 1 1 100%; padding: 8px 4px; }
  .input-icon { order: 1; }
  .hunt-btn { order: 3; width: 100%; margin-top: 4px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .tools { width: 100%; }
  .filter-input { flex: 1; width: auto; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .topbar .pill { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
