:root {
  --black: #111315;
  --dark: #24292f;
  --slate: #4c5563;
  --steel: #88919c;
  --light: #cbd1d8;
  --border: #e4e7ea;
  --surface: #f7f5f2;
  --white: #ffffff;
  --gold: #d6a85b;
  --green: #3f8f68;
  --red: #b8443f;
  --shadow: 0 14px 34px rgba(17, 19, 21, 0.08);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--black);
  background:
    linear-gradient(180deg, rgba(17, 19, 21, 0.05), rgba(17, 19, 21, 0) 240px),
    var(--surface);
  font-size: 16px;
  line-height: 1.5;
}

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

button,
select {
  cursor: pointer;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 8px;
  color: var(--dark);
  font-weight: 800;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 16px clamp(20px, 5vw, 64px);
  color: var(--black);
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(214, 168, 91, 0.28);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  min-width: 0;
  color: var(--black);
  text-decoration: none;
}

h1,
h2,
h3,
.brand-wordmark {
  font-family: Manrope, Inter, ui-sans-serif, system-ui, sans-serif;
}

.brand-logo {
  display: block;
  width: auto;
  height: 48px;
  object-fit: contain;
}

.brand-wordmark {
  display: flex;
  align-items: baseline;
  gap: 0.34em;
  color: var(--black);
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 0.95;
  white-space: nowrap;
}

.brand-wordmark span:last-child {
  color: var(--gold);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-actions a,
.nav-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  color: var(--slate);
  background: transparent;
  border: 0;
  text-decoration: none;
  border-radius: 10px;
  transition: color 180ms ease, background 180ms ease;
}

.nav-actions a:hover,
.nav-actions a:focus-visible,
.nav-button:hover,
.nav-button:focus-visible {
  color: var(--black);
  background: rgba(17, 19, 21, 0.06);
}

.account-button[data-signed-in="true"] {
  color: var(--black);
  background: rgba(214, 168, 91, 0.2);
}

.nav-button[data-active="true"] {
  color: var(--black);
  background: rgba(17, 19, 21, 0.08);
}

main {
  padding-bottom: 64px;
}

.catalog-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 32px;
  align-items: end;
  padding: 64px clamp(20px, 5vw, 64px) 40px;
}

.intro-copy {
  max-width: 780px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 0;
  font-size: clamp(2.45rem, 8vw, 5.75rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.5rem;
  line-height: 1.15;
}

.intro-stat {
  display: grid;
  gap: 18px;
  padding: 24px;
  color: var(--white);
  background: var(--black);
  border: 1px solid rgba(214, 168, 91, 0.42);
  border-radius: 14px;
}

.intro-stat span {
  display: block;
  color: var(--gold);
  font-family: Manrope, Inter, sans-serif;
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1;
}

.intro-stat small {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.72);
}

.search-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 24px clamp(20px, 5vw, 64px);
  background: rgba(255, 255, 255, 0.56);
  border-block: 1px solid var(--border);
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--dark);
  font-weight: 700;
}

.search-control {
  position: relative;
}

.search-form,
.toolbar {
  display: grid;
  align-content: end;
}

.toolbar::after {
  content: "";
  display: block;
  min-height: 22px;
  margin-top: 10px;
}

.search-control svg {
  position: absolute;
  top: 50%;
  left: 18px;
  width: 22px;
  height: 22px;
  color: var(--steel);
  transform: translateY(-50%);
  pointer-events: none;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  color: var(--black);
  background: var(--white);
  border: 1px solid var(--light);
  border-radius: 10px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input,
textarea {
  padding: 12px 14px;
}

.search-control input {
  min-height: 64px;
  padding-left: 56px;
  font-size: 1.16rem;
}

.search-feedback {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--slate);
  font-size: 0.92rem;
}

select {
  min-width: 190px;
  min-height: 64px;
  padding: 0 40px 0 14px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(214, 168, 91, 0.2);
}

.content-grid {
  scroll-margin-top: 96px;
  padding: 32px clamp(20px, 5vw, 64px) 0;
}

.request-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 390px), 1fr));
  gap: 24px;
}

