/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #eee;
    background: #1a1a2e;
}

/* ============================================
   CANVAS
   ============================================ */
#game-canvas {
    display: block;
    position: absolute;
    top: 50px;
    left: 0;
    width: 100%;
    height: calc(100% - 50px);
    background: #0f0f1a;
}

/* ============================================
   MENU BAR
   ============================================ */
.menu-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: rgba(15, 15, 30, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 165, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    z-index: 100;
}

.menu-left {
    display: flex;
    gap: 5px;
}

.menu-center h1 {
    color: #ffa500;
    font-size: 18px;
    text-shadow: 0 0 20px rgba(255, 165, 0, 0.5);
}

.menu-milestone {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 15px;
    font-size: 12px;
}

.milestone-label {
    color: #ffa500;
    font-weight: bold;
    white-space: nowrap;
}

.milestone-items {
    display: flex;
    gap: 8px;
    align-items: center;
}

.milestone-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    border: 1px solid #333;
}

.milestone-item.complete {
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.15);
}

.milestone-item.incomplete {
    border-color: #666;
}

.milestone-item-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

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

.milestone-item.complete .milestone-item-count {
    color: #4ade80;
}

.menu-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.info-display {
    display: flex;
    gap: 20px;
}

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

.info-label {
    color: #888;
    font-size: 12px;
}

.info-value {
    color: #ffa500;
    font-size: 12px;
    font-weight: bold;
}

/* Menu Dropdowns */
.menu-dropdown {
    position: relative;
}

.menu-btn {
    background: transparent;
    border: none;
    padding: 8px 15px;
    color: #ccc;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
}

.menu-btn:hover {
    background: rgba(255, 165, 0, 0.15);
    color: #ffa500;
}

.menu-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(20, 20, 40, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 4px;
    min-width: 150px;
    z-index: 200;
    padding: 5px 0;
}

.menu-dropdown:hover .menu-content {
    display: block;
}

.menu-content button {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 8px 15px;
    color: #ccc;
    font-size: 12px;
    cursor: pointer;
}

.menu-content button:hover {
    background: rgba(255, 165, 0, 0.2);
    color: #ffa500;
}

.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 5px 0;
}

/* ============================================
   SIDEBARS
   ============================================ */
.sidebar {
    position: absolute;
    top: 50px;
    width: 200px;
    height: calc(100% - 50px);
    background: rgba(15, 15, 30, 0.95);
    backdrop-filter: blur(10px);
    z-index: 50;
    overflow-y: auto;
}

.sidebar-right {
    right: 0;
    border-left: 1px solid rgba(255, 165, 0, 0.2);
}

