#project-page {
    display: flex;
    flex-direction: column;
    gap: 25px;
    padding: 0 28px 0 28px;
    margin: 42px auto 0 auto;
    max-width: 1300px;
    position: relative;
}
/* --- Custom Scrollbar for #credits-container (Safari only) --- */
/*
   This block targets only #credits-container scrollbars in Safari (WebKit),
   without affecting global scrollbars or other elements. Chrome/Firefox unaffected.
   If you update global scrollbar styles, do so in global.css, not here.
*/
@media not all and (min-resolution: 0.001dpcm) {
  @supports (-webkit-touch-callout: none) {
    #credits-container::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }
    #credits-container::-webkit-scrollbar-track {
        background: hsla(201, 100%, 10%, 1);
        border-radius: 5px;
    }
    #credits-container::-webkit-scrollbar-thumb {
        background: hsla(228, 48%, 60%, 1);
        border-radius: 5px;
        border: 2px solid hsla(201, 100%, 10%, 1);
    }
    #credits-container::-webkit-scrollbar-thumb:hover {
        background: hsla(228, 48%, 70%, 1);
    }
    #credits-container::-webkit-scrollbar-thumb:active {
        background: hsla(228, 48%, 50%, 1);
    }
  }
}
/*
  --- END Custom Scrollbar for #credits-container ---
  This ensures only #credits-container gets the custom scrollbar in Safari.
  No global scrollbars are affected. If you see global scrollbars break,
  check for accidental overrides or blank ::-webkit-scrollbar rules elsewhere.
*/

#content-box {
    display: flex;
    gap: 25px;
    align-items: flex-start;
}

#project {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

#frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    position: relative;
    border-radius: 25px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    z-index: 101;
}

#info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
    z-index: 5;
    transition: all 300ms ease;
    will-change: transform;
}

#specs {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    margin: 0;
}

#contentTitle {
    font-size: 1.5rem;
    font-weight: bold;
    color: hsla(0,0%,100%,1);
    margin: 0 0 5px 0;
    max-width: 80%;
    transition: color 300ms ease;
    display: flex;
    align-items: center;
    gap: 8px; /* Add gap between title and version badge */
}

#tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
}

.role-tag, .type-tag {
    display: inline-flex;
    align-items: center;
    background: hsla(228,48%,60%,0.25);
    border: 1px solid hsla(248,9%,45%,0.8);
    padding: 2px 6px;
    border-radius: 6.5px;
    line-height: 1;
    margin-right: 2px;
    color: hsla(0,0%,80%,1);
    text-decoration: none;
    cursor: pointer;
    transition: all 200ms ease-out;
    will-change: color, border-color;
}

.role-tag:last-child {
    margin-right: 0;
}

.role-tag:hover {
    color: hsla(0,0%,100%,1);
    border-color: hsla(0,100%,100%,1);
}

.type-tag:hover {
    color: hsla(0,0%,100%,1);
    border-color: hsla(0,100%,100%,1);
}

#divider {
    margin: 0 2px;
}

#date {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.7rem;
    color: hsla(0,0%,80%,1);
    margin: 0;
    line-height: 1.9rem;
    transition: color 300ms ease;
}

#credits {
    width: 250px;
    border: 2px solid hsla(248,9%,45%,0.5);
    border-radius: 25px;
    box-sizing: border-box;
    padding: 20px 0;
    overflow: hidden;
    box-shadow: 0px 40px 100px 5px hsla(0, 0%, 0%, 0.25);
    backdrop-filter: blur(15px) brightness(0.7);
    background-color: hsla(201, 100%, 8%, 0.45);
    z-index: 5;
    display: flex;
    flex-direction: column;
    /* Height will be set dynamically by JavaScript to match #project */
    height: auto;
    max-height: calc(100vh - 200px); /* Fallback constraint */
    min-height: 0; /* Allows shrinking */
    transition: all 300ms ease;
}

#credits:hover {
    backdrop-filter: blur(15px) brightness(0.85);
    /* background-color: hsla(201, 100%, 10%, 0.55); */
}

