/* ===========================================
   Letterboxd Shortlist - Styles
   Theme: Dark cinematic with green accents
   =========================================== */

/* CSS Variables */
:root {
  /* Colors - Letterboxd theme */
  --bg-primary: #202830;
  --bg-secondary: #1b2228;
  --bg-tertiary: #2c3440;
  --bg-hover: #384250;
  --bg-card: #21272e;

  --accent-green: #00e054;
  --accent-blue: #40bcf4;
  --accent-orange: #ff8000;
  --accent: var(--accent-green);
  --accent-hover: #00c949;
  --accent-muted: rgba(0, 224, 84, 0.15);
  --accent-gradient: linear-gradient(120deg, var(--accent-orange), var(--accent-green), var(--accent-blue));

  --link-color: #40bcf4;
  --link-hover: #5ed3ff;

  --text-primary: #ffffff;
  --text-secondary: #2f2f2f;
  --text-muted: #3f3f3f;

  --border: #456;
  --border-subtle: #2c3440;

  --error: #e94747;
  --warning: #ee7000;

  /* Letterboxd poster colors for placeholders */
  --poster-bg: #445566;

  /* Typography - Letterboxd uses Graphik */
  --font-sans: 'Graphik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;

  /* Layout */
  --header-height: 60px;
  --max-width: 1200px;
  --poster-ratio: 2 / 3;
  --user-avatar-size: 80px;
  --input-bg: #2b333c;
  --user-input-width: 120px;
  --user-input-height: 30px;
}

@property --watch-progress {
  syntax: '<number>';
  inherits: true;
  initial-value: 0;
}

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: #ffffff;
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--link-hover);
}

/* ===========================================
   Layout
   =========================================== */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* Main content */
.main {
  min-height: 100vh;
  padding: var(--space-md) 0 var(--space-2xl);
}

/* ===========================================
   Views (Page states)
   =========================================== */

.view {
  display: none;
}

.view.active {
  display: block;
}

/* ===========================================
   Home View
   =========================================== */

.hero {
  text-align: center;
  padding: var(--space-sm) 0 var(--space-md);
}

.hero-logo {
  width: 460px;
  height: auto;
  margin: 0 auto var(--space-sm);
  display: block;
}

.hero-logo-combine {
  width: 220px;
  max-width: 80%;
}

.hero-title {
  font-family: 'STT Interphases Pro Trl Xbd', var(--font-sans);
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: 0.02em;
  margin-bottom: var(--space-sm);
}

.hero h1:not(.hero-title) {
  margin-bottom: var(--space-md);
}

.hero-tagline {
  font-size: 1.125rem;
  color: #555555;
  font-weight: 600;
  max-width: 500px;
  margin: 0 auto var(--space-lg);
}

.combine-tagline {
  margin: var(--space-md) auto var(--space-lg);
  text-align: center;
}

.hero-emphasis {
  color: var(--accent);
  font-weight: 500;
}

/* Combined Watchlists Module */
.combine-module {
  background: transparent;
  border-radius: 0;
  padding: var(--space-lg);
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto var(--space-md);
  border: none;
  box-shadow: none;
}

.combine-module h2 {
  font-size: 1.125rem;
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.combine-module h2::before {
  content: '';
  width: 4px;
  height: 20px;
  background: var(--accent-gradient);
  border-radius: 2px;
}

/* User Chips Area */
.user-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  min-height: 48px;
  margin-bottom: var(--space-lg);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: var(--space-xs) var(--space-md);
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}

.user-chip:hover {
  border-color: var(--border);
}

.user-chip.loading {
  opacity: 0.7;
}

.user-chip-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-hover);
  object-fit: cover;
}

.user-chip-name {
  font-weight: 500;
  color: var(--text-primary);
}

.user-chip-count {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.user-chip-view {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-xs);
  margin: calc(var(--space-xs) * -1);
  margin-left: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.user-chip-view:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.user-chip-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-xs);
  margin: calc(var(--space-xs) * -1);
  margin-left: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.user-chip-remove:hover {
  background: var(--bg-hover);
  color: var(--error);
}

/* User Input Fields */
.user-inputs {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
  justify-content: center;
  align-content: center;
  flex-wrap: wrap;
  overflow-x: visible;
  position: relative;
}

.user-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  overflow: visible;
  flex: 0 0 auto;
  width: fit-content;
  min-width: 0;
}

.user-slot.filled .user-slot-input {
  display: none;
}