.results-column {
  display: grid;
  gap: 24px;
}

.request-card {
  display: grid;
  grid-template-columns: 138px minmax(0, 1fr);
  gap: 24px;
  min-height: 238px;
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(17, 19, 21, 0.04);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.request-card:hover {
  border-color: rgba(214, 168, 91, 0.55);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.poster {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  aspect-ratio: 2 / 3;
  min-height: 190px;
  padding: 16px 14px;
  overflow: hidden;
  color: var(--white);
  background:
    linear-gradient(145deg, rgba(214, 168, 91, 0.18), rgba(17, 19, 21, 0.1)),
    var(--black);
  border: 1px solid rgba(17, 19, 21, 0.18);
  border-radius: 8px;
}

.poster-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster.has-poster::before {
  background: linear-gradient(180deg, rgba(17, 19, 21, 0.62), rgba(17, 19, 21, 0.1) 42%, rgba(17, 19, 21, 0.72));
  border: 0;
}

.poster.has-poster::after {
  display: none;
}

.poster.has-poster .poster-title {
  display: none;
}

.poster::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.poster::after {
  content: "";
  position: absolute;
  right: -26px;
  bottom: -42px;
  width: 122px;
  height: 122px;
  border: 1px solid rgba(214, 168, 91, 0.46);
  border-radius: 50%;
}

.poster-title {
  position: relative;
  z-index: 1;
}

.poster-title {
  font-family: Manrope, Inter, sans-serif;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.05;
}

.request-content {
  display: grid;
  gap: 14px;
  align-content: space-between;
  min-width: 0;
}

.demand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  min-height: 36px;
  margin-bottom: 10px;
  padding: 6px 12px;
  color: var(--black);
  background: rgba(214, 168, 91, 0.18);
  border: 1px solid rgba(214, 168, 91, 0.5);
  border-radius: 999px;
  font-weight: 800;
}

.demand-badge svg {
  width: 18px;
  height: 18px;
  color: var(--green);
}

.movie-title {
  margin-bottom: 2px;
  font-size: 1.45rem;
  line-height: 1.12;
}

.metadata,
.note,
.overview,
.form-message {
  color: var(--slate);
}

.metadata,
.note,
.overview {
  margin-bottom: 0;
}

.metadata {
  display: grid;
  gap: 3px;
}

.metadata-source {
  display: flex;
  align-items: center;
  min-height: 18px;
}

.metadata-tmdb-logo {
  display: block;
  width: auto;
  height: 14px;
  object-fit: contain;
}

.note,
.overview {
  display: -webkit-box;
  min-height: 48px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.primary-button,
.secondary-button,
.buy-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 14px 22px;
  color: var(--black);
  background: var(--gold);
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 800;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.buy-button:hover,
.icon-button:hover,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.buy-button:focus-visible,
.icon-button:focus-visible {
  background: #e1b76c;
  transform: translateY(-1px);
}

.secondary-button {
  color: var(--slate);
  background: var(--white);
  border-color: var(--light);
}

.secondary-button:hover,
.secondary-button:focus-visible {
  color: var(--black);
  background: var(--surface);
  border-color: var(--gold);
}

.buy-button[data-owned="true"] {
  color: var(--white);
  background: var(--green);
}

.primary-button:disabled,
.secondary-button:disabled,
.buy-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.icon-button {
  width: 44px;
  min-height: 44px;
  padding: 0;
  color: var(--slate);
  background: var(--white);
  border-color: var(--light);
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.tmdb-search-results {
  display: grid;
  gap: 18px;
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(17, 19, 21, 0.04);
}

.tmdb-search-results[hidden] {
  display: none;
}

.section-heading {
  display: grid;
  gap: 4px;
}

.helper-text {
  min-height: 22px;
  margin-bottom: 0;
  color: var(--slate);
  font-size: 0.92rem;
}

.helper-text[data-tone="success"] {
  color: var(--green);
  font-weight: 700;
}

.helper-text[data-tone="error"] {
  color: var(--red);
  font-weight: 700;
}

.tmdb-results-grid {
  display: grid;
  gap: 12px;
}

.tmdb-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  width: 100%;
  min-height: 122px;
  padding: 14px;
  color: var(--black);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.tmdb-card-poster {
  width: 72px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(214, 168, 91, 0.18), rgba(17, 19, 21, 0.1)),
    var(--black);
  border-radius: 8px;
}

.tmdb-card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tmdb-card-copy {
  min-width: 0;
}

.tmdb-card h3 {
  margin-bottom: 2px;
  font-size: 1.18rem;
  line-height: 1.15;
}

.tmdb-card .overview {
  margin-top: 8px;
}

.manual-request-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  background: var(--surface);
  border: 1px dashed rgba(214, 168, 91, 0.72);
  border-radius: 10px;
}

.manual-request-prompt[hidden] {
  display: none;
}

.manual-request-prompt h3 {
  margin-bottom: 4px;
  font-size: 1.12rem;
  line-height: 1.2;
}

.manual-request-prompt p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--slate);
}

