:root {
  color-scheme: light;
  --page: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f2f2f2;
  --surface-strong: #f8f8f8;
  --ink: #0f0f0f;
  --muted: #606060;
  --line: #e5e5e5;
  --accent: #b3265f;
  --accent-strong: #921a4b;
  --accent-soft: #f8e8f0;
  --ok: #087f5b;
  --warn: #996500;
  --bad: #c1121f;
  --rail-width: 88px;
  --topbar-height: 64px;
  font-family:
    Inter, Roboto, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(210px, 280px) minmax(260px, 760px) minmax(220px, 1fr);
  align-items: center;
  gap: 24px;
  height: var(--topbar-height);
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.brand-cluster,
.top-actions,
.brand-link,
.create-chip,
.rail-link,
.pane-head,
.job-top,
.feed-meta,
.account-hero,
.account-actions {
  display: flex;
  align-items: center;
}

.brand-cluster {
  gap: 18px;
  min-width: 0;
}

.menu-button,
.round-action,
.icon-button {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}

.menu-button {
  width: 40px;
  height: 40px;
  gap: 4px;
}

.menu-button span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: var(--ink);
}

.menu-button:hover,
.round-action:hover,
.icon-button:hover,
.rail-link:hover,
.create-chip:hover,
.secondary-button:hover {
  background: var(--surface-soft);
}

.brand-link {
  gap: 8px;
  min-width: 0;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-link img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
}

.search-box {
  display: grid;
  grid-template-columns: 1fr 64px;
  width: min(100%, 760px);
  justify-self: center;
  height: 44px;
}

.search-box input {
  min-width: 0;
  padding: 0 22px;
  border: 1px solid #d3d3d3;
  border-right: 0;
  border-radius: 999px 0 0 999px;
  color: var(--ink);
  background: #ffffff;
  font-size: 1rem;
  outline: none;
}

.search-box input:focus {
  border-color: #9f9f9f;
}

.search-box button {
  position: relative;
  border: 1px solid #d3d3d3;
  border-radius: 0 999px 999px 0;
  background: #f8f8f8;
  cursor: pointer;
}

.search-box button span {
  position: absolute;
  inset: 11px 20px 15px 18px;
  border: 3px solid var(--ink);
  border-radius: 50%;
}

.search-box button span::after {
  position: absolute;
  right: -8px;
  bottom: -6px;
  width: 10px;
  height: 3px;
  border-radius: 999px;
  background: var(--ink);
  content: "";
  transform: rotate(45deg);
}

.top-actions {
  justify-content: end;
  gap: 12px;
  min-width: 0;
}

.create-chip {
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--surface-soft);
  font-weight: 800;
}

.create-chip span {
  font-size: 1.65rem;
  line-height: 0;
}

.round-action {
  position: relative;
  width: 42px;
  height: 42px;
}

.round-action span {
  width: 18px;
  height: 20px;
  border: 2px solid var(--ink);
  border-radius: 10px 10px 7px 7px;
}

.round-action span::before {
  position: absolute;
  top: 9px;
  left: 19px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink);
  content: "";
}

.round-action span::after {
  position: absolute;
  bottom: 8px;
  left: 18px;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: var(--ink);
  content: "";
}

.avatar-button,
.large-avatar {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: var(--accent);
  font-weight: 900;
  cursor: pointer;
}

.avatar-button {
  width: 42px;
  height: 42px;
  font-size: 1rem;
}

.side-rail {
  position: fixed;
  z-index: 15;
  top: var(--topbar-height);
  bottom: 0;
  left: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  width: var(--rail-width);
  padding: 12px 8px;
  background: #ffffff;
}

.rail-link {
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  height: 76px;
  border-radius: 10px;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 700;
}

.rail-link.is-active {
  background: var(--surface-soft);
}

.rail-icon {
  position: relative;
  display: block;
  width: 28px;
  height: 28px;
}

.home-icon::before {
  position: absolute;
  inset: 7px 4px 3px;
  border-radius: 3px;
  background: var(--ink);
  content: "";
}

