﻿:root {
  --bg: #050505;
  --panel: #111114;
  --panel-2: #16161a;
  --panel-3: #1d1d22;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f5f5f7;
  --muted: #9898a3;
  --soft: #ceced6;
  --accent: #f3f3f6;
  --accent-strong: #ffffff;
  --green: #22c55e;
  --yellow: #facc15;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.06), transparent 28%),
    linear-gradient(180deg, #08080a 0%, #040404 100%);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

body.modal-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar,
.control-bar,
.movie-card,
.load-more,
.empty-state,
.modal-card {
  background: rgba(17, 17, 20, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 30px;
  margin-bottom: 16px;
}

.topbar-meta {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 280px;
  gap: 8px;
}

.brand-block h1,
.shelf-header h2,
.modal-title,
.card-title {
  margin: 0;
  font-family: "Noto Serif SC", "STZhongsong", serif;
  font-weight: 700;
}

.brand-block h1 {
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.02;
  letter-spacing: 0.01em;
}

.topbar-actions {
  display: flex;
  align-items: start;
  justify-content: end;
}

.action-button,
.chip,
.detail-link,
.modal-close {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 999px;
}

.action-button::before,
.chip::before,
.detail-link::before,
.modal-close::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.18));
  transform: translateX(-105%);
  transition: transform 240ms ease;
  z-index: -1;
}

.action-button:hover::before,
.action-button:focus-visible::before,
.chip:hover::before,
.chip:focus-visible::before,
.detail-link:hover::before,
.modal-close:hover::before {
  transform: translateX(0);
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0 18px;
  transition: transform 180ms ease, border-color 180ms ease, opacity 180ms ease;
}

.action-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.18);
}

.action-button-primary {
  background: rgba(255, 255, 255, 0.92);
  color: #111114;
  border-color: rgba(255, 255, 255, 0.9);
}

.action-button-primary::before {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.62));
}

.action-button:disabled {
  cursor: wait;
  opacity: 0.82;
}

.button-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(17, 17, 20, 0.18);
  border-top-color: rgba(17, 17, 20, 0.78);
  border-radius: 999px;
  display: none;
}

.action-button.is-loading .button-spinner {
  display: inline-block;
  animation: button-spin 0.78s linear infinite;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.metric-card,
.sync-panel,
.modal-pill,
.watch-log-item,
.review-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 22px;
}

.metric-card {
  padding: 10px 12px;
}

.metric-label,
.nav-label,
.modal-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.metric-value {
  display: block;
  margin-top: 8px;
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 800;
}

.sync-panel {
  padding: 10px 12px;
}

.sync-status-stack {
  display: grid;
  gap: 10px;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--soft);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sync-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #8b8b96;
}

.sync-badge[data-tone="syncing"] .sync-badge-dot {
  background: var(--yellow);
  box-shadow: 0 0 0 6px rgba(250, 204, 21, 0.12);
  animation: sync-pulse 1.2s ease-in-out infinite;
}

.sync-badge[data-tone="success"] .sync-badge-dot {
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.12);
}

.sync-badge[data-tone="error"] .sync-badge-dot {
  background: #fb7185;
  box-shadow: 0 0 0 6px rgba(251, 113, 133, 0.12);
}

.sync-line,
.sync-hint,
.meta-line,
.modal-section p,
.modal-subtitle,
.watch-log-item span,
.review-card p,
.collection-count {
  margin: 0;
  color: var(--soft);
  line-height: 1.6;
}

.sync-line {
  color: var(--text);
}

.sync-hint {
  color: var(--muted);
  font-size: 13px;
}

.control-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 8px;
  padding: 10px;
  border-radius: 28px;
  margin-bottom: 20px;
}

.nav-group {
  min-width: 0;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.chip {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--soft);
  padding: 7px 11px;
  font-size: 11px;
  transition: transform 180ms ease, border-color 180ms ease, color 180ms ease;
}

.chip.is-active {
  border-color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.94);
  color: #111114;
}

.chip:hover {
  transform: translateY(-1px);
}

.nav-group-search input {
  width: 100%;
  margin-top: 4px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 20px;
  padding: 10px 12px;
}