#credits #credits-container {
    padding: 0 20px 0 20px;
    overflow-y: auto;
    flex: 1; /* Takes up remaining space after header */
    min-height: 0; /* Allows shrinking */
}

#credits-header {
    padding: 0 20px;
    flex-shrink: 0; /* Prevents header from shrinking */
}

#credits h2 {
    font-size: 1.1rem;
    color: hsla(0,0%,100%,1);
    margin: 0 0 20px 0;
    transition: all 300ms ease;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    position: relative;
    padding-bottom: 12px;
}

#credits h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 2px;
    background: linear-gradient(90deg, hsla(228,48%,70%,1), hsla(228,48%,50%,0.3));
    border-radius: 1px;
    transition: all 400ms cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: left;
}

#credits:hover h2::after {
    width: 100px;
    background: linear-gradient(90deg, hsla(228,48%,85%,1), hsla(228,48%,70%,0.8), hsla(228,48%,50%,0.2));
    box-shadow: 0 0 8px hsla(228,48%,70%,0.3);
}

#credits ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#credits li {
    font-size: 0.8rem;
    color: hsla(0,0%,90%,1);
    transition: color 400ms ease, transform 300ms ease, opacity 400ms ease;
    padding: 8px 0;
    border-bottom: 1px solid hsla(248,9%,45%,0.2);
    position: relative;
    line-height: 1.4;
    opacity: 1;
}

#credits li:last-child {
    border-bottom: none;
}

#credits ul:hover li {
    color: hsla(0,0%,60%,1);
    opacity: 0.6;
}

#credits ul:hover li:hover {
    color: hsla(0,0%,100%,1);
    transform: translateX(5px);
    opacity: 1;
}

#credits li strong {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: hsla(228,48%,70%,1);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    transition: color 400ms ease;
}

.credit-names {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.credit-name {
    display: block;
    font-size: 0.75rem;
    color: hsla(0,0%,85%,1);
    padding-left: 12px;
    position: relative;
    transition: color 400ms ease;
    line-height: 1.3;
}

.credit-name::before {
    content: '•';
    position: absolute;
    left: 0;
    color: hsla(228,48%,60%,0.6);
    font-size: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    transition: color 400ms ease;
}

/* Style the "as Character" parts in actor credits */
.credit-name .character-role {
    font-size: 0.65rem;
    color: hsla(228,48%,65%,0.8);
    font-style: italic;
    font-weight: 400;
    transition: color 400ms ease;
}

#credits ul:hover .credit-name .character-role {
    color: hsla(228,48%,45%,0.6);
}

#credits ul:hover li:hover .credit-name .character-role {
    color: hsla(228,48%,75%,0.9);
}

#credits ul:hover li strong {
    color: hsla(228,48%,45%,1);
}

#credits ul:hover li:hover strong {
    color: hsla(228,48%,80%,1);
}

#credits ul:hover .credit-name {
    color: hsla(0,0%,50%,1);
}

#credits ul:hover .credit-name::before {
    color: hsla(228,48%,40%,0.4);
}

#credits ul:hover li:hover .credit-name {
    color: hsla(0,0%,90%,1);
}

#credits ul:hover li:hover .credit-name::before {
    color: hsla(228,48%,70%,0.8);
}

#more {
    overflow: hidden;
    position: relative;
    border: 2px solid hsla(248,9%,45%,0.5);
    border-radius: 25px;
    padding: 20px;
    box-sizing: border-box;
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    z-index: 5;
    transition: background 300ms ease;
}

#more:hover {
    background: rgba(255, 255, 255, 0.12);
}

#attachments {
  float: right;
  width: 120px;
  font-size: 80%;
  margin-left: 20px;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  transition: all 300ms ease;
  will-change: transform, box-shadow;
}

#attachments:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

#screenplay {
    width: 100%;
    display: block;
    transition: all 300ms ease;
}

