:root {
    --bg-color: #0b0f19;
    --text-color: #e2e8f0;
    --accent-color: #8b5cf6;
    --accent-glow: rgba(139, 92, 246, 0.5);
    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    
    /* Morb Rating Colors */
    --morb-high: #10b981; /* Green */
    --morb-mid: #f59e0b; /* Orange */
    --morb-zero: #3b82f6; /* Blue (The Morbius baseline) */
    --morb-low: #ef4444; /* Red */
    --morb-lowest: #94a3b8; /* Gray */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(139, 92, 246, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.15), transparent 25%);
    /* Cross-OS Mobile Fixes */
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 2rem;
}

header .auth-section {
    order: 3;
}

header .logo {
    order: 1;
}

header .search-container {
    order: 2;
}

.top-nav {
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 0;
}

.logo h1 {
    font-weight: 800;
    font-size: 2.5rem;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo span {
    color: var(--accent-color);
    background: none;
    -webkit-text-fill-color: var(--accent-color);
    text-shadow: 0 0 20px var(--accent-glow);
}

.search-container {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    max-width: 500px;
}

#search-input {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

#search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-glow);
}

#search-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    border: none;
    background: var(--accent-color);
    color: white;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#search-btn:hover {
    background: #7c3aed;
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-2px);
}

main {
    flex: 1;
}

#section-title {
    margin-bottom: 2rem;
    font-size: 1.8rem;
    font-weight: 600;
}

.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

.movie-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    display: flex;
    flex-direction: column;
    will-change: transform;
    transform: translateZ(0);
}

.movie-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
    border-color: rgba(255,255,255,0.2);
}

.movie-poster {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-bottom: 1px solid var(--glass-border);
}

.movie-poster-placeholder {
    width: 100%;
    aspect-ratio: 2/3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e293b;
    border-bottom: 1px solid var(--glass-border);
    color: #64748b;
}

.movie-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.movie-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.movie-year {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.morb-rating-container {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.morb-rating-text {
    font-weight: 800;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rating-high { color: var(--morb-high); }
.rating-mid { color: var(--morb-mid); }
.rating-zero { color: var(--morb-zero); text-shadow: 0 0 10px rgba(59, 130, 246, 0.5); }
.rating-low { color: var(--morb-low); }
.rating-lowest { color: var(--morb-lowest); }

footer {
    text-align: center;
    padding-top: 3rem;
    color: #64748b;
    font-size: 0.9rem;
}

/* Loading State */
.loader {
    width: 50px;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 8px solid;
    border-color: var(--accent-color) transparent;
    animation: l1 1s infinite;
    margin: 4rem auto;
}
@keyframes l1 {to{transform: rotate(.5turn)}}




/* Auth Section */
.auth-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#user-display {
    font-weight: 600;
    color: var(--accent-color);
}

#login-btn, #logout-btn {
    padding: 0.6rem 1.5rem;
    border-radius: 30px;
    border: 2px solid var(--accent-color);
    background: rgba(139, 92, 246, 0.2);
    color: #ffffff;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

#login-btn:hover, #logout-btn:hover {
    background: var(--accent-color);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(11, 15, 25, 0.85); /* darker backdrop */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-backdrop-blob {
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--accent-color), transparent 70%);
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    z-index: 0;
    animation: pulseBlob 4s infinite alternate ease-in-out;
}

@keyframes pulseBlob {
    0% { transform: scale(1); opacity: 0.4; }
    100% { transform: scale(1.1); opacity: 0.6; }
}

.modal-content.premium-glass {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    width: 90%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255,255,255,0.05) inset;
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes slideUp {
    from { transform: translateY(20px); }
    to { transform: translateY(0); }
}

.modal-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.3s ease;
    background: none;
    border: none;
    font-family: inherit;
    z-index: 100;
}

.mobile-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    font-size: 2.5rem;
    color: #fff;
    cursor: pointer;
    background: none;
    border: none;
    z-index: 100;
    line-height: 1;
}

.close-btn:hover, .mobile-close-btn:hover {
    color: white;
}

