/* === Futuristic Medieval Horror Theme === */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Orbitron:wght@400;500;700;900&display=swap');

:root {
    --bg-dark: #0a0e1a;
    --bg-darker: #050810;
    --accent-blood: #8b0000;
    --accent-gold: #d4af37;
    --accent-cyber: #00ffff;
    --text-primary: #e8dcc4;
    --text-glow: #ff6b35;
    --border-glow: #1a1a2e;
    --card-bg: #0f1419;
    --horror-red: #6b0f1a;
}

/* === Base === */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Cinzel', serif;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 50%, #0d0221 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(139, 0, 0, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 255, 255, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15) 0px,
        transparent 1px,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 3px
    );
    pointer-events: none;
    opacity: 0.03;
    z-index: 1;
    animation: scanlines 8s linear infinite;
}

@keyframes scanlines {
    0% { transform: translateY(0); }
    100% { transform: translateY(10px); }
}

main {
    position: relative;
    z-index: 2;
}

/* === Header === */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, rgba(26, 26, 46, 0.95) 0%, rgba(15, 20, 25, 0.95) 100%);
    padding: 20px 30px;
    border-bottom: 2px solid var(--accent-cyber);
    box-shadow: 0 4px 20px rgba(0, 255, 255, 0.2), 0 0 40px rgba(139, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    position: relative;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-cyber), transparent);
    opacity: 0.5;
}

header h1 {
    font-family: 'Orbitron', sans-serif;
    background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-cyber) 50%, var(--accent-blood) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(0, 255, 255, 0.6)); }
    50% { filter: drop-shadow(0 0 20px rgba(139, 0, 0, 0.8)); }
}

.search-bar input {
    padding: 10px 15px;
    border: 2px solid rgba(0, 255, 255, 0.3);
    background: rgba(10, 14, 26, 0.9);
    color: var(--text-primary);
    border-radius: 4px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--accent-cyber);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4), inset 0 0 10px rgba(0, 255, 255, 0.1);
}

.search-bar button {
    padding: 10px 20px;
    margin-left: 8px;
    background: linear-gradient(135deg, var(--accent-blood), #4a0e0e);
    border: 2px solid var(--accent-gold);
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.search-bar button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.search-bar button:hover::before {
    width: 300px;
    height: 300px;
}

.search-bar button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.6), 0 0 40px rgba(139, 0, 0, 0.4);
    border-color: var(--accent-cyber);
}

/* === Player Info === */
#player-info {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.8), rgba(15, 20, 25, 0.8));
    margin: 20px;
    padding: 15px 20px;
    border-radius: 0;
    border: 2px solid var(--accent-gold);
    border-left: 6px solid var(--accent-blood);
    border-right: 6px solid var(--accent-cyber);
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(212, 175, 55, 0.1);
}

#player-info::before,
#player-info::after {
    content: '⚔';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: var(--accent-gold);
    opacity: 0.5;
}

#player-info::before { left: 10px; }
#player-info::after { right: 10px; content: '🗡'; }

#player-info strong {
    color: var(--accent-cyber);
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* === Buttons === */
.api-buttons {
    margin: 30px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.api-buttons button {
    background: linear-gradient(135deg, #1a1a2e 0%, #0f1419 100%);
    color: var(--text-primary);
    border: 2px solid var(--accent-gold);
    padding: 12px 24px;
    border-radius: 0;
    font-weight: bold;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(212, 175, 55, 0.1);
}

.api-buttons button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.api-buttons button:hover::before {
    left: 100%;
}

.api-buttons button:hover {
    transform: translateY(-2px);
    border-color: var(--accent-cyber);
    box-shadow: 0 6px 25px rgba(0, 255, 255, 0.4), 0 0 30px rgba(139, 0, 0, 0.3);
    color: var(--accent-cyber);
}

.api-buttons button:active {
    transform: translateY(0);
}

/* === Cards === */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    padding: 30px;
}

.card {
    background: linear-gradient(135deg, rgba(15, 20, 25, 0.95), rgba(26, 26, 46, 0.95));
    border: 2px solid rgba(212, 175, 55, 0.4);
    border-radius: 0;
    padding: 12px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7), inset 0 0 15px rgba(0, 255, 255, 0.05);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%);
}

