/* Director Tracker — white on black, gold for what you are working on,
   green for what you have finished. */

:root {
  --bg: #000;
  --fg: #fff;
  --fg-2: rgba(255, 255, 255, 0.64);
  --fg-3: rgba(255, 255, 255, 0.42);
  --fg-4: rgba(255, 255, 255, 0.24);
  --line: rgba(255, 255, 255, 0.1);
  --line-2: rgba(255, 255, 255, 0.2);
  --tint: rgba(255, 255, 255, 0.05);
  --tint-2: rgba(255, 255, 255, 0.1);

  --green: #1fdf64;
  --green-soft: rgba(31, 223, 100, 0.14);
  --gold: #f2c14e;
  --gold-line: rgba(242, 193, 78, 0.6);
  --gold-soft: rgba(242, 193, 78, 0.07);

  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --page: 960px;
  --gutter: 28px;
  --drawer: 392px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  scrollbar-color: #2a2a2a #000;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 var(--sans);
  font-feature-settings: 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p,
ol {
  margin: 0;
}

ol {
  list-style: none;
  padding: 0;
}

::selection {
  background: #fff;
  color: #000;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 1.5px solid #fff;
  outline-offset: 3px;
  border-radius: 6px;
}

.ico {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ───────────── Buttons and inputs ───────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 18px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.2s var(--ease);
}

.btn:hover {
  border-color: #fff;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-solid {
  background: #fff;
  border-color: #fff;
  color: #000;
  font-weight: 600;
}

.btn-solid:hover {
  background: rgba(255, 255, 255, 0.86);
}

.btn-ghost {
  border-color: transparent;
  color: var(--fg-2);
}

.btn-ghost:hover {
  border-color: var(--line-2);
  color: #fff;
}

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  color: var(--fg-2);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.icon-btn:hover,
.icon-btn[aria-expanded='true'] {
  border-color: #fff;
  color: #fff;
}

.icon-btn[aria-expanded='true'] {
  background: #fff;
  color: #000;
}

.dot {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2.5px #000;
}

.link-btn {
  color: var(--fg-3);
  font-size: 12.5px;
  text-decoration: underline;
  text-decoration-color: var(--fg-4);
  text-underline-offset: 3px;
  transition: color 0.2s;
}

.link-btn:hover {
  color: #fff;
}

.handle {
  display: flex;
  align-items: baseline;
  padding: 8px 2px;
  border-bottom: 1px solid var(--line-2);
  font-size: 20px;
  transition: border-color 0.25s;
  cursor: text;
}

.handle:focus-within {
  border-color: #fff;
}

.handle span {
  color: var(--fg-3);
}

.handle input {
  flex: 1;
  min-width: 0;
  width: 11ch;
  padding: 0;
  border: 0;
  background: none;
  outline: none;
  font-weight: 500;
}

.handle-sm {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  padding: 7px 0;
}

/* ───────────── Top progress line ───────────── */

.progress-line {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 300;
  height: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s 0.3s;
}

.progress-line.is-on {
  opacity: 1;
  transition-delay: 0s;
}

.progress-line i {
  display: block;
  height: 100%;
  width: 100%;
  background: #fff;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.75);
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
  transition: transform 0.5s var(--ease);
}

/* ───────────── Welcome & first sync ───────────── */

.welcome,
.firstsync {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px var(--gutter);
}

.welcome-inner {
  width: min(500px, 100%);
  animation: rise 0.9s var(--ease-out) both;
}

.welcome-title {
  font-size: 54px;
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.welcome-form {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  margin-top: 40px;
}

.welcome-form .handle {
  flex: 1;
}

.welcome-form .btn {
  height: 44px;
  padding: 0 26px;
  font-size: 14px;
}

.welcome-note {
  margin-top: 22px;
  font-size: 12.5px;
  color: var(--fg-3);
  transition: color 0.3s;
}

/* Empty unless there is a problem to explain. */
.welcome-note:empty {
  display: none;
}

.welcome-note.is-error {
  color: #fff;
}

.firstsync-inner {
  width: min(440px, 100%);
  animation: rise 0.7s var(--ease-out) both;
}

.firstsync-title {
  margin-bottom: 30px;
  font-size: 32px;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.steps li {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  color: var(--fg-4);
  font-variant-numeric: tabular-nums;
  transition: color 0.4s;
}

.steps li.is-active {
  color: #fff;
}

.steps li.is-done {
  color: var(--fg-2);
}

.steps .mark {
  width: 14px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  justify-self: center;
}

.steps li.is-active .mark {
  border-color: var(--fg-4);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

.steps li.is-done .mark {
  border: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Ccircle cx='7' cy='7' r='7' fill='%231fdf64'/%3E%3Cpath d='m4 7.2 2.1 2.1L10 5.2' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.steps .n {
  font-size: 12.5px;
}

.firstsync-note {
  margin-top: 26px;
  font-size: 12.5px;
  color: var(--fg-3);
}

/* ───────────── App shell ───────────── */

.app {
  max-width: calc(var(--page) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter) 96px;
  container: app / inline-size;
  animation: fade 0.6s var(--ease) both;
}

/* With the filters open the page re-centres in the space that is left, so the
   list stays readable while the sliders move. (app.js animates the hand-over.) */
@media (min-width: 960px) {
  body.drawer-open {
    padding-right: var(--drawer);
  }
}

.top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 0 0;
}

.wordmark {
  flex: none;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-left: auto;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  flex: none;
  padding: 0 15px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.2s var(--ease);
}

.nav-btn:hover {
  border-color: #fff;
  background: var(--tint-2);
}

.nav-btn:active {
  transform: scale(0.96);
}

.nav-btn[aria-pressed='true'] {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.nav-btn .count {
  min-width: 22px;
  margin-right: -6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--tint-2);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--fg-2);
}

.profile-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  min-width: 0;
  margin-left: 6px;
  padding: 0 14px 0 6px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.profile-chip:hover {
  border-color: #fff;
  color: #fff;
}

.profile-chip[aria-expanded='true'] {
  border-color: #fff;
  background: #fff;
  color: #000;
}

/* A ring circles the avatar while a sync is running. */
.profile-chip.is-syncing::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 3px;
  width: 30px;
  height: 30px;
  margin-top: -15px;
  border: 1.5px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.btn .ico {
  width: 15px;
  height: 15px;
}

.btn.is-syncing .ico {
  animation: spin 1.1s linear infinite;
}

.avatar {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  background: #1a1a1a;
  font-size: 11px;
  color: var(--fg-2);
  text-transform: uppercase;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ───────────── Hero ───────────── */

.hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 32px;
  padding: 60px 0 30px;
}

.stat {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-value {
  display: flex;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat-value b {
  font-size: 64px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.05em;
}

.stat-value i {
  margin-left: 5px;
  font-style: normal;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--fg-3);
}

.stat-note {
  margin-top: 8px;
  font-size: 13px;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}

.hero-bar {
  grid-column: 1 / -1;
  height: 3px;
  margin-top: 34px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--line);
}

.hero-bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--green);
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
  transition: transform 0.9s var(--ease-out);
}

/* ───────────── Toolbar ───────────── */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 calc(var(--gutter) * -1);
  padding: 12px var(--gutter);
  background: rgba(0, 0, 0, 0.78);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
          backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}

