/* Custom Font - PORKYS */
@font-face {
    font-family: 'PORKYS';
    src: url('PORKYS_.TTF') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'PORKYS', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-tertiary: #1f1f1f;
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --accent-glow: rgba(139, 92, 246, 0.3);
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --text-tertiary: #6b7280;
    --border: #27272a;
    --border-light: #3f3f46;
    --success: #10b981;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.8);
}

[data-theme="light"] {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e5e5e5;
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --accent-glow: rgba(139, 92, 246, 0.2);
    --text-primary: #1a1a1a;
    --text-secondary: #4b5563;
    --text-tertiary: #6b7280;
    --border: #e5e7eb;
    --border-light: #d1d5db;
    --success: #10b981;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.25);
}

body {
    font-family: 'PORKYS', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-primary) 100%);
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
    color: var(--text-primary);
    overflow: hidden;
    overflow-x: hidden;
    font-weight: 400;
    letter-spacing: -0.01em;
    transition: background 0.3s ease, color 0.3s ease;
    position: relative;
    width: 100%;
    max-width: 100vw;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

[data-theme="light"] body {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

header {
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    padding: 1.75rem 2.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 
                inset 0 1px 0 rgba(255, 255, 255, 0.08),
                0 1px 0 rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 10;
    overflow: visible;
    width: 100%;
    box-sizing: border-box;
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
    opacity: 0.5;
}

[data-theme="light"] header {
    background: rgba(255, 255, 255, 0.9);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}


.logo-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

[data-theme="light"] .logo {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.theme-toggle {
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.theme-toggle:hover {
    background: rgba(20, 20, 20, 0.8);
    border-color: rgba(139, 92, 246, 0.4);
    transform: scale(1.08) rotate(5deg);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.3),
                0 0 0 1px rgba(139, 92, 246, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.theme-toggle:hover::before {
    width: 100px;
    height: 100px;
}

[data-theme="light"] .theme-toggle {
    background: rgba(229, 229, 229, 0.6);
}

[data-theme="light"] .theme-toggle:hover {
    background: rgba(229, 229, 229, 0.8);
}

header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.sidebar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(20, 20, 20, 0.85);
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    overflow-x: hidden;
    overflow-y: hidden;
    padding: 1.5rem;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.08);
    z-index: 1000;
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    max-height: 350px;
    justify-content: flex-start;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, transparent, var(--accent-glow), transparent);
    opacity: 0.3;
}

[data-theme="light"] .sidebar {
    background: rgba(255, 255, 255, 0.8);
}

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

.sidebar::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #333;
}

.panel {
    background: rgba(31, 31, 31, 0.4);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 1.5rem;
    margin-bottom: 0;
    margin-right: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 
                inset 0 1px 0 rgba(255, 255, 255, 0.08),
                0 0 0 1px rgba(255, 255, 255, 0.03);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    min-width: 300px;
    max-width: 400px;
}

#hat-panel,
#shirt-panel {
    margin-left: 0;
}

#scene-panel {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    margin: 0;
    min-width: 300px;
    max-width: 350px;
}

.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.1), transparent);
    transition: left 0.5s ease;
}

.panel:hover::before {
    left: 100%;
}

[data-theme="light"] .panel {
    background: rgba(245, 245, 245, 0.8);
}

.panel:hover {
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(139, 92, 246, 0.3),
                0 0 40px rgba(139, 92, 246, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transform: translateY(-4px) scale(1.01);
    background: rgba(31, 31, 31, 0.5);
}

.panel h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    letter-spacing: -0.015em;
}

.panel p {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
    line-height: 1.5;
}

.file-upload {
    margin-bottom: 1rem;
}

.upload-btn {
    display: inline-block;
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--accent);
    color: white;
    text-align: center;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.upload-btn:hover {
    background: var(--accent-hover);
}

.btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.btn:last-child {
    margin-bottom: 0;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4),
                0 0 0 1px rgba(255, 255, 255, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    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 ease;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.5),
                0 0 32px rgba(139, 92, 246, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-primary:hover:not(:disabled)::before {
    left: 100%;
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-secondary);
}

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