.user-slot.filled .user-tile {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.user-slot.preview {
  cursor: pointer;
}

.user-slot.preview .user-slot-avatar img {
  opacity: 1;
}

.user-slot.loading .user-tile {
  border-color: transparent;
  box-shadow: none;
}

.user-slot-input {
  display: grid;
  grid-template-rows: auto auto auto;
  justify-items: center;
  gap: 14px;
  padding: 0;
  width: auto;
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
  order: 2;
}

.user-slot-avatar {
  width: var(--user-avatar-size);
  height: var(--user-avatar-size);
  border-radius: 50%;
  border: 1px solid var(--slot-color, rgba(255, 255, 255, 0.65));
  background: transparent;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* --slot-color is set inline on each .user-slot by refreshUserSlotCache(),
   cycling through the palette so any number of slots stays coloured. */
.user-tile-avatar-wrap {
  color: var(--slot-color, rgba(255, 255, 255, 0.65));
}

.user-slot.preview .user-slot-avatar {
  --slot-color: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(255, 255, 255, 0.95) !important;
}

.user-slot-avatar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-image: repeating-linear-gradient(
    135deg,
    var(--slot-color, rgba(255, 255, 255, 0.65)) 0 1px,
    transparent 1px 3px
  );
  opacity: 0.35;
  pointer-events: none;
  z-index: 2;
}

.user-slot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 1;
}

.user-input-suggestion {
  grid-row: 2;
  grid-column: 1;
  width: var(--user-input-width);
  max-width: 100%;
  height: var(--user-input-height);
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.3;
  font-family: inherit;
  color: rgba(255, 255, 255, 0.8);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border-radius: 15px;
  border: 1px solid transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  z-index: 1;
}

.user-input-suggestion:empty {
  opacity: 0;
  border-color: transparent;
  box-shadow: none;
}

.user-input-field {
  grid-row: 2;
  grid-column: 1;
  /* Stop iOS Safari replacing the field with its native input styling,
     which squares off the rounded corners. */
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid #c8c8c8;
  border-radius: 15px;
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.3;
  font-family: inherit;
  width: var(--user-input-width);
  max-width: 100%;
  height: var(--user-input-height);
  outline: none;
  text-align: left;
  caret-color: var(--text-primary);
  background: transparent;
  position: relative;
  z-index: 2;
  transition: all var(--transition-fast);
}

.user-input-field:placeholder-shown {
  text-align: center;
  padding-left: 10px;
  padding-right: 10px;
  background: #ffffff;
  color: #101418;
}

/* iOS Safari zooms the whole page when a focused input's font-size is under
   16px, which reads as the field warping mid-type. Touch devices get 16px
   regardless of viewport width; desktop keeps the 12px design. */
@media (pointer: coarse) {
  .user-input-field,
  .user-input-suggestion {
    font-size: 16px;
  }
}

.user-input-field:focus {
  color: #101418;
  caret-color: #101418;
}

.user-input-field::placeholder {
  color: #b0b0b0;
  text-align: center;
}

.user-input-field:placeholder-shown::placeholder {
  color: #b0b0b0;
}

.user-input-field:focus::placeholder {
  color: #b0b0b0;
}

.user-slot.preview .user-input-field {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: left;
}

.user-slot-input:focus-within .user-input-suggestion {
  color: rgba(16, 20, 24, 0.55);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 0 rgba(16, 20, 24, 0.2);
}

/* Focus/filled colours come from --slot-color (set inline per slot by JS),
   so slots beyond the palette length cycle instead of losing their colour. */
.user-slot .user-slot-input:focus-within .user-slot-avatar,
.user-slot .user-slot-input:focus-within .user-input-field,
.user-slot .user-slot-input:focus-within .user-input-suggestion {
  border-color: var(--slot-color, rgba(16, 20, 24, 0.4));
}

.user-slot.filled .user-slot-remove {
  opacity: 0;
  pointer-events: none;
}

.user-slot.filled .user-tile-avatar {
  border-color: var(--slot-color, rgba(255, 255, 255, 0.65));
  box-shadow: 0 0 4px color-mix(in srgb, var(--slot-color, #ffffff) 30%, transparent);
  color: var(--slot-color, rgba(255, 255, 255, 0.65));
}

.user-tile {
  position: relative;
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-sm);
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  min-height: 54px;
  opacity: 1;
  pointer-events: none;
  overflow: visible;
  transition: opacity var(--transition-normal), border-color var(--transition-fast), box-shadow var(--transition-fast);
  order: 1;
}

.user-slot-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.25);
  color: rgba(255, 255, 255, 0.8);
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  transform: translateY(-2px);
  z-index: 3;
  font-size: 0;
  line-height: 0;
  --close-size: 10px;
}

.user-slot:hover .user-slot-remove {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.user-tile-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.25);
  color: rgba(255, 255, 255, 0.8);
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  transform: translateY(-2px);
  font-size: 0;
  line-height: 0;
  --close-size: 10px;
  z-index: 3;
}

.user-slot-remove::before,
.user-slot-remove::after,
.user-tile-remove::before,
.user-tile-remove::after,
.modal-close::before,
.modal-close::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--close-size, 12px);
  height: 2px;
  background: currentColor;
  border-radius: 999px;
  transform: translate(-50%, -50%) rotate(45deg);
}