.card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--accent-blood), var(--accent-gold), var(--accent-cyber));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%);
}

.card:hover::before {
    opacity: 0.3;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--accent-cyber);
    box-shadow: 0 15px 40px rgba(0, 255, 255, 0.3), 0 0 30px rgba(139, 0, 0, 0.3);
}

.card img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    border: 2px solid rgba(212, 175, 55, 0.3);
    filter: brightness(0.9) contrast(1.1);
    transition: all 0.3s ease;
}

.card:hover img {
    filter: brightness(1.1) contrast(1.2);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
}

.card h3 {
    margin: 12px 0 6px 0;
    font-family: 'Orbitron', sans-serif;
    color: var(--accent-gold);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.card p {
    margin: 4px 0;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
}

.fight-button {
    display: block;
    margin: 15px auto;
    background: linear-gradient(135deg, var(--horror-red), var(--accent-blood));
    color: var(--text-primary);
    border: 3px solid var(--accent-gold);
    padding: 18px 40px;
    border-radius: 0;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3em;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(139, 0, 0, 0.5), inset 0 0 20px rgba(212, 175, 55, 0.2);
    text-transform: uppercase;
    letter-spacing: 3px;
    position: relative;
    overflow: hidden;
}

.fight-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(transparent, rgba(0, 255, 255, 0.3), transparent 30%);
    animation: fightRotate 3s linear infinite;
}

@keyframes fightRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fight-button:hover {
    transform: scale(1.08);
    border-color: var(--accent-cyber);
    box-shadow: 0 12px 35px rgba(0, 255, 255, 0.5), 0 0 50px rgba(139, 0, 0, 0.7);
}

/* Enhanced Rarity-based glows */
.card[data-rarity="Common"] {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7), 0 0 15px rgba(150, 150, 150, 0.2);
}

.card[data-rarity="Common"]:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(150, 150, 150, 0.4);
}

.card[data-rarity="Rare"] {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 191, 255, 0.4);
    border-color: rgba(0, 191, 255, 0.5);
}

.card[data-rarity="Rare"]:hover {
    box-shadow: 0 15px 40px rgba(0, 191, 255, 0.3), 0 0 35px rgba(0, 191, 255, 0.6);
}

.card[data-rarity="Epic"] {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7), 0 0 25px rgba(163, 53, 238, 0.5);
    border-color: rgba(163, 53, 238, 0.6);
}

.card[data-rarity="Epic"]:hover {
    box-shadow: 0 15px 40px rgba(163, 53, 238, 0.4), 0 0 40px rgba(163, 53, 238, 0.7);
}

.card[data-rarity="Legendary"] {
    box-shadow: 0 8px 25px rgba(139, 0, 0, 0.5), 0 0 30px rgba(255, 215, 0, 0.6);
    border-color: var(--accent-gold);
    animation: legendary-pulse 3s infinite;
}

.card[data-rarity="Legendary"]:hover {
    box-shadow: 0 15px 40px rgba(255, 215, 0, 0.5), 0 0 50px rgba(255, 215, 0, 0.8);
}

@keyframes legendary-pulse {
    0% { 
        box-shadow: 0 8px 25px rgba(139, 0, 0, 0.5), 0 0 30px rgba(255, 215, 0, 0.6);
        border-color: var(--accent-gold);
    }
    50% { 
        box-shadow: 0 15px 40px rgba(139, 0, 0, 0.7), 0 0 50px rgba(255, 215, 0, 0.9), 0 0 40px rgba(0, 255, 255, 0.4);
        border-color: var(--accent-cyber);
    }
    100% { 
        box-shadow: 0 8px 25px rgba(139, 0, 0, 0.5), 0 0 30px rgba(255, 215, 0, 0.6);
        border-color: var(--accent-gold);
    }
}

/* Card pack opening animation */
.pack-opening {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.pack-card {
    position: relative;
    width: 200px;
    height: 280px;
    transform-style: preserve-3d;
    transition: transform 1s;
    cursor: pointer;
}

.pack-card.revealed {
    transform: rotateY(180deg);
}

.pack-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
}

