@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --primary: #f54e00;
  --primary-active: #d04200;
  --navy: #163a70;
  --ink: #26251e;
  --body: #5a5852;
  --body-strong: #26251e;
  --muted: #807d72;
  --muted-soft: #a09c92;
  --hairline: #e6e5e0;
  --hairline-soft: #efeee8;
  --hairline-strong: #cfcdc4;
  --canvas: #f7f7f4;
  --canvas-soft: #fafaf7;
  --surface-card: #ffffff;
  --surface-strong: #e6e5e0;
  --on-primary: #ffffff;
  --semantic-error: #cf2d56;
  --semantic-success: #1f8a65;
  --radius-xs: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-base: 16px;
  --space-md: 20px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;
  --space-section: 80px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--canvas);
  color: var(--ink);
  overflow-x: hidden;
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 64px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(247, 247, 244, 0.94);
  backdrop-filter: blur(8px);
}

.top-nav__inner {
  width: min(1200px, calc(100% - 32px));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
}

.brand-mark,
.top-nav__links a {
  font-size: 14px;
  line-height: 1.4;
  font-weight: 500;
  text-decoration: none;
}

.brand-mark {
  color: var(--primary);
}

.top-nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  color: var(--ink);
}

.app-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: var(--space-section) 0 120px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
  gap: var(--space-xl);
  align-items: start;
  padding-bottom: var(--space-xxl);
  border-bottom: 1px solid var(--hairline);
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  letter-spacing: 0.88px;
  text-transform: uppercase;
  font-size: 11px;
  line-height: 1.4;
  font-weight: 600;
}

h1,
h2,
h3,
th {
  font-family: "Inter", system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 7vw, 4.5rem);
  line-height: 1.1;
  letter-spacing: -2.16px;
  font-weight: 400;
}

.hero-copy,
.panel-heading p,
.empty {
  color: var(--body);
}

.hero-copy {
  margin: 0;
  max-width: 38rem;
  font-size: 16px;
  line-height: 1.5;
}

.hero-copy-block {
  display: grid;
  gap: var(--space-base);
}

.hero-actions {
  display: grid;
  justify-items: stretch;
  gap: var(--space-base);
  min-width: 0;
  padding: var(--space-lg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--surface-card);
}

.hero-meta-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-xs);
}

.hero-meta-pill,
.panel,
.error-banner {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--surface-card);
}

.hero-meta-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: 0.72px;
  text-transform: uppercase;
}

.hero-meta-pill strong {
  display: block;
  max-width: 100%;
  margin-left: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  overflow-wrap: anywhere;
}

.schedule-text {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  margin: 0;
  color: var(--body);
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
  font-family: "JetBrains Mono", "Fira Code", monospace;
}

.schedule-text strong {
  color: var(--ink);
  font-weight: 500;
}

#cgv-status-text {
  display: inline-block;
  margin-left: 0;
}

#refresh-note {
  color: var(--ink);
}

#cgv-status-text {
  color: var(--semantic-success);
}

button {
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  background: var(--surface-card);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
  font-size: 14px;
  line-height: 1;
  font-weight: 500;
}

button:hover {
  border-color: var(--ink);
}

button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.error-banner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
  padding: var(--space-base) var(--space-lg);
}

.error-banner--error {
  color: var(--semantic-error);
  border-color: rgba(207, 45, 86, 0.2);
}

.error-banner--warning {
  color: var(--primary-active);
  border-color: rgba(245, 78, 0, 0.18);
  background: #fff7f2;
}

.hidden {
  display: none;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--hairline-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.grid-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: var(--space-xl);
  margin-top: var(--space-section);
}

.panel {
  padding: var(--space-lg);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.panel-heading h2,
.status-bar strong {
  margin: 0;
}

.panel-heading h2 {
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: -0.325px;
  font-weight: 400;
}

.panel-heading p {
  max-width: 30ch;
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.ranking-note {
  display: inline-grid;
  justify-items: end;
  gap: 1px;
  max-width: 42ch;
  font-size: 9px;
  line-height: 1.35;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.ranking-note__label,
.ranking-note__line,
.ranking-note__ellipsis {
  display: block;
  width: 100%;
  text-align: right;
}

.ranking-note__label {
  margin-bottom: 2px;
}

.ranking-note__ellipsis {
  display: inline-grid;
  justify-items: center;
  line-height: 0.8;
}

.table-wrap,
.compare-wrap {
  position: relative;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 13px;
  line-height: 1.5;
}

#ranking-table {
  table-layout: fixed;
}

.ranking-col--position {
  width: 72px;
}

.ranking-col--title {
  width: auto;
}

.ranking-col--source,
.ranking-col--score {
  width: 96px;
}

#ranking-table th,
#ranking-table td {
  text-align: center;
  vertical-align: top;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--hairline-soft);
  text-align: left;
}

