:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f9f9f9;
  --surface-strong: #f1f1f1;
  --text: #0f0f0f;
  --muted: #606060;
  --line: #e5e5e5;
  --red: #ff0033;
  --red-dark: #cc0029;
  --green: #0f8a3b;
  --danger: #b42318;
  --radius: 14px;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.08);
  font-family: Roboto, Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.brand,
.top-actions,
.inline-form {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  font-size: 1.25rem;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 25px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 0.8rem;
}

.top-actions {
  color: var(--muted);
  font-size: 0.95rem;
}

.top-actions a:hover,
.link-button:hover {
  color: var(--text);
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

main {
  min-height: calc(100vh - 64px);
}

.shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.with-sidebar {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 26px;
}

.sidebar {
  position: sticky;
  top: 84px;
  align-self: start;
  display: grid;
  gap: 6px;
}

.sidebar-item {
  padding: 11px 14px;
  border-radius: 12px;
  color: var(--text);
}

.sidebar-item.active,
.sidebar-item:hover {
  background: var(--surface-strong);
}

.sidebar-item.muted {
  color: var(--muted);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.section-heading h1,
.narrow-panel h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.4rem);
  letter-spacing: -0.06em;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 28px 18px;
}

.video-card {
  display: grid;
  gap: 9px;
}

.thumb-wrap {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.thumb-wrap img,
.compact-card img,
.admin-video-row img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-card:hover .thumb-wrap {
  box-shadow: var(--shadow);
}

.duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 6px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}

.video-title {
  display: -webkit-box;
  overflow: hidden;
  font-weight: 800;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.video-meta,
.watch-meta,
.watch-note,
.compact-card small,
.admin-video-row p,
.empty-state p,
.admin-card p {
  color: var(--muted);
}

.watch-layout {
  width: min(1320px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
}

.player-frame {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  background: #000;
}

.player-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.watch-title {
  margin: 18px 0 6px;
  font-size: clamp(1.5rem, 2vw, 2.2rem);
  line-height: 1.1;
}

.up-next {
  display: grid;
  align-content: start;
  gap: 12px;
}

.up-next h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.compact-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  align-items: start;
}

.compact-card img {
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  background: var(--surface-strong);
}

.compact-card strong {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.compact-card small {
  display: block;
  margin-top: 5px;
}

.narrow-panel {
  width: min(560px, calc(100vw - 32px));
  margin: 56px auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--bg);
  box-shadow: var(--shadow);
}

.stacked-form,
.admin-card,
.admin-list {
  display: grid;
  gap: 16px;
}

.stacked-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  background: var(--bg);
  color: var(--text);
}

input:focus {
  border-color: #111;
  outline: 3px solid rgba(255, 0, 51, 0.12);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.button:hover {
  background: #333;
}

.button.secondary {
  background: var(--surface-strong);
  color: var(--text);
}

.button.danger {
  background: #fee4e2;
  color: var(--danger);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.horizontal-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.admin-card,
.empty-state,
.setup-warning {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.setup-warning {
  margin: 18px 0;
  border-color: #fedf89;
  background: #fffaeb;
}

.admin-video-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.admin-video-row img {
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: var(--surface-strong);
}

.admin-video-row h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.status-row,
.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.row-actions {
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.pill-good {
  background: #dcfae6;
  color: var(--green);
}

.pill-bad {
  background: #fee4e2;
  color: var(--danger);
}

.flash {
  width: min(900px, calc(100vw - 32px));
  margin: 16px auto 0;
  padding: 13px 16px;
  border-radius: 14px;
  background: var(--surface-strong);
  font-weight: 700;
}

.flash-success {
  background: #dcfae6;
  color: var(--green);
}

.flash-error {
  background: #fee4e2;
  color: var(--danger);
}

.flash-warning {
  background: #fffaeb;
  color: #93370d;
}

code {
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: var(--surface-strong);
}

@media (max-width: 880px) {
  .topbar {
    padding: 0 14px;
  }

  .top-actions {
    gap: 8px;
    font-size: 0.86rem;
  }

  .with-sidebar,
  .watch-layout,
  .admin-video-row {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: flex;
    overflow: auto;
  }

  .compact-card {
    grid-template-columns: 120px 1fr;
  }

  .horizontal-form {
    grid-template-columns: 1fr;
  }

  .row-actions {
    justify-content: flex-start;
  }
}
