* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
}

#sidebar {
    width: 320px;
    min-width: 280px;
    flex-shrink: 0;
    background: #1a1a2e;
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid #2d2d44;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

#sidebar h1 {
    font-size: 1.5rem;
    margin-bottom: 4px;
    color: #fff;
}

.subtitle {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 0;
}

.site-logo {
    display: inline-block;
    margin-bottom: 12px;
}

.site-logo img {
    height: 24px;
    width: auto;
}

.settings-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    color: #6366f1;
}

.settings-btn svg {
    transition: transform 0.3s ease;
}

.settings-btn:hover svg {
    transform: rotate(45deg);
}

.drop-zone {
    border: 2px dashed #4a4a6a;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.drop-zone-content {
    pointer-events: none;
}

.drop-zone svg {
    color: #6366f1;
    margin-bottom: 12px;
}

.drop-zone p {
    margin-bottom: 4px;
}

.drop-zone .hint {
    font-size: 0.8rem;
    color: #666;
}

.drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Sample Selector */
.sample-selector {
    margin-bottom: 20px;
}

.sample-selector .sample-label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 10px;
    text-align: center;
}

.sample-buttons {
    display: flex;
    gap: 8px;
}

.sample-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: #252540;
    border: 1px solid #3d3d5c;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sample-btn:hover {
    background: #2d2d50;
    border-color: #6366f1;
    transform: translateY(-2px);
}

.sample-btn:active {
    transform: translateY(0);
}

.sample-btn.loading {
    opacity: 0.6;
    pointer-events: none;
}

.sample-btn .sample-icon {
    font-size: 1.5rem;
}

.sample-btn .sample-name {
    font-size: 0.75rem;
    color: #ccc;
}

.sample-btn:hover .sample-name {
    color: #fff;
}

.file-list {
    margin-bottom: 20px;
}

.file-list h3 {
    font-size: 0.9rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.file-section {
    margin-bottom: 16px;
}

.file-section h4 {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 8px;
}

.file-section ul {
    list-style: none;
}

.file-section li {
    padding: 8px 12px;
    background: #252540;
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-section li:hover {
    background: #2d2d50;
}

.file-section li.active {
    background: #6366f1;
    color: #fff;
}

.file-section li .file-size {
    font-size: 0.75rem;
    color: #888;
}

.file-section li.active .file-size {
    color: rgba(255, 255, 255, 0.7);
}

.file-section li .file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.file-section li .file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-section li .delete-btn {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.file-section li .delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.file-section li.active .delete-btn {
    color: rgba(255, 255, 255, 0.6);
}

.file-section li.active .delete-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.info-panel {
    background: #252540;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.info-panel h3 {
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: #fff;
}

#info-content {
    font-size: 0.85rem;
    line-height: 1.6;
}

#info-content .info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

#info-content .info-label {
    color: #888;
}

/* Collapsible sections */
.materials-collapse {
    margin-top: 12px;
    border-top: 1px solid #3d3d5c;
    padding-top: 8px;
}

.materials-collapse summary {
    font-size: 0.7rem;
    color: #666;
    cursor: pointer;
    user-select: none;
    outline: none;
}

.materials-collapse summary:hover {
    color: #888;
}

.materials-collapse[open] summary {
    margin-bottom: 8px;
}

#materials-list {
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.75rem;
}

.material-wrapper {
    border-bottom: 1px solid #2d2d44;
}

.material-wrapper:last-child {
    border-bottom: none;
}

.material-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.material-edit-btn {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.material-edit-btn:hover {
    color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.material-edit-btn.active {
    color: #6366f1;
}

.material-edit-btn svg {
    transition: transform 0.2s;
}

.material-edit-btn.active svg {
    transform: rotate(45deg);
}

/* Inline material editor */
.material-inline-editor {
    display: none;
    padding: 8px 0 8px 22px;
    border-top: 1px solid #252538;
}

.material-wrapper.expanded .material-inline-editor {
    display: block;
}

.mat-edit-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.mat-edit-row:last-child {
    margin-bottom: 0;
}

.mat-edit-row label {
    font-size: 0.7rem;
    color: #888;
    min-width: 32px;
}

.mat-color-picker {
    width: 28px;
    height: 22px;
    padding: 1px;
    border: 1px solid #3d3d5c;
    border-radius: 4px;
    background: #2a2a3e;
    cursor: pointer;
}

.mat-color-picker::-webkit-color-swatch-wrapper {
    padding: 1px;
}

.mat-color-picker::-webkit-color-swatch {
    border-radius: 2px;
    border: none;
}

.mat-slider {
    width: 50px;
    height: 4px;
    accent-color: #6366f1;
}

.mat-number {
    width: 48px;
    padding: 2px 4px;
    background: #252540;
    border: 1px solid #3d3d5c;
    border-radius: 3px;
    color: #e0e0e0;
    font-size: 0.65rem;
    text-align: center;
    -moz-appearance: textfield;
}

.mat-number::-webkit-outer-spin-button,
.mat-number::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.mat-number:focus {
    outline: none;
    border-color: #6366f1;
}

.mat-props-row {
    flex-wrap: wrap;
}

.mat-prop {
    display: flex;
    align-items: center;
    gap: 4px;
}

.mat-prop label {
    min-width: 48px;
}

.mat-reset-btn {
    margin-left: auto;
    background: transparent;
    border: 1px solid #3d3d5c;
    color: #888;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.mat-reset-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
}

.material-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid #444;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.material-color.has-texture {
    background: transparent;
    border-color: #555;
}

.material-color img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Material reorder buttons */
.material-move-btn {
    background: transparent;
    border: none;
    color: #555;
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.material-move-btn:hover:not(:disabled) {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.material-move-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.material-move-up {
    margin-left: 4px;
}

.material-move-down {
    margin-left: -2px;
}

.material-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #aaa;
}

.material-name.no-texture {
    color: #666;
    font-style: italic;
}

.material-visibility-btn {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.material-visibility-btn:hover {
    color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.material-visibility-btn.hidden {
    color: #ef4444;
}

.material-visibility-btn.hidden:hover {
    background: rgba(239, 68, 68, 0.1);
}

.material-item.material-hidden {
    opacity: 0.5;
}

.material-delete-btn {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.material-delete-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.material-delete-btn.marked {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
}

.material-item.material-deleted {
    opacity: 0.4;
    text-decoration: line-through;
}

.material-item.material-deleted .material-name {
    text-decoration: line-through;
}

/* Parts Panel */
.parts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.parts-header h3 {
    margin: 0;
}

.parts-actions {
    display: flex;
    gap: 4px;
}

.parts-btn {
    padding: 4px 8px;
    font-size: 0.7rem;
    background: #3d3d5c;
    border: none;
    border-radius: 4px;
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s;
}

.parts-btn:hover {
    background: #6366f1;
    color: #fff;
}

.parts-select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #333;
    border-radius: 4px;
    background: #1a1a2e;
    color: #fff;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.parts-select:hover {
    border-color: #6366f1;
}

.parts-select:focus {
    outline: none;
    border-color: #6366f1;
}

.parts-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 0.75rem;
    color: #888;
}

.parts-filters label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.parts-filters input[type="checkbox"] {
    width: 12px;
    height: 12px;
    accent-color: #6366f1;
}

/* Bone Reference Tool */
.bone-reference-section {
    background: linear-gradient(135deg, #1e3a5f 0%, #1a2744 100%);
    border: 1px solid #2d5a87;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.bone-reference-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: #7dd3fc;
    margin-bottom: 4px;
}

.bone-reference-desc {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-bottom: 10px;
    line-height: 1.4;
}

.bone-reference-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    background: #0ea5e9;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.bone-reference-btn:hover {
    background: #38bdf8;
    transform: translateY(-1px);
}

.bone-reference-btn:active {
    transform: translateY(0);
}

.bone-reference-btn svg {
    flex-shrink: 0;
}

.bone-reference-status {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    line-height: 1.4;
}

.bone-reference-status.success {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid #22c55e;
    color: #86efac;
}

.bone-reference-status.error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #fca5a5;
}

.bone-reference-status.info {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid #3b82f6;
    color: #93c5fd;
}

#parts-list {
    max-height: 200px;
    overflow-y: auto;
    overflow-x: auto;
}

.part-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
    min-width: fit-content;
}

