@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

/* Web Crawler: a neon specimen lab. Pink is the spider's mischief, cyan is the live system.
   Chrome stays dark and quiet so the article and the canvas spider remain the show. */
:root {
  color-scheme: dark;
  --bg: #07080d;
  --panel: #0f121a;
  --panel-2: #141824;
  --line: #262b39;
  --line-2: #343a4c;
  --text: #f1f3f7;
  --muted: #a7adbd;
  --faint: #7b8296;
  --pink: #ff2d95;
  --pink-soft: rgba(255, 45, 149, .14);
  --cyan: #2de2ff;
  --cyan-soft: rgba(45, 226, 255, .12);
  --mono: 'Space Mono', ui-monospace, monospace;
  --sans: 'Space Grotesk', system-ui, sans-serif;
  --ease: cubic-bezier(.2, .8, .25, 1);
}

* { box-sizing: border-box; }
body {
  margin: 0; color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(60rem 30rem at 85% -6rem, rgba(255, 45, 149, .09), transparent 70%),
    radial-gradient(50rem 28rem at 0% 10rem, rgba(45, 226, 255, .06), transparent 70%),
    var(--bg);
  position: relative; overflow-x: hidden;
}
::selection { background: var(--pink); color: #fff; }
main { width: min(1240px, 100% - 80px); margin: 0 auto; position: relative; }
a { color: inherit; text-underline-offset: 4px; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }

/* Decorative orb web behind the hero */
.backdrop { position: absolute; inset: 0 0 auto 0; height: 560px; overflow: hidden; pointer-events: none; z-index: 0; }
.backdrop-web {
  position: absolute; top: -170px; right: -150px; width: 640px; height: 640px; z-index: 0; pointer-events: none;
  color: rgba(45, 226, 255, .09);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 30%, transparent 70%);
  mask-image: radial-gradient(circle at 50% 50%, #000 30%, transparent 70%);
}

/* Buttons */
button {
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  padding: 10px 17px; border-radius: 8px; white-space: nowrap; font-size: 14px;
  transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease), transform .15s var(--ease);
}
button:hover:not(:disabled) { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 18px -6px rgba(45, 226, 255, .6); }
button:active:not(:disabled) { transform: scale(.97); }
button:disabled { opacity: .4; cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, #viewport:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
button#pause {
  background: var(--cyan); border-color: var(--cyan); color: #04141a; min-width: 96px; font-weight: 700;
  box-shadow: 0 0 24px -6px rgba(45, 226, 255, .75);
}
button#pause:hover:not(:disabled) { background: #a6f4ff; color: #04141a; }
button#pause[aria-pressed=true] { background: transparent; color: var(--cyan); box-shadow: inset 0 0 0 1px var(--cyan); }

