@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

body {
    font-family: 'Press Start 2P', monospace;
    background: #2d1b00;
    color: #fff;
    min-height: 100vh;
    padding: 20px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.container {
    margin: 0 auto;
    width: 100%;
}

header {
    margin-bottom: 30px;
    padding: 20px;
    background: #3d2b00;
    border: 4px solid #8b4513;
    box-shadow: 0 8px 0 #1a0f00;
    position: relative;
}

.header-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
}

.header-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    justify-self: start;
}

.header-spacer {
    /* Empty spacer for grid balance */
}

h1 {
    font-size: 24px;
    color: #ff6b6b;
    text-shadow: 3px 3px 0 #000;
    margin: 0 0 15px 0;
    text-align: center;
}

/* Menu Toggle Button */
.menu-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    font-family: 'Press Start 2P', monospace;
    font-size: 24px;
    padding: 10px 15px;
    background: #3d2b00;
    color: #fff;
    border: 3px solid #8b4513;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 0 #1a0f00;
    text-shadow: 2px 2px 0 #000;
    line-height: 1;
}

.menu-toggle:hover {
    background: #4d3b10;
    transform: translateY(2px);
    box-shadow: 0 2px 0 #1a0f00;
}

.menu-toggle:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #1a0f00;
}

.mushroom-display {
    font-size: 32px;
    color: #ffd700;
    text-shadow: 3px 3px 0 #000;
    margin: 0;
}

.backpack-display {
    font-size: 12px;
    color: #ffa500;
    margin: 5px 0 0 0;
    opacity: 0.9;
}

.per-second {
    font-size: 14px;
    color: #90ee90;
    margin: 0;
}

.mushroom-button {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    padding: 15px 30px;
    background: #8b0000;
    color: #fff;
    border: 4px solid #ff0000;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 0 6px 0 #450000;
    text-shadow: 2px 2px 0 #000;
}

.mushroom-button:hover {
    background: #a00000;
    transform: translateY(2px);
    box-shadow: 0 4px 0 #450000;
}

.mushroom-button:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 #450000;
}

.farms-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 30px;
}

.farm-item {
    background: #3d2b00;
    border: 4px solid #8b4513;
    padding: 15px;
    box-shadow: 0 4px 0 #1a0f00;
    max-width: 500px;
    width: 100%;
}

.farm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #8b4513;
}

.farm-name {
    font-size: 16px;
    color: #ff6b6b;
}

.farm-count {
    font-size: 14px;
    color: #ffd700;
}

.farm-stats {
    font-size: 10px;
    color: #90ee90;
    margin: 10px 0;
    line-height: 1.6;
}

.farm-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.buy-button, .upgrade-button {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    padding: 12px;
    flex: 1;
    background: #2d6a2d;
    color: #fff;
    border: 3px solid #4a9d4a;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 0 4px 0 #1a3d1a;
    text-shadow: 1px 1px 0 #000;
}

.upgrade-button {
    background: #6a2d6a;
    border-color: #9d4a9d;
    box-shadow: 0 4px 0 #3d1a3d;
}

.buy-button:hover:not(:disabled) {
    background: #3d7a3d;
    transform: translateY(2px);
    box-shadow: 0 2px 0 #1a3d1a;
}

.upgrade-button:hover:not(:disabled) {
    background: #7a3d7a;
    transform: translateY(2px);
    box-shadow: 0 2px 0 #3d1a3d;
}

.buy-button:active:not(:disabled),
.upgrade-button:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 0 0 0 #000;
}

.buy-button:disabled,
.upgrade-button:disabled {
    background: #444;
    border-color: #666;
    cursor: not-allowed;
    opacity: 0.5;
}

.buy-button.processing,
.upgrade-button.processing {
    background: #6a6a2d;
    border-color: #9d9d4a;
    cursor: wait;
    animation: processing-pulse 1s ease-in-out infinite;
}

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

.cost {
    color: #ffd700;
}

.max-level {
    color: #ff6b6b;
    font-size: 10px;
    text-align: center;
    padding: 10px;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    font-size: 10px;
    color: #999;
}

.footer-text {
    font-size: 10px;
    color: #999;
}

