/* Login Screen */
.login-screen { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    min-height: 100vh;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background: #f5f5f5;
}

.login-box { 
    background: white; 
    padding: 40px; 
    border-radius: 8px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
    width: 400px; 
}

.login-box h1 { 
    margin-bottom: 30px; 
    color: #333; 
}

.login-box input { 
    width: 100%; 
    padding: 12px; 
    margin-bottom: 15px; 
    border: 1px solid #ddd; 
    border-radius: 4px; 
    font-size: 14px; 
}

.login-box button { 
    width: 100%; 
    padding: 12px; 
    background: #4CAF50; 
    color: white; 
    border: none; 
    border-radius: 4px; 
    font-size: 16px; 
    cursor: pointer; 
}

.login-box button:hover { 
    background: #45a049; 
}

/* Navbar */
.navbar { 
    background: #2c3e50; 
    color: white; 
    padding: 15px 30px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.navbar h1 { 
    font-size: 20px; 
}

.navbar .nav-links { 
    display: flex; 
    gap: 20px; 
    align-items: center; 
}

.navbar .nav-links button { 
    background: transparent; 
    color: white; 
    border: none; 
    padding: 8px 16px; 
    cursor: pointer; 
    font-size: 14px; 
    border-radius: 4px; 
}

.navbar .nav-links button:hover { 
    background: rgba(255,255,255,0.1); 
}

.navbar .nav-links button.active { 
    background: rgba(255,255,255,0.2); 
}

.navbar .user-section button { 
    background: #e74c3c; 
    color: white; 
    border: none; 
    padding: 8px 16px; 
    border-radius: 4px; 
    cursor: pointer; 
}

/* Stat Cards */
.stats { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 20px; 
    margin-bottom: 30px; 
}

.stat-card { 
    background: white; 
    padding: 20px; 
    border-radius: 8px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}

.stat-card h3 { 
    color: #666; 
    font-size: 14px; 
    margin-bottom: 10px; 
}

.stat-card .number { 
    font-size: 32px; 
    font-weight: bold; 
    color: #2c3e50; 
}

/* Status Badges */
.status-badge { 
    padding: 4px 8px; 
    border-radius: 3px; 
    font-size: 11px; 
    font-weight: bold; 
    display: inline-block; 
    margin-right: 5px; 
}

/* Info Text */
.info-text {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 4px;
    padding: 10px 15px;
    margin: 10px 0;
    color: #1565c0;
    font-size: 14px;
}

.info-text strong {
    color: #0d47a1;
}

.status-online { 
    background: #27ae60; 
    color: white; 
}

.status-offline { 
    background: #95a5a6; 
    color: white; 
}

.status-banned { 
    background: #e74c3c; 
    color: white; 
}

.status-enabled { 
    background: #27ae60; 
    color: white; 
}

.status-disabled { 
    background: #95a5a6; 
    color: white; 
}

/* Buttons */
.actions button { 
    padding: 6px 12px; 
    margin-right: 5px; 
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
    font-size: 12px; 
}

.edit-btn { 
    background: #3498db; 
    color: white; 
}

.ban-btn { 
    background: #e74c3c; 
    color: white; 
}

.unban-btn { 
    background: #27ae60; 
    color: white; 
}

.delete-btn { 
    background: #95a5a6; 
    color: white; 
}

.enable-btn { 
    background: #27ae60; 
    color: white; 
}

.disable-btn { 
    background: #e67e22; 
    color: white; 
}

.download-btn { 
    background: #9b59b6; 
    color: white; 
}

.preview-btn { 
    background: #16a085; 
    color: white; 
}

.info-btn {
    background: #3498db;
    color: white;
}

.info-btn:hover {
    background: #2980b9;
}

/* Tileset Status Table */
.tileset-status-table {
    width: 100%;
    margin-top: 10px;
}

.tileset-status-table th,
.tileset-status-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.tileset-status-table th:first-child,
.tileset-status-table td:first-child {
    width: 30px;
    text-align: center;
}

.tileset-found td {
    color: #27ae60;
}

.tileset-missing td {
    color: #e74c3c;
    font-weight: bold;
}

/* Tileset status in map table */
.tileset-status-cell {
    text-align: center;
    font-size: 18px;
}

.tileset-status-cell .tileset-ok {
    color: #27ae60;
}

.tileset-status-cell .tileset-missing {
    color: #e74c3c;
}

.upload-btn { 
    background: #3498db; 
    color: white; 
    border: none; 
    padding: 10px 20px; 
    border-radius: 4px; 
    cursor: pointer; 
    margin-bottom: 20px; 
}

.upload-btn:hover { 
    background: #2980b9; 
}

.btn-primary { 
    background: #3498db; 
    color: white; 
}

.btn-primary:hover { 
    background: #2980b9; 
}

.btn-secondary { 
    background: #95a5a6; 
    color: white; 
}

.btn-secondary:hover { 
    background: #7f8c8d; 
}

.btn-danger { 
    background: #e74c3c; 
    color: white; 
}

.btn-danger:hover { 
    background: #c0392b; 
}

/* File Input Styling */
.file-input-wrapper { 
    position: relative; 
    overflow: hidden; 
    display: inline-block; 
    width: 100%; 
}

.file-input-wrapper input[type=file] { 
    position: absolute; 
    left: 0; 
    top: 0; 
    opacity: 0; 
    width: 100%; 
    height: 100%; 
    cursor: pointer; 
}

.file-input-label { 
    display: block; 
    padding: 10px; 
    border: 2px dashed #ddd; 
    border-radius: 4px; 
    text-align: center; 
    cursor: pointer; 
    background: #f8f9fa; 
}

.file-input-label:hover { 
    background: #e9ecef; 
    border-color: #3498db; 
}

.file-name { 
    margin-top: 10px; 
    font-size: 14px; 
    color: #666; 
}

/* Refresh Indicator */
.refresh-info { 
    color: #666; 
    font-size: 12px; 
    margin-bottom: 15px; 
}

.refresh-indicator { 
    display: inline-block; 
    width: 8px; 
    height: 8px; 
    border-radius: 50%; 
    background: #27ae60; 
    margin-right: 5px; 
    animation: pulse 2s infinite; 
}

/* Search */
.search { 
    margin-bottom: 20px; 
}

.search input { 
    padding: 10px; 
    border: 1px solid #ddd; 
    border-radius: 4px; 
    width: 300px; 
}

/* Search Bar */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.search-bar input {
    flex: 1;
    max-width: 400px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.search-bar button {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Item Icon */
.item-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    background: #f5f5f5;
}

.no-icon {
    font-size: 24px;
}

.icon-cell {
    width: 50px;
    text-align: center;
}

/* Type Badges */
.type-badge {
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    text-transform: capitalize;
}

.type-weapon { background: #e74c3c; color: white; }
.type-armor { background: #3498db; color: white; }
.type-potion { background: #9b59b6; color: white; }
.type-consumable { background: #e67e22; color: white; }
.type-key_item { background: #f39c12; color: white; }
.type-accessory { background: #1abc9c; color: white; }
.type-material { background: #7f8c8d; color: white; }
.type-ingredient { background: #27ae60; color: white; }
.type-gem { background: #8e44ad; color: white; }

/* Items toolbar: create button + view toggle */
.items-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 12px 0 8px;
}

.items-view-toggle {
    display: flex;
    gap: 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.view-toggle-btn {
    padding: 6px 14px;
    font-size: 13px;
    border: none;
    background: #f5f5f5;
    color: #666;
    cursor: pointer;
    transition: all 0.15s;
}

.view-toggle-btn:hover {
    background: #e8e8e8;
}

.view-toggle-btn.active {
    background: #4CAF50;
    color: white;
}

/* Item type summary bar */
.item-type-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    min-height: 20px;
}

.item-type-summary:empty {
    display: none;
}

.item-summary-total {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-right: 4px;
}

.item-summary-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.item-summary-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* Grouped view */
.item-group {
    margin-bottom: 4px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.item-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f5f7fa;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.item-group-header:hover {
    background: #ebeef3;
}

.item-group-toggle {
    font-size: 11px;
    color: #888;
    width: 14px;
    text-align: center;
}

.item-group-icon {
    font-size: 18px;
}

.item-group-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.item-group-count {
    font-size: 12px;
    color: #999;
    background: #e0e0e0;
    padding: 1px 8px;
    border-radius: 10px;
    margin-left: auto;
}

.item-group-body {
    border-top: 1px solid #e0e0e0;
}

.item-group-body table {
    margin: 0;
    border: none;
    border-radius: 0;
}

.item-group-body thead th {
    position: sticky;
    top: 0;
    background: #fafafa;
    font-size: 12px;
    padding: 6px 8px;
}

/* Quest Type Badges */
.quest-type-main { background: #e74c3c; color: white; }
.quest-type-side { background: #3498db; color: white; }
.quest-type-daily { background: #27ae60; color: white; }
.quest-type-repeatable { background: #9b59b6; color: white; }

/* Rarity Badges */
.rarity-badge {
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    text-transform: capitalize;
}

.rarity-common { background: #95a5a6; color: white; }
.rarity-uncommon { background: #27ae60; color: white; }
.rarity-rare { background: #3498db; color: white; }
.rarity-epic { background: #9b59b6; color: white; }
.rarity-legendary { background: #f39c12; color: white; }

/* Stats Cell */
.stats-cell .stat {
    display: inline-block;
    background: #ecf0f1;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    margin: 1px;
}

.no-stats, .no-data {
    color: #95a5a6;
}

/* Rewards Cell */
.rewards-cell .reward {
    display: inline-block;
    margin-right: 5px;
    font-size: 12px;
}

.reward.xp { color: #9b59b6; }
.reward.gold { color: #f39c12; }
.reward.items { color: #3498db; }

/* NPCs Cell */
.npcs-cell .npc {
    display: block;
    font-size: 12px;
}

.npc.giver { color: #3498db; }
.npc.turnin { color: #27ae60; }

/* Link Button */
.link-btn {
    background: none;
    border: none;
    color: #3498db;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    font-size: inherit;
}

.link-btn:hover {
    color: #2980b9;
}

/* Badge */
.badge {
    font-size: 10px;
    margin-left: 3px;
}

.badge.repeatable { color: #27ae60; }
.badge.prereq { color: #e67e22; }

/* Form Sections */
.form-section {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.form-section h3 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #333;
}

/* Form Row */
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-row .form-group {
    flex: 1;
}

/* Checkbox Group */
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Objectives List */
.objectives-list {
    margin-bottom: 10px;
}

.objective-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.objective-row select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 100px;
}

.objective-row input[type="text"] {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.objective-row input[type="number"] {
    width: 80px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.btn-remove {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
}

.btn-remove:hover {
    background: #c0392b;
}

/* Objectives View */
.objectives-view {
    margin: 20px 0;
}

.objective-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 8px;
}

.objective-item .obj-type {
    color: #3498db;
    font-weight: bold;
    text-transform: capitalize;
}

/* Icon Preview */
.icon-preview-container {
    width: 100px;
    height: 100px;
    border: 2px dashed #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f8f9fa;
}

.icon-preview-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Small Icon Preview for Create Modals */
.icon-preview-small {
    width: 64px;
    height: 64px;
    border: 2px dashed #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f8f9fa;
    margin-top: 8px;
}

.icon-preview-small img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Tileset Preview */
.tileset-preview {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f9fa;
}

/* Hero Class Badges */
.class-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.class-warrior { background: #e74c3c; color: white; }
.class-mage { background: #9b59b6; color: white; }
.class-ranger { background: #27ae60; color: white; }
.class-rogue { background: #34495e; color: white; }
.class-cleric { background: #3498db; color: white; }

/* NPC Type Badges */
.npc-type-enemy { background: #e74c3c; color: white; }
.npc-type-boss { background: #8e44ad; color: white; }
.npc-type-merchant { background: #f39c12; color: white; }
.npc-type-quest_giver { background: #3498db; color: white; }
.npc-type-friendly { background: #27ae60; color: white; }

/* Hero/NPC Sprites */
.hero-sprite, .npc-sprite {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f9fa;
}

/* Stats Cell */
.stats-cell {
    font-size: 11px;
    color: #666;
    font-family: monospace;
}

/* Form Sections */
.form-section {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.form-section h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #333;
}

.form-hint {
    font-size: 12px;
    color: #666;
    margin: 5px 0;
}

/* Assets Browser */
.assets-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.stat-badge {
    background: #f0f0f0;
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 14px;
}

.assets-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.assets-container {
    display: flex;
    gap: 20px;
    min-height: 400px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.assets-tree {
    flex: 1;
    background: #fafafa;
    padding: 15px;
    overflow-y: auto;
    max-height: 500px;
    border-right: 1px solid #ddd;
}

.assets-preview {
    flex: 1;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-placeholder {
    text-align: center;
    color: #999;
}

.preview-placeholder span {
    font-size: 48px;
}

.preview-content {
    width: 100%;
}

.preview-image {
    text-align: center;
    margin-bottom: 15px;
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
}

.preview-image img {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
}

.preview-info h3 {
    margin: 0 0 10px 0;
    word-break: break-all;
}

.preview-info p {
    margin: 5px 0;
    font-size: 13px;
    color: #666;
}

.preview-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

/* Tree Styles */
.tree-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.tree-list .tree-list {
    padding-left: 20px;
}

.tree-item {
    margin: 2px 0;
}

.tree-folder .tree-item-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.tree-folder .tree-item-header:hover {
    background: #e8e8e8;
}

.folder-clickable {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.folder-name {
    font-weight: 500;
}

.folder-count {
    font-size: 11px;
    color: #888;
}

.folder-empty {
    font-size: 11px;
    color: #aaa;
    font-style: italic;
}

.folder-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 14px;
    opacity: 0.5;
    transition: opacity 0.2s;
    border-radius: 4px;
}

.folder-delete-btn:hover {
    opacity: 1;
    background: #fee;
}

.tree-file {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.tree-file:hover {
    background: #e0f0ff;
}

.file-name {
    flex: 1;
    word-break: break-all;
}

.file-size {
    font-size: 11px;
    color: #888;
}

.empty-message, .error-message {
    text-align: center;
    padding: 40px;
    color: #666;
}

.error-message {
    color: #e74c3c;
}

/* Asset Picker Modal */
.asset-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.asset-picker-header h2 {
    margin: 0;
}

.asset-picker-header .close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
    color: #666;
}

.asset-picker-header .close-btn:hover {
    color: #333;
}

.asset-picker-container {
    display: flex;
    gap: 15px;
    min-height: 350px;
    max-height: 450px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

.asset-picker-tree {
    flex: 1;
    background: #fafafa;
    padding: 15px;
    overflow-y: auto;
    border-right: 1px solid #ddd;
}

.asset-picker-preview {
    flex: 1;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
}

.asset-picker-tree .tree-file.selected {
    background: #3498db;
    color: white;
}

.asset-picker-tree .tree-file.selected .file-icon {
    filter: brightness(10);
}

.asset-picker-tree .suggested-folder > .tree-item-header {
    background: #fff3cd;
    border-radius: 4px;
}

/* Asset Select Button in Forms */
.asset-select-group {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.asset-select-btn {
    background: #9b59b6;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.asset-select-btn:hover {
    background: #8e44ad;
}

.selected-asset-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    flex: 1;
}

.selected-asset-preview img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
    background: white;
}

.selected-asset-preview .asset-name {
    flex: 1;
    font-size: 13px;
    color: #333;
    word-break: break-all;
}

.selected-asset-preview .clear-asset {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 16px;
    padding: 0 5px;
}

.selected-asset-preview .clear-asset:hover {
    color: #c0392b;
}

.no-asset-selected {
    color: #999;
    font-style: italic;
    padding: 10px;
}

/* Sprite Pack Selector */
.sprite-pack-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
    background: white;
}

.sprite-pack-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 4px;
    flex: 1;
}

.sprite-preview-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    image-rendering: pixelated;
}

.sprite-pack-preview .asset-name {
    font-size: 14px;
    font-weight: 600;
    color: #ccc;
}

/* ============================================
   WORLD EDITOR STYLES
   ============================================ */

.world-actions {
    margin-bottom: 20px;
}

.world-editor-container {
    display: flex;
    gap: 20px;
    min-height: 500px;
}

.world-editor-sidebar {
    width: 250px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    overflow-y: auto;
    max-height: 600px;
}

.world-editor-sidebar h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}

.info-text-small {
    font-size: 12px;
    color: #666;
    margin-bottom: 15px;
}

.map-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: grab;
    transition: all 0.2s;
}

.map-item:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.map-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.map-item .map-icon {
    font-size: 20px;
}

.map-item .map-name {
    flex: 1;
    font-weight: 500;
    font-size: 13px;
}

.map-item .map-size {
    font-size: 11px;
    color: #888;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
}

.world-editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.world-grid-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.grid-info {
    font-size: 14px;
    color: #666;
}

.world-grid-container {
    flex: 1;
    background: #e9ecef;
    border-radius: 8px;
    padding: 20px;
    overflow: auto;
}

.world-grid {
    display: grid;
    gap: 8px;
    min-width: fit-content;
}

.grid-cell {
    width: 150px;
    height: 100px;
    background: white;
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
}

.grid-cell.empty {
    background: #f8f9fa;
}

.grid-cell.empty:hover {
    border-color: #3498db;
    background: #e8f4fc;
}

.grid-cell.has-map {
    background: #d4edda;
    border: 2px solid #28a745;
}

.grid-cell.drag-over {
    border-color: #3498db;
    background: #cce5ff;
    transform: scale(1.02);
}

.cell-coords {
    font-size: 12px;
    color: #aaa;
}

.cell-content {
    text-align: center;
    width: 100%;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.cell-map-name {
    font-weight: 500;
    font-size: 13px;
    color: #155724;
    display: block;
}

.cell-buttons {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.cell-npc-btn {
    padding: 4px 10px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    opacity: 0.8;
    transition: opacity 0.2s, background 0.2s;
}

.cell-npc-btn:hover {
    background: #2980b9;
    opacity: 1;
}

.cell-remove-btn {
    padding: 4px 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    opacity: 0.8;
    transition: opacity 0.2s, background 0.2s;
}

.grid-cell:hover .cell-npc-btn,
.grid-cell:hover .cell-remove-btn {
    opacity: 1;
}

.cell-remove-btn:hover {
    background: #c82333;
}

/* Type badges for worlds */
.type-badge {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.type-overworld {
    background: #d4edda;
    color: #155724;
}

.type-instance {
    background: #fff3cd;
    color: #856404;
}

.type-door {
    background: #cce5ff;
    color: #004085;
}

.type-cave {
    background: #d6d8db;
    color: #383d41;
}

.type-stairs {
    background: #f8d7da;
    color: #721c24;
}

.type-teleporter {
    background: #e2d5f1;
    color: #5a2d82;
}

.type-portal {
    background: #d1ecf1;
    color: #0c5460;
}

.type-gold {
    background: #fff3cd;
    color: #856404;
}

.type-item {
    background: #cce5ff;
    color: #004085;
}

/* Form sections for portal modal */
.form-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.form-section h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #495057;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

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

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.warning {
    color: #856404;
    background: #fff3cd;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-danger:hover {
    background: #c82333;
}

.modal-content-large {
    background: white;
    padding: 30px;
    border-radius: 8px;
    width: 600px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

/* ============================================
   GAME SETTINGS PAGE STYLES
   ============================================ */

.maintenance-banner {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: bold;
}

.maintenance-banner.active {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.maintenance-icon {
    font-size: 24px;
}

.maintenance-time {
    margin-left: auto;
    font-weight: normal;
    font-size: 14px;
    color: #666;
}

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

.settings-header h2 {
    margin: 0;
}

.maintenance-controls {
    display: flex;
    gap: 10px;
}

.btn-lg {
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
}

.btn-success {
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-success:hover {
    background: #218838;
}

.settings-info {
    background: #e7f3ff;
    border: 1px solid #b8daff;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 25px;
}

.settings-info p {
    margin: 0 0 10px 0;
}

.settings-info ul {
    margin: 0;
    padding-left: 20px;
}

.settings-info li {
    margin-bottom: 5px;
}

.settings-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.settings-card h3 {
    margin: 0 0 5px 0;
    color: #333;
}

.settings-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.settings-card-header h3 {
    margin: 0;
}

.settings-description {
    color: #666;
    font-size: 14px;
    margin: 0 0 15px 0;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.setting-item {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
}

.setting-item.has-pending {
    border-color: #ffc107;
    background: #fffef5;
}

.setting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.setting-label {
    font-weight: bold;
    color: #333;
}

.pending-badge {
    background: #ffc107;
    color: #856404;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
}

.setting-controls {
    display: flex;
    gap: 10px;
    margin: 10px 0;
}

.setting-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.setting-input:focus {
    outline: none;
    border-color: #4CAF50;
}

.setting-select {
    min-width: 150px;
}

.setting-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 12px;
    color: #888;
    margin-top: 8px;
}

.meta-item {
    display: flex;
    gap: 5px;
}

.meta-item.pending {
    color: #856404;
}

.meta-item.default {
    color: #6c757d;
}

.setting-status {
    font-size: 12px;
    margin-top: 5px;
    min-height: 16px;
}

.setting-status.pending {
    color: #856404;
}

.setting-status.success {
    color: #28a745;
}

.setting-status.error {
    color: #dc3545;
}

.setting-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.setting-row textarea {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
}

.settings-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 10px;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-ghost {
    background: transparent;
    border: 1px solid #ddd;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-ghost:hover {
    background: #f0f0f0;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 13px;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 6px;
    background: #333;
    color: white;
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

.notification-success {
    background: #28a745;
}

.notification-error {
    background: #dc3545;
}

.notification-info {
    background: #17a2b8;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Collapsible Settings Sections */
.collapsible-header {
    cursor: pointer;
    user-select: none;
}

.collapsible-header:hover {
    background: #f5f5f5;
    border-radius: 4px;
    margin: -5px;
    padding: 5px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.collapse-icon {
    font-size: 12px;
    color: #666;
    transition: transform 0.2s ease;
    width: 16px;
}

.collapsible-header.collapsed .collapse-icon {
    transform: rotate(0deg);
}

.settings-count {
    font-size: 12px;
    color: #888;
    font-weight: normal;
}

.collapsible-content {
    transition: all 0.3s ease;
    overflow: hidden;
    max-height: 2000px;
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0;
    margin: 0;
}

.settings-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.collapsible-header.collapsed {
    margin-bottom: 0;
}

/* ============================================
   Asset Processor
   ============================================ */

.section-description {
    color: #666;
    font-size: 14px;
    margin: -5px 0 20px 0;
}

.processor-layout {
    display: flex;
    gap: 24px;
    min-height: 400px;
}

.processor-controls {
    flex: 1;
    min-width: 0;
}

.processor-preview-panel {
    flex: 1;
    min-width: 0;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

.processor-preview-panel h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
}

/* Dropzone */
.processor-dropzone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fafafa;
}

.processor-dropzone:hover {
    border-color: #4CAF50;
    background: #f0faf0;
}

.processor-dropzone.dragover {
    border-color: #4CAF50;
    background: #e8f5e9;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.dropzone-icon {
    font-size: 36px;
    display: block;
    margin-bottom: 8px;
}

.dropzone-content p {
    margin: 4px 0;
    color: #555;
}

.dropzone-hint {
    font-size: 12px;
    color: #999 !important;
}

.hidden-file-input {
    display: none;
}

/* File info row */
.processor-file-info {
    margin-top: 10px;
}

.file-info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #f0f9f0;
    border: 1px solid #c8e6c9;
    border-radius: 6px;
}

.file-info-thumb {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 4px;
    background: #fff;
    border: 1px solid #ddd;
}

.file-info-details {
    flex: 1;
    min-width: 0;
}

.file-info-details strong {
    display: block;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-info-details span {
    font-size: 12px;
    color: #666;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    color: #999;
}

.btn-icon:hover {
    background: #ffebee;
    color: #e53935;
}

/* Folder picker */
.processor-folder-picker {
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.folder-picker-header {
    padding: 10px 12px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
}

.folder-picker-selected {
    color: #888;
}

.folder-picker-selected-active {
    color: #333;
}

.folder-picker-tree {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px 0;
}

.folder-tree-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.folder-tree-list .folder-tree-list {
    padding-left: 20px;
}

.folder-tree-item {
    cursor: pointer;
}

.folder-tree-item.selected > .folder-tree-row,
.folder-tree-item.selected > .folder-tree-clickable {
    background: #e3f2fd;
}

.folder-tree-row {
    display: flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 4px;
}

.folder-tree-row:hover {
    background: #f0f0f0;
}

.folder-tree-toggle {
    font-size: 10px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    cursor: pointer;
    color: #888;
    user-select: none;
}

.folder-tree-toggle-spacer {
    width: 16px;
    flex-shrink: 0;
}

.folder-tree-clickable {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    padding: 3px 6px;
    border-radius: 4px;
}

.folder-tree-icon {
    font-size: 14px;
}

.folder-tree-name {
    font-size: 13px;
    color: #333;
}

.loading-small {
    padding: 12px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* Destination path */
.processor-dest-path {
    padding: 10px 12px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
    min-height: 40px;
}

.processor-dest-path.path-ready {
    background: #f3e5f5;
    border-color: #ce93d8;
    color: #6a1b9a;
}

.processor-dest-path code {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
}

.processor-dest-path small {
    color: #888;
}

/* Processor buttons */
.processor-buttons {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.processor-buttons button {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: bold;
}

/* Preview grid */
.processor-preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
    min-height: 200px;
}

.processor-preview-grid .preview-placeholder {
    width: 100%;
    padding: 40px 0;
}

.preview-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.preview-card-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-conic-gradient(#e8e8e8 0% 25%, #fff 0% 50%) 50% / 16px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px;
    overflow: hidden;
}

.preview-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.preview-card-label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    text-align: center;
}

/* Processor status messages */
.processor-status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
}

.processor-status.processing {
    background: #fff3e0;
    border: 1px solid #ffcc80;
    color: #e65100;
}

.processor-status.success {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #2e7d32;
}

.processor-status.error {
    background: #ffebee;
    border: 1px solid #ef9a9a;
    color: #c62828;
}

.processor-result-list {
    margin: 8px 0 0 0;
    padding-left: 20px;
    font-size: 13px;
}

.processor-result-list li {
    margin: 4px 0;
}

.processor-result-list code {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

/* Responsive */
@media (max-width: 900px) {
    .processor-layout {
        flex-direction: column;
    }
}

/* File list (multi-file processor) */
.processor-file-list {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 8px;
    background: #fff;
}

.processor-file-list-empty {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

.file-list-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.file-list-row:last-child {
    border-bottom: none;
}

.file-list-row:hover {
    background: #fafafa;
}

.file-list-thumb {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 4px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.file-list-thumb-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.file-list-name-input {
    flex: 1;
    min-width: 120px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    font-family: monospace;
}

.file-list-name-input:focus {
    border-color: #4CAF50;
    outline: none;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.15);
}

.file-list-original {
    font-size: 11px;
    color: #999;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.file-list-size {
    font-size: 11px;
    color: #aaa;
    flex-shrink: 0;
    min-width: 55px;
    text-align: right;
}

/* Progress panel (right side during upload) */
.processor-progress-panel {
    min-height: 200px;
}

.progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.progress-row:last-child {
    border-bottom: none;
}

.progress-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.progress-name {
    font-weight: 600;
    color: #333;
    min-width: 80px;
    font-family: monospace;
    font-size: 12px;
}

.progress-status {
    color: #888;
    font-size: 12px;
}

.progress-status.progress-done {
    color: #2e7d32;
}

.progress-status.progress-error {
    color: #c62828;
}

/* Background check badges */
.bg-badge-wrapper {
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.bg-badge {
    font-size: 14px;
    cursor: help;
}

.bg-badge-checking {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Mode tags in folder tree */
.folder-mode-tag {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}

.tag-items {
    background: #e8f5e9;
    color: #2e7d32;
}

.tag-portrait {
    background: #e3f2fd;
    color: #1565c0;
}

/* Non-selectable folder rows (navigation only) */
.folder-not-selectable .folder-tree-clickable {
    color: #888;
}

.folder-not-selectable .folder-tree-name {
    color: #888;
}

/* Mode label in folder picker header */
.processor-mode-label {
    display: inline-block;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 10px;
    font-weight: 600;
}

.mode-items {
    background: #e8f5e9;
    color: #2e7d32;
}

.mode-portrait {
    background: #e3f2fd;
    color: #1565c0;
}

/* ============================================
   Browser layout (unified tree style)
   ============================================ */

.browser-layout {
    display: flex;
    gap: 16px;
    min-height: 450px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.browser-tree-panel {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    max-height: 500px;
    padding: 8px 0;
    border-right: 1px solid #e0e0e0;
}

.browser-context-panel {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    max-height: 500px;
    padding: 16px;
    background: #fafafa;
}

/* File items in browser tree */
.file-item .folder-tree-clickable {
    cursor: pointer;
}

.file-item .folder-tree-name {
    font-size: 12px;
}

.folder-tree-count {
    font-size: 11px;
    color: #999;
    margin-left: 4px;
}

.folder-tree-count.empty {
    color: #ccc;
}

.folder-tree-count.file-size {
    color: #aaa;
    margin-left: auto;
    padding-right: 8px;
}

/* Inline rename input */
.inline-rename-input {
    font-size: 13px;
    padding: 1px 4px;
    border: 1px solid #4CAF50;
    border-radius: 3px;
    outline: none;
    background: #fff;
    color: #333;
    min-width: 80px;
    max-width: 200px;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.file-item .inline-rename-input {
    font-size: 12px;
}

.inline-rename-input:focus {
    border-color: #388E3C;
    box-shadow: 0 0 0 2px rgba(56, 142, 60, 0.3);
}

.inline-rename-saving {
    opacity: 0.6;
    cursor: wait;
}

/* Browser actions bar */
.browser-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    align-items: center;
}

.browser-actions .btn-danger {
    margin-left: auto;
}

/* Context panel: folder upload */
.context-folder h3 {
    margin: 0 0 16px 0;
    font-size: 15px;
    color: #333;
    word-break: break-all;
}

.context-upload-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.context-upload-zone:hover {
    border-color: #4CAF50;
    background: #f0faf0;
}

.context-upload-zone.dragover {
    border-color: #4CAF50;
    background: #e8f5e9;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.browser-upload-list {
    margin-top: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
}

.browser-upload-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.browser-upload-row:last-child {
    border-bottom: none;
}

.browser-upload-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.browser-upload-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}

/* Context panel: file preview */
.context-file h3 {
    margin: 0 0 12px 0;
    font-size: 15px;
    color: #333;
    word-break: break-all;
}

.context-file-preview {
    background: repeating-conic-gradient(#e8e8e8 0% 25%, #fff 0% 50%) 50% / 16px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.context-file-preview img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    image-rendering: pixelated;
}

.context-file-preview.json-preview {
    background: #f5f5f5;
    flex-direction: column;
}

.context-file-info {
    margin-top: 12px;
    font-size: 13px;
}

.context-file-info p {
    margin: 4px 0;
}

.context-file-info code {
    background: rgba(0,0,0,0.06);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.context-file-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

/* Responsive */
@media (max-width: 900px) {
    .browser-layout {
        flex-direction: column;
    }
    .browser-tree-panel {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        max-height: 300px;
    }
}

/* ============================================
   Screen Background Settings
   ============================================ */

.background-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 0 16px 16px;
}

@media (max-width: 900px) {
    .background-settings-grid {
        grid-template-columns: 1fr;
    }
}

.background-setting-item {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
}

.background-setting-item h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.background-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.background-select {
    width: 100%;
}

.background-preview {
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #ddd;
    background: #1a1310;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.background-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.background-preview-empty {
    color: #888;
    font-size: 13px;
    font-style: italic;
}

.background-status {
    min-height: 18px;
    font-size: 12px;
    margin-top: 6px;
}

.background-status.pending {
    color: #f0ad4e;
}

.background-status.success {
    color: #5cb85c;
}

.background-status.error {
    color: #d9534f;
}

/* =============================================
   Sprite Processor — Direction Status
   ============================================= */

.sprite-direction-status {
    margin-bottom: 10px;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.direction-summary {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    padding: 4px 0;
}

.dir-summary-ok {
    color: #28a745;
}

.dir-summary-warn {
    color: #e67e22;
}

.direction-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.direction-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.direction-badge.dir-ok {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.direction-badge.dir-warn {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.direction-badge.dir-missing {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Sprite Processor — Transparency Warning Banner */

.sprite-transparency-warning {
    margin-bottom: 10px;
}

.transparency-warning-banner {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 6px;
    padding: 12px 16px;
    color: #664d03;
}

.transparency-warning-banner strong {
    font-size: 14px;
    display: block;
    margin-bottom: 6px;
}

.transparency-warning-banner p {
    margin: 4px 0;
    font-size: 12px;
    line-height: 1.4;
}

.transparency-warning-banner p:last-child {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #ffe08a;
}