.tree-toggle, .tree-spacer {
    width: 12px;
    font-size: 0.65rem;
    color: #666;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}

.tree-toggle:hover {
    color: #6366f1;
}

.tree-spacer {
    cursor: default;
}

.part-item:hover {
    background: rgba(99, 102, 241, 0.1);
}

.part-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #6366f1;
    cursor: pointer;
}

.part-item label {
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.part-item.hidden-part {
    opacity: 0.5;
}

.part-item.disabled-part {
    pointer-events: none;
    opacity: 0.4;
}

.part-item .part-type {
    font-size: 0.65rem;
    padding: 2px 6px;
    background: #3d3d5c;
    border-radius: 3px;
    color: #888;
}

.part-item.selected {
    background: rgba(99, 102, 241, 0.2);
    border-left: 3px solid #6366f1;
    padding-left: 5px;
}

.part-item.selected label {
    color: #fff;
    font-weight: 500;
}

/* Selection Info Panel */
#selection-info {
    border: 1px solid #6366f1;
}

/* Edit Mode Toggle */
.edit-mode-toggle {
    display: flex;
    gap: 2px;
    margin-bottom: 12px;
    background: #1a1a2e;
    padding: 3px;
    border-radius: 6px;
}

.edit-mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #888;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 0;
    white-space: nowrap;
}

.edit-mode-btn:hover {
    background: #252540;
    color: #ccc;
}

.edit-mode-btn.active {
    background: #6366f1;
    color: #fff;
}

.edit-mode-btn svg {
    width: 14px;
    height: 14px;
}

/* Vertex Selection Info */
#vertex-selection-info {
    background: #1a1a2e;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 12px;
}

.vertex-count {
    font-size: 0.85rem;
    color: #ccc;
    margin-bottom: 8px;
    text-align: center;
}

.vertex-count span {
    color: #6366f1;
    font-weight: 600;
}

.vertex-actions {
    display: flex;
    gap: 4px;
}

.vertex-actions .parts-btn {
    flex: 1;
}

/* Soft Selection Controls */
.soft-selection-controls {
    padding: 8px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.soft-selection-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    color: #ccc;
}

.soft-selection-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #6366f1;
}

.soft-selection-radius {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.soft-selection-radius label {
    display: block;
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 4px;
}

.soft-selection-radius #soft-radius-value {
    color: #6366f1;
    font-weight: 500;
}

.soft-selection-radius input[type="range"] {
    width: 100%;
    height: 4px;
    background: #333;
    border-radius: 2px;
    -webkit-appearance: none;
    appearance: none;
}

.soft-selection-radius input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #6366f1;
    border-radius: 50%;
    cursor: pointer;
}

/* Vertex Weld/Merge Controls */
.vertex-weld-controls {
    padding: 8px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.weld-header {
    font-size: 0.75rem;
    font-weight: 500;
    color: #ef4444;
    margin-bottom: 6px;
}

.weld-threshold {
    margin-bottom: 8px;
}

.weld-threshold label {
    display: block;
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 4px;
}

.weld-threshold #weld-threshold-value {
    color: #ef4444;
    font-weight: 500;
}

.weld-threshold input[type="range"] {
    width: 100%;
    height: 4px;
    background: #333;
    border-radius: 2px;
    -webkit-appearance: none;
    appearance: none;
}

.weld-threshold input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #ef4444;
    border-radius: 50%;
    cursor: pointer;
}

.weld-buttons {
    display: flex;
    gap: 6px;
}

.weld-buttons .parts-btn {
    flex: 1;
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.weld-buttons .parts-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}

.selection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.selection-header span {
    font-weight: 500;
    color: #fff;
}

/* Transform Mode Buttons */
.transform-modes {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.transform-mode-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: #1a1a2e;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    color: #888;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.transform-mode-btn:hover {
    background: #252540;
    border-color: #6366f1;
    color: #ccc;
}

.transform-mode-btn.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: #6366f1;
    color: #fff;
}

.transform-mode-btn svg {
    width: 18px;
    height: 18px;
}

/* Transform Input Fields */
.transform-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.transform-input-group {
    background: #1a1a2e;
    border-radius: 6px;
    padding: 8px 10px;
}

.transform-input-group > label {
    display: block;
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.transform-input-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.transform-input-field {
    flex: 1;
    display: flex;
    align-items: center;
    background: #252540;
    border: 1px solid #3d3d5c;
    border-radius: 4px;
    overflow: hidden;
}

.transform-input-field:focus-within {
    border-color: #6366f1;
}

.axis-label {
    padding: 6px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

.axis-label.x { background: rgba(239, 68, 68, 0.3); color: #f87171; }
.axis-label.y { background: rgba(34, 197, 94, 0.3); color: #4ade80; }
.axis-label.z { background: rgba(59, 130, 246, 0.3); color: #60a5fa; }

.transform-input-field input {
    flex: 1;
    width: 100%;
    padding: 6px 4px;
    background: transparent;
    border: none;
    color: #e0e0e0;
    font-size: 0.8rem;
    font-family: 'Monaco', 'Consolas', monospace;
    text-align: right;
    -moz-appearance: textfield;
}

.transform-input-field input::-webkit-outer-spin-button,
.transform-input-field input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.transform-input-field input {
    cursor: ew-resize;
}

.transform-input-field input:focus {
    outline: none;
    cursor: text;
}

.transform-input-field.scale-field {
    flex: 2;
}

.transform-input-group .parts-btn {
    flex-shrink: 0;
}

.transform-hint {
    margin-top: 8px;
    font-size: 0.65rem;
    color: #555;
    text-align: center;
}

.change-badge.material {
    background: rgba(249, 115, 22, 0.2);
    color: #f97316;
}

.change-badge.vertex {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.change-badge.uv {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

/* Texture Grid */
#texture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 6px;
    max-height: 250px;
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

.texture-item {
    position: relative;
    aspect-ratio: 1;
    background: #1a1a2e;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.texture-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.texture-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.texture-item .texture-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    padding: 3px 4px;
    font-size: 0.6rem;
    color: #ccc;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.texture-item .texture-size {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.7);
    padding: 1px 4px;
    font-size: 0.55rem;
    color: #888;
    border-radius: 3px;
}

.texture-delete-btn {
    position: absolute;
    top: 2px;
    left: 2px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: #888;
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0;
    z-index: 2;
}

.texture-item:hover .texture-delete-btn {
    opacity: 1;
}

.texture-delete-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.3);
}

.texture-delete-btn.marked {
    opacity: 1;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.4);
}

.texture-item.texture-deleted {
    opacity: 0.4;
}

.texture-item.texture-deleted img {
    filter: grayscale(1);
}

.texture-item.texture-deleted .texture-label {
    text-decoration: line-through;
}


/* Texture Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: #1a1a2e;
    border-radius: 12px;
    padding: 20px;
    width: 420px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid #2d2d44;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: #666;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #2d2d44;
    color: #fff;
}

/* Settings Modal */
.settings-modal .settings-content {
    width: 540px;
    align-items: stretch;
}

.settings-modal h2 {
    font-size: 1.25rem;
    color: #fff;
    margin: 0 0 8px 0;
    text-align: center;
}

.settings-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
}

.settings-section h3 {
    font-size: 0.75rem;
    color: #6366f1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 10px 0;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.setting-row:last-child {
    margin-bottom: 0;
}

.setting-row label:not(.checkbox-label) {
    font-size: 0.85rem;
    color: #ccc;
}

.setting-row select {
    background: #2a2a3e;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    padding: 6px 10px;
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
}

.setting-row select:hover {
    border-color: #6366f1;
}

.setting-row input[type="color"] {
    width: 40px;
    height: 28px;
    padding: 2px;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    background: #2a2a3e;
    cursor: pointer;
}

.setting-row input[type="color"]:hover {
    border-color: #6366f1;
}

.setting-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.setting-row input[type="color"]::-webkit-color-swatch {
    border-radius: 3px;
    border: none;
}

.setting-hint {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-top: 4px;
}

.shortcuts-grid {
    display: flex;
    gap: 20px;
}

.shortcuts-grid .shortcut-col {
    flex: 1;
}

.shortcuts-grid .shortcut-group {
    display: block;
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.shortcuts-grid .shortcut-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 4px;
}

.shortcuts-grid .shortcut-row kbd {
    background: #2a2a3e;
    border: 1px solid #3d3d5c;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-family: monospace;
    color: #fff;
    min-width: 50px;
    text-align: center;
}

.modal-preview {
    background: repeating-conic-gradient(#222 0% 25%, #333 0% 50%) 50% / 16px 16px;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    min-height: 200px;
}

.modal-preview img {
    max-width: 512px;
    max-height: 512px;
    image-rendering: pixelated;
    border-radius: 4px;
}

.modal-info {
    text-align: center;
    width: 100%;
}

.modal-info h3 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    color: #fff;
    word-break: break-all;
}

.modal-details {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: #888;
}

.modal-details span {
    background: #252540;
    padding: 4px 10px;
    border-radius: 4px;
}

#controls h3 {
    font-size: 0.9rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.control-group {
    margin-bottom: 12px;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    cursor: pointer;
}

.control-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #6366f1;
}

.control-group input[type="color"] {
    width: 100%;
    height: 32px;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 4px;
    background: #252540;
    padding: 4px;
}

.control-group input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.control-group input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.control-group input[type="range"] {
    width: 100%;
    margin-top: 4px;
    accent-color: #6366f1;
}

.control-group select {
    width: 100%;
    padding: 6px 10px;
    margin-top: 4px;
    background: #252540;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.85rem;
    cursor: pointer;
}

.control-group select:hover {
    border-color: #6366f1;
}

.control-group select:focus {
    outline: none;
    border-color: #6366f1;
}

.control-group span {
    font-size: 0.75rem;
    color: #888;
    margin-left: 8px;
}

.btn {
    width: 100%;
    padding: 10px 16px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 8px;
}

.btn:hover {
    background: #5457e5;
}

.btn:disabled {
    background: #4a4a6a;
    cursor: not-allowed;
}

#viewport {
    flex: 1;
    position: relative;
    background: #1a1a2e;
}

#canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 15, 26, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #2d2d44;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#stats {
    position: absolute;
    bottom: 16px;
    left: 16px;
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: #888;
    background: rgba(26, 26, 46, 0.9);
    padding: 8px 12px;
    border-radius: 6px;
}