/* Cloud Save Section */
.cloud-save-section {
    background: #2d1b00;
    border: 3px solid #8b4513;
    padding: 20px;
    margin-bottom: 20px;
}

.cloud-save-section h3 {
    font-size: 14px;
    color: #87ceeb;
    text-shadow: 2px 2px 0 #000;
    margin-bottom: 15px;
    text-align: center;
}

.cloud-save-info,
.cloud-load-section {
    margin-bottom: 20px;
}

.cloud-save-info p,
.cloud-load-section p {
    font-size: 10px;
    color: #ddd;
    margin-bottom: 8px;
}

.uuid-display,
.uuid-input-display {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

#uuidValue,
#loadUuidInput {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    padding: 10px;
    background: #1a0f00;
    color: #ffd700;
    border: 2px solid #8b4513;
    flex: 1;
}

#uuidValue {
    cursor: text;
}

#loadUuidInput {
    cursor: text;
}

#loadUuidInput::placeholder {
    color: #666;
}

.copy-button,
.cloud-save-button,
.cloud-load-button {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    padding: 10px 20px;
    background: #2d6a2d;
    color: #fff;
    border: 3px solid #4a9d4a;
    cursor: pointer;
    text-shadow: 1px 1px 0 #000;
    transition: all 0.1s;
}

.copy-button:hover,
.cloud-save-button:hover,
.cloud-load-button:hover {
    background: #3d7a3d;
}

.cloud-save-button {
    width: 100%;
    margin-top: 5px;
}

.cloud-load-button {
    background: #6a2d6a;
    border-color: #9d4a9d;
}

.cloud-load-button:hover {
    background: #7a3d7a;
}

.session-warning-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #8b0000;
    border-bottom: 3px solid #ff0000;
    padding: 12px 20px;
    font-size: 11px;
    color: #fff;
    text-align: center;
    animation: blink 1s infinite;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    z-index: 1500;
    font-family: 'Press Start 2P', monospace;
    text-shadow: 2px 2px 0 #000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.session-warning-banner:hover {
    background: #a00000;
    border-color: #ff3333;
}

.session-warning-banner:active {
    transform: translateY(1px);
}

/* Add padding to body when session warning is visible */
body.has-session-warning {
    padding-top: 50px;
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0.5;
    }
}

.local-save-section {
    border-top: 2px solid #8b4513;
    padding-top: 15px;
}

/* Menu Overlay */
.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    animation: fadeIn 0.3s ease-in-out;
}

.menu-overlay.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.menu-content {
    background: #2d1b00;
    border: 4px solid #8b4513;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 0 #1a0f00;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 3px solid #8b4513;
}

.menu-spacer {
    width: 58px; /* Same width as close button */
}

.menu-header h2 {
    font-size: 20px;
    color: #ff6b6b;
    text-shadow: 2px 2px 0 #000;
    margin: 0;
    flex: 1;
    text-align: center;
}

.menu-close {
    font-family: 'Press Start 2P', monospace;
    font-size: 20px;
    padding: 10px 15px;
    background: #8b0000;
    color: #fff;
    border: 3px solid #ff0000;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 0 4px 0 #450000;
    line-height: 1;
}

.menu-close:hover {
    background: #a00000;
    transform: translateY(2px);
    box-shadow: 0 2px 0 #450000;
}

.menu-close:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #450000;
}

.menu-section {
    background: #3d2b00;
    border: 3px solid #8b4513;
    padding: 20px;
    margin-bottom: 20px;
}

.menu-section:last-child {
    margin-bottom: 0;
}

.menu-section h3 {
    font-size: 14px;
    color: #87ceeb;
    text-shadow: 2px 2px 0 #000;
    margin-bottom: 15px;
    text-align: center;
}

.cloud-autosave-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    margin-bottom: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #4a9d4a;
    font-size: 8px;
    color: #90ee90;
}

.cloud-autosave-status.inactive {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4a9d4a;
    animation: pulse 2s infinite;
}

.status-indicator.inactive {
    background: #ff6b6b;
    animation: none;
}

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

.warning-text {
    font-size: 10px;
    color: #ff6b6b;
    text-align: center;
    margin-bottom: 15px;
    line-height: 1.5;
}