.sort {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  margin-left: -11px;
  overflow-x: auto;
  scrollbar-width: none;
}

.sort::-webkit-scrollbar {
  display: none;
}

.sort button {
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--fg-3);
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}

.sort button:hover {
  color: #fff;
}

.sort button.is-active {
  color: #fff;
  font-weight: 500;
  background: var(--tint-2);
}

.sort button.is-active::after {
  content: '↓';
  display: inline-block;
  margin-left: 5px;
  font-size: 11px;
  transition: transform 0.35s var(--ease-out);
}

.sort button.is-active.is-up::after {
  transform: rotate(180deg);
}

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
  width: 240px;
  padding: 6px 2px;
  border-bottom: 1px solid transparent;
  color: var(--fg-3);
  cursor: text;
  transition: border-color 0.25s, color 0.25s, width 0.4s var(--ease-out);
}

.search:hover {
  color: var(--fg-2);
}

.search:focus-within {
  width: 280px;
  border-color: var(--line-2);
  color: #fff;
}

.search .ico {
  width: 16px;
  height: 16px;
}

.search input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  outline: none;
  color: #fff;
}

.search input::placeholder {
  color: var(--fg-3);
}

.search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  cursor: pointer;
  background: var(--fg-3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='m3.5 3.5 7 7M10.5 3.5l-7 7'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ───────────── Notices ───────────── */

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 12px 14px 12px 18px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  font-size: 13px;
  color: var(--fg-2);
  animation: rise 0.5s var(--ease-out) both;
}

