:root {
  color-scheme: light dark;
  --bg: #0f1115;
  --card: #1a1d24;
  --text: #f2f2f2;
  --muted: #9aa0aa;
  --accent: #e63946;
  --accent2: #2ec4b6;
  --border: #2a2e37;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 60px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 20;
  flex-wrap: wrap;
}

.topbar h1 { margin: 0; font-size: 1.3rem; white-space: nowrap; }

.search-wrap { position: relative; flex: 1; min-width: 200px; }

#searchInput {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 0.95rem;
}

.search-results {
  position: absolute;
  top: 44px;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 420px;
  overflow-y: auto;
  z-index: 30;
}

.search-result-item {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  align-items: center;
}
.search-result-item:hover { background: #23262f; }
.search-result-item img { width: 36px; height: 54px; object-fit: cover; border-radius: 4px; background: #333; }
.search-result-item .meta { font-size: 0.8rem; color: var(--muted); }

.pill {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
}

.auth-area { display: flex; align-items: center; }
.user-badge { display: flex; align-items: center; gap: 8px; }
.user-badge img { width: 32px; height: 32px; border-radius: 50%; }
.user-badge span { font-size: 0.85rem; }

main { padding: 20px; max-width: 1200px; margin: 0 auto; }

h2 { font-size: 1.1rem; margin: 24px 0 10px; }
.hint { font-weight: normal; color: var(--muted); font-size: 0.8rem; }

.row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.card {
  flex: 0 0 150px;
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: transform 0.15s;
}
.card:hover { transform: translateY(-3px); }
.card img { width: 100%; height: 220px; object-fit: cover; background: #333; display: block; }
.card .info { padding: 8px; }
.card .title { font-size: 0.85rem; font-weight: 600; line-height: 1.2; }
.card .sub { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
.card .rating { color: #ffd166; font-size: 0.75rem; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tab {
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 0.8rem;
}
.tab.active { background: var(--accent2); color: #06231f; border-color: var(--accent2); font-weight: 600; }

.detail {
  display: flex;
  gap: 24px;
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.detail img.poster { width: 220px; border-radius: 10px; flex-shrink: 0; }
.detail .body { flex: 1; min-width: 260px; }
.detail h2 { margin-top: 0; font-size: 1.5rem; }
.detail .overview { color: var(--muted); line-height: 1.5; margin: 10px 0; }
.detail .cast { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.cast-chip { font-size: 0.75rem; background: #23262f; padding: 4px 8px; border-radius: 12px; }
.actions { display: flex; gap: 10px; margin: 14px 0; }
.btn { padding: 9px 16px; border-radius: 8px; border: none; cursor: pointer; font-size: 0.85rem; font-weight: 600; }
.btn.add { background: var(--accent2); color: #06231f; }
.btn.ignore { background: #3a3f4b; color: var(--text); }
.btn.remove { background: #3a3f4b; color: var(--text); }
.btn.close { background: transparent; border: 1px solid var(--border); color: var(--text); }
.providers { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.providers img { width: 36px; height: 36px; border-radius: 8px; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 340px;
  background: var(--card);
  border-left: 1px solid var(--border);
  z-index: 50;
  overflow-y: auto;
  padding: 16px;
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer-head button { background: none; border: none; color: var(--text); font-size: 1.2rem; cursor: pointer; }
.wl-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); align-items: center; }
.wl-item img { width: 40px; height: 60px; object-fit: cover; border-radius: 4px; }
.wl-item .name { flex: 1; font-size: 0.85rem; }
.wl-item button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.9rem; }

.hidden { display: none !important; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #23262f;
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 0.85rem;
  z-index: 100;
}

@media (max-width: 600px) {
  .drawer { width: 100%; }
  .detail img.poster { width: 140px; }
}