.reset-button {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    padding: 15px 30px;
    width: 100%;
    background: #8b0000;
    color: #fff;
    border: 3px solid #ff0000;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 0 4px 0 #450000;
    text-shadow: 1px 1px 0 #000;
}

.reset-button:hover {
    background: #a00000;
    transform: translateY(2px);
    box-shadow: 0 2px 0 #450000;
}

.reset-button:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #450000;
}

/* Welcome Modal */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.5s ease-in-out;
}

.welcome-content {
    background: #2d1b00;
    border: 4px solid #8b4513;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 8px 0 #1a0f00;
    animation: slideIn 0.5s ease-out;
}

.welcome-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #8b4513;
}

.welcome-header h2 {
    font-size: 20px;
    color: #ff6b6b;
    text-shadow: 3px 3px 0 #000;
    margin: 0;
}

.welcome-body {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.welcome-text {
    font-size: 12px;
    color: #ffd700;
    text-align: center;
    text-shadow: 2px 2px 0 #000;
}

.welcome-option {
    background: #3d2b00;
    border: 3px solid #8b4513;
    padding: 20px;
}

.welcome-option h3 {
    font-size: 14px;
    color: #87ceeb;
    text-shadow: 2px 2px 0 #000;
    margin-bottom: 10px;
}

.welcome-option p {
    font-size: 10px;
    color: #ddd;
    margin-bottom: 15px;
}

.welcome-divider {
    text-align: center;
    font-size: 12px;
    color: #999;
    padding: 10px 0;
}

.welcome-load-input {
    display: flex;
    gap: 10px;
}

#welcomeLoadInput {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    padding: 10px;
    background: #1a0f00;
    color: #ffd700;
    border: 2px solid #8b4513;
    flex: 1;
}

#welcomeLoadInput::placeholder {
    color: #666;
}

.welcome-button {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    padding: 15px 20px;
    color: #fff;
    border: 3px solid;
    cursor: pointer;
    transition: all 0.1s;
    text-shadow: 1px 1px 0 #000;
    width: 100%;
}

.new-game-button {
    background: #2d6a2d;
    border-color: #4a9d4a;
    box-shadow: 0 4px 0 #1a3d1a;
}

.new-game-button:hover {
    background: #3d7a3d;
    transform: translateY(2px);
    box-shadow: 0 2px 0 #1a3d1a;
}

.new-game-button:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #1a3d1a;
}

.load-game-button {
    background: #6a2d6a;
    border-color: #9d4a9d;
    box-shadow: 0 4px 0 #3d1a3d;
}

.load-game-button:hover {
    background: #7a3d7a;
    transform: translateY(2px);
    box-shadow: 0 2px 0 #3d1a3d;
}

.load-game-button:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #3d1a3d;
}

.welcome-button:disabled {
    background: #444;
    border-color: #666;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .menu-toggle {
        top: 15px;
        right: 15px;
        font-size: 20px;
        padding: 8px 12px;
    }

    .menu-content {
        padding: 20px;
        width: 95%;
    }

    .menu-header h2 {
        font-size: 16px;
    }

    .welcome-content {
        padding: 25px;
        width: 95%;
    }

    .welcome-header h2 {
        font-size: 16px;
    }

    .welcome-load-input {
        flex-direction: column;
    }
}

/* Backpack Transfer Animation */
.mushroom-transfer {
    position: fixed;
    font-size: 24px;
    pointer-events: none;
    z-index: 9999;
    animation: floatUp 1.5s ease-out forwards;
    opacity: 1;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateY(-30px) scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: translateY(-80px) scale(0.8);
        opacity: 0;
    }
}

.backpack-display.transferring {
    animation: transferPulse 0.5s ease-out;
}

.mushroom-display.receiving {
    animation: receivePulse 0.5s ease-out;
}

@keyframes transferPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        color: #ff8c00;
    }
}

@keyframes receivePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
        filter: brightness(1.5);
    }
}

/* ============================================
   CONTENT WRAPPER - Farms + Sidebar Layout
   ============================================ */

.content-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.container {
    margin: 0 auto;
    max-width: 100%;
    padding: 0 20px;
}