.notice .btn {
  height: 32px;
  flex: none;
}

.footnote {
  padding: 26px 0 0;
  font-size: 12.5px;
  color: var(--fg-3);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.footnote:empty {
  display: none;
}

.footnote .shimmer {
  background: linear-gradient(90deg, var(--fg-3) 0%, #fff 50%, var(--fg-3) 100%) 0 0 / 200% 100%;
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  animation: shimmer 2.2s linear infinite;
}

.empty {
  padding: 96px 0 72px;
  text-align: center;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg-2);
  animation: rise 0.5s var(--ease-out) both;
}

.empty small {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--fg-3);
}

/* ───────────── Director rows ───────────── */

.directors {
  position: relative;
  padding-top: 10px;
  overflow-anchor: none;
}

.director {
  border-bottom: 1px solid var(--line);
  transition: opacity 0.3s;
}

.director.is-hidden {
  opacity: 0.4;
}

/* The first row after the pinned group, and the first completed one. */
.director.starts-group {
  margin-top: 28px;
}

.d-row {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto minmax(96px, 240px) 16px;
  align-items: center;
  column-gap: 18px;
  margin: 0 -14px;
  padding: 13px 14px;
  border-radius: 14px;
  transition: background 0.25s;
}

.d-row:hover {
  background: var(--tint);
}

.d-avatar {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 50%;
  background: #141414;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-3);
  filter: grayscale(1) contrast(1.08);
  transition: filter 0.5s, transform 0.5s var(--ease-out), box-shadow 0.3s;
}

.d-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 22%;
  opacity: 0;
  transition: opacity 0.5s;
}

.d-avatar img.is-loaded {
  opacity: 1;
}

.d-row:hover .d-avatar,
.director.is-open .d-avatar,
.director.is-pinned .d-avatar,
.director.is-complete .d-avatar {
  filter: none;
}

.d-avatar:hover {
  transform: scale(1.08);
}

.d-toggle {
  display: block;
  min-width: 0;
  text-align: left;
}

/* The whole row opens and closes the director; the avatar and the two action
   buttons sit above this stretched hit area. */
.d-toggle::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.d-toggle:focus-visible {
  outline: none;
}

.d-toggle:focus-visible::after {
  border-radius: 14px;
  outline: 1.5px solid #fff;
  outline-offset: -1px;
}

.d-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  transition: color 0.3s;
}

.d-name > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.d-seal {
  display: none;
  flex: none;
  width: 16px;
  height: 16px;
}

.d-seal circle {
  fill: var(--green);
}

.d-sub {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  font-size: 12.5px;
  color: var(--fg-3);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.d-sub b {
  font-weight: 500;
  color: var(--fg);
  transition: color 0.3s;
}

.d-sub em {
  font-style: normal;
  color: var(--fg-2);
}

.d-actions {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 2px;
}

.d-act {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--fg-3);
  opacity: 0;
  transition: opacity 0.2s, color 0.2s, background 0.2s, transform 0.2s var(--ease);
}

.d-act .ico {
  width: 16px;
  height: 16px;
}

.d-row:hover .d-act,
.d-act:focus-visible,
.director.is-pinned .d-act-pin,
.director.is-hidden .d-act-hide {
  opacity: 1;
}

.d-act:hover {
  color: #fff;
  background: var(--tint-2);
}

.d-act:active {
  transform: scale(0.9);
}

@media (hover: none) {
  .d-act {
    opacity: 0.6;
  }
}

.d-bar {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 2px;
  height: 6px;
}

.d-bar i {
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.17);
  transition: background 0.6s var(--ease);
}

.d-bar i.on {
  background: var(--green);
}

.d-bar.is-dense {
  gap: 1px;
}

.d-bar.is-solid {
  display: block;
  overflow: hidden;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.17);
}

