:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1d2733;
  --muted: #5f6f82;
  --line: #d9e1ea;
  --accent: #1366d6;
  --accent-soft: #eaf2ff;
  --watched-bg: #eefaf1;
  --watched-line: #b7e6c4;
  --danger: #b32020;
  --shadow: 0 8px 24px rgba(16, 34, 58, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f9fbff 0%, var(--bg) 60%);
  min-height: 100vh;
}

h1,
p {
  margin: 0;
}

.app-shell {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
}

.card,
.list-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.login-card {
  margin-top: 12vh;
  padding: 1.5rem;
}

.stack {
  margin-top: 1rem;
  display: grid;
  gap: 0.75rem;
}

input,
button {
  font: inherit;
}

input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.outline-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.hidden {
  display: none !important;
}

.error {
  color: var(--danger);
}

.muted {
  color: var(--muted);
}

.top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.top-actions {
  display: grid;
  gap: 0.6rem;
  justify-items: end;
}

.voter-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.voter-btn {
  background: #fff;
  color: var(--text);
  border-radius: 0;
  border-right: 1px solid var(--line);
  min-width: 88px;
}

.voter-btn:last-child {
  border-right: 0;
}

.voter-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.list-card {
  overflow: hidden;
}

.list-head {
  display: grid;
  grid-template-columns: 52px 1fr 88px;
  gap: 0.5rem;
  border-bottom: 1px solid var(--line);
  padding: 0.7rem 0.85rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.show-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.show-row {
  display: grid;
  grid-template-columns: 52px 24px 1fr 88px;
  gap: 0.55rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.show-row:last-child {
  border-bottom: 0;
}

.show-row.watched {
  background: var(--watched-bg);
  border-left: 3px solid var(--watched-line);
  padding-left: calc(0.85rem - 3px);
}

.show-row.dragging {
  opacity: 0.96;
}

.drag-placeholder {
  list-style: none;
  margin: 0;
  border-top: 2px dashed var(--accent);
  border-bottom: 2px dashed var(--accent);
  background: rgba(19, 102, 214, 0.08);
}

.show-list.drag-active {
  user-select: none;
}

body.is-dragging {
  cursor: grabbing;
}

.points {
  font-weight: 700;
  color: var(--accent);
  text-align: center;
}

.drag-handle {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.2rem;
  cursor: grab;
  touch-action: none;
  width: 28px;
  height: 28px;
  line-height: 1;
}

.drag-handle:active {
  cursor: grabbing;
}

.show-main {
  min-width: 0;
}

.show-title {
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
  word-break: break-word;
}

.show-meta {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.show-note {
  margin-top: 0.35rem;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  resize: vertical;
  min-height: 2.4rem;
  color: var(--text);
  background: #fff;
}

.show-note:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.watch-toggle {
  justify-self: end;
  background: #f3f6fa;
  color: var(--text);
  border: 1px solid var(--line);
  min-width: 78px;
  padding: 0.45rem 0.55rem;
}

.watch-toggle.watched {
  background: #dff6e6;
  border-color: var(--watched-line);
}

@media (max-width: 640px) {
  .app-shell {
    padding: 0.7rem;
  }

  .top-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .top-actions {
    justify-items: stretch;
  }

  .list-head {
    grid-template-columns: 52px 1fr 74px;
  }

  .show-row {
    grid-template-columns: 52px 24px 1fr 74px;
  }

  .watch-toggle {
    min-width: 64px;
    padding-inline: 0.45rem;
  }
}
