@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

:root {
  color-scheme: dark;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --page-bg: #0b0216;
  --text-primary: #fdfbff;
  --text-secondary: #d1c6ff;
  --card-bg: rgba(33, 12, 61, 0.9);
  --card-alt: rgba(62, 23, 108, 0.68);
  --card-border: rgba(185, 150, 255, 0.28);
  --card-border-strong: rgba(232, 197, 255, 0.6);
  --accent-primary: rgba(170, 83, 255, 0.35);
  --accent-secondary: rgba(255, 120, 241, 0.24);
  --glow-primary: rgba(204, 143, 255, 0.45);
  --glow-secondary: rgba(255, 148, 222, 0.35);
  --status-info: #f3e8ff;
  --status-error: #ffb4b4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background:
    radial-gradient(circle at 0% 10%, rgba(131, 56, 236, 0.25), transparent 52%),
    radial-gradient(circle at 92% 0%, rgba(231, 70, 148, 0.22), transparent 60%),
    radial-gradient(circle at 35% 100%, rgba(88, 28, 135, 0.18), transparent 65%),
    linear-gradient(160deg, #09021a 0%, #1a0632 40%, #330852 100%);
  color: var(--text-primary);
}

.auth-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 6vw, 3rem);
  background:
    radial-gradient(circle at 18% 18%, rgba(170, 83, 255, 0.42), transparent 60%),
    radial-gradient(circle at 82% 28%, rgba(255, 120, 241, 0.3), transparent 72%),
    rgba(9, 2, 26, 0.92);
  z-index: 20;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 1.75rem;
  padding: clamp(1.75rem, 5vw, 2.4rem);
  border-radius: 24px;
  border: 1px solid rgba(202, 178, 255, 0.28);
  background: linear-gradient(145deg, rgba(45, 16, 88, 0.95), rgba(86, 32, 128, 0.78));
  box-shadow: 0 38px 90px rgba(16, 0, 43, 0.55);
  backdrop-filter: blur(12px);
}

.auth-brand {
  display: flex;
  justify-content: center;
}

.auth-content {
  display: grid;
  gap: 1.2rem;
}

.auth-title {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2rem);
  text-align: center;
}

.auth-subtitle {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  text-align: center;
}

.auth-form {
  display: grid;
  gap: 0.9rem;
}

.auth-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.2rem;
  color: rgba(148, 163, 184, 0.8);
}

.auth-input {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(194, 164, 255, 0.38);
  background: rgba(53, 19, 100, 0.68);
  color: var(--text-primary);
  font-size: 1rem;
}

.auth-input:focus {
  outline: none;
  border-color: rgba(255, 184, 245, 0.75);
  box-shadow: 0 0 0 3px rgba(219, 112, 255, 0.28);
}

.auth-error {
  margin: 0;
  font-size: 0.85rem;
  color: var(--status-error);
}

.auth-error[hidden] {
  display: none;
}

.auth-submit {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  background: linear-gradient(135deg, rgba(167, 65, 255, 0.7), rgba(255, 115, 219, 0.65));
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.auth-submit:hover,
.auth-submit:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 18px 35px rgba(235, 120, 255, 0.35);
}

.auth-submit:focus-visible {
  outline: none;
}

.auth-overlay[hidden] {
  display: none;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  padding: clamp(1.4rem, 4vw, 2.75rem);
  display: grid;
  gap: clamp(1.8rem, 4vw, 2.8rem);
}

.site-top {
  position: sticky;
  top: clamp(1rem, 3vw, 1.75rem);
  z-index: 5;
  transition: top 0.35s ease;
}

.site-title-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(1rem, 4vw, 2.4rem);
  padding: clamp(1.1rem, 3vw, 1.8rem) clamp(1.4rem, 4vw, 2.35rem);
  border-radius: 20px;
  border: 1px solid var(--card-border);
  background: linear-gradient(120deg, rgba(37, 14, 74, 0.95), rgba(84, 32, 125, 0.82));
  box-shadow: 0 26px 60px rgba(22, 0, 55, 0.55);
  backdrop-filter: blur(18px);
  overflow: hidden;
  transition:
    padding 0.35s ease,
    border-radius 0.35s ease,
    box-shadow 0.35s ease,
    background 0.35s ease;
}

.site-title-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 12% 50%, rgba(204, 143, 255, 0.2), transparent 55%),
    radial-gradient(circle at 88% 35%, rgba(255, 137, 242, 0.22), transparent 65%);
  pointer-events: none;
}

.title-group {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 1.8rem);
  min-width: 0;
}