.d-bar.is-solid i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0;
  background: var(--green);
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
  transition: transform 0.7s var(--ease-out);
}

.d-chev {
  width: 16px;
  height: 16px;
  color: var(--fg-4);
  transition: transform 0.45s var(--ease-out), color 0.25s;
}

.d-row:hover .d-chev {
  color: #fff;
}

.director.is-open .d-chev {
  transform: rotate(180deg);
  color: #fff;
}

/* Pinned: the directors being watched right now. Gold, outlined, on top. */

.director.is-pinned {
  margin: 0 -14px 8px;
  padding: 0 14px;
  border: 1px solid var(--gold-line);
  border-radius: 16px;
  background: var(--gold-soft);
}

.director.is-pinned .d-row {
  border-radius: 15px;
}

.director.is-pinned .d-name {
  color: var(--gold);
}

.director.is-pinned .d-avatar {
  box-shadow: 0 0 0 2px #000, 0 0 0 3.5px var(--gold);
}

.director.is-pinned .d-act-pin {
  color: var(--gold);
}

.director.is-pinned .d-act-pin .ico {
  fill: currentColor;
}

/* Completed: every movie that counts is watched. Green. */

.director.is-complete .d-name,
.director.is-complete .d-sub b {
  color: var(--green);
}

.director.is-complete .d-seal {
  display: block;
}

.director.is-complete .d-avatar {
  box-shadow: 0 0 0 2px #000, 0 0 0 3.5px var(--green);
}

.director.just-completed .d-seal {
  animation: stamp 0.6s var(--spring) both;
}

.director.just-completed .d-row {
  animation: glow 1.6s var(--ease) both;
}

/* Expanding body: grid rows 0fr → 1fr animates to the content's own height. */

.d-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.5s var(--ease-out);
}

.director.is-open > .d-body {
  grid-template-rows: 1fr;
}

.d-body-inner {
  min-height: 0;
  overflow: hidden;
}

.d-panel {
  padding: 8px 0 26px 62px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s, transform 0.5s var(--ease-out);
}

.director.is-open .d-panel {
  opacity: 1;
  transform: none;
  transition-delay: 0.06s;
}

.p-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 4px 0;
  font-size: 12.5px;
  color: var(--fg-3);
  transition: color 0.2s;
}

.p-more:hover {
  color: #fff;
}

.p-more::before {
  content: '+';
  display: inline-block;
  width: 10px;
  transition: transform 0.35s var(--ease-out);
}

.p-more[aria-expanded='true']::before {
  transform: rotate(45deg);
}

.p-out {
  margin-top: 6px;
}

/* ───────────── Movie rows ───────────── */

.f-cols,
.film {
  display: grid;
  grid-template-columns: 26px 40px minmax(0, 1fr) 78px 74px 48px 48px 52px 22px;
  align-items: center;
  column-gap: 14px;
}

/* Column titles double as sort buttons. */
.f-cols {
  margin: 0 -8px;
  padding: 0 8px 7px;
  border-bottom: 1px solid var(--line);
}

.f-cols button {
  justify-self: center;
  padding: 3px 0;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--fg-4);
  transition: color 0.2s;
}

/* Sits above the posters and titles. */
.f-cols .c-year {
  grid-column: span 2;
  justify-self: start;
}

.f-cols button:hover {
  color: var(--fg-2);
}

.f-cols button.is-active {
  color: #fff;
}

.f-cols button.is-active::before {
  content: '↓';
  display: inline-block;
  margin-right: 4px;
  letter-spacing: 0;
  transition: transform 0.35s var(--ease-out);
}

/* On the centred titles the arrow hangs outside the word, so the word itself
   stays centred over its column. */
.f-cols button:not(.c-year) {
  position: relative;
}

.f-cols button:not(.c-year).is-active::before {
  position: absolute;
  right: 100%;
  top: 3px;
}

.f-cols button.is-active.is-asc::before {
  transform: rotate(180deg);
}

.films {
  position: relative;
}

.film {
  position: relative;
  margin: 0 -8px;
  padding: 7px 8px;
  border-radius: 10px;
  transition: background 0.2s;
}

.film:hover {
  background: var(--tint);
}

.f-check {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
}

