:root {
    --primary-color: #00ccff;
    --secondary-color: #ff00aa;
    --accent-color: #FFD700;
    --tertiary-color: #00ffaa;
    --dark-bg: #0a0a16;
    --dark-bg-alt: #0f0f22;
    --text-color: #ffffff;
    --light-text-color: #cccccc;
    --border-color: #005f77; /* Darker cyan for borders */
    --font-primary: 'Press Start 2P', cursive;
    --font-secondary: 'Roboto', sans-serif;
    --primary-bg: #0a0a16;
    --secondary-bg: #111122;
    --highlight-color: #ff9900;
    --element-bg: #1a1a2e;
    --element-border: #3a3a5e;
    --canvas-bg: #0c0c18;
    --success-color: #22cc88;
    --rare-color: #ffcc00;
    --epic-color: #cc44dd;
    --legendary-color: #ff5500;
    --shadow-color: rgba(0, 204, 255, 0.4);
}

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

body {
    background-color: var(--dark-bg);
    color: var(--text-color);
    font-family: var(--font-secondary);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: var(--font-primary);
    letter-spacing: 1px;
}

.game-header {
    background-color: var(--dark-bg-alt);
    padding: 1rem;
    text-align: center;
    border-bottom: 2px solid var(--primary-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.game-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg, 
        rgba(0, 204, 255, 0.1) 0%, 
        rgba(0, 0, 0, 0) 70%
    );
    z-index: 1;
}

.game-header h1 {
    font-family: var(--font-primary);
    color: var(--primary-color);
    font-size: 1.8rem;
    margin: 0;
    text-shadow: 0 0 5px var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 10px;
    position: relative;
    z-index: 2;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(0, 204, 255, 0.5);
}

.subtitle {
    font-size: 1rem;
    opacity: 0.8;
    position: relative;
    z-index: 2;
}

.game-container {
    display: flex;
    flex-grow: 1;
    padding: 1rem;
    gap: 1rem;
    flex-wrap: wrap;
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    gap: 20px;
}

.sidebar {
    background-color: var(--dark-bg-alt);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    width: 250px;
    display: flex;
    flex-direction: column;
    width: 300px;
    background-color: var(--secondary-bg);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    height: calc(100vh - 150px);
    overflow-y: auto;
}

.sidebar-header {
    margin-bottom: 15px;
    position: sticky;
    top: 0;
    background-color: var(--secondary-bg);
    padding: 5px 0;
    z-index: 10;
}

.sidebar h2 {
    font-family: var(--font-primary);
    color: var(--accent-color);
    font-size: 1rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
    text-align: center;
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: var(--accent-color);
}

.search-container {
    position: relative;
    margin-bottom: 15px;
}

#searchElements {
    width: calc(100% - 12px);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--primary-color);
    background-color: var(--dark-bg);
    color: var(--text-color);
    font-family: var(--font-secondary);
    width: 100%;
    padding: 8px 12px;
    background-color: var(--primary-bg);
    border: 1px solid var(--element-border);
    border-radius: 4px;
    color: var(--text-color);
    font-size: 0.9rem;
}

#search-elements:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 204, 255, 0.2);
}

.element-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    position: sticky;
    top: 70px;
    background-color: var(--secondary-bg);
    padding: 5px 0;
    z-index: 9;
}

.category-btn {
    background-color: var(--element-bg);
    border: 1px solid var(--element-border);
    color: var(--text-color);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.category-btn:hover {
    background-color: var(--element-border);
}

.category-btn.active {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--primary-bg);
}

.elements-list {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 5px; /* For scrollbar */
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding-bottom: 20px;
}

.element-item {
    background-color: var(--dark-bg);
    color: var(--text-color);
    padding: 0.6rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    cursor: grab;
    font-size: 0.9rem;
    transition: background-color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    background-color: var(--element-bg);
    border: 2px solid var(--element-border);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
}

.element-item:hover {
    background-color: #005f77; /* Darker cyan */
    transform: scale(1.02);
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border-color: var(--accent-color);
}

.element-item:active {
    cursor: grabbing;
}

.element-item .emoji {
    margin-right: 0.5rem;
    font-size: 1.2em;
    font-size: 2rem;
    margin-bottom: 5px;
}