#attachments:hover #screenplay {
    filter: brightness(1.1) contrast(1.1);
}

#view-container {
  text-align: center;
  background: hsla(214,100%,45%,1);
  color: #fff;
  font-weight: 700;
  width: 100%;
  transition: all 300ms ease;
}

#attachments:hover #view-container {
    background: hsla(214,100%,55%,1);
}

#description {
    font-size: 0.9rem;
    color: hsla(0,0%,100%,1);
    margin: 0;
    line-height: 1.5;
    transition: color 300ms ease;
}

#description p {
    margin: 0;
    transition: all 300ms ease;
}

#description a {
    color: hsla(228, 48%, 60%, 1);
    transition: all 300ms ease;
}

#description a:hover {
    color: hsla(228, 48%, 70%, 1);
    text-decoration: none;
}

/* Version badge styling */
.version-badge {
    background: hsla(120, 60%, 45%, 1);
    color: white;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
    /* Remove margin since we use gap in the parent flex container */
}

/* Version history section styling */
#version-history {
    margin-top: 20px;
    border: 1px solid hsla(248, 9%, 45%, 0.3);
    border-radius: 12px;
    overflow: hidden;
    background: hsla(228, 48%, 8%, 0.4);
    width: 100%;
    display: inline-grid;
}

.version-header {
    position: relative;
}

.version-header h3 {
    margin: 0;
    padding: 16px 20px;
    font-size: 0.95rem;
    color: hsla(0, 0%, 90%, 1);
    border-bottom: 1px solid hsla(248, 9%, 45%, 0.3);
}

.dev-status {
    color: hsla(120, 45%, 70%, 1);
    font-weight: normal;
    font-size: 0.8em;
}

.version-toggle {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    background: none;
    border: none;
    padding: 0 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: hsla(0, 0%, 70%, 1);
    transition: color 200ms ease;
}

.version-toggle:hover {
    color: hsla(0, 0%, 90%, 1);
}

.version-summary {
    font-size: 0.85rem;
}

.toggle-arrow {
    transition: transform 200ms ease;
    font-size: 0.8rem;
}

.version-toggle[aria-expanded="true"] .toggle-arrow {
    transform: rotate(180deg);
}

.version-list {
    background: hsla(228, 48%, 6%, 0.6);
    max-height: 0;
    overflow: hidden;
    transition: max-height 300ms ease;
}

.version-list[aria-hidden="false"] {
    max-height: 300px;
}

.version-list ul {
    list-style: none;
    margin: 0;
    padding: 12px 0;
}

.version-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 20px;
    transition: background-color 200ms ease;
}

.version-item:hover {
    background: hsla(228, 48%, 10%, 0.5);
}

.version-item.current {
    background: hsla(120, 45%, 50%, 0.1);
}

.version-number {
    font-weight: 600;
    color: hsla(120, 45%, 70%, 1);
    min-width: 30px;
}

.version-date {
    color: hsla(0, 0%, 70%, 1);
    font-size: 0.85rem;
    line-height: 1;
    margin: auto 0;
}

.current-badge {
    background: hsla(120, 45%, 50%, 1);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-left: auto;
}

/* Using your exact explore page animations */
@keyframes popIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

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

/* Apply your exact animation pattern */
#content-box.pop-in,
#credits.pop-in,
#more.pop-in {
    animation: popIn 0.4s ease-out;
    transform-origin: top center;
}

.role-tag.pop-in,
.type-tag.pop-in {
    animation: popIn 0.4s ease-out;
    transform-origin: center center;
}

.fade-in {
    animation: fadeInUp 0.3s ease-out;
}

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
}

/* Focus states for accessibility */
.role-tag:focus,
.type-tag:focus,
#attachments:focus,
.credits-button:focus,
.view-screenplay-button:focus,
.version-button:focus {
    outline: 2px solid hsla(228,48%,60%,1);
    outline-offset: 2px;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .role-tag:hover,
    .type-tag:hover,
    #attachments:hover {
        transform: none;
    }
}

