:root {
  --bg: #0e0f13;
  --surface: #171a21;
  --surface-2: #1f232c;
  --border: #2a2f3a;
  --text: #eef1f6;
  --muted: #98a1b2;
  --accent: #ff3d54;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 12px 20px;
  background: rgba(14, 15, 19, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.brand .mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #7a5cff);
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
}

.brand .name {
  font-size: 0.98rem;
}

@media (max-width: 820px) {
  .brand .name {
    display: none;
  }
}

.search {
  display: flex;
  flex: 1;
  gap: 8px;
  max-width: 640px;
}

.search input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font: inherit;
  outline: none;
}

.search input:focus {
  border-color: var(--accent);
}

.search button {
  padding: 10px 20px;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.search button:disabled {
  opacity: 0.55;
  cursor: progress;
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 56px;
}

.panel {
  margin-bottom: 32px;
}

.player-frame {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

#player {
  display: block;
  width: 100%;
  height: 100%;
}

.meta h1 {
  margin: 18px 0 4px;
  font-size: 1.25rem;
  line-height: 1.3;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.qualities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.qualities button {
  padding: 6px 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.qualities button[aria-pressed="true"] {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.note,
.status {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.status {
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.status.error {
  color: #ffb3bd;
  background: #2a161a;
  border-color: #58222b;
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px 16px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  color: inherit;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}

.card .thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--radius);
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card .duration {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 1px 6px;
  color: #fff;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 4px;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.card h3 {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 0.95rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.card:hover h3 {
  color: var(--accent);
}

.intro {
  max-width: 640px;
  margin: 8vh auto 10vh;
  text-align: center;
}

.intro h1 {
  margin: 0 0 12px;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  letter-spacing: -0.02em;
}

.intro p {
  margin: 0;
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 24px;
}

.chip {
  padding: 7px 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.chip:hover {
  color: #fff;
  border-color: var(--accent);
}

@media (max-width: 640px) {
  .topbar {
    flex-wrap: wrap;
  }

  .search {
    max-width: none;
  }
}