.pack-front {
    background: linear-gradient(45deg, #1f2937, #374151);
    font-size: 24px;
    color: white;
}

.pack-back {
    transform: rotateY(180deg);
}

/* Rarity text colors - Enhanced */
.rarity-Common { 
    color: #b0b0b0;
    text-shadow: 0 0 5px rgba(176, 176, 176, 0.5);
}
.rarity-Rare { 
    color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.7);
    font-weight: 600;
}
.rarity-Epic { 
    color: #c77dff;
    text-shadow: 0 0 15px rgba(199, 125, 255, 0.8);
    font-weight: 700;
}
.rarity-Legendary { 
    color: var(--accent-gold);
    text-shadow: 0 0 20px rgba(255, 215, 0, 1);
    font-weight: 900;
    animation: legendary-text 2s infinite;
}

@keyframes legendary-text {
    0%, 100% { text-shadow: 0 0 20px rgba(255, 215, 0, 1); }
    50% { text-shadow: 0 0 30px rgba(255, 215, 0, 1), 0 0 40px rgba(0, 255, 255, 0.5); }
}

/* === Drawn card === */
.card-slot {
    display: flex;
    justify-content: center;
    margin: 25px;
}

.card-slot .card {
    max-width: 280px;
}

/* === Arena === */
#arena {
    text-align: center;
    margin-top: 40px;
    padding: 30px;
    border-top: 3px solid var(--accent-gold);
    background: linear-gradient(180deg, transparent, rgba(26, 26, 46, 0.3));
}

.arena-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    position: relative;
}

.card-slot.small .card {
    max-width: 200px;
}

.vs {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-blood), var(--accent-gold), var(--accent-cyber));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 107, 53, 0.8);
    animation: vsGlow 2s ease-in-out infinite;
}

@keyframes vsGlow {
    0%, 100% { 
        filter: drop-shadow(0 0 15px rgba(139, 0, 0, 0.8));
        transform: scale(1);
    }
    50% { 
        filter: drop-shadow(0 0 30px rgba(0, 255, 255, 0.8));
        transform: scale(1.1);
    }
}

.big-red-button {
    background: linear-gradient(135deg, var(--horror-red) 0%, var(--accent-blood) 100%);
    padding: 20px 50px;
    border: 3px solid var(--accent-gold);
    border-radius: 0;
    color: var(--text-primary);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8em;
    font-weight: 900;
    margin: 30px auto;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    text-shadow: 0 0 15px rgba(255, 107, 53, 0.8);
    box-shadow: 0 10px 30px rgba(139, 0, 0, 0.6), inset 0 0 30px rgba(212, 175, 55, 0.2);
    text-transform: uppercase;
    letter-spacing: 4px;
    position: relative;
    overflow: hidden;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.big-red-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(transparent, rgba(0, 255, 255, 0.4), transparent 30%);
    animation: buttonRotate 4s linear infinite;
}

@keyframes buttonRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.big-red-button:disabled {
    background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
    border-color: #444;
    cursor: not-allowed;
    box-shadow: none;
    color: #666;
    text-shadow: none;
}

.big-red-button:disabled::before {
    display: none;
}

.big-red-button:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.05);
    border-color: var(--accent-cyber);
    box-shadow: 0 15px 50px rgba(0, 255, 255, 0.5), 0 0 60px rgba(139, 0, 0, 0.8);
}

.big-red-button:active:not(:disabled) {
    transform: translateY(-2px) scale(1.03);
}

/* Battle Arena Popup Specific Styles */
.battle-arena {
    text-align: center;
}

.battle-arena .arena-container {
    margin: 30px 0;
    padding: 30px;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.9), rgba(15, 20, 25, 0.9));
    border: 3px solid var(--accent-gold);
    border-radius: 0;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), inset 0 0 30px rgba(212, 175, 55, 0.1);
    clip-path: polygon(20px 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%, 0 20px);
}