/* Credits button for mobile (hidden by default) */
.credits-button {
    display: none;
}

/* Project buttons for mobile (hidden by default) */
.project-buttons {
    display: none;
}

/* ----Responsive Styles---- */

.mobile-credits-overlay,
.mobile-version-overlay {
    display: none;
}



/* 1124px and below: Smaller credits section */
@media (max-width: 1124px) {

    #contentTitle {
        font-size: 1.1rem;
        line-height: 1;
    }

    #date {
        font-size: 0.55rem;
        line-height: 1.32rem
    }

    #credits {
        width: 220px;
        padding: 18px 0;
    }
    
    #credits #credits-container {
        padding: 0 18px 0 18px;
    }
    
    #credits-header {
        padding: 0 18px;
    }
    
    #credits h2 {
        font-size: 1rem;
        margin: 0 0 18px 0;
        padding-bottom: 10px;
        letter-spacing: 1.5px;
    }
    
    #credits li {
        font-size: 0.75rem;
        gap: 10px;
        padding: 6px 0;
    }
    
    #credits li strong {
        font-size: 0.65rem;
        margin-bottom: 5px;
        letter-spacing: 0.8px;
    }
    
    .credit-name {
        font-size: 0.7rem;
        padding-left: 10px;
    }
    
    .credit-name::before {
        font-size: 0.55rem;
    }
    
    .credit-name .character-role {
        font-size: 0.6rem;
    }

    /* Version history adjustments */
    .version-header h3 {
        font-size: 0.85rem;
        padding: 14px 18px;
    }
    
    .version-toggle {
        padding: 0 18px;
    }
    
    .version-summary {
        font-size: 0.75rem;
    }
    
    .version-item {
        padding: 6px 18px;
        gap: 10px;
    }
    
    .version-number {
        min-width: 25px;
        font-size: 0.85rem;
    }
    
    .version-date {
        font-size: 0.75rem;
    }
    
    .current-badge {
        font-size: 0.65rem;
        padding: 1px 6px;
    }
}

