/* Sort buttons for table header */
.sort-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2em 0.4em;
    font-size: 1.1em;
    color: #764ba2;
    transition: color 0.2s;
    vertical-align: middle;
}
.sort-btn:hover {
    color: #495057;
}

/* Diagonal split sort cell */
.diagonal-sort-cell {
    position: sticky;
    left: 0;
    background: linear-gradient(135deg, #e0e7ff 0%, #ddd6fe 100%);
    min-width: 60px;
    max-width: 80px;
    height: 56px;
    padding: 0 !important;
    vertical-align: middle;
    overflow: hidden;
    border: 1px solid #c4b5fd;
    /* Tärkeä: sticky-asemointi että pysyy näkyvissä vaakasuuntaisessa skrollauksessa */
    z-index: 52; /* Korkeampi kuin th.movie-col (51) että pysyy päällä */
}

/* Diagonaalinen jakoviiva kolmioiden välissä */
.diagonal-sort-cell::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom right, transparent calc(50% - 1px), #c9b6f5 calc(50% - 1px), #c8b2fb calc(50% + 1px), transparent calc(50% + 1px));
    z-index: 1;
    pointer-events: none;
}

.sort-half {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    z-index: 2;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 92, 246, 0.15);
    transition: background 0.2s;
}

.sort-half-movie {
    left: 0;
    clip-path: polygon(0 0, 100% 0, 0 100%);
    align-items: flex-start;
    justify-content: flex-start;
    padding: 8px 0 0 8px;
}

.sort-half-critic {
    right: 0;
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0 8px 8px 0;
}

.sort-half:hover {
    background: rgba(139, 92, 246, 0.35);
}

.sort-half:active,
.sort-half.active {
    background: rgba(139, 92, 246, 0.55);
}

.sort-half:focus {
    outline: 2px solid #764ba2;
    outline-offset: -2px;
}

.sort-half svg {
    width: 24px;
    height: 24px;
    display: block;
    pointer-events: none;
}

.sort-half svg polygon {
    fill: #7c3aed;
    transition: fill 0.2s;
}

.sort-half:hover svg polygon {
    fill: #6d28d9;
}

/* Elokuvakritiikkien Kerääjä - Tyylit */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Bitter', Georgia, serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 1.25rem;
}

.container {
    max-width: 87.5rem;
    margin: 0 auto;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 3.75rem 1.875rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.25rem 1rem rgba(0,0,0,0.15);
    margin-bottom: 1.875rem;
    text-align: center;
    overflow: hidden;
    position: relative;
    /* Header ei ole sticky, koska se vie liikaa tilaa */
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%
    );
    animation: shimmer 3s infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

.header-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.875rem;
    position: relative;
    z-index: 1;
}

.header-text {
    flex-grow: 1;
    text-align: center;
}

h1 {
    font-family: 'Afacad', sans-serif;
    font-weight: 900;
    color: white;
    font-size: 4.5em;
    margin-bottom: 0.625rem;
    line-height: 1.1;
    text-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.2);
    transform: perspective(500px) rotateX(10deg);
    transition: transform 0.3s ease;
}

h1:hover {
    transform: perspective(500px) rotateX(-10deg) scale(1.02);
}

h2, h3, h4, h5, h6 {
    font-family: 'Afacad', sans-serif;
    font-weight: 700;
}

.subtitle {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.3em;
}

.header-stats {
    display: inline-block;
    margin-left: 1.5rem;
    font-size: 0.85em;
    opacity: 0.9;
}

.header-stat {
    display: inline-block;
    margin: 0 0.75rem;
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 1rem;
    white-space: nowrap;
}

.reset-button {
    background: white;
    color: #764ba2;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1em;
    font-weight: 700;
    border-radius: 0.5rem;
    cursor: pointer;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.reset-button:hover {
    transform: translateY(-0.125rem);
    box-shadow: 0 0.375rem 1rem rgba(0, 0, 0, 0.25);
    background: #f8f9fa;
}

.reset-button:active {
    transform: translateY(0);
}

.table-wrapper {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.1);
    /* Vaakasuuntainen skrollaus */
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
    /* Instant scrolling for smooth sync with sticky scrollbar */
    scroll-behavior: auto;
    -webkit-overflow-scrolling: touch;
    /* Hide the built-in scrollbar since we have a sticky one */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

/* Hide scrollbar for Chrome/Safari/Opera */
.table-wrapper::-webkit-scrollbar {
    display: none;
}

/* Sticky horizontal scrollbar container */
.sticky-scrollbar-container {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 200;
    background: #f5f5f5;
    border-top: 1px solid #dee2e6;
    scrollbar-width: thin;
    scrollbar-color: #667eea #e9ecef;
    scroll-behavior: auto; /* Disable smooth scrolling for instant response */
}

.sticky-scrollbar-container::-webkit-scrollbar {
    height: 12px;
}

.sticky-scrollbar-container::-webkit-scrollbar-track {
    background: #e9ecef;
}

.sticky-scrollbar-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    border: 2px solid #e9ecef;
}

