* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; padding: 1rem var(--space-xxl); background: var(--color-background); color: var(--color-body-1);}
:root {
  --font-caption2: 0.6875rem;
  --font-caption1: 0.75rem;
  --font-footnote: 0.8125rem;
  --font-subhead: 0.9375rem;
  --font-callout: 1rem;
  --font-body: 1.0625rem;
  --font-headline: 1.0625rem;
  --font-title3: 1.25rem;
  --font-title2: 1.375rem;
  --font-title1: 1.75rem;
  --font-largeTitle: 2.125rem;
  --font-display1: 2.5rem;
  --font-display2: 3.25rem;
  --font-display3: 5rem;

  --space-xs: 0.5rem;
  --space-s: 1rem;
  --space-m: 1.5rem;
  --space-l: 2.5rem;
  --space-xl: 3.75rem;
  --space-xxl: 5rem;
  --space-row: 6.25rem;

  --color-background: #000;
  --color-background-2: #e5e5ea;
  --color-card: #1d1d1f;
  --color-title: #f5f5f7;
  --color-heading: #f5f5f7;
  --color-subheading: #f5f5f7;
  --color-body-1: #f5f5f7;
  --color-body-2: #ccc;
  --color-hdr-ftr: #aeaeb2;
  --color-watch-btn: #0071E3;
  --color-watch-btn-hvr: #0077ED;

  --header-height: 3rem;
  --box-shadow: rgba(0,0,0,0.9);

  /* Loading states */
  --skeleton-base: #2a2a2e;
  --skeleton-highlight: #3a3a3e;
  --skeleton-shimmer: rgba(255, 255, 255, 0.10);
  --skeleton-radius: 1rem;
}

body[data-view="home"] #homeView { display: block; }
body[data-view="home"] #gridView { display: none; }

body[data-view="search"] #homeView { display: none; }
body[data-view="search"] #gridView { display: none; }

body[data-view="grid"] #homeView { display: none; }
body[data-view="grid"] #gridView { display: block; }

#tangerineContainer { display: none; }
body[data-view="search"] #tangerineContainer {
  display: flex;
  flex-direction: column;
  gap: var(--space-l);
}

