:root {
  --bg: #0c0e12;
  --bg-elevated: #141820;
  --bg-card: #1a1f2a;
  --bg-card-hover: #212836;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #eef0f4;
  --text-muted: #8b93a7;
  --accent: #e8b84a;
  --accent-dim: rgba(232, 184, 74, 0.15);
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b93a7' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  --movie: #5b9fd4;
  --movie-dim: rgba(91, 159, 212, 0.15);
  --tv: #9b7ede;
  --tv-dim: rgba(155, 126, 222, 0.15);
  --anime: #e86b8a;
  --anime-dim: rgba(232, 107, 138, 0.15);
  --franchise: #6bc9a8;
  --franchise-dim: rgba(107, 201, 168, 0.15);
  --watched: #4ade80;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --font: "DM Sans", system-ui, sans-serif;
  --font-display: "Playfair Display", Georgia, serif;
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(ellipse 70% 45% at 50% -15%, rgba(232, 184, 74, 0.07), transparent),
    radial-gradient(ellipse 50% 35% at 100% 0%, rgba(91, 159, 212, 0.05), transparent),
    var(--bg);
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: max(2rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right))
    max(3rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
}
/* =========================================================
   SITE IDENTITY
   ========================================================= */

   .site-identity {
    display: flex;
    align-items: center;
    gap: 20px;
  
    width: 100%;
    padding-bottom: 18px;
    margin-bottom: 24px;
  
    border-bottom: 1px solid var(--border);
  }
  
  .site-logo {
    display: block;
    flex-shrink: 0;
  
    width: 110px;
    height: 110px;
  
    border-radius: 22px;
    overflow: hidden;
  
    text-decoration: none;
  }
  
  .site-logo__image {
    display: block;
    width: 100%;
    height: 100%;
  
    object-fit: contain;
    border-radius: 22px;
  
    transition: transform 0.18s ease;
  }
  
  .site-logo:hover .site-logo__image {
    transform: scale(1.04);
  }
  
  .site-identity__text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
  
    min-width: 0;
  }
  
  .site-identity__name {
    margin: 0;
  
    font-family: var(--font-display);
    font-size: clamp(2rem, 3.2vw, 3rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.035em;
  
    color: var(--text);
  }
  
  .site-identity__tagline {
    margin: 0;
  
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.4;
  
    color: var(--text-muted);
  }
  
  
  /* =========================================================
     HEADER
     ========================================================= */
  
  .header {
    margin-bottom: 1.25rem;
  }
  
  
  /*
     Second row:
     F9 list ---------------- Add title / Menu
  */
  .header__main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
  
    width: 100%;
    gap: 1.5rem;
  }
  
  .header__brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  
    min-width: 0;
  }
  
  .header__title {
    margin: 0;
  
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.02em;
  
    color: var(--title-accent);
  
    text-wrap: balance;
  }
  
  .header__title-wrap {
    position: relative;
  
    min-width: 0;
    max-width: 100%;
  
    margin: 0;
  }
  
  
  /* =========================================================
     LIST TITLE DROPDOWN
     ========================================================= */
  
  .list-title-dropdown {
    position: relative;
    display: block;
  
    min-width: 0;
    max-width: 100%;
  }
  
  .list-title-dropdown__trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
  
    max-width: 100%;
    margin: 0;
    padding: 0.375rem 0.625rem;
  
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.08;
  
    color: var(--title-accent);
    text-align: start;
  
    background: color-mix(in srgb, var(--title-accent) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--title-accent) 35%, transparent);
    border-radius: 10px;
  
    cursor: pointer;
  
    transition:
      background 0.15s,
      border-color 0.15s;
  }
  
  .list-title-dropdown__trigger:hover,
  .list-title-dropdown__trigger:focus-visible {
    background: color-mix(in srgb, var(--title-accent) 12%, transparent);
    border-color: color-mix(in srgb, var(--title-accent) 55%, transparent);
  
    outline: none;
  }
  
  .list-title-dropdown__trigger[aria-expanded="true"] {
    background: color-mix(in srgb, var(--title-accent) 12%, transparent);
    border-color: color-mix(in srgb, var(--title-accent) 55%, transparent);
  }
  
  .list-title-dropdown__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .list-title-dropdown__chevron {
    flex-shrink: 0;
  
    width: 1.15rem;
    height: 1.15rem;
  
    color: color-mix(in srgb, var(--title-accent) 75%, transparent);
  
    transition: transform 0.15s ease;
  }
  
  .list-title-dropdown__trigger[aria-expanded="true"]
    .list-title-dropdown__chevron {
    transform: rotate(180deg);
  }
  
  .list-title-dropdown__panel {
    position: absolute;
  
    top: calc(100% + 0.25rem);
    inset-inline-start: 0;
    z-index: 220;
  
    min-width: 100%;
    max-width: min(calc(100vw - 2rem), 20rem);
  
    padding: 0.35rem;
  
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
  
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  }
  
  .list-title-dropdown__panel[hidden] {
    display: none;
  }
  
  .list-title-dropdown__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  
    width: 100%;
    padding: 0.55rem 0.65rem;
  
    font: inherit;
    font-size: 0.84rem;
    font-weight: 500;
    text-align: start;
  
    color: var(--text);
    background: transparent;
  
    border: none;
    border-radius: 6px;
  
    cursor: pointer;
  
    transition:
      background 0.15s,
      color 0.15s;
  }
  
  .list-title-dropdown__item:hover,
  .list-title-dropdown__item:focus-visible {
    background: rgba(255, 255, 255, 0.06);
    outline: none;
  }
  
  .list-title-dropdown__item--active {
    color: var(--accent);
    font-weight: 600;
  }
  
  .list-title-dropdown__check {
    flex-shrink: 0;
  
    width: 1rem;
    height: 1rem;
  
    margin-inline-start: auto;
  }
  
  
  /* =========================================================
     HEADER STATS
     ========================================================= */
  
  .header__meta {
    margin: 0.2rem 0 0;
  
    font-size: 0.85rem;
    color: var(--text-muted);
  }
  
  
  /* =========================================================
     HEADER ACTIONS
     ========================================================= */
  
  .header__actions {
    display: flex;
    align-items: flex-start;
  
    flex-shrink: 0;
  }
  
  .header__toolbar {
    display: flex;
    align-items: center;
    gap: 0.45rem;
  
    margin: 0;
  }
  
  
  /* =========================================================
     ACCOUNT MENU
     ========================================================= */
  
  .account-menu {
    position: relative;
  }
  
  .account-menu__trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
  
    padding: 0.45rem 0.7rem;
    min-height: 36px;
  }
  
  .account-menu__icon {
    width: 1.1rem;
    height: 1.1rem;
  }
  
  .account-menu__panel {
    position: absolute;
  
    top: calc(100% + 0.4rem);
    right: 0;
    z-index: 220;
  
    min-width: 12.5rem;
    padding: 0.35rem;
  
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
  
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  }
  
  .account-menu__panel[hidden] {
    display: none;
  }
  
  .account-menu__switch {
    padding: 0.35rem 0.55rem 0.5rem;
  }
  
  .account-menu__label {
    display: block;
  
    margin-bottom: 0.25rem;
  
    font-size: 0.68rem;
    font-weight: 500;
  
    color: var(--text-muted);
  }
  
  .account-menu__select {
    width: 100%;
  
    padding: 0.4rem 1.65rem 0.4rem 0.55rem;
  
    font-size: 0.8rem;
  }
  
  .account-menu__item {
    display: block;
  
    width: 100%;
    padding: 0.5rem 0.65rem;
  
    font: inherit;
    font-size: 0.84rem;
    font-weight: 500;
    text-align: left;
  
    color: var(--text);
    background: transparent;
  
    border: none;
    border-radius: 6px;
  
    cursor: pointer;
  
    transition:
      background 0.15s,
      color 0.15s;
  }
  
  .account-menu__item:hover,
  .account-menu__item:focus-visible {
    background: rgba(255, 255, 255, 0.06);
    outline: none;
  }
  
  .account-menu__item--danger {
    color: #f87171;
  }
  
  .account-menu__item--danger:hover,
  .account-menu__item--danger:focus-visible {
    background: rgba(248, 113, 113, 0.1);
    color: #fca5a5;
  }
  
  .account-menu__divider {
    height: 1px;
  
    margin: 0.3rem 0.35rem;
  
    border: none;
    background: var(--border);
  }
  
  
  /* =========================================================
     PAGE TOOLBAR
     ========================================================= */
  
  .page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
  
    gap: 0.5rem;
  
    margin: -1.1rem 0 1.25rem;
  }
  
  
  /* =========================================================
     MOBILE HEADER
     ========================================================= */
  
  @media (max-width: 640px) {
  
    .site-identity {
      gap: 13px;
  
      padding-bottom: 14px;
      margin-bottom: 18px;
    }
  
    .site-logo {
      width: 68px;
      height: 68px;
  
      border-radius: 15px;
    }
  
    .site-logo__image {
      border-radius: 15px;
    }
  
    .site-identity__name {
      font-size: clamp(1.35rem, 6vw, 1.8rem);
      letter-spacing: -0.025em;
    }
  
    .site-identity__tagline {
      font-size: 0.82rem;
    }
  
    .header__main {
      align-items: flex-start;
      gap: 0.75rem;
    }
  
    .header__actions {
      align-items: flex-start;
    }
  
    .list-title-dropdown__trigger {
      font-size: clamp(1.35rem, 6vw, 1.75rem);
    }
  }

