:root {
  --bg: #090a10;
  --panel: rgba(255, 255, 255, 0.055);
  --panel-strong: rgba(255, 255, 255, 0.085);
  --line: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --muted: #b8c0ce;
  --cyan: #00d4ff;
  --pink: #ff3fd7;
  --green: #31e68a;
  --warning: #ffcc66;
  --error: #ff7a8a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: var(--bg);
}

body.is-locked {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.background-animation {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 22% 18%, rgba(0, 212, 255, 0.24), transparent 34%),
    radial-gradient(circle at 78% 8%, rgba(255, 63, 215, 0.2), transparent 30%),
    linear-gradient(135deg, #0f1028 0%, #111827 44%, #071729 100%);
  background-size: 160% 160%;
  animation: bgShift 16s ease-in-out infinite;
}

@keyframes bgShift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.container {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 0 20px;
}

.access-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(18px);
}

.access-card {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid rgba(0, 212, 255, 0.28);
  border-radius: 8px;
  background: rgba(11, 15, 26, 0.96);
  box-shadow: var(--shadow);
}

.access-note {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.7;
}

.access-card .play-button {
  margin-top: 16px;
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 16px 0;
  background: rgba(0, 0, 0, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.logo {
  color: transparent;
  background: linear-gradient(45deg, var(--cyan), var(--pink), var(--green));
  -webkit-background-clip: text;
  background-clip: text;
  font-size: 28px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-link {
  padding: 9px 14px;
  border-radius: 999px;
  color: #eef5ff;
  text-decoration: none;
  transition: background 180ms ease, transform 180ms ease, color 180ms ease;
}

.nav-link:hover {
  color: var(--cyan);
  background: rgba(0, 212, 255, 0.14);
  transform: translateY(-1px);
}

.main-content {
  padding: 52px 0 70px;
}

.hero-section {
  margin-bottom: 34px;
  text-align: center;
}

.hero-title {
  margin: 0 0 14px;
  color: transparent;
  background: linear-gradient(45deg, var(--cyan), var(--pink), var(--green));
  -webkit-background-clip: text;
  background-clip: text;
  font-size: clamp(38px, 7vw, 66px);
  font-weight: 900;
  letter-spacing: 0;
}

.hero-subtitle {
  margin: 0 auto 26px;
  color: var(--muted);
  font-size: clamp(16px, 2.3vw, 21px);
  line-height: 1.7;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  width: min(900px, 100%);
  margin: 0 auto 22px;
}

.stat-item,
.parser-card,
.search-card,
.result-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.stat-item {
  min-height: 108px;
  padding: 20px 12px;
  border-radius: 8px;
}

.stat-number {
  margin-bottom: 8px;
  color: var(--cyan);
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 900;
}

.stat-label {
  color: var(--muted);
  font-size: 14px;
}

.supported-sites {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.supported-sites span,
.quick-tags button,
.line-button,
.source-link,
.meta-row span,
.tag-row span {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
}

.supported-sites span {
  padding: 8px 13px;
  color: #dfe7f2;
  font-size: 13px;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
}

.parser-card,
.search-card {
  border-radius: 8px;
  padding: clamp(18px, 3vw, 34px);
}

.section-title {
  margin-bottom: 20px;
}

.section-title span {
  display: block;
  margin-bottom: 7px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.section-title h2 {
  margin: 0;
  font-size: 25px;
}

.input-group {
  margin-bottom: 22px;
}

.input-label {
  display: block;
  margin-bottom: 10px;
  color: var(--cyan);
  font-weight: 700;
}

.url-input,
select {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  outline: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.url-input:focus,
select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.24);
}

.url-input::placeholder {
  color: #8d96a8;
}

.parser-head,
.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.line-button,
.quick-tags button,
.source-link {
  min-height: 34px;
  padding: 0 12px;
  color: #dce8f7;
  cursor: pointer;
  text-decoration: none;
}

.line-button {
  min-width: 82px;
}

.line-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.parser-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  max-height: 326px;
  margin-bottom: 22px;
  overflow: auto;
  padding-right: 2px;
}

.parser-option {
  position: relative;
  min-width: 0;
  cursor: pointer;
  user-select: none;
}

.parser-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.parser-label {
  display: block;
  min-height: 74px;
  padding: 13px 14px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.parser-label strong,
.parser-label small {
  display: block;
  overflow-wrap: anywhere;
}

.parser-label strong {
  margin-bottom: 5px;
}

.parser-label small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.parser-radio:checked + .parser-label {
  color: var(--cyan);
  border-color: var(--cyan);
  background: linear-gradient(45deg, rgba(0, 212, 255, 0.17), rgba(255, 63, 215, 0.13));
  box-shadow: 0 10px 24px rgba(0, 212, 255, 0.16);
}

.parser-label:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 212, 255, 0.62);
}

.play-button,
.result-play,
.search-button {
  border: 0;
  color: #fff;
  background: linear-gradient(45deg, var(--cyan), var(--pink));
  cursor: pointer;
  font-weight: 800;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.play-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  border-radius: 8px;
  font-size: 18px;
}

.play-button:hover,
.result-play:hover,
.search-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 212, 255, 0.24);
}