/* 1020px and below: Mobile credits popup and layout adjustments */
@media (max-width: 1020px) {
    #project-page {
        margin-top: 32px;
        padding: 0 8px;
        gap: 20px;
    }

    #info {
        padding: 15px;
    }
    
    /* Hide desktop credits section */
    #credits {
        display: none;
    }
    
    /* Show mobile overlays on mobile */
    .mobile-credits-overlay {
        display: block;
    }
    
    /* Mobile credits overlay */
    .mobile-credits-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(8px);
        z-index: 10000;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .mobile-credits-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Mobile credits popup */
    .mobile-credits-popup {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 100%;
        height: 75vh;
        max-height: calc(100vh - 40px);
        background: hsla(201, 100%, 8%, 0.98);
        border: 2px solid hsla(248, 9%, 45%, 0.7);
        border-radius: 25px 25px 12px 12px;
        padding: 0;
        box-shadow: 0px -8px 50px rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(20px) brightness(0.8);
        transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        z-index: 10001;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        transform: translateY(100%);
        will-change: transform;
        backface-visibility: hidden;
        perspective: 1000px;
    }

    .mobile-credits-popup.active {
        transform: translateY(0);
    }
    
    .mobile-credits-popup .credits-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 20px 24px 16px 24px;
        border-bottom: 1px solid hsla(248, 9%, 45%, 0.4);
        flex-shrink: 0;
        background: hsla(201, 100%, 6%, 0.8);
        border-radius: 23px 23px 0 0;
    }
    
    .mobile-credits-popup .credits-header h2 {
        font-size: 1.2rem;
        color: hsla(0, 0%, 100%, 1);
        margin: 0;
        font-weight: 700;
        letter-spacing: 1.5px;
        text-transform: uppercase;
    }
    
    .credits-close {
        background: hsla(248, 9%, 20%, 0.8);
        border: 1px solid hsla(248, 9%, 45%, 0.6);
        color: hsla(0, 0%, 90%, 1);
        cursor: pointer;
        padding: 8px;
        border-radius: 50%;
        transition: all 200ms ease;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }
    
    .credits-close:hover {
        color: hsla(0, 0%, 100%, 1);
        background: hsla(248, 9%, 35%, 0.9);
        border-color: hsla(248, 9%, 60%, 0.8);
        transform: scale(1.05);
    }
    
    .credits-close svg {
        width: 18px;
        height: 18px;
    }
    
    .mobile-credits-popup ul {
        list-style: none;
        padding: 0 24px 24px 24px;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 16px;
        overflow-y: auto;
        flex: 1;
        scrollbar-width: thin;
        scrollbar-color: hsla(248, 9%, 45%, 0.6) transparent;
    }
    
    .mobile-credits-popup ul::-webkit-scrollbar {
        width: 6px;
    }
    
    .mobile-credits-popup ul::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .mobile-credits-popup ul::-webkit-scrollbar-thumb {
        background: hsla(248, 9%, 45%, 0.6);
        border-radius: 3px;
    }
    
    .mobile-credits-popup li {
        font-size: 0.85rem;
        color: hsla(0, 0%, 92%, 1);
        padding: 12px 0;
        border-bottom: 1px solid hsla(248, 9%, 45%, 0.25);
        line-height: 1.4;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .mobile-credits-popup li:last-child {
        border-bottom: none;
    }
    
    .mobile-credits-popup li strong {
        display: block;
        font-size: 0.75rem;
        font-weight: 700;
        color: hsla(228, 48%, 75%, 1);
        text-transform: uppercase;
        letter-spacing: 1px;
        margin-bottom: 8px;
    }
    
    .mobile-credits-popup .credit-names {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    
    .mobile-credits-popup .credit-name {
        display: block;
        font-size: 0.8rem;
        color: hsla(0, 0%, 88%, 1);
        padding-left: 16px;
        position: relative;
        line-height: 1.4;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        margin-bottom: 2px;
    }
    
    .mobile-credits-popup .credit-name::before {
        content: '•';
        position: absolute;
        left: 6px;
        color: hsla(228, 48%, 65%, 0.8);
        font-size: 0.7rem;
        top: 2px;
    }
    
    .mobile-credits-popup .credit-name .character-role {
        font-size: 0.7rem;
        color: hsla(228, 48%, 70%, 0.9);
        font-style: italic;
        font-weight: 400;
    }
    
    /* Show the credits button */
    .project-buttons {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
        font-size: 0.75rem;
    }

    .credits-button {
        display: flex;
        align-items: center;
        gap: 8px;
        background: hsla(228, 48%, 60%, 0.1);
        border: 1px solid hsla(248, 9%, 45%, 0.5);
        color: hsla(0, 0%, 80%, 1);
        padding: 8px 14px;
        border-radius: 25px;
        cursor: pointer;
        transition: all 100ms ease-out;
        line-height: 1;
        font-size: 0.75rem;
    }
    
    .credits-button:hover {
        border-color: hsla(0, 0%, 100%, 1);
        color: hsla(242, 61%, 80%, 1);
        backdrop-filter: blur(50px) brightness(2);
    }
    
    .credits-button svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }
    
    .mobile-credits-popup ul {
        list-style: none;
        padding: 0 20px 20px 20px;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 12px;
        overflow-y: auto;
        flex: 1;
    }
    
    .mobile-credits-popup li {
        font-size: 0.8rem;
        color: hsla(0, 0%, 90%, 1);
        padding: 8px 0;
        border-bottom: 1px solid hsla(248, 9%, 45%, 0.2);
        line-height: 1.4;
    }
    
    .mobile-credits-popup li:last-child {
        border-bottom: none;
    }
    
    .mobile-credits-popup li strong {
        display: block;
        font-size: 0.7rem;
        font-weight: 700;
        color: hsla(228, 48%, 70%, 1);
        text-transform: uppercase;
        letter-spacing: 1px;
        margin-bottom: 6px;
    }
    
    .mobile-credits-popup .credit-names {
        display: flex;
        flex-direction: column;
        gap: 3px;
    }
    
    .mobile-credits-popup .credit-name {
        display: block;
        font-size: 0.75rem;
        color: hsla(0, 0%, 85%, 1);
        padding-left: 12px;
        position: relative;
        line-height: 1.3;
    }
    
    .mobile-credits-popup .credit-name::before {
        content: '•';
        position: absolute;
        left: 0;
        color: hsla(228, 48%, 60%, 0.6);
        font-size: 0.6rem;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .mobile-credits-popup .credit-name .character-role {
        font-size: 0.65rem;
        color: hsla(228, 48%, 65%, 0.8);
        font-style: italic;
        font-weight: 400;
    }

    .view-screenplay-button, .version-button {
        display: none;
    }
}

@media (max-width: 860px) {
    /* Version history adjustments */
    .version-header h3 {
        font-size: 0.75rem;
        padding: 12px 16px;
    }
    
    .version-toggle {
        padding: 0 16px;
    }
    
    .version-summary {
        font-size: 0.65rem;
    }
    
    .version-item {
        padding: 4px 16px;
        gap: 8px;
    }
    
    .version-number {
        min-width: 20px;
        font-size: 0.75rem;
    }
    
    .version-date {
        font-size: 0.65rem;
    }
    
    .current-badge {
        font-size: 0.6rem;
        padding: 0.5px 4px;
    }
}

/* 768px and below: Smaller elements for mobile screens */
@media (max-width: 768px) {
    #project-page {
        gap: 15px;
    }
    
    /* #contentTitle {
        font-size: 1.2rem;
    }

    #date {
        font-size: 0.8rem;
        line-height: 1.7rem;
    } */
    
    /* .version-badge {
        font-size: 0.65rem;
        padding: 1px 6px;
    } */
    
    .role-tag, .type-tag {
        font-size: 0.75rem;
        padding: 1px 5px;
        border-radius: 5px;
    }
    
    #attachments {
        width: 100px;
        font-size: 75%;
        margin-left: 15px;
    }
    
    #description {
        font-size: 0.8rem;
        line-height: 1.4;
    }
    
    #more {
        padding: 15px;
    }
    
    .credits-button {
        font-size: 0.7rem;
        padding: 6px 12px;
    }
    
    .credits-button svg {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 740px) {
    #version-history {
        display: none;
    }

    .version-badge {
        display: none;
    }

    .version-button {
        display: flex;
        align-items: center;
        justify-content: center;
        background: hsla(120, 60%, 45%, 0.9);
        border: 1px solid hsla(120, 60%, 55%, 0.8);
        color: white;
        padding: 6px 9px;
        border-radius: 25px;
        cursor: pointer;
        transition: all 100ms ease-out;
        font-weight: 500;
        line-height: 1;
        font-size: 0.7rem;
        /* min-width: 40px; */
    }
    
    .version-button:hover {
        background: hsla(120, 60%, 55%, 1);
        border-color: hsla(120, 60%, 65%, 1);
        transform: translateY(-1px);
    }
    
    /* Version history mobile popup */
    .mobile-version-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(8px);
        z-index: 10002;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .mobile-version-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    .mobile-version-popup {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 100%;
        height: 65vh;
        max-height: calc(100vh - 40px);
        background: hsla(201, 100%, 8%, 0.98);
        border: 2px solid hsla(248, 9%, 45%, 0.7);
        border-radius: 25px 25px 12px 12px;
        padding: 0;
        box-shadow: 0px -8px 50px rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(20px) brightness(0.8);
        transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        z-index: 10003;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        transform: translateY(100%);
        will-change: transform;
        backface-visibility: hidden;
        perspective: 1000px;
    }

    .mobile-version-popup.active {
        transform: translateY(0);
    }
    
    .mobile-version-popup .version-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 20px 24px 16px 24px;
        border-bottom: 1px solid hsla(248, 9%, 45%, 0.4);
        flex-shrink: 0;
        background: hsla(201, 100%, 6%, 0.8);
        border-radius: 23px 23px 0 0;
    }
    
    .mobile-version-popup .version-header h3 {
        font-size: 1.1rem;
        color: hsla(0, 0%, 100%, 1);
        margin: 0;
        font-weight: 700;
        letter-spacing: 1px;
        text-transform: uppercase;
        border: none;
    }
    
    .version-close {
        background: hsla(248, 9%, 20%, 0.8);
        border: 1px solid hsla(248, 9%, 45%, 0.6);
        color: hsla(0, 0%, 90%, 1);
        cursor: pointer;
        padding: 8px;
        border-radius: 50%;
        transition: all 200ms ease;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }
    
    .version-close:hover {
        color: hsla(0, 0%, 100%, 1);
        background: hsla(248, 9%, 35%, 0.9);
        border-color: hsla(248, 9%, 60%, 0.8);
        transform: scale(1.05);
    }
    
    .version-close svg {
        width: 18px;
        height: 18px;
    }
    
    .mobile-version-popup .version-list {
        background: none;
        max-height: none;
        overflow: visible;
        transition: none;
        flex: 1;
        overflow-y: auto;
        padding: 20px 24px 24px 24px;
        scrollbar-width: thin;
        scrollbar-color: hsla(248, 9%, 45%, 0.6) transparent;
    }
    
    .mobile-version-popup .version-list::-webkit-scrollbar {
        width: 6px;
    }
    
    .mobile-version-popup .version-list::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .mobile-version-popup .version-list::-webkit-scrollbar-thumb {
        background: hsla(248, 9%, 45%, 0.6);
        border-radius: 3px;
    }
    
    .mobile-version-popup .version-list ul {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .mobile-version-popup .version-item {
        display: flex;
        align-items: flex-start;
        gap: 14px;
        padding: 16px 18px;
        background: hsla(228, 48%, 8%, 0.7);
        border: 1px solid hsla(248, 9%, 45%, 0.3);
        border-radius: 16px;
        transition: all 200ms ease;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .mobile-version-popup .version-item:hover {
        background: hsla(228, 48%, 12%, 0.8);
        border-color: hsla(248, 9%, 55%, 0.5);
        transform: translateY(-1px);
    }
    
    .mobile-version-popup .version-item.current {
        background: hsla(120, 45%, 50%, 0.15);
        border-color: hsla(120, 45%, 50%, 0.5);
    }
    
    .mobile-version-popup .version-number {
        font-weight: 600;
        color: hsla(120, 45%, 75%, 1);
        min-width: 35px;
        font-size: 0.95rem;
        flex-shrink: 0;
        margin-top: 2px;
    }
    
    .mobile-version-popup .version-date {
        color: hsla(0, 0%, 75%, 1);
        font-size: 0.85rem;
        flex: 1;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .mobile-version-popup .current-badge {
        background: hsla(120, 45%, 50%, 1);
        color: white;
        padding: 6px 10px;
        border-radius: 14px;
        font-size: 0.7rem;
        font-weight: 500;
        flex-shrink: 0;
        white-space: nowrap;
        align-self: flex-start;
    }

    /* Show mobile overlays on smaller mobile */
    .mobile-version-overlay {
        display: block;
    }
}

/* 640px and below: New button layout and version history popup */
@media (max-width: 640px) {
    #info {
        padding: 10px 5px 5px 5px;
    }
    
    /* Move date below title and allow title to use full width */
    #specs {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    #contentTitle {
        max-width: 100%;
        font-size: 0.9rem;
    }
    
    #date {
        font-size: 0.5rem;
        align-self: flex-start;
        margin: 0;
        line-height: 1;
    }
    
    /* Hide attachments section */
    #attachments {
        display: none;
    }
    
    /* Button container for Credits, View Screenplay, and Version buttons */
    .project-buttons {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
        font-size: 0.7rem;
    }

    /* View Screenplay button */
    .view-screenplay-button {
        display: flex;
        align-items: center;
        gap: 6px;
        background: hsla(214, 100%, 45%, 0.9);
        border: 1px solid hsla(214, 100%, 55%, 0.8);
        color: white;
        padding: 6px 14px;
        border-radius: 25px;
        cursor: pointer;
        transition: all 100ms ease-out;
        text-decoration: none;
        font-size: 0.7rem;
        font-weight: 500;
        line-height: 1;
    }
    
    .view-screenplay-button:hover {
        background: hsla(214, 100%, 55%, 1);
        border-color: hsla(214, 100%, 65%, 1);
        transform: translateY(-1px);
    }
}

