

@import url('https://fonts.cristianobleve.com/aeonik/stylesheet.css');
@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
:root {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --surface: rgba(255, 255, 255, 0.05);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.192);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-tertiary: rgba(255, 255, 255, 0.4);
    --accent: #3099d6;
    --accent-hover: #1064ff;
    --success: #225e25;
    --error: rgb(255, 80, 80);
    --bg-error-message: rgba(255, 80, 80, 0.1);
    --border-error-message: rgba(255, 80, 80, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.16);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.24);
}

body {
    font-family: 'Figtree', 'Inter', 'Aeonik', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button{
    font-family: 'Figtree', 'Inter', 'Aeonik', sans-serif;
}

input, select, textarea {
    font-family: 'Figtree', 'Inter', 'Aeonik', sans-serif;
}

.screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

/* ===== LOGIN SCREEN ===== */

.login-container {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-width: 420px;
    width: 90%;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-container h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    font-size: 0.95rem;
    font-weight: 400;
}

.login-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.or-separator {
    text-align: center;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: .15em;
    color: var(--text-tertiary);
    margin: .5rem 0 .25rem;
}

.email-auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.25rem;
}

.email-auth-form input {
    padding: 0.65rem 0.85rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: .9rem;
}

.email-auth-form input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-secondary);
}

.email-auth-actions {
    display: flex;
    gap: 0.5rem;
}

.login-btn.alt {
    background: var(--surface);
    border: 1px solid var(--border);
}

.login-btn.alt:hover {
    background: var(--surface-hover);
    border-color: var(--text-tertiary);
}

.email-auth-message {
    min-height: 18px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0 2px;
}

.email-auth-message.error { color: #ff5c5c; }
.email-auth-message.success { color: #10b981; }

.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--surface);
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

.login-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.login-btn:hover::before {
    transform: translateX(100%);
}

.login-btn:hover {
    background: var(--surface-hover);
    border-color: var(--text-tertiary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn svg {
    flex-shrink: 0;
}

/* ===== APP SCREEN ===== */

.app-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.header-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-left { justify-self: start; }
.header-center { justify-self: center; text-align: center; }
.header-right { justify-self: end; }

.app-title {
    font-family: 'Aeonik Extended PRO Trial', sans-serif;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
}


.header-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Mobile menu toggle (hamburger) */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
}

.mobile-menu-toggle:hover {
    background: var(--surface);
    color: var(--text-primary);
    border-color: var(--accent);
}

.mobile-menu-toggle svg { display: block; }

/* Mobile dropdown menu */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
    display: none;
    z-index: 999;
}

.mobile-menu {
    position: fixed;
    left: 12px;
    top: 64px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 220px;
    padding: 0.5rem;
    display: none;
    z-index: 1000;
}

.mobile-menu.open,
.mobile-menu-overlay.open { display: block; }

.mobile-menu a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.7rem;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
}

.mobile-menu a:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.mobile-menu .divider {
    height: 1px;
    background: var(--border);
    margin: 0.4rem 0;
}

.app-brand {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    font-size: 0.938rem;
}

.app-brand:hover {
    color: var(--text-primary);
    border-color: var(--border);
    background: var(--surface);
}

.header-content h1 {
    font-family: 'Aeonik Extended PRO Trial', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.user-info {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.2s, border-color 0.2s;
}

.user-info:hover {
    background: var(--surface);
    border: 1px solid var(--border);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border);
    object-fit: cover;
}

#userGreeting {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.logout-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--surface);
    border-color: var(--text-tertiary);
    color: var(--text-primary);
}

/* ===== ADD FILM SECTION ===== */

.add-film-section {
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border-radius: 12px;
    margin: 2rem 0;
}

.add-film-section h2 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.add-film-form {
    display: grid;
    grid-template-columns: 2fr 1fr 2fr 1fr;
    gap: 0.75rem;
}

.add-film-form input {
    padding: 0.625rem 0.875rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: all 0.2s;
}

.add-film-form input::placeholder {
    color: var(--text-tertiary);
}

.add-film-form input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-secondary);
}

.add-film-form button {
    padding: 0.625rem 1.5rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: all 0.2s;
}

.add-film-form button:hover {
    background: var(--accent-hover);
}

.add-film-form button:active {
    transform: scale(0.98);
}

/* ===== FILMS SECTION ===== */

.films-section {
    margin: 3rem 0;
}

.films-section h2 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.films-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

/* Ranking */
.ranking-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: .5rem;
}