.home-icon::after {
  position: absolute;
  top: 1px;
  left: 4px;
  width: 19px;
  height: 19px;
  background: var(--ink);
  content: "";
  transform: rotate(45deg);
}

.create-icon {
  border: 2px solid var(--ink);
  border-radius: 8px;
}

.create-icon::before,
.create-icon::after {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 999px;
  background: var(--ink);
  content: "";
  transform: translate(-50%, -50%);
}

.create-icon::before {
  width: 14px;
  height: 2px;
}

.create-icon::after {
  width: 2px;
  height: 14px;
}

.you-icon {
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.you-icon::before {
  position: absolute;
  top: 6px;
  left: 9px;
  width: 7px;
  height: 7px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  content: "";
}

.you-icon::after {
  position: absolute;
  right: 5px;
  bottom: 5px;
  left: 5px;
  height: 9px;
  border: 2px solid var(--ink);
  border-radius: 999px 999px 0 0;
  border-bottom: 0;
  content: "";
}

.app-main {
  min-height: 100vh;
  padding: calc(var(--topbar-height) + 18px) 28px 44px calc(var(--rail-width) + 24px);
}

.app-view[hidden] {
  display: none;
}

.home-browse {
  display: grid;
  gap: 24px;
}

.chip-row {
  position: sticky;
  top: var(--topbar-height);
  z-index: 10;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 0 0 8px;
  background: #ffffff;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface-soft);
  font-weight: 800;
  cursor: pointer;
}

.filter-chip.is-active {
  color: #ffffff;
  background: var(--ink);
}

.feed-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 34px 24px;
}

.feed-card {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.feed-link {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.feed-thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: #0f0f0f;
}

.feed-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #0f0f0f;
}

.feed-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #ffffff;
  background:
    radial-gradient(circle at 28% 24%, rgba(179, 38, 95, 0.48), transparent 34%),
    linear-gradient(135deg, #151515, #323232);
}

.feed-placeholder img {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  object-fit: cover;
  opacity: 0.86;
}

.thumb-status {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 7px;
  border-radius: 6px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.82);
  font-size: 0.74rem;
  font-weight: 900;
}

.feed-meta {
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.channel-avatar {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-soft);
}

.feed-copy {
  min-width: 0;
}

.feed-title,
.job-name {
  overflow-wrap: anywhere;
  font-weight: 850;
}

.feed-title {
  display: -webkit-box;
  margin: 0 0 5px;
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.feed-subtitle,
.feed-detail,
.drop-copy,
.status-text,
.job-meta,
.empty-preview,
.panel-copy,
.account-card p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.feed-subtitle,
.feed-detail {
  margin: 0;
}

.feed-empty,
.empty-preview {
  display: grid;
  min-height: 320px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: #ffffff;
}

.create-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(320px, 430px) minmax(440px, 1fr);
  align-items: start;
  gap: 24px;
  min-height: calc(100vh - var(--topbar-height) - 62px);
}

.create-panel,
.account-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.create-panel {
  padding: 22px;
}

.upload-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  min-height: 560px;
  background: var(--surface-strong);
}

.queue-panel,
.preview-panel {
  display: flex;
  flex-direction: column;
  min-height: 560px;
  max-height: calc(100vh - var(--topbar-height) - 62px);
}

.preview-panel {
  background: #fbfbfb;
}

.preview-content {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 18px;
}

.panel-heading {
  display: grid;
  gap: 10px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: 0;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.2rem;
}

.panel-copy {
  margin: 0;
}

.upload-form {
  display: grid;
  gap: 14px;
}

.drop-zone {
  display: grid;
  gap: 9px;
  min-height: 220px;
  align-content: center;
  padding: 22px;
  border: 1px dashed #bbbbbb;
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    background 140ms ease;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.drop-zone:hover {
  border-color: var(--accent);
  background: #fff8fb;
}

.upload-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 10px;
  color: #ffffff;
  background: var(--accent);
  font-size: 0.82rem;
  font-weight: 900;
}

