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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0a0f1e;
  color: #f0f0f5;
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.header {
  background: #121828;
  border-bottom: 1px solid #252d45;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 16px 0;
}

.header-content {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
}

.header-content > * + * {
  margin-left: 32px;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  color: #f0f0f5;
  text-decoration: none;
  white-space: nowrap;
}
.logo span {
  color: #4f7cff;
}

.search-container {
  -webkit-flex: 1;
  flex: 1;
  max-width: 560px;
}

#search-form {
  display: -webkit-flex;
  display: flex;
  position: relative;
}

#search-input {
  width: 100%;
  padding: 12px 48px 12px 18px;
  background: #0a0f1e;
  border: 1px solid #252d45;
  border-radius: 12px;
  color: #f0f0f5;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
#search-input:focus {
  border-color: #4f7cff;
}
#search-input::-webkit-input-placeholder {
  color: #5a6480;
}

.search-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  -webkit-transform: translateY(-50%);
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #8a94b0;
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
}
.search-btn:hover {
  color: #4f7cff;
}

/* Main */
.main {
  padding: 32px 0 64px;
}

.initial-view {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

.hero h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 12px;
}
.hero p {
  color: #8a94b0;
  font-size: 18px;
}

/* Movie Grid */
.results-header {
  margin-bottom: 24px;
}
.results-header h2 {
  font-size: 22px;
  font-weight: 600;
}

.movie-grid {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: -10px;
}

.movie-grid > * {
  width: calc(12.5% - 20px);
  margin: 10px;
}

.movie-card {
  background: #1a2239;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}
.movie-card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
.movie-card:hover .movie-card-overlay {
  opacity: 1;
}

.movie-card-poster {
  width: 100%;
  display: block;
  background: #121828;
}

.movie-card-poster::before {
  content: '';
  display: block;
  padding-top: 150%;
}

.movie-card-poster {
  min-height: 200px;
}

.movie-card-info {
  padding: 12px;
}

.movie-card-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.movie-card-year {
  font-size: 12px;
  color: #5a6480;
  margin-top: 4px;
}

.movie-card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  opacity: 0;
}
.movie-card-overlay svg {
  width: 48px;
  height: 48px;
  color: white;
}

/* Pagination */
.pagination {
  display: -webkit-flex;
  display: flex;
  -webkit-justify-content: center;
  justify-content: center;
  margin-top: 32px;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
}

.pagination > * + * {
  margin-left: 8px;
}

.page-btn {
  padding: 8px 16px;
  background: #1a2239;
  border: 1px solid #252d45;
  border-radius: 8px;
  color: #8a94b0;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}
.page-btn:hover {
  background: #1f2845;
  color: #f0f0f5;
}
.page-btn.active {
  background: #4f7cff;
  color: white;
  border-color: #4f7cff;
}

/* Detail View */
.back-btn {
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
  align-items: center;
  background: none;
  border: none;
  color: #8a94b0;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  padding: 8px 0;
  margin-bottom: 24px;
}
.back-btn:hover {
  color: #4f7cff;
}

.back-btn > * + * {
  margin-left: 6px;
}

.movie-detail {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: -16px;
}

.movie-detail > :first-child {
  width: 300px;
  margin: 16px;
}

.movie-detail > :last-child {
  -webkit-flex: 1;
  flex: 1;
  min-width: 300px;
  margin: 16px;
}

.movie-detail-poster {
  width: 100%;
  border-radius: 12px;
}

.movie-detail-info h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.movie-detail-meta {
  margin-bottom: 16px;
}

.movie-detail-meta > * {
  display: inline-block;
  font-size: 14px;
  color: #8a94b0;
  background: #1a2239;
  padding: 4px 12px;
  border-radius: 20px;
  margin-right: 8px;
  margin-bottom: 4px;
}

.movie-detail-rating {
  color: #f5c518 !important;
}

.movie-detail-description {
  color: #8a94b0;
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 24px;
}

.servers-section {
  margin-top: 16px;
}
.servers-section h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

.servers-grid {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: -6px;
}

.servers-grid > * {
  -webkit-flex: 1 1 200px;
  flex: 1 1 200px;
  margin: 6px;
}

.server-btn {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  padding: 14px 18px;
  background: #1a2239;
  border: 1px solid #252d45;
  border-radius: 8px;
  color: #f0f0f5;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}
.server-btn:hover {
  background: #1f2845;
  border-color: #4f7cff;
}
.server-btn .server-status {
  font-size: 12px;
  color: #5a6480;
}
.server-btn .server-status.loading {
  color: #4f7cff;
}
.server-btn .server-status.ok {
  color: #22c55e;
}
.server-btn .server-status.error {
  color: #ef4444;
}

/* Player Overlay */
.player-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
}

.player-container {
  width: 90%;
  max-width: 1100px;
  position: relative;
}

.player-close {
  position: absolute;
  top: -48px;
  right: 0;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  opacity: 0.7;
}
.player-close:hover {
  opacity: 1;
}

.player-wrapper {
  width: 100%;
  padding-top: 56.25%;
  position: relative;
  background: black;
  border-radius: 12px;
  overflow: hidden;
}

.player-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.player-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Loading */
.loading {
  display: -webkit-flex;
  display: flex;
  -webkit-justify-content: center;
  justify-content: center;
  padding: 48px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #252d45;
  border-top-color: #4f7cff;
  border-radius: 50%;
  -webkit-animation: spin 0.8s linear infinite;
  animation: spin 0.8s linear infinite;
}

/* Footer */
.footer {
  border-top: 1px solid #252d45;
  padding: 24px 0;
  text-align: center;
}
.footer p {
  color: #5a6480;
  font-size: 13px;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Animations */
@-webkit-keyframes spin {
  to { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 1200px) {
  .movie-grid > * {
    width: calc(16.666% - 20px);
  }
}

@media (max-width: 992px) {
  .movie-grid > * {
    width: calc(25% - 20px);
  }
  .movie-detail > :first-child {
    width: 250px;
  }
}

@media (max-width: 768px) {
  .header-content {
    -webkit-flex-direction: column;
    flex-direction: column;
  }
  .header-content > * + * {
    margin-left: 0;
    margin-top: 16px;
  }
  .search-container {
    max-width: 100%;
    width: 100%;
  }
  .movie-detail > :first-child {
    width: 100%;
    max-width: 250px;
  }
  .movie-grid > * {
    width: calc(33.333% - 20px);
  }
  .hero h1 {
    font-size: 26px;
  }
}

@media (max-width: 480px) {
  .movie-grid > * {
    width: calc(50% - 20px);
  }
}
