*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --glass-blur: 26px;
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --font: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --glass-bg: rgba(30, 30, 30, 0.4);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 40px rgba(0, 0, 0, 0.35),
                   0 1px 0 rgba(255, 255, 255, 0.04) inset,
                   0 -1px 0 rgba(255, 255, 255, 0.02) inset;
  --accent: #888;
  --accent-hover: #aaa;
  --accent-light: rgba(255, 255, 255, 0.06);
  --accent-fg: #1a1a1a;
  --text: #fff;
  --text-secondary: #bbb;
  --text-muted: #888;
  --body-bg: #0a0a0a;
  --body-gradient-1: rgba(80, 110, 180, 0.28);
  --body-gradient-2: rgba(130, 90, 170, 0.25);
  --body-gradient-3: rgba(70, 130, 110, 0.23);
  --input-bg: rgba(255, 255, 255, 0.04);
  --input-border: rgba(255, 255, 255, 0.06);
  --input-focus-bg: rgba(255, 255, 255, 0.08);
  --input-focus-border: rgba(255, 255, 255, 0.12);
  --btn-secondary-bg: rgba(255, 255, 255, 0.04);
  --btn-secondary-border: rgba(255, 255, 255, 0.08);
  --btn-secondary-hover-bg: rgba(255, 255, 255, 0.08);
  --error-bg: rgba(255, 70, 70, 0.12);
  --error-border: rgba(255, 70, 70, 0.2);
  --error-text: #fc8181;
  --card-focus-border: rgba(255, 255, 255, 0.14);
  --card-focus-shadow: 0 16px 48px rgba(0, 0, 0, 0.4),
                       0 1px 0 rgba(255, 255, 255, 0.04) inset,
                       0 -1px 0 rgba(255, 255, 255, 0.02) inset;
  --glass-reflection: rgba(255, 255, 255, 0.08);
  --glass-bottom-shadow: rgba(255, 255, 255, 0.03);
}

html { font-size: 18px; }

body {
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse 70% 50% at 20% 30%, var(--body-gradient-1) 0%, transparent 60%),
    radial-gradient(ellipse 60% 55% at 80% 65%, var(--body-gradient-2) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 80%, var(--body-gradient-3) 0%, transparent 55%),
    var(--body-bg);
}

.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
}

.header { text-align: center; margin-bottom: 32px; }

h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.logo-img { vertical-align: -5px; margin-right: 8px; border-radius: 4px; }

.intro { font-size: 16px; color: var(--text-secondary); }

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--glass-shadow);
  transition: box-shadow 0.3s var(--ease-out), border-color 0.3s var(--ease-out), background 0.4s var(--ease-out);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: "";
  position: absolute;
  bottom: 0; left: 12px; right: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--glass-bottom-shadow) 30%, var(--glass-bottom-shadow) 50%, var(--glass-bottom-shadow) 70%, transparent 100%);
  pointer-events: none;
  z-index: 2;
}

.glass-card::after {
  content: "";
  position: absolute;
  top: 0; left: 12px; right: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--glass-reflection) 25%, var(--glass-reflection) 50%, var(--glass-reflection) 75%, transparent 100%);
  pointer-events: none;
  z-index: 2;
}

.glass-card:focus-within {
  box-shadow: var(--card-focus-shadow);
  border-color: var(--card-focus-border);
}

.url-field {
  display: flex;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.url-field input {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.url-field input::placeholder { color: var(--text-muted); }

.url-field input:focus {
  background: var(--input-focus-bg);
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.url-field input:disabled { opacity: 0.35; cursor: not-allowed; }

.url-field button {
  flex-shrink: 0;
  padding: 12px 24px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
  transition: background 0.2s, transform 0.15s var(--ease-spring), box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--glass-shadow);
}

.url-field button:hover:not(:disabled) {
  background: rgba(255,255,255,.08);
  border-color: var(--input-focus-border);
  transform: translateY(-1px);
}

.url-field button:active:not(:disabled) { transform: scale(0.96); }

.url-field button:disabled { opacity: 0.3; cursor: not-allowed; box-shadow: none; }

.spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(128,128,128,.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .55s linear infinite;
  display: none;
}

.spinner.active { display: inline-block; }

@keyframes spin { to { transform: rotate(360deg); } }

.hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  position: relative;
  z-index: 1;
}

.error-msg {
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: none;
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
  position: relative;
  z-index: 1;
}

.error-msg.warning {
  background: rgba(250, 204, 21, 0.14);
  border-color: rgba(250, 204, 21, 0.55);
  color: #fde68a;
}

.error-msg.warning a {
  color: #fff7cc;
}

.error-msg a {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.video-meta {
  display: block;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.video-title {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.video-desc {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
#resultCard { margin-top: 20px; }

.player-wrap {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  box-shadow: 0 2px 12px rgba(0,0,0,.1);
  position: relative;
  z-index: 1;
}

.player-wrap video {
  display: block;
  width: 100%;
  outline: none;
  max-height: 420px;
}

.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  position: relative;
  z-index: 1;
}

.result-actions a,
.result-actions button {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform .15s var(--ease-spring), box-shadow .2s, background .2s;
}

.result-actions a:active,
.result-actions button:active { transform: scale(0.96); }

.btn-primary,
.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--text);
  border: 1px solid var(--btn-secondary-border);
}

.btn-primary:hover,
.btn-secondary:hover { background: var(--btn-secondary-hover-bg); }

.footer {
  margin-top: 28px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color .2s;
}

.footer a:hover { color: var(--text); }

@media (max-width: 480px) {
  body { padding: 20px 14px; align-items: flex-start; padding-top: 60px; }
  h1 { font-size: 24px; }
  .glass-card { padding: 16px; border-radius: var(--radius-md); }
  .url-field { flex-direction: column; }
  .url-field button { justify-content: center; }
  .result-actions { flex-direction: column; }
}