.control-group {
    margin-bottom: 1rem;
}

.bg-select {
    width: 100%;
    padding: 0.625rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.bg-select:hover {
    border-color: var(--border-light);
}

.bg-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

[data-theme="light"] .bg-select {
    background: var(--bg-secondary);
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    font-size: 0.75rem;
}

.control-group input[type="color"] {
    width: 100%;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    background: rgba(10, 10, 10, 0.8);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.control-group input[type="color"]:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
}

.control-group input[type="range"] {
    width: calc(100% - 55px);
    margin-right: 10px;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-primary);
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2), var(--shadow-md);
    transition: all 0.2s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.3), var(--shadow-lg);
    transform: scale(1.1);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2), var(--shadow-md);
    transition: all 0.2s ease;
}

.control-group input[type="range"]::-moz-range-thumb:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.3), var(--shadow-lg);
    transform: scale(1.1);
}

.control-group span {
    display: inline-block;
    width: 45px;
    text-align: right;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.material-item {
    background: var(--bg-primary);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
}

.material-item:last-child {
    margin-bottom: 0;
}

.material-item h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.material-control {
    margin-bottom: 0.75rem;
}

.material-control:last-child {
    margin-bottom: 0;
}

.material-control label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.color-picker-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.color-picker-wrapper input[type="color"] {
    width: 50px;
    height: 35px;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
}

.color-picker-wrapper input[type="text"] {
    flex: 1;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.viewer-container {
    position: relative;
    flex: 1;
    position: relative;
    background: var(--bg-primary);
    transition: background 0.3s ease;
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.3);
}

#canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#canvas-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-content {
    text-align: center;
    color: var(--text-secondary);
}

.placeholder-content .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.placeholder-content h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.placeholder-content p {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 25%;
    text-align: center;
    z-index: 10000;
    pointer-events: all;
}

.spinner-image {
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem;
    animation: spin 1s linear infinite;
    filter: drop-shadow(0 0 20px var(--accent-glow));
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    object-fit: contain;
    max-width: 120px;
    max-height: 120px;
}

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

.loading p {
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.viewer-info {
    position: absolute;
    bottom: 1.5rem;
    left: 1.5rem;
    right: 1.5rem;
    display: flex;
    justify-content: space-between;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    letter-spacing: 0.01em;
    transition: background 0.3s ease, border-color 0.3s ease;
}

[data-theme="light"] .viewer-info {
    background: rgba(255, 255, 255, 0.9);
}

.randomize-btn {
    position: absolute !important;
    bottom: 2rem !important;
    right: 2rem !important;
    left: auto !important;
    z-index: 2000 !important;
    padding: 1.125rem 2.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 24px;
    cursor: pointer;
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.5),
                0 0 40px rgba(139, 92, 246, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.35),
                0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    white-space: nowrap;
    letter-spacing: 0.02em;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    position: relative;
    overflow: hidden;
}

.randomize-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.randomize-btn:hover {
    background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
    box-shadow: 0 16px 48px rgba(139, 92, 246, 0.6),
                0 0 60px rgba(139, 92, 246, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.45),
                0 8px 16px rgba(0, 0, 0, 0.4);
}

.randomize-btn:hover::before {
    left: 100%;
}

/* Desktop hover transform */
@media (min-width: 769px) {
    .randomize-btn:hover {
        transform: translateY(-4px) scale(1.08);
    }
}

/* Mobile hover transform (preserves centering) */
@media (max-width: 768px) {
    .randomize-btn:hover {
        transform: translateX(-50%) translateY(-4px) scale(1.08);
    }
}

.randomize-btn:active {
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Desktop active transform */
@media (min-width: 769px) {
    .randomize-btn:active {
        transform: translateY(0) scale(1.02);
    }
}

/* Mobile active transform (preserves centering) */
@media (max-width: 768px) {
    .randomize-btn:active {
        transform: translateX(-50%) translateY(0) scale(1.02);
    }
}

[data-theme="light"] .randomize-btn {
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.3), 0 4px 8px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .randomize-btn:hover {
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.4), 0 6px 12px rgba(0, 0, 0, 0.2);
}

