/*
  Kino — unslopped
  Direction: dark cinema lobby. Posters carry all color and image.
  Chrome stays quiet neutral. One red accent, used sparingly.
  Credit: design pass follows unslop by @heydamir (CC BY 4.0)
*/

:root {
  --bg: #0c0c0e;
  --bg-elevated: #141416;
  --bg-input: #1c1c1f;
  --border: #2c2c32;
  --border-strong: #3a3a42;

  --text: #ececef;
  --text-secondary: #a8a8b0;
  --text-tertiary: #6e6e76;

  --accent: #e50914;
  --accent-hover: #ff1a24;
  --accent-muted: rgba(229, 9, 20, 0.14);

  --r: 8px;
  --r-lg: 12px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --max: 1080px;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.logo:hover { text-decoration: none; }

.logo__icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  font-size: 0.65rem;
  line-height: 1;
}

.logo__text { font-weight: 600; }

.header-search {
  flex: 1;
  max-width: 360px;
  display: flex;
  align-items: center;
  height: 36px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}

.header-search:focus-within {
  border-color: var(--border-strong);
}

.header-search input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 0 12px;
  font: inherit;
  font-size: 0.875rem;
  outline: none;
}

.header-search input::placeholder { color: var(--text-tertiary); }

.header-search button {
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.header-search button:hover { color: var(--text-secondary); }

/* Main */
.main {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* Hero */
.hero {
  text-align: center;
  padding: 40px 0 48px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.hero__sub {
  margin: 0 0 28px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 400;
}

.search-box {
  display: flex;
  gap: 8px;
  max-width: 480px;
  margin: 0 auto 16px;
}

.search-box input {
  flex: 1;
  height: 48px;
  padding: 0 16px;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r);
  outline: none;
}

.search-box input::placeholder { color: var(--text-tertiary); }

.search-box input:focus {
  border-color: var(--border-strong);
}

.search-modes {
  display: flex;
  justify-content: center;
  gap: 24px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.search-modes label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-modes input { accent-color: var(--accent); }

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 20px;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--r);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r);
  text-decoration: none;
}

.btn-outline:hover {
  border-color: var(--border-strong);
  text-decoration: none;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  padding: 4px 0;
}

.btn-text:hover { color: var(--text); }

/* Sections & grid */
.section {
  margin-bottom: 48px;
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}

.section__head h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

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

/* Card */
.card {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: var(--r);
  overflow: hidden;
}

.card:hover { text-decoration: none; }

.card:hover .card__poster {
  outline: 1px solid var(--border-strong);
}

.card__poster {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--bg-input);
  border-radius: var(--r);
  overflow: hidden;
  outline: 1px solid var(--border);
  outline-offset: -1px;
}

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

.card__no-poster {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  padding: 8px;
  text-align: center;
}

.card__rating {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 6px;
  background: rgba(12, 12, 14, 0.85);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border-radius: 4px;
}

.card__body {
  padding: 8px 2px 0;
}

.card__title {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__year {
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.skeleton-card {
  aspect-ratio: 2 / 3;
  background: var(--bg-elevated);
  border-radius: var(--r);
  border: 1px solid var(--border);
}

.empty,
.error {
  text-align: center;
  color: var(--text-secondary);
  padding: 24px 16px;
  font-size: 0.875rem;
}

.error {
  color: #e88;
  background: var(--accent-muted);
  border-radius: var(--r);
}

/* Film page */
.film-loading {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.player-wrap {
  margin-bottom: 32px;
}

.player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.player iframe,
.player video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.player__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-tertiary);
  background: var(--bg-elevated);
}

.player__icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.player__placeholder p {
  margin: 0;
  font-size: 0.875rem;
}

.player__hint {
  font-size: 0.75rem !important;
  color: var(--text-tertiary);
}

.player__hint code {
  background: var(--bg-input);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.7rem;
}

.film-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 32px;
  margin-bottom: 48px;
  align-items: start;
}

.film-poster {
  width: 100%;
  border-radius: var(--r);
  border: 1px solid var(--border);
  display: block;
  background: var(--bg-input);
}

.film-title {
  margin: 0 0 4px;
  font-size: clamp(1.375rem, 3vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.film-original {
  margin: 0 0 12px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 400;
}

.film-meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}

.film-rating {
  display: inline-block;
  padding: 4px 10px;
  background: var(--accent-muted);
  color: var(--text);
  font-weight: 600;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  border-radius: 6px;
  margin-bottom: 12px;
}

.film-genres {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin: 0 0 16px;
}

.film-desc {
  margin: 0 0 24px;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 54ch;
  font-size: 0.9375rem;
}

.film-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.film-actions .btn-primary {
  height: 40px;
  font-size: 0.875rem;
}

.ai-block {
  padding: 20px 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.ai-block h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
}

.ai-text {
  color: var(--text-secondary);
  line-height: 1.65;
  font-size: 0.9375rem;
}

/* Footer */
.footer {
  padding: 20px 24px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer a {
  color: var(--text-tertiary);
  text-decoration: none;
}

.footer a:hover { color: var(--text-secondary); }

/* Responsive */
@media (max-width: 640px) {
  .header {
    padding: 0 16px;
    gap: 12px;
  }

  .main {
    padding: 20px 16px 48px;
  }

  .hero {
    padding: 20px 0 28px;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .hero__sub {
    margin-bottom: 20px;
    font-size: 0.875rem;
  }

  /* Search: larger on mobile, stacked */
  .search-box {
    flex-direction: column;
    gap: 10px;
    max-width: none;
    margin-bottom: 14px;
  }

  .search-box input {
    height: 52px;
    font-size: 1.0625rem;
    padding: 0 16px;
    border-radius: 10px;
  }

  .search-box .btn-primary {
    height: 52px;
    width: 100%;
    font-size: 1rem;
    border-radius: 10px;
  }

  .search-modes {
    gap: 28px;
    font-size: 0.9375rem;
    padding-top: 2px;
  }

  .search-modes label {
    gap: 10px;
    min-height: 44px;
  }

  /* Keep compact search in header on mobile */
  .header-search {
    display: flex;
    height: 40px;
    max-width: none;
  }

  .header-search input {
    font-size: 0.9375rem;
    padding: 0 12px;
  }

  .header-search button {
    width: 40px;
    height: 40px;
  }

  .film-layout {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 20px;
  }

  .film-poster-col {
    width: 140px;
  }

  .film-desc {
    max-width: none;
  }

  .film-actions {
    justify-content: center;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 16px 10px;
  }
}