.sidebar-header {
    padding: 15px;
    font-size: 14px;
    font-weight: bold;
    color: #ffa500;
    border-bottom: 1px solid rgba(255, 165, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Building icons */
.miner-icon { background: #8b4513; }
.smelter-icon { background: #ff6347; }
.foundry-icon { background: #ff4500; }
.constructor-icon { background: #4682b4; }
.assembler-icon { background: #9370db; }
.belt-icon { background: #555; }
.storage-icon { background: #696969; }
.splitter-icon { background: #ffa500; }
.merger-icon { background: #ffa500; }
.power-icon { background: #228b22; }
.coal-icon { background: #2c2c2c; border: 1px solid #555; }
.foundation-icon { background: #6b6b6b; border: 1px solid #888; }
.special-icon { background: #ff8c00; }

/* ============================================
   PROPERTIES (Right Sidebar)
   ============================================ */
.properties-content {
    padding: 15px;
}

.props-placeholder {
    color: #666;
    font-size: 12px;
    text-align: center;
    padding: 20px;
}

.props-title {
    font-size: 16px;
    font-weight: bold;
    color: #ffa500;
    margin-bottom: 15px;
}

.props-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.info-row span:first-child {
    color: #888;
}

.info-row span:last-child {
    color: #eee;
}

.props-actions {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.props-actions button {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}

.btn-danger {
    background: rgba(255, 80, 80, 0.2);
    color: #ff5050;
    border: 1px solid rgba(255, 80, 80, 0.3);
}

.btn-danger:hover {
    background: rgba(255, 80, 80, 0.3);
}

/* Property sections for inventory */
.props-section {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.props-section-title {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.inventory-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.inventory-item {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

.inventory-item .item-count {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 8px;
    color: #fff;
    text-shadow: 0 0 2px #000, 0 0 2px #000;
}

.buffer-item-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.inventory-empty {
    color: #555;
    font-size: 11px;
    font-style: italic;
}

/* Buffer capacity bar */
.buffer-capacity {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.capacity-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.capacity-fill {
    height: 100%;
    transition: width 0.2s ease;
}

.capacity-text {
    font-size: 10px;
    color: #888;
    min-width: 45px;
    text-align: right;
}

/* Status indicators */
.status-working {
    color: #4ade80;
}

.status-idle {
    color: #fbbf24;
}

.status-blocked {
    color: #f87171;
}

/* Recipe selector */
.recipe-select {
    width: 100%;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #eee;
    font-size: 12px;
    cursor: pointer;
    margin-bottom: 10px;
}

.recipe-select:hover {
    border-color: rgba(255, 165, 0, 0.5);
}

.recipe-select:focus {
    outline: none;
    border-color: #ffa500;
}

.recipe-select option {
    background: #1a1a2e;
    color: #eee;
}

.recipe-details {
    font-size: 11px;
    color: #aaa;
}

.recipe-io {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
}

.recipe-arrow {
    color: #ffa500;
    font-size: 14px;
}

.recipe-items {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.recipe-item {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    padding: 3px 6px;
    border-radius: 3px;
}

.recipe-item-icon {
    width: 16px;
    height: 16px;
    border-radius: 2px;
}

.recipe-item-text {
    font-size: 10px;
    color: #ccc;
}

.recipe-time {
    margin-top: 8px;
    font-size: 10px;
    color: #888;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.visible {
    display: flex;
}

.modal-content {
    background: rgba(20, 20, 40, 0.98);
    border: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 8px;
    padding: 30px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-content h2 {
    color: #ffa500;
    margin-bottom: 20px;
    font-size: 20px;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: #ffa500;
}

/* Help sections */
.help-section {
    margin-bottom: 20px;
}

.help-section h3 {
    color: #888;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.help-grid {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px;
}

.help-key {
    background: rgba(255, 165, 0, 0.1);
    color: #ffa500;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    text-align: center;
}

.help-desc {
    color: #ccc;
    font-size: 12px;
    display: flex;
    align-items: center;
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 165, 0, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 165, 0, 0.5);
}

/* ============================================
   NOTIFICATIONS
   ============================================ */
.notification {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(30, 30, 50, 0.95);
    border: 1px solid #4ade80;
    color: #4ade80;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.notification.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.notification.error {
    border-color: #f87171;
    color: #f87171;
}

/* ============================================
   COST DISPLAY
   ============================================ */
.cost-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
}

.cost-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 4px;
    border-radius: 3px;
}

.cost-item.cost-ok {
    color: #4ade80;
}

.cost-item.cost-missing {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

.cost-icon {
    width: 20px;
    height: 20px;
    border-radius: 2px;
    flex-shrink: 0;
    object-fit: contain;
}

img.cost-icon {
    image-rendering: pixelated;
}

.cost-text {
    flex: 1;
}

.cost-have {
    color: #888;
    font-size: 10px;
}

/* Ghost overlay for unaffordable buildings */
.placement-ghost-unaffordable {
    opacity: 0.3;
}

/* Cost section in properties */
.props-cost {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.props-cost-title {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

/* ============================================
   COST TOOLTIP
   ============================================ */
.cost-tooltip {
    position: fixed;
    background: rgba(20, 20, 40, 0.98);
    border: 1px solid rgba(255, 165, 0, 0.4);
    border-radius: 6px;
    padding: 12px;
    min-width: 180px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.cost-tooltip.visible {
    opacity: 1;
}

.cost-tooltip-title {
    font-size: 14px;
    font-weight: bold;
    color: #ffa500;
    margin-bottom: 6px;
}

.cost-tooltip-power {
    font-size: 11px;
    color: #888;
    margin-bottom: 8px;
}

.cost-tooltip-section {
    font-size: 10px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.cost-tooltip-free {
    font-size: 12px;
    color: #4ade80;
}

/* ============================================
   CHEAT PANEL
   ============================================ */
.cheat-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(30, 20, 20, 0.98);
    border: 2px solid rgba(255, 50, 50, 0.6);
    border-radius: 8px;
    z-index: 600;
    width: 500px;
    max-height: 70vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.cheat-panel.visible {
    display: flex;
    flex-direction: column;
}

.cheat-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(255, 50, 50, 0.2);
    border-bottom: 1px solid rgba(255, 50, 50, 0.4);
}

.cheat-panel-title {
    font-size: 16px;
    font-weight: bold;
    color: #ff6666;
}

.cheat-panel-close {
    background: none;
    border: none;
    color: #ff6666;
    font-size: 24px;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.cheat-panel-close:hover {
    color: #ff9999;
}

.cheat-panel-content {
    padding: 15px;
    overflow-y: auto;
    flex: 1;
}

.cheat-search-section {
    margin-bottom: 10px;
}

.cheat-search-section input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 50, 50, 0.3);
    border-radius: 4px;
    color: #eee;
    font-size: 14px;
}

.cheat-search-section input:focus {
    outline: none;
    border-color: rgba(255, 50, 50, 0.6);
}

.cheat-amount-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.cheat-amount-section label {
    color: #aaa;
    font-size: 14px;
}

.cheat-amount-section input {
    width: 100px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 50, 50, 0.3);
    border-radius: 4px;
    color: #eee;
    font-size: 14px;
}

.cheat-amount-section input:focus {
    outline: none;
    border-color: rgba(255, 50, 50, 0.6);
}

.cheat-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.cheat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cheat-item:hover {
    background: rgba(255, 50, 50, 0.2);
    border-color: rgba(255, 50, 50, 0.5);
}

.cheat-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    margin-bottom: 4px;
    object-fit: contain;
}

.cheat-item-name {
    font-size: 10px;
    color: #ccc;
    text-align: center;
    word-break: break-word;
    line-height: 1.2;
}

/* ============================================
   BUILD MENU (Satisfactory style)
   ============================================ */
.build-menu {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 35, 0.98);
    border: 2px solid rgba(255, 165, 0, 0.4);
    border-radius: 8px;
    z-index: 500;
    min-width: 700px;
    max-width: 900px;
    max-height: 80vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.build-menu.visible {
    display: block;
}

.build-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(255, 165, 0, 0.15);
    border-bottom: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 6px 6px 0 0;
}

.build-menu-title {
    font-size: 18px;
    font-weight: bold;
    color: #ffa500;
}

.build-menu-hint {
    font-size: 12px;
    color: #888;
}

.build-menu-content {
    display: flex;
    min-height: 400px;
    max-height: calc(80vh - 60px);
}

/* Categories sidebar */
.build-categories {
    width: 140px;
    background: rgba(0, 0, 0, 0.3);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 0;
    flex-shrink: 0;
}

.build-category {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    cursor: pointer;
    color: #aaa;
    font-size: 13px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.build-category:hover {
    background: rgba(255, 165, 0, 0.1);
    color: #fff;
}

.build-category.active {
    background: rgba(255, 165, 0, 0.2);
    color: #ffa500;
    border-left-color: #ffa500;
}

.category-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* Buildings grid panel */
.build-items-panel {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
}

.build-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.build-menu-footer {
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 0 6px 6px;
}

.free-build-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.free-build-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #ffa500;
    cursor: pointer;
}

.free-build-toggle .toggle-label {
    color: #aaa;
    font-size: 13px;
}

.free-build-toggle input:checked + .toggle-label {
    color: #ffa500;
}

.build-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.build-item:hover {
    background: rgba(255, 165, 0, 0.15);
    border-color: rgba(255, 165, 0, 0.4);
    transform: translateY(-2px);
}

.build-item.cannot-afford {
    opacity: 0.5;
}

.build-item-icon {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    margin-bottom: 8px;
    object-fit: contain;
}

img.build-item-icon {
    image-rendering: auto;
}

.build-item-name {
    font-size: 11px;
    color: #eee;
    text-align: center;
    line-height: 1.3;
}

.build-item-power {
    font-size: 10px;
    color: #888;
    margin-top: 4px;
}

.build-item-power.produces {
    color: #4ade80;
}

.build-item-power.consumes {
    color: #f87171;
}

/* Shared overlay backdrop */
.overlay-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 499;
}

.overlay-backdrop.visible {
    display: block;
}

/* ============================================
   INVENTORY PANEL (Satisfactory style)
   ============================================ */
.inventory-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 35, 0.98);
    border: 2px solid rgba(255, 165, 0, 0.4);
    border-radius: 8px;
    z-index: 500;
    width: 480px;
    max-height: 80vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.inventory-panel.visible {
    display: block;
}

.inventory-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(255, 165, 0, 0.15);
    border-bottom: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 6px 6px 0 0;
}

.inventory-panel-title {
    font-size: 18px;
    font-weight: bold;
    color: #ffa500;
}

.inventory-panel-hint {
    font-size: 12px;
    color: #888;
}

.inventory-panel-content {
    padding: 15px;
    max-height: calc(80vh - 60px);
    overflow-y: auto;
    overflow-x: hidden;
}

.inventory-grid-large {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.inventory-slot {
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.inventory-slot.has-item {
    border-color: rgba(255, 165, 0, 0.3);
}

.inventory-slot-icon {
    width: 70%;
    height: 70%;
    border-radius: 4px;
    object-fit: contain;
}

img.inventory-slot-icon {
    image-rendering: pixelated;
}

.inventory-slot-count {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 11px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 3px #000, 0 0 3px #000;
}

.inventory-slot-name {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 40, 0.95);
    border: 1px solid rgba(255, 165, 0, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 10;
    color: #eee;
}

.inventory-slot:hover .inventory-slot-name {
    opacity: 1;
}

.inventory-empty-message {
    grid-column: 1 / -1;
    text-align: center;
    color: #666;
    padding: 40px;
    font-size: 14px;
}

/* ============================================
   INVENTORY + EQUIPMENT CONTAINER
   ============================================ */
.inventory-equipment-container {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 500;
    gap: 20px;
}

.inventory-equipment-container.visible {
    display: flex;
}

.inventory-equipment-container .inventory-panel {
    display: block;
    position: static;
    transform: none;
}

/* ============================================
   EQUIPMENT PANEL
   ============================================ */
.equipment-panel {
    background: rgba(20, 20, 35, 0.98);
    border: 2px solid rgba(100, 200, 255, 0.4);
    border-radius: 8px;
    width: 280px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.equipment-panel-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 20px;
    background: rgba(100, 200, 255, 0.15);
    border-bottom: 1px solid rgba(100, 200, 255, 0.3);
    border-radius: 6px 6px 0 0;
}

.equipment-panel-title {
    font-size: 18px;
    font-weight: bold;
    color: #64c8ff;
}

.equipment-panel-content {
    padding: 15px;
}

.equipment-body-slots {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.equipment-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.equipment-slot {
    width: 64px;
    height: 64px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(100, 200, 255, 0.3);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.15s;
}

.equipment-slot:hover {
    border-color: rgba(100, 200, 255, 0.6);
    background: rgba(100, 200, 255, 0.1);
}

.equipment-slot.has-item {
    border-color: rgba(100, 200, 255, 0.5);
}

.equipment-slot .slot-label {
    font-size: 10px;
    color: #666;
    text-transform: uppercase;
}

.equipment-slot.has-item .slot-label {
    display: none;
}

.equipment-slot .slot-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    image-rendering: pixelated;
}

.equipment-slot .slot-item-name {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 40, 0.95);
    border: 1px solid rgba(100, 200, 255, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 10;
    color: #eee;
}

.equipment-slot:hover .slot-item-name {
    opacity: 1;
}

/* Active item slots section */
.equipment-active-section {
    border-top: 1px solid rgba(100, 200, 255, 0.2);
    padding-top: 15px;
}

.equipment-active-label {
    font-size: 12px;
    color: #888;
    text-align: center;
    margin-bottom: 10px;
}

.equipment-active-slots {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.equipment-active-slot {
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 165, 0, 0.3);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.15s;
}

.equipment-active-slot:hover {
    border-color: rgba(255, 165, 0, 0.6);
    background: rgba(255, 165, 0, 0.1);
}

.equipment-active-slot.has-item {
    border-color: rgba(255, 165, 0, 0.5);
}

.equipment-active-slot.selected {
    border-color: #ffa500;
    box-shadow: 0 0 8px rgba(255, 165, 0, 0.5);
}

.equipment-active-slot .slot-num {
    font-size: 11px;
    color: #666;
    font-weight: bold;
}

.equipment-active-slot.has-item .slot-num {
    position: absolute;
    bottom: 1px;
    right: 3px;
    font-size: 9px;
    color: #fff;
    text-shadow: 0 0 2px #000, 0 0 2px #000;
}

.equipment-active-slot .slot-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    image-rendering: pixelated;
}

.equipment-active-slot .slot-item-name {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 40, 0.95);
    border: 1px solid rgba(255, 165, 0, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 10;
    color: #eee;
}

.equipment-active-slot:hover .slot-item-name {
    opacity: 1;
}

/* ============================================
   INTERACT PANEL (Storage, etc.)
   ============================================ */
.interact-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 35, 0.98);
    border: 2px solid rgba(255, 165, 0, 0.4);
    border-radius: 8px;
    z-index: 500;
    min-width: 900px;
    max-height: 90vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.interact-panel.visible {
    display: block;
}

.interact-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(255, 165, 0, 0.15);
    border-bottom: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 6px 6px 0 0;
}

.interact-panel-title {
    font-size: 18px;
    font-weight: bold;
    color: #ffa500;
}

.interact-panel-close {
    background: rgba(255, 100, 100, 0.8);
    border: none;
    color: #fff;
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.interact-panel-close:hover {
    background: rgba(255, 70, 70, 1);
}

.interact-panel-content {
    display: flex;
    padding: 20px;
    gap: 20px;
}

/* Storage side */
.interact-storage-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.interact-storage-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

/* Inventory side */
.interact-inventory-side {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.interact-inventory-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Middle transfer buttons */
.interact-middle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px;
    padding: 10px;
}

.interact-transfer-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 15px 20px;
    background: linear-gradient(180deg, rgba(255, 180, 0, 0.6) 0%, rgba(200, 140, 0, 0.6) 100%);
    border: 2px solid rgba(255, 200, 0, 0.5);
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
}

.interact-transfer-btn:hover {
    background: linear-gradient(180deg, rgba(255, 200, 0, 0.8) 0%, rgba(220, 160, 0, 0.8) 100%);
    border-color: rgba(255, 220, 0, 0.8);
}

.transfer-icon {
    font-size: 20px;
}

.interact-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #ccc;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.interact-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Storage/inventory slots */
.interact-slot {
    aspect-ratio: 1;
    background: rgba(60, 60, 70, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    user-select: none;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.1s;
}

.interact-slot:hover {
    background: rgba(80, 80, 90, 0.8);
    border-color: rgba(255, 165, 0, 0.5);
}

.interact-slot.has-item {
    border-color: rgba(255, 165, 0, 0.3);
}

/* Drag and drop styles */
.interact-slot[draggable="true"],
.inventory-slot[draggable="true"] {
    cursor: grab;
}

.interact-slot[draggable="true"]:active,
.inventory-slot[draggable="true"]:active {
    cursor: grabbing;
}

.interact-slot.dragging,
.inventory-slot.dragging {
    opacity: 0.5;
}

.interact-slot.drag-over,
.inventory-slot.drag-over,
.drag-target.drag-over {
    border-color: #ffa500 !important;
    background: rgba(255, 165, 0, 0.2) !important;
    box-shadow: 0 0 10px rgba(255, 165, 0, 0.5);
}

.interact-slot-icon {
    width: 70%;
    height: 70%;
    border-radius: 4px;
    object-fit: contain;
}

img.interact-slot-icon {
    image-rendering: auto;
}

.interact-slot-count {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 3px #000, 0 0 3px #000;
    background: rgba(255, 165, 0, 0.7);
    padding: 1px 4px;
    border-radius: 3px;
}

.interact-slot-name {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 40, 0.95);
    border: 1px solid rgba(255, 165, 0, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 10;
    color: #eee;
}

.interact-slot:hover .interact-slot-name {
    opacity: 1;
}

/* ============================================
   PRODUCTION PANEL (Constructor, Smelter, etc.)
   ============================================ */
.production-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 35, 0.98);
    border: 2px solid rgba(255, 165, 0, 0.4);
    border-radius: 8px;
    z-index: 500;
    min-width: 950px;
    max-height: 90vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.production-panel.visible {
    display: block;
}

.production-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(255, 165, 0, 0.15);
    border-bottom: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 6px 6px 0 0;
}

.production-panel-title {
    font-size: 18px;
    font-weight: bold;
    color: #ffa500;
}

.production-panel-close {
    background: rgba(255, 100, 100, 0.8);
    border: none;
    color: #fff;
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.production-panel-close:hover {
    background: rgba(255, 70, 70, 1);
}

.production-panel-content {
    display: flex;
    padding: 20px;
    gap: 20px;
}

.production-left {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.production-recipe-section {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 15px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.production-label {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.production-recipe-select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.production-recipe-select:hover {
    border-color: rgba(255, 165, 0, 0.6);
}

.production-recipe-select:focus {
    outline: none;
    border-color: #ffa500;
}

.production-recipe-select option {
    background: #1a1a2e;
    color: #fff;
}

.production-main {
    display: flex;
    gap: 15px;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.production-io-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.production-io-title {
    font-size: 12px;
    font-weight: bold;
    color: #888;
    text-align: center;
    text-transform: uppercase;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.production-buffer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 120px;
}

.production-buffer-slot {
    display: flex;
    align-items: center;
    gap: 10px;
    user-select: none;
    background: rgba(60, 60, 70, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.1s;
}

.production-buffer-slot:hover {
    background: rgba(80, 80, 90, 0.8);
    border-color: rgba(255, 165, 0, 0.5);
}

.production-buffer-slot.has-item {
    border-color: rgba(255, 165, 0, 0.5);
}

.production-buffer-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.production-buffer-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.production-buffer-count {
    font-size: 14px;
    font-weight: bold;
    color: #fff;
}

.production-buffer-name {
    font-size: 12px;
    color: #ccc;
}

.production-buffer-rate {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

.production-buffer-empty {
    color: #666;
    font-size: 12px;
    text-align: center;
    padding: 20px;
}

.production-stats {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    min-width: 150px;
}

.production-recipe-icon {
    width: 64px;
    height: 64px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 165, 0, 0.3);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.production-recipe-icon img {
    width: 80%;
    height: 80%;
    object-fit: contain;
}

.production-status {
    font-size: 14px;
    font-weight: bold;
    color: #ffa500;
    text-transform: uppercase;
}

.production-status.working {
    color: #4ade80;
}

.production-status.blocked {
    color: #f87171;
}

.production-status.standby {
    color: #888;
}

.production-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #aaa;
}

.stat-icon {
    font-size: 14px;
}

.production-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    overflow: hidden;
}

.production-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffa500, #ffcc00);
    border-radius: 4px;
    transition: width 0.1s;
    width: 0%;
}

.production-progress-text {
    font-size: 11px;
    color: #888;
}

.production-controls {
    display: flex;
    justify-content: center;
    padding-top: 10px;
}

.production-standby-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(100, 100, 100, 0.4);
    border: 2px solid rgba(150, 150, 150, 0.4);
    border-radius: 6px;
    color: #ccc;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
}

.production-standby-btn:hover {
    background: rgba(120, 120, 120, 0.5);
    border-color: rgba(180, 180, 180, 0.5);
}

.production-standby-btn.active {
    background: rgba(255, 100, 0, 0.4);
    border-color: rgba(255, 150, 0, 0.6);
    color: #ffa500;
}

.standby-icon {
    font-size: 16px;
}

.production-inventory-side {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.production-inventory-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    max-height: 350px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ============================================
   MINER INTERACT PANEL
   ============================================ */
.miner-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 35, 0.98);
    border: 2px solid rgba(255, 165, 0, 0.4);
    border-radius: 8px;
    z-index: 500;
    min-width: 700px;
    max-height: 90vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.miner-panel.visible {
    display: block;
}

.miner-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(255, 165, 0, 0.15);
    border-bottom: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 6px 6px 0 0;
}

.miner-panel-title {
    font-size: 18px;
    font-weight: bold;
    color: #ffa500;
}

.miner-panel-close {
    background: rgba(255, 100, 100, 0.8);
    border: none;
    color: #fff;
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.miner-panel-close:hover {
    background: rgba(255, 70, 70, 1);
}

.miner-panel-content {
    display: flex;
    padding: 20px;
    gap: 20px;
}

.miner-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 280px;
}

.miner-stats {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.miner-status {
    font-size: 16px;
    font-weight: bold;
    color: #4ade80;
    text-transform: uppercase;
}

.miner-status.idle {
    color: #ffa500;
}

.miner-status.standby {
    color: #888;
}

.miner-stats-row {
    display: flex;
    gap: 20px;
}

.miner-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #ccc;
}

.miner-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    overflow: hidden;
}

.miner-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffa500, #ffcc00);
    border-radius: 4px;
    transition: width 0.1s;
    width: 0%;
}

.miner-output-section {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 15px;
}

.miner-output-title {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 10px;
    text-align: center;
}

.miner-output-slot {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(60, 60, 70, 0.6);
    border: 2px solid rgba(255, 165, 0, 0.5);
    border-radius: 4px;
    padding: 10px;
    user-select: none;
    cursor: pointer;
}

.miner-output-slot:hover {
    background: rgba(80, 80, 90, 0.8);
    border-color: rgba(255, 165, 0, 0.7);
}

.miner-output-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.miner-output-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.miner-output-count {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
}

.miner-output-name {
    font-size: 13px;
    color: #ccc;
}

.miner-output-rate {
    font-size: 12px;
    color: #888;
}

.miner-controls {
    display: flex;
    justify-content: center;
}

.miner-standby-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(100, 100, 100, 0.4);
    border: 2px solid rgba(150, 150, 150, 0.4);
    border-radius: 6px;
    color: #ccc;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
}

.miner-standby-btn:hover {
    background: rgba(120, 120, 120, 0.5);
    border-color: rgba(180, 180, 180, 0.5);
}

.miner-standby-btn.active {
    background: rgba(255, 100, 0, 0.4);
    border-color: rgba(255, 150, 0, 0.6);
    color: #ffa500;
}

.miner-inventory-side {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.miner-inventory-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    max-height: 350px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ============================================
   POWER GENERATOR INTERACT PANEL
   ============================================ */
.power-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 35, 0.98);
    border: 2px solid rgba(255, 165, 0, 0.4);
    border-radius: 8px;
    z-index: 500;
    min-width: 700px;
    max-height: 90vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.power-panel.visible {
    display: block;
}

.power-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(255, 165, 0, 0.15);
    border-bottom: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 6px 6px 0 0;
}

.power-panel-title {
    font-size: 18px;
    font-weight: bold;
    color: #ffa500;
}

.power-panel-close {
    background: rgba(255, 100, 100, 0.8);
    border: none;
    color: #fff;
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.power-panel-close:hover {
    background: rgba(255, 70, 70, 1);
}

.power-panel-content {
    display: flex;
    padding: 20px;
    gap: 20px;
}

.power-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 280px;
}

.power-fuel-section {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 15px;
}

.power-fuel-title {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 10px;
    text-align: center;
}

.power-fuel-slot {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(60, 60, 70, 0.6);
    border: 2px solid rgba(255, 165, 0, 0.5);
    border-radius: 4px;
    padding: 10px;
    user-select: none;
    cursor: pointer;
    margin-bottom: 10px;
}

.power-fuel-slot:hover {
    background: rgba(80, 80, 90, 0.8);
    border-color: rgba(255, 165, 0, 0.7);
}

.power-fuel-slot.empty {
    border-color: rgba(255, 255, 255, 0.2);
    justify-content: center;
    min-height: 68px;
}

.power-fuel-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.power-fuel-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.power-fuel-count {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
}

.power-fuel-name {
    font-size: 13px;
    color: #ccc;
}

.power-fuel-rate {
    font-size: 12px;
    color: #888;
}

.power-fuel-bar {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.power-fuel-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffa500, #ffcc00);
    border-radius: 4px;
    transition: width 0.1s;
    width: 0%;
}

.power-fuel-status {
    font-size: 12px;
    color: #888;
    text-align: center;
}

.power-fuel-status.burning {
    color: #ffa500;
}

.power-stats {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.power-status {
    font-size: 16px;
    font-weight: bold;
    color: #4ade80;
    text-transform: uppercase;
}

.power-status.idle {
    color: #ffa500;
}

.power-status.standby {
    color: #888;
}

.power-status.no-fuel {
    color: #f87171;
}

.power-stats-row {
    display: flex;
    gap: 20px;
}

.power-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #ccc;
}

.power-controls {
    display: flex;
    justify-content: center;
}

.power-standby-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(100, 100, 100, 0.4);
    border: 2px solid rgba(150, 150, 150, 0.4);
    border-radius: 6px;
    color: #ccc;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
}

.power-standby-btn:hover {
    background: rgba(120, 120, 120, 0.5);
    border-color: rgba(180, 180, 180, 0.5);
}

.power-standby-btn.active {
    background: rgba(255, 100, 0, 0.4);
    border-color: rgba(255, 150, 0, 0.6);
    color: #ffa500;
}

.power-inventory-side {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.power-inventory-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    max-height: 350px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ============================================
   POWER NETWORK PANEL
   ============================================ */

.power-network-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 420px;
    background: linear-gradient(145deg, rgba(30, 30, 40, 0.98), rgba(20, 20, 30, 0.98));
    border: 2px solid rgba(255, 215, 0, 0.4);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    z-index: 1500;
    display: none;
}

.power-network-panel.visible {
    display: block;
}

.power-network-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    background: rgba(255, 215, 0, 0.1);
}

.power-network-title {
    font-size: 18px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.power-network-close {
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.power-network-close:hover {
    color: #fff;
}

.power-network-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Network Status */
.power-network-status {
    text-align: center;
}

.network-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 25px;
    border-radius: 20px;
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
}

.network-status-indicator.powered {
    background: rgba(74, 222, 128, 0.2);
    border: 2px solid rgba(74, 222, 128, 0.5);
    color: #4ade80;
}

.network-status-indicator.brownout {
    background: rgba(255, 68, 68, 0.2);
    border: 2px solid rgba(255, 68, 68, 0.5);
    color: #ff4444;
    animation: pulse-red 1s ease-in-out infinite;
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.network-status-indicator .status-icon {
    font-size: 24px;
}

/* Power Stats */
.power-network-stats {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.network-stat {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.network-stat-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.network-stat-value {
    font-size: 20px;
    font-weight: bold;
}

.network-stat-value.production {
    color: #4ade80;
}

.network-stat-value.consumption {
    color: #f87171;
}

.network-stat-value.available {
    color: #ffd700;
}

.network-stat-value.available.negative {
    color: #ff4444;
}

/* Capacity Bar */
.power-capacity-section {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
}

.power-capacity-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
}

.power-capacity-bar {
    position: relative;
    height: 24px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    overflow: hidden;
}

.power-capacity-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #22c55e);
    border-radius: 12px;
    transition: width 0.3s, background 0.3s;
}

.power-capacity-fill.warning {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.power-capacity-fill.critical {
    background: linear-gradient(90deg, #f87171, #ef4444);
}

.power-capacity-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Power History Graph */
.power-history-section {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
}

.power-history-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
}

#power-history-canvas {
    width: 100%;
    height: 120px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

/* Connected Buildings List */
.power-buildings-section {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
}

.power-buildings-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
}

.power-buildings-list {
    max-height: 120px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.power-building-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    font-size: 12px;
}

.power-building-name {
    color: #ccc;
}

.power-building-power {
    font-weight: bold;
}

.power-building-power.producer {
    color: #4ade80;
}

.power-building-power.consumer {
    color: #f87171;
}

.power-building-power.neutral {
    color: #888;
}

/* ============================================
   CRAFT BENCH PANEL
   ============================================ */

.craft-bench-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 35, 0.98);
    border: 2px solid rgba(255, 165, 0, 0.4);
    border-radius: 8px;
    z-index: 500;
    min-width: 950px;
    max-height: 90vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.craft-bench-panel.visible {
    display: block;
}

.craft-bench-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(255, 165, 0, 0.15);
    border-bottom: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 6px 6px 0 0;
}

.craft-bench-title {
    font-size: 18px;
    font-weight: bold;
    color: #ffa500;
}

.craft-bench-close {
    background: rgba(255, 100, 100, 0.8);
    border: none;
    color: #fff;
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.craft-bench-close:hover {
    background: rgba(255, 70, 70, 1);
}

.craft-bench-content {
    display: flex;
    padding: 20px;
    gap: 20px;
    max-height: calc(90vh - 60px);
}

/* Left: Recipe list */
.craft-bench-recipes {
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.craft-bench-search {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #eee;
    font-size: 12px;
}

.craft-bench-search:focus {
    outline: none;
    border-color: rgba(255, 165, 0, 0.5);
}

.craft-bench-search::placeholder {
    color: #666;
}

.craft-bench-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #888;
    cursor: pointer;
    padding: 4px 0;
}

.craft-bench-filter input {
    cursor: pointer;
}

.craft-bench-recipe-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 450px;
}

.craft-bench-recipe-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.craft-bench-recipe-item:hover {
    background: rgba(255, 165, 0, 0.1);
    border-color: rgba(255, 165, 0, 0.3);
}

.craft-bench-recipe-item.selected {
    background: rgba(255, 165, 0, 0.2);
    border-color: rgba(255, 165, 0, 0.5);
}

.craft-bench-recipe-item.cannot-afford {
    opacity: 0.5;
}

.craft-bench-recipe-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: contain;
    flex-shrink: 0;
}

.craft-bench-recipe-info {
    flex: 1;
    min-width: 0;
}

.craft-bench-recipe-item-name {
    font-size: 12px;
    color: #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.craft-bench-recipe-count {
    font-size: 10px;
    color: #888;
}

/* Center: Craft area */
.craft-bench-craft-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 300px;
}

.craft-bench-recipe-name {
    font-size: 18px;
    font-weight: bold;
    color: #ffa500;
    text-align: center;
}

.craft-bench-recipe-display {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: rgba(40, 40, 50, 0.6);
    border: 2px solid rgba(255, 165, 0, 0.3);
    border-radius: 8px;
    min-height: 120px;
    min-width: 280px;
    justify-content: center;
}

.craft-bench-no-recipe {
    color: #666;
    font-size: 14px;
}

.craft-bench-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.craft-bench-input-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.craft-bench-input-item.missing {
    border: 1px solid rgba(255, 100, 100, 0.5);
}

.craft-bench-input-item.has-enough {
    border: 1px solid rgba(100, 255, 100, 0.3);
}

.craft-bench-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: contain;
}

.craft-bench-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.craft-bench-item-count {
    font-size: 14px;
    font-weight: bold;
    color: #fff;
}

.craft-bench-item-count.missing {
    color: #f87171;
}

.craft-bench-item-name {
    font-size: 11px;
    color: #aaa;
}

.craft-bench-arrow {
    font-size: 28px;
    color: #ffa500;
    padding: 0 10px;
}

.craft-bench-output {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: rgba(255, 165, 0, 0.15);
    border: 2px solid rgba(255, 165, 0, 0.4);
    border-radius: 6px;
}

.craft-bench-output-info {
    font-size: 16px;
    font-weight: bold;
    color: #ccc;
    text-align: center;
}

.craft-bench-progress-section {
    width: 100%;
    max-width: 280px;
}

.craft-bench-progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    overflow: hidden;
}

.craft-bench-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffa500, #ffcc00);
    border-radius: 6px;
    width: 0%;
    transition: width 0.05s linear;
}

.craft-bench-craft-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 40px;
    background: linear-gradient(180deg, rgba(255, 165, 0, 0.7), rgba(200, 130, 0, 0.7));
    border: 2px solid rgba(255, 180, 0, 0.6);
    border-radius: 6px;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.craft-bench-craft-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, rgba(255, 180, 0, 0.8), rgba(220, 150, 0, 0.8));
    transform: translateY(-1px);
}

.craft-bench-craft-btn:disabled {
    background: rgba(80, 80, 80, 0.5);
    border-color: rgba(100, 100, 100, 0.4);
    color: #666;
    cursor: not-allowed;
}

.craft-bench-craft-btn.crafting {
    background: linear-gradient(180deg, rgba(100, 200, 100, 0.7), rgba(80, 160, 80, 0.7));
    border-color: rgba(100, 200, 100, 0.6);
}

.craft-btn-icon {
    font-size: 20px;
}

/* Right: Player inventory */
.craft-bench-inventory {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.craft-bench-inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.craft-bench-inventory-header span {
    font-size: 14px;
    color: #ffa500;
    font-weight: bold;
}

.craft-bench-inventory-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    max-height: 450px;
    overflow-y: auto;
}

/* ============================================
   EQUIPMENT WORKSHOP PANEL
   ============================================ */

.equipment-workshop-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 35, 0.98);
    border: 2px solid rgba(255, 165, 0, 0.4);
    border-radius: 8px;
    z-index: 500;
    min-width: 950px;
    max-height: 90vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.equipment-workshop-panel.visible {
    display: block;
}

.equipment-workshop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(255, 165, 0, 0.15);
    border-bottom: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 6px 6px 0 0;
}

.equipment-workshop-title {
    font-size: 18px;
    font-weight: bold;
    color: #ffa500;
}

.equipment-workshop-close {
    background: rgba(255, 100, 100, 0.8);
    border: none;
    color: #fff;
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.equipment-workshop-close:hover {
    background: rgba(255, 70, 70, 1);
}

.equipment-workshop-content {
    display: flex;
    padding: 20px;
    gap: 20px;
    max-height: calc(90vh - 60px);
}

/* Left: Recipe list with categories */
.equipment-recipes {
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.equipment-search {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #eee;
    font-size: 12px;
}

.equipment-search:focus {
    outline: none;
    border-color: rgba(255, 165, 0, 0.5);
}

.equipment-search::placeholder {
    color: #666;
}

.equipment-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #888;
    cursor: pointer;
    padding: 4px 0;
}

.equipment-filter input {
    cursor: pointer;
}

.equipment-categories {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 4px;
}

.equipment-category {
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #aaa;
    transition: all 0.15s;
}

.equipment-category:hover {
    background: rgba(255, 165, 0, 0.1);
    color: #fff;
}

.equipment-category.selected {
    background: rgba(255, 165, 0, 0.2);
    border-color: rgba(255, 165, 0, 0.5);
    color: #ffa500;
}

.equipment-recipe-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 350px;
}

.equipment-recipe-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.equipment-recipe-item:hover {
    background: rgba(255, 165, 0, 0.1);
    border-color: rgba(255, 165, 0, 0.3);
}

.equipment-recipe-item.selected {
    background: rgba(255, 165, 0, 0.2);
    border-color: rgba(255, 165, 0, 0.5);
}

.equipment-recipe-item.cannot-afford {
    opacity: 0.5;
}

.equipment-recipe-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: contain;
    flex-shrink: 0;
}

