:root {
  --bg: #0f1115;
  --surface: #1a1d24;
  --surface-2: #232730;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --accent: #ffb300;
  --border: #2a2e38;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.topbar h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.05em;
}

.topbar h1 a { color: var(--text); display: flex; align-items: center; gap: 0.5rem; }

.logo {
  height: 2rem;
  width: auto;
  vertical-align: middle;
}

#search-form {
  display: flex;
  flex: 1;
  max-width: 600px;
  gap: 0.5rem;
}

#search-input {
  flex: 1;
  padding: 0.6rem 0.9rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}

#search-input:focus {
  outline: none;
  border-color: var(--accent);
}

button {
  padding: 0.6rem 1.2rem;
  background: var(--accent);
  color: #1a1d24;
  border: 0;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

button:hover { filter: brightness(1.1); }

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

.loading, .empty, .error {
  text-align: center;
  color: var(--muted);
  padding: 3rem 0;
}

.error { color: #ff6b6b; }

/* ---------- Grid (Suchergebnisse) ---------- */

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.card .poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  background: var(--surface-2);
  object-fit: cover;
  display: block;
}

.card .meta {
  padding: 0.6rem 0.75rem 0.9rem;
}

.card .title {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.card .year {
  color: var(--muted);
  font-size: 0.8rem;
}

/* ---------- Letter Bar ---------- */

.letter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.letter {
  display: inline-block;
  min-width: 2rem;
  padding: 0.3rem 0.5rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
}

.letter:hover { border-color: var(--accent); text-decoration: none; }

.letter.active {
  background: var(--accent);
  color: #1a1d24;
  border-color: var(--accent);
}

/* ---------- Series List (alphabetisch) ---------- */

.series-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.5rem;
}

.series-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}

.series-row:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.series-name { font-weight: 600; }

.series-desc {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Detail ---------- */

.detail-hero {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
}

.detail-hero .poster {
  width: 240px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--surface-2);
}

.detail-hero h2 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
}

.detail-hero .original {
  color: var(--muted);
  margin: 0 0 1rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.tag {
  background: var(--surface-2);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--muted);
}

.season-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.season-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

.season-tab.active {
  background: var(--accent);
  color: #1a1d24;
  border-color: var(--accent);
  font-weight: 600;
}

.episode-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.episode {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.episode-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  user-select: none;
}

.episode-header:hover { background: var(--surface-2); }

.episode-num {
  color: var(--accent);
  font-weight: 700;
  min-width: 2.5rem;
}

.episode-title {
  flex: 1;
  font-weight: 500;
}

.episode-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.episode-body {
  display: none;
  padding: 0 1rem 1rem 4rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.episode.open .episode-body { display: block; }
.episode.open .episode-header { background: var(--surface-2); }

.episode-desc {
  margin: 0 0 0.8rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.no-embed {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

.player-block {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.play-btn {
  align-self: flex-start;
  background: var(--accent);
  color: #1a1d24;
  border: 0;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.play-btn:hover { filter: brightness(1.1); }
.play-btn:disabled { opacity: 0.6; cursor: wait; }

.player {
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 0;
  border-radius: 8px;
  margin-top: 0.4rem;
}

.player-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  min-height: 1em;
}

.player-status.error { color: #ff6b6b; }

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--muted);
}

.footer {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: stretch; padding: 1rem; }
  .detail-hero { flex-direction: column; }
  .detail-hero .poster { width: 100%; max-width: 240px; margin: 0 auto; }
  main { padding: 1rem; }
}

/* ---------- Fernbedienung / Tastatur-Fokus ---------- */
.remote-focus {
  outline: 3px solid var(--accent) !important;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(255, 179, 0, 0.25);
  border-radius: 8px;
  scroll-margin: 96px;
  z-index: 5;
  position: relative;
}
body.remote-active a:focus,
body.remote-active button:focus,
body.remote-active input:focus,
body.remote-active select:focus,
body.remote-active [tabindex]:focus {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.remote-hint {
  position: fixed;
  right: 12px;
  bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  color: var(--muted);
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
body.remote-active .remote-hint { opacity: 1; }

