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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-2: #232736;
  --text: #e8eaf0;
  --text-dim: #9aa0b0;
  --accent: #5b8def;
  --radius: 10px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.9rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid #2c3040;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

nav { display: flex; gap: 1rem; }
nav a { color: var(--text-dim); text-decoration: none; font-size: 0.95rem; }
nav a:hover { color: var(--text); }

main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

footer {
  padding: 1rem 1.5rem;
  color: var(--text-dim);
  font-size: 0.8rem;
  text-align: center;
}
footer a { color: var(--text-dim); }

h1 { font-size: 1.6rem; margin-bottom: 1rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 0.75rem; }
.dim { color: var(--text-dim); }
.error { color: #ef6b6b; padding: 1rem 0; }

.search-box {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 1.05rem;
  background: var(--surface);
  border: 1px solid #2c3040;
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
}
.search-box:focus { border-color: var(--accent); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.12s, background 0.12s;
  display: block;
}
.card:hover { transform: translateY(-3px); background: var(--surface-2); }
.card img, .card .no-img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 2rem;
}
.card .card-body { padding: 0.6rem 0.7rem; }
.card .title { font-weight: 600; font-size: 0.9rem; }
.card .sub { color: var(--text-dim); font-size: 0.8rem; }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}

.detail-header { display: flex; gap: 1.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.detail-header img {
  width: 200px;
  border-radius: var(--radius);
  align-self: flex-start;
}
.detail-header .info { flex: 1; min-width: 260px; }
.detail-header .overview { margin-top: 0.75rem; color: var(--text-dim); max-width: 65ch; }

select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid #2c3040;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  margin: 0.5rem 0;
}

.episode-list { list-style: none; margin-top: 0.5rem; }
.episode-list li a {
  display: flex;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  align-items: baseline;
}
.episode-list li a:hover { background: var(--surface); }
.episode-list .ep-num { color: var(--accent); font-weight: 600; min-width: 3.2rem; }
.episode-list .ep-date { color: var(--text-dim); font-size: 0.85rem; margin-left: auto; white-space: nowrap; }

.film-list { list-style: none; margin-top: 0.5rem; }
.film-list li a {
  display: flex;
  gap: 0.9rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  align-items: center;
}
.film-list li a:hover { background: var(--surface); }
.film-list img, .film-list .no-img {
  width: 46px;
  height: 69px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface-2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}
.film-list .film-info .name { font-weight: 600; }
.film-list .film-info .role { color: var(--text-dim); font-size: 0.88rem; }
.film-list .year { margin-left: auto; color: var(--text-dim); white-space: nowrap; font-size: 0.9rem; }

.compare-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.compare-col { flex: 1; min-width: 280px; position: relative; }
.picked {
  margin-top: 0.5rem;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.picked button {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
}
.dropdown {
  position: absolute;
  left: 0; right: 0;
  background: var(--surface-2);
  border: 1px solid #2c3040;
  border-radius: 8px;
  margin-top: 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 20;
}
.dropdown div { padding: 0.5rem 0.8rem; cursor: pointer; }
.dropdown div:hover { background: var(--accent); color: #fff; }

.spinner { padding: 2rem; text-align: center; color: var(--text-dim); }