.battle-arena .vs {
    font-size: 4rem;
    font-weight: 900;
    text-shadow: 0 0 30px rgba(255, 107, 53, 0.9);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* === Status === */
#game-status {
    text-align: center;
    margin: 15px;
    padding: 10px;
    font-family: 'Orbitron', sans-serif;
    color: var(--accent-cyber);
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* === Footer === */
footer {
    text-align: center;
    font-family: 'Cinzel', serif;
    color: var(--text-primary);
    padding: 30px;
    border-top: 2px solid var(--accent-gold);
    background: linear-gradient(180deg, transparent, rgba(26, 26, 46, 0.5));
    opacity: 0.7;
}

/* Delete mode styles - Horror theme */
.card .card-inner { position: relative; }
.delete-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, var(--horror-red), var(--accent-blood));
    color: var(--text-primary);
    border: 2px solid var(--accent-gold);
    padding: 8px 12px;
    border-radius: 0;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    cursor: pointer;
    display: none;
    z-index: 3;
}

.card.deletable:hover {
    transform: scale(1.02);
}

.card.selected-for-delete {
    outline: 3px solid rgba(215, 58, 73, 0.6);
    box-shadow: 0 4px 12px rgba(215,58,73,0.12);
}

/* ensure delete overlay is visible when deletable */
.card.deletable .delete-overlay {
    display: block;
}

/* Popup Panels - Horror Theme */
.popup-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle, rgba(139, 0, 0, 0.3), rgba(0, 0, 0, 0.95));
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.popup-content {
    background: linear-gradient(135deg, rgba(15, 20, 25, 0.98), rgba(26, 26, 46, 0.98));
    padding: 30px;
    border: 3px solid var(--accent-gold);
    border-radius: 0;
    width: 85%;
    max-width: 900px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 0 100px rgba(0, 255, 255, 0.3), 0 0 60px rgba(139, 0, 0, 0.5);
    clip-path: polygon(15px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%, 0 15px);
    position: relative;
}

.popup-content::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, var(--accent-blood), var(--accent-gold), var(--accent-cyber));
    z-index: -1;
    opacity: 0.3;
    clip-path: polygon(15px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%, 0 15px);
}

.popup-content h2 {
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-cyber));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 25px;
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 3px;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

/* Tabs */
.tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

.tab {
    background: linear-gradient(135deg, #1a1a2e, #0f1419);
    border: 2px solid rgba(212, 175, 55, 0.3);
    padding: 12px 25px;
    color: var(--text-primary);
    font-family: 'Cinzel', serif;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
}

.tab:hover {
    border-color: var(--accent-cyber);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.tab.active {
    background: linear-gradient(135deg, var(--horror-red), var(--accent-blood));
    border-color: var(--accent-gold);
    color: var(--text-primary);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

/* Achievement Items - Horror Theme */
.achievement-item {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.8), rgba(15, 20, 25, 0.8));
    margin: 12px 0;
    padding: 18px;
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: all 0.3s ease;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.achievement-item:hover {
    border-color: var(--accent-cyber);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
    transform: translateX(5px);
}

.achievement-item.completed {
    border-color: var(--accent-gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

.achievement-icon {
    font-size: 28px;
    width: 45px;
    text-align: center;
    filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.5));
}

.achievement-info {
    flex-grow: 1;
    font-family: 'Cinzel', serif;
}

.achievement-info h3 {
    color: var(--accent-gold);
    margin: 0 0 5px 0;
    font-size: 1.1rem;
}

.achievement-progress {
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid rgba(212, 175, 55, 0.3);
    height: 6px;
    width: 100%;
    margin-top: 8px;
    border-radius: 0;
    overflow: hidden;
}

.achievement-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blood), var(--accent-gold), var(--accent-cyber));
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.6);
}

/* Leaderboard Items */
.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin: 8px 0;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.7), rgba(15, 20, 25, 0.7));
    border: 2px solid rgba(212, 175, 55, 0.2);
    border-radius: 0;
    font-family: 'Orbitron', sans-serif;
    transition: all 0.3s ease;
}

.leaderboard-item:hover {
    border-color: var(--accent-cyber);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
    transform: translateX(5px);
}

.rank {
    width: 50px;
    text-align: center;
    font-weight: 900;
    font-size: 1.2rem;
}

.rank-1 { 
    color: var(--accent-gold);
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
}
.rank-2 { 
    color: #c0c0c0;
    text-shadow: 0 0 10px rgba(192, 192, 192, 0.6);
}
.rank-3 { 
    color: #cd7f32;
    text-shadow: 0 0 10px rgba(205, 127, 50, 0.6);
}

