:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
  line-height: 1.5715;
  text-rendering: optimizeLegibility;

  /* Brand colors */
  --accent: #157a5b;
  --accent-hover: #11644b;
  --accent-soft: #e7f3ef;

  /* Canvas and surfaces */
  --canvas: #f7f8fa;
  --surface: #ffffff;
  --surface-muted: #f2f4f7;

  /* Borders */
  --border: #e4e7ec;
  --border-strong: #c8ced8;

  /* Text colors */
  --text: #17202a;
  --text-muted: #667085;
  --text-strong: #17202a;
  --text-subtle: #98a2b3;

  /* Feedback colors */
  --error: #b42318;
  --error-soft: #fef3f2;
  --warning: #b54708;
  --warning-soft: #fff7e8;
  --focus: #2e90fa;

  /* Layout */
  --header-height: 4rem;
  --page-gutter: 2rem;
  --page-max: 80rem;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  /* Shadows */
  --shadow-overlay: 0 16px 40px rgb(23 32 42 / 18%);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 1.5rem;
  --space-7: 2rem;
  --space-8: 3rem;
  --space-10: 4rem;
}

@media (max-width: 1199px) {
  :root {
    --page-gutter: 1.5rem;
  }
}

@media (max-width: 767px) {
  :root {
    --header-height: 3.5rem;
    --page-gutter: 1rem;
  }
}

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

body {
  background: var(--canvas);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
}

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

ul, ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5, h6, p {
  margin: 0;
}

img {
  max-width: 100%;
  height: auto;
}

button {
  font-family: inherit;
  font-size: inherit;
}

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

/* Mobile Menu Button */
.mobile-menu-btn {
  align-items: center;
  background: transparent;
  border: none;
  cursor: pointer;
  display: none;
  height: 2.5rem;
  justify-content: center;
  margin-left: auto;
  padding: 0;
  width: 2.5rem;
}

.menu-icon {
  background: var(--text);
  display: block;
  height: 2px;
  position: relative;
  transition: background 150ms ease;
  width: 1.25rem;
}

.menu-icon::before,
.menu-icon::after {
  background: var(--text);
  content: '';
  display: block;
  height: 2px;
  left: 0;
  position: absolute;
  transition: transform 200ms ease;
  width: 100%;
}

.menu-icon::before {
  top: -6px;
}

.menu-icon::after {
  top: 6px;
}

.mobile-menu-btn.active .menu-icon {
  background: transparent;
}

.mobile-menu-btn.active .menu-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.mobile-menu-btn.active .menu-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Mobile Navigation */
.mobile-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  left: 0;
  padding: var(--space-4) var(--page-gutter);
  position: fixed;
  right: 0;
  top: var(--header-height);
  z-index: 25;
}

.mobile-nav__menu {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}

.mobile-nav__menu a {
  border-radius: var(--radius-sm);
  color: var(--text);
  display: block;
  font-weight: 500;
  padding: var(--space-3);
  text-decoration: none;
}

.mobile-nav__menu a:hover {
  background: var(--surface-muted);
}

.mobile-nav__search {
  display: flex;
  gap: var(--space-2);
}

.mobile-nav__search .search-input {
  flex: 1;
}

body.menu-open {
  overflow: hidden;
}

/* Container */
.container {
  margin: 0 auto;
  max-width: var(--page-max);
  padding-inline: var(--page-gutter);
  width: 100%;
}

/* ============================================
   Site Header
   ============================================ */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 30;
}

.header-inner {
  align-items: center;
  display: flex;
  gap: var(--space-5);
  height: 100%;
}

.site-logo {
  color: var(--text-strong);
  font-size: 1.25rem;
  font-weight: 750;
  text-decoration: none;
}

.site-logo:hover {
  color: var(--accent);
}

.site-nav {
  align-items: stretch;
  display: flex;
  height: 100%;
}

.site-nav a {
  align-items: center;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  display: inline-flex;
  font-weight: 550;
  padding: 0 var(--space-3);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text-strong);
}

.site-nav a.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

/* Header Search */
.header-search {
  align-items: center;
  display: flex;
  margin-left: auto;
}

.search-input-small {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  min-height: 2.25rem;
  outline: none;
  padding: 0 var(--space-3);
  width: 12rem;
}

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

.search-button {
  background: var(--surface-muted);
  border: 1px solid var(--border-strong);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;
  min-height: 2.25rem;
  min-width: 2.25rem;
}

.search-button:hover {
  background: var(--border);
}

/* ============================================
   Page Layout with Sidebar
   ============================================ */
.page-layout {
  display: grid;
  gap: var(--space-7);
  grid-template-columns: 13rem minmax(0, 1fr);
  min-width: 0;
}

/* Sidebar */
.sidebar {
  min-width: 0;
}

.sidebar__nav {
  display: grid;
  gap: var(--space-6);
  position: sticky;
  top: calc(var(--header-height) + var(--space-5));
}

.sidebar__section {
  min-width: 0;
}