.equipment-recipe-info {
    flex: 1;
    min-width: 0;
}

.equipment-recipe-item-name {
    font-size: 12px;
    color: #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.equipment-recipe-count {
    font-size: 10px;
    color: #888;
}

/* Center: Craft area */
.equipment-craft-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 300px;
}

.equipment-recipe-name {
    font-size: 18px;
    font-weight: bold;
    color: #ffa500;
    text-align: center;
}

.equipment-recipe-display {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: rgba(40, 40, 50, 0.6);
    border: 2px solid rgba(255, 165, 0, 0.3);
    border-radius: 8px;
    min-height: 120px;
    min-width: 280px;
    justify-content: center;
}

.equipment-no-recipe {
    color: #666;
    font-size: 14px;
}

.equipment-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.equipment-input-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.equipment-input-item.missing {
    border: 1px solid rgba(255, 100, 100, 0.5);
}

.equipment-input-item.has-enough {
    border: 1px solid rgba(100, 255, 100, 0.3);
}

.equipment-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: contain;
}

.equipment-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.equipment-item-count {
    font-size: 14px;
    font-weight: bold;
    color: #fff;
}

.equipment-item-count.missing {
    color: #f87171;
}

.equipment-item-name {
    font-size: 11px;
    color: #aaa;
}