th {
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.88px;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

th.is-sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

th.is-sortable.is-active {
  color: var(--primary);
}

th.is-sortable:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

th.is-sortable.is-active {
  text-decoration-color: currentColor;
}

th:not(.is-sortable) {
  cursor: default;
}

tbody tr:hover {
  background: var(--canvas-soft);
}

.poster-cell {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.ranking-poster-cell {
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.ranking-movie-copy {
  min-width: 0;
}

.ranking-poster-cell a,
.ranking-poster-cell strong {
  display: block;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.ranking-title {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  line-height: 1.02;
}

.ranking-title__line {
  display: block;
  white-space: nowrap;
  line-height: 1;
}

.poster-cell img,
.source-poster {
  width: 48px;
  height: 68px;
  object-fit: cover;
  border-radius: var(--radius-md);
  background: var(--canvas-soft);
  border: 1px solid var(--hairline);
}

.sources-table {
  table-layout: fixed;
}

.rank-col {
  width: 72px;
}

.theater-col {
  width: calc((100% - 72px) / 3);
}

.movie-cell {
  min-width: 0;
}

.movie-chip {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.sources-table .movie-chip--stacked {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 8px;
}

.sources-table .movie-cell {
  width: 100%;
  text-align: center;
}

.sources-table thead th {
  text-align: center;
}

.sources-table thead th:first-child,
.sources-table tbody td:first-child {
  text-align: left;
}

.sources-table tbody td {
  vertical-align: top;
}

.sources-table thead th:nth-child(3),
.sources-table thead th:nth-child(4),
.sources-table tbody td:nth-child(3),
.sources-table tbody td:nth-child(4) {
  border-left: 1px solid rgba(128, 128, 128, 0.18);
}

.sources-table .source-poster-link {
  display: inline-flex;
  text-decoration: none;
}

.winner-row-overlay {
  position: absolute;
  border-radius: 14px;
  pointer-events: none;
  overflow: hidden;
  z-index: 3;
}

.winner-row-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 209, 102, 0.08), rgba(245, 78, 0, 0.14), rgba(255, 209, 102, 0.08));
  opacity: 0;
  transform: scale(0.985);
  animation: winnerGlowFade 4.6s ease forwards;
}

.winner-row-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 209, 102, 0.12);
  box-shadow: 0 0 0 rgba(255, 209, 102, 0), inset 0 0 0 rgba(255, 209, 102, 0);
  animation: winnerBorderPulse 4.6s ease forwards;
}

.winner-row-overlay--reduced-motion::before {
  opacity: 0.78;
  transform: none;
}

.winner-row-overlay--reduced-motion::after {
  border-color: rgba(255, 209, 102, 0.48);
  box-shadow: 0 0 0 1px rgba(255, 209, 102, 0.2), inset 0 0 18px rgba(255, 209, 102, 0.12);
}

.winner-row-sparkle {
  position: absolute;
  left: var(--particle-left);
  top: var(--particle-top);
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  clip-path: polygon(50% 0%, 62% 36%, 100% 50%, 62% 64%, 50% 100%, 38% 64%, 0% 50%, 38% 36%);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.98) 0%, rgba(255, 238, 170, 0.96) 34%, rgba(255, 209, 102, 0.84) 60%, rgba(255, 209, 102, 0) 78%);
  filter: drop-shadow(0 0 10px rgba(255, 209, 102, 0.65));
  will-change: transform, opacity;
  opacity: 0;
  animation: winnerSparkleBurst 2100ms ease-out forwards;
  animation-delay: var(--particle-delay);
}

.movie-chip--empty {
  grid-template-columns: 1fr;
}

.movie-title,
.movie-title-link {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  text-decoration: none;
}

.sources-table .movie-title,
.sources-table .movie-title-link {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  overflow: hidden;
  word-break: keep-all;
  line-height: 1.45;
}