.sticky-scrollbar-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.sticky-scrollbar-content {
    height: 1px;
}

/* Pystysuuntainen scrollbar (body/html) */
/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #667eea #e9ecef;
}

/* Webkit (Chrome, Safari, Edge) */
*::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

*::-webkit-scrollbar-track {
    background: #e9ecef;
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    border: 2px solid #e9ecef;
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Desktop: pidä vaakasuuntainen skrollaus */
@media (min-width: 769px) {
    .table-wrapper {
        overflow-x: auto;
        overflow-y: visible;
    }
}

/* Desktop: piilota mobiililiukusäädin */
@media (min-width: 769px) {
    .mobile-filter {
        display: none !important;
    }
    
    .mobile-reset-button {
        display: none !important;
    }
    
    .mobile-cards {
        display: none !important;
    }
}

/* Mobile: hide sticky scrollbar */
@media (max-width: 768px) {
    .sticky-scrollbar-container {
        display: none !important;
    }
}

table {
    width: 100%;
    border-collapse: collapse;
    position: relative;
}

tbody {
    /* Varmista että ensimmäinen rivi ei jää sticky thead:n alle */
    display: table-row-group;
}

tbody tr {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

tbody tr[style*="display: none"] {
    opacity: 0;
    transform: translateX(-10px);
}

thead {
    position: relative; /* Sticky ei toimi overflow:n sisällä, käytä JS:ää */
    z-index: 50;
    background: #f8f9fa;
    border-bottom: 0.125rem solid #dee2e6;
    box-shadow: 0 0.125rem 0.5rem rgba(0,0,0,0.1);
}

/* Varmista että thead-rivit ovat myös sticky */
thead tr {
    background: #f8f9fa;
}

thead th {
    background: #f8f9fa;
    transition: background-color 0.35s ease;
}

/* Hover-efekti ensimmäiselle th:lle (elokuva-sarake) */
thead th:first-child:hover {
    background: #e9ecef;
    cursor: default;
}

/* Hover-efekti kriitikkojen nimille (paitsi ensimmäinen sarake = elokuva-sarake) */
thead th:not(:first-child):hover {
    background: linear-gradient(135deg, #e8d5ff 0%, #d4bbff 100%) !important;
    cursor: pointer;
    font-weight: 900;
    transition: all 0.5s ease;
    
    transform: scale(1.02);
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
    z-index: 35;
}

/* Desktop suodattimet (NYT taulukon ULKOPUOLELLA) - sticky toimii */
.desktop-filters {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem; /* Väli taulukkoon */
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
    position: sticky; /* Sticky toimii, absolute-lapset myös */
    top: 0;
    z-index: 100; /* Ylimpänä kaikista */
    border-bottom: 2px solid #e9ecef;
    display: flex;
    align-items: flex-start; /* Tasaus ylhäältä */
    gap: 1.5rem;
}

.desktop-filters .reset-button {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    margin: 0;
    padding: 0.5rem 1rem;
    font-size: 0.9em;
}

/* Filter-rivi headerin sisällä (deprecated, käytä .desktop-filters) */
.filter-row {
    background: white;
    display: none; /* Piilotettu koska käytetään .desktop-filters */
}

.filter-header {
    padding: 0.75rem 1rem !important;
    border-bottom: 1px solid #e9ecef;
}

.filters-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    flex: 1;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.9em;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.filter-group label strong {
    display: inline-block;
    min-width: 5.5em;
    text-align: left;
}

#review-count-display {
    display: inline-block;
    min-width: 8em;
    text-align: left;
}

#star-filter-value {
    display: inline-block;
    min-width: 10.5em;
    text-align: left;
}

/* Mediasuodatin - pakota yhteen riviin */
.media-filter-buttons {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.4rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.25rem;
}

.media-filter-buttons::-webkit-scrollbar {
    height: 4px;
}

.media-filter-buttons::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.media-filter-btn {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 0.35rem 0.7rem;
    cursor: pointer;
    color: #333;
    font-size: 0.8em;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.media-filter-btn:hover {
    border-color: #667eea;
    background: #f0e6ff;
    transform: translateY(-1px);
}

.media-filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.review-count-filter-inline {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.review-count-filter-inline label {
    font-size: 0.95em;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    min-width: fit-content;
}

@media (max-width: 1200px) {
    .review-count-filter-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .slider-container {
        width: 100%;
        max-width: 100%;
    }
}

.filter-icon {
    font-size: 1.1em;
    margin-right: 0.3rem;
}

.slider-container {
    flex: 1;
    max-width: 400px;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 0.4rem;
    background: #ddd;
    outline: none;
    border-radius: 0.2rem;
    transition: background 0.3s;
    margin-bottom: 0.3rem;
    cursor: pointer;
}

.slider:hover {
    background: #ccc;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1.2rem;
    height: 1.2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 0.125rem 0.5rem rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

.slider::-moz-range-thumb {
    width: 1.2rem;
    height: 1.2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border-radius: 50%;
    border: none;
    box-shadow: 0 0.125rem 0.5rem rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.slider::-moz-range-thumb:active {
    transform: scale(1.1);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75em;
    color: #666;
    padding: 0 0.3rem;
}

th {
    padding: 0.625rem 0.5rem;
    text-align: left;
    font-weight: 600;
    color: #495057;
    font-size: 0.85em;
    max-width: 6.25em;
    word-wrap: break-word;
    line-height: 1.3;
    vertical-align: top;
}

th.movie-col {
    width: 16rem;
    min-width: 16rem;
    max-width: 16rem;
    position: sticky;
    left: 0;
    background: #f8f9fa;
    z-index: 51; /* Korkeampi kuin thead (50) että pysyy päällä */
    white-space: nowrap;
    user-select: none;
    transition: background-color 0.2s;
    text-align: center;
    vertical-align: middle;
    font-family: 'Afacad', sans-serif;
    /* Varmista että varjo näkyy vaakasuuntaisessa skrollauksessa */
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

th.movie-col:hover {
    background: #e9ecef;
    cursor: pointer;
}

th.rating-cell {
    background: #f8f9fa;
    user-select: none;
    transition: background-color 0.2s;
    min-width: 5.9em;
}

th.rating-cell:hover {
    background: rgba(139, 92, 246, 0.2);
    cursor: pointer;
}

td.rating-cell {
    min-width: 5.9em;
}

/* Filler-sarake vie kaiken jäljellä olevan tilan */
th.filler-column,
td.filler-column {
    width: 100%;
    min-width: 0;
    max-width: none;
}

th .critic-media {
    display: block;
    font-size: 0.7em;
    font-weight: normal;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* Vuorottelevat taustavärit sarakkeille - parempi kontrasti */
th:nth-child(even):not(.movie-col) {
    background: #e3f2fd;
}

th:nth-child(even):not(.movie-col):hover {
    background: rgba(139, 92, 246, 0.2);
    cursor: pointer;
}

td:nth-child(even) {
    background: #f5faff;
}

tbody tr:hover td:nth-child(even) {
    background: #e3f2fd;
}

/* Luokkapohjaiset väritykset (korvaavat nth-child kun sarakkeita piilotetaan) */
th.even-column:not(.movie-col) {
    background: #e3f2fd !important;
}

th.even-column:not(.movie-col):hover {
    background: rgba(139, 92, 246, 0.2) !important;
}

td.even-column {
    background: #f5faff !important;
}

tbody tr:hover td.even-column {
    background: #e3f2fd !important;
}

th.odd-column:not(.movie-col) {
    background: transparent !important;
}

th.odd-column:not(.movie-col):hover {
    background: rgba(139, 92, 246, 0.15) !important;
}

td.odd-column {
    background: transparent !important;
}

tbody tr:hover td.odd-column {
    background: #f8f9fa !important;
}

tbody tr {
    border-bottom: 0.0625rem dashed #666;
    transition: background-color 0.15s;
}

tbody tr:hover {
    background: transparent;
}

/* Desktop: Poista katkoviiva viimeiseltä riviltä */
@media (min-width: 769px) {
    tbody tr:last-child {
        border-bottom: none;
    }
}

tbody tr:hover td {
    background: #f8f9fa;
}

tbody tr:hover td:nth-child(even) {
    background: #e3f2fd;
}

td {
    padding: 1rem 0.5rem;
    vertical-align: top;
}

td.movie-col {
    color: #212529;
    position: sticky;
    left: 0;
    background: white;
    border-right: 0.125rem solid #e9ecef;
    padding: 1rem 0.625rem;
    width: 16rem;
    min-width: 16rem;
    max-width: 16rem;
    overflow: visible;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.3;
    z-index: 25;
    box-shadow: 2px 0 4px rgba(0,0,0,0.05);
    user-select: none;
    font-size: 1.0em;
}

td.movie-col:hover {
    background: linear-gradient(135deg, #e8d5ff 0%, #d4bbff 100%) !important;
    cursor: pointer;
    font-weight: 600;
    transform: scale(1.02);
    transition: all 0.25s ease;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
    z-index: 30;
}

/* Hover-tilassa nosta z-index korkeammalle */
tbody tr:hover td.movie-col {
    background: #f8f9fa;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    z-index: 200;
}

/* Posterikuva - PIILOTETTU oletuksena */
.movie-poster {
    position: absolute;
    top: 100%; /* Rivin alapuolelle */
    left: 0;
    max-width: 14rem !important;
    width: 14rem;
    height: auto;
    display: none; /* Piilotettu oletuksena */
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 250;
    background: white;
    padding: 6px;
    margin-top: 0.5rem;
}

/* Näytä posteri kun hoveroidaan RIVIN yli TAI kun rivi on valittu */
tbody tr:hover .movie-poster,
tbody tr:not(.dimmed) .movie-poster {
    display: block;
}

/* UUSI: Erillinen poster-rivi */
.poster-row {
    background: white;
}

.poster-row td {
    padding: 0;
    border: none;
}

.poster-row td:first-child {
    padding: 1rem;
    position: sticky;
    left: 0;
    background: white;
    z-index: 25;
    box-shadow: 2px 0 4px rgba(0,0,0,0.05);
}

.poster-row-empty {
    background: transparent !important;
}

.movie-poster-inline {
    max-width: 14rem;
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    background: white;
    padding: 6px;
}

/* Elokuvan nimi */
.movie-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

/* Elokuvan nimi teksti (kun linkit näkyvät samassa solussa) */
.movie-title-text {
    font-weight: 600;
    line-height: 1.3;
}

/* Linkkien container */
.movie-links {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Linkkityylit */
.movie-link {
    display: inline-block;
    font-size: 0.85em;
    text-decoration: none;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.movie-link:hover {
    opacity: 0.7;
}

.nytleffaan-link {
    color: #059669;
}

.letterboxd-link {
    color: #8b5cf6;
}

tbody tr:hover td.movie-col {
    background: #f8f9fa;
    /* Pidä varjo näkyvissä hover-tilassa */
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

/* Himmennys/piilotus-efektit */
tr.dimmed {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    /* ÄLÄ käytä display: none - se piilottaisi myös absoluuttiset lapset */
    max-height: 0;
    overflow: visible !important; /* Tärkeä - posteri voi vuotaa ulos */
}

/* Posterit näkyvät aina kun niiden pitää näkyä */
.movie-poster {
    pointer-events: auto !important;
}

th.dimmed,
td.dimmed {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Sarakkeiden piilotus filttereiden perusteella */
th.filter-hidden,
td.filter-hidden {
    display: none !important;
}

tr:not(.dimmed) {
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.3s ease;
}

th:not(.dimmed),
td:not(.dimmed) {
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.3s ease;
}

.rating-cell {
    text-align: center;
    min-width: 5em;
    max-width: 6.25em;
    cursor: pointer;
    transition: background-color 0.2s ease;
    padding: 0.5rem 0.25rem;
    vertical-align: middle;
}

.rating-cell:has(.rating-stars):hover {
    background: #f39c12 !important;
}

.rating-cell:has(.rating-stars):hover .rating-stars {
    color: white !important;
}

.rating-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit;
    padding: 0.25rem;
    min-height: 2.5rem;
    height: 100%;
}

.rating-stars {
    color: #f39c12;
    font-size: 1.1em;
    letter-spacing: 0.0625rem;
    display: inline-block;
    transition: color 0.2s ease;
}

.pub-badge {
    display: inline-block;
    font-size: 0.7em;
    font-weight: bold;
    color: #666;
    background: #e9ecef;
    padding: 0.15em 0.4em;
    border-radius: 0.25em;
    margin-left: 0.3em;
    vertical-align: middle;
}

.no-rating {
    color: #adb5bd;
    font-size: 0.85em;
    font-style: italic;
}

.empty-state {
    text-align: center;
    padding: 3.75rem 1.25rem;
    background: white;
    border-radius: 0.5rem;
}

.empty-state h2 {
    color: #666;
    margin-bottom: 0.625rem;
}

footer {
    border-radius: 0.1rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.1);
    margin-top: 1.5rem;
    padding: 1.5rem 1.875rem;
    /* Footer pysyy näkyvissä vaakasuuntaisen skrollauksen aikana */
    position: relative;
    z-index: 5;
}

.footer-content {
    max-width: 56.25rem;
    margin: 0 auto;
}

.footer-content h3 {
    text-align: center;
    color: #333;
    font-size: 1.5em;
    margin-bottom: 1.875rem;
}

.footer-content h4 {
    color: #555;
    font-size: 1.1em;
    margin-bottom: 0.9375rem;
    margin-top: 1.875rem;
}

.stats {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    margin-bottom: 1.875rem;
}

.stat-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.25rem 1.875rem;
    border-radius: 0.625rem;
    text-align: center;
    box-shadow: 0 0.25rem 0.375rem rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.stat-box:hover {
    transform: translateY(-0.25rem);
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
    margin-top: 0.3125rem;
}

.rating-distribution {
    max-width: 37.5rem;
    margin: 1.875rem auto;
}

.rating-bars {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rating-bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rating-stars-label {
    color: #f39c12;
    font-size: 1.1em;
    min-width: 5em;
    text-align: right;
}

.rating-bar-container {
    flex: 1;
    height: 1.5rem;
    background: #e9ecef;
    border-radius: 0.75rem;
    overflow: hidden;
    position: relative;
}

.rating-bar {
    height: 100%;
    background: linear-gradient(90deg, #f39c12 0%, #e67e22 100%);
    border-radius: 0.75rem;
    transition: width 0.3s ease;
    box-shadow: inset 0 0.125rem 0.25rem rgba(0,0,0,0.1);
}

.rating-count {
    min-width: 1.875rem;
    text-align: right;
    color: #666;
    font-weight: 600;
}

.publication-stats {
    max-width: 31.25rem;
    margin: 1.875rem auto;
}

.pub-stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.9375rem;
}

.pub-stat-item {
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    border: 0.125rem solid #e9ecef;
    transition: all 0.2s;
}

.pub-stat-item:hover {
    border-color: #667eea;
    transform: translateY(-0.125rem);
    box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.1);
}

.pub-name {
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    flex-shrink: 0;
}

.pub-count {
    background: #667eea;
    color: white;
    padding: 0.25rem 0.625rem;
    border-radius: 0.75rem;
    font-size: 0.85em;
    font-weight: 600;
    flex-shrink: 0;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    margin-top: 2.5rem;
    padding-top: 1.875rem;
    border-top: 0.0625rem solid #e9ecef;
}

.footer-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.footer-link:hover {
    background: #667eea;
    color: white;
}

.last-updated {
    text-align: center;
    color: #6c757d;
    font-size: 0.85em;
    font-style: italic;
}

.last-updated p {
    margin: 0;
    opacity: 0.8;
}

@media (max-width: 768px) {
    footer {
        padding: 1.875rem 1.25rem;
    }
    
    /* Piilota desktop-suodatin ja desktop-only elementit, näytä mobile-suodatin */
    .desktop-filters,
    .desktop-only {
        display: none !important;
    }
    
    .filter-row {
        display: none;
    }
    
    .mobile-filter {
        display: block !important;
        margin: 0.5rem 0.5rem 1rem 0.5rem;
        position: sticky;
        top: 0.5rem;
        z-index: 15;
        background: transparent;
        padding: 0;
        transition: top 0.2s ease;
    }
    
    .mobile-filter-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
        border: none;
        padding: 0.875rem 1.25rem;
        width: 100%;
        border-radius: 0.75rem;
        box-shadow: 0 0.25rem 0.5rem rgba(139, 92, 246, 0.3);
        cursor: pointer;
        font-size: 1em;
        font-weight: 700;
        color: white;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        transition: all 0.2s ease;
    }
    
    .mobile-filter-toggle:active {
        transform: translateY(2px);
        box-shadow: 0 0.125rem 0.25rem rgba(139, 92, 246, 0.3);
    }
    
    .toggle-icon {
        font-size: 1.2em;
        transition: transform 0.3s ease;
    }
    
    .mobile-filter.collapsed .toggle-icon {
        transform: rotate(180deg);
    }
    
    .mobile-filters-container {
        background: linear-gradient(135deg, #e0e7ff 0%, #ddd6fe 100%);
        border: 2px solid #c4b5fd;
        padding: 1rem 1.25rem;
        border-radius: 0.75rem;
        margin-top: 0.5rem;
        box-shadow: 0 0.5rem 1rem rgba(139, 92, 246, 0.25), 0 0.25rem 0.5rem rgba(139, 92, 246, 0.15);
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        max-height: 1000px;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease, opacity 0.3s ease;
    }
    
    .mobile-filter.collapsed .mobile-filters-container {
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-top: 0;
        opacity: 0;
    }
    
    .mobile-reset-button {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
        border: none;
        padding: 0.875rem 1.25rem;
        width: calc(100% - 1rem);
        margin: 0.5rem 0.5rem 0 0.5rem;
        border-radius: 0.75rem;
        box-shadow: 0 0.25rem 0.5rem rgba(245, 158, 11, 0.3);
        cursor: pointer;
        font-size: 1em;
        font-weight: 700;
        color: white;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        transition: all 0.2s ease;
        position: sticky;
        /* Collapsed hakukortti on n. 3.5rem korkea (0.875rem padding * 2 + 1em teksti + 0.5rem ylä-margin)
           + 0.5rem väli = 4rem */
        top: 4rem;
        z-index: 14; /* Alle hakukortin (z-index: 15) */
    }
    
    .mobile-reset-button:active {
        transform: translateY(2px);
        box-shadow: 0 0.125rem 0.25rem rgba(245, 158, 11, 0.3);
    }
    
    .mobile-filter-group {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .mobile-filter-group.mobile-filter-inline {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
    }
    
    .mobile-filter-group.mobile-filter-inline label {
        flex-shrink: 0;
        white-space: nowrap;
        font-size: 0.9em;
    }
    
    .mobile-stepper {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex: 1;
        justify-content: flex-end;
    }
    
    .stepper-btn {
        width: 44px;
        height: 44px;
        border: 2px solid #8b5cf6;
        background: white;
        border-radius: 8px;
        font-size: 1.5em;
        font-weight: bold;
        color: #8b5cf6;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    .stepper-btn:active {
        background: #8b5cf6;
        color: white;
        transform: scale(0.95);
    }
    
    .stepper-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }
    
    .stepper-value {
        min-width: 60px;
        text-align: center;
        font-weight: 600;
        font-size: 1em;
        color: #333;
    }
    
    .mobile-filter-group.mobile-filter-inline .slider-container-inline {
        flex: 1;
        min-width: 120px;
    }
    
    .mobile-sort-button {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        background: transparent;
        border: 1px solid #ddd;
        padding: 0.5rem 1rem;
        border-radius: 0.375rem;
        font-size: 0.85em;
        font-weight: 500;
        color: #666;
        cursor: pointer;
        transition: all 0.2s ease;
        width: 100%;
    }
    
    .mobile-sort-button:active {
        background: #f5f5f5;
        border-color: #8b5cf6;
        color: #8b5cf6;
    }
    
    .mobile-sort-button .sort-icon {
        font-size: 1.1em;
        opacity: 0.7;
    }
    
    .mobile-filter-group label {
        display: block;
        font-size: 0.9em;
        font-weight: 600;
        color: #333;
    }
    
    .mobile-filter-group label strong {
        display: inline-block;
        min-width: 5.5em;
        text-align: left;
    }
    
    /* Grid layout muuttuu yhdeksi sarakkeeksi mobiililla */
    .filters-container {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .mobile-sort-button {
        transition: all 0.2s ease;
    }
    
    .mobile-sort-button:hover {
        background: #e9ecef !important;
        transform: translateY(-2px);
        box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.1);
    }
    
    .mobile-sort-button:active {
        transform: translateY(0);
        box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.1);
    }
    
    .stats {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .stat-box {
        flex: 1;
        min-width: 7.5rem;
        padding: 1rem 1.25rem;
    }
    
    .stat-number {
        font-size: 2em;
    }
    
    .rating-stars-label {
        min-width: 3.75rem;
        font-size: 1em;
    }
    
    .pub-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-links {
        flex-direction: column;
        gap: 0.625rem;
    }
    
    .footer-link {
        text-align: center;
    }
}

/* Korttinäkymä mobiilille */
.mobile-cards {
    display: none;
}

.movie-card {
    background: white;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.1);
}

.movie-card-header {
    background: #f8f9fa;
    padding: 1rem;
    border-bottom: 0.125rem solid #dee2e6;
}

.movie-card-title-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.movie-card-title {
    font-size: 1.4em;
    font-weight: 600;
    color: #212529;
    line-height: 1.3;
    flex: 1;
}

.movie-card-poster {
    width: 100%;
    max-width: 120px;
    height: auto;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
    float: right;
    margin-left: 1rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.movie-card-body {
    padding: 0.75rem;
}

.review-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 0.0625rem solid #e9ecef;
    transition: background-color 0.15s;
}

.review-item:last-child {
    border-bottom: none;
}

.review-item:hover {
    background: #f8f9fa;
}

.review-rating {
    flex-shrink: 0;
    margin-right: 1rem;
    font-size: 1.2em;
    color: #f39c12;
    letter-spacing: 0.0625rem;
    min-width: 6.25rem;
}

.review-rating a {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 1.25rem;
    transition: all 0.2s ease;
    color: #f39c12;
}

.review-rating a:hover {
    background: #f39c12;
    color: white !important;
    transform: scale(1.05);
    box-shadow: 0 0.125rem 0.5rem rgba(243, 156, 18, 0.3);
}

.review-critic {
    flex-grow: 1;
    color: #495057;
    font-size: 0.95em;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
}

.review-critic:hover {
    background-color: rgba(139, 92, 246, 0.08);
}

.review-critic-name {
    font-weight: 500;
    color: #212529;
    transition: all 0.2s ease;
}

.review-critic:hover .review-critic-name {
    color: #8b5cf6;
}

.review-media {
    color: #6c757d;
    font-size: 0.85em;
    margin-left: 0.25rem;
}

@media (max-width: 768px) {
    header {
        padding: 2rem 1.25rem;
    }
    
    h1 {
        font-size: 2.5em;
    }
    
    .subtitle {
        font-size: 1em;
    }
    
    .header-content {
        flex-direction: column;
        align-items: center;
        gap: 1.25rem;
    }
    
    .reset-button {
        display: none !important; /* Piilotettu mobiilissa, käytä .mobile-reset-button */
    }
    
    .stats {
        flex-wrap: wrap;
    }
    
    /* Piilota taulukko mobiililla */
    .table-wrapper {
        display: none;
    }
    
    /* Poista sticky-asemointi mobiililla (vaikka taulukko on piilotettu) */
    thead {
        position: static;
    }
    
    /* Näytä kortit mobiililla */
    .mobile-cards {
        display: block;
    }
    
    /* Näytä sorttausnappi mobiililla */
    .mobile-sort-button {
        display: block !important;
    }
    
    /* Mobiili movie card layout */
    .movie-card-title-row {
        align-items: flex-end;
    }
    
    .movie-card-title {
        font-size: 1.6em;
    }
    
    .movie-card-poster {
        max-width: 100px;
        margin-left: 0;
        margin-bottom: 0;
        float: none;
        align-self: flex-end;
    }
}

.movie-card-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    justify-content: center;
}

.movie-link {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nytleffaan-link {
    background: #28a745;
    color: white;
}

.nytleffaan-link:hover {
    background: #218838;
    transform: translateY(-1px);
}

.letterboxd-link {
    background: #8b5cf6;
    color: white;
}

.letterboxd-link:hover {
    background: #7c3aed;
    transform: translateY(-1px);
}

/* Korostusluokat facet-hakuun */
.movie-col.selected {
    font-weight: 700 !important;
    background: rgba(139, 92, 246, 0.1) !important;
}

th.rating-cell.selected {
    font-weight: 700 !important;
    background: rgba(139, 92, 246, 0.15) !important;
}

.review-critic-name.selected {
    font-weight: 700 !important;
    color: #8b5cf6 !important;
}