.farms-container {
    flex: 1;
    min-width: 0; /* Prevents flex overflow issues */
}

.right-sidebar {
    flex: 1; /* 50/50 split with farms */
    min-width: 0; /* Prevents flex overflow issues */
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

/* ============================================
   PANEL STYLES - Inventory & Lootbox Containers
   ============================================ */

.panel {
    background: #3d2b00;
    border: 4px solid #8b4513;
    box-shadow: 0 8px 0 #1a0f00;
}

.panel-header {
    background: #2d1b00;
    border-bottom: 4px solid #8b4513;
    padding: 15px;
    text-align: center;
}

.panel-header h2 {
    font-size: 14px;
    color: #ffd700;
    text-shadow: 2px 2px 0 #000;
}

.panel-content {
    padding: 20px;
    min-height: 150px;
}

.empty-message {
    text-align: center;
    color: #8b7355;
    font-size: 10px;
    line-height: 1.6;
    padding: 20px 10px;
}

/* ============================================
   INVENTORY SECTION
   ============================================ */

.inventory-section {
    flex: 1;
    position: relative; /* For item details tooltip positioning */
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 90px);
    gap: 10px;
    margin-top: 15px;
}

.inventory-item {
    background: #2d1b00;
    border: 3px solid #8b4513;
    padding: 10px;
    width: 90px;
    height: 90px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
}

.inventory-item.instant-item {
    border-color: #f4c430; /* Yellow border for instant/consumable items */
}

.inventory-item:hover {
    background: #4d3b10;
    transform: translateY(-2px);
    box-shadow: 0 4px 0 #1a0f00;
}

.inventory-item-icon {
    font-size: 24px;
    display: block;
    margin-bottom: 5px;
}

.inventory-item-name {
    font-size: 8px;
    color: #ffd700;
    word-wrap: break-word;
    overflow: hidden;
}

.inventory-item-count {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #8b4513;
    color: #fff;
    font-size: 8px;
    padding: 2px 5px;
    border-radius: 3px;
}

/* ============================================
   ITEM MODAL (Centered)
   ============================================ */

.item-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s;
}

.item-modal {
    background: linear-gradient(135deg, #2d1b00 0%, #1a0f00 100%);
    border: 4px solid #8b4513;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease-out;
}

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

.item-modal-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border-bottom: 3px solid #8b4513;
    background: rgba(139, 69, 19, 0.2);
}

.item-modal-icon {
    font-size: 48px;
    flex-shrink: 0;
}

.item-modal-title {
    flex: 1;
}

.item-modal-name {
    font-size: 24px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 5px;
}

.item-modal-rarity {
    font-size: 12px;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 4px;
    display: inline-block;
}

.item-modal-close {
    background: #4d3b10;
    border: 2px solid #8b4513;
    color: #ffd700;
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-modal-close:hover {
    background: #6d5b30;
    border-color: #ffd700;
    transform: scale(1.1);
}

.item-modal-body {
    padding: 20px;
}

.item-modal-description {
    font-size: 15px;
    color: #ddd;
    margin-bottom: 15px;
    line-height: 1.5;
}

.item-modal-owned {
    font-size: 14px;
    color: #ffd700;
    margin: 15px 0;
    font-weight: bold;
}

/* Item Effects in Modal */
.item-modal .item-effects {
    margin: 15px 0;
}

.item-modal .item-effects strong {
    color: #ffd700;
    font-size: 15px;
}

.item-modal .item-effects ul {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
}

.item-modal .item-effects li {
    font-size: 14px;
    color: #90ee90;
    padding: 5px 0;
    padding-left: 20px;
    position: relative;
}

.item-modal .item-effects li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #ffd700;
    font-size: 18px;
}

/* Item Use Controls in Modal */
.item-modal .item-use-controls {
    margin: 20px 0 0 0;
    padding-top: 15px;
    border-top: 2px solid #8b4513;
}

