/* Stunning Modern UI for Fusion Battlegrounds */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Roboto', sans-serif;
    background:
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%),
        linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    color: white;
    overflow: hidden;
    height: 100vh;
    position: relative;
}

/* Animated background particles */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(2px 2px at 20px 30px, rgba(255, 255, 255, 0.1), transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255, 255, 255, 0.05), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(255, 255, 255, 0.08), transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255, 255, 255, 0.03), transparent);
    background-repeat: repeat;
    background-size: 150px 100px;
    animation: sparkle 20s linear infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes sparkle {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-100px); }
}

/* Enhanced Loading and Menu Screens */
#loading-screen, #main-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: inherit;
    z-index: 1000;
    backdrop-filter: blur(20px);
}

.loading-content, .menu-content {
    text-align: center;
    color: white;
    z-index: 2;
    position: relative;
}

.game-title {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    letter-spacing: 2px;
}

.game-subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
    font-weight: 300;
    letter-spacing: 1px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #4ecdc4;
    border-right: 4px solid #ff6b6b;
    border-radius: 50%;
    animation: spin 1s linear infinite, pulse 2s ease-in-out infinite;
    margin: 30px auto;
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.3);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 2rem;
}

.menu-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 18px 36px;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
}

.menu-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.menu-btn:hover::before {
    left: 100%;
}

.menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #4ecdc4;
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(78, 205, 196, 0.3);
}

.menu-btn.primary {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    border-color: #4ecdc4;
    box-shadow: 0 5px 20px rgba(78, 205, 196, 0.4);
}

.menu-btn.primary:hover {
    background: linear-gradient(135deg, #44a08d, #4ecdc4);
    box-shadow: 0 15px 40px rgba(78, 205, 196, 0.6);
}

/* Enhanced Game Interface */
#game-interface {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    z-index: 2;
    position: relative;
}

#game-header {
    background: rgba(0, 0, 0, 0.4);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(30px);
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#player-info {
    display: flex;
    gap: 25px;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.stat-icon {
    font-size: 20px;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
}

.health-bar {
    width: 100px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-left: 8px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Enhanced Buttons */
.action-btn, .primary-btn, .clear-btn, .fuse-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
}

.action-btn::before, .primary-btn::before, .clear-btn::before, .fuse-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.action-btn:hover::before, .clear-btn:hover::before {
    left: 100%;
}

.action-btn:hover, .clear-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.1);
}

.primary-btn {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    border-color: #4ecdc4;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

.primary-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #44a08d, #4ecdc4);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(78, 205, 196, 0.5);
}

.primary-btn:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
    box-shadow: none;
}

.fuse-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    border-color: #ff6b6b;
    font-weight: 700;
    padding: 14px 28px;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.fuse-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #ee5a24, #ff6b6b);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 107, 107, 0.6);
}

/* Main Game Area - Simple 2 Panel Layout */
#main-game-area {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
    gap: 16px;
    padding: 16px;
    overflow: hidden;
    min-height: 0;
}

#shop-section {
    grid-area: 1 / 1 / 2 / 2;
}

#board-section {
    grid-area: 1 / 2 / 2 / 3;
}

