:root {
  --ink: #1e1d1b;
  --muted: #666058;
  --paper: #f5f0e6;
  --paper-strong: #fffaf0;
  --line: #d9cfc0;
  --rust: #a94731;
  --teal: #12676f;
  --olive: #657344;
  --gold: #be8a2f;
  --night: #24282e;
  --card: #fff8ec;
  --shadow: 0 18px 40px rgba(30, 29, 27, 0.14);
  font-family: Inter, "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(30, 29, 27, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(30, 29, 27, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

.share-thumb {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 320px;
  height: 320px;
  object-fit: cover;
  opacity: 0.01;
  pointer-events: none;
}

.copy-buffer {
  position: fixed;
  left: -9999px;
  top: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 240, 230, 0.92);
  backdrop-filter: blur(14px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: var(--paper-strong);
  background: var(--ink);
  border: 2px solid var(--rust);
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--rust);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  color: var(--ink);
  background: var(--paper-strong);
  font-weight: 800;
}

.icon-button:hover {
  background: var(--ink);
  color: var(--paper-strong);
}

.count-pill {
  position: absolute;
  right: -7px;
  top: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--rust);
  color: white;
  font-size: 11px;
  line-height: 20px;
}

.share-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  max-width: min(320px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper-strong);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  gap: 28px;
  padding: 24px 28px 40px;
}

.control-rail {
  position: sticky;
  top: 86px;
  align-self: start;
}

.decision-panel,
.summary-strip,
.collection-tile,
.movie-card,
.drawer-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 248, 236, 0.92);
}

.decision-panel {
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.mobile-filter-close {
  display: none;
}

.search-box {
  margin: 18px 0;
}

.search-box label,
.filter-row label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input[type="search"],
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--ink);
}

input[type="search"] {
  padding: 0 12px;
}

select {
  padding: 0 10px;
}

.filter-group {
  margin: 18px 0;
}

.filter-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.text-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--ink);
  font-weight: 700;
}

.chip {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.chip:hover,
.chip.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper-strong);
}

.filter-row {
  margin-top: 20px;
}

.content-area {
  min-width: 0;
}

.mobile-filter-bar {
  display: none;
}

.summary-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px;
  background: linear-gradient(135deg, rgba(255, 248, 236, 0.96), rgba(224, 215, 196, 0.96));
}

.summary-copy p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.score-legend {
  display: grid;
  gap: 8px;
  min-width: 190px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.legend-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 8px;
  border-radius: 999px;
}

.legend-dot.tonight {
  background: var(--teal);
}

.legend-dot.canon {
  background: var(--rust);
}

.season-banner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: 18px 20px 18px;
  overflow: hidden;
  border: 1px solid rgba(169, 71, 49, 0.34);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.96), rgba(238, 226, 207, 0.9));
  box-shadow: 0 12px 28px rgba(30, 29, 27, 0.08);
}

.season-banner::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--rust), var(--teal), var(--gold));
}

.season-copy {
  position: relative;
  min-width: 0;
}

.season-copy p:last-child {
  max-width: 680px;
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.season-button {
  position: relative;
  min-width: 126px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper-strong);
  font-weight: 800;
}

.season-button:hover,
.season-button.active {
  border-color: var(--rust);
  background: var(--rust);
}

.collections,
.tonight-picker,
.movie-section {
  margin-top: 26px;
  scroll-margin-top: 96px;
}

.section-head {
  margin-bottom: 14px;
}

.section-head.inline {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.text-button {
  min-height: 36px;
  padding: 0 12px;
}

.text-button:hover {
  border-color: var(--rust);
  color: var(--rust);
}

.text-button.active {
  border-color: var(--rust);
  background: rgba(169, 71, 49, 0.1);
  color: var(--rust);
}

.intent-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.intent-button {
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.9);
  color: var(--ink);
  text-align: left;
}

.intent-button:hover,
.intent-button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper-strong);
}

.intent-button strong,
.intent-button span {
  display: block;
}

.intent-button strong {
  margin-bottom: 6px;
  font-size: 15px;
  line-height: 1.2;
}

.intent-button span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.intent-button:hover span,
.intent-button.active span {
  color: rgba(255, 250, 240, 0.74);
}

.recommendation-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 248, 236, 0.98), rgba(238, 226, 207, 0.94));
  box-shadow: 0 14px 30px rgba(30, 29, 27, 0.1);
}

.recommendation-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 18px 0;
}

.recommendation-head p:last-child {
  max-width: 540px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.recommendation-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(0, 1.9fr);
  gap: 14px;
  padding: 18px;
}

.hero-recommendation,
.alt-recommendation {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  text-align: left;
}

.hero-recommendation {
  overflow: hidden;
}

.hero-recommendation .poster-card {
  min-height: 218px;
}

.hero-recommendation-body,
.alt-recommendation {
  padding: 14px;
}

.recommendation-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 10px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(18, 103, 111, 0.12);
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
}

.recommendation-reason {
  margin: 10px 0 12px;
  color: #3c3731;
  font-size: 14px;
  line-height: 1.5;
}

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

.alt-recommendation:hover,
.hero-recommendation:hover {
  border-color: var(--ink);
}

.alt-recommendation h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.alt-meta {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mini-score-row {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mini-score-row strong {
  color: var(--ink);
}

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

.collection-tile {
  min-height: 116px;
  padding: 16px;
  text-align: left;
}

.collection-tile:hover {
  border-color: var(--ink);
  box-shadow: 0 10px 24px rgba(30, 29, 27, 0.12);
}

.collection-tile strong {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
}

.collection-tile span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.movie-card {
  overflow: hidden;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.movie-card:hover {
  transform: translateY(-3px);
  border-color: var(--ink);
  box-shadow: 0 14px 28px rgba(30, 29, 27, 0.16);
}

.poster-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 250px;
  padding: 16px;
  color: #fffaf0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent 42%),
    var(--poster-color, var(--night));
}

.poster-card.has-image {
  background: var(--poster-color, var(--night));
}

.poster-card.has-image::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(18, 18, 17, 0.28), rgba(18, 18, 17, 0.08) 36%, rgba(18, 18, 17, 0.84)),
    linear-gradient(90deg, rgba(18, 18, 17, 0.42), transparent 62%);
  pointer-events: none;
}

