:root {
    --primary-color: #ffffff;
    --secondary-color: #a0a0a0;
    --accent-color: #e74c3c;
    --text-color: #e0e0e0;
    --card-bg: #2b2d31;
    --bg-color: #0a0a0a;
    --card-border: #3f4147;
    --font-base: 'Inter', sans-serif;
    --font-mono: 'Space Mono', monospace;
}

body {
    font-family: var(--font-base);
    margin: 0;
    padding: 0 4rem;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
}

header {
    font-family: var(--font-mono);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 4rem;
    box-sizing: border-box;
    background: var(--bg-color);
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
}

header::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(to bottom, var(--bg-color), transparent);
    pointer-events: none;
}

h1 {
    margin: 0;
    font-weight: 400;
    color: var(--secondary-color);
    font-size: 1rem;
    letter-spacing: 1px;
    pointer-events: auto;
    text-wrap: pretty;
}

.header-date {
    color: var(--secondary-color);
    font-size: 1rem;
    pointer-events: auto;
    text-align: right;
}

#ranking-container {
    width: 100%;
    max-width: 800px;
    margin: 160px auto 4rem; /* Increased top margin, centered */
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: row;
    height: 260px; /* Reduced height */
    width: 100%;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.card:hover,
.card:focus {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    outline: none;
}

#ranking-container:has(.card:hover) .card:not(:hover),
#ranking-container:has(.card:focus) .card:not(:focus) {
    opacity: 0.4;
}

.rank-indicator {
    position: absolute;
    top: 16px;
    left: 16px;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    z-index: 20;
}

.card-image-container {
    width: 60%;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.card-image-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.9);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

.card-image-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-40%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 14px 0 14px 24px;
    border-color: transparent transparent transparent rgba(255, 255, 255, 0.9);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    z-index: 11;
}

.card:hover .card-image-container::after,
.card:hover .card-image-container::before,
.card:focus .card-image-container::after,
.card:focus .card-image-container::before {
    opacity: 1;
}

.card:hover .card-image-container::after,
.card:focus .card-image-container::after {
    transform: translate(-50%, -50%) scale(1.1);
}

.card:hover .card-image-container::before,
.card:focus .card-image-container::before {
    transform: translate(-40%, -50%) scale(1.1);
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.film-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
    color: var(--primary-color);
    line-height: 1.2;
    text-decoration: none;
}

.card:hover .film-title,
.card:focus .film-title {
    text-decoration: underline;
}

.film-meta {
    font-size: 0.875rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.meta-item {
    display: flex;
    align-items: center;
}

.synopsis {
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 900px) {
    body {
        padding: 0 2rem;
    }
    
    header {
        padding: 2rem 2rem;
    }
    
    #ranking-container {
        margin: 160px auto 4rem; /* Maintain large top margin on mobile */
        max-width: 100%;
    }
    
    .card {
        height: auto; /* Allow auto height on mobile */
        flex-direction: column;
        width: 100%;
    }
    
    .card-image-container {
        width: 100%;
        height: 250px; /* Increased height for 60% visual proportion */
    }
}

@media (max-width: 600px) {
    body {
        padding: 0 1rem;
    }
    
    header {
        padding: 2rem 1rem;
    }
    
    .synopsis {
        font-size: 16px;
    }
}