/* Top line */
.topline {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  padding: 22px 0; border-bottom: 1px solid var(--line);
  font: 11px var(--mono); letter-spacing: 1.2px; color: var(--faint);
}
.topline a {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(15, 18, 26, .7); color: var(--muted);
  font: 500 13px var(--sans); letter-spacing: 0; text-decoration: none;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.topline a:hover { color: var(--text); border-color: var(--line-2); }
.topline a span { color: var(--pink); }

/* Hero */
.hero {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 36px;
  padding: 34px 0 30px;
}
.eyebrow { font: 11px var(--mono); letter-spacing: 2px; color: var(--cyan); margin: 0 0 12px; }
.live-dot {
  display: inline-block; width: 7px; height: 7px; background: var(--cyan); border-radius: 50%;
  margin-right: 6px; box-shadow: 0 0 10px rgba(45, 226, 255, .7); vertical-align: 1px;
}
h1 { font-size: clamp(46px, 6.4vw, 80px); letter-spacing: -.045em; line-height: 1; margin: 0; font-weight: 600; }
h1 span { color: var(--pink); text-shadow: 0 0 28px rgba(255, 45, 149, .55), 0 0 2px rgba(255, 45, 149, .8); }
.intro { color: var(--muted); font-size: 16px; line-height: 1.65; margin: 16px 0 0; max-width: 46ch; }

/* A spider hanging on a silk thread */
.dangler { position: relative; align-self: start; width: 74px; height: 150px; margin-top: -34px; color: var(--cyan); transform-origin: 50% 0; }
.dangler .silk { position: absolute; left: 50%; top: 0; width: 1px; height: 84px; background: linear-gradient(rgba(45, 226, 255, 0), rgba(45, 226, 255, .7)); }
.dangler svg { position: absolute; left: 0; top: 70px; width: 74px; height: 74px; filter: drop-shadow(0 0 8px rgba(45, 226, 255, .55)); }
@keyframes dangle { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }

/* Museum specimen label */
.specimen {
  position: relative; display: flex; flex-direction: column; gap: 7px;
  padding: 18px 22px 16px; min-width: 210px;
  font: 11px var(--mono); color: var(--faint); letter-spacing: 1px;
  background: linear-gradient(180deg, rgba(20, 24, 36, .9), rgba(15, 18, 26, .9));
  border: 1px dashed var(--line-2); border-radius: 6px;
  transform: rotate(1.5deg); box-shadow: 0 18px 40px -20px rgba(0, 0, 0, .9);
}
.specimen strong { font: 700 21px var(--mono); color: var(--text); letter-spacing: -.5px; margin: 2px 0 4px; }
.specimen .pin {
  position: absolute; top: -6px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff8cc6, var(--pink) 60%, #9b0f55); box-shadow: 0 0 12px rgba(255, 45, 149, .7);
}

/* Console: controls + article trail in one panel */
.console {
  position: relative; z-index: 1;
  background: linear-gradient(180deg, rgba(20, 24, 36, .92), rgba(15, 18, 26, .92));
  border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset;
}
.console::before {
  content: ''; position: absolute; left: 24px; right: 24px; top: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--pink) 25%, var(--cyan) 75%, transparent);
  opacity: .8;
}
.controls { display: flex; align-items: center; flex-wrap: wrap; gap: 18px 30px; padding: 20px 24px; }
.control { display: flex; flex-direction: column; gap: 10px; }
.control label { font: 11px var(--mono); letter-spacing: 1.2px; color: var(--muted); }
.speed-control, .intensity-control { width: 190px; flex-shrink: 0; }
.speed-control label, .intensity-control label { display: flex; justify-content: space-between; }
.speed-control output { color: var(--cyan); }
.intensity-control output { color: var(--pink); }
.action-controls { display: flex; gap: 8px; }
.toggles { margin-left: auto; display: flex; gap: 22px; }

/* Neon range tracks */
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 18px; margin: 0; background: transparent; cursor: pointer;
  --accent: var(--cyan); --fill: 50%;
}
#intensity { --accent: var(--pink); }
input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent) 0 var(--fill), #2a2f3e var(--fill) 100%);
}
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: #2a2f3e; }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent); box-shadow: 0 0 12px var(--accent);
  transition: transform .15s var(--ease);
}
input[type=range]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); box-shadow: 0 0 12px var(--accent); }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.15); }

select {
  border: 1px solid var(--line-2); border-radius: 8px; background-color: #0a0d14; color: var(--text);
  padding: 7px 30px 7px 11px; font: 13px var(--mono);
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%232de2ff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 12px;
}
select:hover:not(:disabled) { border-color: var(--cyan); }
select:disabled { opacity: .5; cursor: default; }