/* View Orientation Gizmo */
.view-gizmo {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    background: rgba(26, 26, 46, 0.85);
    cursor: pointer;
    z-index: 100;
    pointer-events: auto;
}

/* Force visibility when advanced view is active */
#viewport.advanced-view-active .view-gizmo {
    display: block !important;
}

#viewport.advanced-view-active .shading-mode-selector {
    display: flex !important;
}

#viewport.advanced-view-active .mode-indicator {
    display: block !important;
}

#viewport.advanced-view-active .context-tool-panel {
    display: flex !important;
}

.view-gizmo canvas {
    width: 100%;
    height: 100%;
    display: block !important;
}

/* Shading Mode Selector */
.shading-mode-selector {
    position: fixed;
    bottom: 124px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(26, 26, 46, 0.85);
    border-radius: 8px;
    padding: 6px;
    z-index: 100;
    pointer-events: auto;
}

.shading-mode-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.shading-mode-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    color: #e0e0e0;
}

.shading-mode-btn.active {
    background: #6366f1;
    color: #fff;
}

/* Texture preview */
.texture-preview {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    background: #333;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.85rem;
}

/* Custom Scrollbar - Global */
* {
    scrollbar-width: thin;
    scrollbar-color: #3d3d5c transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: #3d3d5c;
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
    background: #5d5d7c;
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

/* Preferences Panel */
.preferences-panel {
    margin-top: 20px;
    background: #252540;
    border-radius: 8px;
    overflow: hidden;
}

.preferences-panel summary {
    padding: 12px 16px;
    font-size: 0.85rem;
    color: #ccc;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preferences-panel summary:hover {
    background: #2d2d50;
}

.preferences-panel summary::marker {
    color: #6366f1;
}

.preferences-panel[open] summary {
    border-bottom: 1px solid #3d3d5c;
}

.preferences-content {
    padding: 12px 16px;
}

.preference-group {
    margin-bottom: 12px;
}

.preference-group:last-child {
    margin-bottom: 0;
}

.preference-group label {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 6px;
}

.preference-group select {
    width: 100%;
    padding: 8px 10px;
    background: #1a1a2e;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.85rem;
    cursor: pointer;
}

.preference-group select:focus {
    outline: none;
    border-color: #6366f1;
}

.preference-hint {
    display: block;
    font-size: 0.7rem;
    color: #666;
    margin-top: 6px;
    line-height: 1.4;
}

/* Keyboard Shortcuts Panel */
.shortcuts-panel {
    margin-top: 12px;
    background: #1e1e35;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.shortcuts-panel:hover {
    border-color: #3d3d5c;
}

.shortcuts-panel summary {
    padding: 8px 12px;
    font-size: 0.7rem;
    color: #666;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.shortcuts-panel summary:hover {
    color: #888;
}

.shortcuts-panel summary::marker {
    color: #555;
    font-size: 0.6rem;
}

.shortcuts-panel[open] summary {
    color: #888;
    border-bottom: 1px solid #2d2d50;
}

.shortcuts-content {
    padding: 8px 12px 12px;
}

.shortcuts-section {
    margin-bottom: 10px;
}

.shortcuts-section:last-child {
    margin-bottom: 0;
}

.shortcuts-title {
    display: block;
    font-size: 0.6rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.shortcut-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    font-size: 0.7rem;
    color: #777;
}

.shortcut-row kbd {
    display: inline-block;
    padding: 2px 5px;
    background: #252545;
    border: 1px solid #3d3d5c;
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.65rem;
    color: #aaa;
    min-width: 18px;
    text-align: center;
}

.shortcut-row span {
    flex: 1;
    text-align: right;
    color: #666;
}

.credits {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #2d2d44;
    font-size: 0.75rem;
    color: #666;
    text-align: center;
}

.credits a {
    color: #888;
    text-decoration: none;
    transition: color 0.2s;
}

.credits a:hover {
    color: #6366f1;
}

.credits a.author {
    color: #6366f1;
    font-weight: 500;
}

.credits a.author:hover {
    text-decoration: underline;
}

/* Texture Rename UI */
.modal-rename {
    margin-bottom: 12px;
    width: 100%;
}

.modal-rename label {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 6px;
    text-align: left;
}

.rename-input-group {
    display: flex;
    gap: 8px;
}

.rename-input-group input {
    flex: 1;
    padding: 8px 12px;
    background: #252540;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.85rem;
    font-family: inherit;
}

.rename-input-group input:focus {
    outline: none;
    border-color: #6366f1;
}

.rename-input-group input.has-rename {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.rename-input-group .btn {
    width: auto;
    margin-bottom: 0;
    padding: 8px 16px;
}

.rename-error {
    display: block;
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 4px;
    text-align: left;
    min-height: 1.2em;
}

/* Pending Changes Panel */
#changes-list {
    max-height: 150px;
    overflow-y: auto;
}

.change-type-label {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 3px;
    flex-shrink: 0;
    text-transform: uppercase;
}

.change-type-label.dff {
    background: rgba(249, 115, 22, 0.2);
    color: #f97316;
}

.change-type-label.txd {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.btn-primary {
    background: #6366f1;
}

.btn-primary:hover {
    background: #5457e5;
}

#changes-list {
    max-height: 120px;
    overflow-y: auto;
}

.change-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 0;
    font-size: 0.75rem;
    color: #ccc;
    border-bottom: 1px solid #2d2d44;
}

.change-item:last-child {
    border-bottom: none;
}

.change-item .change-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.change-item .change-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.change-badge {
    font-size: 0.6rem;
    padding: 2px 5px;
    border-radius: 3px;
    white-space: nowrap;
}