.modal h2 {
    margin-bottom: 0.5rem;
    font-weight: 800;
    font-size: 1.8rem;
    background: linear-gradient(135deg, #fff, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-subtitle {
    color: #94a3b8;
    font-size: 0.95rem;
}

.input-container {
    position: relative;
    margin-bottom: 2rem;
}

.input-container input {
    width: 100%;
    padding: 1.2rem 1rem 0.6rem 1rem;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-container input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
    background: rgba(0, 0, 0, 0.5);
}

.input-container label {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1rem;
    pointer-events: none;
    transition: all 0.3s ease;
}

.input-container input:focus ~ label,
.input-container input:not(:placeholder-shown) ~ label {
    top: 0.5rem;
    font-size: 0.75rem;
    color: var(--accent-color);
    transform: translateY(0);
}

.pin-container {
    margin-bottom: 2rem;
}

.pin-container label {
    display: block;
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
    text-align: center;
}

.pin-inputs {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
}

.pin-box {
    width: 3.5rem;
    height: 4rem;
    font-size: 2rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pin-box:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
    transform: translateY(-2px);
    background: rgba(0, 0, 0, 0.6);
}

.error-msg {
    color: var(--morb-low);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    min-height: 1.2em;
    text-align: center;
}

.premium-btn {
    width: 100%;
    padding: 1.2rem;
    border-radius: 14px;
    border: none;
    background: linear-gradient(45deg, #ff007a, #7c3aed, #00f0ff, #7c3aed);
    background-size: 300% 300%;
    animation: flowGradient 4s ease infinite;
    color: white;
    font-weight: 800;
    font-size: 1.15rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(124, 58, 237, 0.4);
}

.premium-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    transform: skewX(-20deg) translateZ(0);
    animation: shineBtn 3s infinite;
    will-change: left;
}

@keyframes flowGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes shineBtn {
    0% { left: -100%; }
    20% { left: 200%; }
    100% { left: 200%; }
}

.premium-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 240, 255, 0.6);
}

.premium-btn:active {
    transform: translateY(2px) scale(0.98);
    box-shadow: 0 5px 15px rgba(124, 58, 237, 0.4);
}

/* User Rating Controls */
.user-rating-controls {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-rating-controls label {
    font-size: 0.85rem;
    color: #94a3b8;
}

.rating-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rating-input-group input[type="range"] {
    flex: 1;
    accent-color: var(--accent-color);
}

.rating-value {
    font-weight: bold;
    min-width: 2rem;
    text-align: center;
}

.rate-btn {
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    border: none;
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent-color);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.rate-btn:hover {
    background: var(--accent-color);
    color: white;
}

.user-rated-display {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    padding: 0.5rem;
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
    border-left: 3px solid var(--accent-color);
}

.morb-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.morb-btn, .unmorb-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: 2px solid transparent;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.morb-btn {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.3);
}

.morb-btn:hover, .morb-btn.active {
    background: #10b981;
    color: white;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
}

.unmorb-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.unmorb-btn:hover, .unmorb-btn.active {
    background: #ef4444;
    color: white;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

.details-modal-content {
    max-width: 1100px;
    width: 95%;
    height: 85vh;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.details-modal-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background-size: cover;
    background-position: center;
    filter: blur(2px);
    transform: scale(1.05) translateZ(0); /* Hardware accelerate blur */
    will-change: transform;
}

.details-modal-inner {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 3rem;
    overflow-y: auto;
}

.details-layout {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
}

.details-left {
    flex: 0 0 350px;
    position: sticky;
    top: 0;
}

.details-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    max-height: 250px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-right: 0.5rem;
}

.comment-item {
    background: rgba(0,0,0,0.2);
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid #cbd5e1;
}

.comment-author {
    font-weight: 700;
    color: var(--accent-color);
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.comment-date {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.comment-text {
    font-size: 0.95rem;
    color: #e2e8f0;
    line-height: 1.4;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.comment-own {
    border-left-color: var(--accent-color);
}

.comment-delete-btn {
    background: none;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.comment-delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
}

/* Scrollbar for comments */
.comments-list::-webkit-scrollbar {
    width: 6px;
}
.comments-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}
.comments-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}
.comments-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.4);
}




/* Custom Checkbox Rating System */
.rating-input-group {
    margin-bottom: 1.5rem;
}

.rating-boxes-container {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    gap: 0.2rem;
}

.rating-boxes-container input[type="radio"] {
    display: none;
}

.rating-boxes-container .star-label {
    font-size: 2.5rem;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

/* Scoped to .star-label on purpose: the 0 pill is the last child of this
   row, so an unscoped `~ label` would light it up alongside the stars. */
.rating-boxes-container .star-label:hover,
.rating-boxes-container .star-label:hover ~ .star-label,
.rating-boxes-container .star-input:checked ~ .star-label {
    color: #a78bfa;
    text-shadow: 0 0 15px rgba(139, 92, 246, 0.8);
    transform: scale(1.1);
}

/* The 0 rating sits inline at the left end of the star row. The row is
   row-reverse, so it is the LAST child in the DOM — see renderUserControls(). */
.rating-boxes-container {
    align-items: center;
}

.zero-morb-input {
    display: none;
}

.zero-morb-label {
    cursor: pointer;
    user-select: none;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    margin-right: 0.6rem;
    transition: all 0.2s ease;
}

.zero-morb-label:hover {
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.5);
}