.play-dot {
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid currentColor;
}

.parse-info {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid rgba(0, 212, 255, 0.34);
  border-radius: 8px;
  color: var(--cyan);
  background: rgba(0, 212, 255, 0.1);
  text-align: center;
}

.parse-info.error,
.message.error {
  color: var(--error);
}

.video-container {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 320px;
  overflow: hidden;
  border: 2px solid rgba(0, 212, 255, 0.28);
  border-radius: 8px;
  background: #000;
}

.video-container iframe,
.video-container video {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 14px;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.play-symbol {
  position: relative;
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}

.play-symbol::after {
  content: "";
  position: absolute;
  top: 21px;
  left: 28px;
  width: 0;
  height: 0;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-left: 20px solid var(--cyan);
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  gap: 10px;
}

.search-button {
  position: relative;
  min-height: 50px;
  border-radius: 8px;
}

.search-button::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  transform: translate(-2px, -2px);
}

.search-button::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 3px;
  border-radius: 99px;
  background: #fff;
  transform: translate(10px, 10px) rotate(45deg);
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 14px 0;
}

.quick-tags button {
  transition: color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.quick-tags button:hover,
.line-button:hover,
.source-link:hover {
  color: var(--cyan);
  border-color: rgba(0, 212, 255, 0.5);
  transform: translateY(-1px);
}

.message {
  min-height: 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.search-summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 20px;
  padding: 18px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.search-summary span {
  color: var(--cyan);
  font-size: 34px;
  font-weight: 900;
}

.results-section {
  margin-top: 34px;
}

.results-toolbar {
  margin-bottom: 18px;
}

.results-toolbar select {
  max-width: 150px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.result-card {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  min-height: 218px;
  overflow: hidden;
  border-radius: 8px;
}

.poster-wrap {
  position: relative;
  min-height: 218px;
  background: linear-gradient(145deg, rgba(0, 212, 255, 0.15), rgba(255, 63, 215, 0.09));
}

.poster-wrap img,
.poster-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.poster-wrap img {
  object-fit: cover;
}

.poster-wrap img[src=""],
.poster-wrap img:not([src]) {
  display: none;
}

.poster-fallback {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.32);
  font-size: 34px;
  font-weight: 900;
}

.result-body {
  display: grid;
  gap: 10px;
  padding: 14px;
  min-width: 0;
}

.meta-row,
.tag-row,
.episode-row,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.meta-row span,
.tag-row span {
  padding: 4px 8px;
  color: var(--muted);
  font-size: 12px;
}

.meta-row .type {
  color: var(--cyan);
  background: rgba(0, 212, 255, 0.13);
}

.result-body h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.summary {
  display: -webkit-box;
  min-height: 62px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.card-actions {
  align-self: end;
}

.episode-row {
  max-height: 98px;
  overflow: auto;
  padding-right: 2px;
}

.episode-button {
  min-width: 38px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 8px;
  color: #dce8f7;
  background: rgba(0, 212, 255, 0.08);
  cursor: pointer;
  font-size: 12px;
}

.episode-button:hover {
  color: var(--cyan);
  border-color: var(--cyan);
  transform: translateY(-1px);
}

.result-play,
.source-link {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
  text-decoration: none;
}

.empty-results {
  grid-column: 1 / -1;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 1060px) {
  .workbench {
    grid-template-columns: 1fr;
  }

  .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .header-content,
  .parser-head,
  .results-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
  }

  .main-content {
    padding-top: 34px;
  }

  .hero-stats,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .parser-selector {
    grid-template-columns: 1fr;
    max-height: 420px;
  }

  .video-container {
    min-height: 230px;
  }

  .result-card {
    grid-template-columns: 110px minmax(0, 1fr);
  }

  .poster-wrap {
    min-height: 206px;
  }
}

@media (max-width: 440px) {
  .container {
    padding: 0 14px;
  }

  .result-card {
    grid-template-columns: 1fr;
  }

  .poster-wrap {
    aspect-ratio: 2 / 3;
    min-height: auto;
  }
}