.header {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  var(--space-s);
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  height: var(--header-height);
  margin: 0 calc(var(--font-largeTitle) + var(--space-xxl));
  transition: transform 0.25s ease-out;
}
body[data-view="search"] .header {
  position: sticky;
  top: 0;
  margin: 0;
  padding: 0 var(--font-largeTitle);
  background: var(--color-background);
}
body[data-view="grid"] .header {
  position: sticky;
  top: 0;
  margin: 0;
  padding: 0 var(--font-largeTitle);
  background: var(--color-background);
  z-index: 10;
}
body[data-view="search"] .search-icon {
  font-size: var(--font-title1);
}
body[data-view="search"] .search-spinner {
  width: 28px;
  height: 28px;
}
body[data-view="search"] .search-spinner .spinner {
  width: 28px;
  height: 28px;
}
body[data-view="search"] .header.header-hidden {
  transform: translateY(-100%);
}
.header h1 {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  flex: 0 0 auto;
  flex-shrink: 0;
  font-family: 'Monoton', sans-serif;
  var(--font-headline);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1;
  color: var(--color-body-1);
  margin: 0;
  cursor: pointer;
}
.search-icon {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  flex-shrink: 0;
  font-size: var(--font-title3);
  line-height: 1;
  font-variation-settings: 'opsz' 20, 'wght' 400, 'FILL' 0, 'GRAD' 0;
  color: var(--color-body-1);
  transition: color 0.2s ease;
  user-select: none;
  cursor: pointer;
}
.search-icon.dimmed {
  color: var(--color-hdr-ftr);
}
.search-icon.searching {
  display: none;
}
.search-spinner {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}
.search-spinner.visible {
  display: flex;
}
.search-panel {
  display: none;
  flex: 1;
  margin: 0;
  padding: 0;
  background: none;
  position: relative;
}
body[data-view="search"] .search-panel {
  display: block;
}
.search-panel input {
  width: 100%;
  display: block;
  padding: 0;
  font-size: var(--font-largeTitle);
  line-height: 1;
  color: var(--color-body-1);
  text-align: center;
  outline: none;
  background: none;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  border: none;
}
.search-panel input:focus {
  color: var(--color-body-1);
  border: none;
  outline: none;
  box-shadow: none;
  background: none;
}
.search-clear {
  display: none !important;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-hdr-ftr);
  font-size: var(--font-title2);
  user-select: none;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s ease;
}
.search-clear:hover {
  color: var(--color-body-1);
}
.search-clear.visible {
  display: flex !important;
}
.hero {
  position: relative;
  overflow: hidden;
  width: calc(100% + 2 * var(--space-xxl));
  margin-left: calc(-1 * var(--space-xxl));
  margin-right: calc(-1 * var(--space-xxl));
  margin-top: -1rem;
  margin-bottom: 0;
  height: 720px;
  background: var(--color-background);
  z-index: 1;
}
.hero-slide {
  display: flex;
  transition: transform 0.5s ease;
  height: 100%;
}
.hero-item {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 1rem;
}
.hero-item .placeholder {
  width: 100%;
  height: 100%;
  background: var(--color-background);
}
.hero-image-wrapper {
  position: absolute;
  top: 80px;
  bottom: 32px;
  right: 7rem;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 1rem;
}
.hero-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.hero-image-wrapper img.yt {
  transform: scale(2.85) scaleY(1.07);
  transform-origin: center;
}
.hero-image-wrapper img.yt-alt {
  object-fit: cover;
  object-position: center;
}
.hero-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.4);
  color: var(--color-body-1);
  border: none;
  padding: 12px 18px;
  cursor: pointer;
  border-radius: 50%;
  font-size: var(--font-title2);
  z-index: 2;
  transition: background 0.2s;
  backdrop-filter: blur(4px);
}
.hero-btn:hover {
  background: rgba(0,0,0,0.7);
}
.hero-btn.prev { left: 1rem; }
.hero-btn.next { right: 1rem; }
.hero-btn.hidden { display: none; }
.hero-text {
  position: absolute;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: var(--color-body-1);
  bottom: var(--space-l);
  left: 5rem;
  padding: var(--space-l);
  gap: 0;
  max-width: 45%;
  pointer-events: none;
}
.hero-text .title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: var(--font-display3);
  font-weight: 600;
  margin: 0 0 4px;
}
.hero-text .subheading {
  font-size: var(--font-largeTitle);
  color: var(--color-body-2);
  margin: 2px 0;
}
.hero-text .hero-plot {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: var(--font-callout);
}
.hero-text .hero-meta {
  font-size: var(--font-callout);
  color: var(--color-body-2);
  margin: 2px 0;
}
.hero-arrow, .line-header-arrow {
  cursor: pointer;
  color: var(--color-body-1);
  user-select: none;
  pointer-events: auto;
  transition: color 0.2s ease;
  padding: 0 4px;
  line-height: 1;
}
.hero-arrow { font-size: var(--font-largeTitle); }
.line-header-arrow { font-size: var(--font-title2); }
.hero-arrow:hover, .line-header-arrow:hover {
  color: var(--color-hdr-ftr);
}
.hero-watch-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-family: inherit;
  font-size: var(--font-callout);
  font-weight: 500;
  color: var(--color-body-1) !important;
  text-decoration: none;
  line-height: 1;
  padding: var(--font-caption1) var(--font-title2);
  cursor: pointer;
  border: none;
  border-radius: calc(var(--font-callout) * 2);
  pointer-events: auto;
  background: var(--color-watch-btn);
  transition: background 0.2s;
}
.hero-watch-btn:hover {
  background: var(--color-watch-btn-hvr);
}
.hero-actions {
  display: flex;
  gap: var(--space-xs);
  margin-top: var(--space-s);
  align-items: center;
}
.hero-watch-btn.round {
  width: calc(var(--font-callout) * 2.5);
  height: calc(var(--font-callout) * 2.5);
  padding: 0;
  border-radius: 50%;
  font-size: var(--font-title2);
  background: rgba(255, 255, 255, 0.1);
}
.hero-watch-btn.round:hover {
  background: rgba(255, 255, 255, 0.15);
}
.line {
  margin: 0;
}
.line-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-s);
}
.line-header h2 {
  display: flex;
  align-items: center;
  font-size: var(--font-callout);
  font-weight: 600;
  color: var(--color-body-1);
  margin: 0;
}
.line-carousel-wrapper {
  position: relative;
  overflow: hidden;
  padding: var(--space-s) 0;
  margin: calc(-1 * var(--space-s)) 0;
}
.line-track {
  display: flex;
  transition: transform 0.3s ease;
  gap: var(--space-l);
}
.line-item {
  display: flex;
  flex-direction: column;
  flex: 0 0 calc((100% - 5 * var(--space-l)) / 6);
  background: var(--color-background);
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  text-align: left;
  cursor: pointer;
}
.line-item .line-image-wrapper {
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  box-shadow: none;
  border-radius: 1rem;
}
.line-item .line-image-wrapper.portrait {
  aspect-ratio: 2 / 3;
  box-shadow: none;
}
.line-item .line-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.line-item .line-image-wrapper.portrait:not(.omdb-image) img {
  transform: scale(2.85) scaleY(1.07);
  transform-origin: center;
}
.line-item .title {
  padding: var(--space-s) 0 0 0;
  font-size: var(--font-callout);
  font-weight: 500;
  color: var(--color-body-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.line-placeholder {
  flex: 0 0 calc((100% - 5 * var(--space-l)) / 6);
  background: var(--color-background);
  border-radius: 10px;
  aspect-ratio: 16 / 9;
}
.line-placeholder.portrait {
  aspect-ratio: 2 / 3;
}
.line-item .line-image-wrapper.square {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1d1d1f 0%, #2a2a2e 100%);
  border-radius: 1rem;
  box-shadow: none;
}
.line-item .line-image-wrapper.square .tile-icon {
  font-size: var(--font-display3);
  color: var(--color-body-1);
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 48;
}
.line-item.square-tile {
  position: relative;
  z-index: 1;
}

.line-placeholder.square {
  aspect-ratio: 1 / 1;
}
.line-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.4);
  color: var(--color-body-1);
  border: none;
  padding: 12px 18px;
  cursor: pointer;
  border-radius: 50%;
  font-size: var(--font-title2);
  z-index: 2;
  transition: background 0.2s;
  backdrop-filter: blur(4px);
}
.line-arrow:hover {
  background: rgba(0,0,0,0.7);
}
.line-arrow.prev { left: 10px; }
.line-arrow.next { right: 10px; }
.line-arrow.hidden { display: none; }
.line-secondary .line-track { gap: var(--space-l); }
.line-secondary .line-item { flex: 0 0 calc((100% - 5 * var(--space-l)) / 6); }
.line-secondary .line-placeholder { flex: 0 0 calc((100% - 5 * var(--space-l)) / 6); }
.line-tertiary .line-track { gap: var(--space-l); }
.line-tertiary .line-item { flex: 0 0 calc((100% - 5 * var(--space-l)) / 6); }
.line-tertiary .line-placeholder { flex: 0 0 calc((100% - 5 * var(--space-l)) / 6); }
.tangerine-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-l);
}
.tangerine-row .line {
  padding-top: 0;
  margin: 0;
  min-width: 0;
}
.tangerine-row .line-item {
  flex: 0 0 100%;
}
.tangerine-row .line-placeholder {
  flex: 0 0 100%;
  aspect-ratio: 1 / 1;
}
.tangerine-row .line-item .line-image-wrapper,
.tangerine-row .line-item .line-image-wrapper.portrait {
  aspect-ratio: 1 / 1;
  background: yellow;
  border-radius: 1rem;
}
.tangerine-row .line-item .line-image-wrapper.omdb-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: none;
}
.tangerine-row .line-item .line-image-wrapper.yt img {
  transform: scale(2.85) scaleY(1.07);
  transform-origin: center;
}
.tangerine-row .line-item .line-image-wrapper.yt-alt img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: none;
}
.tangerine-row .line-track {
  gap: 0;
}
.tangerine-row .line-item .line-image-wrapper,
.tangerine-row .line-item .line-image-wrapper.portrait {
  aspect-ratio: 1 / 1;
  box-shadow: none;
}
.tangerine-placeholder {
  min-width: 0;
}
.grid {
  margin: 0 auto;
}
.grid-title {
  font-size: var(--font-callout);
  font-weight: 600;
  margin-bottom: var(--space-m);
  color: var(--color-body-1);
}
body[data-view="search"] #moviesTitle {
  font-size: var(--font-callout);
  color: var(--color-hdr-ftr);
  font-weight: 500;
}
body[data-view="grid"] #searchView,
body[data-view="search"] #searchView {
  padding-top: var(--space-l);
}
.chain-block-header {
  grid-column: 1 / -1;
  font-size: var(--font-title2);
  font-weight: 600;
  color: var(--color-body-1);
  margin: var(--space-xl) 0 var(--space-s) 0;
}
.grid-container {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-l);
}
.grid-item {
  background: transparent;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: none;
  cursor: pointer;
  position: relative;
}

