:root {
  --bg: #0b0d12;
  --bg-soft: #11141c;
  --card: #151926;
  --card-hi: #1b2032;
  --line: #262c3f;
  --txt: #e8ebf2;
  --muted: #949cb3;
  --accent: #6ee7b7;
  --accent-2: #60a5fa;
  --danger: #f87171;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(60rem 30rem at 15% -10%, rgba(96, 165, 250, .16), transparent 60%),
    radial-gradient(50rem 28rem at 90% 0%, rgba(110, 231, 183, .12), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 940px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

/* ── Header ─────────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -.01em;
  text-decoration: none;
  color: var(--txt);
}
.brand .dot {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  color: #0b0d12; font-size: 15px; font-weight: 900;
}

.hero { text-align: center; padding: 54px 0 30px; }
.hero h1 {
  font-size: clamp(30px, 5.5vw, 46px);
  line-height: 1.12;
  margin: 0 0 14px;
  letter-spacing: -.03em;
}
.hero h1 span {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  color: var(--muted);
  font-size: 17px;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Form ───────────────────────────────────────────── */
.panel {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 20px 50px -30px rgba(0, 0, 0, .9);
}

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

input[type="text"] {
  flex: 1 1 320px;
  min-width: 0;
  background: #0d101a;
  border: 1px solid var(--line);
  color: var(--txt);
  border-radius: 11px;
  padding: 14px 16px;
  font-size: 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, .18);
}
input::placeholder { color: #5d647a; }

button, .btn {
  border: 1px solid var(--line);
  background: var(--card-hi);
  color: var(--txt);
  border-radius: 11px;
  padding: 13px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: transform .12s, background .15s, border-color .15s;
  font-family: inherit;
}
button:hover, .btn:hover { background: #232941; transform: translateY(-1px); }
button:active, .btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #08101a;
  font-weight: 700;
}
.btn-primary:hover { background: linear-gradient(100deg, #7ff0c3, #7ab4fb); }

/* ── Mode tabs ──────────────────────────────────────── */
.tabs {
  display: inline-flex;
  gap: 4px;
  background: #0d101a;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 16px;
}
.tab {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
}
.tab:hover { background: #171c2b; transform: none; }
.tab.on {
  background: var(--card-hi);
  color: var(--txt);
  box-shadow: inset 0 0 0 1px var(--line);
}
.tab.on.ig { color: #f0a8d0; }
.tab.on.md { color: var(--accent); }
.tab.on.xt { color: #cfd6e4; }
.tab.on.rd { color: #fbbf24; }

body.ig { --accent: #f472b6; --accent-2: #a78bfa; }
body.xt { --accent: #cfd6e4; --accent-2: #7cc0ff; }
body.rd { --accent: #fbbf24; --accent-2: #fb7185; }

.hint { color: var(--muted); font-size: 13px; margin: 14px 2px 0; }
.hint code {
  background: #0d101a;
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--accent);
  font-size: 12px;
}
.error {
  color: var(--danger);
  font-size: 14px;
  margin: 12px 2px 0;
  display: none;
}
.error.show { display: block; }

/* ── Steps ──────────────────────────────────────────── */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 34px;
}
.step {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.step b { display: block; margin-bottom: 6px; font-size: 15px; }
.step p { color: var(--muted); font-size: 13.5px; margin: 0; line-height: 1.55; }
.step .num {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: .12em;
  margin-bottom: 10px;
  display: block;
}

/* ── Results ────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.summary { margin-bottom: 18px; }
.summary .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.summary .slug {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 17px;
  color: var(--accent);
  word-break: break-all;
  margin-top: 6px;
  display: block;
}

.meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; }
.meta div { font-size: 13px; color: var(--muted); }
.meta b { color: var(--txt); display: block; font-size: 15px; margin-top: 2px; }

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 22px 0 14px;
}
.toolbar input[type="text"] { flex: 1 1 220px; padding: 11px 14px; font-size: 14px; }
.toolbar button { padding: 11px 14px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12.5px;
  cursor: pointer;
  font-weight: 600;
}
.chip:hover { background: var(--card-hi); color: var(--txt); }
.chip.on {
  background: rgba(110, 231, 183, .12);
  border-color: var(--accent);
  color: var(--accent);
}

.list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-soft);
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; }
.row:hover { background: var(--card); }
.row .info { flex: 1 1 auto; min-width: 0; }
.row .pubname { font-size: 14.5px; font-weight: 600; }
a.titlelink {
  color: var(--txt);
  text-decoration: none;
  display: inline-block;
}
a.titlelink:hover { color: var(--accent); text-decoration: underline; }
.row .url {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  margin-top: 3px;
}
.row .acts { display: flex; gap: 8px; flex: 0 0 auto; }
.row .acts button, .row .acts a {
  padding: 8px 11px;
  font-size: 12.5px;
  border-radius: 9px;
}
.tag {
  font-size: 10.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 8px;
  vertical-align: middle;
  white-space: nowrap;
}

.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ── Saved requests ─────────────────────────────────── */
.saved { margin-top: 30px; }
.saved-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.saved-head h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin: 0;
  font-weight: 700;
}
.linkbtn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12.5px;
  padding: 4px 6px;
  cursor: pointer;
  text-decoration: underline;
}
.linkbtn:hover { color: var(--danger); background: none; transform: none; }

.saved .row { padding: 11px 14px; }
.saved .row .pubname { font-size: 14px; }
.saved .icon { margin-right: 8px; font-size: 14px; }
.saved .when { color: #6b7288; font-size: 12px; margin-left: 8px; white-space: nowrap; }
.saved .del {
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
}
.saved .del:hover { color: var(--danger); }
.saved a.rowlink { text-decoration: none; color: inherit; flex: 1 1 auto; min-width: 0; }

pre.xml {
  background: #0d101a;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 26px;
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: #b8c0d4;
  white-space: pre;
}

.foot {
  margin-top: 34px;
  color: #6b7288;
  font-size: 12.5px;
  text-align: center;
  line-height: 1.6;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  background: var(--accent);
  color: #08101a;
  font-weight: 700;
  font-size: 13.5px;
  padding: 11px 18px;
  border-radius: 11px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .row { flex-wrap: wrap; }
  .row .acts { width: 100%; }
  .row .acts button, .row .acts a { flex: 1; justify-content: center; }
}