/* 520px and below: Further mobile optimizations */
@media (max-width: 520px) {
    /* #contentTitle {
        font-size: 1.1rem;
    }

    #date {
        font-size: 0.75rem;
        align-self: flex-start;
    } */
    
    #specs {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .role-tag, .type-tag {
        font-size: 0.7rem;
    }
    
    #description {
        font-size: 0.75rem;
    }
    
    /* Mobile popup adjustments for very small screens */
    .mobile-credits-popup,
    .mobile-version-popup {
        left: 5px;
        right: 5px;
        border-radius: 20px 20px 8px 8px;
    }
    
    .mobile-credits-popup.active,
    .mobile-version-popup.active {
        bottom: 5px;
    }
    
    .mobile-credits-popup .credits-header,
    .mobile-version-popup .version-header {
        padding: 16px 20px 12px 20px;
    }
    
    .mobile-credits-popup .credits-header h2,
    .mobile-version-popup .version-header h3 {
        font-size: 1rem;
        letter-spacing: 1px;
    }
    
    .mobile-credits-popup ul {
        gap: 14px;
    }
    
    .mobile-credits-popup li {
        font-size: 0.8rem;
        padding: 10px 0;
    }
    
    .mobile-credits-popup li strong {
        font-size: 0.7rem;
        margin-bottom: 6px;
    }
    
    .mobile-credits-popup .credit-name {
        font-size: 0.75rem;
        padding-left: 16px;
    }
    
    .mobile-version-popup .version-list {
        padding: 16px 20px 20px 20px;
    }
    
    .mobile-version-popup .version-item {
        padding: 14px 16px;
        gap: 12px;
    }
    
    .mobile-version-popup .version-number {
        min-width: 30px;
        font-size: 0.9rem;
    }
    
    .mobile-version-popup .version-date {
        font-size: 0.8rem;
    }
    
    .mobile-version-popup .current-badge {
        padding: 4px 8px;
        font-size: 0.65rem;
    }
}