.drop-title {
  font-weight: 850;
}

.primary-button,
.secondary-button,
.download-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 850;
  text-decoration: none;
}

.primary-button {
  padding: 0 18px;
  color: #ffffff;
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled {
  cursor: wait;
  background: #a9a9a9;
}

.secondary-button,
.download-link {
  padding: 0 16px;
  color: var(--ink);
  background: var(--surface-soft);
}

.pane-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.icon-button {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
}

.icon-button span,
.icon-button span::before,
.icon-button span::after {
  position: absolute;
  border-radius: 999px;
  background: var(--ink);
  content: "";
}

.icon-button span {
  width: 18px;
  height: 2px;
  transform: rotate(-35deg);
}

.icon-button span::before {
  top: -7px;
  right: -2px;
  width: 11px;
  height: 2px;
  transform: rotate(68deg);
}

.icon-button span::after {
  top: 5px;
  left: -2px;
  width: 11px;
  height: 2px;
  transform: rotate(68deg);
}

.jobs-list {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.job-card {
  display: grid;
  width: 100%;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
  background: #ffffff;
  cursor: pointer;
}

.job-card:hover {
  border-color: #bdbdbd;
  background: #fcfcfc;
}

.job-top {
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: #303030;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.badge.completed {
  color: var(--ok);
  background: #dff7ec;
}

.badge.processing,
.badge.queued {
  color: var(--warn);
  background: #fff4d6;
}

.badge.failed {
  color: var(--bad);
  background: #ffe3e7;
}

.progress {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.video-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 12px;
  background: #0f0f0f;
}

.account-shell {
  display: grid;
  gap: 28px;
  max-width: 1120px;
}

.account-hero {
  gap: 18px;
  padding: 16px 0 6px;
}

.large-avatar {
  width: 84px;
  height: 84px;
  font-size: 2rem;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 18px;
}

.account-card {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.account-card h2,
.account-card p {
  margin: 0;
}

.auth-card > div {
  display: grid;
  gap: 14px;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.auth-form input {
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

.auth-form input:focus {
  border-color: #9f9f9f;
}

.upload-form.is-auth-disabled {
  opacity: 0.62;
}

.upload-form.is-auth-disabled .drop-zone {
  cursor: default;
}

.account-actions {
  flex-wrap: wrap;
  gap: 10px;
}

.hidden {
  display: none;
}

@media (max-width: 1220px) {
  .topbar {
    grid-template-columns: minmax(180px, 240px) minmax(240px, 1fr) auto;
  }

  .feed-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }

  .create-layout {
    grid-template-columns: minmax(280px, 360px) minmax(360px, 1fr);
  }

  .preview-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  :root {
    --rail-width: 0px;
    --topbar-height: 58px;
  }

  .topbar {
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 0 12px;
  }

  .brand-cluster {
    gap: 8px;
  }

  .search-box {
    order: 3;
    grid-column: 1 / -1;
    width: 100%;
    height: 40px;
    margin-bottom: 8px;
  }

  .topbar {
    height: 112px;
  }

  .side-rail {
    top: auto;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: auto;
    height: 72px;
    padding: 6px 10px;
    border-top: 1px solid var(--line);
  }

  .rail-link {
    height: 58px;
    font-size: 0.72rem;
  }

  .app-main {
    padding: 124px 12px 92px;
  }

  .chip-row {
    top: 112px;
  }

  .feed-grid,
  .create-layout,
  .account-grid {
    grid-template-columns: 1fr;
  }

  .create-panel {
    padding: 18px;
  }

  .upload-panel,
  .queue-panel,
  .preview-panel {
    min-height: auto;
    max-height: none;
  }

  h1 {
    font-size: 1.6rem;
  }
}

@media (max-width: 560px) {
  .brand-link span {
    display: none;
  }

  .create-chip {
    min-height: 38px;
    padding: 0 12px;
  }

  .round-action {
    display: none;
  }

  .feed-grid {
    gap: 26px;
  }

  .feed-thumb,
  .video-preview {
    border-radius: 10px;
  }
}
