/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a0a0a, #1a1a2e, #16213e);
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

#game {
    width: 100%;
    max-width: 900px;
    background: rgba(10, 10, 20, 0.9);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(100, 100, 200, 0.2);
    overflow: hidden;
    position: relative;
}

#game::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff5500, #ffaa00, #00aaff, #aa00ff);
    z-index: 10;
}

/* ===== SCREEN STYLES ===== */
.screen {
    padding: 30px;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.5s ease-out;
}

.hidden {
    display: none !important;
}

/* ===== TITLE SCREEN ===== */
#title-screen {
    text-align: center;
    background: radial-gradient(circle at center, rgba(26, 26, 46, 0.9), rgba(10, 10, 20, 1));
}

.title-content h1 {
    font-size: 3.2em;
    background: linear-gradient(45deg, #ff5500, #ffaa00, #00aaff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    text-shadow: 0 0 30px rgba(255, 100, 0, 0.3);
    letter-spacing: 1px;
}

.subtitle {
    color: #aaa;
    font-size: 1.2em;
    margin-bottom: 30px;
}

.instructions {
    background: rgba(30, 30, 60, 0.7);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
    border-left: 4px solid #ffaa00;
}

.instructions h3 {
    color: #ffaa00;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.instructions ul {
    list-style: none;
    padding: 0;
}

.instructions li {
    margin: 10px 0;
    padding-left: 25px;
    position: relative;
}

.instructions li i {
    position: absolute;
    left: 0;
    top: 3px;
    color: #00aaff;
}

.high-score {
    background: rgba(0, 50, 100, 0.3);
    border-radius: 10px;
    padding: 15px;
    margin: 20px auto;
    width: 80%;
    display: flex;
    justify-content: space-around;
    font-size: 1.1em;
}

.high-score p {
    margin: 5px 0;
}

.perk-summary {
    margin-top: 20px;
    padding: 15px;
    background: rgba(100, 50, 150, 0.2);
    border-radius: 10px;
}

/* ===== RUN SCREEN ===== */
.run-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(100, 100, 200, 0.3);
}

#floor-display {
    font-size: 1.8em;
    color: #ffaa00;
}

#stats-bar {
    display: flex;
    gap: 20px;
}

.stat {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: bold;
    min-width: 120px;
    text-align: center;
}

#main-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.stat-item {
    background: rgba(20, 20, 40, 0.7);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(100, 100, 200, 0.2);
}

.stat-label {
    display: block;
    color: #aaa;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.stat-label i {
    margin-right: 8px;
}

/* ===== PROGRESS BARS ===== */
.bar-container {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    margin-top: 8px;
    overflow: hidden;
    position: relative;
}

.bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s ease, background-color 0.3s ease;
    position: relative;
    overflow: hidden;
}

.bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        rgba(255,255,255,0) 0%, 
        rgba(255,255,255,0.2) 50%, 
        rgba(255,255,255,0) 100%);
    animation: shine 2s infinite linear;
}