.sources-table .movie-title-link {
  color: var(--navy);
}

.sources-table .movie-title-link:hover {
  text-decoration: underline;
}

.movie-chip--empty .movie-title {
  color: var(--muted);
}

.source-rank-cell {
  font-variant-numeric: tabular-nums;
}

.status-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg) calc(var(--space-sm) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--hairline);
  background: rgba(247, 247, 244, 0.96);
  backdrop-filter: blur(12px);
}

.status-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 8px 14px;
  border: 1px solid var(--hairline-strong);
  background: var(--surface-card);
  font-size: 14px;
}

.status-bar__details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: start;
  gap: var(--space-sm);
}

.status-bar__mobile-info {
  display: none;
}

.status-bar--collapsed .status-bar__details {
  display: none;
}

.status-bar__group {
  min-width: 0;
}

.status-bar__runtime {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.status-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.88px;
  text-transform: uppercase;
}

.status-bar strong {
  display: block;
  white-space: normal;
  font-size: 13px;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: 0.88px;
  text-transform: uppercase;
  color: var(--ink);
}

.badge-pill--thinking {
  background: var(--timeline-thinking);
}

.badge-pill--read {
  background: var(--timeline-read);
}

.badge-pill--edit {
  background: var(--timeline-edit);
}

.badge-pill--done {
  background: var(--timeline-done);
  color: var(--on-primary);
}

@media (max-width: 980px) {
  .hero,
  .grid-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    gap: var(--space-lg);
    padding-bottom: var(--space-xl);
  }

  .hero-meta-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .sources-table {
    min-width: 0;
  }

  .rank-col {
    width: 56px;
  }

  .theater-col {
    width: calc((100% - 56px) / 3);
  }

  th,
  td {
    padding: 10px 8px;
  }

  .movie-chip {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .source-poster {
    display: none;
  }
}

