:root {
  color-scheme: dark;
  --bg: #10120e;
  --ink: #f4f1e6;
  --muted: #a7a48f;
  --line: #34392b;
  --card: #181b14;
  --lime: #dff25a;
  --lime-ink: #161a08;
  --coral: #ff8d6b;
  --track: #2a261f;
  --shadow: 0 24px 60px rgb(0 0 0 / 0.28);
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", "Liberation Serif", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", "Liberation Sans", "Nimbus Sans", sans-serif;
  --mono: "IBM Plex Mono", "Liberation Mono", "DejaVu Sans Mono", ui-monospace, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f3f0e4;
    --ink: #17190f;
    --muted: #5c5f50;
    --line: #ddd4c0;
    --card: #fffdf8;
    --lime: #d6ee4a;
    --lime-ink: #1a1e08;
    --coral: #c2410c;
    --track: #ece4d2;
    --shadow: 0 18px 40px rgb(48 42 16 / 0.08);
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100%;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  background-image:
    radial-gradient(ellipse 70% 45% at 0% -10%, color-mix(in oklab, var(--lime) 22%, transparent), transparent 60%),
    linear-gradient(to right, color-mix(in oklab, var(--ink) 5%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in oklab, var(--ink) 5%, transparent) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px;
}

::selection { background: var(--lime); color: var(--lime-ink); }

:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--lime);
  color: var(--lime-ink);
  padding: 8px 12px;
  z-index: 2;
}

.skip:focus { top: 12px; }

.layout {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 72px;
  display: grid;
  gap: 22px;
}

.span { grid-column: 1 / -1; }

.brand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mark {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.pill {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  color: var(--muted);
}

.pill.has-saved {
  background: var(--lime);
  color: var(--lime-ink);
  border-color: transparent;
  font-weight: 650;
}

h1 {
  margin: 14px 0 0;
  font-family: var(--serif);
  font-size: clamp(2.15rem, 5vw, 3.5rem);
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 0.98;
}

h1::after {
  content: "";
  display: block;
  width: 3.4rem;
  height: 0.38rem;
  margin-top: 0.85rem;
  background: var(--lime);
}

.lede {
  max-width: 38rem;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.bench, .log {
  background: color-mix(in oklab, var(--card) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0;
}

label[for="url"], .kicker {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.field {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: flex-end;
}

textarea {
  flex: 1 1 12rem;
  min-width: 0;
  min-height: 5.2rem;
  resize: vertical;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: color-mix(in oklab, var(--bg) 70%, var(--card));
  color: var(--ink);
  font: 0.92rem/1.45 var(--mono);
  padding: 0.7rem 0.75rem;
}

textarea[aria-invalid="true"] { border-color: var(--coral); }

button, .file {
  font: 600 0.95rem/1 var(--sans);
  border-radius: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.primary {
  min-height: 48px;
  align-self: flex-end;
  background: var(--lime);
  color: var(--lime-ink);
  border-color: transparent;
}

.primary:focus-visible { outline-color: var(--ink); }

button:hover, .file:hover { filter: brightness(1.06); }

.ghost { margin-top: 10px; }

.status:not(:empty) {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: var(--muted);
}

.status.error { color: var(--coral); }

#result { margin-top: 16px; }

.verdict { margin: 0; color: var(--muted); }

.score {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 6px;
}

.score strong {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 560;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score span { color: var(--muted); font-variant-numeric: tabular-nums; }

.meter {
  height: 10px;
  margin: 12px 0;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--lime);
  border-radius: inherit;
  transition: width 180ms ease;
}

.dest { margin: 0 0 8px; color: var(--muted); }

.dest strong { color: var(--ink); font-weight: 700; }

.out {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in oklab, var(--bg) 65%, var(--card));
}

.out a {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.92rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

#copy { flex: 0 0 auto; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.chips li {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--coral);
  background: color-mix(in oklab, var(--coral) 14%, var(--card));
  border-radius: 999px;
  padding: 0.2rem 0.5rem;
}

details { margin-top: 12px; }

summary { cursor: pointer; color: var(--muted); }

#original {
  margin: 8px 0 0;
  font-family: var(--mono);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
  color: var(--muted);
}

.log h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 560;
  letter-spacing: -0.03em;
}

.log-head, .actions, .row1, .meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.log-head { justify-content: space-between; }

.file { position: relative; display: inline-flex; align-items: center; }

.file input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.file:focus-within { outline: 2px solid var(--lime); outline-offset: 2px; }

.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.tiles article {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  min-width: 0;
}

.tiles p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tiles strong {
  display: block;
  margin-top: 4px;
  font-family: var(--serif);
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 560;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.hosts { display: grid; gap: 7px; margin-bottom: 14px; }

.host {
  display: grid;
  grid-template-columns: minmax(0, 7.5rem) 1fr auto;
  gap: 8px;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.75rem;
}

.host > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bar {
  height: 8px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}

.bar span { display: block; height: 100%; background: var(--lime); }

.num { font-variant-numeric: tabular-nums; color: var(--muted); }

.history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.history li {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  min-width: 0;
}

.row1 { justify-content: space-between; }

.hname { font-weight: 700; }

.when, .meta { color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }

.history a {
  display: block;
  margin: 4px 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.texty {
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.empty {
  margin: 8px 0 0;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 16px;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.8fr);
    align-items: start;
    padding-top: 36px;
  }
  .log { position: sticky; top: 16px; }
  .history { max-height: 360px; overflow: auto; }
}

@media (max-width: 560px) {
  .layout { width: min(100% - 24px, 1080px); padding-top: 18px; }
  .field { flex-direction: column; }
  .field button, .ghost { width: 100%; }
  .out { flex-direction: column; }
  #copy { width: 100%; }
  .host { grid-template-columns: minmax(0, 1fr) auto; }
  .bar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
  .meter span { transition: none; }
}