.leader-entry {
    color: var(--accent-cyber);
}

/* Achievement Toast - Horror Theme */
.achievement-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, var(--horror-red), var(--accent-blood));
    border: 3px solid var(--accent-gold);
    color: var(--text-primary);
    padding: 20px 30px;
    border-radius: 0;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    transform: translateX(150%);
    transition: transform 0.5s ease;
    z-index: 1001;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 30px rgba(212, 175, 55, 0.5);
}

.achievement-toast.show {
    transform: translateX(0);
}

/* Close button - Horror Theme */
.close-button {
    display: block;
    margin: 25px auto 0;
    padding: 12px 30px;
    background: linear-gradient(135deg, #1a1a2e, #0f1419);
    border: 2px solid var(--accent-gold);
    color: var(--text-primary);
    border-radius: 0;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-button:hover {
    border-color: var(--accent-cyber);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
    transform: translateY(-2px);
}

/* Menu buttons */
.menu-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
}

.menu-buttons button {
    background: linear-gradient(135deg, #1a1a2e, #0f1419);
    border: 2px solid var(--accent-gold);
    padding: 10px 20px;
    color: var(--text-primary);
    font-family: 'Cinzel', serif;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    text-transform: uppercase;
}

.menu-buttons button:hover {
    border-color: var(--accent-cyber);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Position change animation */
@keyframes positionChange {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.position-changed {
    animation: positionChange 0.5s ease;
}

/* Battle popup mode selection - Horror Theme */
.battle-mode-selection {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}
.mode-btn {
    padding: 15px 30px;
    border-radius: 0;
    border: 3px solid var(--accent-gold);
    background: linear-gradient(135deg, #1a1a2e, #0f1419);
    color: var(--text-primary);
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}
.mode-btn:hover { 
    transform: translateY(-3px);
    border-color: var(--accent-cyber);
    box-shadow: 0 8px 30px rgba(0, 255, 255, 0.4), 0 0 40px rgba(139, 0, 0, 0.3);
}

.battle-panel { margin-bottom: 15px; }

.multiplayer-controls { 
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.room-actions { 
    display:flex;
    gap:12px;
    align-items:center;
}
.room-actions input {
    flex: 1;
    background: rgba(10, 14, 26, 0.9);
    border: 2px solid rgba(212, 175, 55, 0.3);
    color: var(--text-primary);
    padding: 10px;
    font-family: 'Orbitron', sans-serif;
}
.room-actions input:focus {
    outline: none;
    border-color: var(--accent-cyber);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}
.room-actions button {
    background: linear-gradient(135deg, var(--horror-red), var(--accent-blood));
    border: 2px solid var(--accent-gold);
    padding: 10px 20px;
    color: var(--text-primary);
    font-family: 'Cinzel', serif;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}
.room-actions button:hover {
    border-color: var(--accent-cyber);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
}
.room-list { 
    max-height:150px;
    overflow:auto;
    border:2px solid rgba(212, 175, 55, 0.3);
    padding:12px;
    background: rgba(15, 20, 25, 0.6);
}
.room-item { 
    padding:10px;
    border-bottom:2px solid rgba(212, 175, 55, 0.2);
    display:flex;
    gap:12px;
    align-items:center;
    font-family: 'Orbitron', sans-serif;
    transition: all 0.3s ease;
}
.room-item:hover {
    background: rgba(26, 26, 46, 0.5);
    border-color: var(--accent-cyber);
}
.current-room { 
    border:3px solid var(--accent-gold);
    padding:15px;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.8), rgba(15, 20, 25, 0.8));
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.3);
}
.current-proposal { 
    margin-top:10px;
    font-weight:700;
    font-family: 'Orbitron', sans-serif;
    color: var(--accent-cyber);
}

.multiplayer-select .card-grid { display:flex; gap:10px; flex-wrap:wrap; max-height:200px; overflow:auto; }
.multiplayer-select .card-list { 
    display:block;
    max-height:240px;
    overflow:auto;
    border:2px solid rgba(212, 175, 55, 0.3);
    padding:10px;
    background: rgba(15, 20, 25, 0.6);
}
.card-list-item { 
    padding:10px 12px;
    border-bottom:2px solid rgba(212, 175, 55, 0.2);
    cursor:pointer;
    display:flex;
    gap:10px;
    align-items:center;
    transition: all 0.3s ease;
    font-family: 'Orbitron', sans-serif;
}
.card-list-item:hover { 
    background: rgba(26, 26, 46, 0.7);
    border-color: var(--accent-cyber);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
}
.card-list-name { 
    color: var(--accent-gold);
    font-weight:700;
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
}
.card-list-meta { 
    color: var(--text-primary);
    font-size:0.85rem;
    opacity: 0.8;
}
.card-list-item.selected-for-fight { 
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.4), rgba(107, 15, 26, 0.4));
    border-left:5px solid var(--accent-cyber);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
}

/* Battle animations */
.card-facedown {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    min-height: 280px;
    border: 2px solid #30363d;
    animation: cardFlip 0.3s ease;
}

.card-flip {
    animation: cardFlipReveal 0.8s ease;
}

@keyframes cardFlipReveal {
    0% { transform: rotateY(90deg); opacity: 0; }
    100% { transform: rotateY(0deg); opacity: 1; }
}

.power-label {
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    margin-bottom: 10px;
    animation: powerPulse 0.5s ease;
}

@keyframes powerPulse {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.attack {
    animation: attackMove 0.5s ease;
}

@keyframes attackMove {
    0% { transform: translateX(0) scale(1); }
    50% { transform: translateX(30px) scale(1.1); }
    100% { transform: translateX(0) scale(1); }
}

.destroyed {
    animation: destroyCard 1s ease forwards;
}

@keyframes destroyCard {
    0% { 
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% { 
        transform: scale(0.8) rotate(10deg);
        opacity: 0.5;
    }
    100% { 
        transform: scale(0.3) rotate(45deg);
        opacity: 0;
        filter: blur(5px);
    }
}

.shake {
    animation: shakeCard 0.5s ease;
}

@keyframes shakeCard {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px) rotate(-5deg); }
    75% { transform: translateX(10px) rotate(5deg); }
}

.battle-result {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(15, 20, 25, 0.98), rgba(26, 26, 46, 0.98));
    border: 4px solid var(--accent-gold);
    border-radius: 0;
    padding: 40px 60px;
    text-align: center;
    z-index: 10;
    box-shadow: 0 0 60px rgba(212, 175, 55, 0.6), 0 0 100px rgba(0, 255, 255, 0.3);
    animation: resultSlideIn 0.5s ease;
    clip-path: polygon(15px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%, 0 15px);
}