.nav-group-search input::placeholder {
  color: #767681;
}

.shelf-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.shelf-header h2 {
  font-size: 24px;
}

.collection-count {
  color: var(--muted);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.movie-card {
  overflow: hidden;
  border-radius: 28px;
  transition: transform 180ms ease, border-color 180ms ease;
}

.movie-card:hover,
.movie-card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.16);
  outline: none;
}

.card-poster-wrap {
  position: relative;
  aspect-ratio: 3 / 4.4;
  overflow: hidden;
}

.poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08) 8%, rgba(0, 0, 0, 0.1) 24%, rgba(0, 0, 0, 0.28) 48%, rgba(0, 0, 0, 0.78) 80%, rgba(0, 0, 0, 0.96) 100%);
}

.card-rating-badges {
  position: absolute;
  inset: 12px 12px auto 12px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  z-index: 2;
}

.card-rating-badge,
.modal-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 999px;
  backdrop-filter: blur(18px);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.card-rating-badge-douban,
.modal-pill-douban {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.22);
  color: #b7f7ca;
}

.card-rating-badge-user,
.modal-pill-user {
  background: rgba(250, 204, 21, 0.12);
  border: 1px solid rgba(250, 204, 21, 0.22);
  color: #fff0a7;
  margin-left: auto;
}

.card-title-overlay {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  padding: 20px 16px 16px;
}

.card-title {
  font-size: 30px;
  line-height: 1.04;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.54);
}

.card-subtitle {
  margin: 8px 0 0;
  min-height: 18px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  line-height: 1.45;
}

.card-content {
  padding: 14px 14px 16px;
}

.meta-stack {
  display: grid;
  gap: 8px;
}

.card-watch-date {
  color: var(--text);
  font-size: 13px;
}

.card-review {
  color: var(--muted);
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.load-more,
.empty-state {
  margin-top: 16px;
  padding: 16px;
  border-radius: 22px;
  text-align: center;
  color: var(--muted);
}

.load-more-text {
  margin: 0;
}

.scroll-sentinel {
  width: 100%;
  height: 1px;
}

.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.detail-modal.is-active {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(16px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  margin: 14px auto;
  padding: 16px;
  border-radius: 32px;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(28px) scale(0.97);
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms ease;
}

.detail-modal.is-active .modal-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.modal-media {
  min-width: 0;
}

.modal-poster {
  width: 100%;
  aspect-ratio: 3 / 4.3;
  object-fit: cover;
  border-radius: 24px;
  display: block;
}

.modal-content {
  min-width: 0;
  overflow: auto;
  padding-right: 4px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: rgba(17, 17, 20, 0.8);
  color: var(--text);
  font-size: 24px;
}

.modal-title {
  margin-top: 8px;
  font-size: clamp(34px, 4vw, 54px);
  line-height: 0.98;
}

.modal-subtitle {
  margin-top: 12px;
  font-size: 14px;
}

.modal-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.modal-section {
  margin-top: 20px;
}

.modal-section h4 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 14px;
}

.modal-meta-grid > div {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.watch-log,
.review-list {
  display: grid;
  gap: 10px;
}

.watch-log-item,
.review-card {
  padding: 14px 16px;
}

.watch-log-item strong,
.review-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.review-card p,
.review-empty {
  color: var(--soft);
}

.modal-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.review-empty {
  margin: 0;
}

.detail-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin-top: 22px;
  color: var(--text);
  text-decoration: none;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.hidden {
  display: none !important;
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: #000;
  transition: opacity 520ms ease, visibility 520ms ease;
}

.splash-screen p {
  margin: 0;
  color: #f5f5f7;
  text-align: center;
  font-family: "Noto Serif SC", "STZhongsong", serif;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.3;
}

.splash-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.toast-layer {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 80;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  min-width: min(420px, calc(100vw - 24px));
  max-width: min(560px, calc(100vw - 24px));
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(17, 17, 20, 0.94);
  box-shadow: var(--shadow);
  color: var(--text);
  text-align: center;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity 220ms ease, transform 220ms ease, border-color 220ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-success {
  border-color: rgba(34, 197, 94, 0.28);
}

.toast-error {
  border-color: rgba(251, 113, 133, 0.28);
}

.toast-info {
  border-color: rgba(56, 189, 248, 0.28);
}

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

@keyframes sync-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.15);
    opacity: 0.88;
  }
}

