/* --- Global Styles & CSS Variables --- */
:root {
    --dark-bg: #0D110E;
    --card-bg: #141a17;
    --glow-green: #a7ff83;
    --bright-green: #39ff14;
    --text-color: #c5c6c7;
    --border-color: rgba(167, 255, 131, 0.2);
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--dark-bg);
    color: var(--text-color);
    font-family: 'Poppins', sans-serif;
    margin: 0;
    overflow-x: hidden; /* Prevent horizontal scroll from fireflies */
}

/* --- Animated Firefly Background --- */
.firefly {
    position: fixed;
    left: 50%;
    top: 50%;
    width: 0.4vw;
    height: 0.4vw;
    margin: -0.2vw 0 0 9.8vw;
    animation: ease 200s alternate infinite;
    pointer-events: none;
}

.firefly::before,
.firefly::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    transform-origin: -10vw;
}

.firefly::before {
    background: black;
    opacity: 0.4;
    animation: drift ease alternate infinite;
}

.firefly::after {
    background: white;
    opacity: 0;
    box-shadow: 0 0 0vw 0vw var(--glow-green);
    animation: drift ease alternate infinite, flash ease infinite;
}

/* --- Firefly Animation Keyframes --- */
@keyframes drift {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes flash {
    0%, 30%, 100% { opacity: 0; box-shadow: 0 0 0vw 0vw var(--glow-green); }
    5% { opacity: 1; box-shadow: 0 0 2vw 0.4vw var(--glow-green); }
}

/* Staggering the animations for a natural look */
.firefly:nth-child(1) { animation-name: move1; }
.firefly:nth-child(2) { animation-name: move2; }
/* ... (animation definitions for each firefly) ... */
@keyframes move1 { 100% { transform: translate3d(100vw, -100vh, 0); } }
@keyframes move2 { 100% { transform: translate3d(30vw, 100vh, 0); } }
/* Add more @keyframes for each firefly div for more randomness */
.firefly:nth-child(3) { animation-name: move2; animation-delay: 20s; }
.firefly:nth-child(4) { animation-name: move1; animation-delay: 30s; }
.firefly:nth-child(5) { animation-name: move2; animation-delay: 40s; }
.firefly:nth-child(6) { animation-name: move1; animation-delay: 50s; }
.firefly:nth-child(7) { animation-name: move2; animation-delay: 60s; }
.firefly:nth-child(8) { animation-name: move1; animation-delay: 70s; }
.firefly:nth-child(9) { animation-name: move2; animation-delay: 80s; }
.firefly:nth-child(10) { animation-name: move1; animation-delay: 90s; }


/* --- Layout & Main Containers --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
    position: relative;
    z-index: 2;
}

.site-header {
    width: 100%;
    padding: 20px;
    position: relative;
    z-index: 2;
}

.back-link {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}
.back-link:hover {
    color: var(--glow-green);
}

.title-section h1 {
    font-size: 2.5rem;
    color: white;
    text-shadow: 0 0 10px var(--glow-green), 0 0 20px var(--glow-green);
    margin-bottom: 0.5rem;
}

.title-section p {
    font-size: 1rem;
    color: var(--text-color);
    margin-top: 0;
}

/* --- Search Bar --- */
.search-container {
    position: relative;
    width: 60%;
    max-width: 600px;
    margin: 40px auto;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-color);
}

#searchInput {
    width: 100%;
    padding: 15px 20px 15px 50px; /* Left padding for icon */
    font-size: 1rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    color: white;
    transition: all 0.3s ease;
}

#searchInput::placeholder {
    color: var(--text-color);
}

#searchInput:focus {
    outline: none;
    border-color: var(--glow-green);
    box-shadow: 0 0 15px var(--glow-green);
}

/* --- Results Grid & Item Cards --- */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); /* Increased size */
    gap: 20px;
    margin-top: 20px;
}

.item-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(57, 255, 20, 0.2);
    border-color: var(--glow-green);
}

/* In find/style.css */
.item-sprite {
    width: 32px;
    height: 32px;
    
    transform: scale();
    transform-origin: center; /* THIS IS THE FIX */
    
    margin-bottom: 10px;
    background-repeat: no-repeat;
    image-rendering: pixelated;
}
.item-name {
    font-size: 14px;
    font-weight: 300;
    margin: 0;
    word-wrap: break-word;
}

/* --- Modal Styling --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 17, 14, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.modal-content {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--glow-green);
    box-shadow: 0 0 30px rgba(57, 255, 20, 0.3);
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 20px;
    color: var(--text-color);
    font-size: 30px;
    cursor: pointer;
    transition: color 0.2s ease;
}
.modal-close:hover {
    color: var(--glow-green);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-sprite-large {
    width: 32px;
    height: 32px;
    
    transform: scale;
    transform-origin: center; /* THIS IS THE FIX */
    
    margin: 0;
    flex-shrink: 0;
    background-color: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* You can also revert this rule, removing the padding-left */
.modal-header h2 {
    margin: 0;
    /* padding-left: 32px; NO LONGER NEEDED */
    color: var(--glow-green);
    text-shadow: 0 0 8px var(--glow-green);
}
.modal-body h3 {
    margin-top: 0;
    color: white;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-weight: 400;
}
.modal-body h3 i {
    margin-right: 10px;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.modal-body p {
    margin: 5px 0;
    background: var(--dark-bg);
    padding: 8px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.modal-body p strong {
    color: var(--glow-green);
    font-family: 'Share Tech Mono', monospace;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--dark-bg);
}
::-webkit-scrollbar-thumb {
    background: var(--glow-green);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--bright-green);
}