@media (max-width: 640px) {
  .ranking-panel .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }

  #ranking-table {
    width: 520px;
    min-width: 520px;
    table-layout: fixed;
  }

  #ranking-table th,
  #ranking-table td {
    padding-inline: 4px;
    text-align: center;
    vertical-align: top;
  }

  #ranking-table th {
    white-space: normal;
    word-break: keep-all;
    line-height: 1.35;
  }

  #ranking-table th:nth-child(2),
  #ranking-table td:nth-child(2) {
    text-align: center;
  }

  .ranking-poster-cell {
    align-items: center;
    text-align: center;
  }

  .ranking-poster-cell a,
  .ranking-poster-cell strong {
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: normal;
  }

  .status-bar__mobile-info {
    display: block;
  }

  .hero-actions--mobile {
    gap: 10px;
    padding: 14px;
    border-radius: var(--radius-md);
    background: var(--surface-card);
  }

  .hero-actions--mobile .hero-meta-row {
    grid-template-columns: 1fr;
  }

  .hero-actions--mobile .hero-meta-pill {
    width: 100%;
  }

  .hero-actions--mobile .schedule-text {
    display: grid;
    gap: 4px;
  }

  .top-nav__inner,
  .app-shell {
    width: min(100% - 18px, 100%);
  }

  .top-nav {
    height: auto;
  }

  .top-nav__inner {
    min-height: 64px;
    padding: 10px 0;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .top-nav__links {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 13px;
  }

  .app-shell {
    padding-top: 40px;
    padding-bottom: 132px;
  }

  h1 {
    font-size: 32px;
    letter-spacing: -1.2px;
  }

  .panel,
  .hero-actions {
    padding: 18px;
  }

  .hero-actions {
    justify-items: stretch;
  }

  .hero-meta-row {
    grid-template-columns: 1fr;
  }

  .hero-meta-pill {
    width: 100%;
  }

  .hero-meta-pill strong {
    font-size: 12px;
  }

  .schedule-text {
    display: grid;
    gap: 4px;
  }

  #source-lag-text,
  #cgv-status-text {
    display: block;
    margin-left: 0;
    margin-top: 4px;
  }

  .panel-heading {
    flex-direction: column;
    align-items: start;
  }

  th,
  td {
    padding: 8px 6px;
    font-size: 12px;
  }

  .movie-title,
  .movie-title-link,
  .sources-table .movie-title,
  .sources-table .movie-title-link,
  .status-bar strong {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .poster-cell {
    gap: 8px;
  }

  .status-bar {
    padding-inline: 12px;
  }

  .status-toggle {
    width: 100%;
  }

  .status-bar__details {
    grid-template-columns: 1fr;
  }

  .status-bar__runtime {
    justify-content: flex-start;
  }
  }

  .schedule-text strong {
    color: var(--ink);
    font-weight: 500;
  }

  #source-lag-text,
  #cgv-status-text {
    display: inline-block;
    margin-left: var(--space-sm);
  }

  #cgv-status-text {
    color: var(--semantic-success);
  }

  button {
    border: 1px solid var(--hairline-strong);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    background: var(--surface-card);
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
    font-size: 14px;
    line-height: 1;
    font-weight: 500;
  }

  button:hover {
    border-color: var(--ink);
  }

  button.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--on-primary);
  }

  .error-banner {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-xl);
    padding: var(--space-base) var(--space-lg);
  }

  .error-banner--error {
    color: var(--semantic-error);
    border-color: rgba(207, 45, 86, 0.2);
  }

  .error-banner--warning {
    color: var(--primary-active);
    border-color: rgba(245, 78, 0, 0.18);
    background: #fff7f2;
  }

  .hidden {
    display: none;
  }

  .spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--hairline-strong);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }

  @keyframes spin {
    to {
      transform: rotate(360deg);
    }
  }

  @keyframes winnerGlowFade {
    0% {
      opacity: 0;
      transform: scale(0.97);
    }
    12% {
      opacity: 1;
      transform: scale(1);
    }
    78% {
      opacity: 0.92;
      transform: scale(1);
    }
    100% {
      opacity: 0;
      transform: scale(1.02);
    }
  }

  @keyframes winnerBorderPulse {
    0% {
      border-color: rgba(255, 209, 102, 0.08);
      box-shadow: 0 0 0 rgba(255, 209, 102, 0), inset 0 0 0 rgba(255, 209, 102, 0);
    }
    16% {
      border-color: rgba(255, 209, 102, 0.8);
      box-shadow: 0 0 0 1px rgba(255, 209, 102, 0.55), 0 0 22px rgba(255, 209, 102, 0.38), inset 0 0 24px rgba(255, 209, 102, 0.14);
    }
    34% {
      border-color: rgba(255, 245, 214, 0.95);
      box-shadow: 0 0 0 1px rgba(255, 245, 214, 0.68), 0 0 34px rgba(255, 209, 102, 0.48), inset 0 0 30px rgba(255, 245, 214, 0.2);
    }
    52% {
      border-color: rgba(245, 78, 0, 0.78);
      box-shadow: 0 0 0 1px rgba(245, 78, 0, 0.45), 0 0 18px rgba(245, 78, 0, 0.28), inset 0 0 20px rgba(245, 78, 0, 0.12);
    }
    70% {
      border-color: rgba(255, 245, 214, 0.88);
      box-shadow: 0 0 0 1px rgba(255, 245, 214, 0.6), 0 0 28px rgba(255, 209, 102, 0.42), inset 0 0 26px rgba(255, 245, 214, 0.18);
    }
    100% {
      border-color: rgba(255, 209, 102, 0);
      box-shadow: 0 0 0 rgba(255, 209, 102, 0), inset 0 0 0 rgba(255, 209, 102, 0);
    }
  }

  @keyframes winnerSparkleBurst {
    0% {
      opacity: 0;
      transform: translate3d(0, 2px, 0) scale(0.2) rotate(0deg);
    }
    18% {
      opacity: 1;
    }
    40% {
      opacity: 0.95;
    }
    100% {
      opacity: 0;
      transform: translate3d(var(--particle-x), -34px, 0) scale(1.35) rotate(var(--particle-rotate));
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .winner-row-overlay::before,
    .winner-row-overlay::after {
      animation-duration: 1ms;
      animation-iteration-count: 1;
    }

    .winner-row-sparkle { display: none; }
  }

  .grid-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: var(--space-xl);
    margin-top: var(--space-section);
  }

  .panel {
    padding: var(--space-lg);
  }

  .panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
  }

  .panel-heading h2,
  .status-bar strong {
    margin: 0;
  }

  .panel-heading h2 {
    font-size: 26px;
    line-height: 1.25;
    letter-spacing: -0.325px;
    font-weight: 400;
  }

  .panel-heading p {
    max-width: 30ch;
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
  }

  .table-wrap,
  .compare-wrap {
    overflow-x: auto;
  }

  table {
    width: 100%;
    border-collapse: collapse;
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 13px;
    line-height: 1.5;
  }

  th,
  td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--hairline-soft);
    text-align: left;
  }

  th {
    cursor: pointer;
    font-size: 11px;
    line-height: 1.4;
    letter-spacing: 0.88px;
    text-transform: uppercase;
    color: var(--muted);
  }

  tbody tr:hover {
    background: var(--canvas-soft);
  }

  .poster-cell {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
  }

  .poster-cell img,
  .source-poster {
    width: 48px;
    height: 68px;
    object-fit: cover;
    border-radius: var(--radius-md);
    background: var(--canvas-soft);
    border: 1px solid var(--hairline);
  }

  .sources-table {
    table-layout: fixed;
  }

  .rank-col {
    width: 72px;
  }

  .theater-col {
    width: calc((100% - 72px) / 3);
  }

  .movie-cell {
    min-width: 0;
  }

  .movie-chip {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-width: 0;
  }

  .movie-chip--empty {
    grid-template-columns: 1fr;
  }

  .movie-title,
  .movie-title-link {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink);
    text-decoration: none;
  }

  .movie-chip--empty .movie-title {
    color: var(--muted);
  }

  .source-rank-cell {
    font-variant-numeric: tabular-nums;
  }

  .status-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg) calc(var(--space-sm) + env(safe-area-inset-bottom));
    border-top: 1px solid var(--hairline);
    background: rgba(247, 247, 244, 0.96);
    backdrop-filter: blur(12px);
  }

  .status-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 8px 14px;
    border: 1px solid var(--hairline-strong);
    background: var(--surface-card);
    font-size: 14px;
  }

  .status-bar__details {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-sm);
  }

  .status-bar--collapsed .status-bar__details {
    display: none;
  }

  .status-bar__group {
    min-width: 0;
  }

  .status-bar__runtime {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
  }

  .status-label {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
    letter-spacing: 0.88px;
    text-transform: uppercase;
  }

  .status-bar strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-weight: 500;
  }

  .badge-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11px;
    line-height: 1.4;
    font-weight: 600;
    letter-spacing: 0.88px;
    text-transform: uppercase;
    color: var(--ink);
  }

  .badge-pill--thinking {
    background: var(--timeline-thinking);
  }

  .badge-pill--read {
    background: var(--timeline-read);
  }

  .badge-pill--edit {
    background: var(--timeline-edit);
  }

  .badge-pill--done {
    background: var(--timeline-done);
    color: var(--on-primary);
  }

  @media (max-width: 980px) {
    .hero,
    .grid-layout {
      grid-template-columns: 1fr;
    }

    .hero {
      gap: var(--space-lg);
      padding-bottom: var(--space-xl);
    }
  }

  @media (max-width: 820px) {
    .sources-table {
      min-width: 0;
    }

    .rank-col {
      width: 56px;
    }

    .theater-col {
      width: calc((100% - 56px) / 3);
    }

    th,
    td {
      padding: 10px 8px;
    }

    .movie-chip {
      grid-template-columns: 1fr;
      gap: 4px;
    }

    .source-poster {
      display: none;
    }
  }

  @media (max-width: 640px) {
    .top-nav__inner,
    .app-shell {
      width: min(100% - 18px, 100%);
    }

    .app-shell {
      padding-top: 40px;
      padding-bottom: 132px;
    }

    .top-nav__links {
      gap: var(--space-sm);
    }

    h1 {
      font-size: 32px;
      letter-spacing: -1.2px;
    }

    .panel,
    .hero-actions {
      padding: 18px;
    }

    .hero-actions {
      justify-items: stretch;
    }

    #source-lag-text,
    #cgv-status-text {
      display: block;
      margin-left: 0;
      margin-top: 4px;
    }

    .panel-heading {
      flex-direction: column;
      align-items: start;
    }

    th,
    td {
      padding: 8px 6px;
      font-size: 12px;
    }

    .poster-cell {
      gap: 8px;
    }

    .poster-cell img {
      width: 36px;
      height: 52px;
    }

    .status-bar {
      gap: 8px;
      padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    }

    .status-toggle {
      display: inline-flex;
    }

    .status-bar__details {
      grid-template-columns: 1fr;
      gap: 8px;
    }

    .status-bar__runtime {
      justify-content: flex-start;
    }

    body.status-collapsed .app-shell {
      padding-bottom: 76px;
    }
  }

    @media (max-width: 640px) {
      .top-nav {
        height: auto;
      }

      .top-nav__inner {
        min-height: 64px;
        padding: 10px 0;
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 8px 12px;
      }

      .top-nav__links {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px 12px;
        font-size: 13px;
      }

      .hero-meta-pill {
        width: 100%;
      }

      .hero-meta-pill strong {
        font-size: 12px;
        overflow-wrap: anywhere;
      }

      .schedule-text {
        display: grid;
        gap: 4px;
        text-align: left;
      }

      .movie-title,
      .movie-title-link,
      .sources-table .movie-title,
      .sources-table .movie-title-link,
      .status-bar strong {
        overflow-wrap: anywhere;
        word-break: break-word;
      }

      .status-bar {
        padding-inline: 12px;
      }

      .status-toggle {
        width: 100%;
      }

      .status-bar__details {
        grid-template-columns: 1fr;
      }

      .status-bar__runtime {
        justify-content: flex-start;
      }
    }

  @media (max-width: 430px) {
    .top-nav__inner,
    .app-shell {
      width: min(100% - 12px, 100%);
    }

    .top-nav__links {
      display: none;
    }
  background: var(--timeline-read);
}