@media (max-width: 1180px) {
  .cards-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .topbar-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .control-bar,
  .modal-card {
    grid-template-columns: 1fr;
  }

  .cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .modal-card {
    max-height: calc(100vh - 18px);
    margin: 9px auto;
  }

  .modal-media {
    max-width: 320px;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100vw - 14px, 1240px);
    padding-top: 12px;
  }

  .topbar {
    position: static;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
    border-radius: 24px;
  }

  .brand-block h1 {
    font-size: 22px;
    line-height: 1.18;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-meta {
    gap: 6px;
  }

  .action-button {
    width: 100%;
    min-height: 40px;
    font-size: 12px;
  }

  .metrics-grid {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scroll-snap-type: x proximity;
  }

  .metric-card {
    flex: 0 0 auto;
    min-width: 70px;
    padding: 8px 10px;
    border-radius: 18px;
    scroll-snap-align: start;
  }

  .metric-value {
    margin-top: 4px;
    font-size: 16px;
  }

  .sync-panel {
    padding: 8px 10px;
    border-radius: 18px;
  }

  .sync-status-stack {
    gap: 6px;
  }

  .sync-badge {
    width: 100%;
    justify-content: center;
    padding: 6px 10px;
    font-size: 10px;
  }

  .sync-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .control-bar {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 8px;
    border-radius: 20px;
  }

  .nav-group {
    display: grid;
    gap: 2px;
  }

  .nav-label {
    display: none;
  }

  .chip-row {
    gap: 4px;
    margin-top: 0;
  }

  .chip {
    padding: 6px 10px;
    font-size: 11px;
  }

  .nav-group-search input {
    margin-top: 0;
    padding: 9px 12px;
    font-size: 12px;
  }

  .shelf-header {
    display: none;
  }

  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .card-rating-badges {
    inset: 10px 10px auto 10px;
  }

  .card-rating-badge {
    min-height: 32px;
    padding: 7px 10px;
    font-size: 11px;
  }

  .card-title {
    font-size: 22px;
  }

  .card-content {
    padding: 10px;
  }

  .card-subtitle,
  .card-watch-date,
  .card-review,
  .metric-label,
  .sync-line,
  .sync-hint,
  .nav-label,
  .collection-count {
    font-size: 11px;
  }

  .detail-modal {
    align-items: end;
  }

  .modal-card {
    width: 100vw;
    max-height: 100vh;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    border-radius: 24px 24px 0 0;
    gap: 0;
    overflow: hidden;
  }

  .modal-title {
    font-size: 24px;
  }

  .modal-media {
    max-width: none;
    padding: 12px 12px 0;
    background: linear-gradient(180deg, rgba(12, 12, 15, 0.98), rgba(12, 12, 15, 0.86));
  }

  .modal-poster {
    aspect-ratio: 16 / 11;
    border-radius: 20px;
  }

  .modal-content {
    padding: 0 12px 22px;
    overflow: auto;
    overscroll-behavior: contain;
  }

  .modal-section {
    margin-top: 12px;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
  }

  .modal-section h4 {
    margin-bottom: 8px;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .watch-log,
  .review-list {
    gap: 8px;
  }

  .watch-log-item,
  .review-card {
    padding: 12px 14px;
  }

  .modal-meta-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .modal-meta-grid > div {
    padding: 12px 14px;
    border-radius: 16px;
  }

  .modal-pill {
    width: 100%;
    justify-content: center;
  }

  .modal-pill-row {
    position: sticky;
    top: 0;
    z-index: 1;
    margin-top: 14px;
    padding: 10px 0 8px;
    background: linear-gradient(180deg, rgba(12, 12, 15, 0.98), rgba(12, 12, 15, 0.92));
  }

  .modal-close {
    top: 18px;
    right: 18px;
  }

  .toast {
    min-width: min(100vw - 20px, 420px);
  }
}
