:root {
  --red: #ed2636;
  --red-dark: #c91729;
  --navy: #202936;
  --navy-deep: #17202b;
  --ink: #26313e;
  --muted: #718096;
  --line: #dfe5ec;
  --surface: #ffffff;
  --canvas: #f2f4f7;
  --success: #16845b;
  --warning: #9b6500;
  --danger: #b4233a;
  --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; }
img { max-width: 100%; }
a { color: inherit; }
button, input, select { font: inherit; }
button, summary { cursor: pointer; }
form { margin: 0; }

.button,
button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 19px;
  border: 1px solid var(--red);
  border-radius: 8px;
  color: #fff;
  background: var(--red);
  box-shadow: 0 7px 20px rgba(237, 38, 54, .18);
  font-weight: 750;
  text-decoration: none;
}

.button:hover { background: var(--red-dark); border-color: var(--red-dark); }
.button.small { min-height: 38px; padding: 0 15px; }
.button.outline { border-color: rgba(255,255,255,.6); background: transparent; box-shadow: none; }
.button.secondary { color: var(--ink); border-color: var(--line); background: var(--surface); box-shadow: none; }
.button.full { width: 100%; }
.button.facebook { border-color: #1877f2; background: #1877f2; box-shadow: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid #69a8ff;
  outline-offset: 2px;
}

