/* =========================================================
   МОБИЛЬНАЯ СТРАНИЦА ФИЛЬМА
   ========================================================= */

:root {
  --bg: #f4f5f6;
  --surface: #ffffff;
  --surface-2: #eeeeef;
  --text: #171717;
  --muted: #777b80;
  --line: #d7d9dc;
  --accent: #69c72f;
  --accent-dark: #48a918;
  --danger: #ef5b16;
  --shadow: 0 2px 7px rgba(0, 0, 0, .18);
  --radius: 7px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.35;
  transition: background .2s ease, color .2s ease;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 76px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid #d6dbe0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  backdrop-filter: blur(10px);
}

.header-inner {
  width: min(100%, 1080px);
  height: 100%;
  margin: 0 auto;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 46px;
  height: 40px;
  padding: 5px 6px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: var(--accent);
  border-radius: 2px;
}

.brand-mark span {
  display: block;
  width: 7px;
  height: 7px;
  margin: auto;
  border-radius: 1px;
  background: #fff;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-text strong {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.3px;
}

.brand-text small {
  margin-top: 3px;
  font-size: 8px;
  letter-spacing: .2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.theme-btn {
  width: 78px;
  height: 42px;
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 24px;
  background: #edf0f2;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
  cursor: pointer;
}

.theme-btn .sun,
.theme-btn .moon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 25px;
  line-height: 1;
}

