:root {
  color-scheme: light dark;
  --bg: light-dark(#fafafa, #0f0f10);
  --fg: light-dark(#18181b, #ececee);
  --muted: light-dark(#6b6b73, #9a9aa3);
  --card: light-dark(#fff, #18181b);
  --line: light-dark(#e4e4e7, #2a2a2e);
  --accent: light-dark(#2563eb, #60a5fa);
  --danger: light-dark(#dc2626, #f87171);
  --radius: 12px;
  font-family: system-ui, sans-serif;
  line-height: 1.5;
}

*, *::before, *::after { box-sizing: border-box; }

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

a { color: inherit; }

header.site {
  padding: 1rem clamp(1rem, 4vw, 2rem);
  font-weight: 650;
  & a { text-decoration: none; }
}

main {
  max-width: 72rem;
  margin-inline: auto;
  padding: 0 clamp(1rem, 4vw, 2rem) 3rem;
}

video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 80vh;
  background: #000;
  border-radius: var(--radius);
}

.grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1.5rem;

  & a {
    display: grid;
    gap: 0.4rem;
    text-decoration: none;
    position: relative;
  }
  & img, & .placeholder {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius);
    background: var(--line);
    transition: scale 0.15s ease;
  }
  & a:hover :is(img, .placeholder) { scale: 1.02; }
  & .title { font-weight: 550; }
  & .duration {
    position: absolute;
    inset: auto 0.5rem 2.4rem auto;
    padding: 0 0.4rem;
    border-radius: 6px;
    background: rgb(0 0 0 / 0.75);
    color: #fff;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
  }
}

.watch {
  & h1 { margin: 1rem 0 0.25rem; font-size: 1.5rem; text-wrap: balance; }
  & .description { white-space: pre-line; margin: 0.5rem 0; }
}

.meta, .empty, small { color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: grid;
  gap: 1rem;
  & h1, & h2 { margin: 0; font-size: 1.2rem; }
}

.login { max-width: 24rem; margin: 10vh auto 0; }
.upload.dragging { outline: 3px dashed var(--accent); outline-offset: 3px; }
.upload-status:empty { display: none; }

label { display: grid; gap: 0.35rem; font-weight: 550; }

input, textarea, button {
  font: inherit;
  color: inherit;
}

input:not([type="file"]), textarea {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-weight: 400;
  &:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
}

button {
  justify-self: start;
  padding: 0.55rem 1.1rem;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  &.secondary { background: transparent; color: var(--fg); border: 1px solid var(--line); }
  &.danger { background: var(--danger); }
}

.error {
  margin: 0;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  color: var(--danger);
  border: 1px solid currentColor;
}

.admin {
  display: grid;
  gap: 1.5rem;
}

.admin-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  & h1 { margin: 0; }
}

table {
  width: 100%;
  border-collapse: collapse;
  & th, & td {
    text-align: start;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
  }
  & th { color: var(--muted); font-weight: 500; font-size: 0.9rem; }
  & td:nth-child(2), & td:nth-child(3) { font-variant-numeric: tabular-nums; white-space: nowrap; }
}

.confirm {
  & summary { cursor: pointer; color: var(--danger); list-style: none; }
  & summary::-webkit-details-marker { display: none; }
  & form { margin-top: 0.5rem; }
}

body.embed {
  background: #000;
  height: 100dvh;
  display: grid;
  place-items: center;
  & video { width: 100%; height: 100dvh; max-height: none; border-radius: 0; object-fit: contain; }
}
