/* ==========================================================================
   1. CORE THEME & TYPOGRAPHY
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@700&family=Quicksand:wght@400;700&display=swap');

body {
    background-color: #1a1a1a;
    color: #e0e0e0;
    font-family: 'Segoe UI', 'Quicksand', sans-serif;
    text-align: center;
    margin: 0;
    min-height: 100vh;
    transition: background-color 2.0s ease-in-out;
}

.game-title, #boss-name, .hero-name-plate, h2, h3 { 
    font-family: 'Cinzel', serif; 
    text-transform: uppercase; 
    letter-spacing: 2px; 
}

.game-title { font-size: 2.8em; color: #ecf0f1; margin: 20px 0; text-shadow: 0 0 10px rgba(255,255,255,0.2); }
#game-container { max-width: 800px; margin: auto; padding: 20px; touch-action: manipulation; }
.hidden {
    display: none !important;
    visibility: hidden;
    pointer-events: none; /* This ensures clicks pass through it */
}
/* ==========================================================================
   2. OVERLAYS & MODALS
   ========================================================================== */
.overlay, #overlay-container, .modal, #god-mode-overlay { 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; height: 100%; 
    background: rgba(0,0,0,0.9); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 1000; 
}

.overlay-content, .modal-content, .god-box { 
    background: #2c3e50; 
    padding: 30px; 
    border: 2px solid #f1c40f; 
    border-radius: 10px; 
    width: 90%;
    max-width: 850px; 
    box-shadow: 0 0 30px rgba(0,0,0,0.7), inset 0 0 15px rgba(0,0,0,0.5);
    color: #ecf0f1;
    position: relative;
}

.lore-scroll-area, .achievement-scroll {
    max-height: 60vh;
    overflow-y: auto;
    margin-top: 15px;
    padding-right: 15px;
    text-align: left;
}

/* ==========================================================================
   3. HERO UI & INVENTORY
   ========================================================================== */
#hero-summary {
    background: rgba(20, 20, 20, 0.8);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #444;
    margin-bottom: 15px;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
}

.hero-name-plate {
    font-size: 1.8em;
    color: #f1c40f;
    border-bottom: 2px solid #34495e;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px #000;
}

.inventory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 15px; }

