:root {
    --bg: #0a0b0e;
    --card: #13171e;
    --border: #232a36;
    --text: #dde3ec;
    --muted: #8b94a5;
    --red: #e05c55;
    --blue: #4e8de8;
    --green: #4caf7d;
}

* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 40px 16px 80px;
}

.wrap {
    max-width: 1040px;
    margin: 0 auto;
}

h1 {
    font-size: 30px;
    text-align: center;
    margin: 0 0 13px;
    color: var(--text);
}

h2 {
    font-size: 20px;
    margin: 48px 0 8px;
    text-align: center;
}

p.sub {
    color: var(--muted);
    font-size: 14px;
    text-align: center;
    margin: 0 0 18px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    margin: 0 auto 28px;
}

.ranking-card {
    max-width: 860px;
}

.view-more {
    display: block;
    margin: 10px auto 0;
    padding: 4px;
    background: none;
    border: 0;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
}

.view-more:hover {
    color: var(--text);
}

.view-more[hidden] {
    display: none;
}

.timeline-card {
    max-width: 900px;
}

.bubble-card {
    max-width: 752px;
}

.category-card {
    max-width: 800px;
}

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

table {
    border-collapse: collapse;
    font-size: 13px;
    width: 100%;
    table-layout: fixed;
}

.rank-column {
    width: 44px;
}

.poster-column {
    width: 92px;
}

th, td {
    padding: 5px 10px;
    text-align: left;
    border-top: 1px solid var(--border);
}

tbody tr:first-child td {
    border-top: 0;
}

th {
    color: var(--muted);
    font-weight: 500;
    border-top: none;
}

td.num, th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

td.poster-cell {
    padding: 3px 6px;
}

td img {
    width: 72px;
    height: 106px;
    object-fit: cover;
    border-radius: 5px;
    display: block;
}

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

a:hover {
    text-decoration: underline;
}

.about-links {
    margin: 0 auto;
    font-size: 15px;
    text-align: center;
    overflow-wrap: anywhere;
}

.about-links a {
    display: block;
    color: var(--blue);
    font-weight: 700;
}

.about-links a + a {
    margin-top: 6px;
}

.movie-link {
    display: block;
}

.apexcharts-marker, .apexcharts-datalabel {
    cursor: pointer;
}

.apexcharts-legend-series > .apexcharts-legend-marker {
    margin-right: 5px;
}

.movie-details {
    padding: 14px 12px;
}

.movie-details > .movie-link:first-child {
    font-weight: 600;
    line-height: 1.5;
}

.diff-track {
    position: relative;
    height: 32px;
    background: #232a36;
    border-radius: 5px;
    overflow: hidden;
    cursor: default;
}

.movie-details .diff-track {
    margin-top: 12px;
}

.diff-fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: 5px;
}

.diff-value {
    position: relative;
    display: block;
    padding: 7px 10px;
    text-align: right;
    font-weight: 600;
}

.movie-row {
    cursor: pointer;
    height: 130px;
}

.movie-row:hover, .movie-row:focus-within {
    background: #1d2430;
}

#score-tooltip {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    pointer-events: none;
    min-width: 190px;
    padding: 12px 16px;
    border: 1px solid #465268;
    border-radius: 10px;
    background: #202938;
    box-shadow: 0 8px 24px #0008;
    font-size: 13px;
    will-change: transform;
    contain: layout;
}

.score-line {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 3px 0;
}

.score-line span {
    color: var(--muted);
}

.movie-hover {
    display: flex;
    gap: 12px;
    align-items: center;
    max-width: 340px;
}

.movie-hover img {
    width: 72px;
    height: 106px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
}

.movie-hover-details {
    min-width: 190px;
}

.movie-hover-title {
    font-weight: 600;
    margin-bottom: 6px;
}

#chart-year-by-year {
    position: relative;
}

#chart-year-by-year {
    min-height: 795px;
}

#chart-plotted {
    position: relative;
    aspect-ratio: 1;
    min-height: 0;
}

.equality-line {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

#chart-genre {
    min-height: 627px;
}

#chart-decade {
    min-height: 675px;
}

#consensus-gallery {
    min-height: 600px;
}

.load-error {
    color: var(--red);
    padding: 16px;
}

#chart-genre, #chart-decade {
    position: relative;
}

.mean-arrows {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.mean-arrow {
    pointer-events: stroke;
}

.timeline-titles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.timeline-title {
    position: absolute;
    pointer-events: auto;
    font-size: 10px;
    line-height: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-title.left {
    text-align: right;
}

.apex-tip {
    display: flex;
    gap: 10px;
    padding: 10px;
    max-width: 300px;
    align-items: flex-start;
}

.apex-tip img {
    width: 62px;
    height: 92px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 4px;
}

.apex-tip > div {
    min-width: 0;
}

.apex-tip .tt {
    font-weight: 600;
    margin-bottom: 4px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.apex-tip .ts {
    color: #aab3c2;
    font-size: 12px;
    line-height: 1.5;
}

#consensus-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
    max-width: 910px;
    margin: 0 auto;
}

.consensus-card {
    width: 118px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    text-align: center;
}

.consensus-card img {
    width: 118px;
    height: 174px;
    object-fit: cover;
    display: block;
}

.consensus-card .consensus-title {
    font-size: 11px;
    font-weight: 600;
    padding: 6px 6px 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.consensus-card .consensus-scores {
    font-size: 11px;
    color: var(--green);
    padding-bottom: 7px;
}

.apexcharts-tooltip {
    background: #1d2430 !important;
    border: 1px solid var(--border) !important;
    transition: none !important;
}