.equipment-arrow {
    font-size: 28px;
    color: #ffa500;
    padding: 0 10px;
}

.equipment-output {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: rgba(255, 165, 0, 0.15);
    border: 2px solid rgba(255, 165, 0, 0.4);
    border-radius: 6px;
}

.equipment-output-info {
    font-size: 16px;
    font-weight: bold;
    color: #ccc;
    text-align: center;
}

.equipment-progress-section {
    width: 100%;
    max-width: 280px;
}

.equipment-progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    overflow: hidden;
}

.equipment-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffa500, #ffcc00);
    border-radius: 6px;
    width: 0%;
    transition: width 0.05s linear;
}

.equipment-craft-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 40px;
    background: linear-gradient(180deg, rgba(255, 165, 0, 0.7), rgba(200, 130, 0, 0.7));
    border: 2px solid rgba(255, 180, 0, 0.6);
    border-radius: 6px;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.equipment-craft-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, rgba(255, 180, 0, 0.8), rgba(220, 150, 0, 0.8));
    transform: translateY(-1px);
}

.equipment-craft-btn:disabled {
    background: rgba(80, 80, 80, 0.5);
    border-color: rgba(100, 100, 100, 0.4);
    color: #666;
    cursor: not-allowed;
}

.equipment-craft-btn.crafting {
    background: linear-gradient(180deg, rgba(100, 200, 100, 0.7), rgba(80, 160, 80, 0.7));
    border-color: rgba(100, 200, 100, 0.6);
}