.grid-item .grid-image-wrapper {
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 1rem;
}
.grid-item .grid-image-wrapper.portrait {
  aspect-ratio: 2 / 3;
}
.grid-item .grid-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.grid-item .grid-image-wrapper.portrait.yt img {
  transform: scale(2.85) scaleY(1.07);
  transform-origin: center;
}
.grid-item .grid-image-wrapper.portrait.yt-alt img {
  object-fit: cover;
  object-position: center;
}
.grid-item .title {
  padding: var(--space-s) 0 0 0;
  font-size: var(--font-callout);
  font-weight: 500;
  color: var(--color-body-1);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#gridSentinel { height: 1px; }
@media (max-width: 900px) {
.grid-container { grid-template-columns: repeat(4, 1fr); }
}

.report-dialog {
  display: none;
  position: fixed;
  z-index: 3000;
  width: 320px;
  padding: var(--space-s);
  background: rgba(29, 29, 31, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  flex-direction: column;
  gap: var(--space-s);
}
.report-dialog.visible { display: flex; }
.report-dialog-arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  background: rgba(29, 29, 31, 0.85);
  transform: rotate(45deg);
}
.report-dialog.arrow-bottom .report-dialog-arrow {
  bottom: -6px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.report-dialog.arrow-top .report-dialog-arrow {
  top: -6px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.report-dialog-title {
  font-size: var(--font-callout);
  font-weight: 600;
  color: var(--color-body-1);
}
.report-dialog textarea {
  width: 100%;
  min-height: 80px;
  padding: var(--space-xs) var(--space-s);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--color-body-1);
  font-family: inherit;
  font-size: var(--font-caption1);
  resize: none;
}
.report-dialog textarea:focus {
  outline: none;
  border-color: var(--color-watch-btn);
}
.report-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-xs);
}
.report-dialog-btn {
  padding: var(--space-xs) var(--space-s);
  border: none;
  border-radius: 8px;
  font-size: var(--font-caption1);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}