.game-panel {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(30px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.game-panel:hover {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.panel-header {
    background: rgba(0, 0, 0, 0.2);
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0;
    font-size: 18px;
    color: white;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Elements Grid */
.elements-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    padding: 12px;
    overflow-y: auto;
}

/* Shop Grid - 3 elements only */
.shop-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

/* Army Panel Enhancements */
.army-panel {
    position: relative;
}

.army-instructions {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.army-instructions.sell-mode {
    color: #ffd700;
    font-weight: 600;
}

/* Shop and Army Actions */
.shop-actions, .army-actions {
    display: flex;
    gap: 8px;
}

/* Stunning Element Cards */
.element-card {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    cursor: grab;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.element-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.element-card:hover::before {
    opacity: 1;
}

.element-card:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: #4ecdc4;
    box-shadow: 0 15px 40px rgba(78, 205, 196, 0.4);
}

.element-card:active {
    cursor: grabbing;
    transform: translateY(-2px) scale(0.98);
}

.element-cost {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #1a1a1a;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.element-tier {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.element-emoji {
    font-size: 40px;
    margin: 12px 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-3px); }
}

.element-name {
    font-weight: 700;
    font-size: 15px;
    margin: 8px 0;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
}

.element-stats {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 8px;
    font-weight: 600;
}

.element-attack, .element-health {
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
}

.element-passive {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 6px;
    padding: 4px 6px;
    background: rgba(155, 89, 182, 0.2);
    border-radius: 6px;
    border: 1px solid rgba(155, 89, 182, 0.3);
    text-align: center;
    font-weight: 600;
    cursor: help;
    transition: all 0.3s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.element-passive:hover {
    background: rgba(155, 89, 182, 0.3);
    border-color: rgba(155, 89, 182, 0.5);
    transform: scale(1.02);
}

/* Passive Tooltip */
.element-card:hover .element-passive::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
    border: 1px solid rgba(155, 89, 182, 0.5);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    animation: tooltipAppear 0.3s ease-out;
}

@keyframes tooltipAppear {
    0% { opacity: 0; transform: translateX(-50%) translateY(5px); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Enhanced Tier-based styling */
.element-card.tier-1 {
    border-color: #95a5a6;
    background: rgba(149, 165, 166, 0.1);
}

.element-card.tier-2 {
    border-color: #3498db;
    background: rgba(52, 152, 219, 0.1);
    box-shadow: 0 4px 20px rgba(52, 152, 219, 0.2);
}

.element-card.tier-3 {
    border-color: #9b59b6;
    background: rgba(155, 89, 182, 0.1);
    box-shadow: 0 4px 20px rgba(155, 89, 182, 0.2);
}

.element-card.tier-4 {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    box-shadow: 0 4px 20px rgba(231, 76, 60, 0.2);
}

.element-card.tier-5 {
    border-color: #f39c12;
    background: rgba(243, 156, 18, 0.1);
    box-shadow: 0 4px 20px rgba(243, 156, 18, 0.3);
    animation: tier5Pulse 2s ease-in-out infinite;
}

.element-card.tier-6 {
    border: 2px solid transparent;
    background: linear-gradient(135deg, rgba(241, 196, 15, 0.2), rgba(230, 126, 34, 0.2), rgba(231, 76, 60, 0.2));
    background-size: 400% 400%;
    animation: tier6Glow 3s ease-in-out infinite, gradientShift 4s ease infinite;
    position: relative;
}

.element-card.tier-6::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #f1c40f, #e67e22, #e74c3c, #f1c40f);
    background-size: 400% 400%;
    border-radius: 18px;
    z-index: -1;
    animation: gradientShift 3s ease infinite;
}

@keyframes tier5Pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes tier6Glow {
    0% { box-shadow: 0 0 20px rgba(241, 196, 15, 0.5), 0 0 40px rgba(230, 126, 34, 0.3); }
    50% { box-shadow: 0 0 30px rgba(230, 126, 34, 0.7), 0 0 60px rgba(231, 76, 60, 0.4); }
    100% { box-shadow: 0 0 20px rgba(241, 196, 15, 0.5), 0 0 40px rgba(230, 126, 34, 0.3); }
}

/* Enhanced Drop Zones */
.board-drop-zone {
    min-height: 200px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    position: relative;
    transition: all 0.3s ease;
}

.board-drop-zone::before {
    content: 'Drop elements here to build your army';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.3);
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.board-drop-zone:empty::before {
    opacity: 1;
}

.board-drop-zone.drag-over {
    border-color: #4ecdc4;
    background: rgba(78, 205, 196, 0.08);
    box-shadow: inset 0 0 20px rgba(78, 205, 196, 0.2);
    transform: scale(1.01);
}

.board-drop-zone.drag-over::before {
    color: #4ecdc4;
    opacity: 1;
}









/* Enhanced Alchemy Laboratory */
#alchemy-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    position: relative;
    background: radial-gradient(circle at center, rgba(155, 89, 182, 0.05) 0%, transparent 70%);
}

#alchemy-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(2px 2px at 20px 30px, rgba(155, 89, 182, 0.2), transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(142, 68, 173, 0.15), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(155, 89, 182, 0.1), transparent);
    background-repeat: repeat;
    background-size: 100px 80px;
    animation: alchemySparkle 15s linear infinite;
    pointer-events: none;
    opacity: 0.6;
}

@keyframes alchemySparkle {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-80px); }
}