.element-item .element-name {
    font-size: 0.85rem;
    text-align: center;
    word-break: break-word;
}

.element-item.first-discovery::after {
    content: "NEW!";
    font-family: var(--font-primary);
    font-size: 0.6rem;
    color: var(--accent-color);
    margin-left: auto;
    padding: 2px 4px;
    background-color: var(--secondary-color);
    border-radius: 3px;
    animation: pulse-badge 1.5s infinite;
}

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

.element.basic {
    border-color: var(--accent-color);
}

.element.rare {
    border-color: var(--rare-color);
    box-shadow: 0 0 8px rgba(255, 204, 0, 0.3);
}

.element.epic {
    border-color: var(--epic-color);
    box-shadow: 0 0 8px rgba(204, 68, 221, 0.3);
}

.element.legendary {
    border-color: var(--legendary-color);
    box-shadow: 0 0 8px rgba(255, 85, 0, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 8px rgba(255, 85, 0, 0.3); }
    50% { box-shadow: 0 0 15px rgba(255, 85, 0, 0.6); }
    100% { box-shadow: 0 0 8px rgba(255, 85, 0, 0.3); }
}

.crafting-area-section {
    flex-grow: 1;
    background-color: var(--dark-bg-alt);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.crafting-area-section h2 {
    font-family: var(--font-primary);
    color: var(--accent-color);
    font-size: 1.2rem;
    margin-top: 0;
    margin-bottom: 1rem;
}

.craft-section {
    flex: 1;
    min-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.crafting-canvas {
    background-color: var(--canvas-bg);
    border: 2px solid var(--element-border);
    border-radius: 8px;
    height: 500px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(0, 204, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 153, 0, 0.1) 0%, transparent 50%);
    transition: border-color 0.2s ease;
    cursor: default;
}

.crafting-canvas.drag-over {
    border-color: var(--accent-color);
    box-shadow: 
        inset 0 0 20px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(0, 204, 255, 0.4);
}

.canvas-guidance {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 1;
}

.canvas-guidance.hidden {
    opacity: 0;
    visibility: hidden;
}

.canvas-guidance p {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.canvas-guidance p:first-child {
    font-size: 1.3rem;
    color: var(--accent-color);
    font-weight: bold;
}

.canvas-element {
    position: absolute;
    background-color: var(--element-bg);
    border: 2px solid var(--element-border);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: move;
    user-select: none;
    transition: all 0.2s ease;
    z-index: 10;
    min-width: 60px;
    max-width: 80px;
    width: 80px;
    height: 80px;
    text-align: center;
    box-sizing: border-box;
}

.canvas-element:hover {
    transform: scale(1.05);
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(0, 204, 255, 0.3);
}

.canvas-element:active,
.canvas-element.dragging {
    cursor: grabbing;
    transform: scale(1.1) !important;
    opacity: 0.9 !important;
    z-index: 100 !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4) !important;
    border-color: var(--accent-color) !important;
}

.canvas-element .emoji {
    font-size: 1.8rem;
    margin-bottom: 2px;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.3));
    line-height: 1;
}

.canvas-element .element-name {
    font-size: 0.7rem;
    text-align: center;
    word-break: break-word;
    line-height: 1.1;
    max-height: 2.2em;
    overflow: hidden;
    margin-top: auto;
}

.canvas-element.highlight {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 25px var(--accent-color) !important;
    animation: highlight-pulse 0.8s infinite;
}

@keyframes highlight-pulse {
    0%, 100% { 
        box-shadow: 0 0 25px var(--accent-color);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 35px var(--accent-color);
        transform: scale(1.08);
    }
}

/* Enhanced combination effects */
.combination-effect {
    position: absolute;
    font-size: 2.5rem;
    pointer-events: none;
    z-index: 100;
    transform: translate(-50%, -50%);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.5));
}

.combination-glow {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(0, 204, 255, 0.8) 0%,
        rgba(255, 153, 0, 0.6) 40%,
        rgba(0, 0, 0, 0) 70%
    );
    z-index: 8;
    pointer-events: none;
    transform: translate(-50%, -50%);
    opacity: 0;
}

