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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #0c0c0c 0%, #1a1a2e 25%, #16213e 50%, #0f3460 75%, #16213e 100%);
    color: #e0e0e0;
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 20%, rgba(138, 43, 226, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(75, 0, 130, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(72, 61, 139, 0.1) 0%, transparent 50%);
    animation: backgroundShift 20s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes backgroundShift {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

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

.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.logo i {
    font-size: 3rem;
    background: linear-gradient(45deg, #8a2be2, #4b0082, #483d8b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(45deg, #8a2be2, #4b0082, #483d8b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(138, 43, 226, 0.3);
}

.subtitle {
    font-size: 1.2rem;
    color: #b0b0b0;
    font-weight: 300;
    margin-top: 10px;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.upload-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(138, 43, 226, 0.2);
}

.upload-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-radius: 10px;
    color: #b0b0b0;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn:hover {
    background: rgba(138, 43, 226, 0.1);
    color: #e0e0e0;
}

.tab-btn.active {
    background: linear-gradient(45deg, #8a2be2, #4b0082);
    color: white;
    border-color: #8a2be2;
}

.tab-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.items-browser {
    min-height: 300px;
}

.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-radius: 10px;
    color: #e0e0e0;
    font-size: 1rem;
}

.search-box input:focus {
    outline: none;
    border-color: #8a2be2;
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.3);
}

.search-box i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #8a2be2;
}

.category-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
}

.category-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(138, 43, 226, 0.3);
    border-radius: 10px;
    padding: 8px 16px;
    color: #b0b0b0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-btn:hover {
    border-color: rgba(138, 43, 226, 0.6);
    background: rgba(138, 43, 226, 0.1);
    color: #e0e0e0;
}

.category-btn.active {
    border-color: #8a2be2;
    background: rgba(138, 43, 226, 0.2);
    color: #fff;
}

.category-btn.disabled {
    border-color: rgba(128, 128, 128, 0.3);
    background: rgba(128, 128, 128, 0.05);
    color: #808080;
    cursor: not-allowed;
}

.items-grid, .minecraft-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.item-card {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    position: relative;
}

.item-card:hover {
    border-color: rgba(138, 43, 226, 0.5);
    background: rgba(138, 43, 226, 0.1);
    transform: scale(1.05);
}

.item-card.selected {
    border-color: #8a2be2;
    background: rgba(138, 43, 226, 0.2);
}

.item-card img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    image-rendering: pixelated;
    background: transparent;
    display: block;
    min-width: 32px;
    min-height: 32px;
}