.user-slot-remove::after,
.user-tile-remove::after,
.modal-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.user-tile:hover .user-tile-remove {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.user-tile-avatar-wrap {
  position: relative;
  width: var(--user-avatar-size);
  height: var(--user-avatar-size);
  display: grid;
  place-items: center;
  flex: none;
  overflow: visible;
  transition: --watch-progress 300ms ease;
}

.user-tile-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-hover);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* Small curved status readout that arcs above each tile's avatar, in the
   same colour as that tile's border (--slot-color, inherited from the
   .user-slot ancestor). The SVG covers the avatar wrap exactly so its
   viewBox maps 1:1 onto the avatar circle; the arc path in main.js is
   drawn concentric to that circle and the text overflows visibly above. */
.user-tile-arc {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
  color: var(--slot-color, rgba(255, 255, 255, 0.65));
}

.user-tile-arc text {
  fill: currentColor;
  font-family: inherit;
  opacity: 0.85;
}

.user-tile-progress {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
}

.user-tile-avatar-wrap:not([data-progress="true"]) .user-tile-progress {
  display: none;
}

.user-tile-progress::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0.35;
}

.user-tile-progress::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    currentColor calc(var(--watch-progress, 0) * 1turn),
    transparent 0
  );
  -webkit-mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 1px),
    #000 calc(100% - 1px)
  );
  mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 1px),
    #000 calc(100% - 1px)
  );
}

.user-tile-avatar.loading-skeleton {
  border-radius: 50%;
}

.user-tile-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 2;
}

.user-tile-initial {
  font-weight: 600;
  color: var(--text-secondary);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1;
}

.user-tile-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-width: 0;
  align-items: center;
}

.user-tile-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.2;
  min-height: calc(1.2em * 2);
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--user-input-width);
  max-width: var(--user-input-width);
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
  text-align: center;
}

.user-tile-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  justify-content: center;
}

.user-tile-watchlist {
  font-size: 0.75rem;
  color: #6a6a6a;
  text-decoration: none;
  transition: color var(--transition-fast);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
}

.user-tile-watchlist:hover {
  color: var(--text-primary);
}

.user-tile-watchlist.is-disabled {
  opacity: 0.6;
  pointer-events: none;
}

.user-tile-watchlist-count {
  font-weight: 600;
}

.user-tile-handle {
  color: var(--text-secondary);
}

.user-tile-count {
  color: var(--text-secondary);
  font-weight: 400;
}

.user-tile-status {
  color: var(--text-muted);
}

.user-tile-sep {
  color: var(--text-muted);
  opacity: 0.6;
}

.user-tile-actions {
  margin-left: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

.user-tile-action {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  margin: -4px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.user-tile-action:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.user-tile-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}


.error-inline {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: var(--space-sm);
  text-align: center;
}

/* Primary CTA Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.btn-sm {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
}

.combine-cta {
  width: 100%;
  margin-top: var(--space-md);
  background: linear-gradient(#1b2228, #1b2228) padding-box, var(--accent-gradient) border-box;
  border: 1px solid transparent;
  color: var(--text-primary);
  letter-spacing: 0.01em;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}

.combine-cta:hover:not(:disabled) {
  background: linear-gradient(#212a34, #212a34) padding-box, var(--accent-gradient) border-box;
  transform: translateY(-1px);
}

.add-user-btn {
  width: var(--user-input-height);
  height: var(--user-input-height);
  border-radius: 50%;
  border: 1px solid #d0d0d0;
  background: transparent;
  color: #d0d0d0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  line-height: 0;
  padding: 0;
  cursor: pointer;
  margin: 0;
  transition: opacity var(--transition-fast);
  box-shadow: none;
  position: absolute;
  z-index: 2;
}

.add-user-btn:hover {
  opacity: 0.8;
}

.add-user-btn::before,
.add-user-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 1px;
  background: currentColor;
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.add-user-btn::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

/* Settings Panel */
.settings-panel {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
}

.settings-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  padding: var(--space-sm) 0;
}

.settings-toggle:hover {
  color: var(--text-primary);
}

.settings-toggle-icon {
  transition: transform var(--transition-fast);
}

.settings-toggle.expanded .settings-toggle-icon {
  transform: rotate(180deg);
}

.settings-content {
  display: none;
  padding-top: var(--space-lg);
}