.alchemy-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.alchemy-counter {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.2), rgba(142, 68, 173, 0.3));
    padding: 6px 16px;
    border-radius: 16px;
    font-weight: 800;
    font-size: 16px;
    border: 2px solid rgba(155, 89, 182, 0.4);
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.3);
    backdrop-filter: blur(10px);
    color: #e1bee7;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    animation: counterPulse 2s ease-in-out infinite;
}

@keyframes counterPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 15px rgba(155, 89, 182, 0.3); }
    50% { transform: scale(1.05); box-shadow: 0 6px 25px rgba(155, 89, 182, 0.5); }
}

.alchemy-progress {
    width: 100px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(155, 89, 182, 0.2);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(155, 89, 182, 0.3);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #9b59b6, #e1bee7, #9b59b6);
    background-size: 200% 100%;
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    animation: progressShimmer 2s linear infinite;
}

@keyframes progressShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.alchemy-apparatus {
    position: relative;
    width: 140px;
    height: 160px;
    margin-bottom: 20px;
    filter: drop-shadow(0 8px 16px rgba(155, 89, 182, 0.3));
    transition: all 0.5s ease;
}

.alchemy-apparatus.apparatus-ready {
    filter: drop-shadow(0 12px 24px rgba(155, 89, 182, 0.6));
    animation: apparatusReady 2s ease-in-out infinite;
}

@keyframes apparatusReady {
    0%, 100% {
        filter: drop-shadow(0 12px 24px rgba(155, 89, 182, 0.6));
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 16px 32px rgba(155, 89, 182, 0.8));
        transform: scale(1.02);
    }
}

.alchemy-apparatus::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: radial-gradient(circle, rgba(155, 89, 182, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    animation: apparatusGlow 3s ease-in-out infinite alternate;
}

@keyframes apparatusGlow {
    0% { opacity: 0.3; transform: scale(1); }
    100% { opacity: 0.7; transform: scale(1.1); }
}

.alchemy-flask {
    position: absolute;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 90px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    border: 3px solid rgba(155, 89, 182, 0.4);
    border-radius: 0 0 35px 35px;
    overflow: hidden;
    backdrop-filter: blur(15px);
    box-shadow:
        inset 0 2px 10px rgba(255, 255, 255, 0.2),
        0 4px 20px rgba(155, 89, 182, 0.3);
    position: relative;
}

.alchemy-flask::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), transparent);
    border-radius: 0 0 10px 10px;
}

.alchemy-flask::after {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.6), rgba(142, 68, 173, 0.8));
    border: 2px solid rgba(155, 89, 182, 0.8);
    border-radius: 50% 50% 0 0;
    box-shadow: 0 2px 8px rgba(155, 89, 182, 0.4);
}

.flask-liquid {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0%;
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
    transition: height 1.2s cubic-bezier(0.4, 0, 0.2, 1), background 0.8s ease;
    border-radius: 0 0 32px 32px;
    box-shadow:
        0 0 20px rgba(155, 89, 182, 0.5),
        inset 0 2px 10px rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.flask-liquid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 100%);
    animation: liquidShimmer 3s ease-in-out infinite;
}