/* Wheel desktop-only warning */
.desktop-only-warning {
    display: none;
    padding: 0 1.5rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.desktop-only-warning .warning-box {
    margin: 0 auto;
    justify-content: center;
    align-items: center;
    gap: .5rem;
    background: var(--bg-error-message);
    border: 1px solid var(--border-error-message);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    color: var(--text-secondary);
}

.warning-box {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .5rem;
}

.ranking-row {
    display: grid;
    grid-template-columns: 48px 64px 1fr 80px 80px;
    align-items: center;
    gap: .75rem;
    padding: .6rem .8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background .2s, border-color .2s, transform .1s;
}

.ranking-row:hover { background: var(--surface-hover); border-color: var(--text-tertiary); transform: translateY(-1px); }
.ranking-row .pos { font-weight: 700; font-size: 1.1rem; color: var(--text-secondary); text-align: center; }
.ranking-row .pos.gold { color: #FFD700; text-shadow: 0 0 8px rgba(255, 220, 19, 0.63); }
.ranking-row .pos.silver { color: #9c9c9c; text-shadow: 0 0 8px rgba(192, 192, 192, 0.5); }
.ranking-row .pos.bronze { color: #e6811d; text-shadow: 0 0 8px rgba(205, 127, 50, 0.5); }
.rk-poster { width: 64px; height: 96px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.rk-title { font-weight: 600; letter-spacing: -.01em; }
.rk-votes { color: var(--text-secondary); text-align: right; }
.rk-score { font-weight: 700; color: var(--accent); text-align: right; font-size: 1.15rem; }

/* Best film banner */
.best-film-banner {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.9rem 1rem;
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.08), rgba(255, 215, 0, 0.06));
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
    margin-bottom: 1rem;
}
.best-film-banner .bf-label {
    font-weight: 700;
    color: #ffd700;
    white-space: nowrap;
}
.best-film-banner .bf-poster {
    width: 48px;
    height: 72px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border);
}
.best-film-banner .bf-info { display: flex; flex-direction: column; gap: 2px; }
.best-film-banner .bf-title {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.best-film-banner .bf-title:hover { text-decoration: underline; }
.best-film-banner .bf-meta { color: var(--text-secondary); font-size: 0.95rem; }

@media (max-width: 600px) {
  .ranking-row { grid-template-columns: 40px 52px 1fr 62px 62px; padding: .5rem .6rem; }
  .rk-poster { width: 52px; height: 78px; }
  .rk-score { font-size: 1rem; }
}

/* Hide wheel section on mobile; show warning instead */
@media (max-width: 968px) {
    .wheel-page { display: none; }
    .desktop-only-warning {height: 80vh; display: flex; align-items: center; justify-content: center; }
}

/* Figma-style film card */
.film-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 2 / 3;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    animation: fadeInUp 0.3s ease;
}

/* Average rating badge */
.film-card-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: .03em;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: background .2s, border-color .2s;
}

.film-card-badge .badge-score { font-weight:700; font-size:0.9rem; }
.film-card-badge .badge-scale { font-size:0.6rem; opacity:.55; }
.film-card-badge .badge-votes { display:none; font-size:0.55rem; opacity:.7; text-transform:uppercase; letter-spacing:.08em; }
.film-card:hover .film-card-badge .badge-votes { display:inline; }

/* Tier colors */
.film-card-badge.rating-high { border-color: rgba(16,185,129,0.5); box-shadow: 0 0 0 1px rgba(16,185,129,0.4), 0 4px 12px rgba(0,0,0,0.4); }
.film-card-badge.rating-high .badge-score { color:#10b981; }
.film-card-badge.rating-mid { border-color: rgba(245,158,11,0.4); }
.film-card-badge.rating-mid .badge-score { color:#f59e0b; }
.film-card-badge.rating-low { border-color: rgba(239,68,68,0.45); }
.film-card-badge.rating-low .badge-score { color:#ef4444; }
.film-card-badge.rating-none { opacity:.6; }

.film-card-badge span {
    font-weight: 700;
    font-size: 0.9rem;
}

.film-card:hover .film-card-badge {
    background: rgba(0,0,0,0.75);
    border-color: var(--text-tertiary);
}

.film-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--text-tertiary);
}

.film-card-bg {
    position: absolute;
    inset: 0;
}

.film-card-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.film-card-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 10%, rgb(0 0 0 / 65%) 50%, rgba(0, 0, 0, 100%) 90%);
}

.film-card-bottom {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1.25rem 1rem 1.1rem;
    text-align: center;
}

.film-card-title {
    font-family: 'Aeonik', sans-serif;
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: #fff;
}