.report-dialog-btn.cancel {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-body-1);
}
.report-dialog-btn.cancel:hover { background: rgba(255, 255, 255, 0.15); }
.report-dialog-btn.send {
  background: var(--color-watch-btn);
  color: var(--color-body-1);
}
.tangerine-row .line-header {
  position: relative;
}

.report-dialog-btn.send:hover { background: var(--color-watch-btn-hvr); }
.tangerine-delete-btn {
  position: absolute;
  top: 0;
  right: 0;
  cursor: pointer;
  color: var(--color-hdr-ftr);
  font-size: var(--font-callout);
  user-select: none;
  transition: color 0.2s ease;
  padding: 0 4px;
  line-height: 1;
}
.tangerine-delete-btn:hover { color: var(--color-body-1); }
.grid-item-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  cursor: pointer;
  z-index: 5;
  transition: background 0.2s ease;
}
.grid-item-delete-btn:hover { background: rgba(0, 0, 0, 0.85); }
.grid-item-delete-btn .material-symbols-outlined {
  font-size: var(--font-callout);
  color: var(--color-body-1);
}

@media (max-width: 600px) {
  body {
    padding: 1rem var(--space-m) calc(1rem + env(safe-area-inset-bottom)) var(--space-m);
  }
  .header {
    margin: 0 1rem;
  }
  body[data-view="search"] .header {
    padding: 0 1rem;
  }
  .hero {
    width: calc(100% + 2 * var(--space-m));
    margin-left: calc(-1 * var(--space-m));
    margin-right: calc(-1 * var(--space-m));
    margin-top: 3rem;
    height: auto;
    display: flex;
    flex-direction: column;
    background: var(--color-background);
    padding-top: 1rem;
  }
  .hero-slide {
    height: auto;
  }
  .hero-item {
    height: auto;
    display: flex;
    flex-direction: column;
  }
  .hero-image-wrapper {
    position: relative;
    top: auto;
    bottom: auto;
    right: auto;
    height: 45vh;
    width: auto;
    max-width: 80%;
    aspect-ratio: 2 / 3;
    border-radius: 1rem;
    order: 1;
    margin: 0 auto;
  }
  .hero-image-wrapper img {
    object-fit: contain;
    object-position: center;
  }
  .hero-image-wrapper img.yt {
    transform: scale(2.85) scaleY(1.07);
    transform-origin: center;
  }
  .hero-image-wrapper img.yt-alt {
    object-fit: cover;
    object-position: center;
  }
  .hero-text {
    position: relative;
    bottom: auto;
    left: auto;
    padding: var(--space-s);
    max-width: 100%;
    pointer-events: auto;
    order: 2;
    background: var(--color-background);
    align-self: stretch;
  }
  .hero-text .title {
    font-size: var(--font-display2);
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .hero-text .subheading {
    font-size: var(--font-title2);
  }
  .hero-text .hero-meta {
    font-size: var(--font-callout);
  }
  .hero-text .hero-plot {
    display: none;
  }
  .hero-actions {
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    margin-top: 0.75rem;
  }
  .hero-btn {
    padding: 8px 14px;
    font-size: var(--font-callout);
  }
  .line-secondary .line-track {
    gap: var(--space-m);
  }
  .line-secondary .line-item {
    flex: 0 0 calc(66.666% - 16px);
  }
  .line-secondary .line-placeholder {
    flex: 0 0 calc(66.666% - 16px);
  }
  .line-tertiary .line-track {
    gap: var(--space-m);
  }
  .line-tertiary .line-item {
    flex: 0 0 calc(66.666% - 16px);
  }
  .line-tertiary .line-placeholder {
    flex: 0 0 calc(66.666% - 16px);
  }
  .line-item .title {
    font-size: var(--font-callout);
  }
  .line-header h2 {
    font-size: var(--font-title2);
  }
  .tangerine-row {
    grid-template-columns: 1fr;
    gap: var(--space-m);
  }
  .grid-container {
    gap: var(--space-m);
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-item .title {
    font-size: var(--font-callout);
  }
}

.line-item, .grid-item {
  -webkit-touch-callout: none;
  user-select: none;
  touch-action: manipulation;
}

/* ============================================================
   Loading states (skeletons, spinner, fade-in)
   ============================================================ */

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

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

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.skeleton,
.skeleton-tile,
.skeleton-hero {
  position: relative;
  overflow: hidden;
  background: var(--skeleton-base);
}

.skeleton::after,
.skeleton-tile::after,
.skeleton-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--skeleton-shimmer) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  pointer-events: none;
}

