/* GoPixelArt - Neo-Pixel Pop Theme */
/* "Retro Future Minimalist" Design System */
/* Fonts are loaded from /static/css/fonts.css */

/* --- Reset & Base --- */
* {
    box-sizing: border-box; /* CRITICAL FIX: Ensures padding/border doesn't increase width */
}

/* --- Skip Link (Accessibility) --- */
.skip-link {
    position: absolute;
    top: -50px;
    left: 16px;
    background: #000;
    color: #fff;
    padding: 12px 20px;
    z-index: 10000;
    text-decoration: none;
    font-weight: bold;
    border-radius: 0; /* Sharp corners per spec */
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

:root {
    /* ========================================
       Core Colors - NES Inspired Palette
       ======================================== */
    
    /* Background */
    --bg-color: #FFFFFF;
    --bg-light: #f9fafb;
    --card-bg: #ffffff;
    --text-main: #000000;
    --text-dim: #6b7280;
    
    /* NES Palette - Primary Colors */
    --accent-primary: #3CB371;      /* NES Green - Success/Action */
    --accent-secondary: #ec4899;    /* Pink */
    --accent-yellow: #f59e0b;       /* Amber/Warning */
    --accent-green: #3CB371;        /* NES Green */
    --accent-red: #F83800;          /* NES Red */
    --border-color: #000000;
    
    /* Pixel-perfect shadows */
    --shadow-hard: 4px 4px 0px 0px #000000;
    --shadow-hover: 6px 6px 0px 0px #000000;
    --shadow-active: 0px 0px 0px 0px #000000; /* Fixed: shadow disappears on active */
    
    /* 统一变量 - 与 admin.css / style.css 兼容 */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --border-default: #e5e7eb;
    --border-subtle: #f1f5f9;
    --text-primary: #000000;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --accent: #000000;
    --success: #3CB371;             /* NES Green */
    --danger: #F83800;              /* NES Red */
    --warning: #f59e0b;
    
    /* Fonts - Clean and Modern */
    --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    
    /* Radius - Sharp corners per spec */
    --radius-sm: 0px;
    --radius-md: 0px;
    --radius-lg: 0px;
}

/* --- Base --- */
html {
    height: 100%;
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(#e5e7eb 1px, transparent 1px);
    background-size: 24px 24px;
    color: var(--text-main);
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    /* Sticky footer layout */
    display: flex;
    flex-direction: column;
}

/* 主内容区域撑满剩余空间 */
main, .main-content, .main-container {
    flex: 1 0 auto;
}

/* 页脚不收缩 */
footer, .site-footer {
    flex-shrink: 0;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: var(--font-body);
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

/* Hero title - clean modern styling */
.hero-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 16px;
    color: #000;
    letter-spacing: -0.5px;
}

/* Pixel-style accented text (optional use) */
.pixel-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    color: #000;
}

.hero-subtitle {
    font-size: 1rem;
    color: var(--text-dim);
    max-width: 600px;
    margin: 0 auto 40px;
    font-weight: 400;
    line-height: 1.6;
}

.pixel-font {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.5;
}

/* --- Navbar (Simplified) --- */
.navbar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative; /* Context for absolute menu */
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: transparent;
    object-fit: contain;
    image-rendering: pixelated;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: #000;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

.nav-group {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-main {
    gap: 28px;
}

.nav-divider {
    width: 1px;
    height: 20px;
    background: #e5e7eb;
    margin: 0 8px;
}

.nav-links a {
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s;
    border: none;
    padding: 0;
    white-space: nowrap;
}

.nav-links a:hover, .nav-links a.active {
    color: #000;
    background: none;
    box-shadow: none;
    transform: none;
}

.nav-links a.active {
    font-weight: 700;
}

.nav-external .external-link {
    color: var(--accent-primary);
    font-weight: 600;
}

.nav-user {
    gap: 16px;
}

.nav-user a {
    color: var(--text-dim);
}

.nav-user .nav-logout {
    opacity: 0.7;
    font-size: 0.85rem;
}

.nav-user .nav-logout:hover {
    opacity: 1;
}

.lang-switch {
    padding: 4px 10px;
    border-radius: 4px;
    background: #f3f4f6;
    font-size: 0.8rem !important;
    color: var(--text-dim) !important;
}

.lang-switch:hover {
    background: #e5e7eb;
}

.logo-subtext {
    margin-left: 10px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* --- Generator Box --- */
.generator-box {
    background: var(--card-bg);
    border: 3px solid var(--border-color);
    border-radius: 0;  /* Sharp corners per spec */
    box-shadow: var(--shadow-hard);
    padding: 40px;
    margin-top: 20px;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.generator-box:hover {
    box-shadow: var(--shadow-hover);
    transform: translate(-2px, -2px);
}

/* --- Inputs --- */
.input-group {
    margin-bottom: 24px;
    text-align: left;
}

.input-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    color: #000;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-pixel {
    width: 100%;
    padding: 16px;
    font-family: var(--font-body);
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: 0;  /* Sharp corners per spec */
    background: #fff;
    color: var(--text-main);
    outline: none;
    transition: all 0.2s;
    box-shadow: 2px 2px 0px 0px #000;
}

.input-pixel:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-hard);
    transform: translate(-2px, -2px);
}

/* Input validation states */
.input-pixel:invalid:not(:focus):not(:placeholder-shown) {
    border-color: var(--accent-red);
    box-shadow: 2px 2px 0px 0px var(--accent-red);
}

.input-pixel:valid:not(:placeholder-shown) {
    border-color: var(--accent-primary);
}

/* --- Buttons --- */
.btn-pixel {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 16px 32px;
    background: #fff;
    border: 3px solid var(--border-color);
    border-radius: var(--radius-md);
    color: #000;
    font-weight: 700;
    font-size: 1rem;
    font-family: var(--font-body);
    cursor: pointer;
    box-shadow: var(--shadow-hard);
    transition: all 0.1s;
    text-decoration: none;
    gap: 8px;
}

.btn-pixel:hover {
    box-shadow: var(--shadow-hover);
    transform: translate(-2px, -2px);
    background: #f9fafb;
}

.btn-pixel:active {
    box-shadow: var(--shadow-active);
    transform: translate(0, 0);
}

.btn-primary {
    background: var(--accent-primary);
    color: #fff;
}
.btn-primary:hover {
    background: #7c3aed;
}

.btn-outline {
    background: transparent;
}

.btn-sm {
    padding: 10px 16px;
    font-size: 0.9rem;
}

/* --- Radio Options --- */
.size-option input { display: none; }
.size-option span.btn-pixel {
    width: 100%;
    text-align: center;
    background: #fff;
    color: var(--text-dim);
    box-shadow: 2px 2px 0 #000;
    padding: 12px;
}

.size-option input:checked + span.btn-pixel {
    background: var(--accent-yellow);
    color: #000;
    box-shadow: var(--shadow-hard);
    transform: translate(-2px, -2px);
    border-color: #000;
}

/* --- Tags --- */
.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.tag-pixel {
    background: #f3f4f6;
    border: 2px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 2px 2px 0 #000;
}

.tag-pixel:hover {
    background: var(--accent-secondary);
    color: #fff;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 #000;
}

/* --- Cards & Gallery --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

/* 仪表盘作品网格 - 更紧凑 */
.dashboard-container .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.card-pixel {
    background: #fff;
    border: 2px solid #000;
    border-radius: 0;  /* Sharp corners per spec */
    overflow: hidden;
    box-shadow: var(--shadow-hard);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.card-pixel:hover {
    transform: translate(-4px, -4px);
    box-shadow: 8px 8px 0 #000;
}

.card-image-container {
    background: #f9fafb;
    border-bottom: 3px solid #000;
    padding: 20px;
    position: relative;
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pixel-img {
    max-width: 100%;
    max-height: 100%;
    image-rendering: pixelated;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.card-body {
    padding: 16px;
    background: #fff;
}

.card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}
.card-pixel:hover .card-actions { opacity: 1; }

.action-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #000;
    background: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: 2px 2px 0 #000;
    transition: 0.1s;
    text-decoration: none;
    color: #000;
}
.action-btn:hover {
    background: var(--accent-yellow);
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 #000;
}

/* --- Loader --- */
.pixel-loader {
    width: 48px;
    height: 48px;
    background: var(--accent-primary);
    animation: loader-anim 1s infinite steps(4);
    box-shadow: 4px 4px 0 #000;
    margin: 0 auto;
}

@keyframes loader-anim {
    0% { transform: rotate(0deg); background: var(--accent-primary); }
    25% { transform: rotate(90deg); background: var(--accent-yellow); }
    50% { transform: rotate(180deg); background: var(--accent-red); }
    75% { transform: rotate(270deg); background: #000; }
    100% { transform: rotate(360deg); background: var(--accent-primary); }
}

/* Pixel bounce loader - alternative style */
.pixel-loader-bounce {
    width: 48px;
    height: 48px;
    position: relative;
    margin: 0 auto;
}

.pixel-loader-bounce::before,
.pixel-loader-bounce::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--accent-primary);
    box-shadow: 2px 2px 0 #000;
    animation: pixel-bounce 0.6s ease-in-out infinite alternate;
}

.pixel-loader-bounce::before { left: 0; }
.pixel-loader-bounce::after { right: 0; animation-delay: 0.3s; }

@keyframes pixel-bounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-20px); }
}

