:root {
  color-scheme: dark;
  --bg: #101114;
  --surface: #181b21;
  --surface-2: #20242c;
  --text: #f7f2e8;
  --muted: #aaa59a;
  --line: #353943;
  --accent: #f2c94c;
  --accent-2: #5cc8a7;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(242, 201, 76, 0.08), transparent 38%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: var(--accent);
  color: #17130b;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small,
label,
.film-head p,
.overview,
.empty,
.stats span {
  color: var(--muted);
}

.hero {
  min-height: calc(100vh - 120px);
  display: grid;
  align-items: center;
  background:
    linear-gradient(90deg, rgba(16, 17, 20, 0.2), rgba(16, 17, 20, 0.7)),
    url("https://images.unsplash.com/photo-1489599849927-2ee91cede3ba?auto=format&fit=crop&w=1600&q=80") center / cover;
  border: 1px solid var(--line);
  padding: clamp(24px, 6vw, 74px);
}

.hero-copy {
  max-width: 720px;
}

.hero h1 {
  max-width: 620px;
  margin: 8px 0 24px;
  font-size: clamp(2.4rem, 7vw, 5rem);
  line-height: 0.94;
  letter-spacing: 0;
}

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

.create-form,
.proposal-form {
  display: grid;
  gap: 14px;
}

.create-form {
  max-width: 460px;
}

.saved-clubs {
  display: grid;
  gap: 10px;
  max-width: 560px;
  margin-top: 28px;
}

.saved-clubs h2 {
  margin: 0;
  font-size: 1rem;
}

.saved-club {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(16, 17, 20, 0.76);
  padding: 10px;
}

.saved-club strong,
.saved-club small {
  display: block;
}

.saved-club small {
  color: var(--muted);
}

.session-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.saved-club__actions,
.roulette-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.form-grid,
.manual-grid {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 0.82rem;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(16, 17, 20, 0.86);
  color: var(--text);
  padding: 11px 12px;
  text-transform: none;
  letter-spacing: 0;
}

textarea.input {
  min-height: 84px;
  resize: vertical;
}

.btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 14px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 800;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #15120b;
}

.btn-danger {
  color: var(--danger);
}

.btn-sm {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.86rem;
}

.icon-btn {
  width: 42px;
  padding: 0;
  font-size: 1.1rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stats div {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 16px;
}

.stats strong {
  display: block;
  font-size: 1.8rem;
}

.admin-tools,
.proposal-panel,
.empty,
.list-section {
  border: 1px solid var(--line);
  background: rgba(24, 27, 33, 0.82);
  padding: 16px;
  margin-bottom: 14px;
}

.admin-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.copy-row,
.search-row,
.tool-actions,
.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.copy-row {
  flex-wrap: nowrap;
}

.search-row {
  flex-wrap: nowrap;
}

.search-row .input {
  flex: 1 1 auto;
}

.search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

.search-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  padding: 8px;
  text-align: left;
  cursor: pointer;
}

.search-card img {
  width: 44px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: #111;
}

.search-card strong,
.search-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-card small {
  color: var(--muted);
}

.list-section h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 12px;
  font-size: 1.02rem;
}

.list-section h2 span {
  color: var(--accent);
}

.film-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.film-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  padding: 10px;
  min-width: 0;
}

.film-poster {
  width: 92px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: #111;
}

.film-body {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.film-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.film-head h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  line-height: 1.2;
}

.film-head p,
.comment,
.overview {
  margin: 0;
  font-size: 0.9rem;
}

.comment {
  color: var(--text);
}

.overview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-height: 1.45;
}

.status {
  flex: 0 0 auto;
  align-self: flex-start;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 0.76rem;
  color: var(--muted);
}

.status-approved .status,
.status-drawn .status {
  color: var(--accent-2);
}

.status-rejected {
  opacity: 0.65;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
}

.roulette {
  width: min(760px, 100%);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 14px;
  text-align: center;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.45);
  animation: pop 420ms cubic-bezier(0.2, 0.9, 0.2, 1);
  overflow: hidden;
}

.roulette:has(.roulette-window) {
  padding-bottom: 0;
}

.roulette-window {
  position: relative;
  overflow: hidden;
  height: 226px;
  margin: 10px -14px 0;
  padding: 10px 0;
  border-block: 1px solid var(--line);
  background:
    linear-gradient(90deg, var(--surface), transparent 16%, transparent 84%, var(--surface)),
    rgba(0, 0, 0, 0.18);
}

.roulette-pointer {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 50%;
  z-index: 2;
  width: 2px;
  transform: translateX(-50%);
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28), 0 0 18px rgba(242, 201, 76, 0.45);
}

