:root {
    --bg: #070b14;
    --bg-top: #1b1022;
    --surface: rgba(17, 24, 39, 0.78);
    --surface-strong: rgba(17, 24, 39, 0.92);
    --surface-soft: rgba(148, 163, 184, 0.1);
    --text: #fff3df;
    --muted: #d7c6aa;
    --accent: #ff7a45;
    --accent-2: #ffb703;
    --accent-warm: #ffd166;
    --shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
    --radius-lg: 6px;
    --radius-md: 4px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background:
        radial-gradient(circle at 10% 8%, rgba(255, 122, 69, 0.22), transparent 28%),
        radial-gradient(circle at 88% 84%, rgba(255, 183, 3, 0.18), transparent 34%),
        radial-gradient(circle at 56% 18%, rgba(131, 56, 236, 0.18), transparent 32%),
        linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 60%, #06080f 100%);
    color: var(--text);
    font-family: 'VT323', monospace;
    line-height: 1.45;
    overflow-x: hidden;
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: linear-gradient(to top, transparent 0%, #000 42%);
    pointer-events: none;
    z-index: -2;
    animation: grid-shift 16s linear infinite;
}

body::after {
    content: '';
    position: fixed;
    inset: -12%;
    background:
        radial-gradient(ellipse at 20% 60%, rgba(255, 122, 69, 0.14), transparent 40%),
        radial-gradient(ellipse at 80% 40%, rgba(255, 183, 3, 0.12), transparent 42%),
        radial-gradient(ellipse at 50% 100%, rgba(131, 56, 236, 0.12), transparent 48%);
    pointer-events: none;
    z-index: -3;
    animation: aurora-drift 22s ease-in-out infinite alternate;
}

@keyframes grid-shift {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(0, 26px, 0); }
}

@keyframes aurora-drift {
    from { transform: translate3d(-2%, -1%, 0) scale(1); }
    to { transform: translate3d(2%, 1%, 0) scale(1.03); }
}

.crt-overlay {
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.06),
        rgba(0, 0, 0, 0.06) 1px,
        transparent 1px,
        transparent 4px
    );
    z-index: 8;
    pointer-events: none;
    display: none;
}

.crt-flicker {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle, transparent 58%, rgba(0, 0, 0, 0.12) 100%);
    z-index: 9;
    pointer-events: none;
    display: none;
}

#page-transition {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 8, 15, 0.72);
    background: rgba(6, 8, 15, 0.88);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
}

#page-transition.active {
    opacity: 1;
    pointer-events: all;
}

.transition-loader {
    font-size: 1.1rem;
    color: #ffe7c1;
    letter-spacing: 0.08em;
    text-shadow: 0 0 16px rgba(255, 183, 3, 0.45);
}

.progressive-img {
    opacity: 0;
    transition: opacity 0.45s ease;
    background: linear-gradient(
        110deg,
        rgba(255, 255, 255, 0.06) 8%,
        rgba(255, 255, 255, 0.16) 18%,
        rgba(255, 255, 255, 0.06) 33%
    );
    background-size: 220% 100%;
    animation: img-shimmer 1.2s linear infinite;
}

.progressive-img.is-loaded {
    opacity: 1;
    animation: none;
}

@keyframes img-shimmer {
    to {
        background-position-x: -220%;
    }
}

#bg-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.6;
}

.perf-lite #bg-canvas {
    display: none;
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 1rem;
    position: relative;
    z-index: 1;
}

h1,
h2,
h3,
.logo-text {
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}

header {
    position: relative;
    z-index: 30;
    margin-top: 1.2rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(166, 180, 200, 0.22);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.72));
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    box-shadow: var(--shadow);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.6rem;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo-svg {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 8px 16px rgba(255, 122, 69, 0.4));
}

.logo-text {
    font-size: 1.14rem;
    font-weight: 700;
    color: #f3f8ff;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.55);
}

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

nav {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
}

nav a {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    padding: 0.5rem 0.85rem;
    border-radius: 4px;
    transition: 0.2s ease;
}

nav a:hover,
nav a.active {
    color: #fff;
    background: rgba(255, 122, 69, 0.2);
    box-shadow: inset 0 0 0 1px rgba(255, 122, 69, 0.58);
}

.lang-switcher {
    position: relative;
    font-family: inherit;
    z-index: 40;
}

.lang-btn {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: #d6e4f8;
    border-radius: 4px;
    padding: 0.45rem 0.7rem;
    font-size: 0.62rem;
    cursor: pointer;
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--surface-strong);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 4px;
    overflow: hidden;
    display: none;
    flex-direction: column;
    z-index: 4000;
    min-width: 74px;
}