.settings-content.expanded {
  display: block;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.setting-label {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.setting-label span:first-child {
  font-weight: 500;
}

.setting-label span:last-child {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Star rating slider */
.star-slider {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.star-slider input[type="range"] {
  width: 100px;
  accent-color: var(--accent);
}

.star-value {
  font-weight: 600;
  color: var(--accent);
  min-width: 36px;
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 48px;
  height: 26px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.toggle input:checked + .toggle-slider {
  background: var(--accent-muted);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(22px);
  background: var(--accent);
}

/* Number input */
.number-input {
  width: 70px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  text-align: center;
}

.number-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ===========================================
   Results View
   =========================================== */

#view-results {
  margin-top: var(--space-lg);
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.results-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.back-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-secondary);
  font-size: 0.875rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  margin: calc(var(--space-sm) * -1);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.back-btn:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.results-summary {
  flex: 1;
}

.results-summary h2 {
  font-size: 1.25rem;
  margin-bottom: var(--space-xs);
}

.results-data-status {
  margin: 0;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.035);
  color: rgba(0, 0, 0, 0.68);
  font-size: 0.8rem;
  line-height: 1.45;
}

.results-data-status[hidden] {
  display: none;
}

.results-data-status[data-kind="warning"] {
  border-color: rgba(176, 112, 0, 0.2);
  background: rgba(255, 179, 0, 0.08);
  color: #785000;
}

.results-data-status[data-kind="loading"] {
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(0, 0, 0, 0.56);
}

/* Compact control in the tier header; opens the fuller streaming row below. */
.streaming-filter {
  display: inline-flex;
  align-items: center;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.streaming-filter-toggle {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast),
    color var(--transition-fast);
}

.streaming-filter-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-secondary);
}

.streaming-filter.is-open .streaming-filter-toggle {
  border-color: var(--accent-green);
  background: rgba(0, 224, 84, 0.06);
  color: var(--text-secondary);
}

.streaming-filter-count {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.streaming-filter-chevron {
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.streaming-filter.is-open .streaming-filter-chevron {
  transform: rotate(180deg);
}

.tier-header:has(+ .streaming-filter-reveal.is-open) {
  margin-bottom: var(--space-sm);
}

.streaming-filter-reveal {
  display: none;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

.streaming-filter-reveal.is-open {
  display: flex;
}

.streaming-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.streaming-filter-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 6px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.03);
  color: rgba(0, 0, 0, 0.76);
  cursor: pointer;
  white-space: nowrap;
}

.streaming-filter-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.streaming-filter-region {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.streaming-filter-region-label {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.streaming-filter-region select {
  font: inherit;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  cursor: pointer;
  text-transform: uppercase;
}

.streaming-filter-option:has(input:checked) {
  border-color: var(--accent-green);
  background: rgba(0, 224, 84, 0.12);
  color: rgba(0, 0, 0, 0.86);
}

.streaming-filter-option:has(input:focus-visible) {
  outline: 2px solid var(--accent-green);
  outline-offset: 2px;
}

.streaming-filter-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  padding: 1px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 3px;
  flex-shrink: 0;
}

.streaming-filter-name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.streaming-filter-service-count {
  color: rgba(0, 0, 0, 0.56);
  font-variant-numeric: tabular-nums;
}

.streaming-filter-empty {
  color: var(--text-muted);
  font-style: italic;
}

/* Discreet, matches the proxy-usage counter it sits beside. */
.tmdb-attribution {
  opacity: 0.85;
}

.results-users {
  display: flex;
  gap: var(--space-xs);
}

.results-user-avatar-wrapper {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid;
  padding: 1px;
  margin-left: -8px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 3px currentColor;
}

.results-user-avatar-wrapper:first-child {
  margin-left: 0;
}

.results-user-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-tertiary);
}

/* Results Sections */
.tier-section {
  margin-bottom: var(--space-2xl);
}

.tier-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.tier-heading {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-sm);
  min-width: 0;
}

.tier-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
}

.tier-header h3 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.tier-count {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Film Grid - Letterboxd style */
.film-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: var(--space-sm);
}

/* Film Card - Letterboxd style */
.film-card {
  cursor: pointer;
  transition: transform 100ms ease, opacity 180ms ease;
  will-change: transform, opacity;
  contain: layout style;
  position: relative;
  pointer-events: auto;
}

.film-card.is-streaming-unavailable {
  opacity: 0.35;
}

.film-card.is-streaming-unavailable:hover,
.film-card.is-streaming-unavailable:focus {
  opacity: 0.62;
}

/* A not-yet-loaded film keeps its grid cell and shows a shimmer placeholder;
   its poster fades in place once loaded (see .film-poster opacity transition),
   so neighbouring posters are never shoved off their row mid-load. */
.film-card.is-poster-pending {
  pointer-events: none;
}

.film-poster-wrapper,
.film-poster,
.film-poster-placeholder {
  cursor: pointer;
  pointer-events: auto;
}

.film-card:hover {
  transform: scale(1.05);
  z-index: 10;
}

.film-poster-wrapper {
  position: relative;
  aspect-ratio: var(--poster-ratio);
  border-radius: 3px;
  overflow: hidden;
  background: linear-gradient(180deg, #f2f4f7 0%, #e6eaef 100%);
  box-shadow: 0 0 0 1px rgba(16, 24, 32, 0.08), 0 1px 3px rgba(16, 24, 32, 0.12);
  transition: box-shadow 100ms ease;
}

.film-card:hover .film-poster-wrapper,
.film-card:focus .film-poster-wrapper {
  box-shadow: 0 0 0 1px rgba(16, 24, 32, 0.16), 0 6px 18px rgba(16, 24, 32, 0.28);
}

.film-card:focus {
  outline: none;
  transform: scale(1.05);
  z-index: 10;
}

.film-card:focus .film-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.film-poster {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  /* Gentle fade so posters ease into their cell rather than snapping in. */
  transition: opacity 450ms ease;
}

.film-poster.is-loaded {
  opacity: 1;
}

/* Blurred low-res poster shown behind the full poster while it loads,
   giving each tile a colour wash taken from its own artwork. */
.film-poster-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(12px) saturate(1.15);
  transform: scale(1.12);
  opacity: 0;
  transition: opacity 200ms ease;
}

