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

/* ---- Login screen ---- */
.login-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0d0d0d, #1a1a2e);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-box {
  background: #16213e;
  border: 1px solid #e94560;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(233,69,96,0.15);
}

.login-icon { font-size: 3rem; margin-bottom: 0.75rem; }

.login-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #eee;
  margin-bottom: 1.5rem;
}

.login-question {
  font-size: 0.95rem;
  color: #aaa;
  margin-bottom: 1rem;
}

.login-input {
  width: 100%;
  background: #0d0d0d;
  color: #eee;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  outline: none;
  text-align: center;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  transition: border-color 0.2s;
}

.login-input:focus { border-color: #e94560; }

.login-btn {
  width: 100%;
  background: #e94560;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.login-btn:hover { background: #c73652; }

.login-error {
  color: #e94560;
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* ---- Featured strip ---- */
#featured-section {
  padding: 1.2rem 1.5rem 0.5rem;
  background: linear-gradient(180deg, #12122a 0%, #0d0d0d 100%);
}

.featured-title {
  font-size: 1rem;
  font-weight: 700;
  color: #e94560;
  margin-bottom: 0.8rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.featured-strip {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: #e94560 #1a1a2e;
  scroll-snap-type: x mandatory;
}

.featured-strip::-webkit-scrollbar { height: 4px; }
.featured-strip::-webkit-scrollbar-track { background: #1a1a2e; border-radius: 2px; }
.featured-strip::-webkit-scrollbar-thumb { background: #e94560; border-radius: 2px; }

.featured-card {
  flex-shrink: 0;
  width: 110px;
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform 0.15s;
}

.featured-card:hover { transform: scale(1.05); }

.featured-card img {
  width: 110px;
  height: 165px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  background: #1e1e1e;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}

.featured-card:hover img { border-color: #e94560; }

.featured-card .fc-title {
  font-size: 0.72rem;
  color: #ccc;
  margin-top: 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.featured-card .fc-year {
  font-size: 0.68rem;
  color: #666;
  text-align: center;
}

.featured-card .fc-badge {
  position: relative;
}

.featured-card .fc-status {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.9rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px #000);
}

.featured-loading { color: #555; font-size: 0.85rem; padding: 1rem 0; }

/* ---- Video player modal ---- */
.video-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.video-modal-box {
  background: #0d0d0d;
  border: 1px solid #e94560;
  border-radius: 12px;
  width: 100%;
  max-width: 900px;
  overflow: hidden;
}

.video-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #1a1a2e;
  font-weight: 600;
  font-size: 0.95rem;
  color: #eee;
}

.video-modal-close {
  background: none;
  border: none;
  color: #aaa;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  transition: color 0.15s;
}
.video-modal-close:hover { color: #e94560; }

.video-player {
  width: 100%;
  max-height: 70vh;
  background: #000;
  display: block;
}

.video-modal-hint {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  color: #555;
  text-align: center;
}
.video-modal-hint a { color: #e94560; }

.format-warning {
  padding: 1.5rem 1rem;
  text-align: center;
  color: #ccc;
  font-size: 0.9rem;
  line-height: 1.8;
}

/* Prominent Webshare play button */
.ws-play-btn {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #1a6b1a, #2d9e2d);
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.5rem;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.02em;
}
.ws-play-btn:hover { background: linear-gradient(135deg, #1f801f, #35b835); transform: scale(1.02); }

.modal-webshare {
  margin: 0.6rem 0;
  font-size: 0.8rem;
  color: #666;
}

body {
  background: #0d0d0d;
  color: #e0e0e0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  padding-bottom: 2rem;
}

header {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
  border-bottom: 2px solid #e94560;
}

header h1 {
  font-size: 2rem;
  color: #e94560;
  margin-bottom: 0.4rem;
}

header .subtitle {
  color: #888;
  font-size: 0.95rem;
}

.controls {
  background: #111;
  padding: 1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 1px solid #222;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-group label {
  color: #888;
  font-size: 0.85rem;
  white-space: nowrap;
}

.filter-btn,
.status-filter-btn {
  background: #1e1e1e;
  color: #aaa;
  border: 1px solid #333;
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.filter-btn:hover,
.status-filter-btn:hover {
  border-color: #e94560;
  color: #e94560;
}

.filter-btn.active,
.status-filter-btn.active {
  background: #e94560;
  color: #fff;
  border-color: #e94560;
}

.loading {
  text-align: center;
  padding: 3rem;
  color: #888;
  font-size: 1.1rem;
}

.error {
  text-align: center;
  padding: 2rem;
  color: #e94560;
  background: #1a0a0a;
  margin: 1rem;
  border-radius: 8px;
  border: 1px solid #e94560;
}

.movies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.2rem;
  padding: 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
}

.movie-card {
  background: #1a1a1a;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #2a2a2a;
  transition: transform 0.2s, border-color 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
}

.movie-card:hover {
  transform: translateY(-4px);
  border-color: #444;
}

.movie-card.status-seen {
  border-color: #1a7a3c;
}

.movie-card.status-want {
  border-color: #7a6a1a;
}

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

.movie-poster-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #444;
}

.movie-info {
  padding: 0.8rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.movie-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #eee;
  line-height: 1.3;
}

.movie-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.78rem;
  color: #888;
  flex-wrap: wrap;
}

.movie-year {
  color: #aaa;
}

.movie-rating {
  color: #f5c518;
}

.movie-genre {
  background: #2a2a2a;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.72rem;
}

.movie-overview {
  font-size: 0.78rem;
  color: #999;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.movie-actions {
  padding: 0.6rem 0.8rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  border-top: 1px solid #222;
  background: #141414;
}

.btn-status {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0.3rem;
  border-radius: 6px;
  border: 1px solid #333;
  background: #1e1e1e;
  color: #aaa;
  cursor: pointer;
  font-size: 0.72rem;
  transition: all 0.15s;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-status:hover {
  background: #2a2a2a;
}

.btn-status.active-seen {
  background: #1a4a2a;
  border-color: #2a7a4a;
  color: #4dda7a;
}

.btn-status.active-want {
  background: #4a3a0a;
  border-color: #7a6a1a;
  color: #f5c518;
}

.movie-links {
  padding: 0.5rem 0.8rem;
  display: flex;
  gap: 0.5rem;
  background: #0f0f0f;
}

.movie-links a {
  flex: 1;
  text-align: center;
  font-size: 0.72rem;
  color: #aaa;
  text-decoration: none;
  padding: 0.3rem;
  border-radius: 5px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  transition: all 0.15s;
}

.movie-links a:hover {
  color: #e94560;
  border-color: #e94560;
}

.webshare-status {
  flex: 1;
}

.webshare-status .ws-loading {
  display: block;
  text-align: center;
  font-size: 0.72rem;
  color: #666;
  padding: 0.3rem 0.5rem;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  background: #1a1a1a;
}

.webshare-status .ws-found {
  display: block;
  text-align: center;
  font-size: 0.72rem;
  color: #4caf50;
  text-decoration: none;
  padding: 0.3rem 0.5rem;
  border: 1px solid #2a4a2a;
  border-radius: 4px;
  background: #0f2010;
  transition: all 0.15s;
}

.webshare-status .ws-found:hover {
  background: #1a3a1a;
  border-color: #4caf50;
}

.webshare-status .ws-notfound {
  display: block;
  text-align: center;
  font-size: 0.72rem;
  color: #666;
  padding: 0.3rem 0.5rem;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  background: #1a1a1a;
}

.webshare-status .ws-error {
  display: block;
  text-align: center;
  font-size: 0.72rem;
  color: #f5a623;
  padding: 0.3rem 0.5rem;
  border: 1px solid #3a2a1a;
  border-radius: 4px;
  background: #1a1000;
}

.status-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 1.3rem;
  background: rgba(0,0,0,0.7);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
}

.pagination button {
  background: #1e1e1e;
  color: #aaa;
  border: 1px solid #333;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
  border-color: #e94560;
  color: #e94560;
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

#page-info {
  color: #888;
  font-size: 0.9rem;
}

/* ---- Search bar ---- */
.search-bar {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

#search-input {
  width: 100%;
  background: #1e1e1e;
  color: #eee;
  border: 1px solid #333;
  border-radius: 20px;
  padding: 0.5rem 2.5rem 0.5rem 1rem;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

#search-input:focus {
  border-color: #e94560;
}

#search-input::placeholder {
  color: #555;
}

.search-clear-btn {
  position: absolute;
  right: 0.6rem;
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.2rem 0.4rem;
  border-radius: 50%;
  line-height: 1;
  transition: color 0.15s;
}

.search-clear-btn:hover {
  color: #e94560;
}

.search-info {
  width: 100%;
  font-size: 0.82rem;
  color: #888;
  padding: 0.2rem 0;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #1a1a2e;
  border: 1px solid #e94560;
  border-radius: 12px;
  z-index: 1000;
  max-height: 380px;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

.search-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #222;
  transition: background 0.15s;
}

.search-dropdown-item:last-child {
  border-bottom: none;
}

.search-dropdown-item:hover {
  background: #16213e;
}

.search-dropdown-item img {
  width: 36px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: #222;
}

.search-dropdown-item .sd-info {
  flex: 1;
  min-width: 0;
}

.search-dropdown-item .sd-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #eee;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-dropdown-item .sd-meta {
  font-size: 0.75rem;
  color: #888;
  margin-top: 2px;
}

.search-dropdown-loading,
.search-dropdown-empty {
  padding: 1rem;
  text-align: center;
  color: #666;
  font-size: 0.85rem;
}

@media (max-width: 600px) {
  header h1 {
    font-size: 1.5rem;
  }

  .controls {
    flex-direction: column;
    gap: 0.7rem;
  }

  .movies-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.8rem;
    padding: 0.8rem;
  }
}

@media (max-width: 400px) {
  .movies-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---- Modal overlay ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.modal-dialog {
  background: #1a1a1a;
  border-radius: 12px;
  border: 1px solid #333;
  max-width: 700px;
  width: 100%;
  position: relative;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  background: rgba(0,0,0,0.6);
  color: #eee;
  border: 1px solid #444;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background 0.15s;
}

.modal-close:hover {
  background: #e94560;
}

.modal-body {
  display: flex;
  flex-direction: row;
  gap: 0;
}

.modal-poster-wrap {
  flex: 0 0 220px;
  position: relative;
}

.modal-poster {
  width: 220px;
  min-height: 330px;
  object-fit: cover;
  display: block;
  border-radius: 12px 0 0 12px;
  background: #222;
}

.modal-status-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 1.5rem;
  background: rgba(0,0,0,0.7);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-info {
  flex: 1;
  padding: 1.4rem 1.2rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  overflow: hidden;
}

.modal-title {
  font-size: 1.3rem;
  color: #eee;
  line-height: 1.3;
  padding-right: 2rem;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: #999;
}

.modal-meta span {
  background: #252525;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.modal-meta .meta-rating {
  color: #f5c518;
}

.modal-overview {
  font-size: 0.88rem;
  color: #bbb;
  line-height: 1.6;
  flex: 1;
}

.modal-extra {
  font-size: 0.8rem;
  color: #888;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.modal-extra span {
  background: #1e1e1e;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #2a2a2a;
}

.modal-trailer {
  border-radius: 8px;
  overflow: hidden;
}

.modal-trailer iframe {
  width: 100%;
  aspect-ratio: 16/9;
  border: none;
  display: block;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
}

.modal-actions .btn-status {
  flex: 1;
}

/* Poster + title clickable */
.movie-poster,
.movie-poster-placeholder,
.movie-title {
  cursor: pointer;
}

.movie-title:hover {
  color: #e94560;
}

@media (max-width: 600px) {
  .modal-body {
    flex-direction: column;
  }

  .modal-poster-wrap {
    flex: none;
  }

  .modal-poster {
    width: 100%;
    min-height: unset;
    border-radius: 12px 12px 0 0;
  }

  .modal-title {
    font-size: 1.1rem;
  }
}