/* Right: Player inventory */
.equipment-inventory {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.equipment-inventory-header span {
    font-size: 14px;
    color: #ffa500;
    font-weight: bold;
}

.equipment-inventory-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    max-height: 450px;
    overflow-y: auto;
}

/* ============================================
   WATER EXTRACTOR INTERACT PANEL
   ============================================ */
.water-extractor-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 35, 0.98);
    border: 2px solid rgba(65, 105, 225, 0.4);
    border-radius: 8px;
    z-index: 500;
    min-width: 350px;
    max-height: 90vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.water-extractor-panel.visible {
    display: block;
}

.water-extractor-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(65, 105, 225, 0.15);
    border-bottom: 1px solid rgba(65, 105, 225, 0.3);
    border-radius: 6px 6px 0 0;
}

.water-extractor-panel-title {
    font-size: 18px;
    font-weight: bold;
    color: #4169e1;
}

.water-extractor-panel-close {
    background: rgba(255, 100, 100, 0.8);
    border: none;
    color: #fff;
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.water-extractor-panel-close:hover {
    background: rgba(255, 70, 70, 1);
}

.water-extractor-panel-content {
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
}

.water-extractor-stats {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.water-extractor-status {
    font-size: 16px;
    font-weight: bold;
    color: #4ade80;
    text-transform: uppercase;
}

.water-extractor-status.idle {
    color: #ffa500;
}

.water-extractor-status.standby {
    color: #888;
}

.water-extractor-stats-row {
    display: flex;
    gap: 20px;
}

.water-extractor-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #ccc;
}

/* Buffer Section */
.water-extractor-buffer-section {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 15px;
}

.water-extractor-buffer {
    display: flex;
    align-items: center;
    gap: 16px;
}

.water-extractor-buffer-gauge {
    position: relative;
    width: 70px;
    height: 70px;
}

.water-extractor-buffer-svg {
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
}

.water-extractor-buffer-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: bold;
    color: #4169e1;
}