.roulette-pointer::before,
.roulette-pointer::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-inline: 8px solid transparent;
}

.roulette-pointer::before {
  top: -1px;
  border-top: 10px solid var(--accent);
}

.roulette-pointer::after {
  bottom: -1px;
  border-bottom: 10px solid var(--accent);
}

.roulette-track {
  --roulette-offset: 0px;
  display: flex;
  gap: 14px;
  width: max-content;
  padding-left: max(50%, 360px);
  padding-right: max(50%, 360px);
  transform: translateX(0);
}

.roulette-track.is-spinning {
  animation: roulette-slide 6.5s cubic-bezier(0.06, 0.84, 0.05, 1) forwards;
}

.roulette-card {
  flex: 0 0 128px;
  width: 128px;
  display: grid;
  gap: 6px;
  align-content: start;
  transform: scale(0.92);
  opacity: 0.74;
  transition: transform 300ms ease, opacity 300ms ease;
}

.roulette-card img {
  width: 128px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #111;
}

.roulette-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
}

.roulette-card.is-winner {
  opacity: 1;
  transform: scale(1);
}

.roulette-result {
  display: none;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  max-width: 760px;
  margin: 18px auto 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 280ms ease, transform 280ms ease;
  pointer-events: none;
}

.roulette-result.is-visible {
  display: grid;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.roulette h2 {
  margin: 0 0 6px;
}

.roulette-result__poster {
  width: 150px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #111;
}

.roulette-result__body {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.roulette-result__body .eyebrow,
.roulette-result__body h2,
.roulette-result__body p {
  margin: 0;
}

.roulette-result__meta {
  color: var(--muted);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes roulette-slide {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(calc(var(--roulette-offset) * -1));
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: 100%;
    padding: 10px 10px 40px;
  }

  .topbar {
    margin-bottom: 12px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand strong {
    max-width: calc(100vw - 90px);
    font-size: 0.95rem;
  }

  .brand small {
    max-width: calc(100vw - 90px);
    font-size: 0.78rem;
  }

  .hero {
    min-height: auto;
    align-items: start;
    padding: 18px;
    border-inline: 0;
    background:
      linear-gradient(180deg, rgba(16, 17, 20, 0.62), rgba(16, 17, 20, 0.94)),
      url("https://images.unsplash.com/photo-1489599849927-2ee91cede3ba?auto=format&fit=crop&w=900&q=80") center / cover;
  }

  .hero h1 {
    max-width: 330px;
    margin-bottom: 18px;
    font-size: clamp(2.1rem, 14vw, 3.4rem);
    line-height: 0.96;
  }

  .create-form {
    max-width: none;
  }

  .form-grid,
  .manual-grid,
  .admin-tools {
    grid-template-columns: 1fr;
  }

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

  .stats div {
    padding: 12px;
  }

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

  .admin-tools,
  .proposal-panel,
  .empty,
  .list-section {
    padding: 12px;
    margin-bottom: 10px;
  }

  .copy-row {
    flex-wrap: wrap;
  }

  .copy-row .btn,
  .tool-actions .btn,
  .proposal-form > .btn,
  .search-row .btn,
  .saved-club__actions .btn {
    flex: 1 1 100%;
    width: 100%;
  }

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

  .tool-actions .btn-primary {
    grid-column: 1 / -1;
  }

  .search-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .search-results {
    grid-template-columns: 1fr;
  }

  .search-card {
    grid-template-columns: 52px minmax(0, 1fr);
    min-height: 70px;
  }

  .search-card img {
    width: 52px;
  }

  .film-list {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .film-card {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 10px;
    padding: 9px;
  }

  .film-poster {
    width: 82px;
  }

  .film-head {
    display: grid;
  }

  .film-head h3 {
    font-size: 0.96rem;
  }

  .film-head p,
  .comment,
  .overview {
    font-size: 0.84rem;
  }

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

  .card-actions .btn-danger {
    grid-column: 1 / -1;
  }

  .saved-club {
    align-items: stretch;
    flex-direction: column;
  }

  .saved-club__actions {
    justify-content: flex-start;
  }

  .roulette {
    width: min(100%, 390px);
    padding: 12px;
  }

  .roulette-window {
    height: 154px;
    margin-inline: -12px;
    padding-block: 8px;
  }

  .roulette-card {
    flex-basis: 86px;
    width: 86px;
    gap: 5px;
  }

  .roulette-card img {
    width: 86px;
  }

  .roulette-result {
    grid-template-columns: 1fr;
    margin-top: 0;
    padding: 12px;
  }

  .roulette-result__poster {
    width: min(170px, 58vw);
    margin: 0 auto;
  }

  .roulette-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}
