/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
  --bg:       #f7f8fb;
  --surface:  #ffffff;
  --card:     #ffffff;
  --border:   #e6e9ef;
  --accent:   #5964ff;
  --accent2:  #ff6584;
  --text:     #0b1220;
  --muted:    #6c7280;
  --success:  #16a34a;
  --error:    #d6334a;
  --warn:     #d97706;
  --mono:     'JetBrains Mono', monospace;
  --head:     'Syne', sans-serif;
  --radius:   12px;
  --glow:     0 0 30px rgba(89,100,255,.12);
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--head);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Background grid ────────────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(89,100,255,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(89,100,255,.06) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.wrap {
  position: relative; z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 24px 100px;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.header { text-align: center; }
h1 {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.02em;
  margin-bottom: 5px;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 28px;
  transition: border-color .3s;
}
.card:hover { border-color: rgba(108,99,255,.4); }

/* ── Input row ───────────────────────────────────────────────────────────── */
.input-row {
  display: flex; gap: 12px; align-items: stretch;
  flex-wrap: wrap;
}
.url-input {
  flex: 1; min-width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  font-family: var(--mono); font-size: 13px;
  color: var(--text);
  transition: border-color .25s, box-shadow .25s;
  outline: none;
}
.url-input:focus {
  border-color: var(--accent);
  box-shadow: var(--glow);
}
.url-input::placeholder { color: var(--muted); }

.btn {
  background: var(--accent);
  color: #fff; border: none;
  border-radius: 8px;
  padding: 14px 28px;
  font-family: var(--head); font-size: 14px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  cursor: pointer;
  transition: background .2s, transform .15s, box-shadow .2s;
  white-space: nowrap;
}
.btn:hover  { background: #7b74ff; box-shadow: var(--glow); }
.btn:active { transform: scale(.97); }
.btn:disabled {
  background: var(--border); color: var(--muted);
  cursor: not-allowed; box-shadow: none; transform: none;
}

/* ── Progress ────────────────────────────────────────────────────────────── */
#status-area { display: none; }
.status-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.status-label {
  font-family: var(--mono); font-size: 13px; color: var(--accent);
  letter-spacing: .06em;
}
.progress-bar-wrap {
  background: var(--surface); border-radius: 999px;
  height: 4px; overflow: hidden; margin-bottom: 20px;
}
.progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 999px;
  transition: width .4s ease;
}

/* ── Stats row ────────────────────────────────────────────────────────────── */
.stats {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px; display: none;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  display: flex; flex-direction: column; gap: 2px;
}
.stat-val {
  font-size: 28px; font-weight: 800;
  background: linear-gradient(135deg, #fff, var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-key {
  font-family: var(--mono); font-size: 11px;
  color: var(--muted); text-transform: uppercase; letter-spacing: .1em;
}

/* ── Links table ─────────────────────────────────────────────────────────── */
#links-area { display: none; }
.section-title {
  font-size: 11px; font-family: var(--mono);
  color: var(--muted); text-transform: uppercase;
  letter-spacing: .12em; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.links-list { display: flex; flex-direction: column; gap: 8px; }
.link-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  animation: fadeIn .35s ease both;
  transition: border-color .2s;
}
.link-row:hover { border-color: rgba(108,99,255,.4); }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ep-badge {
  background: rgba(89,100,255,.12);
  color: var(--accent);
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  padding: 3px 9px; border-radius: 999px;
  white-space: nowrap; flex-shrink: 0;
  letter-spacing: .05em;
}
.link-url {
  flex: 1; font-family: var(--mono); font-size: 12px;
  color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-family: var(--mono); font-size: 11px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
  flex-shrink: 0;
}
.copy-btn:hover  { border-color: var(--accent); color: var(--accent); }
.copy-btn.copied { border-color: var(--success); color: var(--success); }

/* ── Bulk copy ────────────────────────────────────────────────────────────── */
.bulk-row {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 20px;
}
.bulk-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text); border-radius: 8px;
  padding: 10px 18px;
  font-family: var(--head); font-size: 12px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.bulk-btn:hover { border-color: var(--accent); background: rgba(108,99,255,.1); }

/* ── Errors ───────────────────────────────────────────────────────────────── */
#errors-area { display: none; margin-top: 20px; }
.error-item {
  display: flex; gap: 10px; align-items: flex-start;
  background: rgba(214,51,74,.06);
  border: 1px solid rgba(214,51,74,.12);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-family: var(--mono); font-size: 12px; color: var(--error);
  line-height: 1.5;
}
.error-item::before { content: '✖'; flex-shrink: 0; margin-top: 1px; }

/* ── Fatal error ──────────────────────────────────────────────────────────── */
.fatal {
  background: rgba(214,51,74,.08);
  border: 1px solid rgba(214,51,74,.16);
  border-radius: 8px;
  padding: 16px 20px;
  font-family: var(--mono); font-size: 13px; color: var(--error);
  display: none;
}


.history-link {
	background: #eee;
	border: 2px solid var(--border);
	border-radius: 8px;
	padding: 12px 16px;
	animation: fadeIn 1s ease both;
	margin-top: 5px;
	margin-bottom: 5px;
	cursor: pointer;
}

.history-link:hover {
	border-color: rgba(108,99,255,.4);
}