:root {
  --bg: #0f1115;
  --surface: #1a1d24;
  --surface-2: #232733;
  --text: #f4f5f7;
  --muted: #9aa0ae;
  --accent: #e50914;
  --border: #2c3140;
}

* { box-sizing: border-box; }

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  font-size: 20px;
  margin: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: block;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-label {
  color: var(--muted);
  font-size: 14px;
}

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

.lead {
  color: var(--muted);
  max-width: 460px;
  line-height: 1.5;
}

.view { margin-top: 8px; }

.hidden { display: none !important; }

#signinView {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: 64px;
}

.google-btn {
  margin: 24px 0;
  display: flex;
  justify-content: center;
  min-height: 44px;
}

.lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

@media (max-width: 900px) {
  .lists { grid-template-columns: 1fr; }
}

.list-col h2 {
  font-size: 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.count {
  color: var(--muted);
  font-weight: 400;
  font-size: 14px;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  display: flex;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

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

.card img {
  width: 72px;
  height: 108px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-2);
  flex-shrink: 0;
}

.card .poster-fallback {
  width: 72px;
  height: 108px;
  border-radius: 8px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 28px;
  flex-shrink: 0;
}

.card-info { flex: 1; min-width: 0; }

.card-title {
  font-weight: 600;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.card-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.btn {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 8px 12px;
  background: var(--surface-2);
  color: var(--text);
}

.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.5; cursor: default; }

.btn-ghost { background: transparent; }

.btn-remove {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  flex-shrink: 0;
}
.btn-remove:hover { color: var(--accent); }

.empty {
  color: var(--muted);
  font-size: 14px;
  padding: 12px 0;
}

.message {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px;
}

.message.error {
  border-color: var(--accent);
  color: #ffb4b4;
}

/* ---- Detail modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.modal {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { color: var(--text); }

.modal-body {
  display: flex;
  gap: 24px;
}

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

.modal-poster img {
  width: 200px;
  border-radius: 12px;
  background: var(--surface-2);
  display: block;
}

.modal-poster .poster-fallback {
  width: 200px;
  height: 300px;
  border-radius: 12px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  color: var(--muted);
}

.modal-details { flex: 1; min-width: 0; }

.modal-title {
  margin: 4px 0 8px;
  font-size: 24px;
  overflow-wrap: anywhere;
}

.modal-meta {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 16px;
}

.modal-meta .chip {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  margin: 0 8px 8px 0;
}

.modal-description {
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
}

.modal-description.empty { color: var(--muted); font-style: italic; }

.modal-watch {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.watch-link {
  display: inline-block;
  text-decoration: none;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
}
.watch-link:hover { filter: brightness(1.1); }

/* ---- Share button + toast ---- */
.btn-share {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  flex-shrink: 0;
}
.btn-share:hover { color: var(--text); border-color: var(--border); }

.card .btn-share { padding: 8px 10px; }

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  flex-shrink: 0;
}

.modal .btn-share {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
  margin-bottom: 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