.film-card-year {
    font-family: 'Aeonik', sans-serif;
    font-weight: 400;
    margin-top: 0.25rem;
    font-size: 0.95rem;
    color: var(--text-tertiary);
}

.film-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.stat {
    flex: 1;
    text-align: center;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.vote-section {
    margin-top: 1rem;
}

.vote-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.vote-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.vote-controls input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: all 0.2s;
}

.vote-controls input:focus {
    outline: none;
    border-color: var(--accent);
}

.vote-controls button {
    padding: 0.5rem 1.25rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.vote-controls button:hover {
    background: var(--accent-hover);
}

.vote-controls button:active {
    transform: scale(0.98);
}

.vote-controls button:disabled {
    background: var(--surface);
    cursor: not-allowed;
    opacity: 0.5;
}

.your-vote {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-align: center;
}

.your-vote strong {
    color: var(--accent);
}

/* ===== LOADING SPINNER ===== */

.spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}

.spinner-circle {
    width: 48px;
    height: 48px;
    border: 3px solid var(--surface);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    .header-content {
        flex-direction: row;
        gap: 1rem;
    }

    .header-content h1 {
        font-size: 1.25rem;
    }

    #userGreeting {
        display: none;
    }

    .films-grid {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    }

    .add-film-form {
        grid-template-columns: 1fr;
    }

    .login-container {
        padding: 2rem 1.5rem;
    }
}

/* Extra small devices */
@media (max-width: 600px) {
    .film-hero { padding: 6rem 1.25rem 3rem; }
    .film-title-large { font-size: 1.9rem; }
    .film-poster-large { width: 200px; }
    .film-meta { gap: 0.6rem; }
    .film-rating-summary { flex-direction: row; gap: 1.25rem; justify-content: center; }
    .rating-value { font-size: 1.6rem; }
    .vote-input-group input { width: 65px; padding: 0.6rem; }
    .btn-primary { padding: 0.6rem 1.1rem; font-size: 0.85rem; }
    .voters-cluster { padding: 0.3rem 0.45rem 0.3rem 0.3rem; }
    .avatar-item { width: 32px; height: 32px; }
    .avatar-stack .avatar-item:not(:first-child) { margin-left: -12px; }
    .voters-text { font-size: 0.72rem; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
    .film-card { aspect-ratio: 9 / 14; }
    .film-card-title { font-size: 1.35rem; }
    .film-card-badge { padding: 0.3rem 0.55rem; font-size: 0.7rem; }
    .film-card-badge .badge-score { font-size: 0.75rem; }
    .film-card-badge .badge-scale { display:none; }
}

/* Between small and tablet: keep two columns for better density */
@media (min-width: 600px) and (max-width: 968px) {
    .films-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

/* ===== SCROLLBAR ===== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--surface);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--surface-hover);
}

/* ===== FILM DETAIL PAGE ===== */

.film-detail-page {
    min-height: 100vh;
    background: var(--bg-primary);
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.back-button:hover {
    background: var(--surface-hover);
    border-color: var(--text-tertiary);
}

.film-hero {
    position: relative;
    padding: 8rem 2rem 4rem;
    min-height: 70vh;
}

.film-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.film-backdrop img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(20px);
}

.backdrop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, 
        rgba(0, 0, 0, 0.3) 0%, 
        rgba(0, 0, 0, 0.8) 50%,
        var(--bg-primary) 100%);
}

.film-hero-content {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 3rem;
    align-items: flex-start;
}

.film-poster-container {
    flex-shrink: 0;
}

.film-poster-large {
    width: 300px;
    height: auto;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    border: 3px solid var(--border);
}

.film-info-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.film-title-large {
    font-family: 'Aeonik', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.1;
}