.water-extractor-buffer-info {
    flex: 1;
}

.water-extractor-buffer-label {
    font-size: 14px;
    font-weight: bold;
    color: #4169e1;
}

.water-extractor-buffer-amount {
    font-size: 12px;
    color: #aaa;
    margin-top: 4px;
}

.water-extractor-output-section {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 15px;
}

.water-extractor-output-title {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 10px;
    text-align: center;
}

.water-extractor-output-slot {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(60, 60, 70, 0.6);
    border: 2px solid rgba(65, 105, 225, 0.5);
    border-radius: 4px;
    padding: 10px;
}

.water-extractor-output-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
    background: #4169e1;
}

.water-extractor-output-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.water-extractor-output-name {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
}

.water-extractor-output-rate {
    font-size: 12px;
    color: #888;
}

.water-extractor-controls {
    display: flex;
    justify-content: center;
}

.water-extractor-standby-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(100, 100, 100, 0.4);
    border: 2px solid rgba(150, 150, 150, 0.4);
    border-radius: 6px;
    color: #ccc;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
}

.water-extractor-standby-btn:hover {
    background: rgba(120, 120, 120, 0.5);
    border-color: rgba(180, 180, 180, 0.5);
}

.water-extractor-standby-btn.active {
    background: rgba(65, 105, 225, 0.4);
    border-color: rgba(100, 149, 237, 0.6);
    color: #6495ed;
}

/* ============================================
   COAL GENERATOR PANEL
   ============================================ */

.coal-generator-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    min-width: 700px;
    background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 2px solid #444;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.coal-generator-panel.visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.coal-generator-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
    border-bottom: 1px solid #444;
    border-radius: 6px 6px 0 0;
}

.coal-generator-panel-title {
    font-size: 16px;
    font-weight: bold;
    color: #f5a623;
}

.coal-generator-panel-close {
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}

.coal-generator-panel-close:hover {
    color: #fff;
}

