/* ============================================
   PSXForge - Dark Theme
   ============================================ */

:root {
    /* Colors */
    --bg-primary: #0d0f14;
    --bg-secondary: #141820;
    --bg-tertiary: #1a1f2e;
    --bg-card: #161b27;
    --bg-card-hover: #1c2235;

    --text-primary: #e8eaed;
    --text-secondary: #bfc4d1;
    --text-muted: #a4acbe;

    --accent: #4a7dff;
    --accent-hover: #6191ff;
    --accent-glow: rgba(74, 125, 255, 0.15);
    --accent-subtle: rgba(74, 125, 255, 0.08);

    --success: #34d399;
    --warning: #fbbf24;
    --error: #f87171;

    --border: #252a3a;
    --border-light: #2e3448;

    /* Typography */
    --font-heading: 'Orbitron', sans-serif;
    --font-ui: 'Exo 2', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    /* Spacing */
    --nav-height: 64px;
    --container-max: 1200px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

/* ============================================
   Reset & Base
   ============================================ */

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
}

body {
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.hidden {
    display: none !important;
}

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================
   Splash Screen
   ============================================ */

.splash {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    opacity: 1;
    transition: opacity 0.6s ease;
}

.splash.fade-out {
    opacity: 0;
    pointer-events: none;
}

.splash-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.splash-logo {
    width: 280px;
    height: 280px;
    object-fit: contain;
    border-radius: var(--radius-xl);
    opacity: 0;
    transform: scale(0.9);
    animation: splashLogoIn 0.8s ease forwards;
    animation-delay: 0.2s;
    box-shadow:
        0 0 60px rgba(74, 125, 255, 0.15),
        0 20px 60px rgba(0, 0, 0, 0.5);
}

@keyframes splashLogoIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.splash-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
    animation-delay: 0.8s;
}

.splash-bar {
    width: 240px;
    height: 3px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.splash-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 2px;
    animation: splashProgress 2s ease-in-out forwards;
    animation-delay: 1s;
}

@keyframes splashProgress {
    0% { width: 0%; }
    20% { width: 30%; }
    50% { width: 60%; }
    80% { width: 85%; }
    100% { width: 100%; }
}

.splash-text {
    font-size: 13px;
    font-family: var(--font-heading);
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.splash-version {
    position: absolute;
    bottom: 24px;
    right: 24px;
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
    animation-delay: 1s;
}

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

/* ============================================
   Navigation
   ============================================ */

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--nav-height);
    background: rgba(13, 15, 20, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* RTL (Arabic): keep the top nav bar in LTR orientation so the language switcher
   stays pinned in the top-RIGHT corner — the same place it lives in every other
   language. If a user flips to Arabic by accident, the flag is exactly where they
   expect it, so they can switch back. The page body still renders RTL; only the
   nav chrome keeps LTR order (brand left, switcher far right). */
[dir="rtl"] .nav-inner { direction: ltr; }

.nav-brand {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
    text-decoration: none;
}

.nav-brand-psx {
    color: var(--text-primary);
}

.nav-brand-forge {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-link {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}
.nav-link:hover {
    color: var(--text-primary);
}

.nav-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.nav-username {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
    box-shadow: 0 0 20px rgba(74, 125, 255, 0.3);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-light);
}
.btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
    background: var(--accent-subtle);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
    border-radius: var(--radius-lg);
}

/* ============================================
   Hero
   ============================================ */

.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--nav-height) + 40px) 24px 80px;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(74, 125, 255, 0.08) 0%, transparent 60%),
        var(--bg-primary);
}

.scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
    pointer-events: none;
}

.hero-content {
    position: relative;
    max-width: 800px;
    text-align: center;
}

.hero-title {
    font-size: clamp(36px, 6vw, 64px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -1.5px;
    margin-bottom: 24px;
}

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

.hero-subtitle {
    font-size: 18px;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
}

.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-heading);
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--warning);
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 20px;
    margin-bottom: 24px;
}

.hero-cta {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 64px;
}

.hero-stats {
    display: flex;
    gap: 48px;
    justify-content: center;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-heading);
    letter-spacing: 1px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================
   Hero Floating Characters
   ============================================ */

.hero-floaters {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 40px;
    z-index: 1;
    pointer-events: none;
}