.film-poster-thumb.is-loaded {
  opacity: 1;
}

.film-poster-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #f2f4f7 0%, #e6eaef 100%);
  position: relative;
}

.film-poster-placeholder::after {
  content: '';
  width: 40%;
  height: 50%;
  border: 2px solid rgba(16, 24, 32, 0.1);
  border-radius: 2px;
}

.film-poster-placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.65) 50%, transparent 70%);
  animation: poster-shimmer 1.8s ease-in-out infinite;
}

.film-poster-placeholder--unavailable {
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  text-align: center;
  background: #e6eaef;
}

.film-poster-placeholder--unavailable::before,
.film-poster-placeholder--unavailable::after {
  display: none;
}

.film-poster-fallback-title {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.film-poster-fallback-year {
  color: var(--text-muted);
  font-size: 0.75rem;
}

@keyframes poster-shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .film-poster-placeholder::before {
    animation: none;
  }
}

/* Film tooltip - appears on hover */
.film-tooltip {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  background: rgba(10, 12, 16, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 10px;
  display: grid;
  gap: 6px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 80ms ease-out, transform 80ms ease-out;
  pointer-events: none;
  z-index: 5;
  will-change: opacity, transform;
}

.film-card:hover .film-tooltip {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0ms;
}

.film-tooltip-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.film-tooltip-row--ratings {
  align-items: flex-start;
}

.film-tooltip-icon {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.film-tooltip-icon svg {
  width: 12px;
  height: 12px;
}

.film-tooltip-icon--watchlist {
  color: #9fe3ff;
  background: rgba(64, 188, 244, 0.18);
}

.film-tooltip-icon--director {
  color: #ffd26f;
  background: rgba(255, 210, 111, 0.18);
}

.film-tooltip-director {
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.68rem;
  line-height: 1.25;
}

.film-tooltip-badges {
  display: flex;
  align-items: center;
}

.film-tooltip-badge {
  --badge-color: rgba(255, 255, 255, 0.6);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--badge-color);
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-left: -6px;
  box-shadow: none;
}

.film-tooltip-badge:first-child {
  margin-left: 0;
}

.film-tooltip-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.film-tooltip-initial {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-primary);
}

.film-tooltip-ratings {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.film-tooltip-rating-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.film-tooltip-stars {
  color: #ffd26f;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 0.65rem;
}

/* Film overlay - appears on hover */
.film-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-sm);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.film-card:hover .film-overlay {
  opacity: 1;
}

.film-overlay-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.film-overlay-year {
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 2px;
}

/* ===========================================
   Film Detail Modal
   =========================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(245, 247, 250, 0.92);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  overflow-y: auto;
  backdrop-filter: blur(6px);
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: #ffffff;
  color: #101418;
  border-radius: var(--radius-lg);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
}

.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: #f1f3f6;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #1b2228;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  z-index: 10;
  font-size: 0;
  line-height: 0;
  --close-size: 14px;
}

.modal-close:hover {
  background: #e7ebf0;
  color: #101418;
}

.modal-content {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: var(--space-xl);
  padding: var(--space-xl);
}

.modal-poster {
  aspect-ratio: var(--poster-ratio);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #eef1f4;
}

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

.modal-info h2 {
  margin-bottom: var(--space-xs);
}

.modal-meta {
  color: #4b5563;
  font-size: 0.875rem;
  margin-bottom: var(--space-lg);
}

.modal-section {
  margin-bottom: var(--space-lg);
}

.modal-section h4 {
  color: #6b7280;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-sm);
}

.modal-users {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.modal-user {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background: #f2f4f7;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: #1b2228;
}

.modal-user .modal-user-avatar-wrapper {
  flex-shrink: 0;
}

.modal-user-avatar-wrapper {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid;
  padding: 1px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 3px currentColor;
}

.modal-user-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #e5e7eb;
}

.modal-user-rating {
  color: var(--accent);
  font-weight: 600;
}

.modal-user-meta {
  color: #6b7280;
  font-size: 0.7rem;
}

.modal-reasons {
  display: grid;
  gap: var(--space-xs);
}

.modal-reason {
  color: #1b2228;
  background: #f2f4f7;
  border-radius: var(--radius-sm);
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.8rem;
  line-height: 1.4;
}

/* Review Quote Card */
.review-card {
  background: #f5f7fa;
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  border-left: 3px solid var(--accent);
}