.overline {
  margin: 0 0 9px;
  color: var(--red);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.muted { color: var(--muted); line-height: 1.6; }
.text-link { color: inherit; font-weight: 700; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Public presentation */
.landing {
  color: #fff;
  background: #1e2530 url("../img/background.jpg") center top / cover fixed no-repeat;
}
.landing::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background: linear-gradient(115deg, rgba(18,23,31,.96), rgba(24,31,42,.68) 58%, rgba(33,18,24,.78));
}
.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 40px));
  min-height: 82px;
  margin: 0 auto;
}
.landing-nav nav { display: flex; align-items: center; gap: 20px; }
.landing-brand img { display: block; width: 156px; }
.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  gap: 70px;
  align-items: center;
  width: min(1180px, calc(100% - 40px));
  min-height: calc(100vh - 82px);
  margin: 0 auto;
  padding: 70px 0 100px;
}
.landing-copy h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(44px, 7vw, 86px);
  line-height: .95;
  letter-spacing: -.06em;
}
.landing-copy .lead {
  max-width: 680px;
  margin: 26px 0 0;
  color: #cfd7e2;
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.65;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.landing-visual {
  display: grid;
  place-items: center;
  min-height: 420px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 28px;
  background: rgba(6,9,14,.32);
  box-shadow: 0 40px 100px rgba(0,0,0,.32);
  backdrop-filter: blur(14px);
}
.landing-visual img { width: min(86%, 420px); }
.feature-band {
  padding: 100px max(20px, calc((100vw - 1180px) / 2));
  color: var(--ink);
  background: #fff;
}
.section-intro { max-width: 760px; }
.section-intro h2 { margin: 0; font-size: clamp(34px, 5vw, 58px); line-height: 1.05; letter-spacing: -.045em; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 50px; }
.feature-grid article { padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: #fafbfc; }
.feature-number { color: var(--red); font-size: 12px; font-weight: 900; letter-spacing: .13em; }
.feature-grid h3 { margin: 30px 0 10px; font-size: 22px; }
.feature-grid p { margin: 0; color: var(--muted); line-height: 1.65; }
.landing-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px max(20px, calc((100vw - 1180px) / 2));
  color: #aeb8c6;
  background: #151c25;
}
.landing-footer p { margin: 0; }
.landing-footer a { color: #fff; font-weight: 750; }

/* Authentication */
.auth-page {
  color: #fff;
  background: #161e28 url("../img/background.jpg") center / cover fixed no-repeat;
}
.auth-page::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background: rgba(15,20,28,.88);
}
.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1080px, calc(100% - 36px));
  min-height: 74px;
  margin: auto;
}
.auth-header img { display: block; width: 150px; }
.auth-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 74px);
  padding: 34px 18px 70px;
}
.auth-card {
  width: min(460px, 100%);
  padding: 34px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 18px;
  color: var(--ink);
  background: rgba(255,255,255,.98);
  box-shadow: 0 30px 90px rgba(0,0,0,.38);
}
.auth-card.wide { width: min(620px, 100%); }
.auth-icon {
  display: none;
  width: 74px;
  height: 74px;
  margin-bottom: 24px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--navy);
}
.auth-card h1 { margin: 0; font-size: 34px; line-height: 1.05; letter-spacing: -.04em; }
.form-stack { display: grid; gap: 11px; margin-top: 24px; }
.form-stack label,
.two-fields label,
.repair-form label,
.filter-grid label {
  display: grid;
  gap: 7px;
  color: #4b5868;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
}
input, select {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid #ccd5df;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}
input::placeholder { color: #9aa5b3; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.password-field { position: relative; }
.password-field input { padding-right: 67px; }
.password-toggle {
  position: absolute;
  top: 5px;
  right: 5px;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: #9aa5b3; font-size: 12px; }
.divider::before, .divider::after { flex: 1; height: 1px; content: ""; background: var(--line); }
.auth-switch { margin: 22px 0 0; color: var(--muted); text-align: center; }
.auth-switch a { color: var(--red); font-weight: 750; }
.recaptcha-wrap { overflow-x: auto; padding: 4px 0; }

/* Portal frame */
.portal { color: var(--ink); background: var(--canvas); }
.portal-topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 250px;
  z-index: 30;
  display: flex;
  align-items: center;
  min-height: 66px;
  padding: 0 25px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  box-shadow: 0 2px 10px rgba(32,41,54,.05);
  backdrop-filter: blur(12px);
}
.portal-wordmark { display: none; }
.portal-wordmark img { display: block; width: 145px; }
.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}
.account-menu { display: flex; align-items: center; gap: 13px; margin-left: auto; color: var(--muted); font-size: 13px; }
.link-button { padding: 0; border: 0; color: var(--red); background: none; font-weight: 750; }
.portal-shell { min-height: 100vh; }
.portal-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 250px;
  padding: 0 16px 24px;
  color: #d3dae3;
  background: linear-gradient(180deg, var(--navy), var(--navy-deep));
  box-shadow: 8px 0 30px rgba(23,32,43,.12);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  min-height: 66px;
  padding: 0 13px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.sidebar-logo img { display: block; width: 150px; }
.portal-sidebar nav { display: grid; gap: 6px; margin-top: 25px; }
.portal-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 13px;
  border-radius: 8px;
  color: #c7d0dc;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}
.portal-sidebar nav a span { width: 20px; color: #8593a4; font-size: 18px; text-align: center; }
.portal-sidebar nav a:hover, .portal-sidebar nav a.active { color: #fff; background: rgba(255,255,255,.09); }
.portal-sidebar nav a.active span { color: var(--red); }
.sidebar-note { position: absolute; right: 23px; bottom: 24px; left: 23px; margin: 0; color: #8390a0; font-size: 11px; line-height: 1.55; }
.portal-content { min-height: calc(100vh - 34px); margin-left: 250px; padding: 104px 30px 60px; }
.portal-footer { margin-left: 250px; padding: 0 30px 22px; color: #8a96a6; font-size: 11px; text-align: right; }

.notice {
  max-width: 1400px;
  margin: 0 auto 18px;
  padding: 13px 15px;
  border: 1px solid;
  border-radius: 9px;
  font-size: 13px;
}
.notice.success { color: #0c6848; border-color: #9bd9c2; background: #eaf8f2; }
.notice.error { color: #982039; border-color: #efb3bf; background: #fff0f3; }
.notice.info { color: #375d81; border-color: #b7d2e9; background: #edf6fd; }

.portal-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  max-width: 1400px;
  margin: 0 auto 24px;
}
.portal-heading h1 { margin: 0; font-size: clamp(32px, 4vw, 48px); line-height: 1; letter-spacing: -.045em; }
.portal-heading p:last-child { margin: 12px 0 0; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 1400px; margin: 0 auto 18px; }
.stat-grid article { display: grid; gap: 3px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 6px 18px rgba(32,41,54,.035); }
.stat-grid strong { font-size: 31px; letter-spacing: -.04em; }
.stat-grid span { color: var(--muted); font-size: 12px; }
.panel { max-width: 1400px; margin: 0 auto 18px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 6px 18px rgba(32,41,54,.035); }
.panel-title { display: flex; align-items: end; justify-content: space-between; margin-bottom: 17px; }
.panel-title h2, .add-playlist-panel h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.panel-title h2 span { color: var(--muted); font-weight: 500; }
.filter-grid { display: grid; grid-template-columns: minmax(210px, 1.4fr) minmax(170px, .8fr) minmax(155px, .6fr) auto; gap: 10px; align-items: end; margin-bottom: 20px; }

.archive-timeline {
  position: relative;
  max-width: 1400px;
  margin: 0 auto 18px;
  padding: 25px 26px 18px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  color: #fff;
  background:
    radial-gradient(circle at 12% -30%, rgba(237,38,54,.34), transparent 38%),
    linear-gradient(135deg, #1d2632 0%, #121922 100%);
  box-shadow: 0 22px 55px rgba(23,32,43,.18);
}
.archive-timeline::after {
  position: absolute;
  right: -90px;
  bottom: -145px;
  width: 330px;
  height: 330px;
  border-radius: 50%;
  background: rgba(255,255,255,.035);
  content: "";
  pointer-events: none;
}
.timeline-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.timeline-heading h2 { margin: 0; font-size: clamp(24px, 3vw, 35px); letter-spacing: -.04em; }
.timeline-clear { position: relative; z-index: 1; color: #fff; font-size: 12px; font-weight: 750; text-underline-offset: 4px; }
.timeline-track {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 36px;
  align-items: end;
  min-height: 126px;
  margin: 17px -26px 0;
  padding: 22px 30px 16px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-color: rgba(255,255,255,.24) transparent;
  scrollbar-width: thin;
  scroll-padding-inline: 30px;
}
.timeline-track::before {
  position: absolute;
  right: 30px;
  bottom: 48px;
  left: 30px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,.08), rgba(255,255,255,.35), rgba(255,255,255,.08));
  content: "";
}
.timeline-year-group { display: flex; flex: 0 0 auto; gap: 16px; align-items: end; }
.timeline-year,
.timeline-month {
  --dock-scale: 1;
  position: relative;
  z-index: 1;
  display: grid;
  flex: 0 0 auto;
  justify-items: center;
  color: #fff;
  text-decoration: none;
  transform: scale(var(--dock-scale));
  transform-origin: center bottom;
  transition: transform .16s ease, color .16s ease, opacity .16s ease;
}
.timeline-year { gap: 2px; min-width: 72px; padding-bottom: 27px; }
.timeline-year::after {
  position: absolute;
  bottom: 9px;
  width: 9px;
  height: 9px;
  border: 2px solid #1a222d;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(255,255,255,.3);
  content: "";
}
.timeline-year strong { font-size: 25px; letter-spacing: -.04em; }
.timeline-year span { color: #97a4b5; font-size: 9px; font-weight: 750; }
.timeline-months { display: flex; gap: 12px; align-items: end; }
.timeline-month { gap: 5px; min-width: 34px; padding-bottom: 22px; color: #aeb8c6; }
.timeline-dot { position: absolute; bottom: 10px; width: 5px; height: 5px; border-radius: 50%; background: #788698; transition: background .16s ease, box-shadow .16s ease; }
.timeline-month strong { font-size: 11px; letter-spacing: .02em; }
.timeline-month small { color: #718094; font-size: 8px; font-weight: 800; }
.timeline-year:hover, .timeline-month:hover, .timeline-year:focus-visible, .timeline-month:focus-visible { --dock-scale: 1.18; color: #fff; }
.timeline-month:hover .timeline-dot, .timeline-month:focus-visible .timeline-dot, .timeline-month.is-selected .timeline-dot {
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(237,38,54,.17), 0 0 18px rgba(237,38,54,.75);
}
.timeline-year.is-selected::after { background: var(--red); box-shadow: 0 0 0 5px rgba(237,38,54,.17), 0 0 18px rgba(237,38,54,.75); }
.timeline-year.is-selected strong, .timeline-month.is-selected { color: #fff; }
.timeline-hint { margin: 3px 0 0; color: #7f8c9d; font-size: 10px; }

.video-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.video-card { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.video-card.is-highlighted { border-color: var(--red); box-shadow: 0 0 0 3px rgba(237,38,54,.12), 0 16px 36px rgba(32,41,54,.13); transform: translateY(-3px); }
.video-card > a { display: block; aspect-ratio: 16/9; background: #111; }
.video-card > a img, .video-card > img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #111; }
.thumb-placeholder { display: grid; aspect-ratio: 16/9; place-items: center; color: #8894a3; background: #e9edf2; font-size: 12px; }
.video-card-body { display: grid; gap: 10px; padding: 14px; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; }
.badge { display: inline-block; max-width: 100%; overflow: hidden; padding: 4px 7px; border-radius: 99px; color: #0c6848; background: #dcf5eb; font-size: 9px; font-weight: 850; letter-spacing: .05em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.badge.removed, .badge.deleted { color: #9c1f38; background: #ffe0e6; }
.badge.private { color: #8b5900; background: #fff0c9; }
.badge.neutral { color: #526174; background: #edf0f4; }
.video-card h3 { margin: 0; font-size: 16px; line-height: 1.32; }
.video-card h3 a { text-decoration: none; }
.video-card h3 a:hover { color: var(--red); }
.video-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.video-card footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 5px; color: #909aa8; font-size: 9px; }
.video-card code { color: #788697; }
.nearby-link { flex: 0 0 auto; color: var(--red); font-size: 10px; font-weight: 850; text-decoration: none; }
.nearby-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.panel-subtitle { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.empty-state { padding: 65px 20px; border: 1px dashed #cbd4de; border-radius: 10px; color: var(--muted); text-align: center; }
.empty-state h3 { margin: 0 0 7px; color: var(--ink); }
.empty-state p { margin: 0; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 22px; color: var(--muted); font-size: 12px; }
.pagination a { padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); text-decoration: none; }
.infinite-loader { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 76px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.infinite-loader a { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fff; text-decoration: none; }
.infinite-loader.is-enhanced a { display: none; }
.infinite-loader.is-enhanced.has-error a { display: inline-flex; }
.loading-spinner { display: none; width: 18px; height: 18px; border: 2px solid #d7dde5; border-top-color: var(--red); border-radius: 50%; animation: loader-spin .75s linear infinite; }
.infinite-loader.is-loading .loading-spinner { display: block; }
.infinite-loader.is-complete .loading-spinner { display: none; }
@keyframes loader-spin { to { transform: rotate(360deg); } }

.add-playlist-panel { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 22px; align-items: end; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.playlist-list { border-top: 1px solid var(--line); }
.playlist-item { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 4px; border-bottom: 1px solid var(--line); }
.playlist-main { min-width: 0; flex: 1; }
.playlist-main h3 { margin: 0 0 5px; font-size: 16px; }
.playlist-main h3 a { text-decoration: none; }
.playlist-main h3 a:hover { color: var(--red); }
.playlist-main code { display: block; overflow: hidden; max-width: 760px; color: #788697; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.playlist-main p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.pending { display: inline-block; margin-left: 7px; padding: 3px 6px; border-radius: 99px; color: #7a5100; background: #fff0c9; font-weight: 800; }
.field-error { color: var(--danger) !important; }
.item-actions { display: flex; gap: 7px; }
.mini-button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--red);
  border-radius: 7px;
  color: #fff;
  background: var(--red);
  font-size: 11px;
  font-weight: 800;
}
.mini-button.ghost { color: var(--muted); border-color: var(--line); background: #fff; }
.archived-panel summary { color: var(--ink); font-weight: 800; }
.archived-panel details[open] summary { margin-bottom: 15px; }
.repair-form { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 8px; align-items: end; max-width: 760px; margin-top: 12px; }
.archived-item { align-items: start; }

@media (max-width: 1250px) {
  .video-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .landing-hero { grid-template-columns: 1fr; min-height: auto; padding-top: 90px; }
  .landing-visual { min-height: 340px; }
  .feature-grid { grid-template-columns: 1fr; }
  .portal-topbar { left: 0; }
  .portal-wordmark, .menu-toggle { display: block; }
  .portal-wordmark { margin-left: 12px; }
  .portal-sidebar { transform: translateX(-105%); transition: transform .2s ease; }
  .portal-sidebar.is-open { transform: translateX(0); }
  .portal-content, .portal-footer { margin-left: 0; }
  .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .landing-nav, .landing-hero { width: min(100% - 24px, 1180px); }
  .landing-nav .text-link { display: none; }
  .landing-copy h1 { font-size: 46px; }
  .landing-visual { min-height: 280px; }
  .landing-footer { display: grid; }
  .auth-card { padding: 24px; }
  .two-fields, .filter-grid, .video-grid, .stat-grid, .add-playlist-panel, .inline-form, .repair-form { grid-template-columns: 1fr; }
  .portal-content { padding: 92px 12px 40px; }
  .portal-topbar { padding: 0 12px; }
  .account-menu > span { display: none; }
  .portal-heading { display: grid; align-items: start; }
  .playlist-item { display: grid; }
  .item-actions { flex-wrap: wrap; }
  .archive-timeline { padding: 21px 18px 15px; border-radius: 15px; }
  .timeline-heading { align-items: start; }
  .timeline-track { margin-right: -18px; margin-left: -18px; padding-right: 22px; padding-left: 22px; }
  .timeline-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