.change-badge.rename {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.change-badge.resize {
    background: rgba(99, 102, 241, 0.2);
    color: #6366f1;
}

.change-badge.replace {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.change-badge.delete {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.change-badge.format {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

.change-badge.transform {
    background: rgba(99, 102, 241, 0.2);
    color: #6366f1;
}

.change-badge.reorder {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
}

.change-badge.rig {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
}

.change-item .change-remove {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 2px;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

.change-item .change-remove:hover {
    color: #ef4444;
}

/* Modified texture indicator (renamed) */
.texture-item.modified::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 4px #22c55e;
}

/* Resized texture indicator */
.texture-item.resized::before {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: #6366f1;
    border-radius: 50%;
    box-shadow: 0 0 4px #6366f1;
}

/* Texture Resize UI */
.modal-resize {
    width: 100%;
    margin-bottom: 12px;
    border: 1px solid #3d3d5c;
    border-radius: 8px;
    overflow: hidden;
}

.resize-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #252540;
    cursor: pointer;
    font-size: 0.85rem;
    color: #ccc;
    transition: background 0.2s;
}

.resize-header:hover {
    background: #2d2d50;
}

.resize-toggle-icon {
    font-size: 1rem;
    color: #6366f1;
    font-weight: bold;
    transition: transform 0.2s;
}

.resize-header.open .resize-toggle-icon {
    transform: rotate(45deg);
}

.resize-content {
    padding: 14px;
    background: #1a1a2e;
    border-top: 1px solid #3d3d5c;
}

.resize-presets {
    margin-bottom: 14px;
}

.resize-presets label {
    display: block;
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 8px;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.preset-btn {
    padding: 6px 10px;
    font-size: 0.7rem;
    background: #3d3d5c;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: #4d4d6c;
    border-color: #6366f1;
}

.preset-btn.active {
    background: #6366f1;
    color: #fff;
}

.preset-btn.current {
    border-color: #22c55e;
}

.resize-dimensions {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 12px;
}

.dimension-input {
    flex: 1;
    min-width: 70px;
}

.dimension-input label {
    display: block;
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 4px;
}

.dimension-input input {
    width: 100%;
    padding: 8px 6px;
    background: #252540;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.85rem;
    text-align: center;
    -moz-appearance: textfield;
}

.dimension-input input::-webkit-outer-spin-button,
.dimension-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.dimension-input input:focus {
    outline: none;
    border-color: #6366f1;
}

.dimension-input input:invalid {
    border-color: #ef4444;
}

.dimension-x {
    color: #666;
    font-size: 1rem;
    font-weight: bold;
    padding-bottom: 10px;
    flex-shrink: 0;
}

.aspect-ratio-lock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    padding-bottom: 4px;
    flex-shrink: 0;
}

.aspect-ratio-lock input {
    width: 16px;
    height: 16px;
    accent-color: #6366f1;
}

.aspect-ratio-lock span {
    font-size: 0.6rem;
    color: #888;
}

.resize-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.75rem;
    flex-wrap: wrap;
    gap: 8px;
}

#resize-size-estimate {
    color: #aaa;
    background: #252540;
    padding: 4px 10px;
    border-radius: 4px;
}

.resize-warning {
    color: #f59e0b;
    font-size: 0.7rem;
}

.resize-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.resize-option {
    min-width: 0;
}

.resize-option label {
    display: block;
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 4px;
}

.resize-option select {
    width: 100%;
    padding: 8px 8px;
    background: #252540;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.75rem;
    cursor: pointer;
}

.resize-option select:focus {
    outline: none;
    border-color: #6366f1;
}

.resize-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.resize-actions .btn {
    margin-bottom: 0;
    padding: 10px 12px;
    font-size: 0.8rem;
}

.btn-secondary {
    background: #3d3d5c;
}

.btn-secondary:hover {
    background: #4d4d6c;
}

/* Resize preview in modal */
.modal-preview.resized {
    border: 2px solid #6366f1;
}

.modal-preview .resize-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #6366f1;
    color: #fff;
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
}

/* Replace Texture UI */
.modal-replace {
    width: 100%;
    margin-bottom: 12px;
    border: 1px solid #3d3d5c;
    border-radius: 8px;
    overflow: hidden;
}

.replace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #252540;
    cursor: pointer;
    font-size: 0.85rem;
    color: #ccc;
    transition: background 0.2s;
}

.replace-header:hover {
    background: #2d2d50;
}

.replace-toggle-icon {
    font-size: 1rem;
    color: #22c55e;
    font-weight: bold;
    transition: transform 0.2s;
}

.replace-header.open .replace-toggle-icon {
    transform: rotate(45deg);
}

.replace-content {
    padding: 14px;
    background: #1a1a2e;
    border-top: 1px solid #3d3d5c;
}

.replace-dropzone {
    border: 2px dashed #3d3d5c;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    margin-bottom: 12px;
}

.replace-dropzone:hover,
.replace-dropzone.drag-over {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.replace-dropzone svg {
    color: #22c55e;
    margin-bottom: 8px;
}

.replace-dropzone p {
    font-size: 0.85rem;
    color: #ccc;
    margin-bottom: 4px;
}

.replace-hint {
    font-size: 0.7rem;
    color: #666;
}

.replace-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.replace-preview {
    background: #252540;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.replace-preview img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 4px;
    background: repeating-conic-gradient(#222 0% 25%, #333 0% 50%) 50% / 8px 8px;
}

.replace-preview-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.replace-preview-info span {
    font-size: 0.8rem;
    color: #888;
}

.replace-options {
    margin-bottom: 12px;
}

.replace-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #aaa;
    cursor: pointer;
}

.replace-option input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #22c55e;
}

.replace-format-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #3d3d5c;
}

.replace-format-row label {
    font-size: 0.8rem;
    color: #aaa;
    white-space: nowrap;
}

.replace-format-row select {
    flex: 1;
    padding: 6px 8px;
    background: #1a1a2e;
    border: 1px solid #3d3d5c;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.8rem;
    cursor: pointer;
}

.replace-format-row select:focus {
    outline: none;
    border-color: #6366f1;
}

.format-hint {
    font-size: 0.7rem;
    color: #888;
    white-space: nowrap;
}

#replace-apply-btn {
    width: 100%;
    background: #22c55e;
}

#replace-apply-btn:hover:not(:disabled) {
    background: #16a34a;
}

#replace-apply-btn:disabled {
    background: #3d3d5c;
    cursor: not-allowed;
}

/* Replaced texture indicator */
.texture-item.replaced::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 4px #22c55e;
}

.modal-preview.replaced {
    border: 2px solid #22c55e;
}

/* Merge Modal */
.merge-modal-content {
    width: 400px;
    max-width: 90vw;
    align-items: stretch;
}

.merge-modal-content h3 {
    margin: 0 0 4px 0;
    padding-right: 30px;
    color: #fff;
    font-size: 1.1rem;
}

.merge-modal-body {
    text-align: left;
}

.merge-modal-body > p {
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 16px;
    line-height: 1.5;
}

.merge-info {
    background: #252540;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
}

.merge-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.merge-info-row:not(:last-child) {
    border-bottom: 1px solid #3d3d5c;
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.merge-info-label {
    font-size: 0.8rem;
    color: #888;
}

.merge-info-row span:last-child {
    font-size: 0.85rem;
    color: #e0e0e0;
}

.merge-options {
    margin-bottom: 16px;
}

.merge-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: #252540;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.merge-option:hover {
    background: #2d2d50;
}

.merge-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #6366f1;
    margin-top: 2px;
    flex-shrink: 0;
}

.merge-option span {
    font-size: 0.9rem;
    color: #e0e0e0;
}

.merge-option small {
    display: block;
    font-size: 0.75rem;
    color: #888;
    margin-top: 2px;
}

.merge-output {
    background: #252540;
    border-radius: 6px;
    padding: 12px;
    font-size: 0.8rem;
}

.merge-output p {
    margin: 0 0 8px 0;
    color: #aaa;
}

.merge-output ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.merge-output li {
    padding: 4px 0;
    color: #888;
}

.merge-output li code {
    background: #1a1a2e;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.75rem;
    color: #6366f1;
}

.merge-modal-footer {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.merge-modal-footer .btn {
    flex: 1;
    margin-bottom: 0;
}

.merge-option select {
    padding: 6px 10px;
    background: #1a1a2e;
    border: 1px solid #3d3d5c;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.8rem;
    cursor: pointer;
    margin-left: auto;
}

.merge-option select:focus {
    outline: none;
    border-color: #6366f1;
}

/* UV Editor Button */
.uv-editor-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px;
    background: #252545;
    border: 1px solid #3d3d5c;
    color: #aaa;
    transition: all 0.2s;
}

.uv-editor-btn:hover {
    background: #2d2d55;
    border-color: #6366f1;
    color: #e0e0e0;
}

