:root {
  color-scheme: dark;
  --bg: #101419;
  --bg-soft: #161c22;
  --panel: rgba(23, 29, 35, 0.82);
  --panel-strong: rgba(31, 38, 45, 0.96);
  --line: rgba(232, 238, 242, 0.14);
  --line-strong: rgba(232, 238, 242, 0.26);
  --text: #f2f5f2;
  --muted: #aeb8b7;
  --quiet: #788687;
  --gold: #e5b866;
  --teal: #6ec7bd;
  --sage: #8fb58b;
  --rose: #d87b72;
  --blue: #8fb8e8;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 18% 8%, rgba(229, 184, 102, 0.11), transparent 28rem),
    radial-gradient(circle at 86% 18%, rgba(110, 199, 189, 0.12), transparent 30rem),
    linear-gradient(135deg, #0f1216 0%, #151b20 45%, #101419 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

button,
a {
  font: inherit;
}

.gallery-shell {
  display: grid;
  grid-template-columns: minmax(300px, 24rem) minmax(0, 1fr);
  gap: 14px;
  height: 100svh;
  min-height: 0;
  padding: 14px;
}

.collection-pane,
.viewer-pane {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(128%);
}

.collection-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  border-radius: 8px;
  padding: 14px;
}

.viewer-pane {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  border-radius: 8px;
  padding: 14px;
}

.masthead,
.viewer-topline,
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow,
.selected-provider,
.model-provider,
.card-date,
.meta-label,
.poster-caption,
.timeline-label,
.prompt-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-top: 5px;
  font-size: clamp(1.55rem, 2.2vw, 2.35rem);
}

h2 {
  margin-top: 6px;
  font-size: clamp(1.35rem, 2.2vw, 2.55rem);
}

h3 {
  margin-top: 5px;
  font-size: clamp(1.35rem, 2.2vw, 2.35rem);
}

.count-pill,
.issue-badge,
.filter-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.count-pill {
  flex: 0 0 auto;
  padding: 7px 10px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
}

.prompt-panel {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid rgba(229, 184, 102, 0.25);
  border-radius: 8px;
  background: rgba(229, 184, 102, 0.075);
}

.prompt-panel p {
  margin: 0;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.45;
}

.prompt-panel a {
  color: inherit;
  text-decoration-color: rgba(229, 184, 102, 0.55);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.prompt-panel a:hover,
.prompt-panel a:focus-visible {
  color: #ffe2a4;
  outline: none;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 2px;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  cursor: pointer;
}

.filter-chip:hover,
.filter-chip.active {
  border-color: rgba(110, 199, 189, 0.54);
  color: var(--text);
  background: rgba(110, 199, 189, 0.12);
}

.model-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}

.model-card {
  position: relative;
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  min-height: 128px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.model-card:hover,
.model-card:focus-visible,
.model-card.active {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.078);
  transform: translateY(-1px);
  outline: none;
}

.model-card.active {
  box-shadow: inset 0 0 0 1px rgba(229, 184, 102, 0.42);
}

.provider-mark {
  width: 5px;
  height: 100%;
  border-radius: 999px;
  background: var(--provider-color, var(--teal));
}

.card-copy,
.card-top > span:first-child {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.model-name {
  overflow-wrap: anywhere;
  font-size: 1rem;
  font-weight: 780;
  line-height: 1.1;
}

.issue-badge {
  display: none;
  flex: 0 0 auto;
  padding: 5px 7px;
  color: #dff9ef;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(143, 181, 139, 0.15);
  border-color: rgba(143, 181, 139, 0.46);
}

.model-card.has-label .issue-badge {
  display: inline-flex;
}

.model-card.has-errors .issue-badge {
  color: #ffd8d3;
  background: rgba(216, 123, 114, 0.14);
  border-color: rgba(216, 123, 114, 0.44);
}

.card-strip,
.timeline-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.thumb,
.timeline-shot,
.poster-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, rgba(229, 184, 102, 0.16), rgba(110, 199, 189, 0.12) 55%, rgba(143, 184, 232, 0.14));
}

.thumb {
  aspect-ratio: 16 / 9;
  border-radius: 6px;
}

.thumb img,
.timeline-shot img,
.poster-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb img.missing,
.timeline-shot img.missing,
.poster-wrap img.missing {
  opacity: 0;
}

.viewer-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: rgba(229, 184, 102, 0.5);
  background: rgba(229, 184, 102, 0.11);
  outline: none;
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.meta-item {
  min-width: 0;
  min-height: 54px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.meta-value {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.25;
}

.meta-value a {
  color: var(--gold);
  text-decoration-color: rgba(229, 184, 102, 0.45);
  text-underline-offset: 3px;
}

.media-stage {
  display: grid;
  height: 100%;
  min-height: 0;
}

.preview-frame {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #050708;
}

.preview-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #050708;
}

.poster-wrap,
.timeline-shot {
  border-radius: 8px;
}

.poster-wrap {
  aspect-ratio: 16 / 9;
}

.poster-caption,
.timeline-label {
  position: absolute;
  left: 8px;
  bottom: 7px;
  padding: 4px 6px;
  border-radius: 5px;
  background: rgba(5, 7, 8, 0.72);
  color: var(--text);
}

.timeline-shot {
  aspect-ratio: 16 / 9;
}

.source-note {
  color: var(--quiet);
}

.screenshot-dialog {
  width: min(1180px, calc(100vw - 34px));
  max-width: none;
  height: min(860px, calc(100svh - 34px));
  max-height: none;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(18, 22, 27, 0.96);
  color: var(--text);
  box-shadow: var(--shadow);
}

.screenshot-dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(4px);
}

.dialog-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dialog-gallery {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 10px;
  height: calc(100% - 62px);
  min-height: 0;
}

.dialog-gallery a {
  display: block;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050708;
  color: inherit;
  text-decoration: none;
}

.dialog-gallery img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dialog-poster {
  position: relative;
}

.dialog-strip {
  display: grid;
  gap: 10px;
  overflow: auto;
}

.dialog-shot {
  position: relative;
  aspect-ratio: 16 / 9;
}

@media (max-width: 1050px) {
  body {
    overflow: auto;
  }

  .gallery-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100svh;
  }

  .collection-pane {
    max-height: none;
  }

  .model-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .viewer-pane {
    grid-template-rows: auto auto auto;
  }

  .preview-frame {
    min-height: min(72svh, 620px);
  }
}

@media (max-width: 720px) {
  .gallery-shell {
    padding: 10px;
  }

  .collection-pane,
  .viewer-pane {
    padding: 12px;
  }

  .masthead,
  .viewer-topline,
  .media-stage {
    grid-template-columns: 1fr;
  }

  .viewer-topline {
    display: grid;
  }

  .model-list,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .preview-frame {
    min-height: 62svh;
  }

  .dialog-gallery {
    grid-template-columns: 1fr;
    height: auto;
  }

  .screenshot-dialog {
    height: calc(100svh - 20px);
    width: calc(100vw - 20px);
    overflow: auto;
  }

  .dialog-poster,
  .dialog-shot {
    aspect-ratio: 16 / 9;
  }

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