.theme-btn .sun {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

.theme-btn .moon {
  color: #39435c;
}

.menu-btn {
  width: 29px;
  height: 30px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}

.menu-btn i {
  display: block;
  width: 27px;
  height: 2px;
  background: var(--accent-dark);
}

.mobile-menu {
  position: fixed;
  top: 76px;
  right: 12px;
  z-index: 60;
  width: 190px;
  padding: 8px;
  display: none;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
}

.mobile-menu.is-open {
  display: flex;
}

.mobile-menu a {
  padding: 11px 12px;
  color: var(--text);
  text-decoration: none;
  border-radius: 5px;
}

.mobile-menu a:hover {
  background: var(--surface-2);
}

.page {
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 14px 10px 50px;
}

.movie-shell {
  width: 100%;
}

.movie-card {
  max-width: 760px;
  margin: 0 auto;
}

.poster-box {
  width: 225px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: 5px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.poster {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: #242323;
}

.rating-row {
  height: 57px;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  background: var(--surface);
}

.rating-side {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.rating-side:first-child {
  padding-left: 10px;
  justify-content: flex-start;
}

.rating-side:last-child {
  padding-right: 10px;
  justify-content: flex-end;
}

.rating-circle {
  position: absolute;
  left: 50%;
  top: -10px;
  width: 59px;
  height: 59px;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  border: 5px solid var(--accent);
  border-radius: 50%;
  background: var(--surface);
  color: #149c3c;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}

.vote {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 22px;
  color: #fff;
  font-weight: 700;
}

.vote.dislike {
  background: var(--danger);
}

.vote.like {
  background: var(--accent-dark);
}

.vote-count {
  font-size: 13px;
  color: var(--text);
}

.movie-title {
  margin: 23px 2px 7px;
  font-size: 20px;
  line-height: 1.15;
  font-weight: 700;
}

.description {
  margin: 0;
  max-height: 50px;
  overflow: hidden;
  position: relative;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
  transition: max-height .25s ease;
}

.description:not(.is-expanded)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22px;
  background: linear-gradient(transparent, var(--bg));
}

.description.is-expanded {
  max-height: 500px;
}

.description.is-expanded::after {
  display: none;
}

.read-more {
  width: 100%;
  height: 34px;
  margin-top: 10px;
  border: 1px solid #c8cbd0;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}

.details {
  margin-top: 16px;
}

.details p {
  margin: 0;
  color: var(--muted);
  line-height: 1.38;
}

.details strong {
  color: #34373b;
}

.scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
  margin-top: 10px;
}

.score {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid;
  border-radius: 3px;
  background: var(--surface);
  font-size: 13px;
}

.score.kp {
  border-color: #ff5a00;
}

.score.imdb {
  border-color: #f2b900;
}

/* ---------- Кнопка онлайн-просмотра ---------- */

.watch-title {
  margin: 31px 0 11px;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 700;
}

.watch-online-btn {
  width: 100%;
  min-height: 48px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 2px 5px rgba(0,0,0,.18);
  transition: background .15s ease, transform .1s ease;
}

.watch-online-btn::before {
  content: "▶";
  font-size: 13px;
}

.watch-online-btn:hover {
  background: var(--accent-dark);
}

.watch-online-btn:active {
  transform: translateY(1px);
}

.section {
  margin-top: 28px;
}

.section h2 {
  margin: 0 0 9px;
  font-size: 18px;
}

.section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.load-error {
  max-width: 700px;
  margin: 50px auto;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.load-error h1 {
  margin-top: 0;
  font-size: 20px;
}

code {
  font-family: Consolas, monospace;
}

.loading {
  padding: 50px 15px;
  text-align: center;
  color: var(--muted);
}

/* ---------- Тёмная тема ---------- */

body.dark {
  --bg: #121416;
  --surface: #1d2023;
  --surface-2: #282c30;
  --text: #f1f2f3;
  --muted: #a8adb2;
  --line: #3a3e42;
  --shadow: 0 3px 10px rgba(0,0,0,.35);
}

body.dark .site-header {
  background: rgba(25, 28, 31, .96);
  border-color: #35393d;
}

body.dark .theme-btn {
  background: #2b3035;
}

body.dark .theme-btn .sun {
  background: #454a50;
  color: #cbd0d5;
}

body.dark .theme-btn .moon {
  background: #4b5269;
  color: #fff;
}

body.dark .description:not(.is-expanded)::after {
  background: linear-gradient(transparent, var(--bg));
}

body.dark .details strong {
  color: #e3e5e7;
}

body.dark .score {
  background: #202326;
}

body.dark .watch-online-btn {
  color: #fff;
}

/* ---------- Планшет / десктоп ---------- */

@media (min-width: 700px) {
  .site-header {
    height: 82px;
  }

  .header-inner {
    padding: 0 24px;
  }

  .page {
    padding: 24px 20px 70px;
  }

  .movie-card {
    max-width: 850px;
  }

  .poster-box {
    width: 260px;
  }

  .movie-title {
    font-size: 23px;
  }

  .details p {
    font-size: 15px;
  }
}

/* ---------- Узкий экран ---------- */

@media (max-width: 380px) {
  .site-header {
    height: 72px;
  }

  .header-inner {
    padding: 0 11px;
  }

  .brand-mark {
    width: 44px;
    height: 38px;
  }

  .header-actions {
    gap: 10px;
  }

  .theme-btn {
    width: 72px;
    height: 40px;
  }

  .theme-btn .sun,
  .theme-btn .moon {
    width: 34px;
    height: 34px;
  }

  .page {
    padding: 12px 9px 40px;
  }

  .poster-box {
    width: min(225px, 70vw);
  }

  .movie-title {
    margin-top: 21px;
  }

  .watch-title {
    font-size: 15px;
  }

  .watch-online-btn {
    min-height: 46px;
    font-size: 15px;
  }
}
/* =========================================================
   ГЛАВНАЯ СТРАНИЦА
   ========================================================= */

.home-page {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 60px;
}


/* =========================================================
   ПОИСК
   ========================================================= */

.search-section {
  width: 100%;
  margin-bottom: 42px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.movie-search {
  width: 100%;
  height: 58px;
  padding: 0 68px 0 22px;

  border: 1px solid #e1e1e1;
  border-radius: 16px;

  background: #f7f7f7;
  color: #171717;

  font-family: inherit;
  font-size: 16px;
  outline: none;

  transition:
    border-color .2s ease,
    background .2s ease,
    box-shadow .2s ease;
}

.movie-search::placeholder {
  color: #969696;
}

.movie-search:focus {
  border-color: #c8c8c8;
  background: #fff;
  box-shadow: 0 6px 25px rgba(0, 0, 0, .06);
}

.search-btn {
  position: absolute;
  right: 7px;
  top: 7px;

  width: 44px;
  height: 44px;

  border: 0;
  border-radius: 12px;

  background: #171717;
  color: #fff;

  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  transition:
    transform .2s ease,
    opacity .2s ease;
}

.search-btn:hover {
  opacity: .85;
}

.search-btn:active {
  transform: scale(.94);
}

.search-btn span {
  font-size: 27px;
  line-height: 1;
  transform: translateY(-2px);
}


/* =========================================================
   ЗАГОЛОВОК РАЗДЕЛА
   ========================================================= */

.section-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;

  margin-bottom: 22px;
}

.section-heading h1 {
  margin: 0;

  font-size: 30px;
  line-height: 1.15;
  font-weight: 700;

  color: #171717;
}

.section-count {
  color: #999;
  font-size: 14px;
}


/* =========================================================
   ПЛИТКА ФИЛЬМОВ
   ========================================================= */

.movie-grid {
  display: grid;

  grid-template-columns:
    repeat(6, minmax(0, 1fr));

  gap: 24px 16px;
}


/* =========================================================
   КАРТОЧКА ФИЛЬМА
   ========================================================= */

.movie-tile {
  display: block;

  min-width: 0;

  color: inherit;
  text-decoration: none;

  transition:
    transform .25s ease;
}

.movie-tile:hover {
  transform: translateY(-5px);
}


/* =========================================================
   ПОСТЕР
   ========================================================= */

.tile-poster {
  position: relative;

  width: 100%;

  aspect-ratio: 2 / 3;

  overflow: hidden;

  border-radius: 13px;

  background: #e7e7e7;

  box-shadow:
    0 5px 18px rgba(0, 0, 0, .08);
}

.tile-poster img {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: cover;

  transition:
    transform .35s ease;
}

.movie-tile:hover .tile-poster img {
  transform: scale(1.035);
}


/* =========================================================
   РЕЙТИНГ НА ПОСТЕРЕ
   ========================================================= */

.tile-rating {
  position: absolute;

  right: 8px;
  bottom: 8px;

  display: flex;
  align-items: center;
  gap: 4px;

  padding: 5px 8px;

  border-radius: 8px;

  background: rgba(0, 0, 0, .72);
  color: #fff;

  font-size: 12px;
  font-weight: 600;

  backdrop-filter: blur(6px);
}

.tile-rating span {
  font-size: 11px;
}


/* =========================================================
   ВРЕМЕННЫЕ ПОСТЕРЫ
   ========================================================= */

.placeholder-poster {
  display: flex;
  align-items: center;
  justify-content: center;

  background:
    linear-gradient(
      145deg,
      #111318 0%,
      #30343b 50%,
      #62676d 100%
    );

  color: rgba(255, 255, 255, .9);

  text-align: center;
}

.placeholder-poster > span {
  font-size: clamp(15px, 1.5vw, 23px);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: .5px;
}


/* =========================================================
   ИНФОРМАЦИЯ О ФИЛЬМЕ
   ========================================================= */

.tile-info {
  padding: 11px 2px 0;
}

.tile-info h2 {
  overflow: hidden;

  margin: 0 0 6px;

  color: #171717;

  font-size: 15px;
  line-height: 1.25;
  font-weight: 650;

  white-space: nowrap;
  text-overflow: ellipsis;
}

.tile-meta {
  display: flex;
  align-items: center;
  gap: 7px;

  color: #929292;

  font-size: 12px;
  line-height: 1.2;
}

.tile-meta span + span::before {
  content: "•";
  margin-right: 7px;
  color: #bdbdbd;
}


/* =========================================================
   НИЧЕГО НЕ НАЙДЕНО
   ========================================================= */

.search-empty {
  padding: 70px 20px;

  text-align: center;
}

.search-empty h2 {
  margin: 0 0 8px;

  font-size: 22px;
  color: #171717;
}

.search-empty p {
  margin: 0;

  color: #888;
  font-size: 14px;
}


/* =========================================================
   DARK MODE
   ========================================================= */

body.dark .movie-search {
  border-color: #333;

  background: #1b1c20;
  color: #f2f2f2;
}

body.dark .movie-search::placeholder {
  color: #777;
}

body.dark .movie-search:focus {
  border-color: #555;
  background: #202126;
  box-shadow: 0 6px 25px rgba(0, 0, 0, .2);
}

body.dark .search-btn {
  background: #f2f2f2;
  color: #111;
}

body.dark .section-heading h1 {
  color: #f2f2f2;
}

body.dark .tile-info h2 {
  color: #f2f2f2;
}

body.dark .tile-meta {
  color: #858585;
}

body.dark .search-empty h2 {
  color: #f2f2f2;
}

body.dark .tile-poster {
  background: #25262b;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 1050px) {

  .movie-grid {
    grid-template-columns:
      repeat(5, minmax(0, 1fr));

    gap: 22px 15px;
  }

}


/* =========================================================
   ПЛАНШЕТ
   ========================================================= */

@media (max-width: 850px) {

  .home-page {
    width: min(100% - 30px, 700px);
    padding-top: 28px;
  }

  .movie-grid {
    grid-template-columns:
      repeat(4, minmax(0, 1fr));

    gap: 22px 14px;
  }

  .section-heading h1 {
    font-size: 27px;
  }

}


/* =========================================================
   МОБИЛЬНАЯ ВЕРСИЯ
   ========================================================= */

@media (max-width: 600px) {

  .home-page {
    width: calc(100% - 24px);
    padding: 20px 0 40px;
  }


  /* Поиск */

  .search-section {
    margin-bottom: 30px;
  }

  .movie-search {
    height: 52px;

    padding-left: 17px;
    padding-right: 60px;

    border-radius: 13px;

    font-size: 15px;
  }

  .search-btn {
    right: 6px;
    top: 6px;

    width: 40px;
    height: 40px;

    border-radius: 10px;
  }


  /* Заголовок */

  .section-heading {
    margin-bottom: 17px;
  }

  .section-heading h1 {
    font-size: 24px;
  }

  .section-count {
    font-size: 12px;
  }


  /* 2 фильма в ряд */

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

    gap: 25px 12px;
  }


  /* Карточка */

  .movie-tile:hover {
    transform: none;
  }

  .tile-poster {
    border-radius: 11px;
  }

  .tile-info {
    padding-top: 9px;
  }

  .tile-info h2 {
    margin-bottom: 5px;

    font-size: 14px;
  }

  .tile-meta {
    font-size: 11px;
  }

  .tile-rating {
    right: 6px;
    bottom: 6px;

    padding: 4px 7px;

    border-radius: 7px;

    font-size: 11px;
  }

}


/* =========================================================
   СОВСЕМ УЗКИЕ ЭКРАНЫ
   ========================================================= */

@media (max-width: 360px) {

  .home-page {
    width: calc(100% - 20px);
  }

  .movie-grid {
    gap: 22px 10px;
  }

  .tile-info h2 {
    font-size: 13px;
  }

  .tile-meta {
    font-size: 10px;
  }

}
/* =========================================================
   КНОПКА «ВСЕ ФИЛЬМЫ»
   ========================================================= */

.back-home {
    display: inline-flex;
    align-items: center;
    gap: 9px;

    width: auto;
    margin: 0 0 22px;
    padding: 9px 14px;

    border: 1px solid var(--line);
    border-radius: 7px;

    background: var(--surface);
    color: var(--text);

    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;

    text-align: left;
    text-decoration: none;

    cursor: pointer;

    transition:
        background-color .18s ease,
        border-color .18s ease,
        color .18s ease,
        transform .18s ease;
}

.back-home::before {
    content: "←";

    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-size: 17px;
    line-height: 1;
}

.back-home:hover {
    background: var(--surface-2);
    border-color: #c5c8cb;
    color: var(--text);
}

.back-home:active {
    transform: translateY(1px);
}


/* DARK MODE */

body.dark .back-home {
    background: var(--surface);
    border-color: var(--line);
    color: var(--text);
}

body.dark .back-home:hover {
    background: var(--surface-2);
    border-color: #555;
    color: var(--text);
}
/* =========================================================
   ПОИСК — НАЙДЕН ФИЛЬМ ПО КОДУ
   ========================================================= */

.movie-search.code-found {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 2px rgba(105, 199, 47, 0.12);
}

.search-btn.code-found {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.search-btn.code-found:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
}

.open-search-text {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

/* MOBILE */

@media (max-width: 600px) {

    .back-home {
        margin-bottom: 16px;
        padding: 8px 12px;

        font-size: 13px;
        border-radius: 6px;
    }

    .back-home::before {
        font-size: 16px;
    }

}
/* =========================================================
   ПОИСК ПО КОДУ — КНОПКА «ОТКРЫТЬ»
   ========================================================= */

.search-btn.code-found {
    width: 78px;
    min-width: 78px;
    padding: 0 12px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: var(--accent);
    border-color: var(--accent);
    color: #fff;

    overflow: visible;
}

.search-btn.code-found:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
}

.search-btn.code-found .open-search-text {
    display: block;

    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.movie-search.code-found {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 2px rgba(105, 199, 47, 0.12);
}


/* Мобильная версия */

@media (max-width: 600px) {

    .search-btn.code-found {
        width: 76px;
        min-width: 76px;
        padding: 0 10px;
    }

}