.battle-result::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: linear-gradient(45deg, var(--accent-blood), var(--accent-gold), var(--accent-cyber));
    z-index: -1;
    opacity: 0.5;
    clip-path: polygon(15px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%, 0 15px);
    animation: borderGlow 2s ease-in-out infinite;
}

@keyframes borderGlow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

.battle-result h2 {
    margin: 0 0 20px 0;
    font-size: 3rem;
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-cyber));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(212, 175, 55, 0.8);
    letter-spacing: 4px;
}

.battle-result p {
    margin: 10px 0;
    font-size: 1.3rem;
    font-family: 'Cinzel', serif;
    color: var(--text-primary);
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
}

.rewards-section {
    margin-top: 30px;
    padding: 20px;
    background: rgba(5, 8, 16, 0.7);
    border: 2px solid rgba(212, 175, 55, 0.4);
    border-radius: 0;
}

.rewards-section h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: var(--accent-gold);
    margin: 0 0 15px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.rewards-section p {
    font-size: 1.1rem;
    margin: 8px 0;
    font-family: 'Orbitron', sans-serif;
}

.unlock-msg {
    color: var(--accent-cyber) !important;
    font-weight: 700;
    animation: unlockPulse 1s ease-in-out infinite;
}

.achievement-msg {
    color: var(--accent-gold) !important;
    font-weight: 700;
    font-size: 1.2rem !important;
}

@keyframes unlockPulse {
    0%, 100% { text-shadow: 0 0 10px rgba(0, 255, 255, 0.5); }
    50% { text-shadow: 0 0 20px rgba(0, 255, 255, 1), 0 0 30px rgba(0, 255, 255, 0.8); }
}