@keyframes liquidShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.flask-liquid::after {
    content: '';
    position: absolute;
    top: -2px;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    animation: liquidSurface 2s ease-in-out infinite;
}

@keyframes liquidSurface {
    0%, 100% { transform: scaleX(1); opacity: 0.4; }
    50% { transform: scaleX(1.1); opacity: 0.7; }
}

.flask-bubbles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 2;
}

.bubble {
    position: absolute;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.3) 100%);
    border-radius: 50%;
    animation: bubble-rise 3s infinite ease-in-out;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.bubble:nth-child(1) {
    left: 25%;
    width: 6px;
    height: 6px;
    animation-delay: 0s;
    animation-duration: 2.5s;
}

.bubble:nth-child(2) {
    left: 50%;
    width: 4px;
    height: 4px;
    animation-delay: 0.8s;
    animation-duration: 3s;
}

.bubble:nth-child(3) {
    left: 75%;
    width: 5px;
    height: 5px;
    animation-delay: 1.6s;
    animation-duration: 2.8s;
}

@keyframes bubble-rise {
    0% {
        bottom: 0;
        opacity: 0;
        transform: scale(0.3) translateX(0);
    }
    10% {
        opacity: 1;
        transform: scale(1) translateX(0);
    }
    90% {
        opacity: 0.8;
        transform: scale(0.8) translateX(10px);
    }
    100% {
        bottom: 90px;
        opacity: 0;
        transform: scale(0.2) translateX(-5px);
    }
}

.alchemy-tubes {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 35px;
}

.tube {
    position: absolute;
    width: 10px;
    height: 30px;
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.3), rgba(142, 68, 173, 0.5));
    border: 2px solid rgba(155, 89, 182, 0.6);
    border-radius: 5px;
    box-shadow:
        inset 0 1px 3px rgba(255, 255, 255, 0.3),
        0 2px 8px rgba(155, 89, 182, 0.4);
    position: relative;
    overflow: hidden;
}

.tube::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(180deg,
        rgba(155, 89, 182, 0.8) 0%,
        rgba(155, 89, 182, 0.4) 50%,
        rgba(155, 89, 182, 0.8) 100%);
    animation: tubeFlow 2s ease-in-out infinite;
}

@keyframes tubeFlow {
    0%, 100% { transform: translateY(-100%); }
    50% { transform: translateY(0%); }
}

.tube-1 {
    left: 15px;
    transform: rotate(-20deg);
    animation-delay: 0s;
}

.tube-1::before {
    animation-delay: 0.2s;
}

.tube-2 {
    left: 55px;
    transform: rotate(0deg);
    animation-delay: 0.3s;
}

.tube-2::before {
    animation-delay: 0.5s;
}

.tube-3 {
    right: 15px;
    transform: rotate(20deg);
    animation-delay: 0.6s;
}

.tube-3::before {
    animation-delay: 0.8s;
}

.alchemy-base {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 90px;
    height: 25px;
    background: linear-gradient(135deg, #8b4513, #a0522d, #cd853f);
    border-radius: 12px;
    border: 2px solid rgba(160, 82, 45, 0.8);
    box-shadow:
        inset 0 2px 5px rgba(205, 133, 63, 0.6),
        0 4px 15px rgba(139, 69, 19, 0.5);
    position: relative;
}

.alchemy-base::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    height: 8px;
    background: linear-gradient(90deg, rgba(205, 133, 63, 0.8), rgba(160, 82, 45, 0.6));
    border-radius: 8px;
}

.base-flame {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 25px;
    background: radial-gradient(ellipse at bottom,
        #ff4757 0%,
        #ff6b6b 30%,
        #ffa502 60%,
        #ff7675 80%,
        transparent 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flame-flicker 1.2s ease-in-out infinite;
    filter: blur(0.5px);
}

.base-flame::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 15px;
    background: radial-gradient(ellipse at bottom,
        #ff3742 0%,
        #ff4757 50%,
        transparent 100%);
    border-radius: 50% 50% 50% 50% / 70% 70% 30% 30%;
    animation: flame-core 0.8s ease-in-out infinite alternate;
}

