@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=JetBrains+Mono:wght@400;700&family=Space+Grotesk:wght@300;400;700&display=swap');

:root {
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --panel-bg: rgba(37, 37, 66, 0.8);
    --cyan: #00d4ff;
    --magenta: #ff00ff;
    --green: #39ff14;
    --text: #e0e0e0;
    --text-dim: #888;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text);
    min-height: 100vh;
}

.app-container {
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(0, 212, 255, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(255, 0, 255, 0.05) 0%, transparent 50%);
}

.title-font {
    font-family: 'Press Start 2P', cursive;
    text-shadow: 0 0 10px var(--cyan), 0 0 20px rgba(0, 212, 255, 0.3);
    letter-spacing: 2px;
}

.section-title {
    font-family: 'JetBrains Mono', monospace;
    color: var(--cyan);
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.label-text {
    display: block;
    color: var(--text-dim);
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    font-family: 'JetBrains Mono', monospace;
}

.header-glow {
    background: linear-gradient(180deg, rgba(0, 212, 255, 0.1) 0%, transparent 100%);
}

.footer-glow {
    background: linear-gradient(0deg, rgba(255, 0, 255, 0.05) 0%, transparent 100%);
}

.panel {
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 8px;
    transition: border-color 0.3s ease;
}

.panel:hover {
    border-color: rgba(0, 212, 255, 0.4);
}

.input-field {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 4px;
    padding: 0.625rem 0.75rem;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.color-picker {
    width: 100%;
    height: 36px;
    border: 2px solid rgba(0, 212, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
}

.color-picker::-webkit-color-swatch {
    border-radius: 2px;
    border: none;
}

.range-slider {
    -webkit-appearance: none;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--cyan);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--cyan);
}

.pose-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-dim);
}

.pose-btn:hover {
    border-color: var(--magenta);
    transform: translateY(-2px);
}

.pose-btn.active {
    background: rgba(255, 0, 255, 0.2);
    border-color: var(--magenta);
    color: var(--text);
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.3);
}

.upload-zone {
    border: 2px dashed rgba(0, 212, 255, 0.4);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-dim);
}

.upload-zone:hover {
    border-color: var(--cyan);
    background: rgba(0, 212, 255, 0.05);
}

.upload-thumb {
    position: relative;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    cursor: grab;
}

.upload-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
}

.upload-thumb:hover .thumb-overlay {
    opacity: 1;
}

.thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.grid-assign-btn {
    background: rgba(0, 212, 255, 0.2);
    border: none;
    color: var(--text);
    font-size: 8px;
    cursor: pointer;
}

.grid-assign-btn:hover {
    background: var(--cyan);
    color: black;
}

.prompt-area {
    width: 100%;
    height: 80px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 4px;
    padding: 0.75rem;
    color: var(--green);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    resize: none;
}

.canvas-container {
    display: inline-block;
    transition: transform 0.2s ease;
}

.sprite-canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 2px solid rgba(0, 212, 255, 0.5);
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.2);
}

.toggle-btn, .zoom-btn {
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
}

.toggle-btn:hover, .zoom-btn:hover {
    border-color: var(--cyan);
}

.toggle-btn.active, .zoom-btn.active {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--cyan);
    color: var(--cyan);
}

.btn-primary {
    background: linear-gradient(135deg, var(--cyan) 0%, var(--magenta) 100%);
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: 6px;
    color: white;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 212, 255, 0.4);
    padding: 0.625rem 1rem;
    border-radius: 6px;
    color: var(--cyan);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--cyan);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 212, 255, 0.2);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-bar {
    height: 6px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cyan), var(--magenta));
    transition: width 0.3s ease;
}

.history-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-item:hover {
    border-color: var(--magenta);
    background: rgba(255, 0, 255, 0.1);
}

.pixel-icon {
    animation: bounce 2s infinite;
}

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

/* Mobile Optimizations */
@media (max-width: 1024px) {
    .canvas-container {
        overflow-x: auto;
        overflow-y: hidden;
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .title-font {
        font-size: 0.875rem !important;
    }
    
    .pose-btn {
        padding: 0.375rem;
    }
    
    .pose-btn span:last-child {
        display: none;
    }
}