.review-card blockquote {
  font-style: italic;
  color: #2f2f2f;
  margin-bottom: var(--space-sm);
  font-size: 0.875rem;
  line-height: 1.6;
}

.review-card cite {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-style: normal;
}

.modal-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* ===========================================
   Loading States
   =========================================== */

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--bg-tertiary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    var(--bg-hover) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

.loading-poster {
  aspect-ratio: var(--poster-ratio);
}

.loading-text {
  height: 16px;
  width: 80%;
}

.loading-text-sm {
  height: 12px;
  width: 50%;
}

/* Full page loading */
.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl);
  gap: var(--space-lg);
}

.loading-overlay .loading-spinner {
  width: 40px;
  height: 40px;
}

.loading-text-status {
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-align: center;
}

/* Dev tools */
.dev-tile-status-panel {
  position: fixed;
  top: 76px;
  right: 12px;
  z-index: 9999;
  width: 320px;
  max-width: calc(100vw - 24px);
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #d6d6d6;
  border-radius: 10px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
  color: #2f2f2f;
  font-size: 0.7rem;
  line-height: 1.4;
  display: none;
}

.dev-tile-status-panel.active {
  display: block;
}

.dev-tile-status-title {
  font-weight: 600;
  margin-bottom: 6px;
  color: #1f1f1f;
}

.dev-tile-status-row {
  padding: 6px 0;
  border-top: 1px solid #ececec;
}

.dev-tile-status-row:first-child {
  border-top: none;
}

.dev-tile-status-name {
  font-weight: 600;
  color: #1f1f1f;
  margin-bottom: 2px;
}

.dev-tile-status-meta {
  color: #5a5a5a;
}

.dev-stage {
  display: inline-block;
  padding: 0 2px;
  background: transparent;
  color: #7a7a7a;
  font-weight: 500;
  font-size: 0.65rem;
}

.dev-stage.active {
  color: #111111;
  font-weight: 700;
  border-bottom: 2px solid #111111;
}

.dev-stage-sep {
  margin: 0 6px;
  color: #b0b0b0;
  font-weight: 500;
}

.dev-stage-empty {
  color: #9a9a9a;
  font-weight: 500;
}

/* ===========================================
   Empty & Error States
   =========================================== */

.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-lg);
  opacity: 0.5;
}

.empty-state h3 {
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.empty-state p {
  font-size: 0.875rem;
  max-width: 400px;
  margin: 0 auto;
}

/* "Show N more" reveal button, below each tier's grid */
.show-more-btn {
  display: block;
  margin: var(--space-lg) auto 0;
  padding: 8px 20px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.show-more-btn:hover {
  border-color: var(--accent);
  background: var(--accent-muted);
}

/* Show-more as a grid tile (SHOW_MORE_AS_TILE experiment) */
.show-more-tile {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  text-align: center;
  color: inherit;
}

/* Inherit the poster card's background, border-radius and shadow from
   .film-poster-wrapper (the tile carries both classes) so the tile reads as a
   native card. Hover/scale also come from the shared .film-card rules. This
   block only adds the centred column layout. */
.show-more-tile-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.show-more-tile:focus-visible {
  outline: 2px solid rgba(16, 24, 32, 0.5);
  outline-offset: 2px;
}

.show-more-tile-plus {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(16, 24, 32, 0.06);
  border: 1px solid rgba(16, 24, 32, 0.08);
  font-size: 24px;
  line-height: 1;
  color: rgba(16, 24, 32, 0.58);
  transition: background 100ms ease, border-color 100ms ease, color 100ms ease;
}

.film-card.show-more-tile:hover .show-more-tile-plus,
.film-card.show-more-tile:focus .show-more-tile-plus {
  background: rgba(16, 24, 32, 0.1);
  border-color: rgba(16, 24, 32, 0.16);
  color: rgba(16, 24, 32, 0.72);
}

.show-more-tile-label {
  font-size: 11px;
  font-weight: 650;
  color: rgba(16, 24, 32, 0.74);
  letter-spacing: 0;
  padding: 0 6px;
}

.show-more-tile-meta {
  font-size: 10px;
  font-weight: 500;
  color: rgba(16, 24, 32, 0.46);
  padding: 0 6px;
}

/* Dice Button */
.dice-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
  flex-shrink: 0;
  position: relative;
  box-shadow: none;
}

.dice-btn:hover {
  border-color: var(--accent);
  color: #d7f9ff;
  background: transparent;
  transform: translateY(-2px) scale(1.05);
}

.dice-btn:active {
  transform: translateY(0) scale(0.98);
}

.dice-btn svg {
  width: 20px;
  height: 20px;
}

.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(8, 10, 14, 0.95);
  color: var(--text-primary);
  font-size: 0.7rem;
  padding: 6px 8px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  pointer-events: none;
  z-index: 20;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.has-tooltip:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.error-message {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid var(--error);
  color: var(--error);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.error-inline {
  color: var(--error);
  font-size: 0.75rem;
  margin-top: var(--space-xs);
}

/* ===========================================
   Responsive
   =========================================== */

/* Tablet */
@media (max-width: 1024px) {
  .film-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-sm);
  }

  .modal-content {
    grid-template-columns: 200px 1fr;
    gap: var(--space-lg);
    padding: var(--space-lg);
  }
}