.item-modal .item-use-quantity {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.item-modal .item-use-quantity label {
    color: #ffd700;
    font-size: 14px;
    font-weight: bold;
}

.item-modal .use-amount-input {
    flex: 1;
    padding: 8px 10px;
    background: #2d1b00;
    border: 2px solid #8b4513;
    color: #fff;
    font-size: 16px;
    border-radius: 4px;
    max-width: 100px;
}

.item-modal .use-amount-input:focus {
    outline: none;
    border-color: #ffd700;
}

.item-modal .use-max-btn {
    padding: 8px 15px;
    background: #4d3b10;
    border: 2px solid #8b4513;
    color: #ffd700;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.item-modal .use-max-btn:hover {
    background: #6d5b30;
    border-color: #ffd700;
}

.item-modal .use-max-btn:active {
    transform: scale(0.95);
}

.item-modal .use-item-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    border: 3px solid #2d6a2f;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    text-transform: uppercase;
}

.item-modal .use-item-btn:hover {
    background: linear-gradient(135deg, #5bc05f 0%, #4fb052 100%);
    border-color: #ffd700;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.item-modal .use-item-btn:active {
    transform: translateY(0);
}

.item-modal .use-item-btn:disabled {
    background: #555;
    border-color: #333;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ============================================
   OLD ITEM DETAILS (Keep for compatibility)
   ============================================ */

/* Item Details Backdrop - Semi-transparent overlay for click-to-close */
.item-details-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99;
    animation: fadeIn 0.2s;
    cursor: pointer;
}

/* Item Details Tooltip - Anchored Modal */
.item-details-tooltip {
    position: absolute;
    left: var(--tooltip-left);
    top: var(--tooltip-top);
    z-index: 100;
    animation: fadeIn 0.2s;
    pointer-events: auto;
    cursor: default;
}

.item-details-content {
    background: linear-gradient(135deg, #2d1b00 0%, #1a0f00 100%);
    border: 3px solid #8b4513;
    border-radius: 8px;
    padding: 20px;
    max-width: 400px;
    min-width: 320px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

.item-details-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.item-details-icon {
    font-size: 48px;
    flex-shrink: 0;
}

.item-details-title {
    flex: 1;
}

.item-details-name {
    font-size: 20px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 5px;
}

.item-details-rarity {
    font-size: 12px;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 3px;
    display: inline-block;
}

.rarity-common {
    background: #6b6b6b;
    color: #fff;
}

.rarity-uncommon {
    background: #1eff00;
    color: #000;
}

.rarity-rare {
    background: #0070dd;
    color: #fff;
}

.rarity-epic {
    background: #a335ee;
    color: #fff;
}

.rarity-legendary {
    background: #ff8000;
    color: #fff;
}

.item-details-description {
    font-size: 14px;
    color: #ccc;
    margin-bottom: 15px;
    line-height: 1.4;
}

.item-effects {
    margin-bottom: 15px;
}

.item-effects strong {
    color: #ffd700;
    font-size: 14px;
}

.item-effects ul {
    list-style: none;
    padding: 0;
    margin: 5px 0 0 0;
}

.item-effects li {
    font-size: 13px;
    color: #90ee90;
    padding: 3px 0;
    padding-left: 15px;
    position: relative;
}

.item-effects li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #ffd700;
}

.item-details-owned {
    font-size: 13px;
    color: #ffd700;
    margin-bottom: 10px;
}

.item-details-close {
    font-size: 11px;
    color: #888;
    text-align: center;
    font-style: italic;
}

/* Item Use Controls */
.item-use-controls {
    margin: 15px 0 10px 0;
    border-top: 1px solid #8b4513;
    padding-top: 15px;
}

.item-use-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.item-use-quantity label {
    color: #ffd700;
    font-size: 13px;
}

.use-amount-input {
    flex: 1;
    padding: 5px 8px;
    background: #2d1b00;
    border: 2px solid #8b4513;
    color: #fff;
    font-size: 14px;
    border-radius: 3px;
    min-width: 60px;
    max-width: 100px;
}

.use-amount-input:focus {
    outline: none;
    border-color: #ffd700;
}

.use-max-btn {
    padding: 5px 12px;
    background: #4d3b10;
    border: 2px solid #8b4513;
    color: #ffd700;
    font-size: 12px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
}

.use-max-btn:hover {
    background: #6d5b30;
    border-color: #ffd700;
}

.use-max-btn:active {
    transform: scale(0.95);
}

.use-item-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    border: 2px solid #2d6a2f;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    text-transform: uppercase;
}

.use-item-btn:hover {
    background: linear-gradient(135deg, #5bc05f 0%, #4fb052 100%);
    border-color: #ffd700;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.use-item-btn:active {
    transform: translateY(0);
}

.use-item-btn:disabled {
    background: #555;
    border-color: #333;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ============================================
   LOOTBOX SECTION
   ============================================ */

.lootbox-section {
    flex: 1;
    position: relative; /* For lootbox opening overlay positioning */
}

/* ============================================
   RESPONSIVE LAYOUT
   ============================================ */

@media (max-width: 1200px) {
    .content-wrapper {
        flex-direction: column;
    }

    .right-sidebar {
        flex-direction: row;
        position: static;
        max-height: none;
    }

    .inventory-section,
    .lootbox-section {
        flex: 1;
    }

    .container {
        padding: 0 15px;
    }
}

@media (max-width: 768px) {
    .right-sidebar {
        flex-direction: column;
    }

    .inventory-grid {
        grid-template-columns: repeat(auto-fill, 80px);
        gap: 8px;
    }

    .inventory-item {
        width: 80px;
        height: 80px;
    }

    .panel-content {
        padding: 15px;
    }

    body {
        padding: 10px;
    }

    .content-wrapper {
        gap: 15px;
    }
}

/* ============================================
   LOOTBOX UI
   ============================================ */

.lootbox-item {
    background: #2d1b00;
    border: 3px solid #8b4513;
    padding: 15px;
    margin-bottom: 15px;
    text-align: center;
}

.lootbox-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.lootbox-name {
    font-size: 12px;
    color: #ffd700;
    margin-bottom: 5px;
}

.lootbox-description {
    font-size: 8px;
    color: #8b7355;
    margin-bottom: 10px;
    line-height: 1.4;
}

.lootbox-purchase-button {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    padding: 10px 15px;
    background: #4CAF50;
    color: #fff;
    border: 3px solid #2d5f2f;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
}

.lootbox-purchase-button:hover {
    background: #5CBF60;
    transform: translateY(-2px);
    box-shadow: 0 4px 0 #2d5f2f;
}

.lootbox-purchase-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 0 #2d5f2f;
}

.lootbox-purchase-button:disabled,
.lootbox-purchase-button.cannot-afford {
    background: #666;
    border-color: #333;
    cursor: not-allowed;
    opacity: 0.5;
}

.lootbox-purchase-button.purchasing {
    background: #ff9800;
    animation: pulse 0.5s infinite;
}

.lootbox-cost {
    font-weight: bold;
    color: #fff;
}

/* ============================================
   LOOTBOX OPENING ANIMATION
   ============================================ */

.lootbox-opening-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
    border-radius: 4px;
}

.lootbox-opening-content {
    text-align: center;
}

.lootbox-opening-icon {
    font-size: 80px;
    animation: shake 0.5s infinite;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8));
}