.skeleton-hero {
  width: calc(100% + 2 * var(--space-xxl));
  margin: -1rem calc(-1 * var(--space-xxl)) 0;
  height: 720px;
}

.skeleton-hero-image {
  position: absolute;
  top: 80px;
  bottom: 32px;
  right: 7rem;
  aspect-ratio: 2 / 3;
  background: var(--skeleton-highlight);
  border-radius: 1rem;
}

.skeleton-hero-text {
  position: absolute;
  bottom: 32px;
  left: 5rem;
  max-width: 45%;
  padding: var(--space-l);
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
}

.skeleton-bar {
  background: var(--skeleton-highlight);
  border-radius: 6px;
  height: 16px;
}
.skeleton-bar-lg { height: 56px; width: 80%; }
.skeleton-bar-md { height: 24px; width: 50%; }
.skeleton-bar-sm { height: 16px; width: 95%; }

.skeleton-line {
  margin: 0;
  padding-top: var(--space-row);
}

.skeleton-line-header {
  height: 24px;
  width: 180px;
  background: var(--skeleton-highlight);
  border-radius: 6px;
  margin-bottom: 15px;
}

.skeleton-line-track {
  display: flex;
  gap: var(--space-l);
}

.skeleton-tile {
  border-radius: var(--skeleton-radius);
}
.skeleton-tile.portrait  { aspect-ratio: 2 / 3; }
.skeleton-tile.landscape { aspect-ratio: 16 / 9; }
.skeleton-tile.square    { aspect-ratio: 1 / 1; }