.item-slot { 
    background: #34495e; 
    padding: 8px; 
    border: 1px solid #7f8c8d; 
    font-size: 0.75em; 
    min-height: 65px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stats-summary {
    margin-top: 20px;
    padding: 15px;
    background: #16a085; 
    border-radius: 5px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    text-align: left;
    font-weight: bold;
    color: #fff;
    border: 1px solid #1abc9c;
}

.stat-line span { float: right; color: #f1c40f; }

/* Container for the stats under the name */
.hero-stats-line {
    display: flex;             /* This puts them in a row */
    justify-content: space-around; /* This creates equal spacing between them */
    align-items: center;       /* Keeps them vertically centered */
    font-weight: bold;
    font-size: 1.1em;
    color: #ecf0f1;
    margin-top: 5px;
}

/* Optional: Add some breathing room to the labels */
.hero-stats-line span {
    margin: 0 10px;
}

/* Target the numbers specifically if you want them to pop */
.stat-value {
    color: #3498db; /* A bright blue for the numbers */
    margin-left: 4px;
    margin-right: 0px; /* Explicitly kill any right margin */
    display: inline;   /* Ensure it doesn't behave like a block */
}
/* ==========================================================================
   4. BATTLE & BOSSES
   ========================================================================== */
#boss-name { color: #e74c3c; font-size: 2em; margin-bottom: 15px; }
.threatening { animation: bossPulse 1.2s infinite ease-in-out; display: inline-block; }

@keyframes bossPulse { 
    0% { transform: scale(1); text-shadow: 2px 2px 4px #000; } 
    50% { transform: scale(1.25); text-shadow: 0 0 20px #ff0000; } 
    100% { transform: scale(1); text-shadow: 2px 2px 4px #000; } 
}

#battle-log { 
    height: 150px; 
    overflow-y: scroll; 
    background: rgba(0, 0, 0, 0.9); 
    padding: 10px; 
    border: 1px solid #555; 
    text-align: left; 
    font-size: 0.8em; 
    font-family: 'Courier New', monospace;
    line-height: 1.2;
    border-radius: 5px;
}

.hp-bar { position: relative; height: 20px; background: #444; border: 1px solid #000; border-radius: 3px; margin-bottom: 7px; overflow: hidden; }
#hero-hp-fill { height: 100%; background: #27ae60; width: 100%; transition: width 0.3s; }
#boss-hp-fill { height: 100%; background: #c0392b; width: 100%; transition: width 0.3s; }

/* ==========================================================================
   5. RARITY & EFFECTS
   ========================================================================== */
.rarity-0 { color: #95a5a6; }
.rarity-1 { color: #ffffff; }
.rarity-2 { color: #2ecc71; }
.rarity-3 { color: #3498db; text-shadow: 0 0 5px #3498db; }
.rarity-4 { color: #df99ff; font-weight: 800; animation: purple-glow 2s infinite alternate; }
.rarity-5 { color: #f1c40f !important; font-weight: bold; text-shadow: 0 0 10px #f1c40f; animation: orange-glow 1.5s infinite alternate; }
.rarity-6 { color: #e74c3c; font-weight: bold; text-shadow: 0 0 10px #ff0000; }

@keyframes purple-glow { from { text-shadow: 0 0 5px #9b59b6; } to { text-shadow: 0 0 15px #bf55ec; } }
@keyframes orange-glow { from { text-shadow: 0 0 8px #e67e22; } to { text-shadow: 0 0 20px #d35400; } }

/* ==========================================================================
   6. THE SHAKE EFFECT (RESTORED)
   ========================================================================== */
@keyframes shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(3px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(3px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(1px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.apply-shake {
  animation: shake 0.2s;
  animation-iteration-count: 1;
}

/* ==========================================================================
   7. BUTTONS & ACTIVE TOGGLES
   ========================================================================== */
/* The Base Button - Standard state */
button, .btn-speed, .btn-menu {
    background: linear-gradient(180deg, #444 0%, #222 100%) !important;
    color: #e0e0e0 !important;
    border: 1px solid #000 !important;
    border-radius: 4px;
    padding: 8px 15px;
    font-family: 'Verdana', sans-serif;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 3px 0 #111;
    margin: 10px 2px 10px 2px !important;
    transition: all 0.1s;
}

/* THE FIX: Forced Active State */
/* This overrides the base gradient when game.js adds the 'active' class */
button.active, 
.btn-speed.active, 
.btn-menu.active {
    background: linear-gradient(180deg, #f1c40f 0%, #d4ac0d 100%) !important;
    color: #1a1a1a !important;
    border-color: #b7950b !important;
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.5), 0 1px 0 #917508 !important;
    transform: translateY(2px); /* Keeps it pressed down slightly */
}

button:hover { filter: brightness(1.2); }

/* Ensure Close Button remains Red even if it somehow gets an active class */
.btn-close { 
    background: linear-gradient(180deg, #e74c3c 0%, #c0392b 100%) !important; 
    border-color: #922b21 !important;
    color: #fff !important;
}

.overlay-banner {
    width: 100%;
    height: 150px; /* Adjust height as needed */
    object-fit: cover;
    border-bottom: 2px solid #d4af37; /* Gold trim */
    margin-bottom: 15px;
    border-radius: 5px 5px 0 0;
    opacity: 0.8;
}

/* The pulsing red background for Superior encounters */
.superior-overlay {
    text-align: center;
    padding: 40px;
    background: radial-gradient(circle, rgba(139, 0, 0, 0.9) 0%, rgba(0, 0, 0, 1) 100%);
    border: 5px solid #e74c3c;
    box-shadow: 0 0 50px #ff0000;
    animation: pulse-red 2s infinite;
    z-index: 10000;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 20px #8b0000; }
    50% { box-shadow: 0 0 60px #ff0000; }
    100% { box-shadow: 0 0 20px #8b0000; }
}

/* The shaking warning text */
.superior-title {
    font-size: 3.5rem;
    font-weight: bold;
    color: #e74c3c;
    text-shadow: 2px 2px 0px #555;
    animation: shake 0.5s infinite;
    margin-bottom: 10px;
}

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10px { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
}

.orange-button {
    background-color: #e67e22; 
    color: white;
    border: 1px solid #d35400;
    padding: 2px 8px; /* Smaller padding to fit the log header */
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8em;
    font-weight: bold;
    margin-right: 5px; /* Space between music and speed buttons */
    transition: all 0.2s;
}

/* The "Lightened" style when the music is active */
.orange-button.on {
    background-color: #f39c12; 
    box-shadow: 0 0 8px #f39c12;
    border-color: #f1c40f;
}

/* This adds the 'Lightened Orange' look when the music is active */
.log-button.on {
    background-color: #f39c12 !important; /* Brighter Orange */
    color: #fff !important;
    border-color: #f1c40f !important; /* Gold border */
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.6); /* Subtle glow */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* This targets the button ONLY when the music is turned on */
.log-button.on {
    background-color: #ff9800 !important; /* Bright Orange */
    color: white !important;
    border: 1px solid #e65100 !important;
    box-shadow: 0 0 12px #ff9800 !important; /* The Glow */
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

/* Optional: This adds a little pulse effect to the glow */
.log-button.on {
    animation: musicPulse 2s infinite alternate;
}

@keyframes musicPulse {
    from { box-shadow: 0 0 5px #ff9800; }
    to { box-shadow: 0 0 15px #ffb74d; }
}

/* We are 'hijacking' your game's existing button hover/active color */
.log-button.on {
    background-color: #e67e22 !important; /* Your game's 'Classic Orange' */
    color: #fff !important;
    border-color: #d35400 !important;
    /* This makes it look exactly like a button that is being pressed or hovered */
}

/* If your game uses a specific shadow for its buttons, add it here */
.log-button:hover, .log-button.on {
    filter: brightness(1.1);
}

.game-footer {
    width: 100%;
    margin-top: 1px;
    padding: 10px 0;
    /* Merged from your inline style */
    text-align: center;
    color: #ecf0f1;
    font-family: 'Cinzel', serif;
    font-size: 0.7em;
    opacity: 0.6;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 20px;
    line-height: 1.8;
}

.separator {
    display: inline-block; /* Ensures it takes up space */
    width: 8px;
    height: 8px;
    background-color: #d4af37 !important; /* !important forces the color to show */
    transform: rotate(45deg);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.8);
    flex-shrink: 0;
}

/* Make the names pop slightly */
.footer-content span:not(.separator) {
    transition: color 0.3s ease;
}

.footer-content span:not(.separator):hover {
    color: #d4af37;
    text-shadow: 0 0 5px rgba(212, 175, 55, 0.2);
}

/* Responsive fix for mobile */
@media (max-width: 600px) {
    .separator { display: none; }
    .footer-content { flex-direction: column; gap: 5px; }
}

.shop-banner {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #4a4a4a;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    filter: sepia(20%) contrast(1.1); /* Gives it a slightly aged, fantasy feel */
}

.shop-header h2 {
    color: #ffd700; /* Gold! */
    text-shadow: 2px 2px 4px #000;
    text-align: center;
    font-family: 'Cinzel', serif; /* A classic fantasy font if you have it */
}

/* Prevents iOS zoom on form elements */
input, select, textarea {
    font-size: 16px !important;
}

#lore-box {
    margin-top: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.4);
    border-left: 3px solid #b48c28;
    min-height: 60px;
    font-style: italic;
    font-size: 0.9em;
    color: #e0d0a0;
}

.map-location {
    cursor: pointer; /* Change to pointer to show it's clickable */
}

.card-hub { padding: 20px; text-align: center; }
.hub-btn { 
    padding: 20px; border: 2px solid #444; border-radius: 10px; 
    cursor: pointer; transition: 0.3s; background: #222; 
}
.hub-btn:hover { border-color: #f1c40f; background: #333; }
.hub-btn.glow { border-color: #f1c40f; box-shadow: 0 0 15px #f1c40f; }

.card-mini {
    width: 100px; height: 140px; border: 2px solid; border-radius: 5px;
    background: #111; display: flex; flex-direction: column; 
    justify-content: center; align-items: center; padding: 5px;
}

.revealed .card-inner {
    transform: rotateY(180deg);
}