.badge-pill--edit {
  background: var(--timeline-edit);
}

.badge-pill--done {
  background: var(--timeline-done);
  color: var(--on-primary);
}

@media (max-width: 980px) {
  .hero,
  .grid-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-bottom: var(--space-xl);
  }
}

@media (max-width: 820px) {
  .sources-table {
    min-width: 0;
  }

  .rank-col {
    width: 56px;
  }

  .theater-col {
    width: calc((100% - 56px) / 3);
  }

  th,
  td {
    padding: 10px 8px;
    font-size: 12px;
  }

  .movie-chip {
    grid-template-columns: 1fr;
    gap: var(--space-xxs);
  }

  .source-poster {
    display: none;
  }

  .movie-title,
  .movie-title-link {
    font-size: 12px;
  }
}

@media (max-width: 640px) {
  .top-nav {
    position: static;
  }

  .top-nav__inner,
  .app-shell {
    width: min(100% - 18px, 100%);
  }

  .app-shell {
    padding-top: 40px;
    padding-bottom: 132px;
  }

  h1 {
    font-size: 32px;
    letter-spacing: -1.2px;
  }

  .hero-actions,
  .panel {
    padding: 18px;
  }

  .top-nav__links {
    gap: var(--space-sm);
  }

  .panel-heading {
    flex-direction: column;
    align-items: start;
  }

  .schedule-text {
    text-align: left;
  }

  #source-lag-text,
  #cgv-status-text {
    display: block;
    margin-left: 0;
    margin-top: 4px;
  }

  th,
  td {
    padding: 8px 6px;
    font-size: 11px;
  }

  .poster-cell {
    gap: var(--space-xs);
  }

  .poster-cell img {
    width: 36px;
    height: 52px;
  }

  .status-bar {
    gap: var(--space-xs);
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  }

  .status-toggle {
    display: inline-flex;
  }

  .status-bar__details {
    grid-template-columns: 1fr;
    gap: var(--space-xs);
  }

  .status-bar__runtime {
    justify-content: flex-start;
  }

  body.status-collapsed .app-shell {
    padding-bottom: 76px;
  }
}

@media (max-width: 430px) {
  .top-nav__inner,
  .app-shell {
    width: min(100% - 12px, 100%);
  }

  .top-nav__links {
    display: none;
  }
}

  .hero,
  .panel {
    padding: 14px;
  }

  h1 {
    font-size: 1.72rem;
  }

  .status-bar {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }

  body.status-collapsed .app-shell {
    padding-bottom: 72px;
  }
}

@media (max-width: 640px) {
  #ranking-table .ranking-movie-copy {
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  #ranking-table .ranking-title {
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    white-space: normal !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    text-align: center !important;
  }

  #ranking-table .ranking-title__line {
    white-space: nowrap !important;
  }
}