.manual-request-prompt .secondary-button {
  flex: 0 0 auto;
}

.form-message {
  min-height: 24px;
  margin-bottom: 0;
}

.form-message[data-tone="success"] {
  color: var(--green);
  font-weight: 700;
}

.form-message[data-tone="error"] {
  color: var(--red);
  font-weight: 700;
}

.empty-state {
  padding: 32px;
  color: var(--slate);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.request-modal {
  width: min(100% - 32px, 560px);
  max-height: min(760px, calc(100vh - 32px));
  padding: 24px;
  overflow: auto;
  color: var(--black);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(17, 19, 21, 0.28);
}

.request-modal::backdrop {
  background: rgba(17, 19, 21, 0.56);
  backdrop-filter: blur(4px);
}

.request-modal[data-open="true"] {
  position: fixed;
  inset: 50% auto auto 50%;
  display: block;
  transform: translate(-50%, -50%);
}

.about-modal {
  width: min(100% - 32px, 760px);
}

.modal-heading,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.modal-heading {
  margin-bottom: 22px;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 4px;
}

.request-form {
  display: grid;
  gap: 16px;
}

.auth-copy {
  margin-bottom: 0;
  color: var(--slate);
}

.signed-in-panel {
  display: grid;
  gap: 16px;
}

.signed-in-panel[hidden] {
  display: none;
}

.about-copy {
  display: grid;
  gap: 14px;
  color: var(--dark);
}

.about-copy p {
  margin-bottom: 0;
}

.about-copy strong {
  color: var(--black);
}

input[readonly] {
  color: var(--dark);
  background: var(--surface);
}

@media (max-width: 960px) {
  .catalog-intro,
  .search-band {
    grid-template-columns: 1fr;
  }

  .intro-stat {
    position: static;
  }

  .toolbar {
    width: 100%;
  }

  .tmdb-card {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .tmdb-card .primary-button,
  .tmdb-card .secondary-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .manual-request-prompt {
    align-items: stretch;
    flex-direction: column;
  }

  .manual-request-prompt .secondary-button {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .site-header {
    align-items: center;
    gap: 12px;
  }

  .brand-logo {
    height: 40px;
  }

  .brand-wordmark {
    flex-direction: column;
    gap: 0;
    font-size: 1.12rem;
  }

  .nav-actions {
    width: auto;
  }

  .nav-actions a {
    justify-content: center;
  }

  .catalog-intro {
    padding-top: 40px;
  }

  .content-grid {
    scroll-margin-top: 82px;
  }

  .request-card {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 16px;
    padding: 16px;
  }

  .poster {
    min-height: 142px;
    padding: 12px 10px;
  }

  .poster-title {
    font-size: 0.9rem;
  }

  .movie-title {
    font-size: 1.2rem;
  }

  .note {
    display: none;
  }

  .overview {
    display: none;
  }

  .tmdb-card {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 14px;
    min-height: 0;
  }

  .tmdb-card-poster {
    width: 56px;
  }

  .buy-button,
  .modal-actions .primary-button,
  .modal-actions .secondary-button {
    width: 100%;
  }

  .modal-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }
}