.f-check svg {
  width: 22px;
  height: 22px;
  overflow: visible;
}

.f-check circle {
  fill: transparent;
  stroke: var(--fg-4);
  stroke-width: 1.5;
  transition: fill 0.3s var(--ease), stroke 0.3s;
}

.f-check path {
  fill: none;
  stroke: #000;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 14;
  stroke-dashoffset: 14;
  transition: stroke-dashoffset 0.35s var(--ease) 0.08s, stroke 0.3s;
}

.f-check:hover circle {
  stroke: var(--green);
}

.film.is-seen .f-check circle {
  fill: var(--green);
  stroke: var(--green);
}

.film.is-seen .f-check path {
  stroke-dashoffset: 0;
}

/* Ticked here but not on Letterboxd yet: outlined until the next sync confirms it. */
.film.is-manual .f-check circle {
  fill: transparent;
  stroke: var(--green);
}

.film.is-manual .f-check path {
  stroke: var(--green);
}

.f-check.pop svg {
  animation: pop 0.5s var(--spring);
}

.f-check.pop::after {
  content: '';
  position: absolute;
  inset: 2px;
  border: 1.5px solid var(--green);
  border-radius: 50%;
  animation: ring 0.65s var(--ease-out) both;
  pointer-events: none;
}

.f-poster {
  width: 40px;
  height: 60px;
  overflow: hidden;
  border-radius: 3px;
  background: #121212;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07);
  transition: transform 0.4s var(--ease-out);
}

.film:hover .f-poster {
  transform: scale(1.05);
}

.f-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.45s;
}

.f-poster img.is-loaded {
  opacity: 1;
}

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

.f-title {
  display: block;
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.3s;
}

/* Stretch the title link over the whole row. */
.f-title::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 10px;
}

.f-title:focus-visible {
  outline: none;
}

.f-title:focus-visible::after {
  outline: 1.5px solid #fff;
  outline-offset: -1px;
}

.film.is-seen .f-title {
  color: var(--fg-2);
  font-weight: 400;
}

.f-fresh {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px 2px;
  border-radius: 999px;
  background: var(--green);
  color: #000;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 2px;
}

.f-meta {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  font-size: 12.5px;
  color: var(--fg-3);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.f-meta .m-ratings {
  display: none;
}

/* Every value sits centred under its column title. */
.f-date,
.f-rate,
.f-stat {
  text-align: center;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--fg-2);
}

/* When you watched it, then what you gave it: each in its own column. */
.f-date {
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg-3);
}

.f-rate {
  letter-spacing: 0.04em;
  color: #fff;
}

.f-stat.is-empty {
  color: var(--fg-4);
}

a.f-stat {
  position: relative;
  z-index: 2;
  transition: color 0.2s;
}

a.f-stat[href]:hover {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.f-hide {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--fg-3);
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
}

.f-hide .ico {
  width: 15px;
  height: 15px;
}

.film:hover .f-hide,
.f-hide:focus-visible {
  opacity: 1;
}

.f-hide:hover {
  color: #fff;
}

.film.is-out {
  opacity: 0.5;
  transition: opacity 0.25s, background 0.2s;
}

.film.is-out:hover {
  opacity: 0.9;
}

/* A movie that does not count says why, across both of those columns. */
.film.is-out .f-date {
  grid-column: span 2;
  color: var(--fg-2);
}

.film.is-out .f-rate {
  display: none;
}

/* ───────────── Drawer ───────────── */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  width: min(var(--drawer), 100vw);
  background: rgba(4, 4, 4, 0.94);
  -webkit-backdrop-filter: blur(22px);
          backdrop-filter: blur(22px);
  border-left: 1px solid var(--line-2);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.55s var(--ease-out), visibility 0s 0.55s;
}

.drawer.is-open {
  transform: none;
  visibility: visible;
  transition-delay: 0s;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 26px 8px;
}

.drawer-head h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 26px 40px;
  scrollbar-width: thin;
}

.drawer-summary {
  min-height: 20px;
  margin-bottom: 26px;
  font-size: 13px;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}

.drawer-notice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin: -8px 0 26px;
  padding: 13px 15px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  font-size: 12.5px;
  color: var(--fg-2);
  animation: rise 0.45s var(--ease-out) both;
}