/* Mobile */
@media (max-width: 640px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.25rem; }

  .hero {
    padding: var(--space-sm) 0 var(--space-lg);
  }

  .hero-logo {
    width: min(80vw, 460px);
  }

  .combine-module {
    padding: var(--space-sm);
  }

  .tier-header {
    flex-wrap: wrap;
  }

  .tier-actions {
    width: 100%;
    justify-content: flex-start;
    overflow: visible;
  }

  .streaming-filter-options {
    width: 100%;
  }

  :root {
    --user-avatar-size: 96px;
    --user-input-width: 100%;
    --user-input-height: 40px;
  }

  .user-inputs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
    justify-items: stretch;
    align-items: start;
  }

  .user-slot {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
  }

  .user-slot-input {
    width: 100%;
    padding-top: 14px;
  }

  .user-input-field {
    width: 100%;
    font-size: 16px;
    padding: 6px 6px;
  }

  .user-input-field:placeholder-shown {
    padding-left: 6px;
    padding-right: 6px;
  }

  .user-input-field::placeholder {
    font-size: 12px;
  }

  .user-input-suggestion {
    width: 100%;
    padding: 6px 6px;
    font-size: 16px;
  }

  .user-tile {
    padding: 14px;
  }

  .add-user-btn {
    position: relative;
    left: auto !important;
    top: auto !important;
    width: 44px;
    height: 44px;
    margin: 4px auto 0;
    grid-column: 1 / -1;
    justify-self: center;
    align-self: start;
    transform: none !important;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .film-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .show-more-tile-meta {
    display: none;
  }

  .film-overlay {
    /* Always show on mobile since no hover */
    opacity: 1;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 60%);
    padding: var(--space-xs);
  }

  .film-overlay-title {
    font-size: 0.625rem;
    -webkit-line-clamp: 1;
  }

  .film-overlay-year {
    display: none;
  }

  .modal-content {
    grid-template-columns: 1fr;
    gap: var(--space-md);
    padding: var(--space-md);
  }

  .modal-poster {
    max-width: 200px;
    margin: 0 auto;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .results-header-right {
    width: 100%;
    justify-content: space-between;
  }

  .results-users {
    display: flex;
  }

  .dice-btn {
    width: 36px;
    height: 36px;
  }

  .dice-btn svg {
    width: 18px;
    height: 18px;
  }

  .user-chips {
    flex-direction: column;
    align-items: stretch;
  }

  .user-chip {
    justify-content: space-between;
  }

  .setting-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }
}

/* ===========================================
   Utilities
   =========================================== */

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

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.mt-md { margin-top: var(--space-md); }
.mb-md { margin-bottom: var(--space-md); }

/* ===========================================
   Toast Notifications
   =========================================== */

.toast-notification {
  position: fixed;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(10, 12, 16, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  z-index: 300;
  opacity: 0;
  transition: opacity var(--transition-normal), transform var(--transition-normal);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  white-space: pre-line;
  text-align: center;
  max-width: 90vw;
}

.toast-notification.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===========================================
   Sort Controls
   =========================================== */

.sort-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
}

.sort-controls .dice-btn {
  margin-left: auto;
}

.sort-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sort-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sort-btn:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.sort-btn.active {
  color: #3d3d3d;
  font-weight: 700;
  background: #d6d6d6;
  border-color: #c2c2c2;
  border-radius: 999px;
}

.sort-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.keyboard-hint {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.7rem;
  opacity: 0.7;
}

/* ===========================================
   Action Buttons (Random)
   =========================================== */

.action-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
  flex-shrink: 0;
  position: relative;
}

.action-btn:hover {
  border-color: var(--accent);
  color: #d7f9ff;
  background: var(--bg-hover);
  transform: translateY(-1px);
}

.action-btn:active {
  transform: translateY(0);
}

.action-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.action-btn svg {
  width: 18px;
  height: 18px;
}

/* ===========================================
   Friend Search Modal
   =========================================== */

.friend-search-modal-content {
  max-width: 420px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}

.friend-search-header {
  padding: var(--space-lg);
  padding-bottom: var(--space-md);
}

.friend-search-header h3 {
  font-size: 1.125rem;
  margin-bottom: var(--space-xs);
}

.friend-search-description {
  color: #6b7280;
  font-size: 0.8rem;
}

.friend-search-input-wrapper {
  padding: 0 var(--space-lg);
  margin-bottom: var(--space-md);
}

.friend-search-input {
  width: 100%;
  background: #f2f4f7;
  border: 1px solid #d6dde4;
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  color: #101418;
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.friend-search-input:focus {
  border-color: var(--accent);
}

.friend-search-input::placeholder {
  color: #9aa3ad;
}

.friend-search-results {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.friend-search-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-lg) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-height: 0;
}

