:root {
    --bg-dark: #0a0a0c;
    --card-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.5);
    --secondary: #06b6d4;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
    --nav-height: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .glow-bg {
        display: none;
    }
}

/* Glassmorphism Classes */
.glass-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background: rgba(10, 10, 12, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 1000;
}

.view {
    margin-top: var(--nav-height);
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

@media (max-width: 768px) {
    .glass-card {
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
}

/* Navigation */
.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.logo-accent {
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
}

/* Hero Section */
.hero {
    height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 1rem;
}

.hero-content h1 {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.text-gradient {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 2.5rem;
}

.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-container input {
    width: 100%;
    padding: 1.2rem 1.5rem 1.2rem 3.5rem;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    color: white;
    font-size: 1.1rem;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-container input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
}

.search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    color: var(--text-secondary);
}

/* Buttons */
.btn-primary {
    background: var(--accent-gradient);
    border: none;
    padding: 0.8rem 1.8rem;
    border-radius: 50px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 25px var(--primary-glow);
}

/* Filters */
.filters-section {
    max-width: 1200px;
    margin: 4rem auto 2rem;
    padding: 0 2rem;
}

.filters {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filters::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    padding: 0.6rem 1.5rem;
    border-radius: 30px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ROM Grid */
.rom-grid {
    max-width: 1200px;
    margin: 0 auto 4rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    padding: 0 2rem;
}

.rom-card {
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.rom-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

@media (max-width: 768px) {
    .rom-card:hover {
        transform: none;
    }
}

.tag-container {
    position: absolute;
    top: 1.2rem;
    left: 1.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    max-width: calc(100% - 3rem);
}

.rom-tag {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 600;
    border: 1px solid rgba(99, 102, 241, 0.2);
    white-space: nowrap;
}

.rom-card h3 {
    font-size: 1.4rem;
    margin-top: 2.5rem;
    /* Space for the tag above */
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.maintainer {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.android-version {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    width: 95%;
    max-width: 650px;
    padding: 2.5rem;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 20px;
}

@media (max-width: 600px) {
    .modal-content {
        padding: 1.5rem;
        width: 100%;
        max-height: 100vh;
        border-radius: 20px 20px 0 0;
        position: fixed;
        bottom: 0;
    }
}

/* Custom Scrollbar for Modal */
.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    position: sticky;
    top: -2.5rem;
    background: var(--bg-dark);
    padding: 1rem 0;
    margin-top: -1rem;
    z-index: 10;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
}

.form-section {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.form-section:last-of-type {
    border-bottom: none;
}

.section-subtitle {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    color: var(--primary);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Modal Form Styling Refinement */
.modal-content input[type="text"],
.modal-content input[type="url"],
.modal-content select,
.modal-content textarea,
.item-card input,
.download-input-card input {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: var(--text-primary) !important;
    padding: 0.8rem 1rem !important;
    border-radius: 12px !important;
    font-size: 0.9rem !important;
    width: 100% !important;
    transition: all 0.3s ease !important;
    box-shadow: none !important;
    appearance: none !important;
}

.modal-content input::placeholder {
    color: rgba(255, 255, 255, 0.3) !important;
}

.modal-content input:focus,
.modal-content select:focus,
.modal-content textarea:focus {
    outline: none !important;
    border-color: var(--primary) !important;
    background: rgba(255, 255, 255, 0.06) !important;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2) !important;
}

.modal-content label {
    display: block;
    margin-bottom: 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.row {
    display: flex;
    gap: 1.2rem;
}

.col {
    flex: 1;
}

.full-width {
    width: 100%;
}

/* Tags Checkbox Group */
.tags-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.checkbox-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.checkbox-pill:has(input:checked) {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary);
    color: var(--text-primary);
}

.checkbox-pill input {
    width: auto;
    margin: 0;
}

/* Dynamic List Styles Refinement */
.dynamic-list-container {
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    transition: transform 0.3s ease;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.list-header label {
    margin-bottom: 0px !important;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-icon-small {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white !important;
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-icon-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--primary-glow);
    background: #4f46e5;
}

.btn-icon-small svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

.dynamic-inputs {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.item-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.6rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: all 0.3s ease;
}

.item-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.item-card input {
    background: transparent !important;
    border: none !important;
    padding: 0.6rem !important;
    box-shadow: none !important;
}

.download-input-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.2rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    animation: slideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transition: all 0.3s ease;
}

.download-input-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.download-input-card .remove-btn {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
}

.input-group-row {
    display: flex;
    gap: 1rem;
}

@media (max-width: 600px) {
    .input-group-row {
        flex-direction: column;
    }
}

.remove-btn {
    background: rgba(255, 68, 68, 0.1);
    color: #f87171 !important;
    border: 1px solid rgba(248, 113, 113, 0.2);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.remove-btn:hover {
    background: rgba(248, 113, 113, 0.2);
    transform: scale(1.05);
    border-color: #f87171;
}

.remove-btn svg {
    width: 18px;
    height: 18px;
    stroke: #f87171;
}

.form-section {
    margin-bottom: 2.5rem;
}

.section-subtitle {
    margin-bottom: 1.2rem;
    color: var(--text-primary);
    font-size: 1.1rem;
}

/* Devices View Styles */
.hero-mini {
    padding: 6rem 2rem 3rem;
    text-align: center;
}

.hero-mini h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.device-list-container {
    max-width: 1200px;
    margin: 0 auto 4rem;
    padding: 0 2rem;
}

.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.device-card {
    padding: 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.device-icon-box {
    width: 60px;
    height: 60px;
    background: var(--card-bg);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.device-icon-box svg {
    width: 30px;
    height: 30px;
}

.device-card h3 {
    font-size: 1.25rem;
}

.codename {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.6rem;
    border-radius: 5px;
    font-size: 0.9rem;
    color: var(--secondary);
}

.brand-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    color: var(--text-primary);
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--glass-border);
    border-color: var(--text-secondary);
}

/* Rewritten Details View - Immersive Design */
.details-page-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem 5rem;
}

.details-top-nav {
    padding: 2rem 0;
}

.btn-back-refined {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.5rem 0;
}

.btn-back-refined:hover {
    color: var(--primary);
    transform: translateX(-5px);
}

.details-hero {
    margin-bottom: 3.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.details-hero h1 {
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.1;
    letter-spacing: -2px;
}

.details-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.meta-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.details-grid {
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    gap: 3.5rem;
    align-items: start;
}

.details-card-refined {
    margin-bottom: 4rem;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-primary);
    position: relative;
    padding-left: 1.5rem;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 1.5rem;
    background: var(--primary);
    border-radius: 2px;
}

.content-body {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.changelog-list-refined {
    list-style: none;
    padding: 0;
}

.changelog-list-refined li {
    padding: 1.2rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-secondary);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.changelog-list-refined li::before {
    content: '•';
    color: var(--primary);
    font-weight: bold;
}

.installation-steps-refined {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.install-step {
    display: flex;
    gap: 1.5rem;
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 0.85rem;
}

.step-text {
    font-size: 1.05rem;
    color: var(--text-secondary);
    padding-top: 0.3rem;
}

/* Sidebar Refinement */
.sticky-sidebar-content {
    position: sticky;
    top: calc(var(--nav-height) + 2rem);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sidebar-card-refined {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.download-links-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn-download-refined {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    padding: 1.2rem;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2);
}

.btn-download-refined:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.3);
}

.Porter-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.porter-profile {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-top: 0.5rem;
}

.porter-avatar-large {
    width: 56px;
    height: 56px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.porter-info-text label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--secondary);
    margin-bottom: 0.2rem;
}

.porter-info-text p {
    font-size: 1.1rem;
    font-weight: 600;
}

.meta-card .meta-row-refined {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.meta-card .meta-row-refined:last-child {
    border-bottom: none;
}

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

.meta-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

@media (max-width: 992px) {
    .details-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .details-meta-row {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 2.5rem;
    }

    .nav-content {
        justify-content: space-between;
        padding: 0 1rem;
    }

    .nav-links {
        display: flex;
        gap: 1.2rem;
    }

    .nav-links a {
        font-size: 0.8rem;
    }

    #upload-trigger {
        display: none !important;
    }

    .logo {
        font-size: 1.1rem;
    }
}