*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-base: #0a0d18;
  --bg-elev: #11151f;
  --surface: rgba(20, 24, 38, 0.65);
  --surface-strong: rgba(28, 33, 50, 0.85);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #ecedf5;
  --text-muted: #8a90a6;
  --text-faint: #5d6379;
  --accent: #00a1d6;
  --accent-strong: #38c0ee;
  --accent-glow: rgba(0, 161, 214, 0.35);
  --pink: #fb7299;
  --pink-glow: rgba(251, 114, 153, 0.3);
  --success: #6ad17c;
  --success-bg: rgba(106, 209, 124, 0.12);
  --success-border: rgba(106, 209, 124, 0.4);
  --warn: #d4b169;
  --warn-bg: rgba(212, 177, 105, 0.1);
  --warn-border: rgba(212, 177, 105, 0.3);
  --danger: #f06b6b;
}

html, body {
  background: var(--bg-base);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.bg-gradient {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse 60% 50% at 15% 8%, rgba(0, 161, 214, 0.18) 0, transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 90%, rgba(251, 114, 153, 0.14) 0, transparent 60%),
    radial-gradient(ellipse 80% 60% at 50% 50%, rgba(80, 50, 200, 0.06) 0, transparent 70%),
    var(--bg-base);
}

.bg-grain {
  position: fixed; inset: 0; z-index: -1;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='3'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 72px 24px 48px;
}

.hero {
  text-align: center;
  margin-bottom: 40px;
  animation: fade-down 0.6s ease both;
}

.logo-mark {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 52px; height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--pink));
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.02em;
  margin-bottom: 20px;
  box-shadow:
    0 8px 24px var(--accent-glow),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

.hero h1 {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}
.hero h1 .accent {
  background: linear-gradient(135deg, var(--accent-strong), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.subtitle {
  color: var(--text-muted);
  margin-top: 14px;
  font-size: 15px;
}

.search-card {
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  box-shadow:
    0 24px 60px -20px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: fade-up 0.6s 0.05s ease both;
}

.search-row { display: flex; gap: 10px; }

.search-row input {
  flex: 1;
  min-width: 0;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
.search-row input::placeholder { color: var(--text-faint); }
.search-row input:focus {
  border-color: rgba(0, 161, 214, 0.5);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px rgba(0, 161, 214, 0.08);
}

.search-row button {
  padding: 0 26px;
  background: linear-gradient(135deg, var(--accent) 0%, #007cb8 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s, opacity 0.2s;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 124, 184, 0.35);
}
.search-row button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px var(--accent-glow);
}
.search-row button:active:not(:disabled) { transform: translateY(0); }
.search-row button:disabled { opacity: 0.55; cursor: wait; }

.hint {
  color: var(--text-muted);
  font-size: 13px;
  padding: 10px 6px 2px;
  min-height: 20px;
  transition: color 0.2s;
}
.hint.error { color: var(--danger); }
.hint.success { color: var(--success); }

#result {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow:
    0 18px 50px -20px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: fade-up 0.4s ease both;
}

.video-header {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}
.video-cover {
  width: 168px;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.video-meta { flex: 1; min-width: 0; }
.video-meta h2 {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.video-meta .owner {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 8px;
}
.video-meta .badges {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  font-weight: 500;
}
.badge.accent {
  color: var(--accent-strong);
  border-color: rgba(0, 161, 214, 0.35);
  background: rgba(0, 161, 214, 0.08);
}
.badge.pink {
  color: var(--pink);
  border-color: rgba(251, 114, 153, 0.35);
  background: rgba(251, 114, 153, 0.08);
}

.section-title {
  font-size: 12px;
  color: var(--text-muted);
  margin: 22px 0 10px;
  padding: 0 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}
.list::-webkit-scrollbar { width: 6px; }
.list::-webkit-scrollbar-track { background: transparent; }
.list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.list::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid transparent;
  border-radius: 10px;
  transition: background 0.15s, border-color 0.15s;
}
.item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.item .num {
  font-size: 12px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 32px;
  letter-spacing: 0.02em;
}

.item .item-body { flex: 1; min-width: 0; }
.item .item-title {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.item .item-url {
  font-size: 11px;
  color: var(--text-faint);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 4px;
  display: none;
}
.item.parsed .item-url { display: block; }

.copy-btn {
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  font-weight: 500;
  min-width: 96px;
  text-align: center;
}
.copy-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: rgba(0, 161, 214, 0.06);
}
.copy-btn:active:not(:disabled) { transform: scale(0.97); }
.copy-btn:disabled { cursor: wait; opacity: 0.7; }

.copy-btn.just-copied {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}
.copy-btn.just-copied:hover {
  background: rgba(106, 209, 124, 0.18);
  border-color: var(--success-border);
  color: var(--success);
}

.copy-btn.previously-copied {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn);
}
.copy-btn.previously-copied:hover {
  background: rgba(212, 177, 105, 0.16);
  border-color: var(--warn-border);
  color: var(--warn);
}

.copy-btn.error {
  background: rgba(240, 107, 107, 0.1);
  border-color: rgba(240, 107, 107, 0.4);
  color: var(--danger);
}

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
  font-size: 14px;
}

.footer {
  text-align: center;
  padding: 24px 16px 36px;
  color: var(--text-faint);
  font-size: 12px;
}
.footer a {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--border-strong);
  margin-left: 4px;
  transition: color 0.18s;
}
.footer a:hover { color: var(--accent-strong); border-color: var(--accent); }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 560px) {
  .container { padding: 48px 16px 32px; }
  .hero h1 { font-size: 34px; }
  .search-row { flex-direction: column; }
  .search-row button { padding: 13px; }
  .video-header { flex-direction: column; gap: 14px; }
  .video-cover { width: 100%; }
  .item { flex-wrap: wrap; }
  .copy-btn { min-width: 0; flex: 1; }
}