.hero-floaters-left {
    left: 3%;
}

.hero-floaters-right {
    right: 3%;
}

.hero-floater {
    width: 120px;
    height: 120px;
    object-fit: contain;
    opacity: 0;
    animation: floatIn 0.8s ease forwards, floatBob 4s ease-in-out infinite;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.5));
}

@keyframes floatIn {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 0.7; transform: translateY(0) scale(1); }
}

@keyframes floatBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

/* ============================================
   Scrolling Items Banner
   ============================================ */

.scroll-banner {
    overflow: hidden;
    padding: 24px 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.scroll-track {
    display: flex;
    align-items: center;
    animation: scrollItems 40s linear infinite;
    width: max-content;
}

.scroll-item {
    width: 64px;
    height: 64px;
    object-fit: contain;
    opacity: 0.6;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
    transition: opacity 0.3s;
    margin: 0 24px;
    flex-shrink: 0;
}

.scroll-item:hover {
    opacity: 1;
}

@keyframes scrollItems {
    from { transform: translateX(0); }
    to { transform: translateX(calc(-50% - 0.5px)); }
}

/* ============================================
   Feature Images
   ============================================ */

.feature-img {
    width: 72px;
    height: 72px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

/* ============================================
   Character & World Showcase
   ============================================ */

.showcase-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 48px;
}

.showcase-sprite {
    width: 100px;
    height: 100px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 8px;
    transition: all 0.3s;
}

.showcase-sprite:hover {
    transform: translateY(-4px) scale(1.05);
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(74, 125, 255, 0.2);
}

.showcase-sprite img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.showcase-worlds {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.showcase-world {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    aspect-ratio: 1;
    transition: all 0.3s;
}

.showcase-world:hover {
    transform: scale(1.02);
    border-color: var(--accent);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.showcase-world img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================
   Steps with Images
   ============================================ */

.steps-visual {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 24px;
}

.step-visual {
    flex: 1;
    max-width: 300px;
    text-align: center;
}

.step-visual-img {
    width: 140px;
    height: 140px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-visual-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.5));
}

.step-visual h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.step-visual p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ============================================
   Game Objects Showcase
   ============================================ */

.game-objects-row {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 64px;
}

.game-object {
    width: 160px;
    height: 160px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-object:hover {
    transform: translateY(-6px) scale(1.05);
    border-color: var(--accent);
    box-shadow: 0 12px 32px rgba(74, 125, 255, 0.2);
}

.game-object img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

/* Retro Media Row */

.retro-media-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}

.retro-media-item {
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
}

.retro-media-item:hover {
    transform: rotate(-3deg) scale(1.08);
}

.retro-media-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.6));
}

.retro-media-text {
    max-width: 280px;
}

.retro-media-text p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
    border-left: 3px solid var(--accent);
    padding-left: 16px;
}

/* CTA Seal */

.cta-seal {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin: 0 auto 24px;
    position: relative;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
    opacity: 0.85;
}

/* ============================================
   CTA Floaters
   ============================================ */

.cta-floaters {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.cta-floater {
    position: absolute;
    width: 120px;
    height: 120px;
    object-fit: contain;
    opacity: 0.15;
    animation: floatBob 5s ease-in-out infinite;
}

.cta-floater-left {
    left: 5%;
    top: 50%;
    transform: translateY(-50%);
}

.cta-floater-right {
    right: 5%;
    top: 50%;
    transform: translateY(-50%);
    animation-delay: 1.5s;
}

/* ============================================
   Sections
   ============================================ */

.section {
    padding: 100px 0;
}

.section-alt {
    background: var(--bg-secondary);
}

.section-title {
    font-size: 36px;
    font-weight: 700;
    text-align: center;
    letter-spacing: -0.5px;
    margin-bottom: 12px;
}

.section-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 64px;
}

/* ============================================
   Features Grid
   ============================================ */

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: all 0.3s;
}

.feature-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.feature-card-planned {
    position: relative;
    border-style: dashed;
    opacity: 0.85;
}

.planned-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--warning);
    color: #1a1a2e;
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.feature-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-subtle);
    border-radius: var(--radius);
    color: var(--accent);
    margin-bottom: 20px;
}

