:root {
  color-scheme: light;
  --ink: #17191c;
  --muted: #666b72;
  --line: #d9dce0;
  --soft: #f2f3f4;
  --paper: #ffffff;
  --accent: #d9442f;
  --accent-dark: #a82d1e;
  --seedance: #196b57;
  --kling: #a24b16;
  --shadow: 0 12px 34px rgba(20, 23, 27, 0.14);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--soft);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 82px;
  padding: 14px max(24px, calc((100vw - 1480px) / 2));
  color: #fff;
  background: #202327;
  border-bottom: 3px solid var(--accent);
}

.title-block {
  min-width: 240px;
}

.eyebrow {
  margin: 0 0 3px;
  color: #f09d8f;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 680;
}

.summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 22px;
  color: #c8cbd0;
  font-size: 12px;
  white-space: nowrap;
}

.summary strong {
  margin-right: 3px;
  color: #fff;
  font-size: 14px;
}

.local-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #d4f0e7;
}

.local-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #57c99d;
  box-shadow: 0 0 0 3px rgba(87, 201, 157, 0.16);
}

main {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
  padding: 20px 0 44px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.search-field {
  position: relative;
  display: block;
  width: min(460px, 50vw);
}

.search-field input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 39px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 5px;
  outline: none;
}

.search-field input:focus {
  border-color: #737981;
  box-shadow: 0 0 0 3px rgba(56, 62, 69, 0.1);
}

.search-icon {
  position: absolute;
  top: 12px;
  left: 14px;
  width: 14px;
  height: 14px;
  border: 2px solid #747a81;
  border-radius: 50%;
  pointer-events: none;
}

.search-icon::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 6px;
  height: 2px;
  background: #747a81;
  transform: rotate(45deg);
  transform-origin: left center;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, auto);
  padding: 3px;
  background: #e2e4e6;
  border-radius: 6px;
}

.segmented button {
  min-height: 34px;
  padding: 0 13px;
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.segmented button span {
  margin-left: 4px;
  color: #7c8188;
  font-size: 11px;
}

.segmented button.active {
  background: var(--paper);
  box-shadow: 0 1px 3px rgba(23, 25, 28, 0.16);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.video-card {
  min-width: 0;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.video-card:hover {
  border-color: #a9adb3;
  box-shadow: 0 8px 22px rgba(22, 25, 29, 0.09);
  transform: translateY(-1px);
}

.media-launch {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #1a1c1f;
  border: 0;
  cursor: pointer;
}

.media-launch img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 220ms ease, opacity 150ms ease;
}

.video-card:hover .media-launch img {
  transform: scale(1.012);
  opacity: 0.91;
}

.play-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding-left: 3px;
  color: #fff;
  background: rgba(23, 25, 28, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  font-size: 17px;
  line-height: 1;
}

.card-number {
  position: absolute;
  top: 10px;
  left: 10px;
  min-width: 31px;
  padding: 5px 7px;
  color: #fff;
  background: rgba(23, 25, 28, 0.82);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 750;
  text-align: center;
}

.card-content {
  padding: 13px 14px 14px;
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
}

.card-heading h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
}

.model-badge {
  flex: 0 0 auto;
  margin-top: 1px;
  padding: 3px 6px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.model-badge.seedance {
  color: var(--seedance);
  background: #eef8f4;
}

.model-badge.kling {
  color: var(--kling);
  background: #fff5ec;
}

.card-prompt {
  display: -webkit-box;
  min-height: 42px;
  margin: 9px 0 12px;
  overflow: hidden;
  color: #555b62;
  font-size: 12px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
  color: #7a8087;
  border-top: 1px solid #eceef0;
  font-size: 10px;
  font-weight: 650;
}

.empty-state {
  margin: 80px 0;
  color: var(--muted);
  text-align: center;
}

.viewer {
  width: min(1160px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.viewer::backdrop {
  background: rgba(14, 16, 19, 0.76);
  backdrop-filter: blur(3px);
}

.viewer-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.viewer-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.viewer-index {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.viewer-bar h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0 0 3px;
  color: #555b62;
  background: #f2f3f4;
  border: 1px solid #d7dade;
  border-radius: 5px;
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
}

.video-stage {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 320px;
  max-height: 64vh;
  background: #0f1113;
}

.video-stage video {
  display: block;
  width: 100%;
  max-height: 64vh;
  background: #0f1113;
  object-fit: contain;
}

.viewer-details {
  min-width: 0;
  padding: 16px 18px 18px;
}

.viewer-prompt {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.5;
}

.viewer-details dl {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 26px;
  margin: 0;
}

.viewer-details dl div {
  display: flex;
  gap: 6px;
}

.viewer-details dt {
  color: var(--muted);
  font-size: 11px;
}

.viewer-details dd {
  margin: 0;
  font-size: 11px;
  font-weight: 650;
}

.viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 18px 18px 0;
}

.viewer-actions button {
  height: 36px;
  padding: 0 15px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.secondary-command {
  background: #fff;
  border: 1px solid #c9cdd2;
}

.primary-command {
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
}

.primary-command:hover {
  background: var(--accent-dark);
}

@media (max-width: 980px) {
  .summary span:not(.local-status) {
    display: none;
  }

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 660px) {
  .topbar {
    position: static;
    min-height: 70px;
    padding: 12px 16px;
  }

  h1 {
    font-size: 18px;
  }

  .local-status {
    font-size: 10px;
  }

  main {
    width: calc(100% - 24px);
    padding-top: 12px;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .search-field {
    width: 100%;
  }

  .segmented {
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
  }

  .segmented button {
    padding: 0 7px;
  }

  .gallery {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .viewer {
    width: 100vw;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .viewer-shell {
    grid-template-columns: 1fr;
  }

  .video-stage {
    min-height: 220px;
  }

  .viewer-actions {
    padding: 0 18px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