/* Improved drag feedback */
.crafting-canvas {
    background-color: var(--canvas-bg);
    border: 2px solid var(--element-border);
    border-radius: 8px;
    height: 500px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(0, 204, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 153, 0, 0.1) 0%, transparent 50%);
    transition: border-color 0.2s ease;
    cursor: default;
}

.crafting-canvas.drag-over {
    border-color: var(--accent-color);
    box-shadow: 
        inset 0 0 20px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(0, 204, 255, 0.4);
}

/* Better mobile touch targets */
@media (max-width: 768px) {
    .canvas-element {
        min-width: 70px;
        max-width: 70px;
        width: 70px;
        height: 70px;
        padding: 6px;
    }
    
    .canvas-element .emoji {
        font-size: 1.6rem;
    }
    
    .canvas-element .element-name {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .canvas-element {
        min-width: 60px;
        max-width: 60px;
        width: 60px;
        height: 60px;
        padding: 4px;
    }
    
    .canvas-element .emoji {
        font-size: 1.4rem;
    }
    
    .canvas-element .element-name {
        font-size: 0.6rem;
    }
}

/* Print styles */
@media print {
    .tutorial-overlay,
    .notification,
    .controls,
    .sidebar,
    .discovery-panel {
        display: none !important;
    }
    
    .game-container {
        flex-direction: column;
    }
    
    .crafting-canvas {
        border: 2px solid #000;
        background: white;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --element-border: #ffffff;
        --text-color: #ffffff;
        --dark-bg: #000000;
        --accent-color: #ffff00;
    }
    
    .element-item,
    .canvas-element,
    .discovery {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* FIXED: Content Section Styles */
.info-section {
    background-color: var(--secondary-bg);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    margin-bottom: 3rem;
    overflow: hidden;
    padding: 2rem;
    border: 1px solid var(--element-border);
}

.info-section .section-title {
    color: var(--accent-color);
    font-family: var(--font-primary);
    text-align: center;
    margin-bottom: 2rem;
    text-shadow: 0 0 10px rgba(0, 204, 255, 0.5);
    font-size: 2rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.info-card {
    background-color: var(--primary-bg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--element-border);
}

.info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-color), var(--highlight-color));
}

.info-card.full-width {
    grid-column: 1 / -1;
}

.card-title {
    color: var(--accent-color);
    font-family: var(--font-primary);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    display: inline-block;
    position: relative;
}

.card-title::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent-color);
    opacity: 0.5;
}

.info-card p {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: var(--text-color);
}

.recipe-examples {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem 0;
    border-left: 4px solid var(--accent-color);
}

.recipe-examples li {
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
    color: var(--text-color);
}

.element-emoji {
    font-size: 1.2rem;
    margin-right: 4px;
    display: inline-block;
}

.popular-recipes h4 {
    color: var(--highlight-color);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: bold;
    font-size: 1.1rem;
}

.popular-recipes ol, 
.popular-recipes ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.popular-recipes li {
    margin-bottom: 0.25rem;
    padding: 0.25rem 0;
    color: var(--text-color);
}

.tips-list {
    list-style-type: none;
    padding: 0;
}

.tips-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    padding-left: 1.5rem;
    color: var(--text-color);
}

.tips-list li::before {
    content: '⭐';
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

.tips-list li:last-child {
    border-bottom: none;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.feature {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 6px;
    height: 100%;
    border: 1px solid var(--element-border);
    transition: transform 0.2s ease;
}

.feature:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 204, 255, 0.2);
}

.feature h4 {
    color: var(--highlight-color);
    margin-bottom: 0.75rem;
    font-weight: bold;
    font-size: 1.1rem;
}

.feature p {
    color: var(--text-color);
}

.faq-container {
    margin-top: 1rem;
}

.faq-item {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    border-left: 4px solid var(--accent-color);
}

.faq-question {
    color: var(--highlight-color);
    font-weight: bold;
    margin-bottom: 0.5rem;
    position: relative;
    padding-left: 1.5rem;
    font-size: 1.05rem;
}

.faq-question::before {
    content: '▶';
    position: absolute;
    left: 0;
    top: 0;
    color: var(--accent-color);
    font-size: 0.8rem;
}

.faq-answer {
    padding-left: 1.5rem;
    opacity: 0.9;
    color: var(--text-color);
}