.brand-crest {
  position: relative;
  width: clamp(76px, 12vw, 108px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  transition: width 0.35s ease, transform 0.35s ease;
}

.brand-orb {
  position: absolute;
  inset: 12%;
  border-radius: 30px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 176, 240, 0.55), transparent 60%),
    linear-gradient(140deg, rgba(179, 76, 255, 0.85), rgba(255, 120, 241, 0.6));
  filter: blur(0.2px);
  box-shadow: 0 26px 50px rgba(36, 0, 88, 0.55);
}

.brand-logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: min(68%, 128px);
  min-width: 90px;
  padding: 0.45rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(209, 184, 255, 0.38);
  background: linear-gradient(135deg, rgba(167, 65, 255, 0.4), rgba(255, 120, 241, 0.28));
  box-shadow: 0 18px 42px rgba(24, 0, 58, 0.55);
  overflow: hidden;
  transition: padding 0.35s ease, min-width 0.35s ease;
}

.brand-logo.has-image {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: none;
  background: none;
  box-shadow: none;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.logo-placeholder {
  font-size: clamp(0.8rem, 2vw, 0.95rem);
  letter-spacing: 0.4rem;
  text-transform: uppercase;
  color: rgba(243, 224, 255, 0.9);
  font-weight: 700;
}

.title-stack {
  display: grid;
  gap: 0.45rem;
  justify-items: flex-start;
  text-align: left;
}

.brand-tagline {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: rgba(235, 221, 255, 0.78);
}

.brand-kicker {
  text-transform: uppercase;
  letter-spacing: 0.32rem;
  font-size: 0.72rem;
  color: rgba(233, 213, 255, 0.78);
  transition: letter-spacing 0.35s ease, font-size 0.35s ease;
}

.site-title-card h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: -0.02em;
  transition: font-size 0.35s ease;
}

.site-top.is-compact {
  top: 0;
}

.site-top.is-compact .site-title-card {
  padding: 0.75rem 1.6rem;
  border-radius: 0 0 20px 20px;
  background: linear-gradient(120deg, rgba(39, 14, 74, 0.95), rgba(84, 32, 125, 0.78));
  box-shadow: 0 20px 55px rgba(27, 0, 72, 0.55);
}

.site-top.is-compact .brand-crest {
  width: clamp(56px, 9vw, 80px);
  transform: translateY(2px);
}

.site-top.is-compact .brand-logo {
  min-width: 76px;
  padding: 0.35rem 0.9rem;
}

.site-top.is-compact .brand-kicker {
  font-size: 0.66rem;
  letter-spacing: 0.24rem;
}

.site-top.is-compact .brand-tagline {
  display: none;
}

.site-top.is-compact .site-title-card h1 {
  font-size: clamp(1.6rem, 4vw, 2.35rem);
}

.site-top.is-compact .site-actions {
  align-self: stretch;
}

.site-actions {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.75rem;
  justify-items: end;
  text-align: right;
}

.status-banner {
  border-radius: 14px;
  padding: 0.5rem 1.1rem;
  font-size: 0.9rem;
  text-align: right;
  color: var(--status-info);
  background: linear-gradient(130deg, rgba(170, 83, 255, 0.28), rgba(255, 120, 241, 0.22));
  border: 1px solid rgba(205, 172, 255, 0.38);
  box-shadow: 0 20px 55px rgba(30, 0, 72, 0.45);
}

.status-banner.error {
  color: var(--status-error);
  background: linear-gradient(130deg, rgba(244, 114, 182, 0.3), rgba(244, 114, 182, 0.1));
  border-color: rgba(248, 187, 208, 0.4);
}

.status-banner[hidden] {
  display: none;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
}

.btn-link {
  border: 1px solid var(--card-border);
  background: linear-gradient(130deg, rgba(170, 83, 255, 0.38), rgba(255, 120, 241, 0.22));
  color: var(--text-primary);
  padding: 0.6rem 1.55rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  box-shadow: 0 22px 52px rgba(34, 0, 80, 0.48);
}

.btn-link:hover {
  transform: translateY(-4px);
  border-color: var(--card-border-strong);
  background: linear-gradient(130deg, rgba(181, 97, 255, 0.55), rgba(255, 146, 242, 0.3));
  box-shadow: 0 28px 60px rgba(35, 0, 84, 0.55);
}

.btn-link[disabled] {
  opacity: 0.6;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.feed-panel {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.5rem);
}

