/* Kinoportal redesign — Stage 1: phone and tablet safeguards */
@media (max-width: 1199px) {
  :root { --kp-container: 1120px; }

  body:not(.admin-body) .kp-page-frame {
    grid-template-columns: minmax(0, 1fr) !important;
    width: min(100% - 28px, var(--kp-container));
  }

  body:not(.admin-body) .kp-side-banner { display: none !important; }
}

@media (max-width: 991.98px) {
  body:not(.admin-body) { font-size: 15px; }

  body:not(.admin-body) .kp-nav {
    background: rgba(12, 18, 32, .98) !important;
    border-color: var(--kp-border) !important;
    box-shadow: var(--kp-shadow-md) !important;
    backdrop-filter: blur(20px);
  }
  html[data-theme="light"] body:not(.admin-body) .kp-nav { background: rgba(255, 255, 255, .98) !important; }

  body:not(.admin-body) .kp-navlink {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  body:not(.admin-body) :where(.btn, .button, .kp-btn, .login-button, .register-button, .media-card__button, .article-card__button, .quiz-card__button) {
    min-height: 44px;
  }
}

@media (max-width: 767.98px) {
  :root {
    --kp-radius-lg: 16px;
    --kp-radius-xl: 20px;
  }

  body:not(.admin-body) {
    line-height: 1.55;
    padding-bottom: env(safe-area-inset-bottom);
  }

  body:not(.admin-body) :where(.container, .wrap, .page-wrap, .news-page, .articles-page, .reviews, .quiz-page, .users-container, .profile-container, .forum-page, .search-page) {
    width: min(100% - 20px, var(--kp-container));
  }

  body:not(.admin-body) .kp-header__inner { padding-inline: 10px; }
  body:not(.admin-body) .kp-brand__title { font-size: .98rem; }

  body:not(.admin-body) :where(.section-head, .news-page__head, .reviews__head, .users-head, .forum-head) {
    align-items: stretch;
  }

  body:not(.admin-body) :where(.section-head > *, .news-page__actions, .reviews__head .btn, .users-head .filter) {
    max-width: 100%;
  }

  body:not(.admin-body) :where(.actions-bar, .comments-form__footer, .comments-login) {
    align-items: stretch !important;
  }

  body:not(.admin-body) :where(.action-buttons, .news-page__actions, .modal__actions) {
    width: 100%;
  }

  body:not(.admin-body) :where(.action-buttons .btn, .news-page__actions .btn, .modal__actions .btn) {
    flex: 1 1 auto;
  }

  body:not(.admin-body) :where(.media-grid, .articles-grid, .quiz-list, .users-grid, .cards, .actor-grid) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body:not(.admin-body) :where(.search-card) { grid-template-columns: 1fr !important; }
  body:not(.admin-body) :where(.search-card__thumb, .search-card__thumb--poster) { width: 100% !important; }

  body:not(.admin-body) .kp-notify-dropdown {
    position: fixed !important;
    top: 66px !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-height: calc(100svh - 82px) !important;
  }
}

@media (max-width: 520px) {
  body:not(.admin-body) h1 { font-size: clamp(1.65rem, 8vw, 2.25rem); }
  body:not(.admin-body) h2 { font-size: clamp(1.25rem, 6vw, 1.65rem); }

  body:not(.admin-body) :where(.media-grid, .articles-grid, .quiz-list, .users-grid, .cards, .actor-grid) {
    grid-template-columns: 1fr !important;
  }

  body:not(.admin-body) :where(.btn, .button, .kp-btn, .login-button, .register-button, .media-card__button, .article-card__button, .quiz-card__button) {
    min-height: 46px;
  }

  body:not(.admin-body) :where(.search-form, .kp-search-form) { gap: 7px; }
  body:not(.admin-body) .kp-search-form .kp-btn { padding-inline: 12px; }

  body:not(.admin-body) :where(.pagination, .articles-pagination) {
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
  }
}