.no-elements, .no-discoveries {
    text-align: center;
    padding: 2rem;
    opacity: 0.6;
    font-style: italic;
    grid-column: 1 / -1;
    color: var(--text-color);
}

/* Container utility classes */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.mt-10 {
    margin-top: 2.5rem;
}

.text-3xl {
    font-size: 1.875rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.md\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.md\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gap-8 {
    gap: 2rem;
}

.gap-4 {
    gap: 1rem;
}

.discovery-panel {
    width: 300px;
    background-color: var(--secondary-bg);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    height: calc(100vh - 150px);
    overflow-y: auto;
    border: 1px solid var(--element-border);
}

.discovery-panel h2 {
    font-family: var(--font-primary);
    color: var(--accent-color);
    font-size: 1.4rem;
    margin-bottom: 15px;
    text-align: center;
    text-shadow: 0 0 5px rgba(0, 204, 255, 0.3);
}

.discovery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    position: sticky;
    top: 0;
    background-color: var(--secondary-bg);
    padding: 5px 0;
    z-index: 9;
}

.filter-btn {
    background-color: var(--element-bg);
    border: 1px solid var(--element-border);
    color: var(--text-color);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    font-family: var(--font-secondary);
}

.filter-btn:hover {
    background-color: var(--element-border);
    transform: translateY(-1px);
}

.filter-btn.active {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--primary-bg);
    box-shadow: 0 0 10px rgba(0, 204, 255, 0.4);
}

.discoveries-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding-bottom: 20px;
}

.discovery {
    background-color: var(--element-bg);
    border: 2px solid var(--element-border);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
    min-height: 80px;
}

.discovery:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border-color: var(--accent-color);
}

.discovery:active {
    transform: translateY(-1px);
}

.discovery-emoji {
    font-size: 1.8rem;
    margin-bottom: 5px;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.3));
}

.discovery-name {
    font-size: 0.75rem;
    text-align: center;
    word-break: break-word;
    line-height: 1.1;
    margin-bottom: 5px;
    color: var(--text-color);
    font-weight: 500;
}

.favorite-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    color: var(--light-text-color);
    font-size: 1rem;
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    transition: all 0.2s ease;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.favorite-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.favorite-btn.active {
    color: var(--accent-color);
    text-shadow: 0 0 5px var(--accent-color);
}

/* Rarity-based styling for discoveries */
.discovery.common {
    border-color: var(--element-border);
}

.discovery.uncommon {
    border-color: #22cc88;
    box-shadow: 0 0 8px rgba(34, 204, 136, 0.2);
}

.discovery.rare {
    border-color: var(--rare-color);
    box-shadow: 0 0 8px rgba(255, 204, 0, 0.3);
}

.discovery.epic {
    border-color: var(--epic-color);
    box-shadow: 0 0 8px rgba(204, 68, 221, 0.3);
}

.discovery.legendary {
    border-color: var(--legendary-color);
    box-shadow: 0 0 8px rgba(255, 85, 0, 0.3);
    animation: legendary-glow 2s infinite;
}

@keyframes legendary-glow {
    0% { box-shadow: 0 0 8px rgba(255, 85, 0, 0.3); }
    50% { box-shadow: 0 0 15px rgba(255, 85, 0, 0.6); }
    100% { box-shadow: 0 0 8px rgba(255, 85, 0, 0.3); }
}

/* First discovery badge */
.discovery.first-discovery::before {
    content: "FIRST!";
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(45deg, var(--accent-color), var(--highlight-color));
    color: var(--primary-bg);
    font-size: 0.6rem;
    font-family: var(--font-primary);
    padding: 2px 6px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    animation: first-discovery-pulse 2s infinite;
    z-index: 10;
}