.video-grid {
  display: grid;
  gap: clamp(1.35rem, 3vw, 2.1rem);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

@media (min-width: 960px) {
  .video-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.video-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 320px;
  position: relative;
  box-shadow: 0 32px 72px rgba(30, 0, 72, 0.52);
  transition:
    opacity 0.4s ease,
    transform 0.4s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.video-card:hover {
  transform: translateY(-6px);
  border-color: var(--card-border-strong);
  box-shadow: 0 36px 82px rgba(38, 0, 92, 0.55);
}

.video-frame {
  position: relative;
  padding-top: 56.25%;
  background: rgba(63, 22, 108, 0.72);
  border-radius: 16px 16px 0 0;
  overflow: hidden;
}

.video-frame.has-thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--frame-thumb, none);
  background-size: cover;
  background-position: center;
  filter: saturate(1.1);
  transition: opacity 0.35s ease;
}

.video-frame.has-thumb.is-loaded::before {
  opacity: 0;
}

.video-frame iframe,
.video-frame video,
.video-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-frame img {
  object-fit: cover;
}

.video-frame .empty-frame {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  color: rgba(226, 232, 240, 0.8);
  padding: 1.5rem;
  text-align: center;
  background: rgba(58, 19, 105, 0.82);
}

.video-meta {
  padding: 1.2rem 1.35rem 1.6rem;
  display: grid;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.video-id {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: max-content;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(236, 222, 255, 0.9);
  background: rgba(132, 56, 237, 0.22);
  border: 1px solid rgba(209, 184, 255, 0.42);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
}

.video-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.video-source {
  display: grid;
  gap: 0.35rem;
  padding: 0.6rem 0.75rem;
  border-radius: 14px;
  background: rgba(110, 36, 184, 0.28);
  border: 1px solid rgba(216, 173, 255, 0.38);
  box-shadow: 0 16px 32px rgba(58, 8, 120, 0.35);
  word-break: break-word;
}

.video-source-label {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12rem;
  color: rgba(243, 224, 255, 0.78);
}

.video-source-link {
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  color: rgba(252, 245, 255, 0.95);
  text-decoration: none;
}

.video-source-link:hover,
.video-source-link:focus-visible {
  text-decoration: underline;
}

.video-source-link.is-disabled {
  pointer-events: none;
  color: rgba(235, 214, 255, 0.55);
  text-decoration: none;
}

.video-description {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.video-meta-summary {
  margin: 0;
  color: rgba(242, 228, 255, 0.8);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.video-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.video-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(227, 88, 253, 0.22);
  border: 1px solid rgba(241, 171, 255, 0.38);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: rgba(252, 243, 255, 0.9);
  box-shadow: 0 12px 22px rgba(68, 0, 112, 0.38);
}

.video-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.video-category {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid rgba(192, 132, 252, 0.35);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: rgba(237, 233, 254, 0.92);
  box-shadow: 0 10px 20px rgba(74, 22, 135, 0.38);
}

.video-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.video-metric {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(140, 70, 255, 0.2);
  border: 1px solid rgba(209, 184, 255, 0.4);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(248, 240, 255, 0.9);
  box-shadow: 0 12px 22px rgba(70, 18, 120, 0.42);
}

.feed-sentinel {
  width: 100%;
  height: 1px;
}

.empty-state {
  margin: 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.95rem;
  padding: 2rem;
  border: 1px dashed rgba(205, 172, 255, 0.35);
  border-radius: 20px;
  background: rgba(58, 19, 105, 0.55);
}

.video-card.reveal {
  opacity: 0;
  transform: translateY(18px);
}

.video-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.skeleton-card {
  pointer-events: none;
  position: relative;
  overflow: hidden;
}

.skeleton-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.05));
  animation: shimmer 1.35s infinite;
  opacity: 0.6;
}

.skeleton-line {
  height: 12px;
  border-radius: 999px;
  background: rgba(210, 180, 255, 0.14);
}

.skeleton-line.w-60 {
  width: 60%;
}

.skeleton-line.w-40 {
  width: 40%;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@media (min-width: 900px) {
  .feed-panel {
    gap: clamp(2rem, 3vw, 3rem);
  }

  .video-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

@media (max-width: 720px) {
  .site-title-card {
    flex-direction: column;
    align-items: stretch;
    gap: 1.4rem;
  }

  .title-group {
    justify-content: center;
    text-align: center;
  }

  .title-stack {
    justify-items: center;
    text-align: center;
  }

  .site-actions {
    justify-items: center;
    text-align: center;
    width: 100%;
  }

  .action-buttons {
    justify-content: center;
  }
}