.coal-generator-panel-content {
    padding: 16px;
    display: flex;
    flex-direction: row;
    gap: 20px;
}

.coal-gen-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 280px;
}

.coal-gen-inventory-side {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.coal-gen-inventory-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    max-height: 350px;
    overflow-y: auto;
    padding: 5px;
}

/* Sections */
.coal-gen-section {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #333;
    border-radius: 6px;
    padding: 12px;
}

.coal-gen-section-title {
    font-size: 11px;
    font-weight: bold;
    color: #888;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

/* Fuel Input */
.coal-gen-fuel-input {
    display: flex;
    align-items: center;
    gap: 12px;
}

.coal-gen-fuel-slot {
    position: relative;
    width: 56px;
    height: 56px;
    background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
    border: 2px solid #555;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coal-gen-fuel-icon {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: contain;
}

.coal-gen-fuel-count {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px #000;
}

.coal-gen-fuel-info {
    flex: 1;
}

.coal-gen-fuel-name {
    font-size: 14px;
    font-weight: bold;
    color: #ddd;
}

.coal-gen-fuel-rate {
    font-size: 12px;
    color: #f5a623;
    margin-top: 2px;
}

/* Burning Fuel */
.coal-gen-burning-header {
    font-size: 11px;
    font-weight: bold;
    color: #888;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.coal-gen-burning-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.coal-gen-burning-content.coal-gen-burning-empty {
    opacity: 0.5;
}

.coal-gen-burning-icon {
    width: 48px;
    height: 48px;
    background: #333;
    border: 2px solid #444;
    border-radius: 6px;
    object-fit: contain;
}

.coal-gen-burning-icon.empty {
    background: #222;
}

.coal-gen-burning-info {
    flex: 1;
}

.coal-gen-burning-bar-container {
    height: 12px;
    background: #222;
    border: 1px solid #444;
    border-radius: 4px;
    overflow: hidden;
}

.coal-gen-burning-bar {
    height: 100%;
    background: linear-gradient(90deg, #f5a623 0%, #ff8c00 100%);
    transition: width 0.1s linear;
}

.coal-gen-burning-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
    color: #888;
}

.coal-gen-burning-stats span:first-child {
    color: #f5a623;
    font-weight: bold;
}

/* Water Gauge */
.coal-gen-water {
    display: flex;
    align-items: center;
    gap: 16px;
}

.coal-gen-water-gauge {
    position: relative;
    width: 80px;
    height: 80px;
}

.coal-gen-water-svg {
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
}

.coal-gen-water-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    font-weight: bold;
    color: #4169e1;
}

.coal-gen-water-info {
    flex: 1;
}

.coal-gen-water-label {
    font-size: 14px;
    font-weight: bold;
    color: #4169e1;
}

.coal-gen-water-amount {
    font-size: 12px;
    color: #aaa;
    margin-top: 4px;
}

.coal-gen-water-rate {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #888;
    margin-top: 6px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    width: fit-content;
}

.coal-gen-water-rate-icon {
    color: #4169e1;
    font-size: 10px;
}

/* Controls */
.coal-gen-controls {
    display: flex;
    justify-content: center;
}

.coal-gen-standby-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(100, 100, 100, 0.4);
    border: 2px solid rgba(150, 150, 150, 0.4);
    border-radius: 6px;
    color: #ccc;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
}

.coal-gen-standby-btn:hover {
    background: rgba(120, 120, 120, 0.5);
    border-color: rgba(180, 180, 180, 0.5);
}

.coal-gen-standby-btn.active {
    background: rgba(245, 166, 35, 0.4);
    border-color: rgba(255, 140, 0, 0.6);
    color: #f5a623;
}

/* ============================================
   PORTABLE MINER PANEL
   ============================================ */

.portable-miner-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, #2a2a40, #1e1e30);
    border: 2px solid #ffa500;
    border-radius: 12px;
    z-index: 1001;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    min-width: 700px;
    max-width: 850px;
}

.portable-miner-panel.visible {
    display: block;
}

.pminer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(90deg, rgba(255, 140, 0, 0.3), transparent);
    border-bottom: 1px solid rgba(255, 140, 0, 0.3);
    border-radius: 10px 10px 0 0;
}

.pminer-title {
    color: #ffa500;
    font-size: 18px;
    font-weight: bold;
}

.pminer-close {
    background: rgba(255, 0, 0, 0.3);
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.pminer-close:hover {
    background: rgba(255, 0, 0, 0.6);
}

.pminer-content {
    display: flex;
    padding: 20px;
    gap: 20px;
}

.pminer-left {
    flex: 0 0 200px;
}

.pminer-status-card {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 15px;
    color: #333;
}

.pminer-resource-name {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.pminer-rate {
    font-size: 14px;
    color: #666;
}

.pminer-rate .rate-value {
    color: #ff8c00;
    font-weight: bold;
}

.pminer-divider {
    border: none;
    border-top: 1px solid #ddd;
    margin: 12px 0;
}

.pminer-output-label {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.pminer-output-slot {
    width: 80px;
    height: 80px;
    background: #e0e0e0;
    border: 2px solid #ccc;
    border-radius: 6px;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.pminer-output-slot.has-items {
    border-color: #ffa500;
}

.pminer-output-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.pminer-output-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 4px;
}

.pminer-output-count {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: #ffa500;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
}

.pminer-progress-container {
    margin-bottom: 10px;
}

.pminer-progress-bar {
    height: 20px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}

.pminer-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffa500, #ff6600);
    transition: width 0.2s;
}

.pminer-progress-text {
    font-size: 13px;
    color: #666;
    text-align: center;
}

.pminer-progress-text .status-value {
    color: #ff8c00;
    font-weight: bold;
}

.pminer-progress-text .status-full {
    color: #e74c3c;
    font-weight: bold;
}

.pminer-progress-text .status-idle {
    color: #999;
}

.pminer-center {
    display: flex;
    flex-direction: column;
    gap: 15px;
    justify-content: center;
}

.pminer-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 90px;
    background: linear-gradient(180deg, #ffc107, #ff9800);
    border: 2px solid #ff8c00;
    border-radius: 8px;
    color: #333;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.pminer-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #ffd54f, #ffb300);
    transform: translateY(-2px);
}

.pminer-btn:disabled {
    background: #666;
    border-color: #555;
    color: #999;
    cursor: not-allowed;
}

.pminer-btn-icon {
    font-size: 28px;
    margin-bottom: 4px;
}

.pminer-inventory-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pminer-inventory-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    max-height: 350px;
    overflow-y: auto;
}

/* ============================================
   MAM PANEL
   ============================================ */

.mam-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 35, 0.98);
    border: 2px solid rgba(153, 50, 204, 0.5);
    border-radius: 8px;
    z-index: 500;
    width: 1100px;
    max-width: 95vw;
    max-height: 85vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.mam-panel.visible {
    display: block;
}

.mam-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(153, 50, 204, 0.2);
    border-bottom: 1px solid rgba(153, 50, 204, 0.4);
    border-radius: 6px 6px 0 0;
}

.mam-panel-title {
    font-size: 18px;
    font-weight: bold;
    color: #da70d6;
}

