:root {
  --ink: #132238;
  --ink-muted: #56677d;
  --navy: #10233f;
  --navy-soft: #1d3a5c;
  --surface: #ffffff;
  --surface-soft: #f2f5f7;
  --line: #d7e0e8;
  --line-strong: #aebdcc;
  --lime: #dbff32;
  --lime-deep: #a7c900;
  --coral: #ff6b57;
  --water: #2b7fbd;
  --shadow: 0 18px 48px rgba(16, 35, 63, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--surface-soft);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--surface-soft);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface-soft);
}

button,
select {
  font: inherit;
}

button,
select,
.scene-card__preview {
  outline-offset: 3px;
}

button:focus-visible,
select:focus-visible {
  outline: 3px solid var(--water);
}

.shell {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
}

.topbar {
  height: 58px;
  color: #fff;
  background: var(--navy);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.topbar__inner {
  width: min(1480px, calc(100% - 48px));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand,
.topbar__status {
  display: flex;
  align-items: center;
}

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

.brand__mark {
  width: 13px;
  height: 13px;
  background: var(--lime);
  box-shadow: 5px 5px 0 var(--coral);
}

.brand__name {
  font-size: 15px;
  font-weight: 800;
}

.brand__divider {
  width: 1px;
  height: 18px;
  margin: 0 3px;
  background: rgba(255, 255, 255, 0.28);
}

.brand__context {
  overflow: hidden;
  color: #b9c8d8;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__status {
  flex: 0 0 auto;
  gap: 8px;
  color: #c8d4e0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
}

.intro-band {
  color: #fff;
  background: var(--navy-soft);
}

.intro {
  min-height: 174px;
  padding: 36px 0 32px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--lime-deep);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.intro .eyebrow {
  color: var(--lime);
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: 38px;
  line-height: 1.06;
  letter-spacing: 0;
}

.intro__meta {
  margin: 13px 0 0;
  color: #c6d3df;
  font-size: 14px;
}

.selection-summary {
  min-width: 280px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 9px;
  row-gap: 12px;
}

.selection-summary__value {
  color: var(--lime);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 40px;
  line-height: 1;
}

.selection-summary__label {
  color: #c6d3df;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.selection-summary .button {
  grid-column: 1 / -1;
}

.button {
  min-height: 40px;
  padding: 9px 15px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.button--primary {
  color: var(--navy);
  background: var(--lime);
  border-color: var(--lime);
}

.button--primary:hover:not(:disabled) {
  background: #e6ff6f;
}

.button--secondary {
  color: #fff;
  background: transparent;
  border-color: #7088a3;
}

.button--secondary:hover:not(:disabled) {
  border-color: var(--lime);
}

.controls-band {
  position: sticky;
  z-index: 10;
  top: 0;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.controls {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.filter-group {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.filter {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 11px;
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.filter span {
  margin-left: 4px;
  color: #8392a3;
  font-size: 11px;
}

.filter:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.filter.is-active {
  color: var(--navy);
  background: var(--lime);
  border-color: var(--lime-deep);
}

.filter.is-active span {
  color: #536300;
}

.sort-control {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.sort-control select {
  min-width: 184px;
  min-height: 38px;
  padding: 7px 34px 7px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.gallery-band {
  padding: 32px 0 72px;
}

.gallery-heading {
  margin-bottom: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
}

.gallery-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  font-weight: 500;
}

.gallery-heading p {
  margin: 5px 0 0;
  color: var(--ink-muted);
  font-size: 13px;
}

.legend {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--ink-muted);
  font-size: 12px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.legend__swatch {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 50%;
}

.legend__swatch--recommended {
  background: var(--lime-deep);
}

.legend__swatch--experimental {
  background: var(--coral);
}

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

.scene-card {
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(16, 35, 63, 0.04);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.scene-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 12px 28px rgba(16, 35, 63, 0.12);
  transform: translateY(-2px);
}

.scene-card.is-selected {
  border-color: var(--lime-deep);
  box-shadow: 0 0 0 2px rgba(167, 201, 0, 0.2);
}

.scene-card__preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  padding: 0;
  overflow: hidden;
  cursor: zoom-in;
  background: #dce5eb;
  border: 0;
  border-radius: 0;
}

.scene-card__preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  image-rendering: auto;
  transition: transform 220ms ease;
}

.scene-card:hover .scene-card__preview img {
  transform: scale(1.018);
}

.scene-card__zoom {
  position: absolute;
  right: 9px;
  bottom: 9px;
  padding: 5px 8px;
  color: #fff;
  background: rgba(16, 35, 63, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 150ms ease;
}

.scene-card__preview:hover .scene-card__zoom,
.scene-card__preview:focus-visible .scene-card__zoom {
  opacity: 1;
}

.scene-card__body {
  min-height: 190px;
  padding: 15px;
  display: flex;
  flex-direction: column;
}

.scene-card__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.scene-card__heading > div {
  min-width: 0;
}

.scene-card__source {
  margin: 0 0 4px;
  color: var(--ink-muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.scene-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.22;
}

.select-button {
  flex: 0 0 auto;
  min-width: 64px;
  min-height: 30px;
  padding: 5px 9px;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.select-button:hover {
  border-color: var(--lime-deep);
}

.select-button[aria-pressed="true"] {
  background: var(--lime);
  border-color: var(--lime-deep);
}

.scene-card__description {
  margin: 10px 0 16px;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.45;
}

.scene-card__footer {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.tags {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  padding: 4px 6px;
  color: #486077;
  background: #edf2f5;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.tag--water {
  color: #12527e;
  background: #dceefa;
}

.candidate-status {
  flex: 0 0 auto;
  padding-left: 8px;
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
}

.candidate-status--recommended {
  color: #6c8100;
}

.candidate-status--experimental {
  color: #ba4133;
}

.empty-state {
  padding: 72px 24px;
  color: var(--ink-muted);
  text-align: center;
  border: 1px dashed var(--line-strong);
}

.preview-dialog {
  width: min(1040px, calc(100% - 40px));
  max-height: calc(100vh - 40px);
  padding: 0;
  overflow: auto;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.preview-dialog::backdrop {
  background: rgba(8, 23, 39, 0.78);
}

.dialog-close {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #fff;
  background: rgba(16, 35, 63, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
}

.dialog-media {
  background: #0d1e31;
}

.dialog-media img {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: contain;
}

.dialog-details {
  padding: 22px 24px 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
}

.dialog-details > div {
  min-width: 0;
}

.dialog-details h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 500;
}

.dialog-details p:last-child {
  margin: 8px 0 0;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  z-index: 30;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100% - 40px));
  padding: 11px 14px;
  color: #fff;
  background: var(--navy);
  border-left: 4px solid var(--lime);
  border-radius: 4px;
  box-shadow: var(--shadow);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .scene-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .shell,
  .topbar__inner {
    width: min(100% - 32px, 1480px);
  }

  .intro {
    align-items: flex-start;
  }

  .selection-summary {
    min-width: 210px;
  }

  .controls {
    padding: 10px 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .filter-group {
    width: 100%;
  }

  .sort-control {
    width: 100%;
    justify-content: space-between;
  }

  .sort-control select {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 320px;
  }

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

@media (max-width: 620px) {
  .shell,
  .topbar__inner {
    width: min(100% - 24px, 1480px);
  }

  .brand__context,
  .topbar__status {
    display: none;
  }

  .intro {
    min-height: 0;
    padding: 28px 0;
    align-items: stretch;
    flex-direction: column;
    gap: 26px;
  }

  h1 {
    font-size: 31px;
  }

  .selection-summary {
    min-width: 0;
    grid-template-columns: auto 1fr auto;
  }

  .selection-summary .button {
    grid-column: auto;
  }

  .gallery-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

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

  .scene-card__body {
    min-height: 168px;
  }

  .dialog-details {
    align-items: stretch;
    flex-direction: column;
  }

  .dialog-details .button {
    width: 100%;
  }
}

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