.poster-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-card::after {
  content: "";
  position: absolute;
  inset: 12px;
  z-index: 2;
  border: 1px solid rgba(255, 250, 240, 0.45);
  pointer-events: none;
}

.poster-rank {
  position: relative;
  z-index: 3;
  align-self: flex-start;
  padding: 4px 7px;
  border: 1px solid rgba(255, 250, 240, 0.6);
  color: #fffaf0;
  font-size: 12px;
  font-weight: 800;
}

.poster-title {
  position: relative;
  z-index: 3;
}

.poster-title .cn {
  display: block;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.12;
}

.poster-title .en {
  display: block;
  margin-top: 7px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0.86;
}

.card-body {
  padding: 14px;
}

.meta-line,
.tag-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.card-copy {
  min-height: 62px;
  margin: 10px 0 12px;
  color: #38342f;
  font-size: 14px;
  line-height: 1.45;
}

.score-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.score-box {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
}

.score-box span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.score-box strong {
  font-size: 22px;
}

.bar {
  overflow: hidden;
  height: 5px;
  margin-top: 6px;
  border-radius: 999px;
  background: #e4d8c8;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.bar.tonight i {
  background: var(--teal);
}

.bar.canon i {
  background: var(--rust);
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 38px;
  gap: 8px;
}

.primary-button,
.mark-button {
  min-height: 38px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper-strong);
  font-weight: 800;
}

.primary-button:hover,
.mark-button:hover,
.mark-button.active {
  background: var(--rust);
  border-color: var(--rust);
}

.empty-state {
  padding: 36px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
}

.drawer.open {
  display: block;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 29, 27, 0.42);
}

.drawer-panel {
  position: absolute;
  top: 18px;
  right: 18px;
  bottom: 18px;
  width: min(560px, calc(100vw - 36px));
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.drawer-close {
  position: sticky;
  top: 14px;
  float: right;
  z-index: 2;
  margin: 14px 14px 0 0;
}

.drawer-hero {
  display: grid;
  grid-template-columns: 178px 1fr;
  gap: 18px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.drawer-hero .poster-card {
  min-height: 260px;
  border-radius: 6px;
}

.drawer-main h2 {
  margin: 0 46px 8px 0;
  font-size: 28px;
}

.drawer-main .subtitle {
  color: var(--muted);
  font-weight: 700;
}

.drawer-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.drawer-body {
  display: grid;
  gap: 16px;
  padding: 20px 22px 24px;
}

.insight-block {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.insight-block h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.insight-block p {
  margin-bottom: 0;
  color: #3c3731;
  line-height: 1.6;
}

.fit-block {
  background: #fff8ea;
}

.fit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.fit-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid rgba(30, 29, 27, 0.12);
  border-radius: 999px;
  background: #fffdf8;
  color: #4d453c;
  font-size: 12px;
  font-weight: 800;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.detail-cell {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.78);
}

.detail-cell span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.detail-cell strong {
  font-size: 15px;
}

.related-list {
  display: grid;
  gap: 8px;
}

.related-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--ink);
  text-align: left;
}

.related-list button:hover {
  border-color: var(--ink);
}

.source-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .control-rail {
    position: static;
  }

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

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

  .recommendation-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body.mobile-filters-open {
    overflow: hidden;
  }

  body.mobile-filters-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(30, 29, 27, 0.42);
  }

  .topbar {
    align-items: flex-start;
    padding: 14px;
  }

  h1 {
    font-size: 22px;
  }

  .workspace {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 14px;
  }

  .content-area {
    order: 1;
  }

  .control-rail {
    display: none;
  }

  body.mobile-filters-open .control-rail {
    position: fixed;
    inset: 76px 14px 14px;
    z-index: 30;
    display: block;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .decision-panel {
    padding: 16px;
  }

  body.mobile-filters-open .decision-panel {
    box-shadow: var(--shadow);
  }

  .mobile-filter-close {
    display: inline-grid;
    place-items: center;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fffdf8;
    color: var(--ink);
    font-weight: 800;
  }

  .mobile-filter-bar {
    position: sticky;
    top: 74px;
    z-index: 18;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 248, 236, 0.94);
    backdrop-filter: blur(12px);
  }

  .mobile-filter-toggle {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--ink);
    border-radius: 6px;
    background: var(--ink);
    color: var(--paper-strong);
    font-weight: 800;
  }

  .mobile-filter-toggle[aria-expanded="true"] {
    border-color: var(--rust);
    background: var(--rust);
  }

  #mobileFilterSummary {
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-align: right;
  }

  .summary-strip {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .season-banner {
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }

  .season-button {
    width: 100%;
  }

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

  .intent-button {
    min-height: 68px;
  }

  .recommendation-head {
    flex-direction: column;
    padding: 16px 16px 0;
  }

  .recommendation-layout {
    padding: 16px;
  }

  .collection-grid,
  .movie-grid,
  .alt-grid,
  .drawer-hero,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .collection-tile {
    min-height: auto;
  }

  .drawer-panel {
    inset: auto 0 0;
    width: 100%;
    max-height: 92vh;
    border-radius: 8px 8px 0 0;
  }

  .drawer-hero .poster-card {
    min-height: 220px;
  }
}