@keyframes first-discovery-pulse {
    0%, 100% { 
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
    50% { 
        transform: translateX(-50%) scale(1.05);
        opacity: 0.9;
    }
}

/* Recipe display styling */
.recipe-display {
    background-color: var(--secondary-bg);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid var(--element-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.recipe-display h2 {
    font-family: var(--font-primary);
    color: var(--accent-color);
    font-size: 1.2rem;
    margin-bottom: 15px;
    text-align: center;
}

.discovery-container {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recipe-formula {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.recipe-element {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--element-bg);
    border: 1px solid var(--element-border);
    border-radius: 6px;
    padding: 8px;
    min-width: 60px;
}

.recipe-emoji {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.recipe-name {
    font-size: 0.75rem;
    text-align: center;
    color: var(--text-color);
}

.recipe-plus,
.recipe-equals {
    font-size: 1.2rem;
    color: var(--accent-color);
    font-weight: bold;
}

.new-element {
    background-color: var(--element-bg);
    border: 2px solid var(--element-border);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
}

.new-element-emoji {
    font-size: 2rem;
    margin-bottom: 8px;
}

.new-element-name {
    font-size: 1rem;
    font-weight: bold;
    text-align: center;
    color: var(--text-color);
}

.formula-placeholder {
    color: var(--light-text-color);
    font-style: italic;
    text-align: center;
    opacity: 0.7;
}

/* Controls styling */
.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

/* NEW: Sound controls styling */
.sound-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background-color: var(--element-bg);
    border: 2px solid var(--element-border);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.sound-controls:hover {
    border-color: var(--accent-color);
    background-color: rgba(0, 204, 255, 0.1);
}

.sound-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    user-select: none;
}

.sound-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.sound-btn.muted {
    opacity: 0.5;
    color: var(--light-text-color);
}

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

.volume-control label {
    font-size: 0.9rem;
    color: var(--light-text-color);
    cursor: pointer;
}

.volume-slider {
    width: 80px;
    height: 4px;
    background: var(--element-border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(0, 204, 255, 0.5);
    transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(0, 204, 255, 0.8);
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 4px rgba(0, 204, 255, 0.5);
    transition: all 0.2s ease;
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(0, 204, 255, 0.8);
}

/* Enhanced drag performance styles */
.drag-clone {
    pointer-events: none !important;
    transform: translate(-50%, -50%) scale(1.1) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4) !important;
    border-color: var(--accent-color) !important;
    z-index: 1000 !important;
    will-change: transform, left, top; /* Optimize for animations */
}

.canvas-element.dragging {
    will-change: transform, left, top; /* Optimize for animations */
}

/* Smooth hover transitions */
.element-item,
.discovery,
.controls button,
.category-btn,
.filter-btn {
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1); /* Faster, smoother transitions */
}

/* NEW: Tutorial overlay styles */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.tutorial-content {
    background-color: var(--secondary-bg);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    text-align: center;
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 30px rgba(0, 204, 255, 0.3);
}

.tutorial-content h2 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.tutorial-step {
    display: flex;
    align-items: center;
    margin: 1rem 0;
    padding: 0.5rem;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.tutorial-image {
    font-size: 2rem;
    margin-right: 1rem;
    width: 3rem;
    text-align: center;
}

#start-crafting {
    background: linear-gradient(45deg, var(--accent-color), var(--highlight-color));
    color: var(--primary-bg);
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.2s ease;
    font-family: var(--font-secondary);
}

#start-crafting:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 204, 255, 0.4);
}

/* NEW: Notification styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--secondary-bg);
    border: 2px solid var(--accent-color);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 300px;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.success {
    border-color: var(--success-color);
    background-color: rgba(34, 204, 136, 0.1);
}

.notification.error {
    border-color: #ff4444;
    background-color: rgba(255, 68, 68, 0.1);
}

/* NEW: Recipe hints panel */
.recipe-hints-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--secondary-bg);
    border: 2px solid var(--accent-color);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 600px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 9000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.recipe-hints-panel h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    text-align: center;
    font-family: var(--font-primary);
}

.close-hints {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-hints:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.hints-list {
    display: grid;
    gap: 1rem;
}

.recipe-hint {
    background-color: var(--element-bg);
    border: 1px solid var(--element-border);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.recipe-hint:hover {
    border-color: var(--accent-color);
    background-color: rgba(0, 204, 255, 0.1);
}

.hint-elements {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hint-emoji {
    font-size: 1.2rem;
}

.hint-name {
    font-size: 0.9rem;
    color: var(--text-color);
}

.hint-plus, .hint-arrow {
    color: var(--accent-color);
    font-weight: bold;
    margin: 0 0.5rem;
}

.hint-result {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* NEW: Particle system for combinations */
.particle-system {
    position: absolute;
    pointer-events: none;
    z-index: 50;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: particle-burst 1s ease-out forwards;
}

@keyframes particle-burst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--dx), var(--dy)) scale(0);
        opacity: 0;
    }
}

