:root {
  --ink: #0A0E14;
  --ink-2: #12161F;
  --ink-3: #1A2029;
  --signal: #5DE0C4;
  --signal-dim: #2E5A50;
  --alert: #FF6B4A;
  --good: #6FE07A;
  --warn: #E8C766;
  --human: #F4E9D8;
  --text: #E7ECF3;
  --mute: #7C8698;
  --line: #232A36;

  --font-hook: 'Fraunces', Georgia, serif;
  --font-machine: 'IBM Plex Mono', 'SF Mono', monospace;
  --font-ui: 'Inter', -apple-system, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-ui);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
::selection { background: var(--signal); color: var(--ink); }

.cursor-caret {
  display: inline-block;
  width: 0.5em; height: 1em;
  background: var(--signal);
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
  box-shadow: 0 0 8px var(--signal);
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Top bar ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.75rem;
  border-bottom: 1px solid var(--line);
}
.top__brand { font-family: var(--font-hook); font-style: italic; font-size: 1.2rem; }
.top__line { font-family: var(--font-machine); font-size: 0.75rem; color: var(--mute); margin: 0; }

.loader__row--paste { margin-top: 0.6rem; align-items: flex-start; }
#pasteBox {
  flex: 1; min-width: 260px; min-height: 60px;
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-machine);
  font-size: 0.78rem;
  padding: 0.6rem;
  border-radius: 6px;
  resize: vertical;
}
.loader__btn--ghost {
  background: transparent;
  color: var(--signal);
  border: 1px solid var(--signal-dim);
}
.loader__btn--ghost:hover { background: var(--ink-3); }

/* ---------- Loader controls ---------- */
.loader {
  padding: 0.9rem 1.75rem;
  border-bottom: 1px solid var(--line);
  background: var(--ink-2);
}
.loader__row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.loader__row--compare { margin-top: 0.6rem; }
.loader__label { font-family: var(--font-machine); font-size: 0.75rem; color: var(--text); min-width: 90px; }
.loader__label--muted { color: var(--mute); }
#urlInput {
  flex: 1; min-width: 260px;
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-machine);
  font-size: 0.85rem;
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
}
#urlInput:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }
.loader__btn, .chip {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.85rem;
  background: var(--signal);
  color: var(--ink);
  border: none;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s var(--ease);
}
.loader__btn:hover, .chip:hover { transform: translateY(-1px); }
.chip {
  background: transparent;
  color: var(--signal);
  border: 1px solid var(--signal-dim);
  padding: 0.4rem 0.9rem;
  font-size: 0.78rem;
}
.loader__status {
  font-family: var(--font-machine);
  font-size: 0.75rem;
  color: var(--mute);
}
.loader__status.is-error { color: var(--alert); }
.loader__status.is-loading { color: var(--warn); }
.loader__status.is-ok { color: var(--good); }

/* ---------- Split layout ---------- */
.split {
  flex: 1;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  min-height: 0;
}
.pane { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.pane--ai { border-right: none; }

.pane__chrome {
  display: flex; align-items: center; gap: 6px;
  padding: 0.6rem 1rem;
  background: var(--ink-3);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-machine);
  font-size: 0.72rem;
  color: var(--mute);
}
.pane__chrome--ai { justify-content: space-between; }
.pane__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.pane__label { margin-left: 0.75rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane__opennew { color: var(--signal); text-decoration: none; font-size: 0.7rem; }
.pane__opennew:hover { text-decoration: underline; }

.verdict {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--ink);
  border: 1px solid var(--line);
}
.verdict.low { color: var(--alert); border-color: var(--alert); }
.verdict.mixed { color: var(--warn); border-color: var(--warn); }
.verdict.high { color: var(--good); border-color: var(--good); }

.pane__body { flex: 1; position: relative; overflow: hidden; background: #fff; }
.pane--human .pane__body { min-height: 0; }
#siteFrame { width: 100%; height: 100%; border: none; display: block; }

.frame-fallback {
  position: absolute; inset: 0;
  background: var(--ink-2);
  color: var(--mute);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 2rem; font-family: var(--font-ui);
}
.frame-fallback__sub { font-size: 0.85rem; max-width: 32ch; }

.pane__caption {
  font-family: var(--font-machine);
  font-size: 0.68rem;
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--line);
  margin: 0;
}

/* ---------- AI tabs + output ---------- */
.tabs {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}
.tab {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  background: var(--ink-2);
  color: var(--mute);
  border: 1px solid var(--line);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--signal); color: var(--ink); border-color: var(--signal); font-weight: 600; }

.pane__body--ai { background: var(--ink-2); padding: 1.25rem; overflow-y: auto; }
.ai-placeholder { color: var(--mute); font-family: var(--font-machine); font-size: 0.85rem; }

.ai-line {
  display: flex; gap: 0.6rem;
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 1rem;
  opacity: 0;
  transform: translateY(6px);
  animation: aiIn 0.4s var(--ease) forwards;
}
@keyframes aiIn { to { opacity: 1; transform: translateY(0); } }
.ai-line__icon { flex-shrink: 0; font-family: var(--font-machine); }
.ai-line.ok .ai-line__icon { color: var(--good); }
.ai-line.bad .ai-line__icon { color: var(--alert); }
.ai-line.warn .ai-line__icon { color: var(--warn); }
.ai-line__text { color: var(--text); }
.ai-line__text strong { color: var(--signal); font-weight: 600; }

.ai-quote {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--line);
  font-family: var(--font-hook);
  font-style: italic;
  color: var(--human);
  font-size: 1.05rem;
  line-height: 1.5;
}

/* ---------- Bottom / CTA ---------- */
.bottom {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.75rem;
  border-top: 1px solid var(--line);
  background: var(--ink-2);
}
.bottom__line { font-family: var(--font-hook); font-style: italic; color: var(--human); margin: 0; font-size: 1rem; }
.cta {
  font-family: var(--font-ui); font-weight: 600; font-size: 0.9rem;
  background: var(--signal); color: var(--ink);
  padding: 0.7rem 1.4rem; border-radius: 999px; text-decoration: none;
  transition: transform 0.2s var(--ease);
}
.cta:hover, .cta:focus-visible { transform: translateY(-2px); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .pane { border-right: none; border-bottom: 1px solid var(--line); min-height: 420px; }
  .bottom { flex-direction: column; gap: 0.75rem; text-align: center; }
}
