/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0a0a0a;
    --bg-darker: #000000;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --accent-red: #ff0000;
    --accent-dark-red: #8b0000;
    --accent-gold: #ffd700;
    --glow-color: #ff0066;
    --border-color: #333333;
    --shadow-color: rgba(255, 0, 0, 0.5);
}

body {
    font-family: 'Special Elite', monospace;
    background: var(--bg-darker);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    position: relative;
}

/* ===== LOADING SCREEN ===== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-darker);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.5s;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-bar {
    width: 300px;
    height: 4px;
    background: #333;
    margin: 20px auto;
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: var(--accent-red);
    width: 0%;
    animation: loading 2s ease-in-out;
    box-shadow: 0 0 10px var(--accent-red);
}

@keyframes loading {
    to { width: 100%; }
}

.warning-text {
    margin-top: 20px;
    color: var(--accent-red);
    font-size: 14px;
    animation: pulse 2s infinite;
}

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

/* ===== GLITCH EFFECT ===== */
.glitch {
    position: relative;
    font-family: 'Creepster', cursive;
    font-size: 4rem;
    color: var(--text-primary);
    text-shadow: 
        0 0 10px var(--glow-color),
        0 0 20px var(--glow-color),
        0 0 30px var(--glow-color);
    animation: glitch-anim 2s infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--accent-red);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-1 0.5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 var(--accent-dark-red), 2px 2px var(--glow-color);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-2 0.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
}

@keyframes glitch-1 {
    0% { clip: rect(31px, 9999px, 94px, 0); }
    100% { clip: rect(33px, 9999px, 96px, 0); }
}

@keyframes glitch-2 {
    0% { clip: rect(31px, 9999px, 94px, 0); }
    100% { clip: rect(33px, 9999px, 96px, 0); }
}

/* ===== SCREENS ===== */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    background: var(--bg-darker);
    z-index: 1;
}

.screen.active {
    display: flex;
}

/* ===== MAIN MENU ===== */
.menu-content {
    text-align: center;
    padding: 40px;
}

.title {
    margin-bottom: 10px;
    font-size: 5rem;
}

.subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    text-shadow: 0 0 10px var(--shadow-color);
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 40px 0;
    align-items: center;
}

.btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-family: 'Special Elite', monospace;
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--accent-red);
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    min-width: 250px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--accent-red);
    transition: left 0.3s;
    z-index: -1;
}

.btn:hover::before {
    left: 0;
}

.btn:hover {
    color: var(--bg-darker);
    box-shadow: 0 0 20px var(--accent-red);
    transform: scale(1.05);
}

.btn-primary {
    border-color: var(--accent-red);
}

.btn-secondary {
    border-color: var(--text-secondary);
}

.btn-secondary::before {
    background: var(--text-secondary);
}

.btn-ad {
    border-color: var(--accent-gold);
    background: var(--accent-gold);
    color: var(--bg-darker);
}

.btn-ad:hover {
    box-shadow: 0 0 20px var(--accent-gold);
}

.stats-preview {
    display: flex;
    gap: 40px;
    justify-content: center;
    margin-top: 40px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.5rem;
    color: var(--accent-gold);
    text-shadow: 0 0 10px var(--accent-gold);
}

/* ===== GAME SCREEN ===== */
#game-screen {
    background: var(--bg-darker);
    display: none;
    flex-direction: column;
}

#game-screen.active {
    display: flex;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: var(--bg-darker);
    cursor: crosshair;
}

.game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    pointer-events: none;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
}

.score-display {
    font-size: 1.2rem;
    color: var(--text-primary);
    text-shadow: 0 0 10px var(--glow-color);
}

.health-bar {
    width: 200px;
    height: 30px;
    border: 2px solid var(--accent-red);
    background: rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.health-fill {
    height: 100%;
    width: 100%;
    background: var(--accent-red);
    transition: width 0.3s;
    box-shadow: 0 0 10px var(--accent-red);
}

.health-bar span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    z-index: 1;
}

.coins-display {
    font-size: 1.2rem;
    color: var(--accent-gold);
    text-shadow: 0 0 10px var(--accent-gold);
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 200;
}

.jumpscare {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--accent-red);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 8rem;
    animation: jumpscare-anim 0.3s;
    z-index: 1000;
}

.jumpscare.hidden {
    display: none;
}

@keyframes jumpscare-anim {
    0% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 0; transform: scale(1); }
}