.base-flame::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 8px;
    background: radial-gradient(ellipse, rgba(255, 71, 87, 0.6) 0%, transparent 70%);
    border-radius: 50%;
    animation: flame-glow 1.5s ease-in-out infinite;
}

@keyframes flame-flicker {
    0% {
        transform: translateX(-50%) scale(1) rotate(-3deg);
        opacity: 0.9;
    }
    25% {
        transform: translateX(-48%) scale(1.05) rotate(2deg);
        opacity: 1;
    }
    50% {
        transform: translateX(-52%) scale(0.95) rotate(-1deg);
        opacity: 0.95;
    }
    75% {
        transform: translateX(-49%) scale(1.1) rotate(3deg);
        opacity: 1;
    }
    100% {
        transform: translateX(-51%) scale(1.02) rotate(-2deg);
        opacity: 0.9;
    }
}

@keyframes flame-core {
    0% { transform: translateX(-50%) scale(1); opacity: 1; }
    100% { transform: translateX(-50%) scale(1.2); opacity: 0.8; }
}

@keyframes flame-glow {
    0%, 100% { opacity: 0.4; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.8; transform: translateX(-50%) scale(1.2); }
}

.alchemy-slots {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding: 8px;
    background: rgba(155, 89, 182, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(155, 89, 182, 0.2);
}

.alchemy-slot {
    width: 48px;
    height: 48px;
    border: 3px dashed rgba(155, 89, 182, 0.4);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(155, 89, 182, 0.03);
    backdrop-filter: blur(5px);
    box-shadow: inset 0 2px 4px rgba(155, 89, 182, 0.1);
}

.alchemy-slot::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg,
        transparent,
        rgba(155, 89, 182, 0.3),
        transparent,
        rgba(142, 68, 173, 0.3),
        transparent);
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: slotShimmer 3s linear infinite;
}

@keyframes slotShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.alchemy-slot.drag-over {
    border-color: #9b59b6;
    border-style: solid;
    background: rgba(155, 89, 182, 0.15);
    box-shadow:
        0 0 20px rgba(155, 89, 182, 0.5),
        inset 0 2px 10px rgba(155, 89, 182, 0.2);
    transform: scale(1.1) rotate(2deg);
}

.alchemy-slot.drag-over::before {
    opacity: 1;
}

.alchemy-slot.filled {
    border-color: #9b59b6;
    border-style: solid;
    background: rgba(155, 89, 182, 0.1);
    box-shadow:
        0 0 15px rgba(155, 89, 182, 0.4),
        inset 0 2px 8px rgba(155, 89, 182, 0.3);
    animation: filledPulse 2s ease-in-out infinite;
}

@keyframes filledPulse {
    0%, 100% {
        box-shadow:
            0 0 15px rgba(155, 89, 182, 0.4),
            inset 0 2px 8px rgba(155, 89, 182, 0.3);
    }
    50% {
        box-shadow:
            0 0 25px rgba(155, 89, 182, 0.6),
            inset 0 2px 12px rgba(155, 89, 182, 0.4);
    }
}

.slot-number {
    font-size: 12px;
    color: rgba(155, 89, 182, 0.6);
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    animation: numberFloat 2s ease-in-out infinite;
}

@keyframes numberFloat {
    0%, 100% { transform: translateY(0px); opacity: 0.6; }
    50% { transform: translateY(-2px); opacity: 1; }
}

.alchemy-slot.filled .slot-number {
    display: none;
}

.alchemy-slot .slot-emoji {
    font-size: 24px;
    animation: slotElementGlow 1s ease-out;
    filter: drop-shadow(0 0 8px rgba(155, 89, 182, 0.6));
}