.uv-editor-btn svg {
    width: 14px;
    height: 14px;
}

/* UV Editor Modal */
.uv-editor-content {
    width: 90vw;
    max-width: 1200px;
    height: 85vh;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.uv-editor-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #3d3d5c;
    gap: 16px;
}

.uv-editor-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #e0e0e0;
    margin: 0;
}

.uv-editor-info {
    display: flex;
    gap: 16px;
    flex: 1;
    align-items: center;
}

.uv-editor-info span {
    font-size: 0.8rem;
    color: #888;
    padding: 4px 10px;
    background: #1a1a2e;
    border-radius: 4px;
}

#uv-texture-select {
    padding: 6px 10px;
    background: #1a1a2e;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.8rem;
    cursor: pointer;
    min-width: 150px;
    max-width: 250px;
}

#uv-texture-select:hover {
    border-color: #6366f1;
}

#uv-texture-select:focus {
    outline: none;
    border-color: #6366f1;
}

.uv-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    background: #1a1a2e;
    border-bottom: 1px solid #3d3d5c;
    flex-wrap: wrap;
}

.uv-tool-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.uv-tool-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #252545;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
}

.uv-tool-btn:hover {
    background: #2d2d55;
    color: #ccc;
}

.uv-tool-btn.active {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

.uv-action-btn {
    padding: 6px 12px;
    background: #252545;
    border: 1px solid #3d3d5c;
    border-radius: 4px;
    color: #888;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.uv-action-btn:hover {
    background: #2d2d55;
    color: #ccc;
}

.uv-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #888;
    cursor: pointer;
}

.uv-checkbox input {
    accent-color: #6366f1;
}

.uv-zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.uv-zoom-btn {
    padding: 6px 12px;
    background: #252545;
    border: 1px solid #3d3d5c;
    border-radius: 4px;
    color: #888;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.uv-zoom-btn:hover {
    background: #2d2d55;
    color: #ccc;
}

#uv-zoom-level {
    font-size: 0.75rem;
    color: #666;
    min-width: 50px;
    text-align: center;
}

.uv-editor-body {
    flex: 1;
    width: 100%;
    position: relative;
    overflow: hidden;
    background: #0d0d1a;
}

#uv-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.uv-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid #3d3d5c;
    background: #1a1a2e;
}

.uv-coords {
    display: flex;
    gap: 16px;
}

.uv-coords span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #888;
}

.uv-coords input {
    width: 70px;
    padding: 4px 8px;
    background: #252545;
    border: 1px solid #3d3d5c;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.8rem;
}

.uv-coords input:disabled {
    opacity: 0.5;
}

.uv-coords input:focus {
    outline: none;
    border-color: #6366f1;
}

.uv-actions {
    display: flex;
    gap: 10px;
}

/* Save Options Panel */
.save-options-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.save-option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.save-option-row label {
    font-size: 0.85rem;
    color: #aaa;
}

.save-option-row select {
    flex: 1;
    max-width: 180px;
    padding: 8px 10px;
    background: #1a1a2e;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.8rem;
    cursor: pointer;
}

.save-option-row select:focus {
    outline: none;
    border-color: #6366f1;
}

#save-options .format-changed {
    color: #f59e0b;
    font-size: 0.75rem;
    margin-top: 4px;
}

.merge-modal-footer .btn:first-child {
    background: #3d3d5c;
}

.merge-modal-footer .btn:first-child:hover {
    background: #4d4d6c;
}

/* Mobile Toggle Button */
.mobile-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #6366f1;
    color: white;
    border: none;
    cursor: pointer;
    z-index: 200;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    align-items: center;
    justify-content: center;
}

.mobile-sidebar-toggle svg {
    width: 24px;
    height: 24px;
}

/* Responsive - Tablet */
@media (max-width: 900px) {
    body {
        overflow: auto;
    }

    #app {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    #sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #2d2d44;
        padding: 16px;
        max-height: none;
    }

    #sidebar h1 {
        font-size: 1.25rem;
    }

    #viewport {
        min-height: 50vh;
        height: 50vh;
    }

    #texture-grid {
        max-height: 180px;
    }

    #parts-list {
        max-height: 150px;
    }

    .credits {
        display: none;
    }
}

/* Responsive - Mobile */
@media (max-width: 640px) {
    #sidebar {
        padding: 12px;
    }

    #sidebar h1 {
        font-size: 1.1rem;
    }

    .subtitle {
        font-size: 0.8rem;
        margin-bottom: 12px;
    }

    .drop-zone {
        padding: 20px 16px;
        margin-bottom: 12px;
    }

    .drop-zone svg {
        width: 36px;
        height: 36px;
    }

    .drop-zone p {
        font-size: 0.9rem;
    }

    .info-panel {
        padding: 12px;
        margin-bottom: 12px;
    }

    .file-section li {
        padding: 12px;
    }

    #texture-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 4px;
        max-height: 160px;
    }

    .texture-item:hover {
        transform: none;
    }

    .texture-item .texture-label {
        font-size: 0.55rem;
        padding: 2px;
    }

    .texture-item .texture-size {
        display: none;
    }

    .parts-actions {
        gap: 6px;
    }

    .parts-btn {
        padding: 6px 10px;
        font-size: 0.65rem;
    }

    .parts-filters {
        gap: 8px;
        font-size: 0.7rem;
    }

    #parts-list {
        max-height: 120px;
    }

    .part-item {
        padding: 8px;
        font-size: 0.75rem;
    }

    #controls h3 {
        font-size: 0.8rem;
        margin-bottom: 10px;
    }

    .control-group {
        margin-bottom: 10px;
    }

    .control-group label {
        font-size: 0.8rem;
    }

    .control-group input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }

    .control-group input[type="color"] {
        height: 40px;
    }

    .btn {
        padding: 14px 16px;
        font-size: 0.85rem;
    }

    #viewport {
        min-height: 45vh;
        height: 45vh;
    }

    #stats {
        bottom: 12px;
        left: 12px;
        font-size: 0.7rem;
        padding: 6px 10px;
        gap: 12px;
    }

    .modal-content {
        padding: 16px;
        margin: 10px;
        max-height: 95vh;
    }

    .modal-close {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }

    .modal-preview img {
        max-width: 90vw;
        max-height: 40vh;
    }

    .modal-info h3 {
        font-size: 0.9rem;
    }

    .modal-details {
        flex-wrap: wrap;
        gap: 8px;
        font-size: 0.8rem;
    }

    .rename-input-group {
        flex-direction: column;
    }

    .rename-input-group input {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .rename-input-group .btn {
        width: 100%;
    }

    .mobile-sidebar-toggle {
        display: flex;
    }

    /* Collapsed sidebar state */
    #app.sidebar-collapsed #sidebar {
        display: none;
    }

    #app.sidebar-collapsed #viewport {
        min-height: calc(100vh - 60px);
        height: calc(100vh - 60px);
    }

    .merge-modal-content {
        width: 95vw;
        padding: 16px;
    }

    .merge-modal-footer {
        flex-direction: column;
    }

    .merge-modal-footer .btn {
        padding: 14px;
    }

    /* Resize UI mobile styles */
    .modal-content {
        width: 95vw;
        padding: 16px;
    }

    .resize-content {
        padding: 12px;
    }

    .resize-dimensions {
        gap: 6px;
    }

    .dimension-input {
        min-width: 60px;
    }

    .dimension-input input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 10px 4px;
    }

    .resize-options {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .resize-actions {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .preset-buttons {
        max-height: 70px;
        overflow-y: auto;
    }

    .preset-btn {
        padding: 8px 10px;
        font-size: 0.65rem;
    }
}

/* Very small phones */
@media (max-width: 380px) {
    #sidebar {
        padding: 10px;
    }

    .site-logo img {
        height: 20px;
    }

    #sidebar h1 {
        font-size: 1rem;
    }

    .drop-zone {
        padding: 16px 12px;
    }

    .info-panel {
        padding: 10px;
    }

    #texture-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .file-section li {
        padding: 10px;
        font-size: 0.8rem;
    }

    .file-section li .file-size {
        display: none;
    }

    .parts-filters {
        flex-direction: column;
        gap: 6px;
    }
}

/* ==================== Advanced View Mode ==================== */

/* Sidebar collapsed state */
#sidebar.collapsed {
    width: 0;
    min-width: 0;
    padding: 0;
    overflow: hidden;
    border-right: none;
}