.skeleton-line-track .skeleton-tile {
  flex: 0 0 calc((100% - 5 * var(--space-l)) / 6);
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-l);
  padding-top: var(--font-title2);
}
.skeleton-grid .skeleton-tile {
  aspect-ratio: 2 / 3;
  width: 100%;
}

.skeleton-tangerine-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-l);
  padding-top: var(--space-row);
  margin-bottom: var(--space-m);
}
.skeleton-tangerine-row .skeleton-tile {
  aspect-ratio: 1 / 1;
}

body[data-view="search"] .skeleton-grid,
body[data-view="search"] .skeleton-tangerine-row {
  padding-top: var(--font-callout);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-hdr-ftr);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 0;
}

.fade-in {
  animation: fade-in 200ms ease-out;
}

@media (max-width: 900px) {
  .skeleton-line-track .skeleton-tile { flex: 0 0 calc((100% - 3 * var(--space-l)) / 4); }
  .skeleton-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 600px) {
  .skeleton-line-track { gap: var(--space-m); }
  .skeleton-line-track .skeleton-tile { flex: 0 0 calc(66.666% - 16px); }
  .skeleton-grid { grid-template-columns: repeat(2, 1fr); }
  .skeleton-tangerine-row { grid-template-columns: 1fr; }
  .skeleton-hero {
    height: 60vh;
    margin: 0 calc(-1 * var(--space-m));
    width: calc(100% + 2 * var(--space-m));
  }
  .skeleton-hero-image {
    position: relative;
    top: auto;
    bottom: auto;
    right: auto;
    height: 45vh;
    width: auto;
    max-width: 80%;
    aspect-ratio: 2 / 3;
    order: 1;
    margin: 1rem auto 0;
  }
  .skeleton-hero-text {
    position: relative;
    bottom: auto;
    left: auto;
    padding: var(--space-s);
    max-width: 100%;
    order: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton::after,
  .skeleton-tile::after,
  .skeleton-hero::after {
    animation: none;
    background: none;
  }
  .spinner {
    animation: none;
    border-color: var(--color-hdr-ftr);
    border-top-color: var(--color-hdr-ftr);
    opacity: 0.5;
  }
  .fade-in {
    animation: none;
  }
}

.hero-image-wrapper,
.line-item .line-image-wrapper:not(.square),
.grid-item .grid-image-wrapper {
  background: var(--skeleton-base);
}

.line-item .line-image-wrapper,
.grid-item .grid-image-wrapper {
  position: relative;
}

.hero-image-wrapper:not(.img-loaded)::after,
.line-item .line-image-wrapper:not(.square):not(.img-loaded)::after,
.grid-item .grid-image-wrapper:not(.img-loaded)::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--skeleton-shimmer) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