.film-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.meta-item {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.meta-item:not(:last-child)::after {
    content: "•";
    margin-left: 1rem;
    color: var(--text-tertiary);
}

.genres-list {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.genre-tag {
    padding: 0.25rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.813rem;
    color: var(--text-secondary);
}

.film-rating-summary {
    display: flex;
    gap: 2rem;
    margin: 1rem 0;
}

.rating-box {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.rating-label {
    font-size: 0.813rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rating-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.vote-section-large {
    margin-top: 1rem;
}

.vote-section-large label {
    display: block;
    font-size: 0.813rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.vote-input-group {
    display: flex;
    gap: 0.75rem;
}

.vote-input-group input {
    width: 80px;
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    text-align: center;
}

.vote-input-group input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Voters cluster (film detail) */
.voters-cluster {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-top: 0.25rem;
    padding: 0.35rem 0.5rem 0.35rem 0.35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    width: fit-content;
    cursor: pointer;
    transition: all 0.2s;
}

.voters-cluster:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.voters-cluster:active {
    transform: translateY(0);
}

.avatar-stack {
    display: flex;
    position: relative;
    padding-left: 0.25rem;
}

.avatar-item {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--bg-primary);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    background: var(--surface);
    transition: transform .15s, box-shadow .15s;
}

.avatar-stack .avatar-item:not(:first-child) {
    margin-left: -14px;
}

.avatar-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 20 !important;
}

.voters-text {
    font-size: 0.813rem;
    white-space: nowrap;
    color: var(--text-secondary);
    padding-right: 0.75rem;
    letter-spacing: .02em;
}

.btn-primary {
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.938rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.film-details-section {
    padding: 4rem 2rem;
    background: var(--bg-primary);
}

.details-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.detail-block h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.film-description {
    font-size: 1.063rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.crew-info {
    margin-bottom: 1.5rem;
}

.crew-item {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.crew-label {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 80px;
}

.crew-value {
    color: var(--text-secondary);
}

.cast-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cast-member {
    padding: 0.5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.938rem;
    color: var(--text-secondary);
}

.trailer-container {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.trailer-container iframe {
    display: block;
}

.error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 1.5rem;
    padding: 2rem;
}

.error-message p {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

/* Search Autocomplete */
.search-autocomplete {
    position: relative;
    max-width: 640px;
}

.search-input {
    position: relative;
}

.search-input input {
    width: 100%;
    padding: 0.95rem 2.5rem 0.95rem 2.25rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.search-input input::placeholder {
    color: var(--text-tertiary);
}

.search-input input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,112,243,0.15);
    background: var(--bg-secondary);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

.clear-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.25rem;
    border-radius: 6px;
    cursor: pointer;
    display: none;
}

.clear-btn:hover {
    background: var(--surface);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: var(--surface-hover);
}

.search-result-poster {
    width: 44px;
    height: 66px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.search-result-info {
    flex: 1;
}

.search-result-title {
    font-weight: 600;
    color: var(--text-primary);
}

.search-result-year {
    font-size: 0.813rem;
    color: var(--text-tertiary);
}

.tmdb-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.tmdb-logo {
    color: var(--text-tertiary);
    opacity: 0.6;
}

.subtle-help {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    margin-top: 0.75rem;
}

/* Voters Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.voters-list {
    padding: 1rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.voter-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem;
    background: var(--bg-primary);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    transition: all 0.2s;
}
.voter-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    background: var(--surface);
}

.voter-info {
    flex: 1;
    min-width: 0;
}

.voter-name {
    font-size: 0.938rem;
    font-weight: 500;
    color: var(--text-primary);
    display: block;
}

.voter-rating {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    background: var(--accent);
    padding: 0.5rem 0.875rem;
    border-radius: 8px;
}

.rating-number {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
}

.rating-max {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
}

.no-voters,
.error-text {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-size: 0.938rem;
}

.error-text {
    color: #ff6b6b;
}

/* ============================================
   WHEEL OF FORTUNE PAGE
   ============================================ */

.wheel-page {
    min-height: 100vh;
    background: var(--bg-primary);
}

.wheel-container {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 2rem;
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
    min-height: calc(100vh - 80px);
}

/* Film Selection Panel */
.film-selection-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    height: fit-content;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.panel-header {
    margin-bottom: 1rem;
}

.panel-header h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.selection-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-secondary-small {
    padding: 0.5rem 0.875rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.813rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary-small:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

.films-count {
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    text-align: center;
    margin-bottom: 1rem;
    font-weight: 500;
}

.films-count span {
    color: var(--accent);
    font-weight: 600;
    font-size: 1.125rem;
}

.films-checklist {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.films-checklist::-webkit-scrollbar {
    width: 8px;
}

.films-checklist::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.films-checklist::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.films-checklist::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.film-checkbox-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.film-checkbox-item:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
}

.film-checkbox-item input[type="checkbox"] {
    margin-right: 0.75rem;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--accent);
}

.film-checkbox-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.film-checkbox-poster {
    width: 45px;
    height: 67px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.film-checkbox-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.film-checkbox-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.film-checkbox-year {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.loading-spinner-small {
    width: 30px;
    height: 30px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 2rem auto;
}

.no-films-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem 1rem;
    font-size: 0.938rem;
}

/* Wheel Panel */
.wheel-panel {
    display: flex;
    align-items: center;
    justify-content: center;
}

.wheel-section {
    text-align: center;
    width: 100%;
    max-width: 600px;
}

.wheel-section h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

#wheel-chart {
    width: 500px;
    height: 500px;
    margin: 0 auto 2rem;
}

#wheel-chart svg {
    display: block;
    margin: 0 auto;
}

#wheel-chart text {
    font-family: 'Figtree', 'Inter', sans-serif;
    pointer-events: none;
}

/* Winner Display */
.winner-display {
    margin-top: 2rem;
    padding: 2rem;
    background: var(--surface);
    border: 2px solid var(--accent);
    border-radius: 16px;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.winner-content h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--accent);
}

.winner-poster {
    width: 200px;
    height: auto;
    border-radius: 12px;
    margin-bottom: 1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.winner-content h4 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.page-title {
    font-size: 1.5rem;
    margin-left: 1rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .wheel-container {
        grid-template-columns: 350px 1fr;
    }

    #wheel-chart {
        width: 400px;
        height: 400px;
    }
}

@media (max-width: 968px) {
    .wheel-container {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    /* Hide desktop nav, show mobile toggle */
    .header-nav { display: none; }
    .mobile-menu-toggle { display: inline-flex; align-items: center; justify-content: center; }

    .film-selection-panel {
        max-height: 400px;
        order: 2;
    }

    .wheel-panel {
        order: 1;
    }

    .wheel-section h2 {
        font-size: 1.5rem;
    }

    #wheel-chart {
        width: 350px;
        height: 350px;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .winner-poster {
        width: 150px;
    }
}

@media (max-width: 600px) {
    #wheel-chart {
        width: 300px;
        height: 300px;
    }

    .wheel-section h2 {
        font-size: 1.25rem;
        margin-bottom: 1.5rem;
    }

    .film-selection-panel {
        max-height: 350px;
    }

    .selection-actions {
        flex-direction: column;
    }

    .btn-secondary-small {
        width: 100%;
    }
}

/* Responsive Film Detail */
@media (max-width: 968px) {
    .film-hero-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .film-poster-large {
        width: 250px;
    }

    .film-title-large {
        font-size: 2rem;
    }

    .film-meta {
        justify-content: center;
    }

    .film-rating-summary {
        justify-content: center;
    }

    .vote-input-group {
        justify-content: center;
    }

    .film-info-main {
        align-items: center;
    }

    .film-hero {
        padding: 6rem 1.5rem 3rem;
    }
    
    .modal-content {
        width: 95%;
        max-height: 85vh;
    }
    
    .modal-header {
        padding: 1.25rem;
    }
    
    .voters-list {
        padding: 0.75rem 1rem;
    }
}

/* ===== CHAT PAGE ===== */

.chat-main {
    padding: 2rem 1.5rem;
    max-width: 900px;
}

.chat-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.chat-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-tertiary);
    transition: background 0.3s;
}

.status-indicator.connected {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
    
}

.pulse {
  animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
  0% {
    box-shadow: 0 0 0 0px rgba(0, 0, 0, 0.2);
  }
  100% {
    box-shadow: 0 0 0 20px rgba(16, 155, 27, 0.308);
  }
}


.chat-container {
    flex: 1;
    overflow: hidden;
}

.messages-container {
    height: 100%;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.messages-container::-webkit-scrollbar {
    width: 8px;
}

.messages-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.messages-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

.loading-messages,
.no-messages,
.error-messages {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    text-align: center;
}

.spinner-small {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.message {
    display: flex;
    gap: 0.75rem;
    animation: fadeInUp 0.3s ease;
}

.message.own-message {
    flex-direction: row-reverse;
}

.message.own-message .message-content {
    align-items: flex-end;
}

.message.own-message .message-text {
    background: var(--accent);
    color: white;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border);
    object-fit: cover;
    flex-shrink: 0;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-width: 70%;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
}

.message.own-message .message-header {
    flex-direction: row-reverse;
}

.message-username {
    font-weight: 600;
    color: var(--text-primary);
}

.message-time {
    color: var(--text-tertiary);
    font-size: 0.75rem;
}

.message-text {
    padding: 0.625rem 0.875rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.5;
}

.message-form {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.message-form input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: border-color 0.2s;
}

.message-form input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-primary);
}

.message-form input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.send-btn:hover {
    background: var(--accent-hover);
}

.send-btn:active {
    transform: scale(0.95);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .chat-main {
        padding: 1rem;
    }

    .chat-wrapper {
        height: calc(100vh - 160px);
    }

    .chat-header {
        padding: 1rem;
    }

    .chat-header h1 {
        font-size: 1.25rem;
    }

    .messages-container {
        padding: 1rem;
    }

    .message-content {
        max-width: 80%;
    }

    .message-form {
        padding: 0.75rem 1rem;
    }
}