@media (max-width: 420px) {
    .project-buttons {
        font-size: 0.6rem;
        gap: 5px;
    }

    .version-button {
        font-size: 0.6rem;
    }

    .view-screenplay-button {
        font-size: 0.6rem;
    }

    .credits-button {
        font-size: 0.6rem;
    }
}

@media (max-width: 380px) {
    .project-buttons {
        font-size: 0.52rem;
        gap: 4px;
    }

    .version-button {
        font-size: 0.52rem;
    }

    .view-screenplay-button {
        font-size: 0.52rem;
    }

    .credits-button {
        font-size: 0.52rem;
    }
}

#credits-container::-webkit-scrollbar {
    width: 10px !important;
    height: 10px !important;
}

#credits-container::-webkit-scrollbar-track {
    background: hsla(201, 100%, 10%, 1) !important;
    border-radius: 5px !important;
}

#credits-container::-webkit-scrollbar-thumb {
    background: hsla(228, 48%, 60%, 1) !important;
    border-radius: 5px !important;
    border: 2px solid hsla(201, 100%, 10%, 1) !important;
}

#credits-container::-webkit-scrollbar-thumb:hover {
    background: hsla(228, 48%, 70%, 1) !important;
}

#credits-container::-webkit-scrollbar-thumb:active {
    background: hsla(228, 48%, 50%, 1) !important;
}