:root {
  color-scheme: dark;
  --bg: #100f0d;
  --panel: #1b1713;
  --text: #fff7e8;
  --muted: #b9aa92;
  --line: rgba(255, 247, 232, 0.16);
  --gold: #e6c16e;
  --shadow: rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(230, 193, 110, 0.16), transparent 28rem),
    linear-gradient(135deg, #100f0d 0%, #17110d 42%, #0d1113 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

.wall {
  width: min(1680px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 72px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 430px);
  gap: 28px;
  align-items: end;
  padding: 0 0 28px;
  border-bottom: 1px solid var(--line);
}

.hero > * {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 5.2vw, 5.75rem);
  font-weight: 500;
  line-height: 0.98;
}

.subtitle,
.generated {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.user-form {
  display: grid;
  gap: 10px;
  max-width: 720px;
  margin-top: 18px;
}

.user-form label {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.user-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.user-form input,
.user-form button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
}

.user-form input {
  width: 100%;
  padding: 0 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  outline: none;
}

.user-form input::placeholder {
  color: rgba(185, 170, 146, 0.75);
}

.user-form input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(230, 193, 110, 0.18);
}

.user-form button {
  padding: 0 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.user-form button[type="submit"] {
  color: #130f0b;
  border-color: transparent;
  background: var(--gold);
}

.user-form button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.stat {
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.stat strong {
  display: block;
  margin-top: 12px;
  color: var(--accent);
  font-size: 2rem;
  line-height: 1;
}

.controls {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  gap: 10px;
  margin: 0 -1px 22px;
  padding: 14px 1px 16px;
  background: linear-gradient(180deg, rgba(16, 15, 13, 0.98), rgba(16, 15, 13, 0.86));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 247, 232, 0.08);
}

.filters,
.categories,
.layouts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.categories {
  flex-wrap: nowrap;
  margin-right: -16px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 16px 2px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.categories::-webkit-scrollbar {
  display: none;
}

.filter,
.category-button,
.layout-button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  font: inherit;
  cursor: pointer;
}

.category-button {
  --accent: var(--gold);
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.category-button span {
  color: color-mix(in srgb, var(--muted), transparent 18%);
  font-size: 0.76rem;
}

.layout-button {
  --accent: var(--gold);
  min-height: 36px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.filter[aria-pressed="true"],
.category-button[aria-pressed="true"],
.layout-button[aria-pressed="true"] {
  border-color: var(--accent);
  color: #130f0b;
  background: var(--accent);
}

.category-button[aria-pressed="true"] span {
  color: rgba(19, 15, 11, 0.72);
}

.empty {
  margin: 28px 0;
  padding: 22px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.gallery {
  column-width: 190px;
  column-gap: 18px;
  min-width: 0;
}

.gallery[data-layout="grid"],
.gallery[data-layout="compact"] {
  display: grid;
  column-width: auto;
}

.gallery[data-layout="grid"] {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}

.gallery[data-layout="compact"] {
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 12px;
}

.poster-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 18px;
  break-inside: avoid;
  vertical-align: top;
}

.gallery[data-layout="grid"] .poster-card,
.gallery[data-layout="compact"] .poster-card {
  display: block;
  margin: 0;
}

.poster-frame {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 247, 232, 0.14);
  background: var(--panel);
  box-shadow: 0 18px 40px var(--shadow);
  transition: transform 180ms ease, border-color 180ms ease;
}

.poster-card:hover .poster-frame {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.poster-frame img,
.poster-placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: linear-gradient(135deg, rgba(230, 193, 110, 0.28), rgba(226, 120, 79, 0.18));
}

.poster-placeholder {
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 2rem;
  font-family: Georgia, "Times New Roman", serif;
}

figcaption {
  padding: 12px;
}

.status {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
}

figcaption strong,
figcaption small,
.rating {
  display: block;
}

figcaption strong {
  font-size: 1rem;
  line-height: 1.35;
}

figcaption small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.35;
}

.rating {
  margin-top: 8px;
  color: var(--gold);
  font-size: 0.82rem;
}

.gallery[data-layout="compact"] figcaption {
  padding: 9px;
}

.gallery[data-layout="compact"] figcaption strong {
  font-size: 0.88rem;
}

.gallery[data-layout="compact"] figcaption small,
.gallery[data-layout="compact"] .rating {
  font-size: 0.74rem;
}

@media (max-width: 900px) {
  .wall {
    width: 100%;
    max-width: none;
    padding: 22px 11px 72px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .user-form-row {
    grid-template-columns: 1fr 1fr;
  }

  .user-form input {
    grid-column: 1 / -1;
  }

  h1 {
    font-size: 2.75rem;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 100%;
  }

  .stat {
    min-height: 72px;
    padding: 10px;
  }

  .stat strong {
    font-size: 1.45rem;
  }

  .gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    column-width: auto;
  }

  .gallery[data-layout="grid"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery[data-layout="compact"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .poster-card {
    display: block;
    margin: 0;
  }

  .gallery[data-layout="compact"] figcaption {
    padding: 7px;
  }

  .gallery[data-layout="compact"] figcaption strong {
    font-size: 0.78rem;
  }

  .gallery[data-layout="compact"] figcaption small {
    display: none;
  }
  .controls {
    gap: 8px;
    margin-bottom: 16px;
    padding-top: 10px;
  }
}

@media (max-width: 520px) {
  .wall {
    width: min(100%, 390px);
    margin: 0;
  }

  .user-form-row {
    grid-template-columns: 1fr;
  }

  .user-form button {
    width: 100%;
  }
}
