: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:
    linear-gradient(120deg, rgba(229, 184, 102, 0.07), transparent 34%),
    linear-gradient(300deg, rgba(110, 199, 189, 0.08), transparent 40%),
    #101419;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

button,
a,
input,
select {
  font: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.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,
.card-score,
.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 {
  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;
}

.masthead-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.share-grid-button {
  width: 34px;
  height: 34px;
}

.share-grid-button svg {
  width: 19px;
  height: 19px;
}

.prompt-panel {
  flex: 0 0 auto;
  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;
}

.browse-tools {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.search-control {
  position: relative;
  grid-column: 1 / -1;
  min-width: 0;
}

.search-control svg {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 17px;
  height: 17px;
  fill: var(--quiet);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-control input,
.sort-control select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  outline: none;
}

.search-control input {
  padding: 0 10px 0 36px;
}

.search-control input::placeholder {
  color: var(--quiet);
}

.sort-control select {
  padding: 0 30px 0 10px;
  cursor: pointer;
}

.search-control input:focus,
.sort-control select:focus {
  border-color: rgba(110, 199, 189, 0.58);
}

.sort-control option {
  color: #101419;
}

.empty-state {
  display: grid;
  min-height: 116px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
}

.model-list {
  flex: 1 1 auto;
  display: grid;
  min-height: 0;
  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;
}

.card-facts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.card-score {
  flex: 0 0 auto;
  color: var(--gold);
  font-weight: 800;
}

.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(6, 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,
.compare-dialog::backdrop,
.evaluation-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;
}

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

.evaluation-dialog {
  width: min(720px, calc(100vw - 34px));
  max-width: none;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(18, 22, 27, 0.98);
  color: var(--text);
  box-shadow: var(--shadow);
}

.evaluation-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.evaluation-summary > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.evaluation-summary p,
.evaluation-method {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.evaluation-score {
  color: var(--gold);
  font-size: 2rem;
  font-weight: 820;
}

.evaluation-tier {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 780;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.evaluation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.evaluation-dimension {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.evaluation-dimension-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
}

.evaluation-dimension-top strong {
  color: var(--gold);
}

.evaluation-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.evaluation-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

.evaluation-method {
  margin-top: 14px;
  font-size: 0.76rem;
}

.compare-topline {
  margin-bottom: 10px;
}

.compare-years {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 12px;
}

.compare-year {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  cursor: pointer;
}

.compare-year:hover,
.compare-year:focus-visible,
.compare-year.active {
  border-color: rgba(229, 184, 102, 0.55);
  background: rgba(229, 184, 102, 0.1);
  color: var(--text);
  outline: none;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 10px;
  height: calc(100% - 112px);
  overflow: auto;
  padding-right: 3px;
}

.compare-card {
  display: grid;
  align-content: start;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.compare-card:hover,
.compare-card:focus-visible {
  border-color: var(--provider-color);
  background: rgba(255, 255, 255, 0.075);
  outline: none;
}

.compare-image {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #050708;
}

.compare-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.compare-copy {
  display: grid;
  gap: 5px;
  padding: 10px;
}

.compare-name {
  font-weight: 760;
  line-height: 1.15;
}

.compare-meta {
  color: var(--muted);
  font-size: 0.76rem;
}

.compare-badge {
  justify-self: start;
  padding: 3px 6px;
  border: 1px solid rgba(143, 181, 139, 0.4);
  border-radius: 999px;
  color: #dff9ef;
  font-size: 0.65rem;
  font-weight: 760;
  text-transform: uppercase;
}

.compare-badge.error {
  border-color: rgba(216, 123, 114, 0.44);
  color: #ffd8d3;
}

@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 {
    display: flex;
    flex: 0 0 auto;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 5px;
    scroll-snap-type: x mandatory;
  }

  .model-card {
    flex: 0 0 min(340px, calc(100vw - 58px));
    scroll-snap-align: start;
  }

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

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

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

  .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;
  }

  .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;
  }

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

  .evaluation-dialog {
    width: calc(100vw - 20px);
  }

  .compare-grid {
    grid-template-columns: 1fr;
  }

  .evaluation-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 430px) {
  .browse-tools {
    grid-template-columns: 1fr;
  }

  .search-control {
    grid-column: auto;
  }

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