.zero-morb-input:checked + .zero-morb-label {
    color: #fff;
    background: rgba(239, 68, 68, 0.9);
    border-color: #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

/* ========================================
   COMPREHENSIVE MOBILE RESPONSIVENESS
   ======================================== */

/* Tablet breakpoint */
@media (max-width: 900px) {
    .details-layout {
        gap: 2rem;
    }
    .details-left {
        flex: 0 0 250px;
    }
}

/* ==========================================
   MOBILE-NATIVE BREAKPOINT
   Phone-first design — not a shrunken desktop.
   ========================================== */
@media (max-width: 768px) {

    /* --- Global Touch & Performance --- */
    button,
    a,
    input[type="submit"],
    label,
    .movie-card,
    .close-btn,
    .premium-btn {
        touch-action: manipulation;
        min-height: 44px;
    }

    /* Cap all blurs for GPU performance on mobile */
    *,
    *::before,
    *::after {
        --mobile-blur: 5px;
    }

    /* --- App Shell --- */
    #app {
        padding: 0.75rem;
    }

    /* --- Header: compact sticky top bar --- */
    header {
        position: sticky;
        top: 0;
        z-index: 100;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0;
        padding: 0.6rem 0.75rem;
        backdrop-filter: blur(var(--mobile-blur));
        -webkit-backdrop-filter: blur(var(--mobile-blur));
    }

    /* Logo — small, left-aligned */
    header .logo {
        order: 1;
        width: auto;
        flex: 1;
        text-align: left;
    }

    .logo h1 {
        font-size: 1.4rem;
        margin: 0;
    }

    /* Hide "The Negative IMDb" tagline on mobile */
    .logo-tagline {
        display: none !important;
    }

    /* Auth buttons — right-aligned pills */
    header .auth-section {
        order: 2;
        width: auto;
        flex: 0 0 auto;
        justify-content: flex-end;
        gap: 0.4rem;
    }

    #login-btn,
    #logout-btn {
        font-size: 0.8rem;
        padding: 0.45rem 1rem;
        border-radius: 50px;
        min-height: 36px;
        letter-spacing: 0.5px;
    }

    #user-display {
        font-size: 0.8rem !important;
    }

    /* Search — full-width row below logo+auth */
    header .search-container {
        order: 3;
        width: 100%;
        max-width: 100%;
        flex-direction: row;
        margin-top: 0.5rem;
    }

    #search-input {
        width: 100%;
        min-height: 48px;
        padding: 0 1rem;
        font-size: 1rem;
        text-align: left;
        border-radius: 12px;
    }

    #search-btn {
        display: none; /* search triggers on input, button unnecessary on mobile */
    }

    /* --- Movie Grid: 2-column compact --- */
    .movies-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .movie-card {
        border-radius: 12px;
    }

    /* Kill all hover transforms on mobile cards */
    .movie-card:hover {
        transform: none !important;
        box-shadow: none !important;
        border-color: var(--glass-border);
    }

    .movie-info {
        padding: 0.6rem;
    }

    .movie-title {
        font-size: 0.85rem;
        line-height: 1.25;
    }

    .movie-year {
        font-size: 0.75rem;
        margin-bottom: 0.35rem;
    }

    .user-rated-display {
        font-size: 0.75rem;
        padding: 0.25rem 0.4rem;
    }

    /* --- Section Title --- */
    #section-title {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    /* --- Hall of Fame / Shame: stacked cards --- */
    #top-bottom-section > div {
        flex-direction: column !important;
        gap: 1.5rem !important;
    }

    #highest-morb-card,
    #lowest-morb-card {
        min-width: unset !important;
        padding: 1rem !important;
    }

    /* --- Movie Details Modal: FULL SCREEN --- */
    #movie-details-modal {
        padding: 0 !important;
    }

    #movie-details-modal .modal-content.premium-glass,
    .movie-modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
        margin: 0;
    }

    /* Close button: fixed pill, top-right, visible over poster */
    #movie-details-modal .close-btn,
    #close-movie-modal {
        position: fixed;
        top: 0.75rem;
        right: 0.75rem;
        z-index: 110;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(var(--mobile-blur));
        -webkit-backdrop-filter: blur(var(--mobile-blur));
        border-radius: 50px;
        padding: 0.3rem 0.85rem;
        font-size: 1.6rem;
        color: #fff;
        border: 1px solid rgba(255, 255, 255, 0.15);
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Details inner padding */
    .details-modal-inner {
        padding: 1rem !important;
    }

    /* Single-column details layout */
    .details-layout {
        flex-direction: column;
        gap: 1.25rem;
    }

    .details-left {
        flex: none;
        width: 100%;
        text-align: left;
        position: static;
    }

    /* Poster as hero banner */
    .details-left .movie-poster {
        width: 100% !important;
        max-height: 280px !important;
        object-fit: cover !important;
        border-radius: 0 !important;
        margin: 0 !important;
        display: block;
        box-shadow: none !important;
    }

    /* Title below poster */
    #details-title {
        font-size: 1.6rem !important;
        line-height: 1.2 !important;
        margin-top: 1rem;
    }

    .details-right {
        min-height: auto;
    }

    /* Rating stars */
    .rating-boxes-container {
        gap: 0.15rem;
    }

    .zero-morb-label {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .rating-boxes-container label {
        font-size: 1.8rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Comments: let them flow naturally */
    .comments-list {
        max-height: none;
    }

    /* Reduce blur on inner detail panels */
    #details-user-controls,
    .comments-section {
        backdrop-filter: blur(var(--mobile-blur)) !important;
        -webkit-backdrop-filter: blur(var(--mobile-blur)) !important;
    }

    /* --- Similar Movies Section --- */
    #similar-movies-grid {
        -webkit-overflow-scrolling: touch;
    }

    #similar-movies-grid > * {
        min-width: 110px !important;
        max-width: 110px !important;
        flex: 0 0 110px;
    }

    /* --- Profile Modal: FULL SCREEN --- */
    #profile-modal {
        padding: 0 !important;
    }

    #profile-modal .modal-content.premium-glass,
    .profile-modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
        margin: 0;
    }

    #profile-modal .close-btn,
    #close-profile-modal {
        position: fixed;
        top: 0.75rem;
        right: 0.75rem;
        z-index: 110;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(var(--mobile-blur));
        -webkit-backdrop-filter: blur(var(--mobile-blur));
        border-radius: 50px;
        padding: 0.3rem 0.85rem;
        font-size: 1.6rem;
        color: #fff;
        border: 1px solid rgba(255, 255, 255, 0.15);
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #profile-title {
        font-size: 1.5rem !important;
    }

    /* Profile tab buttons */
    #tab-ratings,
    #tab-comments {
        font-size: 0.85rem !important;
        padding: 0.7rem !important;
        min-height: 44px;
    }

    /* --- Auth Modal --- */
    #auth-modal .modal-content.premium-glass {
        width: 95%;
        max-width: 95%;
        padding: 1.5rem;
        border-radius: 20px;
    }

    .modal h2 {
        font-size: 1.3rem;
    }

    .pin-box {
        width: 2.8rem;
        height: 3.2rem;
        font-size: 1.5rem;
        min-height: 44px;
    }

    .pin-inputs {
        gap: 0.6rem;
    }

    .premium-btn {
        padding: 0.9rem;
        font-size: 1rem;
        letter-spacing: 1.5px;
        min-height: 44px;
    }

    /* --- Top Nav (if navigated to a movie page) --- */
    .top-nav {
        padding: 0.6rem 4%;
    }

    .top-nav .logo h1 {
        font-size: 1.4rem;
    }

    /* --- Footer --- */
    footer {
        padding-top: 1.5rem;
        font-size: 0.75rem;
    }
}