.lang-switcher:hover .lang-dropdown {
    display: flex;
}

.lang-switcher:focus-within .lang-dropdown {
    display: flex;
}

.lang-dropdown a {
    padding: 0.5rem 0.7rem;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.62rem;
}

.lang-dropdown a:hover {
    background: rgba(255, 183, 3, 0.18);
    color: #fff;
}

.hero {
    padding: 2.2rem 0 1rem;
    display: grid;
    gap: 1.3rem;
}

.hero-content {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.84), rgba(30, 41, 59, 0.63));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid rgba(166, 180, 200, 0.22);
    position: relative;
}

.hero-content::after {
    content: '';
    position: absolute;
    left: 12px;
    right: 12px;
    top: 10px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 122, 69, 0.78), transparent);
}

.hero-content h1 {
    font-size: clamp(1.45rem, 3vw, 2.2rem);
    line-height: 1.2;
    margin-bottom: 0.85rem;
}

.hero-content p {
    font-size: clamp(1.35rem, 2.5vw, 1.62rem);
    color: var(--muted);
    max-width: 760px;
    margin: 0 auto 1.4rem;
}

.btn {
    display: inline-block;
    padding: 0.95rem 1.65rem;
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-decoration: none;
    border-radius: 4px;
    border: 0;
}

.btn-primary {
    background: linear-gradient(180deg, #ffd166 0%, #ffb703 48%, #ff7a45 100%);
    color: #2b1203;
    border: 2px solid #fff4d6;
    box-shadow:
        0 0 0 3px rgba(255, 122, 69, 0.4),
        0 10px 26px rgba(255, 122, 69, 0.45),
        5px 5px 0 #7a3216;
    transition: 0.2s ease;
    transform: translateY(0);
    font-size: 0.98rem;
    padding: 1.15rem 2rem;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow:
        0 0 0 3px rgba(255, 183, 3, 0.55),
        0 16px 34px rgba(255, 122, 69, 0.55),
        7px 7px 0 #7a3216;
}

.btn-primary .version-tag {
    display: block;
    margin-top: 0.55rem;
    padding-top: 0.4rem;
    border-top: 1px dashed rgba(43, 18, 3, 0.35);
    font-size: 0.82rem;
    font-weight: 700;
    color: rgba(43, 18, 3, 0.92);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
}

.feature-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 1rem;
    border: 1px solid rgba(166, 180, 200, 0.2);
    box-shadow: 0 8px 22px rgba(2, 8, 23, 0.3);
    transition: 0.2s ease;
    position: relative;
}

.feature-card::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #ffb703;
    box-shadow: 0 0 8px rgba(255, 183, 3, 0.7);
}

.feature-card:hover {
    transform: translateY(-3px);
    background: rgba(30, 41, 59, 0.82);
}

.feature-icon {
    font-size: 1.6rem;
    margin-bottom: 0.55rem;
    display: block;
}

.feature-card h3 {
    font-size: 0.72rem;
    margin-bottom: 0.35rem;
    color: #d8f9ee;
}

.feature-card p {
    font-size: 1.2rem;
    color: var(--muted);
}

.gold-section {
    margin: 2.2rem 0;
    padding: 1.2rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, rgba(146, 64, 14, 0.5), rgba(30, 41, 59, 0.8));
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.gold-logo {
    width: 96px;
    height: 96px;
    flex-shrink: 0;
    display: block;
    object-fit: cover;
    object-position: center;
    border-radius: 6px;
}

.gold-info h2 {
    font-size: 1rem;
    margin-bottom: 0.45rem;
}

.gold-info p {
    font-size: 1.2rem;
    color: #fde6be;
}

.badge-soon {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.28rem 0.55rem;
    border-radius: 3px;
    background: rgba(245, 158, 11, 0.2);
    color: #ffebc5;
    font-family: inherit;
    font-size: 0.56rem;
}

.roms-list {
    padding: 1.8rem 0;
}

.roms-list h1 {
    font-size: clamp(1.18rem, 2.3vw, 1.8rem);
}

.filter-container {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
    margin-bottom: 1.3rem;
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    border: 1px solid rgba(166, 180, 200, 0.2);
}

.search-wrapper,
.select-wrapper {
    flex: 1;
    min-width: 220px;
}

.filter-input,
.filter-select {
    width: 100%;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 3px;
    color: #ecf4ff;
    padding: 0.5rem 0.7rem;
    font-family: 'VT323', monospace;
    font-size: 1.35rem;
    outline: none;
}