/* Desktop filter bar */
@media (min-width: 641px) {
  .panel__filters {
    display: grid;
    grid-template-columns: minmax(200px, 1.25fr) repeat(3, minmax(118px, 1fr));
    align-items: end;
    gap: 0.45rem 0.6rem;
  }

  .panel__filters > .search {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    max-width: none;
    flex: unset;
  }

  .panel__filters > .genre-filter {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    max-width: none;
    flex: unset;
  }

  .panel__filters > .watched-filter {
    grid-column: 3;
    grid-row: 1;
    width: 100%;
    flex: unset;
  }

  .panel__filters > .rating-filter {
    grid-column: 4;
    grid-row: 1;
    width: 100%;
    flex: unset;
  }

  /* Genre chips on their own row, horizontal pills */
  .panel__filters > .genre-filter:has(.genre-filter__chips:not(:empty)) {
    display: contents;
  }

  .panel__filters > .genre-filter:has(.genre-filter__chips:not(:empty)) .panel-filter__label {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }

  .panel__filters > .genre-filter:has(.genre-filter__chips:not(:empty)) .genre-filter__select {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    width: 100%;
  }

  .panel__filters > .genre-filter:has(.genre-filter__chips:not(:empty)) .genre-filter__chips {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding-top: 0.1rem;
  }

  /* Clear filters: bottom-right on its own row */
  .panel__filters > .panel__clear-filters {
    grid-column: 1 / -1;
    grid-row: auto;
    justify-self: end;
    margin-inline-start: 0;
  }

  .panel__filters > .ratings-backfill-banner {
    grid-column: 1 / -1;
  }
}

.ratings-backfill-banner {
  flex: 1 1 100%;
  margin: 0;
  padding: 0.45rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--accent);
  background: rgba(217, 185, 106, 0.1);
  border: 1px solid rgba(217, 185, 106, 0.28);
  border-radius: var(--radius-sm);
}

.type-tabs {
  display: flex;
  min-width: 0;
  gap: 0;
  padding: 0;
  border-bottom: 1px solid var(--border);
}

.type-tab {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.type-tab:hover {
  color: var(--text);
  background: transparent;
}

.type-tab--active {
  color: var(--tab-active-fg);
  background: transparent;
  border-bottom-color: var(--tab-active-fg);
}

.type-tab--active:hover {
  color: var(--tab-active-fg);
  background: transparent;
}

.type-tab__icon {
  flex-shrink: 0;
  font-size: 1rem;
}

.type-tab__label {
  white-space: nowrap;
}

.type-tab__count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
  opacity: 0.75;
}

.type-tab--active .type-tab__count {
  color: var(--text-muted);
  opacity: 1;
}

.search {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.panel__filters .search__input {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 2.35rem;
  min-height: 2.35rem;
  padding-block: 0;
  padding-inline-start: 2.35rem;
  padding-inline-end: 0.65rem;
  font-size: 14px;
  line-height: 1.25;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.panel__filters .genre-filter__select,
.panel__filters .watched-filter__select,
.panel__filters .rating-filter__select {
  height: 2.35rem;
  min-height: 2.35rem;
  box-sizing: border-box;
}

.search__icon {
  position: absolute;
  inset-inline-start: 0.65rem;
  top: 50%;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  color: var(--text-muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.search__icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.search__input,
.filter {
  width: 100%;
  padding: 0.55rem 0.75rem;
  padding-inline-start: 2.15rem;
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s;
}

.search__input:focus,
.filter:focus {
  border-color: rgba(232, 184, 74, 0.4);
}

.search__input::placeholder {
  color: var(--text-muted);
}

/* Native placeholder is only a space for :placeholder-shown — keep it invisible */
#searchInput::placeholder {
  color: transparent;
}

/* Fake placeholder overlay — sits over the empty input, one coherent sentence */
.search__fake-placeholder {
  position: absolute;
  inset-inline-start: 2.15rem; /* lines up with the input's text start */
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.875rem;
  color: var(--text-muted);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  max-width: calc(100% - 2.5rem);
  letter-spacing: 0;
  font-family: inherit;
  unicode-bidi: plaintext;
}

/* The "in your list" portion — accent-colored */
.search__scope-hl {
  color: var(--accent);
  font-weight: 700;
}

/* Hide fake placeholder when input has content (placeholder no longer shown) */
#searchInput:not(:placeholder-shown) ~ .search__fake-placeholder {
  display: none;
}

.search__input::-webkit-search-decoration,
.search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.search__clear {
  position: absolute;
  inset-inline-end: 0.3rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}

.search__clear:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.search__clear:focus-visible {
  outline: 2px solid rgba(232, 184, 74, 0.45);
  outline-offset: 1px;
}

.search__clear[hidden] {
  display: none;
}

.search__clear svg {
  display: block;
  width: 0.9rem;
  height: 0.9rem;
}

.search__input.search__input--has-clear,
.search:has(.search__clear:not([hidden])) .search__input {
  padding-inline-end: 2.15rem;
}

.panel__filters .search:has(.search__clear:not([hidden])) .search__input {
  padding-inline-end: 2.35rem;
}

.search:has(.search__clear:not([hidden])) .search__fake-placeholder {
  max-width: calc(100% - 3.25rem);
}

.filter {
  width: auto;
  min-width: 150px;
  padding-right: 2rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b93a7' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
}

.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 2.25rem;
  padding: 0 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.filter-check input {
  accent-color: var(--accent);
}

.genre-filter {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
  min-width: 0;
  flex: 1 1 0;
  width: 100%;
}

.panel-filter__label {
  display: block;
  width: 100%;
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.2;
}

.watched-filter {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
  min-width: 0;
  flex: 1 1 0;
  width: 100%;
}

.genre-filter__select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.55rem 2rem 0.55rem 0.75rem;
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  transition: border-color 0.15s;
}

.watched-filter__select,
.rating-filter__select {
  appearance: none;
  background-color: var(--bg-card);
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  padding-inline-end: 2rem;
}

.genre-filter__select:focus {
  border-color: rgba(232, 184, 74, 0.4);
  box-shadow: 0 0 0 3px rgba(232, 184, 74, 0.12);
}

.genre-filter__select--active,
.genre-filter--active > .genre-filter__select {
  border-color: rgba(232, 184, 74, 0.55);
  background-color: rgba(232, 184, 74, 0.08);
  box-shadow: 0 0 0 1px rgba(232, 184, 74, 0.18);
}

.watched-filter--active > .watched-filter__select,
.rating-filter--active > .rating-filter__select {
  border-color: rgba(232, 184, 74, 0.55);
  background-color: rgba(232, 184, 74, 0.08);
  box-shadow: 0 0 0 1px rgba(232, 184, 74, 0.18);
}

.watched-filter__select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  flex: 0 0 auto;
}

.rating-filter {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
  flex: 1 1 0;
  width: 100%;
  min-width: 0;
}

.rating-filter__controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
}

.rating-filter__select {
  flex: 1;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.sort-direction-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  margin-inline-start: auto;
  color: var(--text-muted);
  background: var(--filter-field-bg, var(--bg-card));
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}

.sort-direction-btn:hover {
  color: var(--text);
  border-color: rgba(232, 184, 74, 0.35);
}

.sort-direction-btn:focus-visible {
  outline: 2px solid rgba(232, 184, 74, 0.55);
  outline-offset: 2px;
}

.sort-direction-btn__icon {
  width: 1.1rem;
  height: 1.1rem;
  transform: rotate(-90deg);
  transition: transform 0.2s ease;
}

.sort-direction-btn--oldest .sort-direction-btn__icon {
  transform: rotate(90deg);
}

.genre-filter__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  width: 100%;
}

.genre-filter__chips:empty {
  display: none;
}

.genre-chip--filter {
  font-weight: 500;
  color: var(--text);
  background: var(--bg-card);
  border-color: var(--border);
}

.genre-chip--filter .genre-chip__remove {
  color: inherit;
}

.genre-chip--filter .genre-chip__remove:hover {
  color: inherit;
  background: rgba(0, 0, 0, 0.08);
}

.select {
  min-width: 0;
  padding: 0.55rem 2rem 0.55rem 0.75rem;
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b93a7' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
}

.type-tab:focus-visible,
.btn:focus-visible,
.watched-btn:focus-visible,
.filter:focus,
.search__input:focus,
.filter-check:has(input:focus-visible) {
  outline: none;
  box-shadow: 0 0 0 3px rgba(232, 184, 74, 0.12);
}

