:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c2330;
  --border: #2d3644;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #4f8cff;
  --accent-hover: #6ba1ff;
  --danger: #ff6b6b;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.brand .logo { font-size: 28px; }
.brand h1 {
  font-size: 22px;
  margin: 0;
  letter-spacing: -0.02em;
}
.brand h1 span { color: var(--accent); }

.tagline {
  color: var(--muted);
  margin: 0 0 32px;
  font-size: 15px;
  line-height: 1.5;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 14px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.6;
  outline: none;
}
textarea:focus { border-color: var(--accent); }
textarea::placeholder { color: #9aa8ba; }

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.stats {
  color: var(--muted);
  font-size: 13.5px;
  margin-left: auto;
}
.stats strong { color: var(--text); }

button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 11px 18px;
  font-size: 14.5px;
  font-weight: 600;
  transition: background 0.15s, transform 0.05s;
}
button:active { transform: translateY(1px); }

.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

.btn-big {
  font-size: 17px;
  padding: 15px 28px;
  border-radius: 10px;
}

.result-url {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.result-url input, .manual-copy input {
  flex: 1;
  min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 11px 14px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  outline: none;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-url input:focus { border-color: var(--accent); }
.manual-copy { display: block; margin-top: 16px; color: var(--text); font-size: 14px; line-height: 1.5; }
.manual-copy input { display: block; width: 100%; margin-top: 8px; }

.hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
  line-height: 1.5;
}

.error {
  color: var(--danger);
  font-size: 13.5px;
  margin-top: 10px;
  display: none;
}
.error.show { display: block; }

/* ---------- bundle view ---------- */
.bundle-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.bundle-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.count-pill {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 13px;
}

.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  background: var(--panel);
  transition: border-color 0.15s;
}
.link-list li:hover { border-color: var(--accent); }
.link-list img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  flex-shrink: 0;
}
.link-list .favicon-fallback {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--muted);
}
.link-list a {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link-list a:hover { color: var(--accent); text-decoration: underline; }
.link-list .host {
  color: var(--muted);
  font-size: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

.center-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 28px 0;
}

.note { color: var(--muted); font-size: 13px; }

.copied-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.copied-toast.show { opacity: 1; }

.bad-link {
  color: var(--muted);
  font-size: 13px;
  padding: 40px 0;
  text-align: center;
  line-height: 1.6;
}

/* ---------- footer ---------- */
.site-footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--accent); }
.site-footer a:hover { color: var(--accent-hover); }
.site-footer a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.field-label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
.compatibility-option { display: flex; align-items: center; gap: 8px; margin-top: 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.compatibility-option input { flex-shrink: 0; accent-color: var(--accent); }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
@media (max-width: 480px) {
  .result-url { flex-wrap: wrap; }
  .result-url input { flex-basis: 100%; }
  .link-list li { flex-wrap: wrap; }
  .link-list a { min-width: 0; flex: 1; }
  .link-list .host { max-width: 100%; overflow-wrap: anywhere; }
}