/* --- Empty State Component --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
}

.empty-state__icon {
    font-size: 4rem;
    margin-bottom: 20px;
    filter: grayscale(0.3);
}

.empty-state__title {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-main);
}

.empty-state__description {
    font-size: 1rem;
    margin-bottom: 24px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.empty-state__action {
    margin-top: 16px;
}

/* --- Modals --- */
.modal {
    display: none;
    position: fixed;
    z-index: 999;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: grayscale(100%);
}

.modal-content {
    background: #fff;
    margin: 5vh auto;
    padding: 40px;
    border: 3px solid #000;
    box-shadow: 8px 8px 0 #000;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border-radius: 0;  /* Sharp corners per spec */
}

.close-btn {
    position: absolute;
    right: 20px; top: 20px;
    font-size: 2rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}
.close-btn:hover { color: var(--accent-secondary); }

/* === User Dashboard === */
.dashboard-container {
    padding-top: 40px;
    padding-bottom: 60px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 32px;
}

.dashboard-header .hero-title {
    margin: 0;
    font-size: 1.75rem;
}

.dashboard-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* 统计卡片网格 */
.stats-grid-user {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-box {
    padding: 24px !important;
    margin-top: 0 !important;
    text-align: center;
    min-height: auto;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.stat-label--primary { color: var(--accent-primary); }
.stat-label--success { color: #22c55e; }
.stat-label--danger { color: #ef4444; }
.stat-label--warning { color: #f59e0b; }

.stat-value {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 8px;
    font-family: var(--font-pixel);
}

.stat-value--primary { color: var(--text-main); }
.stat-value--success { color: #22c55e; }
.stat-value--danger { color: #ef4444; }
.stat-value--warning { color: #f59e0b; }

.stat-desc {
    font-size: 0.8125rem;
    color: var(--text-dim);
}

/* Section Box */
.section-box {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #000;
}

.section-header-icon {
    font-size: 1.25rem;
}

/* API Grid */
.api-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 20px;
}

.api-stat-label {
    font-size: 0.8125rem;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.api-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.api-key-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.api-key-code {
    background: var(--bg-light);
    border: 2px solid #000;
    padding: 8px 12px;
    font-size: 0.75rem;
    font-family: monospace;
    word-break: break-all;
    flex: 1;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.section-footer {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px dashed #ccc;
}

.section-center {
    text-align: center;
    margin-top: 24px;
}

/* Card Pixel 样式 */
.card-pixel {
    background: var(--card-bg);
    border: 3px solid #000;
    box-shadow: var(--shadow-hard);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-pixel:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-hover);
}

.card-image-container {
    position: relative;
    aspect-ratio: 1;
    background: #f5f5f5;
    border-bottom: 3px solid #000;
}

.card-image-container .pixel-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.card-actions {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.card-pixel:hover .card-actions {
    opacity: 1;
}

.action-btn {
    width: 32px;
    height: 32px;
    background: #fff;
    border: 2px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.875rem;
    text-decoration: none;
}

.action-btn:hover {
    background: var(--accent-primary);
    color: #fff;
}

.action-btn--danger:hover {
    background: #ef4444;
    color: #fff;
}

/* Fallback 警告样式 */
.card-fallback {
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3);
}

.fallback-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 0.6rem;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    z-index: 10;
}

.card-body {
    padding: 12px;
}

.card-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 8px;
    color: var(--text-main);
}

.card-title--truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}

.card-id {
    color: var(--text-dim);
    font-family: monospace;
}

.badge-status {
    padding: 2px 8px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: lowercase;
    border: 2px solid #000;
}

.badge-completed { background: #dcfce7; color: #166534; }
.badge-pending { background: #fef9c3; color: #854d0e; }
.badge-failed { background: #fee2e2; color: #991b1b; }
.badge-processing { background: #dbeafe; color: #1e40af; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    grid-column: 1 / -1;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--text-dim);
    margin-bottom: 20px;
}

/* 响应式 */
@media (max-width: 1024px) {
    .stats-grid-user {
        grid-template-columns: repeat(2, 1fr);
    }
    .api-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .dashboard-actions {
        width: 100%;
    }
    .dashboard-actions .btn-pixel {
        flex: 1;
        text-align: center;
        font-size: 0.75rem;
        padding: 10px 12px;
    }
    .stats-grid-user {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .stat-box {
        padding: 16px !important;
    }
    .stat-value {
        font-size: 1.75rem;
    }
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

/* --- Footer --- */
footer {
    border-top: 3px solid #000;
    background: #fff;
    margin-top: 80px;
    padding: 40px 0;
}

/* Mobile */
@media (max-width: 640px) {
    .navbar { padding: 16px 0; } /* Ensure height for button */
    
    .nav-content {
        position: static; /* Let absolute menu position relative to container or body */
    }

    .hero-title { font-size: 1.5rem; }
    .hero-subtitle { font-size: 0.9rem; padding: 0 10px; }
    
    .generator-box { 
        padding: 24px 16px; 
        margin-top: 40px;
    }
    
    .nav-links { display: none; }
    .mobile-menu-btn { 
        display: flex !important; /* Force show button */
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: #fff;
        border: 2px solid #000;
        border-radius: 8px;
        cursor: pointer; 
        color: var(--text-main);
        z-index: 101; /* Above everything */
        box-shadow: 2px 2px 0 #000;
        transition: transform 0.15s, box-shadow 0.15s;
    }

    .mobile-menu-btn:hover {
        transform: translateY(-1px);
        box-shadow: 3px 3px 0 #000;
    }

    .mobile-menu-btn:active {
        transform: translateY(1px);
        box-shadow: 1px 1px 0 #000;
    }

    .mobile-menu-btn svg {
        width: 22px;
        height: 22px;
    }

    /* 关闭按钮状态 */
    .mobile-menu-btn.is-open .icon-menu {
        display: none;
    }

    .mobile-menu-btn.is-open .icon-close {
        display: block;
    }

    .mobile-menu-btn .icon-close {
        display: none;
    }
    
    .gallery-grid { grid-template-columns: 1fr; }
    
    .options-grid {
        flex-direction: column;
        gap: 16px !important;
    }
    
    .input-group { min-width: 100% !important; }
    
    .generator-box > div[style*="position: absolute"] {
        top: -12px !important;
        left: 50% !important;
        transform: translateX(-50%) rotate(-2deg) !important;
        width: max-content;
        font-size: 0.8rem !important;
        font-weight: 600 !important;
        padding: 4px 10px !important;
    }

    /* Mobile Menu - Smooth animation */
    .mobile-menu-container {
        display: flex;
        flex-direction: column;
        background: white;
        padding: 0;
        border-top: 3px solid #000;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        margin-left: 0;
        box-shadow: 0 4px 0 #000;
        z-index: 99;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
    }
    
    .mobile-menu-container.active {
        max-height: 85vh;
        opacity: 1;
        padding: 16px 0;
        overflow-y: auto;
    }

    .mobile-menu-container a,
    .mobile-menu-container button {
        padding: 16px 0;
        color: var(--text-main);
        text-decoration: none;
        border-bottom: 1px solid #f3f4f6;
        font-weight: 500;
        text-align: center;
        font-size: 1.1rem;
        background: none;
        border-left: none;
        border-right: none;
        border-top: none;
        cursor: pointer;
        width: 100%;
    }

    .mobile-menu-container a:hover,
    .mobile-menu-container button:hover {
        background: #f9fafb;
        color: var(--accent-primary);
    }

    .mobile-menu-container a.active {
        color: var(--accent-primary);
        font-weight: 700;
    }

    .mobile-menu-container .lang-switch {
        justify-content: center;
        padding: 16px 0;
        font-size: 1rem;
        color: var(--text-dim);
    }
}

.mobile-menu-btn { display: none; }
/* Force hide mobile menu on desktop */
@media (min-width: 641px) {
    .mobile-menu-container { display: none !important; }
}

/* Utilities */
.text-center { text-align: center; }

.progress-container {
    margin-top: 20px;
    display: none;
}

.progress-container.active {
    display: block;
}

.pixel-progress-track {
    width: 100%;
    height: 32px;
    background: #fff;
    border: 3px solid #000;
    box-shadow: 4px 4px 0 #000;
    position: relative;
    margin-bottom: 12px;
}

.pixel-progress-fill {
    height: 100%;
    background: var(--accent-primary);
    width: 0%;
    transition: width 0.3s ease-out;
    position: relative;
}

.pixel-progress-fill::after {
    content: "";
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 20px 20px;
    animation: move-stripes 1s linear infinite;
}

@keyframes move-stripes {
    0% { background-position: 0 0; }
    100% { background-position: 20px 20px; }
}

.progress-text {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-main);
}

.queue-section {
    max-width: 800px;
    margin: 60px auto;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 3px solid #000;
    padding-bottom: 10px;
}

.queue-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
}

.queue-stats {
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    gap: 16px;
}

.queue-stat-item {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #000;
    box-shadow: 2px 2px 0 #000;
    padding-right: 12px;
}

.queue-badge {
    padding: 6px 12px;
    border-right: 2px solid #000;
    font-size: 0.8rem;
    font-weight: bold;
    display: inline-block;
}
.badge-pending { background: var(--accent-yellow); color: #000; }
.badge-processing { background: var(--accent-secondary); color: #fff; }

.queue-stat-item span[id^="stat-"] {
    padding-left: 12px;
    font-weight: 700;
    font-family: var(--font-display);
    font-size: 1rem;
}

.queue-list {
    display: grid;
    gap: 16px;
}

.queue-card {
    background: #fff;
    border: 2px solid #000;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 4px 4px 0 #000;
    transition: transform 0.2s;
}

.queue-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 #000;
}

.queue-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.queue-prompt {
    font-weight: bold;
    font-size: 1rem;
}

.queue-meta {
    font-size: 0.85rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 640px) {
    .queue-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .queue-stats {
        width: 100%;
        justify-content: space-between;
    }
}

/* === Studio Modal - Complete Redesign === */

.studio-modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.studio-modal-content {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    max-width: 950px;
    width: 100%;
    height: 85vh;
    max-height: 700px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.studio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.studio-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.studio-close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    font-size: 1.25rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
}

.studio-close-btn:hover {
    background: #e5e7eb;
    color: #111827;
}

.studio-close-btn:focus-visible {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
}

/* Body */
.studio-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Canvas Area */
.studio-canvas-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: 
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
        linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-color: #fafafa;
    border-right: 1px solid #e5e7eb;
    overflow: auto;
}

.studio-canvas-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100%;
    min-height: 100%;
}

.studio-canvas-wrapper {
    background: #ffffff;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    box-shadow: 
        0 10px 25px -5px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05);
    line-height: 0;
}

.studio-canvas-wrapper canvas {
    display: block;
    cursor: grab;
}

.studio-canvas-wrapper canvas:active {
    cursor: grabbing;
}

/* Sidebar */
.studio-sidebar {
    width: 260px;
    background: #ffffff;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

/* Control Groups */
.studio-control-group {
    border: none;
    padding: 0;
    margin: 0;
}

.studio-control-group legend,
.studio-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
}

/* D-Pad */
.studio-dpad {
    display: grid;
    grid-template-columns: repeat(3, 36px);
    gap: 4px;
    justify-content: center;
    margin-bottom: 12px;
}

.studio-dpad-center {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

/* Buttons */
.studio-btn {
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
}

.studio-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.studio-btn:active {
    background: #f3f4f6;
    transform: scale(0.95);
}

.studio-btn:focus-visible {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
}

.studio-btn-wide {
    flex: 1;
    font-size: 0.75rem;
}

.studio-btn-sm {
    height: 28px;
    padding: 0 10px;
    font-size: 0.75rem;
}

/* Drawing Tools */
.studio-tools {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.studio-tool-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    color: #6b7280;
}

.studio-tool-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
}

.studio-tool-btn.active {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.studio-tool-btn:focus-visible {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
}

/* Color Palette */
.studio-palette {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.studio-color-btn {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

.studio-color-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.studio-color-btn.active {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px #8b5cf6, 0 2px 8px rgba(139, 92, 246, 0.3);
    transform: scale(1.05);
}

.studio-color-btn:focus-visible {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
}

/* Custom Color Picker */
.studio-custom-color {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.studio-label-sm {
    font-size: 0.75rem;
    color: #6b7280;
}

.studio-color-picker-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
}

.studio-color-picker-wrap input[type="color"] {
    width: 48px;
    height: 32px;
    padding: 2px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    background: #ffffff;
}

.studio-color-picker-wrap input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.studio-color-picker-wrap input[type="color"]::-webkit-color-swatch {
    border-radius: 4px;
    border: none;
}

/* History Buttons */
.studio-history-btns {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.studio-history-btns .studio-btn {
    flex: 1;
    gap: 4px;
    font-size: 0.75rem;
}

.studio-history-btns .studio-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.studio-history-btns .studio-btn svg {
    flex-shrink: 0;
}

/* Checkbox */
.studio-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: #374151;
    cursor: pointer;
}

.studio-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #8b5cf6;
    cursor: pointer;
}

/* Zoom Controls */
.studio-zoom-controls {
    display: flex;
    gap: 6px;
}

/* Slider */
.studio-slider-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.studio-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
}

.studio-slider:focus {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
}

.studio-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #8b5cf6;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
    transition: transform 0.1s;
}

.studio-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.studio-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #8b5cf6;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
}

.studio-slider:focus-visible {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
}

.studio-slider-value {
    text-align: right;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8125rem;
    color: #6b7280;
}

/* Info Section */
.studio-info-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
    margin: 0;
    font-size: 0.8125rem;
}

.studio-info-list dt {
    color: #6b7280;
}

.studio-info-list dd {
    margin: 0;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: #111827;
}

/* Actions */
.studio-actions {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.studio-download-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
}

.studio-download-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 10px -2px rgba(16, 185, 129, 0.4);
}

.studio-download-btn:active {
    transform: translateY(0);
}

.studio-download-btn:focus-visible {
    outline: 2px solid #10b981;
    outline-offset: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .studio-modal-content {
        height: 95vh;
        max-height: none;
        border-radius: 12px 12px 0 0;
    }
    
    .studio-body {
        flex-direction: column;
    }
    
    .studio-canvas-area {
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        min-height: 300px;
    }
    
    .studio-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 16px;
        padding: 16px;
    }
    
    .studio-control-group {
        flex: 1;
        min-width: 140px;
    }
    
    .studio-actions {
        flex: 100%;
        margin-top: 0;
        padding-top: 0;
        border-top: none;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

*:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}