.btn {
  padding: 0.7rem 1.1rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn--ghost {
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  border-color: rgba(232, 184, 74, 0.3);
  background: var(--bg-card);
}

.btn--primary {
  color: #14120c;
  background: var(--accent);
  border: 1px solid var(--accent);
}

.btn--primary:hover {
  background: #ecc55a;
  border-color: #ecc55a;
}

.header__toolbar .btn--primary {
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  color: #0c0c0d;
  background: linear-gradient(180deg, #d4b896 0%, #c4a882 100%);
  border-color: transparent;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset;
}

html[data-theme] .header__toolbar .btn--primary {
  color: #0c0c0d;
  background: linear-gradient(180deg, #d4b896 0%, #c4a882 100%);
  border-color: transparent;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset;
}

.header__toolbar .btn--primary:hover {
  background: linear-gradient(180deg, #dfc9a8 0%, #ceb08a 100%);
  border-color: transparent;
}

html[data-theme] .header__toolbar .btn--primary:hover {
  background: linear-gradient(180deg, #dfc9a8 0%, #ceb08a 100%);
  border-color: transparent;
}

.panel__filters #genreSelect,
.panel__filters #watchedFilter,
.panel__filters #ratingFilter,
.panel__filters #sortDirectionBtn,
.panel__filters .genre-filter__select,
.panel__filters .watched-filter__select,
.panel__filters .rating-filter__select {
  background-color: var(--filter-field-bg);
}

.btn--loading {
  pointer-events: none;
}

.btn--loading::after {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-inline-start: 0.4em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.65s linear infinite;
  vertical-align: -0.08em;
}

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

.btn--text {
  padding: 0.55rem 0.65rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: transparent;
  border: none;
}

.btn--text:hover {
  color: var(--text);
}

.btn--danger {
  color: #f87171;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.btn--danger:hover {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.4);
}

.btn--danger-text {
  color: #f87171;
}

.btn--danger-text:hover {
  color: #fca5a5;
}

.btn--sm {
  padding: 0.4rem 0.65rem;
  font-size: 0.75rem;
}

/* Main content */
.main {
  min-height: 200px;
}

.app-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  background: rgba(217, 185, 106, 0.1);
  border: 1px solid rgba(217, 185, 106, 0.28);
  border-radius: var(--radius-md);
}

.app-banner--share {
  background: rgba(96, 165, 250, 0.1);
  border-color: rgba(96, 165, 250, 0.32);
}

.app-banner--pwa-icon {
  background: rgba(196, 168, 130, 0.12);
  border-color: rgba(196, 168, 130, 0.34);
}

.app-banner--pwa-icon .app-banner__list {
  margin-top: 0.55rem;
  padding-inline-start: 1.2rem;
  list-style: decimal;
}

.app-banner__body {
  flex: 1 1 14rem;
  min-width: 0;
}

.app-banner__title {
  margin: 0 0 0.45rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.app-banner__text {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.app-banner__list {
  margin: 0;
  padding-inline-start: 1.15rem;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.app-banner__list li + li {
  margin-top: 0.35rem;
}

.app-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.app-banner__dismiss {
  flex-shrink: 0;
}

.empty-state__hints {
  margin: 0.75rem auto 0;
  padding: 0;
  list-style: none;
  max-width: 26rem;
  text-align: start;
}

.empty-state__hints li {
  position: relative;
  margin: 0;
  padding: 0.35rem 0 0.35rem 1.35rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.empty-state__hints li::before {
  content: "•";
  position: absolute;
  inset-inline-start: 0.35rem;
  color: var(--accent);
}

.empty-state__subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

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

.list-skeleton-wrap {
  padding: 1.5rem 0 2rem;
}

.list-skeleton__heading {
  width: min(12rem, 40%);
  height: 1.1rem;
  margin: 0 0 1.25rem;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 200% 100%;
  animation: list-skeleton-shimmer 1.4s ease-in-out infinite;
}

.list-skeleton__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 1rem;
}

.list-skeleton__card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: rgba(255, 255, 255, 0.02);
}

.list-skeleton__poster {
  aspect-ratio: 2 / 3;
  border-radius: calc(var(--radius-md, 12px) - 2px);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: list-skeleton-shimmer 1.4s ease-in-out infinite;
}

.list-skeleton__body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.list-skeleton__line {
  height: 0.72rem;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: list-skeleton-shimmer 1.4s ease-in-out infinite;
}

.list-skeleton__line--title {
  width: 78%;
}

.list-skeleton__line--short {
  width: 42%;
}

.list-skeleton__status {
  margin: 1.25rem 0 0;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
}

@keyframes list-skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.empty-state__title {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: var(--text);
}

/* Genre sections */
.genre-section {
  margin-bottom: 2.5rem;
}

.genre-section__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.genre-section__header::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 2.5rem;
  height: 2px;
  background: var(--accent);
  opacity: 0.6;
  border-radius: 1px;
}

.genre-section__type {
  flex-shrink: 0;
  padding: 0.25rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 4px;
}

.genre-section__type--movies {
  color: var(--movie);
  background: var(--movie-dim);
}

.genre-section__type--tvSeries {
  color: var(--tv);
  background: var(--tv-dim);
}

.genre-section__type--anime {
  color: var(--anime);
  background: var(--anime-dim);
}

.genre-section__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
}

.genre-section__count {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.genre-section__match {
  flex-shrink: 0;
  padding: 0.2rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 999px;
}

.genre-section--all-match .genre-section__header::after {
  width: 4rem;
  opacity: 1;
}

/* Cards grid */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: border-color 0.2s, background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.card--linked {
  cursor: pointer;
}

.card--linked:hover .card__title {
  color: var(--accent);
}

.card--watched {
  opacity: 0.82;
}

.card--watched .card__title,
.card--watched .card__title .text-ltr {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: color-mix(in srgb, var(--watched) 50%, var(--text-muted) 50%);
}

.card__watched-check {
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  width: 1.2rem;
  height: 1.2rem;
  color: var(--watched);
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid color-mix(in srgb, var(--watched) 45%, transparent);
  border-radius: 50%;
}

.card__watched-check svg {
  display: block;
  width: 0.68rem;
  height: 0.68rem;
}

.card:has(.card__media) .card__watched-check {
  display: none;
}

.card:has(.card__media) .card__progress-check {
  display: none;
}

.card--watched .card__media::after {
  content: "✓";
  position: absolute;
  top: 0.3rem;
  inset-inline-end: 0.3rem;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 1.2rem;
  height: 1.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  color: var(--watched);
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid color-mix(in srgb, var(--watched) 45%, transparent);
  border-radius: 50%;
}

.card__progress-check {
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  width: 1.2rem;
  height: 1.2rem;
  color: var(--in-progress, #fb923c);
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid color-mix(in srgb, var(--in-progress, #fb923c) 45%, transparent);
  border-radius: 50%;
}

.card__progress-check svg {
  display: block;
  width: 0.78rem;
  height: 0.78rem;
}

.card--in-progress .card__media::after {
  content: "●";
  position: absolute;
  top: 0.3rem;
  inset-inline-end: 0.3rem;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 1.2rem;
  height: 1.2rem;
  font-size: 0.55rem;
  line-height: 1;
  color: var(--in-progress, #fb923c);
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid color-mix(in srgb, var(--in-progress, #fb923c) 45%, transparent);
  border-radius: 50%;
}

.card__top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.card__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
}

.card__alt {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

.card__rating-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem;
  margin: 0.15rem 0 0.8rem;
  min-height: 2.05rem;
  flex-shrink: 0;
}

.card__rating-badges:not(:empty) {
  margin-top: auto;
  margin-bottom: 0.35rem;
}

.card__rating-badges:not(:empty) ~ .card__footer {
  margin-top: 0;
}

.card__score {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  min-height: 2.05rem;
  min-width: 5.35rem;
  padding: 0.2rem 0.58rem 0.2rem 0.75rem;
  border-radius: 999px;
  border: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
}

.card__score-value {
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.card__score-logo {
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

.card__score-logo--imdb {
  width: auto;
  height: 0.95rem;
}

.card__score-logo--anilist {
  width: auto;
  height: 1.1rem;
}

.card__score--imdb {
  background: #f5c518;
  color: #000000;
}

.card__score--imdb .card__score-value {
  color: #000000;
}

.card__score--anilist {
  background: #02a9ff;
  color: #ffffff;
}

.card__score--anilist .card__score-value {
  color: #ffffff;
}

.card__head > .card__top {
  margin-bottom: 0.55rem;
}

.card__sections {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.5rem;
}

.card__section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.32rem;
  min-width: 0;
}

.card__section-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  opacity: 0.88;
}

.card__info-row,
.card__genre-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.card__genre-row {
  gap: 0.3rem;
}

.badge {
  padding: 0.2rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 4px;
}

.badge--movie {
  color: var(--movie);
  background: var(--movie-dim);
}

.badge--franchise {
  color: var(--franchise);
  background: var(--franchise-dim);
}

.badge--series,
.badge--tvSeries {
  color: var(--tv);
  background: var(--tv-dim);
}

.badge--anime {
  color: var(--anime);
  background: var(--anime-dim);
}

.badge--genre-primary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-strong);
  font-weight: 600;
}

.badge--genre-secondary {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  font-weight: 500;
}

.badge--year {
  color: #f3f4f6;
  background: rgba(18, 18, 20, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  font-variant-numeric: tabular-nums;
}

.badge--age {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge--duration {
  color: #93c5fd;
  background: rgba(147, 197, 253, 0.1);
  border: 1px solid rgba(147, 197, 253, 0.32);
  font-weight: 700;
  text-transform: none;
}

.badge--seasons {
  color: #a5b4fc;
  background: rgba(165, 180, 252, 0.1);
  border: 1px solid rgba(165, 180, 252, 0.32);
  font-weight: 700;
  text-transform: none;
}

.badge--episodes {
  color: #86efac;
  background: rgba(12, 28, 18, 0.96);
  border: 1px solid rgba(134, 239, 172, 0.45);
  font-weight: 700;
  text-transform: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.card__meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.genre-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 0;
  margin-top: 0.45rem;
}

.genre-chips:empty {
  display: none;
}

.genre-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.genre-chip__remove {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  margin: -0.5rem;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.genre-chip__remove:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.inline-add {
  display: flex;
  gap: 0.5rem;
}

.inline-add .form-input {
  flex: 1;
}

.inline-add .btn {
  flex-shrink: 0;
  align-self: stretch;
}

/* List cards: lead/summary are detail-sheet only (removed from renderCard). */
.card__lead,
.card__summary {
  display: none;
}

.card__footer-mobile {
  display: none;
}

.card__watch-status,
.card__watch-rating {
  display: none;
}

.card__footer-badge {
  display: inline-flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: var(--radius-sm);
  /* Allow button element to inherit appearance */
  background: none;
  border: none;
  cursor: default;
  text-align: start;
  font-family: inherit;
}

.card__footer-badge--unwatched {
  flex: 0 1 auto;
  width: fit-content;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.card__footer-badge--in-progress {
  flex: 0 1 auto;
  width: fit-content;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--in-progress, #fb923c);
  background: color-mix(in srgb, var(--in-progress, #fb923c) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--in-progress, #fb923c) 35%, var(--border));
  border-radius: 999px;
  cursor: pointer;
}

.card__footer-badge--watched {
  flex: 0 1 auto;
  width: fit-content;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--watched, #4ade80);
  background: color-mix(in srgb, var(--watched, #4ade80) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--watched, #4ade80) 35%, var(--border));
  border-radius: 999px;
  cursor: pointer;
}

.card__rating {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.card__rating--rated {
  display: block;
  width: 100%;
  max-width: 100%;
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.card__rating--rated:hover,
.card__rating--rated:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(217, 185, 106, 0.35);
  outline: none;
}

.card__rating-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.5rem;
  min-height: 1.25rem;
}

.card__rating-label {
  min-width: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(139, 147, 167, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__rating--rated:has(.card__rating-note) .card__rating-top {
  margin-bottom: 0.5rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}

.card__rating--empty {
  display: block;
  min-height: 2.35rem;
  background: transparent;
  border-style: dashed;
}

.card__rating-placeholder {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

.card__rating--pending {
  padding: 0.45rem 0.5rem;
  background: transparent;
  border-style: dashed;
}

.card__rating-score {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  justify-self: end;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.card__rating-score::before {
  content: "★";
  font-size: 0.82rem;
}

.card__rating-note {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.card__rate-btn {
  width: auto;
  flex-shrink: 0;
  margin-left: auto;
  justify-content: center;
}

.card__footer {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  min-width: 0;
}

.card-menu {
  position: relative;
  flex-shrink: 0;
  margin-inline-start: 0;
}

@media (min-width: 641px) {
  .card-menu {
    margin-inline-start: auto;
  }
}

.card-menu__trigger-icon--desktop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
}

.card-menu__trigger-icon--desktop svg {
  display: block;
  width: 100%;
  height: 100%;
}

.card-menu__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  min-height: 2.35rem;
  max-height: 2.35rem;
  align-self: center;
  padding: 0;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.card-menu__trigger:hover,
.card-menu__trigger:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.card-menu__trigger-icon--mobile {
  display: none !important;
}

.card-menu__panel {
  position: absolute;
  inset-inline-end: 0;
  bottom: calc(100% + 0.35rem);
  z-index: 30;
  min-width: 10.5rem;
  max-width: min(10.5rem, calc(100vw - 1.75rem));
  padding: 0.3rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.card:has(.card-menu__panel:not([hidden])) {
  overflow: visible;
  z-index: 25;
}

.app[data-layout="poster"] .card:has(.card-menu__panel:not([hidden])) {
  overflow: visible;
}

.card-menu__panel[hidden] {
  display: none;
}

.card-menu__item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.card-menu__item:hover,
.card-menu__item:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.card-menu__item--danger {
  color: #f87171;
}

.card-menu__item--danger:hover,
.card-menu__item--danger:focus-visible {
  background: rgba(248, 113, 113, 0.1);
}

.watched-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.watched-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.watched-btn--active {
  color: var(--watched);
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.08);
}

/* Gate */
.gate {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: max(1.5rem, env(safe-area-inset-top)) max(1.5rem, env(safe-area-inset-right))
    max(1.5rem, env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
}

.gate__card {
  position: relative;
  width: min(100%, 22rem);
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.gate__toolbar {
  display: flex;
  justify-content: flex-start;
  margin: -0.75rem 0 0.35rem;
}

.gate__lang--compact {
  display: inline-flex;
  gap: 0.3rem;
}

.gate__lang-btn--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  flex: none;
  border-radius: 999px;
  flex-shrink: 0;
}

.gate__lang-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.3rem;
  height: 1.3rem;
  font-weight: 800;
  line-height: 1;
}

.gate__lang-btn--icon[data-lang="en"] .gate__lang-letter {
  font-family: var(--font), "Plus Jakarta Sans", sans-serif;
  font-size: 1.42rem;
}

.gate__lang-btn--icon[data-lang="ar"] .gate__lang-letter {
  font-family: "Noto Sans Arabic", var(--font), sans-serif;
  font-size: 1.3rem;
}

.gate__field {
  position: relative;
  margin-bottom: 0.55rem;
}

.gate__input {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.75rem 2.65rem 0.75rem 0.85rem;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s;
}

.gate__field .gate__input {
  display: block;
  width: 100%;
}

.gate__toggle-password {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

.gate__toggle-password:hover,
.gate__toggle-password:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.gate__toggle-password[aria-pressed="true"] .gate__eye--show {
  display: none;
}

.gate__toggle-password[aria-pressed="true"] .gate__eye--hide {
  display: block;
}

.gate__toggle-password[aria-pressed="false"] .gate__eye--hide {
  display: none;
}

.gate__eye {
  width: 1.15rem;
  height: 1.15rem;
}

.gate__rules {
  margin: 0 0 0.85rem;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
}

.gate__rule {
  position: relative;
  padding-left: 1.2rem;
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--text-muted);
}

.gate__rule::before {
  content: "✕";
  position: absolute;
  left: 0;
  top: 0;
  font-size: 0.76rem;
  font-weight: 800;
  color: #e57373;
}

.gate__rule--met {
  color: var(--text);
}

.gate__rule--met::before {
  content: "✓";
  color: var(--accent);
}

.gate__theme-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  width: 100%;
  margin-top: 1.35rem;
  padding: 0.9rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.gate__theme-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}

.gate__theme-swatches {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.gate__theme-swatch {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.gate__theme-swatch:hover,
.gate__theme-swatch:focus-visible {
  transform: scale(1.08);
  outline: none;
}

.gate__theme-swatch--active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--bg-elevated), 0 0 0 3px var(--accent);
}

.gate__theme-swatch--dark {
  background: #000000;
  border: 1px solid #363636;
}

.gate__theme-swatch--light {
  background: linear-gradient(135deg, #ffffff 0%, #f3f2ee 55%, #8a6d42 100%);
}

.gate__theme-swatch--purple {
  background: linear-gradient(135deg, #1a0f30 0%, #07040f 50%, #c49cff 100%);
}

.gate__theme-swatch--brown {
  background: linear-gradient(135deg, #fff8f0 0%, #c9956a 28%, #3d2518 62%, #18100c 100%);
}

.gate__theme-swatch--pink {
  background: linear-gradient(180deg, #8e1448 0%, #d81b60 45%, #e84878 78%, #c2185b 100%);
}

.gate__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.15rem;
  text-align: center;
}

.gate__logo {
  display: block;
  width: 5.5rem;
  height: 5.5rem;
}

.gate__title {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}

.gate__modes {
  display: flex;
  gap: 0.35rem;
  margin-top: 1.25rem;
  padding: 0.3rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.gate__mode {
  flex: 1;
  padding: 0.45rem 0.5rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.gate__mode--active {
  color: var(--text);
  background: rgba(232, 184, 74, 0.12);
}

.gate__panel {
  margin-top: 1rem;
  text-align: left;
}

.gate__hint {
  margin: -0.15rem 0 0.7rem;
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.gate__warning {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.75rem;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--accent);
  background: rgba(217, 185, 106, 0.1);
  border: 1px solid rgba(217, 185, 106, 0.28);
  border-radius: var(--radius-sm);
}

.gate__input--block {
  display: block;
  width: 100%;
  margin-bottom: 0.55rem;
  padding: 0.75rem 0.85rem;
}

.gate__input:focus {
  border-color: rgba(232, 184, 74, 0.4);
}

.gate__submit {
  width: 100%;
  margin-top: 0.25rem;
}

.gate__error {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  color: #f87171;
  text-align: left;
}

.footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  padding-bottom: max(0, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer__attribution {
  margin-top: 0.5rem !important;
  font-size: 0.75rem !important;
}

.footer__attribution a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.75;
}

.footer__attribution a:hover {
  opacity: 1;
}

.credits-modal__body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  font-size: 0.92rem;
  line-height: 1.5;
}

.credits-modal__body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.credits-modal__hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}

/* App dialog (replaces browser alert/confirm) */
.app-dialog[hidden] {
  display: none;
}

.app-dialog {
  position: fixed;
  inset: 0;
  z-index: 350;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.app-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(4px);
}

.app-dialog__panel {
  position: relative;
  width: min(100%, 22rem);
  padding: 1.35rem 1.25rem 1.15rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.app-dialog__title {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.app-dialog__message {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.app-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.15rem;
}

.app-dialog__actions .btn {
  min-width: 5.5rem;
}

.app-dialog--alert .app-dialog__actions [data-action="cancel"] {
  display: none !important;
}

.app-dialog--alert .app-dialog__actions {
  justify-content: stretch;
}

.app-dialog--alert .app-dialog__actions .btn {
  width: 100%;
}

.gate__input--invalid {
  border-color: rgba(248, 113, 113, 0.55);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.1);
}

/* Modal */
.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  z-index: 230;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Compact modals (change-code, share, theme, etc.) still scroll themselves */
.modal__panel--compact {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.modal__panel::-webkit-scrollbar {
  width: 5px;
}

.modal__panel::-webkit-scrollbar-track {
  background: transparent;
}

.modal__panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.modal__panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.24);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.25rem 0.5rem;
}

.modal__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
}

.modal__close {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.modal__close:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.modal__form {
  flex: 1;
  overflow-y: auto;
  padding: 0 1.25rem 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.modal__panel--compact {
  max-width: 420px;
}

.modal__body {
  padding: 0 1.25rem 1.25rem;
}

.backup-modal__text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
}

.backup-modal__hint {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-muted);
}

#bulkPasteError {
  white-space: pre-line;
}

.backup-modal__hint--error {
  color: #f87171;
}

.rating-picker {
  margin-top: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
}

.rating-modal-body {
  margin-top: 0.35rem;
  padding: 1rem 0.85rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.rating-modal-body__note {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  border-radius: 0;
  resize: vertical;
  min-height: 4.5rem;
}

.rating-episode-avg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  margin-top: 0.65rem;
  padding: 0.65rem 0.75rem;
  text-align: start;
  font: inherit;
  cursor: pointer;
  color: var(--text, #fafafa);
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.rating-episode-avg:hover,
.rating-episode-avg:focus-visible {
  background: color-mix(in srgb, var(--accent, #0095f6) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent, #0095f6) 55%, transparent);
  outline: none;
}

.rating-episode-avg__label {
  font-size: 0.86rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rating-episode-avg__meta {
  font-size: 0.74rem;
  color: var(--text-muted, #a8a8a8);
}

#ratingSaveBtn:disabled,
.modal__footer .btn--primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

.rating-picker__value {
  margin: 0 0 0.9rem;
  text-align: center;
}

.rating-picker--idle .rating-picker__score {
  color: var(--text-muted);
}

.rating-picker__score {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
}

.rating-picker__max {
  margin-inline-start: 0.2rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
}

.rating-picker__stars {
  display: flex;
  justify-content: center;
  gap: 0.28rem;
  flex-wrap: nowrap;
  padding: 0.15rem 0 0.35rem;
}

.rating-picker__star {
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.rating-picker__star:hover {
  transform: scale(1.08);
}

.rating-picker__star-icon {
  font-size: 1.35rem;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.28);
}

.rating-picker__star--filled .rating-picker__star-icon {
  color: var(--accent);
  -webkit-text-stroke: 0;
}

.rating-picker__fine {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.55rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
}

.rating-picker--idle .rating-picker__fine {
  display: none;
}

.rating-picker__fine-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
}

.rating-picker__step {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.rating-picker__step:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.07);
}

.rating-picker__step:focus-visible,
.rating-picker__star:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(232, 184, 74, 0.2);
}

.list-switcher {
  display: none;
}

.share-modal__body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.share-modal__tagline {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--accent);
  text-align: center;
}

.share-modal__copy {
  display: grid;
  gap: 0.45rem;
}

.share-modal__list {
  margin: 0;
  padding-inline-start: 1.15rem;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.share-modal__list li + li {
  margin-top: 0.35rem;
}

.share-modal__note {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.share-modal__footer {
  margin-top: 0.35rem;
}

.share-modal__footer .btn {
  width: 100%;
}

.share-options {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 1rem;
}

.share-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.85rem 1rem;
  text-align: center;
  font: inherit;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.share-modal__intro {
  margin-top: 0.35rem;
  text-align: center;
}

/* legacy share option cards — kept for reference; share modal uses primary button */

.share-option:hover,
.share-option:focus-visible {
  border-color: rgba(236, 197, 90, 0.45);
  background: rgba(236, 197, 90, 0.06);
  outline: none;
}

.share-option__title {
  font-size: 0.9rem;
  font-weight: 600;
}

.share-option__desc {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.my-lists__create {
  width: 100%;
  justify-content: center;
  margin-bottom: 0.85rem;
}

.manage-lists {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.manage-lists__item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  flex-wrap: wrap;
}

.manage-lists__info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.manage-lists__name {
  font-size: 0.88rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-lists__badge {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--accent);
}

.manage-lists__meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.manage-lists__about {
  font-size: 0.74rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-lists__badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  margin-top: 0.1rem;
}

.manage-lists__actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.manage-lists__item .btn--sm {
  font-size: 0.78rem;
  padding: 0.35rem 0.6rem;
}

.manage-lists__item .btn {
  flex-shrink: 0;
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
}

.move-list-picker {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 16rem;
  overflow-y: auto;
}

.move-list-picker__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 0.7rem;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.move-list-picker__item:hover,
.move-list-picker__item:focus-visible {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(217, 185, 106, 0.35);
  outline: none;
}

.move-list-picker__name {
  font-size: 0.88rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.move-list-picker__meta {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.move-list-picker__empty {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.modal__footer--stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  margin-top: 1rem;
  padding-top: 0;
  border-top: none;
}

.modal__footer--stacked .btn {
  width: 100%;
  justify-content: center;
}

.modal__footer--simple {
  justify-content: flex-end;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.add-mode-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0 1.25rem 1rem;
  padding: 0.25rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.add-mode-tab {
  flex: 1;
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.add-mode-tab:hover {
  color: var(--text);
}

.add-mode-tab--active {
  color: #14120c;
  background: var(--accent);
}

.add-mode-tab--active:hover {
  color: #14120c;
  background: var(--accent);
}

/* ── Add-title panel ──
   Mobile: edge-to-edge (see mobile.css).
   Desktop/tablet: centered window, same language as title-detail. */
#itemModal .modal__panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Hide sheet drag handle — not a bottom sheet */
#itemModal .modal__panel::before {
  display: none;
}

@media (min-width: 641px) {
  #itemModal {
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
  }

  #itemModal .modal__panel {
    width: min(680px, 92vw);
    max-width: min(680px, 92vw);
    height: auto;
    max-height: min(90vh, 860px);
    border-radius: 16px;
    border: 1px solid var(--border-strong);
    box-shadow: 0 24px 72px rgba(0, 0, 0, 0.55);
    align-self: auto;
  }

  /* Bulk import table needs more horizontal room */
  #itemModal.modal--bulk-preview .modal__panel {
    width: min(960px, 94vw);
    max-width: min(960px, 94vw);
  }
}

#itemModal .modal__header,
#itemModal .add-mode-tabs {
  flex-shrink: 0;
}

#itemModal .modal__search,
#itemModal .title-search,
#itemModal .modal__form,
#itemModal .title-search-confirm,
#itemModal .modal__bulk {
  flex: 1 1 auto;
  min-height: 0;
}

#itemModal .title-search {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#itemModal .title-search__scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

#itemModal .modal__form,
#itemModal .title-search-confirm,
#itemModal .modal__bulk {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  max-height: none;
}

/* Bulk import preview: keep inner scroll regions usable at full screen */
#itemModal.modal--bulk-preview .modal__bulk {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 1.35rem;
}

#itemModal.modal--bulk-preview .bulk-import-preview {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#itemModal.modal--bulk-preview .bulk-import-preview__body {
  flex: 1 1 auto;
  min-height: 0;
}

#itemModal.modal--bulk-preview .bulk-import-preview__table-wrap {
  flex: 1 1 auto;
  min-height: 8rem;
  max-height: none;
}

#itemModal.modal--bulk-preview .bulk-import-preview__footer {
  flex-shrink: 0;
  margin-top: 0.5rem;
  padding-bottom: 1rem;
  position: static;
}

/* Mobile: lock page scroll while open; keep touch scrolling inside the panel */
@media (max-width: 639px) {
  html.item-modal-scroll-lock:has(#itemModal:not([hidden])),
  html.item-modal-scroll-lock:has(#itemModal:not([hidden])) body {
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
  }

  #itemModal .modal__backdrop {
    touch-action: none;
  }

  #itemModal .modal__panel {
    touch-action: pan-y;
  }

  #itemModal.modal--dragging .modal__panel,
  #itemModal .modal__panel.modal__panel--dragging {
    transition: none;
  }
}

/* Search confirm step scrolls within the full-screen panel */
.title-search-confirm {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: none;
  padding: 0 1.35rem 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.modal__search {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  overflow: visible;
  padding: 0;
}

/* title-search step inside the add modal is a flex column */
.title-search {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

/* Sticky controls: hint, search input, type filter, status */
.title-search__controls {
  flex-shrink: 0;
  padding: 0.75rem 1.35rem 0;
}

.title-search__hero {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.title-search__field {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 3.1rem;
  padding: 0 0.85rem 0 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.title-search__field:focus-within {
  background: rgba(255, 255, 255, 0.08);
  border-color: color-mix(in srgb, var(--accent, #5b8cff) 55%, rgba(255, 255, 255, 0.2));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #5b8cff) 22%, transparent);
}

.title-search__field-icon {
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.title-search__field-icon svg {
  width: 100%;
  height: 100%;
}

.title-search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.85rem 0;
}

.title-search__input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.title-search__clear {
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}

.title-search__clear svg {
  width: 0.9rem;
  height: 0.9rem;
}

.title-search__clear:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.14);
}

.title-search__type-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.title-search__type-pill {
  min-height: 2rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.title-search__type-pill:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
}

.title-search__type-pill--active {
  color: #fff;
  background: color-mix(in srgb, var(--accent, #5b8cff) 28%, transparent);
  border-color: color-mix(in srgb, var(--accent, #5b8cff) 60%, rgba(255, 255, 255, 0.2));
}

.title-search__type-select {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* Results scroll when the list is long */
.title-search__scroll {
  flex: none;
  max-height: min(48vh, 24rem);
  overflow-y: auto;
  padding: 0 1.35rem 1.35rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.add-panel-hint {
  margin: 0 0 1.1rem;
  padding: 0.75rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.add-panel-hint strong {
  font-weight: 600;
  color: var(--text);
}

.add-panel-hint--manual {
  margin: 0 1.35rem 1.1rem;
}

.title-search__filters {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.title-search__filter {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 8rem;
}

.title-search__filter-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

.title-search__status {
  min-height: 1.2rem;
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.title-search__status--error {
  color: #f87171;
}

.title-search--loading .title-search__results,
.title-search--loading .title-search__more {
  pointer-events: none;
  opacity: 0.55;
}

.title-search__results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

/* Each result row contains the pick button + add (+) button */
/* Result list row — just a plain list item, no styling */
.title-search__row {
  list-style: none;
}

/* The visual card — a div (not button) so a <button> can live inside */
.title-search__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  font: inherit;
  text-align: start;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
  -webkit-user-select: none;
}

.title-search__item:hover,
.title-search__item:focus-visible {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(217, 185, 106, 0.35);
  outline: none;
}

/* + add button — lives inside the card, pushed to the right */
.title-search__add-btn {
  margin-inline-start: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.title-search__add-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(var(--accent-rgb, 99 102 241), 0.1);
}

.title-search__add-btn--added {
  border-color: #22c55e;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
  pointer-events: none;
}

.search-poster-btn {
  flex-shrink: 0;
  display: block;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  font: inherit;
  color: inherit;
}

.search-poster-btn:focus-visible {
  outline: 2px solid var(--accent, #7c6aff);
  outline-offset: 2px;
}

.search-poster-btn .title-search__poster,
.search-poster-btn .title-search-confirm__poster {
  pointer-events: none;
}

.title-search__poster {
  flex-shrink: 0;
  width: 2.4rem;
  height: 3.5rem;
  object-fit: cover;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
}

.title-search__poster--empty {
  display: grid;
  place-items: center;
  font-size: 1rem;
  color: var(--text-muted);
}

.title-search__info {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.title-search__title {
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-search__meta {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.title-search__badge {
  flex-shrink: 0;
  margin-inline-start: auto;
  padding: 0.18rem 0.45rem;
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--accent);
  background: rgba(217, 185, 106, 0.12);
  border: 1px solid rgba(217, 185, 106, 0.28);
  border-radius: 999px;
  white-space: nowrap;
}

.title-search__item--on-list {
  border-color: rgba(217, 185, 106, 0.22);
  cursor: default;
}

.title-search__item--on-list .title-search__title {
  color: var(--text-muted);
}

.title-search__item--on-list .title-search__meta {
  color: #22c55e;
}

.title-search__more {
  width: 100%;
  justify-content: center;
  margin-top: 0.65rem;
}

.title-search-confirm .modal__footer,
.title-search-confirm__footer {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.title-search-confirm__footer .btn {
  width: auto;
  flex: 0 1 auto;
  min-height: 2.5rem;
}

.title-search-confirm__add {
  margin-inline-start: auto;
}

.title-search-confirm__add--on-list {
  opacity: 0.85;
  cursor: default;
}

#searchConfirmSecondaryChips:not(:empty) {
  margin-top: 0.55rem;
  padding: 0.55rem 0.6rem;
  border: 1px solid rgba(232, 184, 74, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(232, 184, 74, 0.08);
}

.genre-chip--secondary {
  font-weight: 600;
  color: var(--text);
  background: var(--bg-card);
  border-color: var(--border);
}

.genre-chip--secondary .genre-chip__remove {
  color: inherit;
}

.genre-chip--secondary .genre-chip__remove:hover {
  color: inherit;
  background: rgba(0, 0, 0, 0.08);
}

.title-search-confirm__back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding-inline: 0.85rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.title-search-confirm__back::before {
  content: "←";
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}

.title-search-confirm__preview {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.85rem;
  margin: 0 0 1rem;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

/* Full-bleed poster in the add-title confirm step — show the whole image */
#itemModal .title-search-confirm__preview {
  margin-inline: -1.35rem;
  width: calc(100% + 2.7rem);
}

#itemModal .title-search-confirm__preview > .search-poster-btn {
  align-self: stretch;
  width: 100%;
  max-height: none;
  aspect-ratio: auto;
  overflow: visible;
  border-radius: 0;
  cursor: zoom-in;
}

#itemModal .title-search-confirm__poster {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  border-radius: 0;
  object-fit: contain;
  object-position: center top;
  background: rgba(255, 255, 255, 0.04);
}

#itemModal .title-search-confirm__preview > .title-search-confirm__poster {
  max-height: none;
  aspect-ratio: auto;
}

#itemModal .title-search-confirm__poster--empty {
  align-self: stretch;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 16rem;
  max-height: none;
  aspect-ratio: 2 / 3;
  border-radius: 0;
  font-size: 1.75rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
}

#itemModal .title-search-confirm__body {
  min-width: 0;
  padding: 0 1.35rem;
}

/* Link/edit preview keeps a compact padded card */
.form-link-preview__card.title-search-confirm__preview {
  margin: 0 0 1rem;
  width: auto;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.form-link-preview__card .search-poster-btn {
  width: 100%;
  max-height: none;
  aspect-ratio: auto;
  overflow: visible;
}

.form-link-preview__card .title-search-confirm__poster {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.form-link-preview__card .title-search-confirm__body {
  padding: 0;
}

.title-search-confirm__name {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
}

.title-search-confirm__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  margin: 0 0 0.5rem;
}

.title-search-confirm__meta .card__score {
  font-size: 0.78rem;
}

.title-search-confirm__meta .badge--year {
  font-size: 0.72rem;
}

.title-search-confirm__actors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  width: 100%;
}

.title-search-confirm__actor {
  padding: 0.14rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  background: var(--bg-card-hover);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
}

.title-search-confirm__sub {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.title-search-confirm__plot {
  margin: 0.35rem 0 0;
  padding: 0.7rem 0.8rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-secondary, #c8c8c8);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border, #363636);
  border-radius: 10px;
}

.title-search-confirm__fields {
  margin-bottom: 0.25rem;
}

.content-type-picker {
  display: flex;
  gap: 0.3rem;
}

.content-type-picker__btn {
  flex: 1;
  min-width: 0;
  min-height: 2.5rem;
  padding: 0.45rem 0.35rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.content-type-picker__btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.content-type-picker__btn--active {
  color: #14120c;
  background: var(--accent);
  border-color: var(--accent);
}

.content-type-picker__btn--active:hover {
  color: #14120c;
  background: #ecc55a;
  border-color: #ecc55a;
}

.modal__bulk {
  flex: 1;
  overflow-y: auto;
  padding: 0 1.35rem 1.35rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.bulk-add__steps {
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bulk-add__headline {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.bulk-add__lead {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.bulk-add__actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.bulk-add__or {
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: lowercase;
}

.bulk-add__copy {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0.45rem 0.95rem;
}

.bulk-add__copy-icon,
.bulk-add__file-icon {
  display: grid;
  place-items: center;
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
}

.bulk-add__copy-icon svg,
.bulk-add__file-icon svg {
  width: 100%;
  height: 100%;
}

.bulk-add__file {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.bulk-add__file--inline {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.bulk-add__file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0;
  padding: 0;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.bulk-add__file-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
}

.bulk-add__textarea {
  min-height: 12rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.bulk-add__step-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.bulk-add__step {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem 1.15rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.bulk-add__step-num {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #14120c;
  background: var(--accent);
}

.bulk-add__step-body {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.bulk-add__step-title {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.bulk-add__step-body p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.bulk-add__step-body p + p {
  margin-top: 0.45rem;
}

.bulk-add__example,
.bulk-add__textarea {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin-top: 0.55rem;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text);
  background: rgba(0, 0, 0, 0.22);
  border: 1px dashed rgba(255, 255, 255, 0.12);
}

.bulk-add__example {
  font-style: italic;
}

.bulk-add__textarea {
  min-height: 4.25rem;
  height: auto;
  resize: vertical;
  font-family: inherit;
}

.bulk-add__textarea:focus {
  border-color: rgba(232, 184, 74, 0.35);
  box-shadow: none;
  outline: none;
}

.bulk-add__textarea::-webkit-scrollbar {
  width: 4px;
}

.bulk-add__textarea::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.bulk-add__step-body .backup-modal__hint {
  margin-top: 0.55rem;
  margin-bottom: 0;
}

.bulk-add__copy {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  margin-top: 0;
  padding: 0.45rem 0.95rem;
  justify-content: center;
  font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--text);
}

.bulk-add__copy:hover {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: var(--accent);
}

.modal__bulk .modal__footer {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
}

.bulk-add__textarea::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.bulk-import-preview {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.bulk-import-preview__body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 0.35rem;
}

.bulk-import-preview__filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.bulk-import-preview__filter-heading {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.bulk-import-preview__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0;
}

@media (min-width: 640px) {
  .bulk-import-preview__stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.bulk-import-preview__stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: start;
  color: inherit;
  font-family: inherit;
  width: 100%;
  min-width: 0;
}

.bulk-import-preview__stat:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.bulk-import-preview__stat.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-elevated));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.bulk-import-preview__stat-label {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.78rem;
  line-height: 1.25;
  white-space: normal;
}

.bulk-import-preview__stat-value {
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1;
}

.bulk-import-preview__advanced {
  margin-top: 0;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.bulk-import-preview__advanced-body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  padding: 0.5rem 0 0.35rem;
}

.bulk-import-preview__copy-btn.is-copied {
  border-color: color-mix(in srgb, #27ae60 55%, var(--border));
  color: #1e8449;
  background: color-mix(in srgb, #27ae60 14%, transparent);
}

.bulk-import-preview__import-label {
  cursor: pointer;
  margin: 0;
}

.bulk-import-preview__accounting {
  display: none;
}

.bulk-import-preview__persistence-error {
  margin: 0.5rem 0 0;
  padding: 0.65rem 0.85rem;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--danger, #c0392b) 12%, transparent);
  color: var(--danger, #c0392b);
  font-size: 0.9rem;
  line-height: 1.4;
}

.bulk-import-preview__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.bulk-import-preview__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: nowrap;
}

.bulk-import-preview__footer .btn--primary {
  margin-inline-start: auto;
  flex-shrink: 0;
}

.bulk-import-preview__import-label--optional {
  font-size: 0.78rem;
  opacity: 0.85;
}

@media (max-width: 640px) {
  .bulk-import-preview__footer {
    position: static;
    z-index: 2;
    margin: 0 -0.35rem;
    padding: 0.65rem 0.35rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(
      180deg,
      transparent 0%,
      color-mix(in srgb, var(--bg-elevated) 88%, transparent) 28%,
      var(--bg-elevated) 100%
    );
    border-top: 1px solid var(--border);
  }
}

.bulk-import-preview__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.bulk-import-preview__notice {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--text);
  font-size: 0.9rem;
}

.bulk-import-preview__table-wrap {
  flex: 0 1 auto;
  min-height: 0;
  max-height: min(48vh, 420px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.bulk-import-preview__table {
  width: 100%;
  min-width: 36rem;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.bulk-import-preview__table th,
.bulk-import-preview__table td {
  padding: 0.4rem 0.55rem;
  text-align: start;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.bulk-import-preview__cell-title {
  word-break: break-word;
  min-width: 9rem;
  max-width: 16rem;
}

.bulk-import-preview__cell-reason {
  word-break: break-word;
  min-width: 8rem;
  max-width: 14rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.35;
  max-height: calc(1.35em * 2 + 0.1rem);
}

@media (max-width: 720px) {
  .bulk-import-preview__table th:nth-child(5),
  .bulk-import-preview__table td:nth-child(5),
  .bulk-import-preview__table th:nth-child(6),
  .bulk-import-preview__table td:nth-child(6) {
    display: none;
  }

  .bulk-import-preview__table {
    min-width: 0;
  }

  .bulk-import-preview__cell-title {
    max-width: none;
  }

  .bulk-import-preview__cell-type .bulk-import-preview__type-note {
    display: none;
  }
}

.bulk-import-preview__table th:nth-child(2),
.bulk-import-preview__table td:nth-child(2) {
  min-width: 4.5rem;
  white-space: nowrap;
}

.bulk-import-preview__table th:nth-child(3),
.bulk-import-preview__table td:nth-child(3) {
  min-width: 5.5rem;
  white-space: nowrap;
}

.bulk-import-preview__table th:nth-child(4),
.bulk-import-preview__table td:nth-child(4) {
  min-width: 7.5rem;
  white-space: nowrap;
}

.bulk-import-preview__table th:nth-child(5),
.bulk-import-preview__table td:nth-child(5) {
  min-width: 5rem;
  white-space: nowrap;
}

.bulk-import-preview__row {
  cursor: pointer;
}

.bulk-import-preview__row--failed {
  background: color-mix(in srgb, #e74c3c 8%, transparent);
}

.bulk-import-preview__row--not-found {
  background: color-mix(in srgb, #f39c12 8%, transparent);
}

.bulk-import-preview__row.is-expanded {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.bulk-import-preview__row-detail td {
  padding-top: 0;
  border-bottom: 1px solid var(--border);
}

.bulk-import-preview__row-detail-body {
  padding: 0 0.65rem 0.65rem;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.bulk-import-preview__row-detail-body ul {
  margin: 0.35rem 0 0;
  padding-inline-start: 1.1rem;
}

.bulk-import-preview__table th {
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  font-weight: 600;
  z-index: 1;
}

.bulk-import-preview__status {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}

.bulk-import-preview__status--pending {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.bulk-import-preview__status--duplicate {
  background: color-mix(in srgb, var(--text-muted) 16%, transparent);
}

.bulk-import-preview__status--invalid {
  background: color-mix(in srgb, #c0392b 16%, transparent);
}

.bulk-import-preview__status--failed {
  background: color-mix(in srgb, #c0392b 22%, transparent);
  color: #922b21;
}

.bulk-import-preview__status--not-found {
  background: color-mix(in srgb, #f39c12 22%, transparent);
  color: #9a6700;
}

.bulk-import-preview__row-error {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.bulk-import-preview__status--added {
  background: color-mix(in srgb, #27ae60 18%, transparent);
}

.bulk-import-preview__status--ready {
  background: color-mix(in srgb, #27ae60 14%, transparent);
}

.bulk-import-preview__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.bulk-import-preview__progress {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.bulk-import-preview__match {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.bulk-import-preview__type-btn {
  appearance: none;
  border: 1px dashed var(--border);
  border-radius: 0.35rem;
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.bulk-import-preview__type-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.bulk-import-preview__type-edit {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  min-width: 7.5rem;
}

.bulk-import-preview__type-edit-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.bulk-import-preview__type-edit-actions .btn--sm {
  flex: 1 1 0;
  min-height: 2rem;
  justify-content: center;
}

.bulk-import-preview__type-select {
  width: 100%;
  min-width: 0;
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: none;
  appearance: auto;
}

.bulk-import-preview__type-select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 1px;
}

.bulk-import-preview__type-note {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.bulk-import-preview__type-note--inline {
  display: block;
  margin-top: 0.25rem;
}

.bulk-import-preview__pick {
  display: block;
  margin-top: 0.35rem;
  max-width: 100%;
  font-size: 0.82rem;
}

.bulk-add__file {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.bulk-add__file-hint {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.bulk-add__file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.bulk-add__file-label:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.layout-bar {
  display: flex;
  justify-content: flex-start;
  gap: 0.35rem;
}

.layout-toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.layout-toggle::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 0.4rem);
  left: 0;
  z-index: 5;
  width: max-content;
  max-width: 11rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s;
}

.layout-toggle:hover::after,
.layout-toggle:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.layout-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-card);
}

.layout-toggle--active {
  color: var(--accent);
  border-color: rgba(232, 184, 74, 0.45);
  background: rgba(232, 184, 74, 0.08);
}

.layout-toggle__icon {
  width: 1.2rem;
  height: 1.2rem;
}

.link-preview-popover {
  position: fixed;
  z-index: 90;
  width: min(320px, calc(100vw - 2rem));
  pointer-events: none;
}

.link-preview-popover[hidden] {
  display: none;
}

.link-preview-popover__inner {
  padding: 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.link-preview-popover__loading,
.link-preview-popover__fallback {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.link-preview-popover__content {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.75rem;
  align-items: start;
}

.link-preview-popover__poster {
  width: 72px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.link-preview-popover__poster--empty {
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  color: var(--text-muted);
}

.link-preview-popover__title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
}

.link-preview-popover__meta-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.title-search-confirm__meta-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.link-preview-popover__meta {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.link-preview-popover__plot {
  margin: 0.35rem 0 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app[data-layout="poster"] .cards {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.app[data-layout="poster"] .card {
  padding: 0;
  overflow: hidden;
  min-width: 0;
}

.app[data-layout="poster"] .card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0.9rem 1rem 1rem;
}

.app[data-layout="poster"] .card__media {
  position: relative;
  flex-shrink: 0;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  min-height: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.app[data-layout="poster"] .card__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.app[data-layout="poster"] .card__poster--placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  font-size: 2.5rem;
  color: var(--text-muted);
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
}

.card__poster--broken {
  position: absolute;
  inset: 0;
  padding: 0.65rem;
  font-size: 0.72rem;
  line-height: 1.45;
  text-align: center;
  color: var(--text-muted);
  background: linear-gradient(180deg, rgba(220, 80, 80, 0.08) 0%, var(--bg-elevated) 100%);
  border: 1px dashed rgba(220, 80, 80, 0.35);
}

.card__poster-message {
  display: block;
  max-width: 16rem;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text-muted);
}

/* Cover still finishing in the background after a fast bulk-import add
   (see queueImportedItemEnrichment) — same shimmer language as list-loading
   skeletons so it reads as "in progress", not broken. */
.card__poster.card__poster--pending {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.14) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 200% 100%;
  animation: list-skeleton-shimmer 1.4s ease-in-out infinite;
}

.badge--pending {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  animation: badge-pending-pulse 1.6s ease-in-out infinite;
}

html[data-theme="light"] .badge--pending {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
}

@keyframes badge-pending-pulse {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

.app[data-layout="hover"] .card__media {
  display: none;
}

.app[data-layout="hover"] .card__overlay {
  display: none;
}

.app[data-layout="hover"] .card__body {
  display: contents;
}

.app[data-layout="poster"] .card__overlay {
  display: none;
}

.card__overlay {
  display: none;
}

.card__head {
  display: contents;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-field--full {
  grid-column: 1 / -1;
}

.form-field__label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-field__hint {
  display: block;
  margin: 0.2rem 0 0.45rem;
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--text-muted);
  opacity: 0.85;
}

.form-field__hint strong {
  font-weight: 600;
  color: var(--text);
}

.form-field__status {
  min-height: 1.1rem;
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text);
}

.form-link-preview {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.form-link-preview__hint {
  margin: 0;
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
  background: rgba(217, 185, 106, 0.12);
  border: 1px solid rgba(217, 185, 106, 0.35);
  border-radius: var(--radius-sm);
}

.form-link-preview__hint strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
}

.form-link-preview__card {
  margin-bottom: 0;
}

.form-link-preview__hint:empty,
.form-link-preview__card:empty {
  display: none;
}

.form-field__status--error {
  color: #f87171;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-textarea {
  resize: vertical;
  min-height: 64px;
}

.form-input:focus,
.form-textarea:focus,
.modal .select:focus {
  border-color: rgba(232, 184, 74, 0.45);
  box-shadow: 0 0 0 3px rgba(232, 184, 74, 0.08);
}

.form-input--loading {
  opacity: 0.72;
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    rgba(217, 185, 106, 0.08) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: form-input-shimmer 1.2s ease-in-out infinite;
}

@keyframes form-input-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.modal .select {
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  line-height: 1.35;
  appearance: auto;
  -webkit-appearance: menulist;
  background-image: none;
  padding-inline-end: 0.85rem;
}

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.modal__footer-right {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.empty-state__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.empty-state__actions .empty-state__btn {
  margin-top: 0;
}

.empty-state__btn {
  margin-top: 1rem;
}

@media (max-width: 640px) {
  .app {
    padding: max(0.65rem, env(safe-area-inset-top)) max(0.65rem, env(safe-area-inset-right))
      max(1.25rem, env(safe-area-inset-bottom, 0px)) max(0.65rem, env(safe-area-inset-left));
  }

  .header {
    margin-bottom: 0.65rem;
  }

  .header__main {
    gap: 0.38rem 0.5rem;
  }

  .header__title {
    font-size: clamp(1.5rem, 4.2vw, 1.85rem);
    padding-right: 0;
  }

  .header__stats {
    gap: 0.3rem;
  }

  .header__stat-chip {
    padding: 0.22rem 0.5rem;
    font-size: 0.72rem;
  }

  .header__toolbar {
    padding: 0.22rem;
    gap: 0.22rem;
  }

  .header__toolbar .btn--primary {
    min-height: 34px;
    padding: 0.42rem 0.75rem;
    font-size: 0.76rem;
  }

  .header__toolbar .account-menu__trigger {
    min-height: 32px;
    padding: 0.4rem 0.55rem;
    font-size: 0.76rem;
  }

  .header__actions {
    width: auto;
    gap: 0.4rem;
  }

  .header__actions .btn--primary {
    min-height: 34px;
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
  }

  .account-menu__trigger-label {
    display: none;
  }

  .account-menu__trigger {
    min-width: 34px;
    padding: 0.45rem 0.55rem;
  }

  .page-toolbar {
    margin: -0.35rem 0 0.55rem;
  }

  .panel {
    margin-bottom: 0.75rem;
    border-radius: 10px;
  }

  .type-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0.2rem;
    padding: 0.35rem;
  }

  .type-tabs::-webkit-scrollbar {
    display: none;
  }

  .type-tab {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 0.35rem 0.5rem;
    font-size: 0.74rem;
    gap: 0.2rem;
  }

  .type-tab:has(.type-tab__icon) .type-tab__label {
    display: none;
  }

  .panel__filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: clamp(0.28rem, 1.1vw, 0.35rem);
    padding: clamp(0.32rem, 1.1vw, 0.4rem);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .panel__filters > .genre-filter,
  .panel__filters > .watched-filter,
  .panel__filters > .rating-filter {
    flex: unset;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    overflow: hidden;
  }

  .panel__filters > .search {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    max-width: none;
    flex: none;
  }

  .panel__filters .search__input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .search {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    display: block;
  }

  .genre-filter {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    align-self: start;
  }

  .watched-filter {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    align-self: start;
  }

  .rating-filter {
    grid-column: 3;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    align-self: start;
  }

  .search__input,
  .genre-filter__select,
  .watched-filter__select,
  .rating-filter__select,
  .gate__input,
  .form-input,
  .form-textarea {
    font-size: 16px;
  }

  .search__input,
  .genre-filter__select {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    border-radius: 8px;
  }

  .panel__filters .search__input {
    height: 3rem;
    min-height: 3rem;
    max-height: none;
    padding-inline-start: 2.35rem;
    padding-inline-end: 0.65rem;
    line-height: 1.25;
  }

  .panel__filters .genre-filter__select {
    height: 2.35rem;
    min-height: 2.35rem;
    max-height: none;
    padding: 0 1.65rem 0 0.5rem;
    background-position: right 0.45rem center;
  }

  .filter,
  .genre-filter__select {
    width: 100%;
    min-width: 0;
  }

  .layout-toggle {
    width: 2.1rem;
    height: 2.1rem;
  }

  .cards,
  .app[data-layout="poster"] .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(0.28rem, 1.1vw, 0.4rem);
  }

  .app[data-layout="hover"] .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  /* Poster tab: compact phone grid (desktop poster rules were winning here). */
  .app[data-layout="poster"] .card {
    padding: 0;
  }

  .app[data-layout="poster"] .card__body {
    padding: 0.35rem 0.32rem 0.38rem;
  }

  .app[data-layout="poster"] .card__poster--placeholder {
    min-height: 0;
    font-size: 1.35rem;
  }

  /* Hover tab: text cards on phone (no duplicate poster grid). */
  .app[data-layout="hover"] .card__media,
  .app[data-layout="hover"] .card__overlay {
    display: none;
  }

  .app[data-layout="hover"] .card:has(.card__media) .card__head {
    display: block;
  }

  .app[data-layout="hover"] .card {
    padding: 0.5rem 0.45rem;
  }

  .app[data-layout="hover"] .card__head .card__top {
    margin-bottom: 0.3rem;
  }

  .app[data-layout="hover"] .card__head .card__title {
    font-size: 0.8rem;
    line-height: 1.25;
  }

  .app[data-layout="hover"] .card__head .card__sections {
    margin-bottom: 0.35rem;
  }

  .app[data-layout="hover"] .card__head .badge {
    padding: 0.12rem 0.32rem;
    font-size: 0.55rem;
  }

  .app[data-layout="hover"] .card__body {
    display: flex;
    flex-direction: column;
    padding: 0;
  }

  .app[data-layout="poster"] .card__media {
    display: block;
  }

  .app[data-layout="poster"] .card__overlay {
    display: block;
  }

  .app[data-layout="poster"] .card__body {
    display: flex;
    flex-direction: column;
  }

  .card {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: 8px;
  }

  .card:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  }

  .card__media {
    position: relative;
    flex-shrink: 0;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    min-height: 0;
    background: var(--bg-elevated);
  }

  .card__poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .card__poster--placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    min-height: 0;
    font-size: 1.35rem;
    color: var(--text-muted);
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
  }

  .card__overlay {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
  }

  .card:has(.card__media) .card__head {
    display: none;
  }

  .card__overlay .card__top {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    margin: 0;
    padding: 1.1rem 0.3rem 0.28rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.35) 55%, transparent 100%);
  }

  .card__overlay .card__title {
    font-size: clamp(0.62rem, 2.75vw, 0.68rem);
    line-height: 1.2;
    color: #fff;
  }

  .card__overlay .card__alt {
    font-size: 0.58rem;
    color: rgba(255, 255, 255, 0.75);
  }

  .card__overlay .card__sections {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    inset-inline: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.18rem;
    max-width: 100%;
    margin: 0;
    padding: 0.2rem 0.28rem 0.26rem;
    background: linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.62) 0%,
      rgba(0, 0, 0, 0.38) 48%,
      rgba(0, 0, 0, 0) 100%
    );
    pointer-events: none;
  }

  .card__overlay .card__section-label {
    display: block;
    align-self: stretch;
    width: 100%;
    padding: 0 0 0.08rem;
    margin: 0;
    font-size: 0.4rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.58);
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0;
    box-shadow: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
    line-height: 1.15;
  }

  .card__overlay .card__section {
    gap: 0.16rem;
    width: 100%;
  }

  .card__overlay .card__section--genres {
    width: 100%;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }

  .card__overlay .card__genre-row--single-line {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .card__overlay .card__genre-row--single-line::-webkit-scrollbar {
    display: none;
  }

  .card__overlay .card__info-row,
  .card__overlay .card__genre-row {
    gap: 0.12rem;
  }

  .card__overlay .card__genre-row {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }

  .card__overlay .badge {
    padding: 0.1rem 0.3rem;
    font-size: 0.46rem;
  }

  .card__overlay .badge--year {
    color: #fff;
    background: rgba(6, 6, 8, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.42);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.55);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  }

  .card__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0.22rem 0.32rem 0.28rem;
  }

  .card:not(:has(.card__media)) {
    padding: 0.65rem;
  }

  .card:not(:has(.card__media)) .card__head {
    display: block;
  }

  .card:not(:has(.card__media)) .card__top {
    margin-bottom: 0.35rem;
  }

  .card:not(:has(.card__media)) .card__title {
    font-size: 0.88rem;
    color: var(--text);
  }

  .card:not(:has(.card__media)) .card__sections {
    margin-bottom: 0.4rem;
  }

  .card__lead {
    display: none;
  }

  .card__summary {
    display: none;
  }

  .card__rating-badges {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    align-self: stretch;
    gap: 0.14rem;
    margin-top: auto;
    margin-bottom: 0.28rem;
    padding: 0;
    min-height: 2.05rem;
    flex-shrink: 0;
    max-width: 100%;
    overflow: hidden;
  }

  .card__rating-badges ~ .card__footer {
    margin-top: 0;
  }

  .card__footer {
    margin-top: auto;
    flex-shrink: 0;
  }

  .card__score {
    flex: 0 1 auto;
    width: auto;
    max-width: calc(50% - 0.07rem);
    min-height: 1.05rem;
    min-width: 0;
    gap: 0.1rem;
    padding: 0.08rem 0.22rem 0.08rem 0.2rem;
    justify-content: flex-start;
    overflow: hidden;
  }

  .card__score-value {
    font-size: 0.44rem;
    font-weight: 700;
    flex-shrink: 0;
  }

  .card__score-logo {
    flex-shrink: 1;
    min-width: 0;
    max-width: 100%;
  }

  .card__score-logo--imdb {
    height: 0.58rem;
    width: auto;
  }

  .card__score-logo--anilist {
    height: 0.62rem;
    width: auto;
  }

  .card__footer {
    gap: 0.22rem;
    padding-top: 0.28rem;
  }

  .card-menu__trigger {
    width: 1.85rem;
    height: 1.85rem;
    min-height: 1.85rem;
    max-height: 1.85rem;
    font-size: 0.95rem;
  }

  .card-menu__trigger-icon--desktop {
    width: 0.9rem;
    height: 0.9rem;
  }

  .card__rating {
    padding: 0.35rem 0.45rem;
  }

  .card__rating--empty {
    min-height: 1.65rem;
  }

  .card__rating-placeholder {
    font-size: 0.62rem;
  }

  .card__rating-top {
    column-gap: 0.35rem;
  }

  .card__rating-label {
    font-size: 0.5rem;
    letter-spacing: 0.05em;
  }

  .card__rating-score {
    font-size: 0.78rem;
  }

  .card__rating-note {
    font-size: 0.62rem;
    line-height: 1.4;
  }

  .genre-section {
    margin-bottom: 1.15rem;
  }

  .genre-section__header {
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.45rem;
  }

  .genre-section__title {
    font-size: 1rem;
    flex: 1 1 auto;
    min-width: 0;
  }

  .genre-section__count {
    margin-left: 0;
    width: 100%;
    font-size: 0.72rem;
  }

  .footer {
    margin-top: 2rem;
    padding-bottom: 0.5rem;
    text-align: left;
  }

  .footer p {
    font-size: 0.8rem;
    line-height: 1.5;
  }

  .modal {
    align-items: center;
    justify-content: center;
    padding: max(0.65rem, env(safe-area-inset-top))
      max(0.65rem, env(safe-area-inset-right))
      max(0.65rem, env(safe-area-inset-bottom))
      max(0.65rem, env(safe-area-inset-left));
  }

  .modal__panel {
    width: min(100%, 22.5rem);
    max-width: 22.5rem;
    max-height: min(90vh, 42rem);
    border-radius: 12px;
  }

  .modal__panel--compact {
    max-width: min(100%, 21rem);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .inline-add {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-add .btn {
    min-height: 2.1rem;
  }

  .modal__footer {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
  }

  .modal__footer-right {
    margin-left: 0;
    margin-inline-start: auto;
    width: auto;
  }

  .modal__footer-right .btn {
    flex: 0 0 auto;
    min-height: 2.1rem;
  }

  .modal__footer--simple .btn {
    min-height: 2.1rem;
    width: auto;
  }

  .title-search-confirm__footer {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .title-search-confirm__footer .btn {
    width: auto;
    min-height: 2.1rem;
  }

  .link-preview-popover {
    width: min(300px, calc(100vw - 1.5rem));
  }

  .gate {
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
      max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  }

  .gate__title {
    font-size: 1.5rem;
  }

  .gate__mode {
    min-height: 44px;
  }

  .gate__submit {
    min-height: 44px;
  }
}

@media (max-width: 380px) {
  .gate__card {
    padding: 1.5rem 1.1rem 1.25rem;
  }

  .gate__mode {
    font-size: 0.76rem;
    padding: 0.4rem 0.35rem;
  }

  .gate__title {
    font-size: 1.35rem;
  }
}