.hero-image-wrapper img,
.line-item .line-image-wrapper:not(.square) img,
.grid-item .grid-image-wrapper img {
  opacity: 0;
  transition: opacity 300ms ease-out;
}
.hero-image-wrapper img.loaded,
.line-item .line-image-wrapper:not(.square) img.loaded,
.grid-item .grid-image-wrapper img.loaded {
  opacity: 1;
}

.skeleton-hero-fill {
  position: absolute;
  inset: 0;
}

/* ============================================================
   Error states (inline, replaces skeleton/spinner)
   ============================================================ */

.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--font-callout);
  padding: var(--font-display3) var(--font-title2);
  text-align: center;
}

.error-state-icon {
  font-size: var(--font-display2);
  color: var(--color-hdr-ftr);
  line-height: 1;
  user-select: none;
}

.error-state-title {
  font-size: var(--font-title2);
  font-weight: 600;
  color: var(--color-body-1);
  margin: 0;
}

.error-state-message {
  font-size: var(--font-callout);
  color: var(--color-body-2);
  max-width: 32ch;
  margin: 0;
}

.error-state-retry {
  margin-top: var(--font-caption1);
  padding: var(--font-caption1) var(--font-title2);
  background: var(--color-watch-btn);
  color: var(--color-body-1);
  border: none;
  border-radius: var(--font-title2);
  font-family: inherit;
  font-size: var(--font-callout);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.error-state-retry:hover {
  background: var(--color-watch-btn-hvr);
}

.error-state-retry:active {
  transform: scale(0.97);
}

/* ============================================================
   Empty states (search page, no recent terms)
   ============================================================ */

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--font-display3) var(--font-title2);
  text-align: center;
}

.empty-state-icon {
  font-size: var(--font-display2);
  color: var(--color-hdr-ftr);
  line-height: 1;
  user-select: none;
}

.empty-state-message {
  font-size: var(--font-callout);
  color: var(--color-hdr-ftr);
  margin: 0;
}

/* ============================================================
   Detail Modal (desktop + mobile)
   ============================================================ */

.detail-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2500;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: var(--space-l) var(--space-m);
  overflow-y: auto;
}
.detail-modal-overlay.visible {
  display: flex;
}

.detail-modal-handle {
  display: none;
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  margin: var(--space-xs) auto 0;
  flex-shrink: 0;
  touch-action: none;
  cursor: grab;
  position: relative;
  z-index: 11;
}
.detail-modal-close {
  position: absolute;
  top: var(--space-s);
  right: var(--space-s);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
  border-radius: 50%;
  color: var(--color-body-1);
  cursor: pointer;
  z-index: 10;
  padding: 0;
}
.detail-modal-close:hover {
  background: rgba(0, 0, 0, 0.7);
}
.detail-modal-close .material-symbols-outlined {
  font-size: var(--font-title2);
}
.detail-modal {
  display: flex;
  flex-direction: column;
  width: 65vw;
  max-width: 900px;
  min-width: 280px;
  max-height: calc(100vh - 96px);
  background: var(--color-card);
  border-radius: 20px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  position: relative;
}
.detail-modal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
}

.detail-modal-image-wrapper {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 20px;
  background: var(--color-background-2);
  animation: modal-image-fade 20s ease-in-out infinite alternate;
}
.detail-modal-image-wrapper::before,
.detail-modal-image-wrapper::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 33%;
  pointer-events: none;
  z-index: 2;
}
.detail-modal-image-wrapper::before {
  top: 0;
  background: linear-gradient(to bottom, var(--color-card) 0%, var(--color-card) 50%, transparent 100%);
  animation: modal-edge-top 20s ease-in-out infinite alternate;
}
.detail-modal-image-wrapper::after {
  bottom: 0;
  background: linear-gradient(to top, var(--color-card) 0%, var(--color-card) 50%, transparent 100%);
  animation: modal-edge-bottom 20s ease-in-out infinite alternate;
}