@keyframes slotElementGlow {
    0% {
        transform: scale(0) rotate(180deg);
        opacity: 0;
        filter: drop-shadow(0 0 20px rgba(155, 89, 182, 1));
    }
    50% {
        transform: scale(1.3) rotate(90deg);
        opacity: 0.8;
        filter: drop-shadow(0 0 15px rgba(155, 89, 182, 0.8));
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
        filter: drop-shadow(0 0 8px rgba(155, 89, 182, 0.6));
    }
}

.extract-btn {
    background: linear-gradient(135deg, #9b59b6, #8e44ad, #7b1fa2);
    border: 2px solid #9b59b6;
    color: white;
    padding: 14px 28px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 16px;
    font-weight: 800;
    backdrop-filter: blur(20px);
    box-shadow:
        0 6px 20px rgba(155, 89, 182, 0.4),
        inset 0 1px 3px rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.extract-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent);
    transition: left 0.5s;
}

.extract-btn:hover:not(:disabled)::before {
    left: 100%;
}

.extract-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #8e44ad, #7b1fa2, #9b59b6);
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 12px 40px rgba(155, 89, 182, 0.6),
        inset 0 1px 3px rgba(255, 255, 255, 0.3);
    border-color: #e1bee7;
}

.extract-btn:active:not(:disabled) {
    transform: translateY(-1px) scale(0.98);
    box-shadow:
        0 6px 20px rgba(155, 89, 182, 0.4),
        inset 0 2px 6px rgba(0, 0, 0, 0.2);
}

.extract-btn:disabled {
    background: rgba(155, 89, 182, 0.1);
    color: rgba(155, 89, 182, 0.4);
    cursor: not-allowed;
    box-shadow: none;
    border-color: rgba(155, 89, 182, 0.2);
}

.extract-btn:not(:disabled) {
    animation: extractReady 2s ease-in-out infinite;
}

@keyframes extractReady {
    0%, 100% {
        box-shadow:
            0 6px 20px rgba(155, 89, 182, 0.4),
            inset 0 1px 3px rgba(255, 255, 255, 0.2);
    }
    50% {
        box-shadow:
            0 8px 30px rgba(155, 89, 182, 0.6),
            inset 0 1px 3px rgba(255, 255, 255, 0.3);
    }
}