#sidebar.collapsed > * {
    display: none;
}

/* Sidebar toggle button */
.sidebar-toggle {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 100;
    width: 36px;
    height: 36px;
    background: rgba(26, 26, 46, 0.9);
    border: 1px solid #3d3d5c;
    border-radius: 8px;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.sidebar-toggle:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: #6366f1;
    color: #fff;
}

.sidebar-toggle.active {
    background: rgba(99, 102, 241, 0.4);
    border-color: #6366f1;
    color: #fff;
}

/* Floating shortcuts panel */
.floating-shortcuts {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 200;
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid #3d3d5c;
    border-radius: 12px;
    padding: 0;
    min-width: 600px;
    max-width: 90vw;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
}

.floating-shortcuts.dragging {
    opacity: 0.9;
    cursor: grabbing;
}

.floating-shortcuts.positioned {
    transform: none;
}

.floating-shortcuts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #3d3d5c;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 12px 12px 0 0;
    cursor: grab;
    user-select: none;
}

.floating-shortcuts-header:active {
    cursor: grabbing;
}

.floating-shortcuts-header span {
    font-weight: 600;
    color: #fff;
    font-size: 0.9rem;
}

.floating-shortcuts-header button {
    background: none;
    border: none;
    color: #888;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.floating-shortcuts-header button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.floating-shortcuts-content {
    display: flex;
    gap: 20px;
    padding: 16px;
    flex-wrap: wrap;
}

.shortcut-col {
    flex: 1;
    min-width: 100px;
}

.shortcut-group-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #6366f1;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.shortcut-item {
    font-size: 0.75rem;
    color: #ccc;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.shortcut-item kbd {
    background: #2a2a3e;
    border: 1px solid #3d3d5c;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.65rem;
    font-family: monospace;
    color: #fff;
    min-width: 24px;
    text-align: center;
}

/* Mode indicator */
.mode-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 100;
    background: rgba(26, 26, 46, 0.9);
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    padding: 6px 12px;
    backdrop-filter: blur(4px);
    pointer-events: auto;
}

.mode-indicator span {
    font-size: 0.75rem;
    font-weight: 500;
    color: #888;
}

.mode-indicator.part-mode span {
    color: #6366f1;
}

.mode-indicator.vertex-mode span {
    color: #22c55e;
}

/* Checkbox label styling for preferences */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #6366f1;
}

/* Context Tool Panel */
.context-tool-panel {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid #3d3d5c;
    border-radius: 10px;
    padding: 10px 14px;
    backdrop-filter: blur(8px);
    display: flex;
    gap: 12px;
    align-items: center;
}

.tool-section {
    display: flex;
    gap: 12px;
    align-items: center;
}

.tool-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tool-row.tool-info {
    padding-left: 8px;
    border-left: 1px solid #3d3d5c;
}

.tool-label {
    font-size: 0.65rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 50px;
}

.tool-buttons {
    display: flex;
    gap: 4px;
}

.tool-btn {
    width: 28px;
    height: 28px;
    background: #2a2a3e;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    color: #ccc;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: #6366f1;
    color: #fff;
}

.tool-btn.active {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

.tool-btn.tool-soft.active {
    background: #22c55e;
    border-color: #22c55e;
}

#ctx-vertex-count {
    font-size: 0.7rem;
    color: #888;
    white-space: nowrap;
}

/* ==============================
   AUTO-RIGGER PANEL STYLES
   ============================== */

#autorig-panel {
    max-width: 300px;
}

/* Skeleton Source Selection */
.autorig-skeleton-source {
    background: #1a1a2e;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    border: 1px solid #2a2a4a;
}

.autorig-skeleton-header {
    font-weight: 500;
    color: #e0e0e0;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.autorig-skeleton-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.autorig-skeleton-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #ccc;
}

.autorig-skeleton-option input[type="radio"] {
    accent-color: #6366f1;
}

.autorig-skeleton-file {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #2a2a4a;
}

.autorig-skeleton-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.8rem;
    padding: 8px 12px;
}

.autorig-skeleton-status {
    margin-top: 8px;
    font-size: 0.8rem;
    padding: 6px 10px;
    border-radius: 4px;
    display: none;
}

.autorig-skeleton-status.success {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    display: block;
}

.autorig-skeleton-status.error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    display: block;
}

.autorig-skeleton-status.info {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    display: block;
}

.autorig-step {
    margin-bottom: 16px;
}

.autorig-step-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.autorig-step-num {
    width: 22px;
    height: 22px;
    background: #6366f1;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.autorig-step-title {
    font-weight: 500;
    color: #e0e0e0;
}

.autorig-markers-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.autorig-marker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #1a1a2e;
    border-radius: 6px;
    font-size: 0.85rem;
}

.autorig-marker-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.autorig-marker-name {
    flex: 1;
    color: #ccc;
}

.autorig-marker-status {
    font-size: 0.75rem;
    color: #22c55e;
}

.autorig-marker-status.not-placed {
    color: #888;
}

.autorig-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #ccc;
}

.autorig-option input[type="checkbox"] {
    accent-color: #6366f1;
}

.autorig-hint {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 12px;
    line-height: 1.4;
}

.autorig-btn {
    width: 100%;
}

.autorig-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.autorig-stat {
    display: flex;
    gap: 6px;
    font-size: 0.85rem;
}

.autorig-stat-label {
    color: #888;
}

.autorig-stat span:last-child {
    color: #e0e0e0;
    font-weight: 500;
}

.autorig-preview-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.autorig-preview-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #ccc;
}

.autorig-preview-options input[type="radio"] {
    accent-color: #6366f1;
}

.autorig-bone-edit {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.autorig-bone-edit .btn {
    font-size: 11px;
    padding: 4px 8px;
}

.autorig-bone-edit label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #a0a0b0;
    cursor: pointer;
}

.autorig-bone-edit input[type="checkbox"] {
    accent-color: #6366f1;
}

.autorig-actions {
    display: flex;
    gap: 8px;
}

.autorig-actions .btn {
    flex: 1;
}

.autorig-progress {
    margin-top: 12px;
}

.autorig-progress-bar {
    height: 4px;
    background: #2d2d44;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.autorig-progress-fill {
    height: 100%;
    background: #6366f1;
    width: 0%;
    transition: width 0.2s ease;
}

.autorig-progress-text {
    font-size: 0.75rem;
    color: #888;
    text-align: center;
}

/* ==================== 2DFX Effects Panel ==================== */

.effects-2dfx-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.effects-2dfx-empty {
    padding: 16px;
    text-align: center;
    color: #888;
    font-size: 13px;
    background: #252538;
    border-radius: 6px;
}

.effect-2dfx-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #252538;
    border-radius: 6px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.effect-2dfx-item:hover {
    background: #2d2d44;
}

.effect-2dfx-item.selected {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.5);
}

.effect-2dfx-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.effect-2dfx-icon.light {
    background: radial-gradient(circle, rgba(255, 200, 50, 0.8) 0%, rgba(255, 150, 0, 0.4) 70%, transparent 100%);
    box-shadow: 0 0 8px rgba(255, 180, 50, 0.5);
}

.effect-2dfx-icon.particle {
    background: rgba(0, 255, 255, 0.3);
    border: 1px solid rgba(0, 255, 255, 0.6);
}

.effect-2dfx-icon.attractor {
    background: rgba(255, 0, 255, 0.3);
    border: 1px solid rgba(255, 0, 255, 0.6);
}

.effect-2dfx-icon.sunglare {
    background: radial-gradient(circle, rgba(255, 255, 100, 0.9) 0%, rgba(255, 200, 0, 0.3) 100%);
}

.effect-2dfx-icon.other {
    background: rgba(128, 128, 128, 0.3);
    border: 1px solid rgba(128, 128, 128, 0.6);
}

.effect-2dfx-info {
    flex: 1;
    min-width: 0;
}

.effect-2dfx-type {
    font-size: 0.8rem;
    font-weight: 500;
    color: #e0e0e0;
}

.effect-2dfx-details {
    font-size: 0.7rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.effect-2dfx-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

/* Effect Properties Panel */
.effect-properties {
    border-top: 1px solid #2d2d44;
    padding-top: 12px;
    margin-top: 8px;
}

.effect-props-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.effect-props-header span {
    font-size: 0.85rem;
    font-weight: 500;
    color: #e0e0e0;
}

.parts-btn.danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.parts-btn.danger:hover {
    background: rgba(239, 68, 68, 0.4);
}

.effect-prop-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}