/* Safe area for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    .top-nav {
        padding-top: max(0.75rem, env(safe-area-inset-top));
    }
}

/* Disable hover effects on touch devices */
@media (hover: none) {
    .movie-card:hover {
        transform: none;
        box-shadow: none;
        border-color: var(--glass-border);
    }
    #login-btn:hover, #logout-btn:hover {
        transform: none;
    }
    #search-btn:hover {
        transform: none;
    }
    .premium-btn:hover {
        transform: none;
    }
}

/* --- Loader Animations --- */
.loader {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(167, 139, 250, 0.2);
    border-top: 5px solid var(--accent-color);
    border-radius: 50%;
    animation: morb-spin 1s linear infinite;
    margin: 4rem auto;
}

.global-loader {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.global-loader.active {
    opacity: 1;
    pointer-events: all;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.morb-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(167, 139, 250, 0.2);
    border-top: 5px solid var(--accent-color);
    border-radius: 50%;
    animation: morb-spin 1s linear infinite;
}

.loader-text {
    color: var(--accent-color);
    font-weight: 600;
    font-size: 1.2rem;
    letter-spacing: 2px;
    animation: morb-pulse 1.5s ease-in-out infinite;
}

@keyframes morb-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes morb-pulse {
    0%, 100% { opacity: 0.5; text-shadow: none; }
    50% { opacity: 1; text-shadow: 0 0 15px rgba(167, 139, 250, 0.6); }
}

/* --- Utilities --- */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}
.hide-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}