.feature-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ============================================
   Steps (How It Works)
   ============================================ */

.steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 24px;
}

.step {
    flex: 1;
    max-width: 300px;
    text-align: center;
}

.step-number {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    background: var(--accent);
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    border-radius: 50%;
    font-family: var(--font-heading);
}

.step h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.step p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.step-arrow {
    color: var(--text-muted);
    padding-top: 16px;
    flex-shrink: 0;
}

/* ============================================
   CTA Section
   ============================================ */

.cta-section {
    padding: 80px 0;
}

.cta-box {
    text-align: center;
    padding: 64px 40px;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    position: relative;
    overflow: hidden;
}

.cta-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, var(--accent-glow), transparent 70%);
    pointer-events: none;
}

.cta-box h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    position: relative;
}

.cta-box p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    position: relative;
}

.cta-box .btn {
    position: relative;
}

/* ============================================
   Footer
   ============================================ */

.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 64px 0 0;
}

.footer-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    gap: 48px;
    margin-bottom: 48px;
}

.footer-tagline {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 8px;
}

.footer-links {
    display: flex;
    gap: 64px;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-col h4 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.footer-col a {
    font-size: 14px;
    color: var(--text-secondary);
    transition: color 0.2s;
}
.footer-col a:hover {
    color: var(--text-primary);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding: 20px 24px;
    text-align: center;
}

.footer-bottom p {
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1100px) {
    .hero-floaters {
        display: none;
    }
}

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

    .hero-stats {
        gap: 24px;
    }

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

    .steps, .steps-visual {
        flex-direction: column;
        align-items: center;
    }

    .step-arrow {
        transform: rotate(90deg);
        padding: 0;
    }

    .showcase-worlds {
        grid-template-columns: 1fr;
    }

    .showcase-sprite {
        width: 80px;
        height: 80px;
    }

    .game-object {
        width: 120px;
        height: 120px;
    }

    .retro-media-item {
        width: 110px;
        height: 110px;
    }

    .retro-media-text {
        text-align: center;
        max-width: 100%;
    }

    .retro-media-text p {
        border-left: none;
        padding-left: 0;
        border-top: 3px solid var(--accent);
        padding-top: 16px;
    }

    .cta-floater {
        display: none;
    }

    .footer-inner {
        flex-direction: column;
    }

    .footer-links {
        flex-wrap: wrap;
        gap: 32px;
    }
}

/* ========== Custom scrollbars ========== */
/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border, #2a2e3d) transparent;
}
/* Chrome / Edge / Safari */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
}
::-webkit-scrollbar-thumb {
    background: var(--border, #2a2e3d);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent, #4a7dff);
    background-clip: content-box;
}
::-webkit-scrollbar-corner {
    background: transparent;
}

/* ===== Language switcher (worker w002) — nav + editor toolbar ===== */
.lang-switch{position:relative;display:inline-block}
.lang-switch>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:6px;padding:6px 10px;border:1px solid var(--border);border-radius:var(--radius);background:var(--bg-secondary);color:var(--text-primary);font-size:13px;font-weight:600}
.lang-switch>summary::-webkit-details-marker{display:none}
.lang-switch .lang-caret{font-size:10px;opacity:.7}
.lang-menu{position:absolute;right:0;top:calc(100% + 6px);background:var(--bg-secondary);border:1px solid var(--border);border-radius:var(--radius);padding:6px;min-width:124px;z-index:3000;max-height:60vh;overflow:auto;box-shadow:0 8px 24px rgba(0,0,0,.45)}
.lang-item{display:flex;align-items:center;gap:8px;padding:6px 10px;border-radius:6px;color:var(--text-primary);text-decoration:none;font-size:13px;font-weight:600}
.lang-item:hover{background:rgba(255,255,255,.07)}
.lang-item.active{background:var(--accent,#3b6fff);color:#fff}
.lang-item img,.lang-switch>summary img{border-radius:2px;flex:none;display:block}
/* Compact variant for the editor toolbar (matches its tiny buttons). */
.lang-switch-compact>summary{gap:4px;padding:3px 8px;font-size:10px}
.lang-switch-compact>summary img{width:18px;height:13.5px}
.lang-switch-compact .lang-caret{font-size:8px}