/* Toggles */
.toggle { display: flex; align-items: center; gap: 10px; font-size: 14px; white-space: nowrap; cursor: pointer; position: relative; color: var(--muted); }
.toggle input { position: absolute; opacity: 0; width: 34px; height: 20px; margin: 0; }
.switch { width: 34px; height: 20px; background: #2a2f3e; border-radius: 12px; position: relative; transition: background .2s var(--ease), box-shadow .2s var(--ease); }
.switch:before { content: ''; position: absolute; top: 4px; left: 4px; width: 12px; height: 12px; background: #adb4c5; border-radius: 50%; transition: left .2s var(--ease), background .2s var(--ease); }
.toggle input:checked + .switch { background: #0f4d5a; box-shadow: 0 0 14px -4px var(--cyan); }
.toggle input:checked + .switch:before { left: 18px; background: var(--cyan); }
.toggle:has(input:checked) { color: var(--text); }
.toggle input:focus-visible + .switch { outline: 2px solid var(--cyan); outline-offset: 4px; }
.switch, .switch:before { pointer-events: none; }

/* Article trail */
.article-history {
  display: flex; align-items: center; gap: 14px; padding: 12px 24px; min-width: 0;
  border-top: 1px dashed var(--line-2); background: rgba(10, 13, 20, .5);
}
.article-history button { font-size: 13px; padding: 7px 12px; }
.article-history button:disabled { cursor: default; }
.article-history label, .article-history > span { font: 11px var(--mono); letter-spacing: 1px; color: var(--faint); white-space: nowrap; }
.article-history select { min-width: 0; max-width: 460px; flex: 1; }
.article-history > span { margin-left: auto; color: var(--muted); }

/* Lab + frame */
.lab {
  position: relative; z-index: 1;
  padding: 26px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 14px 14px;
  background:
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(255, 255, 255, .025) 39px 40px),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(255, 255, 255, .025) 39px 40px),
    radial-gradient(ellipse at 50% 0%, rgba(45, 226, 255, .05), transparent 60%),
    #0a0c12;
}
.frame {
  border: 1px solid #3b4258; border-radius: 10px; overflow: hidden; width: 100%; margin: auto;
  box-shadow: 0 0 0 1px rgba(45, 226, 255, .06), 0 0 60px -20px rgba(255, 45, 149, .35), 0 30px 60px -30px rgba(0, 0, 0, .9);
}
.browser-bar {
  height: 42px; display: flex; align-items: center; gap: 16px; padding: 0 14px;
  background: #171b26; border-bottom: 1px solid var(--line);
  font: 12px var(--mono); color: var(--muted);
}
.window-dots { display: flex; gap: 6px; }
.window-dots i { width: 9px; height: 9px; border-radius: 50%; background: #3a4052; }
.window-dots i:first-child { background: var(--pink); box-shadow: 0 0 8px rgba(255, 45, 149, .6); }
.window-dots i:nth-child(2) { background: #f5c451; }
.window-dots i:last-child { background: var(--cyan); }
.address {
  flex: 1; min-width: 0; max-width: 560px; display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 999px; background: #0c0f16; border: 1px solid var(--line);
}
.address svg { width: 12px; height: 12px; flex-shrink: 0; color: var(--cyan); }
#article-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-label {
  margin-left: auto; font-size: 10px; letter-spacing: 1px; color: var(--pink); white-space: nowrap;
  padding: 3px 7px; border-radius: 4px; background: var(--pink-soft); border: 1px solid rgba(255, 45, 149, .3);
}
.stage { position: relative; height: clamp(420px, 68vh, 800px); background: #fff; isolation: isolate; }
#viewport { width: 100%; height: 100%; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #657286 #151924; position: relative; }
#article-host { display: block; min-height: 100%; background: white; color: #202122; }
#spider-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }

.telemetry {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; height: 40px; padding: 0 16px;
  background: #121620; border-top: 1px solid var(--line);
  font: 11px var(--mono); color: var(--muted); letter-spacing: 1px;
}
.telemetry b { color: var(--pink); font-weight: 700; text-shadow: 0 0 10px rgba(255, 45, 149, .6); }
.telemetry .live-dot { width: 6px; height: 6px; }
#state { color: var(--text); }

/* Cast: each spider's species, size, and diet */
.cast-row { display: flex; align-items: flex-start; gap: 18px; padding: 14px 24px; border-top: 1px dashed var(--line-2); }
.cast-row h2 { flex-shrink: 0; margin: 9px 0 0; font: 400 11px var(--mono); letter-spacing: 1px; color: var(--faint); }
.cast { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 8px; }
.cast li {
  position: relative; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; align-items: center;
  padding: 9px 12px 10px; border-radius: 10px; min-width: 0;
  background: rgba(10, 13, 20, .55); border: 1px solid var(--line);
  box-shadow: inset 3px 0 0 var(--species);
  animation: cast-in .35s var(--ease) both;
}
.cast-number { grid-row: span 3; align-self: start; padding-top: 2px; font: 700 11px var(--mono); color: var(--species); text-shadow: 0 0 10px var(--species); }
.cast strong { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cast-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.cast-tags span {
  padding: 1px 6px; border-radius: 4px; font: 10.5px var(--mono); color: var(--species);
  background: color-mix(in srgb, var(--species) 12%, transparent); border: 1px solid color-mix(in srgb, var(--species) 35%, transparent);
}
.cast small { color: var(--faint); font-size: 12px; line-height: 1.35; }
@keyframes cast-in { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .cast li { animation: none; } }

/* Loading / error overlays */
.notice {
  position: absolute; inset: 0; z-index: 3; padding: 25px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: radial-gradient(circle at 50% 40%, #1a1f2e, #0e1118 70%);
}
.notice[hidden] { display: none; }
.notice h2 { font-size: 24px; font-weight: 500; margin: 12px 0 0; }
.notice p { font-size: 15px; color: var(--muted); line-height: 1.6; }
.loader-mark { color: var(--pink); font-size: 58px; line-height: 1; text-shadow: 0 0 24px rgba(255, 45, 149, .7); }
@keyframes spin { to { transform: rotate(360deg); } }
.suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* 9:16 reel */
.reel-watermark { display: none; }
.reel .frame { max-width: 430px; }
.reel .stage { height: auto; aspect-ratio: 9/16; }
.reel .reel-watermark {
  position: absolute; display: flex; justify-content: space-between; align-items: center; inset: auto 0 0;
  padding: 24px 14px 12px; background: linear-gradient(transparent, #070b14d9);
  font: 10px var(--mono); color: var(--cyan); z-index: 2; pointer-events: none;
}
.reel-watermark span { font-size: 8px; color: #dae2f2; }
.reel .source-label, .reel .telemetry-end { display: none; }

/* Below the stage + footer */
.below-stage { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 18px 0 34px; color: var(--muted); font-size: 14px; }
.below-stage p { margin: 0; line-height: 1.6; padding-left: 14px; border-left: 2px solid var(--pink); }
.below-stage button { padding: 0; background: none; border: 0; color: var(--cyan); font-size: 13px; box-shadow: none; }
.below-stage button:hover:not(:disabled) { box-shadow: none; text-decoration: underline; text-underline-offset: 4px; }
footer { display: flex; justify-content: space-between; align-items: center; gap: 30px; padding: 26px 0 36px; border-top: 1px solid var(--line); font-size: 15px; }
footer p { margin: 0; font-weight: 500; }
footer p span { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 8px; line-height: 1.7; }
.bookmark { display: flex; align-items: flex-end; flex-direction: column; gap: 9px; }
.bookmark a {
  font: 13px var(--mono); color: var(--pink); text-decoration: none; padding: 10px 14px;
  border: 1px dashed rgba(255, 45, 149, .5); border-radius: 8px; background: var(--pink-soft); cursor: grab;
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.bookmark a:hover { box-shadow: 0 0 22px -6px rgba(255, 45, 149, .7); transform: translateY(-1px); }
.bookmark span { font-size: 12px; color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
  .dangler { animation: dangle 5s ease-in-out infinite; }
  .dangler svg { animation: bob 3.2s ease-in-out infinite; }
  .live-dot { animation: pulse 2s ease-in-out infinite; }
  .loader-mark { display: inline-block; animation: spin 3s linear infinite; }
}
@keyframes pulse { 50% { opacity: .35; } }

@media (min-width: 1500px) { main { width: min(1380px, 100% - 100px); } }

@media (max-width: 950px) {
  main { width: calc(100% - 40px); }
  .hero { grid-template-columns: minmax(0, 1fr) auto; }
  .specimen { display: none; }
  .controls { gap: 18px 22px; }
  .toggles { margin-left: 0; }
  .speed-control, .intensity-control { flex: 1; min-width: 140px; width: auto; }
  .lab { padding: 16px; }
}

@media (max-width: 600px) {
  main { width: calc(100% - 24px); }
  .backdrop-web { width: 420px; height: 420px; top: -120px; right: -170px; }
  .topline { padding: 14px 0; font-size: 9px; letter-spacing: .6px; }
  .topline a { font-size: 12px; padding: 6px 10px; }
  .topline > span { display: none; }
  .hero { padding: 24px 0 22px; gap: 12px; }
  .dangler { width: 48px; height: 104px; margin-top: -24px; }
  .dangler .silk { height: 58px; }
  .dangler svg { width: 48px; height: 48px; top: 50px; }
  .intro { font-size: 14px; }
  .console { border-radius: 12px 12px 0 0; }
  .controls { padding: 16px; gap: 16px; }
  .speed-control, .intensity-control { min-width: 130px; }
  .action-controls { margin-left: auto; }
  .toggles { width: 100%; justify-content: space-between; }
  .control label { font-size: 10px; }
  button { padding: 9px 12px; font-size: 13px; }
  button#pause { min-width: 80px; }
  .cast-row { flex-direction: column; gap: 8px; padding: 12px; }
  .cast-row h2 { margin: 0; font-size: 10px; }
  .cast { grid-template-columns: 1fr; }
  .article-history { padding: 12px; gap: 8px; flex-wrap: wrap; }
  .article-history label { font-size: 10px; }
  .article-history select { flex-basis: 45%; font-size: 12px; }
  .article-history > span { display: none; }
  .lab { padding: 10px; border-radius: 0 0 12px 12px; }
  .stage { height: 62svh; min-height: 360px; }
  .browser-bar { gap: 9px; padding: 0 10px; font-size: 10px; }
  .window-dots i { width: 7px; height: 7px; }
  .source-label { display: none; }
  .telemetry { font-size: 10px; padding: 0 10px; letter-spacing: .3px; }
  .telemetry-end { display: none; }
  .below-stage { flex-direction: column; align-items: flex-start; font-size: 13px; gap: 10px; }
  footer { flex-direction: column; align-items: flex-start; gap: 23px; }
  .bookmark { align-items: flex-start; }
  .reel .stage { min-height: 0; }
  .reel .lab { padding: 10px; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