.drawer-notice .btn {
  height: 30px;
  padding: 0 14px;
  font-size: 12.5px;
}

.drawer h3 {
  margin: 34px 0 18px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.field {
  margin-bottom: 20px;
}

.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--fg-2);
}

.field-head output {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.field-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--fg-3);
}

.range {
  -webkit-appearance: none;
          appearance: none;
  display: block;
  width: 100%;
  height: 24px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  --p: 50%;
}

.range::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(to right, #fff var(--p), rgba(255, 255, 255, 0.2) var(--p));
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.16);
  transition: box-shadow 0.25s, transform 0.25s var(--spring);
}

.range:hover::-webkit-slider-thumb {
  box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.12);
}

.range:active::-webkit-slider-thumb {
  transform: scale(1.2);
  box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.16);
}

.range::-moz-range-track {
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
}

.range::-moz-range-progress {
  height: 2px;
  border-radius: 2px;
  background: #fff;
}

.range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #fff;
}

.range:focus-visible {
  outline: none;
}

.range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px #000, 0 0 0 4.5px #fff;
}

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  font-size: 13px;
  color: var(--fg-2);
  cursor: pointer;
  transition: color 0.2s;
}

.switch:hover {
  color: #fff;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch i {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  border: 1px solid var(--fg-4);
  border-radius: 999px;
  transition: background 0.3s, border-color 0.3s;
}

.switch i::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--fg-3);
  transition: transform 0.4s var(--spring), background 0.3s;
}

.switch input:checked + i {
  background: #fff;
  border-color: #fff;
}

.switch input:checked + i::after {
  background: #000;
  transform: translateX(14px);
}

.switch input:focus-visible + i {
  outline: 1.5px solid #fff;
  outline-offset: 3px;
}

.segmented {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
}

.segmented button {
  flex: 1;
  padding: 6px 8px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--fg-2);
  white-space: nowrap;
  transition: background 0.3s var(--ease), color 0.3s;
}

.segmented button:hover {
  color: #fff;
}

.segmented button.is-active {
  background: #fff;
  color: #000;
  font-weight: 500;
}

.handle-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.drawer-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.drawer #resetFilters {
  margin-top: 12px;
}

/* ───────────── Random picks ───────────── */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  animation: fade 0.3s both;
}

.modal-card {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 30px;
  border: 1px solid var(--line-2);
  border-radius: 22px;
  background: #060606;
  animation: lift 0.5s var(--ease-out) both;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  border-color: transparent;
}

.pick {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 30px;
  align-items: center;
}

.pick.is-empty {
  grid-template-columns: 1fr;
  padding: 18px 40px 18px 4px;
}

.pick-poster {
  display: grid;
  place-items: center;
  width: 180px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  font-size: 44px;
  font-weight: 700;
  color: var(--fg-4);
  border-radius: 8px;
  background: #121212;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.pick-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 20%;
  opacity: 0;
  transition: opacity 0.5s;
}

.pick-poster img.is-loaded {
  opacity: 1;
}

.pick-body {
  min-width: 0;
}

.pick-body.swap,
.pick-poster.swap {
  animation: rise 0.5s var(--ease-out) both;
}

.pick-title {
  margin-bottom: 8px;
  padding-right: 28px;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.pick-meta {
  font-size: 13px;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}

.pick-meta b {
  font-weight: 500;
  color: #fff;
}

.pick-by {
  margin-top: 14px;
}

.pick-bar {
  margin-top: 16px;
  max-width: 280px;
}

.pick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.pick-actions .btn {
  padding: 0 16px;
}

/* ───────────── Toasts & effects ───────────── */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 250;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 18px;
  border-radius: 999px;
  background: #fff;
  color: #000;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
  animation: toast-in 0.5s var(--spring) both;
}

.toast.is-leaving {
  animation: toast-out 0.3s var(--ease) both;
}

.toast button {
  flex: none;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
}

/* A director completed. */
.toast.is-big {
  padding: 13px 22px;
  background: var(--green);
  font-size: 14px;
}

.toast.is-big em {
  font-style: normal;
  font-weight: 700;
}