.lootbox-opening-text {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    color: #ffd700;
    margin-top: 20px;
    text-shadow: 2px 2px 0 #000;
    animation: pulse 1s infinite;
}

@keyframes shake {
    0%, 100% {
        transform: rotate(-5deg) scale(1);
    }
    25% {
        transform: rotate(5deg) scale(1.05);
    }
    50% {
        transform: rotate(-5deg) scale(1);
    }
    75% {
        transform: rotate(5deg) scale(0.95);
    }
}

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

/* ============================================
   LOOTBOX REWARD OVERLAY
   ============================================ */

.lootbox-reward-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 101;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
    border-radius: 4px;
}

.lootbox-reward-content {
    background: #3d2b00;
    border: 3px solid #ffd700;
    padding: 20px;
    max-width: 90%;
    text-align: center;
    animation: scaleIn 0.2s;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.lootbox-reward-content h2 {
    font-size: 14px;
    color: #ffd700;
    margin-bottom: 15px;
    text-shadow: 2px 2px 0 #000;
}

.lootbox-reward-item {
    background: #2d1b00;
    border: 2px solid #8b4513;
    padding: 12px;
    margin: 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.reward-icon {
    font-size: 28px;
}

.reward-text {
    font-size: 12px;
    color: #ffd700;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

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