.effect-prop-label {
    font-size: 0.75rem;
    color: #888;
    width: 80px;
    flex-shrink: 0;
}

.effect-prop-value {
    flex: 1;
    display: flex;
    gap: 4px;
}

.effect-prop-input {
    flex: 1;
    padding: 4px 8px;
    background: #1a1a2e;
    border: 1px solid #3d3d5c;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.75rem;
}

.effect-prop-input:focus {
    outline: none;
    border-color: #6366f1;
}

.effect-prop-input[type="color"] {
    padding: 2px;
    width: 40px;
    height: 28px;
    cursor: pointer;
}

.effect-prop-input[type="range"] {
    -webkit-appearance: none;
    background: #2d2d44;
    height: 4px;
    border-radius: 2px;
    border: none;
}

.effect-prop-input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #6366f1;
    border-radius: 50%;
    cursor: pointer;
}

/* Select dropdown styling for 2DFX properties */
select.effect-prop-input {
    cursor: pointer;
    padding-right: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236366f1' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

select.effect-prop-input:hover {
    border-color: #6366f1;
}

select.effect-prop-input option {
    background: #1a1a2e;
    color: #e0e0e0;
    padding: 4px;
}

/* Checkbox styling for 2DFX properties */
.effect-prop-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #6366f1;
    margin: 0;
}

.effect-prop-checkbox:hover {
    filter: brightness(1.2);
}

/* Flags grid layout for editable checkboxes */
.effect-flags-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 12px;
}

.effect-flags-grid .effect-flag {
    justify-content: flex-start;
}

.effect-prop-group {
    background: #1e1e30;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
}

.effect-prop-group-title {
    font-size: 0.7rem;
    color: #6366f1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.effect-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.effect-flag {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: #888;
    cursor: pointer;
}

.effect-flag input {
    accent-color: #6366f1;
}

.effect-flag:hover {
    color: #e0e0e0;
}

/* Empty state */
.effects-2dfx-empty {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.8rem;
}

/* ================================
   Batch Render Panel
   ================================ */

#batch-render-panel {
    border-top: 1px solid #2d2d44;
    padding-top: 16px;
    margin-top: 16px;
}

#batch-render-panel h3 {
    margin-bottom: 4px;
}

#batch-render-panel .panel-subtitle {
    font-size: 0.75rem;
    color: #666;
    margin: 0 0 12px 0;
}

.batch-upload-section,
.batch-shared-section,
.batch-camera-section,
.batch-output-section {
    margin-bottom: 16px;
}

.batch-upload-section label,
.batch-shared-section label,
.batch-camera-section label,
.batch-output-section label {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 6px;
}

.batch-dropzone,
.batch-shared-dropzone {
    border: 2px dashed #4a4a6a;
    border-radius: 8px;
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.batch-dropzone svg {
    color: #666;
    margin-bottom: 8px;
}

.batch-dropzone p,
.batch-shared-dropzone p {
    margin: 0 0 4px 0;
    font-size: 0.85rem;
    color: #e0e0e0;
}

.batch-dropzone .hint,
.batch-shared-dropzone .hint {
    font-size: 0.75rem;
    color: #666;
}

.batch-dropzone:hover,
.batch-shared-dropzone:hover,
.batch-dropzone.drag-over,
.batch-shared-dropzone.drag-over {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.batch-dropzone:hover svg,
.batch-dropzone.drag-over svg {
    color: #6366f1;
}

.batch-dropzone input,
.batch-shared-dropzone input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.batch-shared-dropzone {
    padding: 12px;
}

.batch-shared-dropzone p {
    font-size: 0.8rem;
    color: #888;
    margin: 0;
}

.batch-shared-list {
    margin-top: 8px;
}

.batch-shared-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: #2d2d44;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 0.8rem;
}

.batch-shared-item span {
    color: #e0e0e0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.batch-shared-item button {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 1rem;
    line-height: 1;
}

.batch-shared-item button:hover {
    color: #ef4444;
}

.batch-info {
    font-size: 0.8rem;
    color: #888;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 6px;
}

.batch-info span {
    color: #6366f1;
    font-weight: 600;
}

.batch-camera-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.batch-preset-btn {
    padding: 6px 12px;
    border: 1px solid #4a4a6a;
    background: transparent;
    color: #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.batch-preset-btn:hover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.batch-preset-btn.active {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

.batch-preset-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.batch-custom-angle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-small {
    padding: 4px 10px;
    font-size: 0.75rem;
}

.batch-saved-indicator {
    font-size: 0.75rem;
    color: #22c55e;
}

.batch-output-section select {
    width: 100%;
    padding: 8px 10px;
    background: #2d2d44;
    border: 1px solid #4a4a6a;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.85rem;
    cursor: pointer;
}

.batch-output-section select:focus {
    outline: none;
    border-color: #6366f1;
}

.batch-lighting-section {
    margin-bottom: 16px;
    padding: 12px;
    background: #252540;
    border-radius: 8px;
}

.batch-lighting-section > label {
    display: block;
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 10px;
    font-weight: 500;
}

.batch-lighting-row {
    margin-bottom: 10px;
}

.batch-lighting-row:last-of-type {
    margin-bottom: 12px;
}

.batch-lighting-row label {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 4px;
}

.batch-lighting-row .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.batch-lighting-row .checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #6366f1;
}

.batch-lighting-row select {
    width: 100%;
    padding: 6px 10px;
    background: #1a1a2e;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.85rem;
    cursor: pointer;
}

.batch-lighting-row select:focus {
    outline: none;
    border-color: #6366f1;
}

.batch-lighting-row input[type="range"] {
    width: calc(100% - 40px);
    accent-color: #6366f1;
}

.batch-lighting-row span {
    display: inline-block;
    width: 35px;
    text-align: right;
    font-size: 0.75rem;
    color: #888;
}

.batch-lighting-section .btn-small {
    width: 100%;
    margin-top: 4px;
}

.batch-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.batch-actions .btn {
    flex: 1;
}

.batch-progress {
    margin-top: 16px;
    padding: 12px;
    background: #2d2d44;
    border-radius: 8px;
}

.batch-progress-bar {
    height: 8px;
    background: #1a1a2e;
    border-radius: 4px;
    overflow: hidden;
}

.batch-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    width: 0%;
    transition: width 0.3s ease;
}

#batch-progress-text {
    display: block;
    text-align: center;
    font-size: 0.75rem;
    color: #888;
    margin-top: 8px;
}

/* Batch render panel loaded state */
.batch-dropzone.has-files {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.batch-dropzone.has-files svg {
    color: #22c55e;
}

.batch-dropzone.has-files p {
    color: #22c55e;
}

/* Preview mode toggle */
.batch-preview-toggle {
    margin-bottom: 16px;
    padding: 10px 12px;
    background: #2d2d44;
    border-radius: 6px;
}

.batch-preview-toggle .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
}

.batch-preview-toggle .checkbox-label input {
    accent-color: #6366f1;
}

.batch-preview-toggle .batch-hint {
    display: block;
    font-size: 0.7rem;
    color: #666;
    margin-top: 4px;
    margin-left: 22px;
}

/* Preview controls (shown during preview mode) */
.batch-preview-controls {
    background: linear-gradient(135deg, #3730a3, #4f46e5);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.batch-preview-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

#batch-preview-name {
    font-weight: 600;
    color: #fff;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 150px;
}

#batch-preview-count {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

.batch-preview-actions {
    display: flex;
    gap: 6px;
}

.batch-preview-actions .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.8rem;
}

.batch-preview-actions .btn-primary {
    background: #22c55e;
    border-color: #22c55e;
}

.batch-preview-actions .btn-primary:hover {
    background: #16a34a;
}

/* =============================================
   Skeleton Edit Controls
   ============================================= */

#skeleton-edit-controls {
    display: flex;
    gap: 6px;
    margin: 8px 0;
}

#skeleton-edit-controls .btn {
    flex: 1;
    padding: 8px 10px;
    font-size: 0.8rem;
}

/* =============================================
   Prelight Baking Panel Styles
   ============================================= */