@keyframes modal-edge-top {
  0%   { opacity: 1; }
  15%  { opacity: 1; }
  40%  { opacity: 0; }
  100% { opacity: 0; }
}
@keyframes modal-edge-bottom {
  0%   { opacity: 0; }
  60%  { opacity: 0; }
  85%  { opacity: 1; }
  100% { opacity: 1; }
}

.detail-modal-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  animation: modal-poster-pan 20s ease-in-out infinite alternate;
}
.detail-modal-image-wrapper img.yt {
  transform: scale(2.9);
  animation: modal-yt-pan 20s ease-in-out infinite alternate;
}

@keyframes modal-yt-pan {
  0% {
    transform-origin: center top;
  }
  100% {
    transform-origin: center bottom;
  }
}
.detail-modal-image-wrapper img.yt-alt {
  object-fit: cover;
  object-position: center;
}

@keyframes modal-poster-pan {
  0% {
    object-position: center top;
  }
  100% {
    object-position: center bottom;
  }
}

.detail-modal-content {
  flex: 0 0 auto;
  padding: var(--space-s);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.detail-modal-title {
  font-size: var(--font-title1);
  font-weight: 600;
  line-height: 1.1;
  color: var(--color-body-1);
  flex-shrink: 0;
}
.detail-modal-meta {
  font-size: var(--font-caption1);
  color: var(--color-hdr-ftr);
  flex-shrink: 0;
}
.detail-modal-plot {
  font-size: var(--font-callout);
  color: var(--color-body-1);
  line-height: 1.4;
}
.detail-modal-credits {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}
.detail-modal-credit-line {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.3;
}
.detail-modal-credit-label {
  color: var(--color-hdr-ftr);
  font-weight: 600;
  font-size: var(--font-caption1);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.detail-modal-credit-value {
  color: var(--color-body-1);
  font-size: var(--font-callout);
}

.detail-modal-actions {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
  padding: var(--space-s);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.detail-watch-btn {
  flex: 1;
  padding: var(--space-s);
  background: var(--color-watch-btn);
  color: var(--color-body-1);
  border: none;
  border-radius: 999px;
  font-size: var(--font-callout);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.detail-watch-btn:hover { background: var(--color-watch-btn-hvr); }
.detail-action-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--color-body-1);
  padding: 0;
}
.detail-action-btn:hover { background: rgba(255, 255, 255, 0.15); }
.detail-action-btn .material-symbols-outlined {
  font-size: var(--font-title2);
}

@media (max-width: 600px) {
  .detail-modal-overlay {
    padding: 0;
    align-items: flex-end;
    background: rgba(0, 0, 0, 0.6);
  }
  .detail-modal {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    aspect-ratio: auto;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
  }
    .detail-modal-handle {
    display: block;
  }
  .detail-modal-image-wrapper {
    flex: 0 0 auto;
    aspect-ratio: 16 / 9;
  }
  .detail-modal-image-wrapper img.yt {
    transform: scale(2.3);
  }
  .detail-modal-content {
    padding: var(--space-s);
  }
  .detail-modal-actions {
    padding: var(--space-s);
  }
}

/* ============================================================
   Hover elevation (desktop, pointer devices only)
   ============================================================ */

@media (hover: hover) {
  .line-item {
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  .line-item:hover {
    transform: scale(1.04);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
    z-index: 2;
  }
  .grid-item {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  .grid-item:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
    z-index: 2;
  }
  .line-item.square-tile:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
  }
}

#linesContainer {
  display: flex;
  flex-direction: column;
  gap: var(--space-row);
  padding-top: var(--space-row);
}