.sidebar__title {
  color: var(--text-strong);
  display: block;
  font-size: 0.9375rem;
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.sidebar__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.sidebar__tag {
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1;
  padding: var(--space-2) var(--space-3);
  text-decoration: none;
  transition: background-color 150ms ease, color 150ms ease;
}

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

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

/* ============================================
   Main Content
   ============================================ */
main.container {
  min-height: calc(100vh - var(--header-height) - 100px);
  padding-top: calc(var(--header-height) + var(--space-7));
  padding-bottom: var(--space-10);
}

/* ============================================
   Breadcrumb
   ============================================ */
.breadcrumb {
  align-items: center;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.875rem;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

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

.breadcrumb__sep {
  color: var(--text-subtle);
}

.breadcrumb__current {
  color: var(--text-strong);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================
   Page Header
   ============================================ */
.page-header {
  align-items: baseline;
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.page-header h1 {
  color: var(--text-strong);
  font-size: 1.5rem;
  font-weight: 700;
}

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

/* ============================================
   List Controls / Sort Tabs
   ============================================ */
.list-controls {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: var(--space-4);
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
}

.sort-tabs {
  display: flex;
  gap: var(--space-1);
}

.sort-tab {
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  padding: var(--space-2) var(--space-3);
  text-decoration: none;
}

.sort-tab:hover {
  background: var(--surface-muted);
  color: var(--text-strong);
}

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

/* ============================================
   Movie List
   ============================================ */
.movie-list {
  display: grid;
  gap: 0 2rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.movie-card {
  border-top: 1px solid var(--border);
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 7rem minmax(0, 1fr);
  padding: var(--space-5) var(--space-2);
  transition: background-color 140ms ease;
}

.movie-card:hover {
  background: #f8fafc;
}

.movie-card__poster {
  aspect-ratio: 2 / 3;
  background: linear-gradient(110deg, var(--surface-muted) 8%, #f5f7fa 18%, var(--surface-muted) 33%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s linear infinite;
  border-radius: var(--radius-sm);
  display: block;
  overflow: hidden;
  position: relative;
  width: 7rem;
}

.movie-card__poster img {
  height: 100%;
  object-fit: cover;
  width: 100%;
  opacity: 0;
  transition: opacity 300ms ease;
}

.movie-card__poster img.loaded {
  opacity: 1;
}

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

.poster-fallback {
  align-items: center;
  color: var(--text-subtle);
  display: flex;
  font-size: 0.75rem;
  height: 100%;
  justify-content: center;
  width: 100%;
}

.movie-card__content {
  min-width: 0;
}

.movie-card__title {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.625rem;
  margin: 0;
}

.movie-card__title a {
  color: var(--text-strong);
  text-decoration: none;
}

.movie-card__title a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.movie-card__original {
  color: var(--text-subtle);
  font-size: 0.8125rem;
  margin-top: var(--space-1);
}

.movie-card__facts {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: var(--space-2);
}

.movie-card__cast {
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin-top: var(--space-2);
}

.movie-card__genres {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-3);
}

.genre-tag {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 0.75rem;
  line-height: 1.5rem;
  padding: 0 var(--space-2);
}

.movie-card__rating {
  align-items: center;
  color: var(--warning);
  display: flex;
  font-weight: 700;
  gap: var(--space-1);
  margin-top: var(--space-3);
}

.movie-card__rating .star {
  font-size: 0.875rem;
}

.movie-card__rating--empty {
  color: var(--text-subtle);
  font-weight: 500;
}

/* ============================================
   Movie Detail Page
   ============================================ */
.movie-detail {
  max-width: 900px;
}

.movie-overview {
  display: grid;
  gap: var(--space-7);
  grid-template-columns: 200px minmax(0, 1fr);
  margin-bottom: var(--space-7);
}

.movie-poster {
  aspect-ratio: 2 / 3;
  background: linear-gradient(110deg, var(--surface-muted) 8%, #f5f7fa 18%, var(--surface-muted) 33%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s linear infinite;
  border-radius: var(--radius-md);
  overflow: hidden;
  width: 200px;
}

.movie-poster img {
  height: 100%;
  object-fit: cover;
  width: 100%;
  opacity: 0;
  transition: opacity 300ms ease;
}

.movie-poster img.loaded {
  opacity: 1;
}

.movie-poster__fallback {
  align-items: center;
  color: var(--text-subtle);
  display: flex;
  flex-direction: column;
  font-size: 0.875rem;
  gap: var(--space-2);
  height: 100%;
  justify-content: center;
}

.movie-info {
  min-width: 0;
}

.movie-title {
  color: var(--text-strong);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: var(--space-2);
}

.movie-original-title {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: var(--space-4);
}

.movie-facts {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(2, 1fr);
  margin: 0;
}

.movie-facts > div {
  display: flex;
  gap: var(--space-2);
}

.movie-facts dt {
  color: var(--text-muted);
  flex: 0 0 3.5rem;
  font-weight: 500;
}

.movie-facts dd {
  color: var(--text-strong);
  margin: 0;
}

.movie-facts__rating {
  align-items: center;
  color: var(--warning);
  display: flex;
  font-weight: 700;
  gap: var(--space-1);
}

.movie-facts__rating .star {
  color: var(--warning);
}

.fact-wide {
  grid-column: 1 / -1;
}

/* Movie Sections */
.movie-section {
  border-top: 1px solid var(--border);
  margin-top: var(--space-5);
  padding-top: var(--space-5);
}

.movie-section h2 {
  color: var(--text-strong);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-4);
}

.movie-section h2 .count {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 400;
  margin-left: var(--space-2);
}

.movie-synopsis {
  color: var(--text);
  line-height: 1.75;
}

/* Gallery */
.movie-gallery {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.gallery-item {
  aspect-ratio: 16 / 9;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

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

/* Resources */
.resource-tabs {
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}

.resource-tab {
  align-items: center;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.875rem;
  font-weight: 500;
  gap: var(--space-2);
  margin-bottom: -1px;
  padding: var(--space-3) var(--space-4);
  transition: color 150ms ease, border-color 150ms ease;
}

.resource-tab:hover {
  color: var(--text-strong);
}

.resource-tab.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.resource-tab__count {
  background: var(--surface-muted);
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 1.5rem;
  padding: 0.125rem 0.5rem;
  text-align: center;
}

.resource-tab.active .resource-tab__count {
  background: var(--accent-soft);
  color: var(--accent);
}

.resource-panel {
  display: none;
}

.resource-panel.active {
  display: block;
}

.resource-notice {
  align-items: center;
  background: var(--warning-soft);
  border-radius: var(--radius-sm);
  color: var(--warning);
  display: flex;
  font-size: 0.875rem;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
}

.resource-list {
  display: grid;
  gap: var(--space-2);
}

.resource-item {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  gap: var(--space-4);
  justify-content: space-between;
  padding: var(--space-4);
}

.resource-info {
  min-width: 0;
}

.resource-label {
  color: var(--text-strong);
  display: block;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-date {
  color: var(--text-muted);
  display: block;
  font-size: 0.8125rem;
  margin-top: var(--space-1);
}

.resource-action {
  flex: 0 0 auto;
}

/* ============================================
   Search Page
   ============================================ */
.search-header {
  margin-bottom: var(--space-5);
}

.search-form {
  display: flex;
  max-width: 500px;
}

.search-input {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--text);
  flex: 1;
  font-size: 1rem;
  min-height: 3rem;
  outline: none;
  padding: 0 var(--space-4);
}

.search-input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 1px var(--focus);
}

/* ============================================
   Buttons
   ============================================ */
.button {
  align-items: center;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.875rem;
  font-weight: 500;
  gap: var(--space-2);
  justify-content: center;
  min-height: 2.5rem;
  padding: 0 var(--space-4);
  text-decoration: none;
  transition: background-color 150ms ease;
}

.button:hover {
  background: var(--accent-hover);
}

.button:disabled {
  background: var(--surface-muted);
  color: var(--text-subtle);
  cursor: not-allowed;
}

.button--secondary {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.button--secondary:hover {
  background: var(--surface-muted);
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
  align-items: center;
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  margin-top: var(--space-7);
}

.pagination__link {
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: inline-flex;
  font-size: 0.875rem;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0 var(--space-3);
  text-decoration: none;
}

.pagination__link:hover {
  background: var(--surface-muted);
  color: var(--text-strong);
}

.pagination__link--disabled {
  color: var(--text-subtle);
  cursor: not-allowed;
  pointer-events: none;
}

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

/* ============================================
   Empty State
   ============================================ */
.empty-state {
  align-items: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  justify-content: center;
  padding: var(--space-10) var(--space-4);
  text-align: center;
}

.empty-state p {
  font-size: 1.125rem;
  font-weight: 500;
}

.empty-state span {
  font-size: 0.875rem;
}

/* ============================================
   Error Page
   ============================================ */
.error-page {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  justify-content: center;
  min-height: 50vh;
  text-align: center;
}

.error-page h1 {
  color: var(--text-subtle);
  font-size: 5rem;
  font-weight: 700;
  line-height: 1;
}

.error-page h2 {
  color: var(--text-strong);
  font-size: 1.5rem;
  font-weight: 600;
}

.error-page p {
  color: var(--text-muted);
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin-top: var(--space-10);
  padding: var(--space-5) 0;
  text-align: center;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1199px) {
  .movie-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    display: none;
  }

  .page-layout {
    display: block;
  }
}

@media (max-width: 767px) {
  .site-nav {
    display: none;
  }

  .header-search {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .movie-card {
    gap: var(--space-3);
    grid-template-columns: 5.5rem minmax(0, 1fr);
    padding: var(--space-4) 0;
  }

  .movie-card__poster {
    width: 5.5rem;
  }

  .movie-card__title {
    font-size: 1rem;
    line-height: 1.5rem;
  }

  .movie-card__original,
  .movie-card__cast {
    display: none;
  }

  .movie-overview {
    gap: var(--space-4);
    grid-template-columns: 140px minmax(0, 1fr);
  }

  .movie-poster {
    width: 140px;
  }

  .movie-title {
    font-size: 1.375rem;
  }

  .movie-facts {
    grid-template-columns: 1fr;
  }

  .search-form {
    max-width: 100%;
  }

  .page-header {
    flex-direction: column;
    gap: var(--space-1);
  }
}
