:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --text: #1f2a37;
  --muted: #5f6b7a;
  --line: #d7dee8;
  --accent: #005bac;
  --accent-dark: #004386;
  --accent-soft: #e8f1fb;
  --warning-bg: #fff7e6;
  --warning-line: #f0c36a;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-dark);
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.notice {
  margin: 0;
  padding: 10px 0;
  color: #604000;
  font-weight: 700;
}

.hero {
  padding: 30px 0 34px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.2;
  letter-spacing: 0;
}

.lead {
  max-width: 720px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.inline-notice {
  margin: 24px 0 12px;
  border: 1px solid #d9c27a;
  border-radius: 8px;
  background: #fffaf0;
  color: #604000;
  font-weight: 700;
  padding: 12px 14px;
}

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px) auto;
  gap: 18px;
  align-items: end;
  margin: 0 0 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}

.clear-button {
  min-height: 48px;
  border: 1px solid #aeb9c8;
  border-radius: 6px;
  background: #ffffff;
  color: #123b66;
  font: inherit;
  font-weight: 700;
  padding: 10px 14px;
  cursor: pointer;
}

.clear-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.popular-tags {
  margin: 0 0 26px;
  padding: 16px 0 4px;
  border-bottom: 1px solid var(--line);
}

.popular-tags h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.popular-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.popular-tag-button {
  min-height: 38px;
  border: 1px solid #bfd0e5;
  border-radius: 999px;
  background: #ffffff;
  color: #123b66;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
}

.popular-tag-button:hover,
.popular-tag-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #aeb9c8;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
}

input:focus,
select:focus {
  outline: 3px solid #b8d8ff;
  outline-offset: 2px;
  border-color: var(--accent);
}

.results-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--line);
}

.results-header h2 {
  margin: 0 0 12px;
  font-size: 1.4rem;
}

.results-header p {
  margin: 0 0 12px;
  color: #123b66;
  font-weight: 700;
  background: var(--accent-soft);
  border: 1px solid #bfd0e5;
  border-radius: 999px;
  padding: 4px 12px;
}

.video-list {
  display: grid;
  gap: 16px;
  margin-bottom: 48px;
}

.video-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 16px 18px;
}

.video-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.video-card h3 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  line-height: 1.52;
}

.channel {
  margin: 0 0 10px;
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid #bfd0e5;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #123b66;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 3px 10px;
}

.tag-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.tag-secondary {
  border-color: #ccd7e5;
  background: #f3f6fa;
  color: #4f5f71;
  font-weight: 600;
}

.tag-muted {
  border-color: #d8e0ea;
  background: #f8fafc;
  color: #667789;
  font-weight: 600;
}

.video-footer {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-top: auto;
  padding-top: 10px;
}

.duration {
  color: var(--muted);
  font-weight: 700;
}

.youtube-link {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
  min-height: 44px;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  padding: 9px 16px;
}

.youtube-link:hover {
  background: var(--accent-dark);
  color: #ffffff;
}

.empty,
.error-message {
  border: 1px solid var(--warning-line);
  border-radius: 8px;
  background: var(--warning-bg);
  padding: 18px;
}

.error-message {
  color: var(--danger);
  font-weight: 700;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--muted);
  padding: 28px 0;
}

.site-footer p {
  margin: 0 0 8px;
}

@media (max-width: 720px) {
  .container {
    width: min(100% - 24px, 1120px);
  }

  .hero {
    padding: 24px 0 28px;
  }

  .controls {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .clear-button {
    width: 100%;
  }

  .popular-tags {
    margin-bottom: 22px;
  }

  .results-header {
    display: block;
  }

  .results-header p {
    display: inline-block;
  }

  .video-footer {
    display: block;
  }

  .youtube-link {
    width: 100%;
    margin-top: 12px;
    margin-left: 0;
  }
}