@keyframes resultSlideIn {
    0% { 
        transform: translate(-50%, -50%) scale(0) rotate(45deg);
        opacity: 0;
    }
    70% {
        transform: translate(-50%, -50%) scale(1.1) rotate(-5deg);
    }
    100% { 
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* EXP Meter - Horror Theme */
.exp-meter {
    margin-top: 8px;
    background: rgba(10, 14, 26, 0.9);
    border: 2px solid rgba(212, 175, 55, 0.3);
    height: 40px;
    border-radius: 0;
    position: relative;
    overflow: hidden;
}

.exp-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blood), var(--accent-gold), var(--accent-cyber));
    transition: width 0.5s ease;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.7);
    position: relative;
}

.exp-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: expShine 2s infinite;
}

@keyframes expShine {
    0% { left: -100%; }
    100% { left: 200%; }
}

.exp-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.9), 0 0 10px rgba(0, 255, 255, 0.5);
    z-index: 1;
}

/* === Level Selection UI === */
.level-selection {
    padding: 20px;
    background: rgba(10, 14, 26, 0.8);
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 0;
    margin-bottom: 20px;
}

.level-selection h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    text-align: center;
    margin: 0 0 20px 0;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-cyber));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(5, 8, 16, 0.5);
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.level-tile {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(15, 20, 25, 0.9), rgba(10, 14, 26, 0.9));
    border: 2px solid rgba(212, 175, 55, 0.3);
    clip-path: polygon(10% 0%, 100% 0%, 100% 90%, 90% 100%, 0% 100%, 0% 10%);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Orbitron', sans-serif;
    position: relative;
}

.level-tile:hover:not(.locked) {
    transform: scale(1.1);
    border-color: var(--accent-cyber);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5), inset 0 0 15px rgba(0, 255, 255, 0.2);
}

.level-tile.current {
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.6), rgba(212, 175, 55, 0.4));
    border-color: var(--accent-gold);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.7);
    animation: levelPulse 2s infinite;
}

@keyframes levelPulse {
    0%, 100% { box-shadow: 0 0 30px rgba(212, 175, 55, 0.7); }
    50% { box-shadow: 0 0 50px rgba(212, 175, 55, 1), 0 0 70px rgba(0, 255, 255, 0.3); }
}

.level-tile.locked {
    background: rgba(5, 8, 16, 0.9);
    border-color: rgba(100, 100, 100, 0.3);
    cursor: not-allowed;
    opacity: 0.5;
}

.level-tile.boss {
    border-color: var(--accent-blood);
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.5), rgba(107, 15, 26, 0.7));
    box-shadow: 0 0 15px rgba(139, 0, 0, 0.6);
}

.level-tile.boss:hover:not(.locked) {
    border-color: #ff0000;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.8), inset 0 0 20px rgba(139, 0, 0, 0.4);
}

.level-number {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-primary);
}

.level-difficulty {
    font-size: 0.65rem;
    color: var(--accent-cyber);
    margin-top: 5px;
}

.level-boss-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 1.2rem;
}

.level-lock-icon {
    font-size: 1.5rem;
    opacity: 0.7;
}

.level-stats {
    display: flex;
    justify-content: space-around;
    padding: 15px;
    background: rgba(5, 8, 16, 0.7);
    border: 1px solid rgba(212, 175, 55, 0.2);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
}

.level-stats p {
    margin: 0;
}

.level-stats span {
    color: var(--accent-gold);
    font-weight: 700;
}

/* === Level Card Selection === */
.level-card-selection {
    padding: 20px;
    background: rgba(10, 14, 26, 0.8);
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 0;
    margin-bottom: 20px;
}

.level-card-selection h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.6rem;
    text-align: center;
    margin: 0 0 15px 0;
    color: var(--accent-gold);
}

.level-info {
    margin-top: 20px;
    padding: 15px;
    background: rgba(5, 8, 16, 0.7);
    border: 1px solid rgba(212, 175, 55, 0.2);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
}

.level-info p {
    margin: 8px 0;
}

.level-info strong {
    color: var(--accent-cyber);
}

.level-info span {
    color: var(--text-primary);
}

#boss-indicator {
    color: var(--accent-blood);
    font-weight: 900;
    text-shadow: 0 0 10px rgba(139, 0, 0, 0.8);
}