#lighting-panel .panel-subtitle {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 12px;
}

.lighting-add-buttons {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.lighting-add-buttons .btn-small {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 6px;
    font-size: 0.75rem;
    background: #3d3d5c;
    border: 1px solid #4d4d6c;
    border-radius: 6px;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lighting-add-buttons .btn-small:hover {
    background: #4d4d6c;
    border-color: #6366f1;
}

.lighting-add-buttons .light-icon {
    font-size: 0.9rem;
}

/* Light List */
.light-list {
    max-height: 150px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.light-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #2d2d44;
    border-radius: 6px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.light-item:hover {
    background: #3d3d5c;
}

.light-item.selected {
    background: rgba(99, 102, 241, 0.2);
    border-color: #6366f1;
}

.light-item .light-icon {
    font-size: 1rem;
}

.light-item .light-name {
    font-size: 0.8rem;
    color: #e0e0e0;
    flex: 1;
}

.light-item .light-type {
    font-size: 0.7rem;
    color: #888;
    text-transform: capitalize;
}

/* Light Properties Panel */
.light-properties {
    background: #2d2d44;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.light-props-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #3d3d5c;
}

.light-props-header span {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
}

#lighting-panel .property-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 8px;
}

#lighting-panel .property-row label {
    font-size: 0.8rem;
    color: #aaa;
    min-width: 70px;
}

#lighting-panel .property-row input[type="color"] {
    width: 40px;
    height: 28px;
    border: 1px solid #4d4d6c;
    border-radius: 4px;
    background: #1a1a2e;
    cursor: pointer;
    padding: 2px;
}

#lighting-panel .property-row select {
    flex: 1;
    padding: 6px 8px;
    background: #1a1a2e;
    border: 1px solid #4d4d6c;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.8rem;
}

.slider-with-value {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.slider-with-value input[type="range"] {
    flex: 1;
    height: 4px;
    background: #3d3d5c;
    border-radius: 2px;
    -webkit-appearance: none;
    appearance: none;
}

.slider-with-value input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #6366f1;
    border-radius: 50%;
    cursor: pointer;
}

.slider-with-value span {
    font-size: 0.75rem;
    color: #888;
    min-width: 35px;
    text-align: right;
}

/* Position inputs */
.light-position {
    flex-direction: column;
    align-items: flex-start !important;
}

.light-position label {
    margin-bottom: 6px;
}

.position-inputs {
    display: flex;
    gap: 6px;
    width: 100%;
}

.pos-input {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pos-input .axis-label {
    font-size: 0.7rem;
    font-weight: 600;
    width: 14px;
    text-align: center;
}

.pos-input .axis-label.x { color: #ef4444; }
.pos-input .axis-label.y { color: #22c55e; }
.pos-input .axis-label.z { color: #3b82f6; }

.pos-input input[type="number"] {
    width: 100%;
    padding: 4px 6px;
    background: #1a1a2e;
    border: 1px solid #4d4d6c;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.75rem;
    text-align: center;
}

.pos-input input[type="number"]:focus {
    outline: none;
    border-color: #6366f1;
}

/* Panel divider */
.panel-divider {
    border: none;
    border-top: 1px solid #3d3d5c;
    margin: 12px 0;
}

/* Bake Settings */
.bake-settings h4 {
    font-size: 0.8rem;
    color: #fff;
    margin-bottom: 10px;
}

/* Bake Actions */
.bake-actions {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}

.bake-actions .btn {
    flex: 1;
    padding: 10px 12px;
    font-size: 0.85rem;
}

#preview-bake.active {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #000;
}

/* Bake Progress */
.bake-progress {
    margin: 12px 0;
}

.bake-progress .progress-bar {
    height: 6px;
    background: #3d3d5c;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.bake-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 3px;
    width: 0%;
    transition: width 0.2s ease;
}

.bake-progress .progress-text {
    font-size: 0.75rem;
    color: #888;
}

/* Bake Hint */
.bake-hint {
    font-size: 0.7rem;
    color: #666;
    line-height: 1.4;
    margin-top: 8px;
}

/* Empty state for light list */
.light-list:empty::before {
    content: "No lights added yet";
    display: block;
    text-align: center;
    padding: 16px;
    color: #666;
    font-size: 0.8rem;
    font-style: italic;
}

/* ==================== Model Merge Modal ==================== */

.merge-models-content {
    max-width: 480px;
    width: 90%;
}

.merge-models-content h3 {
    margin-bottom: 12px;
    font-size: 1.2rem;
    color: #fff;
}

.merge-models-body {
    padding: 16px 0;
}

.merge-models-body > p {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 16px;
    line-height: 1.5;
}

.merge-models-info {
    background: rgba(99, 102, 241, 0.1);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.merge-models-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.merge-models-row:not(:last-child) {
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}

.merge-models-label {
    color: #888;
    font-size: 0.85rem;
}

.merge-models-row span:last-child {
    color: #fff;
    font-weight: 500;
    font-size: 0.85rem;
}

.merge-models-dropzone {
    border: 2px dashed #4a4a6a;
    border-radius: 12px;
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 16px;
    position: relative;
}

.merge-models-dropzone:hover,
.merge-models-dropzone.drag-over {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.merge-models-dropzone.has-file {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.merge-models-dropzone svg {
    color: #6366f1;
    margin-bottom: 8px;
}

.merge-models-dropzone p {
    color: #e0e0e0;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.merge-models-dropzone .hint {
    color: #666;
    font-size: 0.75rem;
}

.merge-models-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.merge-models-options {
    background: rgba(45, 45, 68, 0.5);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.merge-models-options h4 {
    font-size: 0.9rem;
    color: #fff;
    margin-bottom: 12px;
    font-weight: 600;
}

.merge-option-row {
    margin-bottom: 12px;
}

.merge-option-row > label {
    display: block;
    color: #888;
    font-size: 0.8rem;
    margin-bottom: 6px;
}

.merge-offset-inputs {
    display: flex;
    gap: 8px;
}

.merge-offset-field {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}

.merge-offset-field input {
    flex: 1;
    width: 100%;
    padding: 8px;
    background: #2d2d44;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    color: #fff;
    font-size: 0.85rem;
}

.merge-offset-field input:focus {
    outline: none;
    border-color: #6366f1;
}

/* Merge mode selection */
.merge-mode-row {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #3d3d5c;
}

.merge-mode-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.merge-mode-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: #2d2d44;
    border: 1px solid #3d3d5c;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.merge-mode-option:hover {
    border-color: #6366f1;
    background: #35355a;
}

.merge-mode-option input[type="radio"] {
    margin-top: 2px;
    accent-color: #6366f1;
}

.merge-mode-option input[type="radio"]:checked + .merge-mode-label strong {
    color: #6366f1;
}

.merge-mode-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.merge-mode-label strong {
    font-size: 0.9rem;
    color: #fff;
}

.merge-mode-label small {
    font-size: 0.75rem;
    color: #888;
}

.merge-suffix-input {
    width: 100%;
    padding: 8px;
    background: #2d2d44;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    color: #fff;
    font-size: 0.85rem;
}

.merge-suffix-input:focus {
    outline: none;
    border-color: #6366f1;
}

.merge-stats {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(99, 102, 241, 0.2);
}

.merge-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.merge-stat-label {
    color: #666;
    font-size: 0.75rem;
}

.merge-stat span:last-child {
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
}

.merge-warnings {
    margin-top: 12px;
    padding: 10px;
    background: rgba(251, 146, 60, 0.15);
    border: 1px solid rgba(251, 146, 60, 0.3);
    border-radius: 6px;
}

.merge-warnings p {
    color: #fb923c;
    font-size: 0.8rem;
    margin: 0;
    line-height: 1.4;
}

.merge-warnings p + p {
    margin-top: 6px;
}

.merge-models-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid #2d2d44;
}

.merge-models-footer .btn {
    padding: 10px 20px;
}

.merge-models-footer .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Merge Preview Floating Bar */
.merge-preview-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid #6366f1;
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
}

.merge-preview-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.merge-preview-label {
    font-size: 0.7rem;
    color: #6366f1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

#merge-preview-names {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
}

.merge-preview-actions {
    display: flex;
    gap: 8px;
}

.merge-preview-actions .btn {
    padding: 8px 16px;
    font-size: 0.85rem;
}