.filter-input:focus,
.filter-select:focus {
    border-color: rgba(255, 122, 69, 0.7);
}

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

.rom-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid rgba(166, 180, 200, 0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 20px rgba(2, 8, 23, 0.25);
    transition: 0.2s ease;
    position: relative;
}

.rom-card::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, #ffb703, #ff7a45);
}

.rom-card:hover {
    transform: translateY(-3px);
    background: rgba(30, 41, 59, 0.85);
}

.rom-cover {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    display: block;
    object-fit: cover;
    image-rendering: auto;
}

.rom-info {
    padding: 0.8rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.rom-title {
    font-size: 1.3rem;
    color: #f6fbff;
    margin-bottom: 0.45rem;
    line-height: 1.12;
}

.rom-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    margin-bottom: 0.65rem;
}

.rom-system {
    font-family: inherit;
    font-size: 0.66rem;
    color: #ffd89a;
    text-transform: uppercase;
}

.rom-size {
    color: var(--muted);
    font-size: 1.08rem;
}

.rom-actions {
    margin-top: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
}

.pagination {
    margin-top: 1.2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: center;
}

.page-btn {
    min-width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.6rem;
    border-radius: 3px;
    text-decoration: none;
    font-size: 1.05rem;
    color: #ffeacc;
    background: rgba(255, 183, 3, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.page-btn.active {
    background: rgba(255, 122, 69, 0.38);
    color: #fff;
}

.page-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    color: #ffd7a6;
    opacity: 0.75;
}

.btn-rom {
    min-height: 42px;
    padding: 0.68rem 0.6rem;
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.btn-download {
    background: rgba(255, 183, 3, 0.3);
    color: #fff7e3;
}

.btn-play {
    background: rgba(255, 122, 69, 0.34);
    color: #fff4ea;
}

.btn-play-lg {
    min-height: 46px;
    padding: 0.9rem 1.25rem;
    font-size: 0.9rem;
}

.game-page-actions .btn,
.game-page-actions .btn-play-lg {
    min-width: 180px;
}

.game-page-actions .btn {
    font-size: 0.92rem;
}

.game-detail {
    padding: 1.8rem 0;
}

.game-breadcrumb {
    margin-bottom: 1rem;
}

.game-breadcrumb a {
    color: #ffd89a;
    text-decoration: none;
    font-size: 1.35rem;
}

.game-main {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.game-visual,
.game-content {
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid rgba(166, 180, 200, 0.2);
    box-shadow: 0 8px 22px rgba(2, 8, 23, 0.28);
}

.game-visual {
    padding: 0.7rem;
    align-self: start;
}

.game-page-cover {
    width: 100%;
    display: block;
    border-radius: 10px;
}

.game-content {
    padding: 1rem;
}

.game-page-title {
    font-size: clamp(1.2rem, 2.2vw, 1.8rem);
    margin-bottom: 0.75rem;
}

.game-page-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 1rem;
    font-size: 1.22rem;
}

.game-page-system {
    color: #ffd89a;
}

.game-page-size {
    color: #fde68a;
}

.game-page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-bottom: 1rem;
}

.game-description-box {
    padding: 0.9rem;
    border-radius: 3px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(166, 180, 200, 0.2);
}

.game-description-box h3 {
    font-size: 0.72rem;
    margin-bottom: 0.45rem;
    color: #ffd89a;
}

.game-description-text {
    font-size: 1.22rem;
    color: #d7e4f8;
}

#lift-btn {
    position: fixed;
    bottom: 1.1rem;
    right: 1.1rem;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 3px;
    background: rgba(255, 122, 69, 0.88);
    color: #2c1306;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: 0.2s ease;
    font-family: inherit;
    font-weight: 700;
}

#lift-btn.visible {
    opacity: 1;
    visibility: visible;
}

footer {
    padding: 1.9rem 0;
    text-align: center;
    color: var(--muted);
    font-size: 1.16rem;
}

@media (max-width: 900px) {
    .features-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .game-main {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 0.75rem;
    }

    .crt-overlay,
    .crt-flicker {
        display: none;
    }

    #bg-canvas {
        opacity: 0.38;
    }

    header {
        flex-direction: column;
        align-items: stretch;
    }

    .header-right {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    nav {
        justify-content: center;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .gold-section {
        flex-direction: column;
        text-align: center;
    }

    .rom-actions {
        grid-template-columns: 1fr;
    }

    .btn-primary {
        width: 100%;
        max-width: 320px;
    }
}