/* NEW: Combination fade animation */
@keyframes combination-fade {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* NEW: Achievement notification styles */
.achievement-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background-color: var(--secondary-bg);
    border: 2px solid var(--accent-color);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.4s ease;
    max-width: 320px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.achievement-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.achievement-notification.rare {
    border-color: var(--rare-color);
    box-shadow: 0 8px 24px rgba(255, 204, 0, 0.3);
}

.achievement-notification.epic {
    border-color: var(--epic-color);
    box-shadow: 0 8px 24px rgba(204, 68, 221, 0.3);
}

.achievement-notification.legendary {
    border-color: var(--legendary-color);
    box-shadow: 0 8px 24px rgba(255, 85, 0, 0.3);
    animation: achievement-glow 2s infinite;
}

@keyframes achievement-glow {
    0%, 100% { box-shadow: 0 8px 24px rgba(255, 85, 0, 0.3); }
    50% { box-shadow: 0 8px 30px rgba(255, 85, 0, 0.6); }
}

.achievement-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.achievement-content {
    flex-grow: 1;
}

.achievement-title {
    font-size: 0.8rem;
    color: var(--accent-color);
    font-weight: bold;
    margin-bottom: 0.25rem;
    font-family: var(--font-primary);
}

.achievement-name {
    font-size: 1rem;
    color: var(--text-color);
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.achievement-description {
    font-size: 0.85rem;
    color: var(--light-text-color);
    opacity: 0.9;
}

/* NEW: Button styles for controls */
.controls button {
    background: linear-gradient(45deg, var(--element-bg), var(--element-border));
    border: 2px solid var(--element-border);
    color: var(--text-color);
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: var(--font-secondary);
    transition: all 0.2s ease;
    font-weight: 500;
}

.controls button:hover {
    border-color: var(--accent-color);
    background: linear-gradient(45deg, var(--accent-color), var(--highlight-color));
    color: var(--primary-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 204, 255, 0.3);
}

.controls button:active {
    transform: translateY(0);
}

.hint-button {
    background: linear-gradient(45deg, var(--rare-color), var(--highlight-color)) !important;
    color: var(--primary-bg) !important;
    border-color: var(--rare-color) !important;
}

.hint-button:hover {
    box-shadow: 0 4px 12px rgba(255, 204, 0, 0.4) !important;
}

/* NEW: Discovery stats styling */
.discovery-stats {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 20px;
}

.stat-box {
    background-color: var(--element-bg);
    border: 2px solid var(--element-border);
    border-radius: 8px;
    padding: 15px 20px;
    text-align: center;
    min-width: 120px;
    transition: all 0.2s ease;
}

.stat-box:hover {
    border-color: var(--accent-color);
    background-color: rgba(0, 204, 255, 0.1);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent-color);
    font-family: var(--font-primary);
    text-shadow: 0 0 5px rgba(0, 204, 255, 0.3);
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--light-text-color);
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Responsive design improvements */
@media (max-width: 1200px) {
    .game-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .sidebar, .discovery-panel {
        width: 100%;
        height: auto;
        max-height: 300px;
    }
    
    .craft-section {
        min-width: auto;
        width: 100%;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .game-header h1 {
        font-size: 1.8rem;
    }
    
    .crafting-canvas {
        height: 400px;
    }
    
    .controls {
        gap: 10px;
    }
    
    .controls button {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .discovery-stats {
        gap: 10px;
    }
    
    .stat-box {
        padding: 10px 15px;
        min-width: 100px;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .notification, .achievement-notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .recipe-hints-panel {
        left: 10px;
        right: 10px;
        transform: translateY(-50%);
        max-width: none;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 10px;
    }
    
    .sidebar, .discovery-panel {
        padding: 10px;
    }
    
    .elements-list, .discoveries-list {
        grid-template-columns: 1fr;
    }
    
    .tutorial-content {
        margin: 20px;
        padding: 1.5rem;
    }
    
    .tutorial-step {
        flex-direction: column;
        text-align: center;
    }
    
    .tutorial-image {
        margin: 0 0 0.5rem 0;
    }
}
