/* A deliberately early-2010s, YouTube-ish visual language. */
:root {
  --bg: #e9e9e9;
  --panel: #fff;
  --line: #cfcfcf;
  --text: #333;
  --muted: #777;
  --blue: #167ac6;
  --blue-dark: #1266a3;
  --red: #c00;
  --shadow: 0 1px 2px rgba(0,0,0,.12);
  --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.yt-header {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid #c8c8c8;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  max-width: var(--max);
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
}

.yt-logo {
  text-decoration: none;
  color: #222;
  font-size: 22px;
  font-weight: bold;
  white-space: nowrap;
}
.yt-logo > span:last-child > span { color: var(--red); }
.yt-mark {
  display: inline-block;
  color: white;
  background: var(--red);
  font-size: 12px;
  line-height: 22px;
  width: 32px;
  text-align: center;
  border-radius: 4px;
  margin-right: 3px;
  vertical-align: 2px;
}

.search-wrap {
  flex: 1;
  max-width: 600px;
  display: flex;
}
.search-wrap input {
  flex: 1;
  height: 32px;
  border: 1px solid #aaa;
  border-right: 0;
  padding: 0 10px;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.08);
}
.search-wrap button,
.toolbar button {
  border: 1px solid #bbb;
  background: linear-gradient(#fff, #e5e5e5);
  color: #444;
}
.search-wrap button {
  width: 72px;
  font-size: 12px;
}
.header-links {
  margin-left: auto;
  display: flex;
  gap: 14px;
}
.header-links a {
  color: #167ac6;
  text-decoration: none;
}
.header-links a:hover { text-decoration: underline; }

.page-shell {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
  padding: 18px;
}

.sidebar {
  min-width: 0;
}
.side-section {
  border-bottom: 1px solid #c8c8c8;
  padding: 0 0 14px;
  margin-bottom: 14px;
}
.side-title {
  color: #555;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  margin-bottom: 7px;
}
.side-link {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 7px 8px;
  color: #555;
}
.side-link:hover, .side-link.active {
  background: #ddd;
  color: #222;
}
.side-link.active {
  border-left: 3px solid var(--red);
  padding-left: 5px;
  font-weight: bold;
}
.sidebar select {
  width: 100%;
  height: 30px;
  border: 1px solid #bbb;
  background: white;
}
.tiny-note {
  color: #888;
  font-size: 11px;
  line-height: 1.45;
}
.tiny-note p { margin: 6px 0; }

.content { min-width: 0; }

.hero {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 26px 30px 23px;
  margin-bottom: 14px;
}
.hero-kicker, .quiz-kicker {
  color: #999;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: .11em;
}
.hero h1 {
  margin: 7px 0 8px;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.05;
  font-weight: normal;
  letter-spacing: -1px;
}
.hero-copy {
  margin: 0;
  max-width: 690px;
  font-size: 14px;
  line-height: 1.5;
  color: #666;
}
.stats {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid #eee;
  color: #777;
}
.stats strong { color: #333; }

.toolbar {
  min-height: 43px;
  background: #f7f7f7;
  border: 1px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px 5px 12px;
  margin-bottom: 14px;
}
.toolbar-left { color: #888; }
.toolbar-label {
  color: #444;
  font-weight: bold;
  margin-right: 8px;
}
.toolbar-right { display: flex; gap: 4px; }
.toolbar button {
  padding: 6px 10px;
  font-size: 11px;
}
.toolbar button.active {
  background: #ddd;
  border-color: #aaa;
  color: #222;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.08);
}

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

.video-card {
  min-width: 0;
}
.thumb-wrap {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #ccc;
  overflow: hidden;
  border: 1px solid #bbb;
  box-shadow: var(--shadow);
}
.thumb-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.duration {
  position: absolute;
  right: 4px;
  bottom: 4px;
  padding: 2px 4px;
  background: rgba(0,0,0,.82);
  color: #fff;
  font-size: 11px;
}
.video-title {
  display: block;
  margin: 7px 0 3px;
  color: #167ac6;
  text-decoration: none;
  font-size: 14px;
  font-weight: bold;
  line-height: 1.25;
}
.video-title:hover { text-decoration: underline; }
.creator {
  color: #666;
  margin-bottom: 2px;
}
.meta {
  color: #999;
  font-size: 11px;
}
.meta .dot { margin: 0 4px; }
.tag {
  display: inline-block;
  margin-top: 6px;
  border: 1px solid #ddd;
  background: #f7f7f7;
  color: #888;
  padding: 2px 5px;
  font-size: 10px;
}

.no-results {
  background: #fff;
  border: 1px solid #ccc;
  padding: 40px;
  text-align: center;
  color: #777;
}

.archive-end {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-top: 42px;
  padding: 44px 30px;
  text-align: center;
}
.end-line {
  width: 60px;
  height: 1px;
  background: #aaa;
  margin: 0 auto 20px;
}
.end-small {
  font-size: 10px;
  letter-spacing: .12em;
  color: #999;
}
.archive-end h2 {
  font-size: 22px;
  font-weight: normal;
  margin: 9px 0;
}
.archive-end p {
  max-width: 600px;
  margin: 8px auto;
  line-height: 1.5;
  color: #777;
}
.research-note { font-size: 10px; color: #aaa !important; }

.quiz {
  margin: 20px 0 60px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 30px;
  box-shadow: var(--shadow);
}
.quiz h2 {
  font-size: 25px;
  font-weight: normal;
  margin: 6px 0;
}
.quiz > p { color: #777; }

.quiz-question {
  margin: 22px 0;
  border-top: 1px solid #eee;
  padding-top: 18px;
}
.quiz-question h3 {
  font-size: 14px;
  font-weight: bold;
  margin: 0 0 10px;
}
.quiz-option {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid #ccc;
  background: #fafafa;
  margin: 5px 0;
  padding: 9px 10px;
}
.quiz-option:hover {
  background: #eee;
}
.quiz-submit {
  border: 1px solid #aaa;
  background: linear-gradient(#fff, #ddd);
  padding: 9px 15px;
  font-weight: bold;
}
.quiz-result {
  margin-top: 20px;
  border-top: 1px solid #ddd;
  padding-top: 20px;
}
.quiz-result h3 { font-size: 22px; font-weight: normal; margin: 0 0 8px; }
.quiz-result p { color: #666; line-height: 1.5; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  background: #333;
  color: #fff;
  padding: 9px 14px;
  font-size: 12px;
  border-radius: 2px;
  transition: .2s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 850px) {
  .page-shell { grid-template-columns: 1fr; }
  .sidebar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }
  .side-section {
    margin: 0;
    padding: 0 8px 10px 0;
    border-bottom: 0;
  }
  .tiny-note { display: none; }
  .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .yt-header { height: auto; }
  .header-inner { flex-wrap: wrap; padding: 10px 12px; gap: 10px; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
  .header-links { display: none; }
  .page-shell { padding: 10px; }
  .sidebar {
    grid-template-columns: repeat(2, 1fr);
    background: #fff;
    border: 1px solid #ccc;
    padding: 10px;
  }
  .video-grid { grid-template-columns: 1fr; }
  .hero { padding: 20px; }
  .toolbar { align-items: flex-start; gap: 8px; flex-direction: column; }
  .toolbar-right { width: 100%; }
  .toolbar button { flex: 1; }
  .quiz, .archive-end { padding: 24px 18px; }
}