#materials-list {
    max-height: 400px;
    overflow-y: auto;
}

#materials-list::-webkit-scrollbar {
    width: 6px;
}

#materials-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

#materials-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.fur-gallery {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5rem;
    max-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.25rem 1.25rem 2.5rem 1.25rem;
}

.fur-gallery .fur-btn {
    margin: 0;
}

.fur-gallery::-webkit-scrollbar {
    width: 6px;
}

.fur-gallery::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.fur-gallery::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.fur-btn {
    padding: 0;
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    letter-spacing: 0.01em;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1;
    box-sizing: border-box;
}

.fur-btn img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    padding: 4px;
    box-sizing: border-box;
}

/* Fallback styling for text-only buttons */
.fur-btn:not(:has(img)) {
    padding: 0.75rem 1rem;
    min-height: auto;
}

[data-theme="light"] .fur-btn {
    background: rgba(255, 255, 255, 0.9);
}

.fur-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.fur-btn:hover::before {
    left: 100%;
}

.fur-btn:hover {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    border-color: var(--accent);
    color: white;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 24px -4px var(--accent-glow),
                0 0 20px rgba(139, 92, 246, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.fur-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

/* NFT Search Bar Styles */
.nft-search-input {
    width: 180px;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    color: var(--text-primary);
    font-family: 'PORKYS', sans-serif;
    font-size: 0.875rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.nft-search-input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(20, 20, 20, 0.8);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3),
                0 0 0 3px var(--accent-glow),
                0 0 24px rgba(139, 92, 246, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.nft-search-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

/* Desktop - Larger search bar */
@media (min-width: 1024px) {
    .nft-search-input {
        width: 220px;
        padding: 0.625rem 1rem;
        font-size: 1rem;
    }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    header {
        padding: 0.75rem 1rem;
        overflow: visible;
        min-height: auto;
        height: auto;
    }

    .header-content {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .logo-title {
        width: auto;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        flex-shrink: 0;
        order: 1;
    }
    
    .logo {
        display: block !important;
        visibility: visible !important;
        width: 40px !important;
        height: 40px !important;
    }
    
    header h1 {
        font-size: 1.25rem !important;
        display: block !important;
        visibility: visible !important;
        margin: 0 !important;
        white-space: nowrap;
    }
    
    .header-controls {
        order: 2;
        flex: 1;
        min-width: 0;
        justify-content: flex-end;
    }

    header p {
        font-size: 0.85rem;
    }
    
    .header-controls {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    .sidebar {
        padding: 1rem 1rem 3.5rem 1rem;
        gap: 1rem;
        max-height: 300px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        margin-bottom: 100px;
        padding-bottom: 4.5rem;
    }

    .panel {
        min-width: 250px;
        max-width: 280px;
        width: 250px;
        padding: 1rem;
        flex-shrink: 0;
    }

    .panel h2 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .panel p {
        font-size: 0.8rem;
    }

    #scene-panel {
        position: relative;
        top: auto;
        right: auto;
        min-width: 250px;
        max-width: 280px;
        width: 250px;
        padding: 1rem;
        flex-shrink: 0;
    }

    .fur-gallery {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
        padding: 1rem 1rem 10rem 1rem;
    }

    .fur-btn {
        min-height: 80px;
        aspect-ratio: 1;
    }

    .randomize-btn {
        bottom: 120px !important;
        right: auto !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Mobile - Smaller search bar */
    .nft-search-input {
        width: 100px;
        padding: 0.35rem 0.45rem;
        font-size: 0.7rem;
    }
    
    .nft-search-btn {
        padding: 0.35rem 0.65rem;
        font-size: 0.7rem;
    }
    
    .header-controls {
        gap: 0.5rem !important;
    }
    
    .nft-search-group {
        gap: 0.375rem !important;
    }
}

@media (max-width: 480px) {
    header {
        padding: 0.5rem 0.75rem;
        overflow: visible;
        min-height: auto;
        height: auto;
    }
    
    .header-content {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .logo-title {
        width: auto;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        flex-shrink: 0;
        order: 1;
        gap: 0.5rem;
    }
    
    .logo {
        display: block !important;
        visibility: visible !important;
        width: 36px !important;
        height: 36px !important;
    }
    
    header h1 {
        font-size: 1.1rem !important;
        display: block !important;
        visibility: visible !important;
        margin: 0 !important;
        white-space: nowrap;
    }
    
    .header-controls {
        order: 2;
        flex: 1;
        min-width: 0;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
    
    /* Extra small mobile - Even smaller search bar */
    .nft-search-input {
        width: 90px;
        padding: 0.3rem 0.35rem;
        font-size: 0.65rem;
    }
    
    .nft-search-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.65rem;
    }
    
    .nft-search-btn {
        min-width: auto;
    }
    
    .logo {
        width: 36px;
        height: 36px;
    }

    .theme-toggle {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .sidebar {
        padding: 0.75rem 0.75rem 3.5rem 0.75rem;
        gap: 0.75rem;
        max-height: 250px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        margin-bottom: 100px;
        padding-bottom: 4.5rem;
    }

    .panel {
        min-width: 200px;
        max-width: 220px;
        width: 200px;
        padding: 0.75rem;
        flex-shrink: 0;
    }

    #scene-panel {
        position: relative;
        top: auto;
        right: auto;
        min-width: 200px;
        max-width: 220px;
        width: 200px;
        padding: 0.75rem;
        flex-shrink: 0;
    }

    .fur-gallery {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
        padding: 0.75rem 0.75rem 10rem 0.75rem;
    }

    .fur-btn {
        min-height: 70px;
        aspect-ratio: 1;
    }

    .randomize-btn {
        bottom: 120px !important;
        right: auto !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
    }
}



























/* Inventory Panel Styles */
.inventory-toggle-overlay {
    position: absolute;
    top: 2rem;
    right: 1rem;
    transform: none;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(139, 92, 246, 0.05) 100%);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border: 2px solid rgba(139, 92, 246, 0.3);
    border-radius: 16px;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.2),
                0 0 0 1px rgba(139, 92, 246, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    padding: 0;
    line-height: 1;
    overflow: hidden;
}

.inventory-toggle-overlay::before {
    content: '';
    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.6s ease;
}

.inventory-toggle-overlay:hover::before {
    left: 100%;
}

.inventory-toggle-overlay svg {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.6));
    transition: transform 0.3s ease;
}

.inventory-toggle-overlay:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-color: var(--accent);
    transform: scale(1.15);
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.4),
                0 0 0 2px rgba(139, 92, 246, 0.2),
                0 0 40px rgba(139, 92, 246, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.inventory-toggle-overlay:hover svg {
    transform: translateX(-2px);
    filter: drop-shadow(0 0 12px rgba(139, 92, 246, 0.8));
}

.inventory-toggle-overlay:active {
    transform: scale(1.05);
}

.inventory-toggle-overlay:active svg {
    transform: translateX(-4px);
}

.inventory-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5),
                inset 1px 0 0 rgba(255, 255, 255, 0.08);
    z-index: 1000;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.inventory-panel.open {
    right: 0;
}

.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(20, 20, 20, 0.8);
}

.inventory-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.inventory-close {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 2rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
}

.inventory-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.inventory-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    color: var(--text-primary);
}

.inventory-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.inventory-overlay.active {
    opacity: 1;
    pointer-events: all;
}

[data-theme="light"] .inventory-panel {
    background: rgba(245, 245, 245, 0.95);
    border-left-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .inventory-header {
    background: rgba(245, 245, 245, 0.8);
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .inventory-panel {
        width: 85vw;
        right: -85vw;
    }
    
    .inventory-toggle-overlay {
        width: 48px;
        height: 48px;
        right: 0.75rem;
    }
    
    .inventory-toggle-overlay svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .inventory-panel {
        width: 90vw;
        right: -90vw;
    }
    
    .inventory-header {
        padding: 1rem;
    }
    
    .inventory-header h2 {
        font-size: 1.25rem;
    }
    
    .inventory-content {
        padding: 1rem;
    }
}