.fx {
  position: fixed;
  inset: 0;
  z-index: 260;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ───────────── Motion ───────────── */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes lift {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
}

@keyframes pop {
  0% {
    transform: scale(0.8);
  }
  55% {
    transform: scale(1.22);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes ring {
  from {
    opacity: 0.9;
    transform: scale(0.7);
  }
  to {
    opacity: 0;
    transform: scale(2.3);
  }
}

@keyframes stamp {
  from {
    opacity: 0;
    transform: scale(2.4) rotate(-18deg);
  }
}

@keyframes glow {
  0% {
    background: var(--green-soft);
    box-shadow: 0 0 0 1px var(--green);
  }
  100% {
    background: transparent;
    box-shadow: 0 0 0 1px transparent;
  }
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.94);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
}

/* Animations off (the switch in the panel): everything lands instantly. */
.no-motion *,
.no-motion *::before,
.no-motion *::after {
  animation-duration: 0.001ms !important;
  animation-delay: 0s !important;
  transition-duration: 0.001ms !important;
  transition-delay: 0s !important;
}

/* ───────────── Narrower page column (also when the filters are open) ───────────── */

@container app (max-width: 840px) {
  .d-row {
    grid-template-columns: 42px minmax(0, 1fr) auto minmax(70px, 150px) 16px;
    column-gap: 14px;
  }

  .d-avatar {
    width: 42px;
    height: 42px;
  }

  .d-panel {
    padding-left: 0;
  }

  .f-cols,
  .film {
    grid-template-columns: 26px 40px minmax(0, 1fr) 78px 74px 48px 22px;
  }

  .f-imdb,
  .f-views,
  .f-cols .c-imdb,
  .f-cols .c-views {
    display: none;
  }

  .stat-value b {
    font-size: 52px;
  }

  .stat-value i {
    font-size: 21px;
  }
}

/* ───────────── Phones ───────────── */

@media (max-width: 860px) {
  .top {
    flex-wrap: wrap;
    row-gap: 12px;
  }

  .profile-chip {
    margin-left: auto;
  }

  .top-nav {
    order: 3;
    width: 100%;
    margin: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .top-nav::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 620px) {
  :root {
    --gutter: 18px;
  }

  .app {
    padding-bottom: 64px;
  }

  .top {
    padding-top: 18px;
  }

  .profile-chip #profileName {
    max-width: 11ch;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hero {
    column-gap: 14px;
    padding: 36px 0 24px;
  }

  .stat-value b {
    font-size: 34px;
  }

  .stat-value i {
    font-size: 15px;
    margin-left: 3px;
  }

  .stat-note {
    margin-top: 6px;
    font-size: 11.5px;
  }

  .hero-bar {
    margin-top: 24px;
  }

  .toolbar {
    position: static;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .search,
  .search:focus-within {
    width: 100%;
    border-color: var(--line);
  }

  .d-row {
    grid-template-columns: 38px minmax(0, 1fr) auto 14px;
    grid-template-areas:
      'avatar main actions chev'
      'avatar bar bar bar';
    column-gap: 12px;
    row-gap: 9px;
  }

  .d-avatar {
    grid-area: avatar;
    width: 38px;
    height: 38px;
    align-self: start;
  }

  .d-toggle {
    grid-area: main;
  }

  .d-actions {
    grid-area: actions;
  }

  .d-bar {
    grid-area: bar;
    height: 5px;
  }

  .d-chev {
    grid-area: chev;
    width: 14px;
    height: 14px;
  }

  .d-name {
    font-size: 17px;
  }

  .f-cols {
    display: none;
  }

  .film {
    grid-template-columns: 26px 36px minmax(0, 1fr) auto 62px;
    column-gap: 10px;
  }

  .f-poster {
    width: 36px;
    height: 54px;
  }

  .f-lb,
  .f-hide,
  .f-meta .m-genres {
    display: none;
  }

  .f-meta .m-ratings {
    display: inline;
  }

  .pick {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .pick-poster {
    width: 120px;
  }

  .pick-title {
    font-size: 25px;
  }

  .modal-card {
    padding: 22px;
  }

  .welcome-title {
    font-size: 40px;
  }

  .welcome-form {
    flex-direction: column;
    align-items: stretch;
    gap: 22px;
  }

  .firstsync-title {
    font-size: 27px;
  }
}