@keyframes extracting {
    0% {
        transform: translateY(0) scale(1);
        background: linear-gradient(135deg, #9b59b6, #8e44ad, #7b1fa2);
    }
    25% {
        transform: translateY(-2px) scale(1.05);
        background: linear-gradient(135deg, #e1bee7, #9b59b6, #8e44ad);
    }
    50% {
        transform: translateY(0) scale(0.95);
        background: linear-gradient(135deg, #7b1fa2, #e1bee7, #9b59b6);
    }
    75% {
        transform: translateY(-1px) scale(1.02);
        background: linear-gradient(135deg, #9b59b6, #7b1fa2, #e1bee7);
    }
    100% {
        transform: translateY(0) scale(1);
        background: linear-gradient(135deg, #8e44ad, #9b59b6, #7b1fa2);
    }
}

@keyframes extraction {
    0% {
        transform: scale(1) rotate(0deg);
        filter: drop-shadow(0 12px 24px rgba(155, 89, 182, 0.6));
    }
    25% {
        transform: scale(1.05) rotate(1deg);
        filter: drop-shadow(0 16px 32px rgba(155, 89, 182, 0.8));
    }
    50% {
        transform: scale(1.1) rotate(-1deg);
        filter: drop-shadow(0 20px 40px rgba(155, 89, 182, 1));
    }
    75% {
        transform: scale(1.05) rotate(0.5deg);
        filter: drop-shadow(0 16px 32px rgba(155, 89, 182, 0.8));
    }
    100% {
        transform: scale(1) rotate(0deg);
        filter: drop-shadow(0 12px 24px rgba(155, 89, 182, 0.6));
    }
}

@keyframes particleBurst {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    20% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(
            calc(-50% + ${Math.random() * 200 - 100}px),
            calc(-50% + ${Math.random() * 200 - 100}px)
        ) scale(0);
        opacity: 0;
    }
}

.alchemy-particle {
    box-shadow: 0 0 10px rgba(155, 89, 182, 0.8);
}

/* Click-to-Fuse Selection System */
.element-card.selected-for-fusion {
    border-color: #4ecdc4 !important;
    background: rgba(78, 205, 196, 0.15) !important;
    box-shadow:
        0 0 20px rgba(78, 205, 196, 0.6),
        inset 0 2px 10px rgba(78, 205, 196, 0.2) !important;
    transform: translateY(-3px) scale(1.02);
    animation: selectedPulse 1.5s ease-in-out infinite;
}

@keyframes selectedPulse {
    0%, 100% {
        box-shadow:
            0 0 20px rgba(78, 205, 196, 0.6),
            inset 0 2px 10px rgba(78, 205, 196, 0.2);
    }
    50% {
        box-shadow:
            0 0 30px rgba(78, 205, 196, 0.8),
            inset 0 2px 15px rgba(78, 205, 196, 0.3);
    }
}

.element-card.selected-for-fusion::before {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: #4ecdc4;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
    animation: checkmarkAppear 0.3s ease-out;
}

@keyframes checkmarkAppear {
    0% { transform: scale(0) rotate(180deg); opacity: 0; }
    50% { transform: scale(1.2) rotate(90deg); opacity: 0.8; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Fusion Particles */
@keyframes fusionBurst {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    20% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(
            calc(-50% + ${Math.random() * 150 - 75}px),
            calc(-50% + ${Math.random() * 150 - 75}px)
        ) scale(0);
        opacity: 0;
    }
}

.fusion-particle {
    box-shadow: 0 0 8px rgba(78, 205, 196, 0.8);
}

/* Board interaction hints */
#board-elements::after {
    content: 'Click two elements to fuse them together';
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#board-elements:empty::after {
    opacity: 1;
}

#board-elements {
    position: relative;
}

/* Alchemy Page */
#alchemy-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.alchemy-header {
    background: rgba(0, 0, 0, 0.4);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(30px);
    flex-shrink: 0;
}

.alchemy-header h2 {
    margin: 0;
    font-size: 24px;
    color: white;
    font-weight: 700;
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.alchemy-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
}

.alchemy-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(30px);
    padding: 30px;
}

.alchemy-army {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(30px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.alchemy-instructions {
    padding: 16px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    background: rgba(155, 89, 182, 0.1);
    border-top: 1px solid rgba(155, 89, 182, 0.2);
}

/* Sell Mode */
.element-card.sell-mode {
    border-color: #ffd700 !important;
    background: rgba(255, 215, 0, 0.1) !important;
    cursor: pointer;
}

.element-card.sell-mode:hover {
    border-color: #ffed4e !important;
    background: rgba(255, 215, 0, 0.2) !important;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4) !important;
}

.element-card.sell-mode::after {
    content: '💰';
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 16px;
    z-index: 10;
}

/* Multiplayer UI */
.multiplayer-content {
    padding: 20px;
    max-width: 500px;
    margin: 0 auto;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: statusPulse 2s ease-in-out infinite;
}

.status-indicator.disconnected {
    background: #ff6b6b;
}

.status-indicator.connecting {
    background: #ffd93d;
}

.status-indicator.connected {
    background: #6bcf7f;
}

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

.player-setup {
    text-align: center;
}

.player-setup input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 16px;
}

.player-setup input:focus {
    border-color: #4ecdc4;
    outline: none;
    box-shadow: 0 0 10px rgba(78, 205, 196, 0.3);
}

.game-modes {
    display: grid;
    gap: 12px;
    margin: 20px 0;
}

.mode-btn {
    padding: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #4ecdc4;
    transform: translateY(-2px);
}

.mode-btn span {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 4px;
}

.room-section {
    text-align: center;
}

.room-settings {
    margin: 15px 0;
    text-align: left;
}

.room-settings label {
    display: block;
    margin: 10px 0;
    color: rgba(255, 255, 255, 0.8);
}

.waiting-room {
    text-align: center;
}

.room-info {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 8px;
    margin: 15px 0;
}

.players-list {
    display: grid;
    gap: 10px;
    margin: 20px 0;
}

.player-slot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.player-avatar {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.player-info {
    flex: 1;
    text-align: left;
}

.player-name {
    font-weight: 600;
    color: white;
}

.player-status {
    font-size: 12px;
    margin-top: 2px;
}

.player-status.ready {
    color: #6bcf7f;
}

.player-status.waiting {
    color: #ffd93d;
}

.match-overlay {
    position: fixed;
    top: 80px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 16px;
    backdrop-filter: blur(20px);
    z-index: 1000;
    min-width: 250px;
}

.match-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.opponent-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.opponent-details {
    text-align: left;
}

.opponent-name {
    font-weight: 600;
    color: white;
}

.opponent-status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.timer-circle {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top: 3px solid #4ecdc4;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: timerSpin 1s linear infinite;
}

@keyframes timerSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.match-phase {
    text-align: center;
    color: #4ecdc4;
    font-weight: 600;
    font-size: 14px;
}

/* Battle Log */
.log-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    font-size: 13px;
    line-height: 1.4;
}

.log-entry {
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

/* Modals */
.modal {
    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: 2000;
    backdrop-filter: blur(10px);
}

.modal-content {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    margin: 0;
    color: white;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 20px;
}

.tutorial-step {
    margin-bottom: 20px;
    color: white;
}

.tutorial-step h3 {
    color: #4ecdc4;
    margin-bottom: 8px;
}

.tutorial-step p {
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item label {
    font-weight: 500;
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Battle Screen */
#battle-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1500;
}

.battle-content {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    padding: 30px;
    text-align: center;
    color: white;
    max-width: 800px;
    width: 90%;
}

.battle-arena {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: center;
    margin: 30px 0;
}

.vs-text {
    font-size: 2rem;
    font-weight: bold;
    color: #4ecdc4;
    padding: 20px;
    border: 3px solid #4ecdc4;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#battle-player-board, #battle-enemy-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 8px;
    min-height: 100px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.army-power {
    font-size: 1.2rem;
    font-weight: bold;
    color: #4ecdc4;
    margin-top: 10px;
}

.battle-result {
    font-size: 1.3rem;
    font-weight: bold;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    border: 2px solid;
}

.battle-result.victory {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
    border-color: #4caf50;
}

.battle-result.defeat {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
    border-color: #f44336;
}

/* Notifications */
#notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid #4ecdc4;
    backdrop-filter: blur(10px);
}

.notification.success {
    border-left-color: #4caf50;
}

.notification.error {
    border-left-color: #f44336;
}

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

/* Utility Classes */
.hidden { display: none !important; }

/* Responsive adjustments */
@media (max-width: 1200px) {
    .elements-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .element-card {
        min-height: 120px;
        padding: 8px;
    }

    .element-emoji {
        font-size: 24px;
    }

    .alchemy-apparatus {
        width: 100px;
        height: 120px;
    }

    .alchemy-flask {
        width: 50px;
        height: 70px;
    }

    .alchemy-slots {
        gap: 6px;
    }

    .alchemy-slot {
        width: 35px;
        height: 35px;
    }
}

@media (max-width: 900px) {
    #main-game-area {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        gap: 12px;
    }

    #shop-section { grid-area: 1 / 1 / 2 / 2; }
    #board-section { grid-area: 2 / 1 / 3 / 2; }

    .alchemy-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .shop-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