.item-image-container {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.item-image-container svg {
    width: 32px !important;
    height: 32px !important;
    display: block;
}

.item-card img[src*="blocks"] {
    image-rendering: auto;
    filter: contrast(1.1) brightness(1.1);
    object-fit: cover;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.item-card .item-name {
    font-size: 0.7rem;
    text-align: center;
    margin-top: 4px;
    color: #b0b0b0;
    line-height: 1.2;
}

.upload-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 30px;
    border: 2px dashed rgba(138, 43, 226, 0.3);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.upload-section:hover {
    border-color: rgba(138, 43, 226, 0.6);
    box-shadow: 0 10px 30px rgba(138, 43, 226, 0.2);
}

.upload-area {
    text-align: center;
    padding: 40px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    transform: translateY(-5px);
}

.upload-icon {
    font-size: 4rem;
    color: #8a2be2;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

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

.upload-area h3 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: #e0e0e0;
}

.upload-area p {
    color: #b0b0b0;
    margin-bottom: 20px;
}

.upload-btn {
    background: linear-gradient(45deg, #8a2be2, #4b0082);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 15px rgba(138, 43, 226, 0.3);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(138, 43, 226, 0.5);
}

.file-info {
    background: rgba(138, 43, 226, 0.1);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(138, 43, 226, 0.3);
}

.file-details {
    display: flex;
    align-items: center;
    gap: 15px;
}

.file-details i {
    font-size: 2rem;
    color: #8a2be2;
}

.file-text {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.file-name {
    font-weight: 600;
    color: #e0e0e0;
    font-size: 1.1rem;
}

.file-size {
    color: #b0b0b0;
    font-size: 0.9rem;
}

.remove-file {
    background: rgba(255, 0, 0, 0.2);
    color: #ff4444;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.remove-file:hover {
    background: rgba(255, 0, 0, 0.4);
    transform: scale(1.1);
}

.settings-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(138, 43, 226, 0.2);
}

.settings-section h3 {
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-section h3 i {
    color: #8a2be2;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    align-items: start;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-group label {
    font-weight: 500;
    color: #d0d0d0;
}

.setting-group input,
.setting-group select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-radius: 10px;
    padding: 12px;
    color: #e0e0e0;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.setting-group input:focus,
.setting-group select:focus {
    outline: none;
    border-color: #8a2be2;
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.3);
}

.setting-group input[type="range"] {
    height: 8px;
    background: rgba(138, 43, 226, 0.2);
    border-radius: 5px;
    padding: 0;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(45deg, #8a2be2, #4b0082);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(138, 43, 226, 0.5);
}

.range-value {
    font-size: 0.9rem;
    color: #8a2be2;
    font-weight: 600;
}

.color-picker-group {
    flex-direction: column !important;
}

.color-picker-container {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(138, 43, 226, 0.2);
}

.color-picker-container input[type="color"] {
    width: 60px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: none;
    padding: 0;
}

.color-picker-container input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
}

.color-picker-container input[type="color"]::-webkit-color-swatch {
    border: 2px solid rgba(138, 43, 226, 0.3);
    border-radius: 6px;
}

.color-picker-container input[type="text"] {
    width: 100px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(138, 43, 226, 0.3);
    color: #e0e0e0;
    padding: 8px 12px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.9rem;
}

.color-picker-container input[type="text"]:focus {
    outline: none;
    border-color: #8a2be2;
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.3);
}

.preview-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(138, 43, 226, 0.2);
}

.preview-section h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-section h3 i {
    color: #8a2be2;
}

.svg-preview {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(138, 43, 226, 0.2);
}

.svg-preview svg {
    max-width: 100%;
    max-height: 300px;
    filter: drop-shadow(0 0 10px rgba(138, 43, 226, 0.3));
}

.generate-section {
    text-align: center;
    margin: 20px 0;
}

.generate-btn {
    background: linear-gradient(45deg, #8a2be2, #4b0082, #483d8b);
    color: white;
    border: none;
    padding: 18px 50px;
    border-radius: 30px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 15px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(138, 43, 226, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.generate-btn:disabled {
    background: rgba(138, 43, 226, 0.3);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.generate-btn:not(:disabled):hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(138, 43, 226, 0.6);
}

.btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.generate-btn:hover .btn-glow {
    left: 100%;
}

.loading-section {
    text-align: center;
    padding: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(138, 43, 226, 0.3);
    border-top: 4px solid #8a2be2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-bar {
    width: 300px;
    height: 8px;
    background: rgba(138, 43, 226, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #8a2be2, #4b0082);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.result-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(138, 43, 226, 0.2);
}

.result-section h3 {
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: #4ade80;
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

.video-preview {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(138, 43, 226, 0.3);
    text-align: center;
}

.video-preview h4 {
    color: #e0e0e0;
    margin-bottom: 15px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.video-preview video {
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(138, 43, 226, 0.3);
    max-width: 100%;
}

.manim-code {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(138, 43, 226, 0.3);
}

.manim-code h4 {
    color: #e0e0e0;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.manim-code pre {
    background: rgba(0, 0, 0, 0.6);
    padding: 20px;
    border-radius: 10px;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    overflow-x: auto;
    line-height: 1.5;
    border: 1px solid rgba(138, 43, 226, 0.2);
}

.copy-btn {
    background: rgba(138, 43, 226, 0.2);
    color: #8a2be2;
    border: 1px solid rgba(138, 43, 226, 0.5);
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.copy-btn:hover {
    background: rgba(138, 43, 226, 0.4);
    transform: translateY(-2px);
}

.download-section {
    text-align: center;
}

.download-btn {
    background: linear-gradient(45deg, #4ade80, #22c55e);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 25px rgba(74, 222, 128, 0.3);
}

.download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(74, 222, 128, 0.5);
}

.download-info {
    color: #b0b0b0;
    margin-top: 15px;
    font-size: 0.9rem;
}

.footer {
    text-align: center;
    margin-top: 60px;
    padding: 30px 20px;
    border-top: 1px solid rgba(138, 43, 226, 0.2);
    color: #b0b0b0;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 15px;
}

.footer-link {
    color: #8a2be2;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.footer-link:hover {
    color: #b084f5;
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .result-content {
        grid-template-columns: 1fr;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 15px;
    }
}

.upload-area.drag-over {
    border-color: #8a2be2;
    background: rgba(138, 43, 226, 0.1);
    transform: scale(1.02);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(138, 43, 226, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #8a2be2, #4b0082);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #b084f5, #6a4c93);
}