.hp-bar {
    background: linear-gradient(90deg, #ff4444, #ff8888);
}

.corruption-bar {
    background: linear-gradient(90deg, #8844ff, #aa88ff);
}

.time-bar {
    background: linear-gradient(90deg, #44ff44, #88ff88);
}

/* ===== GAME SECTIONS ===== */
.game-section {
    background: rgba(25, 25, 45, 0.7);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(100, 100, 200, 0.1);
}

.game-section h3 {
    color: #ffaa00;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.game-section h3 small {
    color: #aaa;
    font-size: 0.8em;
}

/* ===== ITEMS GRID ===== */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.item {
    background: rgba(40, 40, 80, 0.6);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    animation: float 3s infinite ease-in-out;
}

.item:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.7;
}

.item img {
    width: 50px;
    height: 50px;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 5px currentColor);
}

.item div {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.item small {
    display: block;
    font-size: 0.75em;
    color: #ccc;
    margin-bottom: 10px;
    min-height: 30px;
}

.item button {
    width: 100%;
    padding: 8px;
    background: rgba(0, 100, 200, 0.7);
    border: none;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.item button:hover {
    background: rgba(0, 120, 240, 0.9);
}

/* Rarity Colors */
.item[data-rarity="common"] { color: #aaa; }
.item[data-rarity="uncommon"] { color: #4CAF50; }
.item[data-rarity="rare"] { color: #2196F3; }
.item[data-rarity="epic"] { color: #9C27B0; }
.item[data-rarity="legendary"] { color: #FF9800; }

/* ===== EVENT & SHOP ===== */
#event-container {
    background: rgba(60, 30, 90, 0.9);
    border: 2px solid #aa44ff;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    animation: pulse 2s infinite;
}

.event {
    text-align: center;
}

.event h3 {
    color: #ff88ff;
    margin-bottom: 15px;
}

.event p {
    margin-bottom: 20px;
    font-size: 1.1em;
    line-height: 1.5;
}

.event-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.event-buttons button {
    flex: 1;
    max-width: 200px;
}

#shop-container {
    background: rgba(30, 60, 30, 0.9);
    border: 2px solid #44ff44;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
}

.shop-item {
    background: rgba(40, 80, 40, 0.7);
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0;
    border-left: 4px solid gold;
}

.shop-item strong {
    color: gold;
    display: block;
    margin-bottom: 5px;
}

/* ===== MESSAGE BOX ===== */
.message-box {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    text-align: center;
    font-weight: bold;
    min-height: 20px;
    animation: fadeIn 0.3s;
    border-left: 4px solid #ffaa00;
}

/* ===== QUICK ACTIONS ===== */
.quick-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(100, 100, 200, 0.2);
}

.action-btn {
    flex: 1;
    max-width: 200px;
    padding: 12px;
    background: rgba(100, 50, 150, 0.7);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.action-btn:hover {
    background: rgba(120, 70, 170, 0.9);
    transform: translateY(-2px);
}

/* ===== END SCREENS ===== */
.end-screen-content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.end-screen-content h1 {
    font-size: 3em;
    margin-bottom: 30px;
    color: #ffaa00;
}

.death-summary, .victory-summary {
    background: rgba(30, 30, 60, 0.7);
    border-radius: 15px;
    padding: 25px;
    margin: 20px 0;
    text-align: left;
    display: inline-block;
}

.death-summary p, .victory-summary p {
    margin: 10px 0;
    font-size: 1.1em;
}

.death-summary i, .victory-summary i {
    color: #00aaff;
    width: 20px;
    margin-right: 10px;
}

.death-message {
    color: #ff6666;
    font-size: 1.2em;
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 0, 0, 0.1);
    border-radius: 10px;
}

.victory-message {
    color: #44ff44;
    font-size: 1.3em;
    margin: 20px 0;
}

.score-bonus {
    color: gold;
    font-size: 1.5em;
    font-weight: bold;
    margin: 20px 0;
    animation: pulse 1s infinite;
}

/* ===== PERK SCREEN ===== */
.perk-screen-content {
    text-align: center;
}

.perk-info {
    margin: 20px 0;
}

.current-score {
    font-size: 1.3em;
    color: gold;
    margin: 15px 0;
}

.perks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin: 30px 0;
}

.perk-item {
    background: rgba(40, 40, 80, 0.7);
    border-radius: 10px;
    padding: 20px;
    text-align: left;
    border: 2px solid rgba(100, 100, 200, 0.3);
    transition: all 0.3s;
}

.perk-item:hover {
    border-color: #ffaa00;
    transform: translateY(-3px);
}

.perk-item.unlocked {
    border-color: #44ff44;
    background: rgba(40, 80, 40, 0.7);
}

.perk-item h4 {
    color: #ffaa00;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.perk-item p {
    color: #ccc;
    margin: 8px 0;
    font-size: 0.9em;
}

.perk-item .cost {
    color: gold;
    font-weight: bold;
    margin-top: 10px;
}

.perk-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

/* ===== BUTTONS ===== */
button {
    cursor: pointer;
    padding: 12px 25px;
    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

button:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.glow-button {
    background: linear-gradient(45deg, #ff5500, #ffaa00);
    color: white;
    font-size: 1.1em;
    padding: 15px 30px;
    margin: 10px;
}

.glow-button:hover {
    background: linear-gradient(45deg, #ff6600, #ffbb00);
    box-shadow: 0 0 20px rgba(255, 100, 0, 0.5);
}

.secondary-btn {
    background: rgba(100, 100, 200, 0.7);
    color: white;
}

.secondary-btn:hover {
    background: rgba(120, 120, 220, 0.9);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .screen {
        padding: 15px;
        min-height: auto;
    }
    
    .title-content h1 {
        font-size: 2.2em;
    }
    
    #main-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    #stats-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .stat {
        min-width: auto;
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .action-btn {
        max-width: none;
    }
    
    .perks-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    #game {
        border-radius: 10px;
    }
    
    .screen {
        padding: 10px;
    }
    
    .title-content h1 {
        font-size: 1.8em;
    }
    
    .game-section h3 {
        font-size: 1.1em;
    }
    
    button {
        padding: 10px 15px;
        font-size: 0.9em;
    }
}

/* ===== UTILITY CLASSES ===== */
.text-success { color: #44ff44; }
.text-danger { color: #ff4444; }
.text-warning { color: #ffaa00; }
.text-info { color: #00aaff; }

.shake {
    animation: shake 0.5s;
}