/* Friend Search Filters */
.friend-search-filters {
  display: flex;
  gap: var(--space-sm);
  padding: 0 var(--space-lg);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.friend-filter-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  background: #f2f4f7;
  border: 1px solid #e3e7ec;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.75rem;
  color: #1f2933;
}

.friend-filter-checkbox:hover {
  background: #e7ebf0;
}

.friend-filter-checkbox:has(input:checked) {
  border-color: var(--filter-color);
  background: color-mix(in srgb, var(--filter-color) 12%, #f2f4f7);
}

.friend-filter-checkbox input {
  display: none;
}

.friend-filter-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  overflow: hidden;
  border: 2px solid var(--filter-color);
  flex-shrink: 0;
}

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

.friend-filter-name {
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Recent Users Section */
.friend-search-recent {
  padding: 0;
  margin-bottom: var(--space-sm);
}

.friend-search-section-header {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-bottom: var(--space-xs);
}

.friend-search-recent-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.friend-search-recent-item {
  background: #f7f9fb;
}

.friend-search-recent-remove {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.friend-search-recent-remove:hover {
  background: #e7ebf0;
  color: #101418;
}

/* Friend Search Item */
.friend-search-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: #f2f4f7;
  border: 1px solid #e3e7ec;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.friend-search-item:hover {
  background: #e7ebf0;
  border-color: #cfd6de;
}

.friend-search-item-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.friend-search-item-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.friend-search-item-displayname {
  font-size: 0.875rem;
  color: #101418;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-search-item-username {
  font-size: 0.7rem;
  color: #6b7280;
}

.friend-search-item-initial {
  font-size: 0.7rem;
  font-weight: 600;
  color: #6b7280;
}

.friend-search-item-name {
  flex: 1;
  font-size: 0.875rem;
  color: #101418;
}

.friend-search-item-sources {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.friend-source-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.friend-search-item-source {
  font-size: 0.7rem;
  color: #6b7280;
  background: #eef1f4;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.friend-search-empty {
  padding: var(--space-xl) 0;
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
}

.friend-search-btn {
  grid-row: 3;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 4px 12px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  white-space: nowrap;
  margin-top: -6px;
}

/* Only show friend search button when users have been loaded */
.user-inputs.has-users .user-slot:not(.filled) .friend-search-btn {
  visibility: visible;
}

.user-inputs.has-users .user-slot:not(.filled):hover .friend-search-btn,
.user-inputs.has-users .user-slot:not(.filled):focus-within .friend-search-btn {
  opacity: 1;
}

.friend-search-btn:hover {
  background: rgba(64, 188, 244, 0.15);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

/* Mobile adjustments for new elements */
@media (max-width: 640px) {
  .sort-controls {
    flex-wrap: wrap;
    gap: var(--space-xs);
  }

  .keyboard-hint {
    display: none;
  }

  .action-btn {
    width: 32px;
    height: 32px;
  }

  .action-btn svg {
    width: 16px;
    height: 16px;
  }

  .toast-notification {
    bottom: var(--space-lg);
    left: var(--space-md);
    right: var(--space-md);
    transform: translateY(20px);
  }

  .toast-notification.visible {
    transform: translateY(0);
  }

  .friend-search-modal-content {
    max-width: 100%;
    max-height: 80vh;
  }

  .friend-search-filters {
    padding: 0 var(--space-md);
  }

  .friend-search-scroll {
    padding: 0 var(--space-md) var(--space-lg);
  }

  .friend-filter-checkbox {
    padding: 3px 8px 3px 3px;
    font-size: 0.7rem;
  }

  .friend-filter-avatar {
    width: 18px;
    height: 18px;
  }

  .friend-filter-name {
    max-width: 60px;
  }

  .friend-search-item-avatar {
    width: 28px;
    height: 28px;
  }

  .friend-search-btn {
    font-size: 0.65rem;
    padding: 4px 10px;
  }

  /* Always show on mobile when users loaded */
  .user-inputs.has-users .user-slot:not(.filled) .friend-search-btn {
    opacity: 0.8;
  }
}

.proxy-usage-toolbar {
  text-align: center;
  padding: 16px 8px;
  font-size: 0.65rem;
  font-family: monospace;
  color: rgba(0, 0, 0, 0.35);
}

.export-profiles-btn {
  margin-left: 8px;
  padding: 2px 8px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-full);
  background: transparent;
  color: rgba(0, 0, 0, 0.45);
  font: inherit;
  cursor: pointer;
}

.export-profiles-btn:hover {
  color: rgba(0, 0, 0, 0.7);
  border-color: rgba(0, 0, 0, 0.3);
}

.poster-load-status {
  display: inline;
  margin-left: 8px;
  color: #c62828;
  font-weight: 700;
}

.poster-load-status[hidden] {
  display: none;
}
