:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #f5f5f7;
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: wait; opacity: .58; }

:focus-visible {
  outline: 3px solid #0071e3;
  outline-offset: 3px;
}

.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 32px 28px 72px;
}

.eyebrow {
  margin: 0 0 7px;
  color: #6e6e73;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(35px, 5vw, 50px); letter-spacing: -.042em; line-height: 1.04; }
h2 { margin-bottom: 5px; font-size: 20px; letter-spacing: -.02em; line-height: 1.2; }
h3 { margin-bottom: 5px; font-size: 16px; letter-spacing: -.012em; line-height: 1.25; }
.lede, .section-heading p { color: #6e6e73; line-height: 1.5; }

.sign-in {
  width: min(390px, 100%);
  margin: clamp(72px, 18vh, 178px) auto 0;
  padding: 38px;
  border: 1px solid #d2d2d7;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .07);
}

.sign-in__mark {
  display: grid;
  width: 35px;
  height: 35px;
  margin-bottom: 27px;
  place-items: center;
  border-radius: 10px;
  background: #1d1d1f;
  color: #fff;
  font-size: 27px;
  line-height: 1;
}

.sign-in__form { display: grid; gap: 11px; margin-top: 27px; }

label { color: #1d1d1f; font-size: 13px; font-weight: 650; }
input, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c7c7cc;
  border-radius: 10px;
  background: #fff;
  color: #1d1d1f;
}
input { padding: 0 12px; }
select { padding: 0 33px 0 12px; }
input::placeholder { color: #86868b; }
input:focus, select:focus { border-color: #0071e3; box-shadow: 0 0 0 3px rgba(0, 113, 227, .14); outline: 0; }

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.button--primary { background: #0071e3; color: #fff; }
.button--primary:hover:not(:disabled) { background: #0077ed; }
.button--quiet { border-color: #d2d2d7; background: #fff; color: #1d1d1f; }
.button--quiet:hover:not(:disabled) { border-color: #a1a1a6; background: #fafafa; }
.button--danger { background: #c93425; color: #fff; }
.button--danger:hover:not(:disabled) { background: #b62a1d; }
.button--text-danger { min-height: 36px; padding: 0 8px; background: transparent; color: #bd2c20; }
.button--text-danger:hover:not(:disabled) { background: #fff1f0; }

.form-message { margin: 2px 0 0; color: #a51d13; font-size: 13px; line-height: 1.45; }

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 8px 0 32px;
  border-bottom: 1px solid #d2d2d7;
}

.download-panel, .queue, .collection { padding-top: 30px; }
.download-panel { border-bottom: 1px solid #d2d2d7; padding-bottom: 30px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.section-heading p { margin-bottom: 0; font-size: 14px; }
.limit { flex: 0 0 auto; margin-top: 4px; color: #86868b !important; font-size: 12px !important; white-space: nowrap; }

.download-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px auto;
  align-items: end;
  gap: 12px;
  margin-top: 20px;
}
.field { display: grid; gap: 7px; }

.queue {
  padding-bottom: 2px;
  border-bottom: 1px solid #d2d2d7;
}
.queue__heading { display: flex; align-items: baseline; justify-content: space-between; }
.queue__count {
  display: inline-grid;
  min-width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 99px;
  background: #e8e8ed;
  color: #515154;
  font-size: 12px;
  font-weight: 700;
}
.queue__list { display: grid; gap: 8px; margin: 0; padding: 0 0 28px; list-style: none; }
.queue-item { display: grid; grid-template-columns: 100px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 44px; padding: 10px 12px; border-radius: 10px; background: #fff; font-size: 14px; }
.queue-item__state { font-weight: 700; }
.queue-item--downloading .queue-item__state { color: #0066cc; }
.queue-item--failed .queue-item__state { color: #a51d13; }
.queue-item--ready .queue-item__state { color: #16803c; }
.queue-item__copy { min-width: 0; color: #515154; overflow-wrap: anywhere; }
.queue-item__quality { color: #86868b; font-size: 12px; white-space: nowrap; }

.collection__heading { margin-bottom: 18px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 18px; }
.video-card { overflow: hidden; border: 1px solid #d2d2d7; border-radius: 16px; background: #fff; box-shadow: 0 1px 1px rgba(0, 0, 0, .02); }
.video-card--deleting { opacity: .65; }
.video-card__preview { position: relative; display: grid; width: 100%; aspect-ratio: 16 / 9; margin: 0; padding: 0; place-items: center; overflow: hidden; border: 0; background: #e8e8ed; }
.video-card__preview img { width: 100%; height: 100%; object-fit: cover; }
.video-card__preview--placeholder::before { content: "Video"; color: #6e6e73; font-size: 13px; font-weight: 650; }
.play-mark { position: absolute; display: grid; width: 42px; height: 42px; padding-left: 2px; place-items: center; border-radius: 50%; background: rgba(29, 29, 31, .82); color: white; font-size: 15px; transition: transform 140ms ease; }
.video-card__preview:hover .play-mark { transform: scale(1.07); }
.video-card__body { display: grid; min-width: 0; padding: 15px; }
.video-card h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metadata { margin-bottom: 14px; color: #6e6e73; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.video-card__actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.video-card__pending, .video-card__warning { margin: 0; font-size: 13px; line-height: 1.45; }
.video-card__pending { color: #0066cc; }
.video-card__warning { color: #a51d13; }
.empty-state { display: grid; min-height: 230px; place-items: center; align-content: center; padding: 30px; border: 1px dashed #c7c7cc; border-radius: 16px; background: #fafafa; text-align: center; }
.empty-state h3 { margin-bottom: 7px; }
.empty-state p { max-width: 360px; margin-bottom: 20px; color: #6e6e73; line-height: 1.5; }

.dialog { width: min(720px, calc(100% - 32px)); max-width: none; padding: 0; border: 0; border-radius: 16px; background: transparent; color: #1d1d1f; box-shadow: 0 22px 65px rgba(0, 0, 0, .25); }
.dialog::backdrop { background: rgba(0, 0, 0, .42); }
.dialog__surface { padding: 18px; background: #fff; }
.dialog__surface--compact { padding: 25px; }
.dialog__surface--compact p { color: #6e6e73; line-height: 1.5; }
.dialog__header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 2px 2px 16px; }
.dialog__header h2 { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog video { display: block; width: 100%; max-height: min(68vh, 620px); background: #000; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.icon-button { display: grid; width: 44px; height: 44px; flex: 0 0 auto; place-items: center; border: 0; border-radius: 50%; background: #f5f5f7; color: #1d1d1f; font-size: 29px; line-height: 1; }
.icon-button:hover { background: #e8e8ed; }
.screen-reader-status { position: fixed; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 680px) {
  .shell { padding: 20px 16px 48px; }
  .sign-in { margin-top: 54px; padding: 28px 22px; border-radius: 17px; }
  .topbar { align-items: flex-start; padding-bottom: 25px; }
  .topbar .button { flex: 0 0 auto; }
  .section-heading { display: block; }
  .limit { margin: 9px 0 0; white-space: normal; }
  .download-form { grid-template-columns: 1fr; gap: 14px; }
  .download-form .button { width: 100%; }
  .queue-item { grid-template-columns: 1fr auto; gap: 2px 12px; }
  .queue-item__copy { grid-column: 1 / -1; }
  .gallery { grid-template-columns: 1fr; gap: 14px; }
  .video-card h3 { white-space: normal; overflow-wrap: anywhere; }
  .metadata { margin-bottom: 12px; }
  .dialog { width: calc(100% - 20px); border-radius: 14px; }
  .dialog__surface { padding: 12px; }
  .dialog__surface--compact { padding: 22px; }
  .dialog__actions { display: grid; grid-template-columns: 1fr 1fr; }
  .dialog__actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