.warning-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    border: 3px solid var(--accent-red);
    padding: 30px;
    text-align: center;
    font-size: 1.5rem;
    animation: warning-pulse 0.5s;
    z-index: 500;
}

.warning-message.hidden {
    display: none;
}

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

.pause-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 3px solid var(--accent-red);
    padding: 40px;
    text-align: center;
    z-index: 300;
    pointer-events: all;
}

.pause-menu.hidden {
    display: none;
}

.pause-menu h2 {
    margin-bottom: 30px;
    font-size: 2.5rem;
    color: var(--accent-red);
}

/* ===== CHAT PANEL ===== */
.chat-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    height: 400px;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid var(--accent-red);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s;
}

.chat-panel.collapsed {
    height: 50px;
}

.chat-panel.collapsed .chat-messages,
.chat-panel.collapsed .chat-input-container {
    display: none;
}

.chat-header {
    background: var(--accent-red);
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    cursor: pointer;
}

.chat-toggle {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 10px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-message {
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-left: 2px solid var(--accent-red);
    word-wrap: break-word;
}

.chat-message .username {
    color: var(--accent-gold);
    font-weight: bold;
    margin-right: 5px;
}

.chat-message .timestamp {
    color: var(--text-secondary);
    font-size: 0.7rem;
    margin-left: 5px;
}

.chat-input-container {
    display: flex;
    padding: 10px;
    gap: 5px;
    border-top: 1px solid var(--border-color);
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px;
    font-family: inherit;
    font-size: 0.9rem;
}

#chat-input:focus {
    outline: none;
    border-color: var(--accent-red);
}

.chat-send-btn {
    background: var(--accent-red);
    border: none;
    color: var(--text-primary);
    padding: 8px 15px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.3s;
}

.chat-send-btn:hover {
    background: var(--accent-dark-red);
}

/* ===== LEADERBOARD ===== */
.leaderboard-content {
    text-align: center;
    padding: 40px;
    max-width: 600px;
}

.leaderboard-content h2 {
    font-size: 3rem;
    margin-bottom: 30px;
    color: var(--accent-red);
    text-shadow: 0 0 20px var(--accent-red);
}

.leaderboard-list {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--accent-red);
    padding: 20px;
    margin: 30px 0;
    min-height: 300px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.1rem;
}

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

.leaderboard-rank {
    color: var(--accent-gold);
    font-weight: bold;
    margin-right: 20px;
}

.leaderboard-name {
    flex: 1;
    text-align: left;
}

.leaderboard-score {
    color: var(--accent-red);
    font-weight: bold;
}

/* ===== SHOP ===== */
.shop-content {
    text-align: center;
    padding: 40px;
    max-width: 800px;
}

.shop-content h2 {
    font-size: 3rem;
    margin-bottom: 30px;
    color: var(--accent-gold);
    text-shadow: 0 0 20px var(--accent-gold);
}

.shop-coins {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: var(--accent-gold);
}

.shop-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.shop-item {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--border-color);
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.shop-item:hover {
    border-color: var(--accent-gold);
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--accent-gold);
}

.shop-item.owned {
    border-color: var(--accent-gold);
    opacity: 0.7;
}

.shop-item-name {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--accent-gold);
}

.shop-item-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.shop-item-price {
    font-size: 1.3rem;
    color: var(--accent-gold);
    margin-bottom: 10px;
}

.ad-section {
    margin-top: 40px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--accent-gold);
}

.ad-section p {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

/* ===== AD CONTAINER ===== */
.ad-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ad-container.hidden {
    display: none;
}

.ad-wrapper {
    position: relative;
    background: var(--bg-dark);
    border: 3px solid var(--accent-gold);
    padding: 20px;
    max-width: 90%;
    max-height: 90%;
}

.close-ad {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 40px;
    height: 40px;
    background: var(--accent-red);
    border: 2px solid var(--text-primary);
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s;
}

.close-ad:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px var(--accent-red);
}

.ad-placeholder {
    width: 300px;
    height: 250px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    border: 2px dashed var(--border-color);
}

.ad-note {
    font-size: 0.8rem;
    margin-top: 10px;
    color: var(--text-secondary);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .title {
        font-size: 3rem;
    }
    
    .chat-panel {
        width: 100%;
        right: 0;
        bottom: 0;
        height: 300px;
    }
    
    .shop-items {
        grid-template-columns: 1fr;
    }
}

/* ===== HIDDEN UTILITY ===== */
.hidden {
    display: none !important;
}