.mam-panel-close {
    background: rgba(255, 100, 100, 0.8);
    border: none;
    color: #fff;
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.mam-panel-close:hover {
    background: rgba(255, 70, 70, 1);
}

.mam-panel-content {
    display: flex;
    padding: 15px;
    gap: 15px;
    height: calc(85vh - 60px);
    max-height: 600px;
}

/* Categories sidebar */
.mam-categories {
    width: 180px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 6px;
    overflow-y: auto;
}

.mam-category {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(60, 60, 70, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mam-category:hover {
    background: rgba(153, 50, 204, 0.2);
    border-color: rgba(153, 50, 204, 0.4);
}

.mam-category.selected {
    background: rgba(153, 50, 204, 0.3);
    border-color: #9932cc;
}

.mam-category.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.mam-cat-name {
    font-size: 13px;
    color: #ddd;
}

.mam-cat-progress {
    font-size: 11px;
    color: #888;
}

/* Research tree container */
.mam-tree-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    overflow: hidden;
}

.mam-tree-header {
    padding: 10px 15px;
    background: rgba(153, 50, 204, 0.15);
    border-bottom: 1px solid rgba(153, 50, 204, 0.3);
    font-size: 14px;
    font-weight: bold;
    color: #da70d6;
}

.mam-tree {
    flex: 1;
    overflow: auto;
    padding: 20px;
    position: relative;
}

.mam-tree-empty {
    color: #666;
    text-align: center;
    padding: 40px;
}

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

/* Tiered layout for DAG display */
.mam-tree-list.tiered {
    gap: 4px;
}

.mam-tree-tier {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    background: rgba(40, 40, 50, 0.5);
    border-radius: 6px;
    border-left: 3px solid #9932cc;
}

.mam-tree-tier .mam-tree-node {
    flex: 1 1 calc(50% - 4px);
    min-width: 180px;
    max-width: 100%;
}

.mam-tier-connector {
    text-align: center;
    color: #666;
    font-size: 14px;
    padding: 2px 0;
}

/* Research nodes - list style */
.mam-tree-node {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(60, 60, 70, 0.8);
    border: 2px solid #555;
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mam-tree-node:hover {
    background: rgba(80, 80, 90, 0.9);
    border-color: #9932cc;
}

.mam-tree-node.selected {
    border-color: #da70d6;
    box-shadow: 0 0 10px rgba(218, 112, 214, 0.5);
}

.mam-tree-node.completed {
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.15);
}

.mam-tree-node.active {
    border-color: #ffa500;
    background: rgba(255, 165, 0, 0.15);
}

.mam-tree-node.locked {
    opacity: 0.5;
}

.mam-node-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mam-node-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.mam-node-icon span {
    font-size: 20px;
    color: #888;
}

.mam-node-info {
    flex: 1;
    min-width: 0;
}

.mam-node-name {
    font-size: 13px;
    color: #eee;
    font-weight: 500;
}

.mam-node-prereq {
    font-size: 10px;
    color: #888;
    margin-top: 2px;
}

.mam-node-prereq .done {
    color: #4ade80;
}

.mam-node-prereq .pending {
    color: #f87171;
}

.mam-node-status-icon {
    font-size: 14px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
}

.mam-node-status-icon.completed {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
}

.mam-node-status-icon.active {
    background: rgba(255, 165, 0, 0.2);
    color: #ffa500;
    font-size: 12px;
}

/* Right side: details + inventory */
.mam-right-side {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mam-details {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 15px;
    overflow-y: auto;
}

.mam-no-selection {
    color: #666;
    text-align: center;
    padding: 30px;
}

.mam-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mam-detail-header h3 {
    font-size: 16px;
    color: #da70d6;
}

.mam-detail-status {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 10px;
}

.mam-detail-status.completed {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
}

.mam-detail-status.active {
    background: rgba(255, 165, 0, 0.2);
    color: #ffa500;
}

.mam-detail-status.locked {
    background: rgba(100, 100, 100, 0.2);
    color: #888;
}

.mam-detail-section {
    margin-bottom: 12px;
}

.mam-detail-section h4 {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.mam-cost-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mam-cost-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(60, 60, 70, 0.5);
    border-radius: 4px;
    font-size: 12px;
}

.mam-cost-item.have {
    border-left: 3px solid #4ade80;
}

.mam-cost-item.need {
    border-left: 3px solid #ef4444;
}

.mam-cost-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.mam-cost-name {
    flex: 1;
    color: #ccc;
}

.mam-cost-amount {
    color: #888;
    font-size: 11px;
}

.mam-unlock-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mam-unlock-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(153, 50, 204, 0.15);
    border-radius: 4px;
    font-size: 11px;
    color: #ccc;
}

.mam-unlock-item.reward {
    background: rgba(74, 222, 128, 0.15);
}

.mam-unlock-icon {
    font-size: 14px;
}

.mam-progress-bar {
    height: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.mam-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #9932cc, #da70d6);
    transition: width 0.2s ease;
}

.mam-progress-text {
    font-size: 11px;
    color: #888;
    text-align: center;
}

.mam-research-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #9932cc, #7b1fa2);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-top: 10px;
}

.mam-research-btn:hover:not(.disabled) {
    background: linear-gradient(135deg, #b041eb, #9c27b0);
    transform: translateY(-1px);
}

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

.mam-cancel-btn {
    width: 100%;
    padding: 10px;
    background: rgba(239, 68, 68, 0.3);
    border: 1px solid #ef4444;
    border-radius: 6px;
    color: #ef4444;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-top: 10px;
}

.mam-cancel-btn:hover {
    background: rgba(239, 68, 68, 0.5);
}

/* Inventory section */
.mam-inventory-section {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 10px;
}

.mam-inventory-header {
    font-size: 12px;
    font-weight: bold;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.mam-inventory-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    max-height: 180px;
    overflow-y: auto;
}

/* ============================================
   BUILDING HOTBAR
   ============================================ */
.hotbar-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 90;
}

.hotbar-row-selector {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px;
    background: rgba(30, 30, 50, 0.95);
    border: 1px solid #444;
    border-radius: 6px;
}

.hotbar-row-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    color: #666;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #333;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.1s ease;
}

.hotbar-row-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #555;
    color: #999;
}

.hotbar-row-btn.active {
    background: rgba(255, 165, 0, 0.25);
    border-color: #ffa500;
    color: #ffa500;
}

.hotbar {
    display: flex;
    gap: 3px;
    padding: 6px;
    background: rgba(30, 30, 50, 0.95);
    border: 1px solid #444;
    border-radius: 6px;
}

.hotbar-slot {
    position: relative;
    width: 52px;
    height: 52px;
    background: rgba(60, 60, 80, 0.8);
    border: 2px solid #555;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s ease;
    cursor: pointer;
}

.hotbar-slot:hover {
    border-color: #888;
    background: rgba(80, 80, 100, 0.9);
}

.hotbar-slot.assigned {
    background: rgba(80, 70, 50, 0.9);
    border-color: rgba(255, 165, 0, 0.6);
}

.hotbar-slot.assigned:hover {
    border-color: #ffa500;
    background: rgba(100, 85, 50, 0.95);
}

.hotbar-key {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 11px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8);
}

.hotbar-slot.assigned .hotbar-key {
    color: rgba(255, 200, 100, 0.9);
}

.hotbar-icon-container {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hotbar-icon {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.5));
}

.hotbar-icon-color {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

/* ============================================
   OVERCLOCK PANEL
   ============================================ */
.overclock-section {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 6px;
    padding: 12px;
    margin-top: 12px;
}

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

.overclock-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
}

.overclock-value {
    font-size: 18px;
    font-weight: bold;
    color: #ffa500;
}

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

.overclock-slider {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
}

.overclock-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffa500;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.overclock-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffa500;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.overclock-max {
    font-size: 11px;
    color: #666;
    min-width: 40px;
    text-align: right;
}

.overclock-shards {
    display: flex;
    align-items: center;
    gap: 10px;
}

.overclock-shards-label {
    font-size: 11px;
    color: #888;
}

.overclock-shard-slots {
    display: flex;
    gap: 4px;
}

.overclock-shard-slot {
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #444;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.overclock-shard-slot:hover {
    border-color: #666;
    background: rgba(255, 255, 255, 0.05);
}

.overclock-shard-slot.filled {
    border-color: #a855f7;
    background: rgba(168, 85, 247, 0.2);
}

.overclock-shard-slot img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}
