/* BitBuddies 16-bit Retro Theme */
:root {
    --primary-color: #4a6bff;
    --secondary-color: #ff6b4a;
    --background-color: #181425;
    --text-color: #f4f4f4;
    --border-color: #8d3cff;
    --success-color: #48e14e;
    --error-color: #e14848;
    --card-bg: #29234b;
    --highlight-color: #ffde3d;
    --pixel-border: 4px;
    --accent-color-dark: #333;
    --accent-color-medium: #555;
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Press Start 2P', monospace;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 0;
    margin: 0;
    image-rendering: pixelated;
}

/* Game Container */
.game-container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 20px;
    border: var(--pixel-border) solid var(--border-color);
    background-color: var(--card-bg);
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.5);
}

.game-title {
    color: var(--highlight-color);
    font-size: 28px;
    text-shadow: 4px 4px 0 #000;
    letter-spacing: 2px;
}

/* Navigation */
.game-nav {
    position: relative;
    margin-bottom: 20px;
}

.nav-toggle {
    display: none;
    background-color: var(--card-bg);
    border: var(--pixel-border) solid var(--border-color);
    color: var(--text-color);
    padding: 10px 15px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
    margin-bottom: 5px;
}

.game-nav ul {
    display: flex;
    list-style: none;
    background-color: var(--card-bg);
    border: var(--pixel-border) solid var(--border-color);
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.5);
}

.game-nav li {
    flex: 1;
    text-align: center;
}

.game-nav a {
    display: block;
    padding: 15px 10px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s;
}

.game-nav a:hover {
    background-color: var(--primary-color);
    color: var(--highlight-color);
}

/* Main Content */
.game-content {
    flex: 1;
    padding: 20px;
    background-color: var(--card-bg);
    border: var(--pixel-border) solid var(--border-color);
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
    min-height: 400px;
}

.welcome-section {
    text-align: center;
    padding: 20px;
}

.welcome-section h2 {
    font-size: 24px;
    color: var(--highlight-color);
    margin-bottom: 20px;
    text-shadow: 3px 3px 0 #000;
}

.welcome-section p {
    font-size: 16px;
    margin-bottom: 30px;
}

/* Pixel Art Container */
.pixel-art-container {
    display: flex;
    justify-content: center;
    margin: 30px 0;
}

.pixel-pet {
    width: 128px;
    height: 128px;
    background-repeat: no-repeat;
    background-size: contain;
    image-rendering: pixelated;
}

/* Footer */
.game-footer {
    text-align: center;
    padding: 15px;
    font-size: 12px;
    background-color: var(--card-bg);
    border: var(--pixel-border) solid var(--border-color);
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.5);
}

/* Auth Status */
.auth-status {
    display: flex;
    gap: 15px;
    align-items: center;
}

.auth-status a {
    color: var(--highlight-color);
    text-decoration: none;
    font-size: 14px;
}
.auth-status .gold-amount {
    font-size: 14px;
    color: var(--highlight-color);
    font-weight: bold;
}

.auth-status a:hover {
    text-decoration: underline;
}

.auth-status span {
    color: var(--success-color);
    font-size: 14px;
}

/* Buttons */
button {
    background-color: var(--primary-color);
    color: var(--text-color);
    border: var(--pixel-border) solid #2a3b9f;
    padding: 10px 15px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.1s;
}

button:hover {
    background-color: #5a7bff;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

button:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

/* Forms */
.auth-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--card-bg);
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--highlight-color);
    text-shadow: 3px 3px 0 #000;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--highlight-color);
}

.form-group input {
    width: 100%;
    padding: 12px;
    background-color: #1a1a2e;
    border: var(--pixel-border) solid var(--border-color);
    color: var(--text-color);
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    justify-content: center;
}

/* Messages */
.success {
    color: var(--success-color);
    font-weight: bold;
    padding: 15px;
    background-color: rgba(72, 225, 78, 0.2);
    border: var(--pixel-border) solid var(--success-color);
    margin: 15px 0;
    text-align: center;
}

.error {
    color: var(--error-color);
    font-weight: bold;
    padding: 15px;
    background-color: rgba(225, 72, 72, 0.2);
    border: var(--pixel-border) solid var(--error-color);
    margin: 15px 0;
    text-align: center;
}

/* User Info */
.user-info {
    background-color: var(--card-bg);
    padding: 20px;
    margin-bottom: 20px;
}

.user-info h2 {
    color: var(--highlight-color);
    margin-bottom: 15px;
}

.user-info p {
    margin-bottom: 10px;
    font-size: 0.9em;
}

/* Username editing styles */
#username-section {
    margin-bottom: 15px;
}

#username-section .edit-button {
    font-size: 0.7em;
    padding: 4px 8px;
    margin-left: 10px;
    background-color: var(--primary-color);
    border: 2px solid var(--border-color);
}

#username-section .edit-button:hover {
    background-color: #5a7bff;
}

#username-section form {
    margin-top: 10px;
    margin-bottom: 15px;
}

#username-section .form-group {
    margin-bottom: 15px;
}

#username-section input[type="text"] {
    width: 100%;
    padding: 8px;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.8em;
    background-color: #3a3464;
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

#username-section .form-actions {
    display: flex;
    gap: 10px;
}

#username-section .save-button {
    background-color: var(--success-color);
    color: #000;
    border: 2px solid #2a9e30;
}

#username-section .save-button:hover {
    background-color: #5af160;
}

#username-section .cancel-button {
    background-color: var(--error-color);
    color: #fff;
    border: 2px solid #9e2a2a;
}

#username-section .cancel-button:hover {
    background-color: #f15a5a;
}

#username-section .success-message {
    margin-top: 10px;
    padding: 8px;
    background-color: rgba(72, 225, 78, 0.2);
    border: 2px solid var(--success-color);
    color: var(--success-color);
    font-size: 0.8em;
}

#username-section .error-message {
    margin-top: 10px;
    padding: 8px;
    background-color: rgba(225, 72, 72, 0.2);
    border: 2px solid var(--error-color);
    color: var(--error-color);
    font-size: 0.8em;
}

/* Debug Info (hidden in production) */
#debug-info {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .game-nav ul {
        display: none;
        position: absolute;
        width: 100%;
        z-index: 1000;
        flex-direction: column;
    }
    
    .game-nav ul.show {
        display: flex;
    }
    
    .game-nav li {
        width: 100%;
        border-bottom: 2px solid var(--border-color);
    }
    
    .game-nav li:last-child {
        border-bottom: none;
    }
    
    .game-nav a {
        padding: 12px 15px;
        display: block;
        text-align: left;
    }
    
    .auth-status {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-actions {
        flex-direction: column;
    }
}

/* Pets Page Styles */
.pets-container {
    max-width: 1200px;
    margin: 0 auto;
    color: white;
}

.pets-container h2 {
    font-size: 24px;
    color: #ffcc00;
    text-align: center;
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 0 #000;
}

.pets-sort-controls {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
}

.sort-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 16px;
    margin-right: 1rem;
    color: white;
    text-shadow: 2px 2px 0 #000;
}

.sort-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.sort-button {
    background-color: #4b2a84;
    color: white;
    border: 2px solid #7045af;
    padding: 8px 12px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.1s;
}

.sort-button:hover {
    background-color: #5d35a4;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

.sort-button.active {
    background-color: #ffcc00;
    color: #4b2a84;
    border-color: #7045af;
}

.pets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.pet-card {
    background-color: #25252563;
    border: 2px solid #3f3f3f;
    border-radius: 6px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    color: white;
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.pet-card:hover {
    transform: translateY(-2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.7);
}

.pet-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    position: relative;
}

.pet-avatar {
    position: relative;
    width: 80px;
    height: 80px;
    margin-right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #3f3f3f;
}

.pet-image {
    max-width: 100%;
    min-width: 64px;
    min-height: 64px;
    image-rendering: pixelated;
}

.pet-name-section {
    width: 100%;
    flex: 1;
}

.nick-name-section {
    background-color: #27233c;
}

.pet-name-section h3 {
    font-size: 16px;
    margin: 0 0 0.5rem;
    color: white;
    word-break: break-word;
}

.edit-button {
    background-color: #4b69ee;
    color: white;
    border: 1px solid #2a4bdf;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

.pet-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pet-status {
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.pet-rarity {
    font-size: 12px;
    font-weight: bold;
    margin: 0.5rem 0;
}

.pet-level {
    margin: 0.75rem 0;
    font-size: 12px;
    color: white;
}

.pet-experience {
    margin: 0.75rem 0;
    font-size: 12px;
    color: white;
}

.pet-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 0.75rem 1.5rem;
    margin: 1rem 0;
    width: 100%;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.stat-header {
    font-size: 16px;
    color: white;
    font-weight: bold;
    margin-bottom: 0.25rem;
    display: block;
    width: 100%;
}

.stat-value {
    font-size: 20px;
    color: #ffcc00;
    text-align: left;
    display: block;
    width: 100%;
}

.work-in-progress {
    color: #ffcc00;
    font-size: 16px;
    margin: 1rem 0 0.5rem 0;
}

.work-time-remaining {
    color: #ffcc00;
    display: block;
    margin-top: 0.25rem;
    font-size: 14px;
}

.cancel-work-button {
    background-color: #ff4a4a;
    color: white;
    border: 2px solid #df2a2a;
    padding: 10px 15px;
    margin-top: 1rem;
    width: 100%;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
}

.pet-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.work-indicator {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #ffcc00;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.work-indicator.working {
    animation: pulse 1.5s infinite;
}

.work-indicator.completed {
    background-color: #4caf50;
}

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

/* Shop Styles */
.shop-container {
    padding: 20px;
}

.shop-header {
    display: flex;
    justify-content: space-between; /* Keeps gold display (if present) to the right */
    align-items: center;
    margin-bottom: 20px;
}

.shop-header h2 {
    color: var(--highlight-color);
    text-shadow: 3px 3px 0 #000;
    /* Remove default/conflicting margins */
    margin: 0;
    /* Allow the h2 to grow and occupy space */
    flex-grow: 1;
    /* Center the text within the h2 element */
    text-align: center;
    /* Add padding to prevent text touching edges if needed */
    padding: 0 15px;
}

.user-gold {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.gold-icon {
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
    position: relative;
    top: -2px;
}

.shop-intro {
    margin-bottom: 20px;
    padding: 15px;
    background-color: rgba(41, 35, 75, 0.7);
}

.shop-categories {
    display: flex;          /* Keep as flex container */
    justify-content: flex-start; /* Align buttons to the start */
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;       /* Allow horizontal scrolling */
    padding-bottom: 10px;   /* Add space for scrollbar */
    /* Optional: Hide scrollbar visually but keep functionality */
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

.shop-category-btn {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: var(--pixel-border) solid var(--border-color);
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    flex-shrink: 0;     /* Important: Prevent buttons from shrinking */
    white-space: nowrap; /* Prevent text inside button from wrapping */
}

.shop-category-btn:hover, .shop-category-btn.active {
    background-color: var(--primary-color);
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}


.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.shop-item {
    background-color: rgba(41, 35, 75, 0.8);
    border: var(--pixel-border) solid var(--border-color);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
    padding: 15px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
    border-radius: 8px;
}

.shop-item:hover {
    transform: translateY(-5px);
}

.shop-item-image {
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    border: 3px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.3);
}

.item-food, .item-potion, .item-upgrade {
    font-size: 40px;
    text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5);
}

.shop-item-info h3 {
    color: var(--highlight-color);
    margin-bottom: 10px;
    font-size: 16px;
}

.shop-item-info p {
    margin-bottom: 10px;
    font-size: 12px;
}

.shop-item-price {
    color: var(--highlight-color);
    font-weight: bold;
    font-size: 14px !important;
    margin-bottom: 15px !important;
}

.shop-buy-btn {
    background-color: var(--primary-color);
    color: var(--text-color);
    border: var(--pixel-border) solid #2a3b9f;
    padding: 8px 15px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.1s;
    margin-top: auto;
}

.shop-buy-btn:hover:not([disabled]) {
    background-color: #5a7bff;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

.shop-buy-btn[disabled] {
    background-color: #555;
    color: #888;
    cursor: not-allowed;
    border-color: #444;
}

.shop-loading {
    text-align: center;
    padding: 20px;
    font-style: italic;
    color: #888;
}

/* Leaderboard Styles */
.leaderboard-container {
    padding: 20px;
}

.leaderboard-container h2 {
    color: var(--highlight-color);
    text-shadow: 3px 3px 0 #000;
    margin-bottom: 20px;
    text-align: center;
}

.leaderboard-tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
    border-radius: 8px;
    overflow: hidden;
}

.tab-btn {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: var(--pixel-border) solid var(--border-color);
    padding: 10px 20px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.1s;
    transform: none; /* Reset transform initially */
}

/* Increase specificity by adding parent. Combine :hover and .active. */
.leaderboard-tabs .tab-btn:hover,
.leaderboard-tabs .tab-btn.active {
    background-color: var(--primary-color); /* Target background color */
    color: var(--highlight-color);        /* Target text color */
    transform: translate(-2px, -2px);     /* Target position shift */
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5); /* Target shadow */
    /* If the border should also change color when active/hover, uncomment below */
    /* border-color: var(--highlight-color); */
}

.leaderboard-list {
    background-color: rgba(41, 35, 75, 0.7);
    border: var(--pixel-border) solid var(--border-color);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
    margin-bottom: 30px;
}

.leaderboard-header {
    display: flex;
    background-color: var(--primary-color);
    padding: 12px 15px;
    font-weight: bold;
    border-bottom: var(--pixel-border) solid var(--border-color);
    align-items: center;
}

.leaderboard-row {
    display: flex;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: background-color 0.2s;
    align-items: center;
}

.leaderboard-row:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

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

.rank-col {
    width: 60px;
    min-width: 60px;
    text-align: center;
    font-weight: bold;
}

.pet-col {
    flex: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.owner-col {
    flex: 1;
    min-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.exp-col, .battles-col {
    width: 120px;
    min-width: 120px;
    text-align: center;
}

.level-col {
    width: 80px;
    min-width: 80px;
    text-align: center;
}

.pet-avatar-small {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pet-face-small {
    position: relative;
    width: 15px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
}

.pet-face-small::before, .pet-face-small::after {
    content: "";
    position: absolute;
    width: 3px;
    height: 3px;
    background-color: #000;
    border-radius: 50%;
    top: 2px;
}

.pet-face-small::before {
    left: 3px;
}

.pet-face-small::after {
    right: 3px;
}

.no-data {
    padding: 30px;
    text-align: center;
    font-style: italic;
    color: #888;
}

.pet-details-container {
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.pet-details {
    background-color: rgba(30, 25, 55, 0.9);
    padding: 20px;
    margin: 0 10px 10px;
    border: var(--pixel-border) solid var(--highlight-color);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.pet-details-header {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.pet-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 3px solid var(--border-color);
}

.pet-face-large {
    position: relative;
    width: 40px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
}

.pet-face-large::before, .pet-face-large::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #000;
    border-radius: 50%;
    top: 5px;
}

.pet-face-large::before {
    left: 8px;
}

.pet-face-large::after {
    right: 8px;
}

.pet-details-info {
    flex: 1;
}

.pet-details-info h3 {
    color: var(--highlight-color);
    margin-bottom: 10px;
}

.pet-details-info p {
    margin-bottom: 5px;
    font-size: 12px;
}

.pet-stats-large {
    margin-bottom: 20px;
}

.stat-large {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.stat-label {
    width: 40px;
    font-weight: bold;
}

.stat-bar {
    flex: 1;
    height: 15px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 2px solid var(--border-color);
}

.stat-fill {
    height: 100%;
    transition: width 0.5s;
}

.stat-fill.hp {
    background-color: #55AA55;
}

.stat-fill.atk {
    background-color: #AA5555;
}

.stat-fill.spd {
    background-color: #5555AA;
}

.stat-fill.int {
    background-color: #AA55AA;
}

.stat-value {
    width: 30px;
    text-align: right;
    font-size: 14px;
    color: #ffcc00;
}

/* Improved responsive leaderboard styles */
@media (max-width: 768px) {
    .leaderboard-header, .leaderboard-row {
        font-size: 12px;
    }
    
    .rank-col {
        width: 40px;
        min-width: 40px;
    }
    
    .pet-col {
        flex: 1.5;
        min-width: 120px;
    }
    
    .owner-col {
        flex: 1;
        min-width: 80px;
    }
    
    .exp-col, .battles-col {
        width: 60px;
        min-width: 60px;
    }
    
    .level-col {
        width: 50px;
        min-width: 50px;
    }
    
    .leaderboard-list {
        overflow-x: auto;
    }
}

/* For very small screens, make more adjustments */
@media (max-width: 480px) {
    .leaderboard-list {
        overflow-x: auto;
    }
    
    .leaderboard-header, .leaderboard-row {
        min-width: 400px;
    }
    
    .pet-col {
        flex: 2;
    }
}

/* Mining Styles */
.action-buttons {
    display: flex;
    flex-direction: column;
    align-items: center; /* Add this */
    justify-content: center;
    margin-top: 30px;
}

.action-button {
    background-color: var(--primary-color);
    color: var(--text-color);
    border: var(--pixel-border) solid #2a3b9f;
    padding: 12px 20px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.1s;
}

.action-button:hover {
    background-color: #5a7bff;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

.mines-button {
    background-color: #AA7722;
    border-color: #664411;
}

.mines-button:hover {
    background-color: #CC9933;
}

.mines-container {
    padding: 20px;
}

.mines-container h2 {
    color: var(--highlight-color);
    text-shadow: 3px 3px 0 #000;
    margin-bottom: 20px;
    text-align: center;
}

.mines-intro {
    text-align: center;
    margin-bottom: 30px;
    padding: 15px;
    background-color: rgba(41, 35, 75, 0.7);
    border: var(--pixel-border) solid var(--border-color);
}

.mines-pet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.mines-pet-card {
    background-color: rgba(41, 35, 75, 0.8);
    border: var(--pixel-border) solid var(--border-color);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
    padding: 15px;
    display: flex;
    gap: 15px;
    transition: transform 0.2s;
}

.mines-pet-card:hover {
    transform: translateY(-5px);
}

.select-for-mines-btn {
    background-color: #AA7722;
    color: var(--text-color);
    border: var(--pixel-border) solid #664411;
    padding: 8px 15px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.1s;
    margin-top: 10px;
}

.select-for-mines-btn:hover {
    background-color: #CC9933;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: var(--card-bg);
    border: var(--pixel-border) solid var(--highlight-color);
    box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.5);
    padding: 25px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    box-sizing: border-box;
}

.modal-content h3 {
    color: var(--highlight-color);
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 #000;
}

.confirmation-text {
    margin-bottom: 25px;
    line-height: 1.6;
}

.pet-name {
    color: var(--highlight-color);
    font-weight: bold;
}

.modal-buttons {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.cancel-button, .confirm-button {
    flex: 1;
    padding: 10px;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
}

.cancel-button {
    background-color: var(--error-color);
    color: var(--text-color);
    border: var(--pixel-border) solid #8f2a2a;
}

.cancel-button:hover {
    background-color: #e15a5a;
}

.confirm-button {
    background-color: #AA7722;
    color: var(--text-color);
    border: var(--pixel-border) solid #664411;
}

.confirm-button:hover {
    background-color: #CC9933;
}

.mining-result {
    text-align: center;
    padding: 30px;
}

.mining-animation {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 30px auto;
}

.mining-pet {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 3px solid var(--border-color);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: mine 2s infinite;
}

.pickaxe {
    font-size: 40px;
    position: absolute;
    top: 30%;
    right: 20%;
    animation: swing 1s infinite;
    transform-origin: bottom right;
}

@keyframes mine {
    0%, 100% { transform: translate(-50%, -50%); }
    50% { transform: translate(-50%, -45%); }
}

@keyframes swing {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-30deg); }
}

.mining-message {
    margin: 20px 0;
    font-size: 16px;
}

.button-link {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--text-color);
    border: var(--pixel-border) solid #2a3b9f;
    padding: 10px 20px;
    text-decoration: none;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
    margin-top: 20px;
}

.button-link:hover {
    background-color: #5a7bff;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

/* Add or update these styles in your CSS */
#mines-confirmation-modal {
    position: relative;
    z-index: 1000;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.claim-rewards-button {
    background-color: var(--success-color);
}

.claim-rewards-button:disabled,
.claim-rewards-button.claiming {
    background-color: #888;
    cursor: not-allowed;
    opacity: 0.7;
    position: relative;
}

.claim-rewards-button.claiming:after {
    content: "...";
    position: absolute;
    right: 10px;
    animation: ellipsis 1.5s infinite;
}

@keyframes ellipsis {
    0% { content: "."; }
    33% { content: ".."; }
    66% { content: "..."; }
    100% { content: "."; }
}

.pet-actions {
    margin-top: 10px;
}

/* Pet Work Modal Styles */
#work-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#work-modal .modal-content {
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

#work-modal h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #f4f4f4;
    font-size: 18px;
}

#work-modal p {
    text-align: center;
    margin-bottom: 20px;
    font-size: 14px;
}

.work-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.work-option {
    background-color: rgba(74, 107, 255, 0.3);
    border: 4px solid #2a3b9f;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.work-option:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.3);
}

.work-option h4 {
    text-align: center;
    margin-bottom: 10px;
    color: #f4f4f4;
    font-size: 16px;
}

.work-option p {
    font-size: 12px;
    margin-bottom: 10px;
}

.work-option button {
    background-color: #4a6bff;
    color: #f4f4f4;
    border: 4px solid #2a3b9f;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    display: block;
    margin: 10px auto 0;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
}

.work-option button:hover {
    background-color: #5a7bff;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

.close-modal-button {
    background-color: #ff4a4a;
    color: #f4f4f4;
    border: 4px solid #9f2a2a;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    display: block;
    margin: 0 auto;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
}

.close-modal-button:hover {
    background-color: #ff5a5a;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

/* Work confirmation styles */
.work-confirmation {
    text-align: center;
}

.work-confirmation h3 {
    color: #4CAF50;
    margin-bottom: 20px;
}

.work-confirmation button {
    background-color: #4a6bff;
    color: #f4f4f4;
    border: 4px solid #2a3b9f;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    margin-top: 20px;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
}

.work-confirmation button:hover {
    background-color: #5a7bff;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

/* Pet work status indicators */
.work-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
}

.work-indicator.working {
    background-color: rgba(255, 193, 7, 0.8);
    animation: pulse 2s infinite;
}

.work-indicator.completed {
    background-color: rgba(76, 175, 80, 0.8);
}

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

.pet-work-status {
    margin-top: 10px;
    padding: 8px;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.1);
}

.work-in-progress {
    color: #FFC107;
    font-weight: bold;
}

.work-time-remaining {
    font-size: 12px;
    opacity: 0.8;
}

.work-completed {
    color: #4CAF50;
    font-weight: bold;
}

.work-rewards {
    margin-top: 5px;
}

.cancel-work-button {
    background-color: #ff4a4a;
    color: white;
    border: 2px solid #df2a2a;
    padding: 10px 15px;
    margin-top: 1rem;
    width: 100%;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
}

.cancel-work-button:hover {
    background-color: #ff5a5a;
}

.claim-rewards-button {
    background-color: #4CAF50;
    color: white;
    border: 2px solid #01860a;
    padding: 10px 15px;
    width: 100%;
    cursor: pointer;
    font-size: 12px;
    margin-top: 1rem;
}

.claim-rewards-button:hover {
    background-color: #45a049;
}

/* Release Pet Styles */
.pet-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.release-pet-button {
    background-color: #ff4a4a;
    color: white;
    border: 2px solid #df2a2a;
    padding: 8px;
    margin-top: 0.5rem;
    width: 100%;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
}

.release-pet-button:hover {
    background-color: #ff5a5a;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

.release-confirmation h3 {
    color: #ff4a4a !important;
}

.warning-icon {
    font-size: 48px;
    text-align: center;
    margin: 20px 0;
    animation: pulse-warning 2s infinite;
}

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

.warning-text {
    color: #ff4a4a;
    font-weight: bold;
    text-align: center;
    margin: 20px 0;
    font-size: 14px;
}

.pet-name {
    color: #ffde3d;
    font-weight: bold;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    width: 100%;
    overflow: visible;
}

.modal-actions button {
    flex: none;
    min-width: 140px;
    max-width: 45%;
    padding: 10px 15px;
    white-space: nowrap;
}

.release-confirmation .confirm-release-button {
    background-color: #ff4a4a;
    color: #f4f4f4;
    border: 4px solid #9f2a2a;
    padding: 10px 15px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.1s;
    min-width: 120px;
    width: auto;
}

.release-confirmation .cancel-button:hover {
    background-color: #ff5a5a;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

/* Coming Soon Styles */
.coming-soon-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1rem;
    margin: 2rem auto;
    max-width: 600px;
    background-color: rgba(41, 35, 75, 0.8);
    border: var(--pixel-border) solid var(--border-color);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
    border-radius: 8px;
}

.coming-soon-icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
    animation: float 3s ease-in-out infinite;
}

.coming-soon-container h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--highlight-color);
    text-shadow: 3px 3px 0 #000;
}

.coming-soon-container p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

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

/* Add these media queries for mobile responsiveness */
@media (max-width: 768px) {
    .shop-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .shop-header h2 {
        margin-bottom: 0;
    }

    .user-gold {
        width: 100%;
        justify-content: center;
    }
}

/* Mobile navigation styles */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    .nav-menu {
        display: none; /* Start closed */
        position: absolute;
        width: 100%;
        z-index: 1000;
        flex-direction: column;
    }

    .nav-menu.show {
        display: flex; /* Only show when .show class is present */
    }

    .nav-menu li {
        width: 100%;
        border-bottom: 2px solid var(--border-color);
    }

    .nav-menu li:last-child {
        border-bottom: none;
    }

    .nav-menu a {
        padding: 12px 15px;
        display: block;
        text-align: left;
    }
}

.enemy-name {
    font-size: 20px;
    text-align: center;
    width: 100%;
    margin-top: 20px;
    color: #ff3d3d !important;
    text-shadow: 3px 3px 0 #000;
    margin-bottom: 20px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding: 0 10px;
    box-sizing: border-box;
    max-width: 100%;
    line-height: 1.4;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    #work-modal .modal-content {
        width: 95%;
        margin: 10px;
    }

    .work-options {
        max-height: 70vh;
        overflow-y: auto;
    }

    .work-option {
        margin-bottom: 15px;
    }

    .work-option button {
        width: 100%;
        margin-top: 10px;
    }

    .close-modal-button {
        position: sticky;
        top: 0;
        margin-bottom: 10px;
        width: 100%;
    }
}

/* Add this to your CSS file */
.pets-sort-controls {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.sort-label {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-color);
    text-shadow: 2px 2px 0 #000;
}

.sort-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.sort-button {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: var(--pixel-border) solid var(--border-color);
    padding: 8px 12px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.1s;
}

.sort-button:hover {
    background-color: var(--primary-color);
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

.sort-button.active {
    background-color: var(--primary-color);
    color: var(--highlight-color);
    border-color: var(--highlight-color);
}

/* Mobile responsiveness for sort controls */
@media (max-width: 768px) {
    .pets-sort-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .sort-buttons {
        width: 100%;
    }
    
    .sort-button {
        flex: 1;
        text-align: center;
        font-size: 10px;
        padding: 6px 8px;
    }
}

/* Add this to your CSS file */
.validation-error {
    color: var(--error-color);
    background-color: rgba(225, 72, 72, 0.2);
    border: 2px solid var(--error-color);
    padding: 8px;
    margin: 10px 0;
    font-size: 12px;
    text-align: center;
}

/* Battle Styles */
.battle-scene {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    background-color: var(--card-bg);

    border-radius: 8px;
    max-width: 900px;
    margin: 0 auto;
}

.battle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
}

.battle-header h2 {
    color: var(--highlight-color);
    text-shadow: 3px 3px 0 #000;
}

.battle-status {
    padding: 8px 15px;
    background-color: rgba(41, 35, 75, 0.8);
    border: var(--pixel-border) solid var(--border-color);
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
}

.battle-turn {
    color: var(--text-color);
    font-size: 1.2rem;
}

.battle-result {
    font-size: 1.2rem;
    font-weight: bold;
}

.battle-result.victory {
    color: var(--success-color);
}

.battle-result.defeat {
    color: var(--error-color);
}

.battle-arena {
    display: flex;
    justify-content: space-between;
    background-color: rgba(20, 17, 38, 0.9);
    padding: 30px;
    min-height: 300px;
    position: relative;
}

.battle-arena::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('/static/img/battle-bg.png') center/cover no-repeat;
    opacity: 0.15;
    pointer-events: none;
}

.battle-combatant {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 45%;
    position: relative;
    z-index: 1;
}

.battle-combatant.pet {
    align-self: flex-end;
}

.battle-combatant.enemy {
    align-self: flex-start;
}

.combatant-info {
    background-color: rgba(41, 35, 75, 0.9);
    border: var(--pixel-border) solid var(--border-color);
    padding: 15px;
    width: 100%;
    text-align: center;
}

.combatant-info h3 {
    color: var(--highlight-color);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.health-bar {
    height: 20px;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--border-color);
    position: relative;
}

.health-fill {
    height: 100%;
    background-color: var(--success-color);
    transition: width 0.5s ease-out;
}

.health-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-color);
    font-size: 0.8rem;
    text-shadow: 1px 1px 0 #000;
}

.combatant-sprite {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 150px;
}

.pet-sprite {
    max-height: 150px;
    max-width: 150px;
    min-height: 64px;
    min-width: 64px;
    image-rendering: pixelated;
}
.enemy-sprite {
    max-height: 150px;
    max-width: 150px;
    min-height: 128px;
    min-width: 128px;
    image-rendering: pixelated;
}



/* Battle animations */
.attack-animation {
    animation: attack 0.5s ease-in-out;
}

.damage-animation {
    animation: damage 0.5s ease-in-out;
}

@keyframes attack {
    0% { transform: translateX(0); }
    25% { transform: translateX(20px); }
    50% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

@keyframes damage {
    0% { 
        transform: translateX(0); 
        filter: none; /* Start normal */
    }
    25% { 
        transform: translateX(-10px); 
        /* Apply a strong red tint effect */
        filter: sepia(100%) hue-rotate(-55deg) saturate(500%) brightness(0.9); 
    }
    50% { 
        transform: translateX(5px); 
        /* Keep the red tint during the shake */
        filter: sepia(100%) hue-rotate(-55deg) saturate(500%) brightness(0.9); 
    }
    75% { 
        transform: translateX(-5px); 
        /* Keep the red tint during the shake */
        filter: sepia(100%) hue-rotate(-55deg) saturate(500%) brightness(0.9); 
    }
    100% { 
        transform: translateX(0); 
        filter: none; /* Return to normal */
    }
}

.battle-log {
    background-color: rgba(30, 25, 55, 0.9);
    padding: 15px;
    max-height: 150px;
    overflow-y: auto;
}

.battle-log h4 {
    color: var(--highlight-color);
    margin-bottom: 10px;
    text-align: center;
    text-shadow: 2px 2px 0 #000;
}

.log-entries {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-entry {
    padding: 5px 10px;
    background-color: rgba(0, 0, 0, 0.2);
    border-left: 3px solid var(--border-color);
}

.turn-number {
    color: var(--highlight-color);
    font-weight: bold;
    margin-right: 10px;
}

.event-text {
    color: var(--text-color);
}

.battle-controls {
    background-color: rgba(41, 35, 75, 0.8);
    padding: 15px;
}

.battle-controls h4 {
    color: var(--highlight-color);
    margin-bottom: 15px;
    text-align: center;
    text-shadow: 2px 2px 0 #000;
}

.battle-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.battle-action {
    flex: 1;
    max-width: 150px;
    padding: 12px 15px;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.2s;
}

.battle-action:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

.battle-action.attack {
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: var(--pixel-border) solid #aa3b2a;
}

.battle-action.attack:hover {
    background-color: #ff7b5a;
}

.battle-action.defend {
    background-color: #4a6bff;
    color: var(--text-color);
    border: var(--pixel-border) solid #2a3b9f;
}

.battle-action.defend:hover {
    background-color: #5a7bff;
}

.battle-action.special {
    background-color: #9a4aff;
    color: var(--text-color);
    border: var(--pixel-border) solid #7a2aff;
}

.battle-action.special:hover {
    background-color: #aa5aff;
}

.battle-results {
    background-color: rgba(41, 35, 75, 0.8);
    border: var(--pixel-border) solid var(--border-color);
    padding: 25px;
    text-align: center;
}

.victory-message h3, .defeat-message h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    text-shadow: 3px 3px 0 #000;
}

.victory-message h3 {
    color: var(--success-color);
}

.defeat-message h3 {
    color: var(--error-color);
}

.rewards-list {
    list-style-type: none;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.2);
    border: 2px solid var(--border-color);
    display: inline-block;
    margin: 15px 0;
}

.rewards-list li {
    margin-bottom: 8px;
    font-size: 1.1rem;
    color: var(--highlight-color);
}

.return-button {
    background-color: var(--primary-color);
    color: var(--text-color);
    border: var(--pixel-border) solid #2a3b9f;
    padding: 12px 20px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    margin-top: 25px;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.2s;
}

.return-button:hover {
    background-color: #5a7bff;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

.battle-intro {
    text-align: center;
    margin-bottom: 30px;
    padding: 15px;
    background-color: rgba(41, 35, 75, 0.7);
    border: var(--pixel-border) solid var(--border-color);
}

.battle-pet-card {
    display: flex;
    flex-direction: column;
    background-color: rgba(41, 35, 75, 0.8);
    border: var(--pixel-border) solid;
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
    padding: 15px;
    transition: transform 0.2s;
}

.battle-pet-card:hover {
    transform: translateY(-5px);
}

.pet-image-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.pet-reveal-image {
    width: 128px;
    height: 128px;
    object-fit: contain;
    image-rendering: pixelated;
}

.select-for-battle-btn {
    width: 100%;
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: var(--pixel-border) solid #aa3b2a;
    padding: 10px 15px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    margin-top: 15px;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.2s;
}

.select-for-battle-btn:hover {
    background-color: #ff7b5a;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

/* Mobile styles */
@media (max-width: 768px) {
    .battle-arena {
        flex-direction: column;
        gap: 30px;
        padding: 20px;
    }
    
    .battle-combatant {
        width: 100%;
    }
    
    .battle-combatant.pet {
        order: initial; /* Ensures default HTML source order */
    }
    
    .battle-combatant.enemy {
        order: initial; /* Ensures default HTML source order */
    }
    
    .battle-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .battle-action {
        max-width: 100%;
    }
    
    .battle-stats-comparison {
        flex-direction: column;
        gap: 15px;
    }
}

/* Add these styles for mobile pet cards */
@media (max-width: 768px) {
    .pets-grid {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .pet-card {
        position: relative;
        padding: 0;
        overflow: hidden;
        cursor: pointer;
    }
    
    .pet-card-summary {
        display: flex;
        align-items: center;
        padding: 0.75rem;
        width: 100%;
    }
    
    .pet-card-summary .pet-avatar {
        width: 50px;
        height: 50px;
        margin-right: 0.75rem;
        border: none;
    }
    
    .pet-card-summary .pet-name-summary {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    
    .pet-card-summary .pet-name-summary h3 {
        margin: 0;
        font-size: 12px;
    }
    
    .pet-level-summary {
        font-size: 12px;
        opacity: 0.8;
    }
    
    .pet-status-indicator {
        color: #ffcc00;
        font-weight: bold;
        font-size: 12px;
        margin-left: 0.5rem;
    }
    
    .expand-indicator {
        margin-left: 0.75rem;
        font-size: 20px;
        color: #6a6a6a;
        transition: transform 0.3s ease;
    }
    
    .pet-card-details {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        padding: 0 0.75rem;
    }
    
    .pet-card.expanded .pet-card-details {
        max-height: 500px; /* Adjust based on content */
        padding-bottom: 0.75rem;
    }
    
    .pet-card.expanded .expand-indicator {
        transform: rotate(90deg);
    }
    
    /* Ensure proper styling inside the expanded section */
    .pet-card-details .pet-info {
        padding-top: 0.5rem;
        border-top: 1px solid #3f3f3f;
    }
    
    .pet-card-details .pet-header {
        display: none; /* Hide the duplicated header */
    }
}

/* Hide mobile summary on desktop */
.pet-card-summary {
    display: none; /* Hidden by default on desktop */
}

/* Make details visible on desktop */
.pet-card-details {
    max-height: none; /* Always expanded on desktop */
    padding: 1rem;
}

/* For mobile screens, show summary and collapse details */
@media (max-width: 768px) {
    .pet-card-summary {
        display: flex; /* Show on mobile */
    }
    
    .pet-card-details {
        max-height: 0; /* Collapsed by default on mobile */
        padding: 0 0.75rem;
    }
    
    .pet-card.expanded .pet-card-details {
        max-height: 500px; /* Expand when clicked on mobile */
        padding-bottom: 0.75rem;
    }
    
    /* Rest of the mobile styles remain the same */
}

.battle-events-panel {
    flex-direction: column;
    background-color: #25252563;
    border: 2px solid #3f3f3f;
    border-radius: 6px;
    padding: 1rem;
    display: flex;
}

.battle-events-panel-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.battle-events-panel-title {
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
    text-shadow: 2px 2px 0 #000;
}

/* Styles for active/inactive pets */
.active-status {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid #252525;
}

.active-pet .active-status {
    background: #00ff00;
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

.inactive-pet .active-status {
    background: #777;
}

.inactive-pet {
    opacity: 0.7;
}

.pets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.active-pets-button {
    background-color: #4a6bff;
    color: white;
    border: 2px solid #2a4bdf;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
}

.active-pets-button:hover {
    background-color: #3a5bef;
}

.edit-active-pets-modal {
    max-height: 70vh;
    overflow-y: auto;
}

.pets-selection-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Force exactly 3 columns */
    gap: 15px;
    margin: 20px 0;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 10px;
}

.pet-selection-card {
    background-color: #252525;
    border: 2px solid #3f3f3f;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease-in-out;
    height: 80px; /* Force consistent height */
    box-sizing: border-box;
}

.pet-selection-card:hover {
    border-color: #5a5a5a;
    transform: translateY(-2px);
}

.pet-selection-card.active {
    border-color: #ffd700;
    background-color: rgba(255, 215, 0, 0.1);
}

.pet-selection-card.active:hover {
    border-color: #ffea80;
}

.active-status-indicator {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
}

.active-status-indicator span {
    color: #777;
}

.active .active-status-indicator span {
    color: #ffd700;
}

/* Additional styles to make the card look more clickable */
.pet-selection-card {
    cursor: pointer;
    user-select: none;
}

@media (max-width: 768px) {
    .pets-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .active-pets-button {
        align-self: flex-end;
    }
    
    .pets-selection-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on mobile */
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .pets-selection-grid {
        grid-template-columns: 1fr; /* 1 column on very small screens */
    }
}

/* Ability buttons */
.battle-action.ability {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 15px;
    text-align: center;
    margin: 0 5px;
    font-weight: bold;
    color: white;
    background-color: #6a5acd; /* Default ability color */
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.battle-action.ability:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Style for different ability types */
.battle-action.attack-ability {
    background-color: #d9534f; /* Red for attack abilities */
    color: var(--text-color);
    border: var(--pixel-border) solid #aa3b2a;
}

.battle-action.elemental-ability {
    background-color: #5bc0de; /* Blue for elemental abilities */
}

.battle-action.support-ability {
    background-color: #5cb85c; /* Green for support abilities */
}

.battle-action.special-ability {
    background-color: #f0ad4e; /* Orange for special abilities */
}

.ability-cost {
    font-size: 0.8em;
    margin-top: 2px;
    opacity: 0.8;
}

/* Make the battle actions more responsive */
@media (max-width: 768px) {
    .battle-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .battle-action.ability {
        margin: 5px;
        min-width: 100px;
    }
}

.abilities-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
}

.abilities-header {
    font-size: 0.9em;
    color: #aaa;
    margin-bottom: 4px;
}

.abilities-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.ability-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    cursor: help;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ability-name {
    color: #fff;
}

.ability-cost {
    color: #ffd700;
    font-size: 0.9em;
}

/* Custom tooltip styling */
.ability-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Optional: If you want a custom tooltip instead of the default browser tooltip */
.ability-item {
    position: relative;
}

.ability-item:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    white-space: nowrap;
    z-index: 10;
    margin-bottom: 4px;
}

/* Update these styles in your CSS file */
.level-abilities-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin: 0.75rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pet-level {
    margin: 0;
    font-size: 12px;
    color: white;
    flex-shrink: 0;
}

.abilities-section {
    margin: 0;
    padding: 0;
    border: none;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.abilities-header {
    font-size: 0.9em;
    color: #aaa;
    margin-bottom: 4px;
}

.abilities-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
}

.ability-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    cursor: help;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Add responsive adjustments */
@media (max-width: 768px) {
    .level-abilities-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .abilities-section {
        align-items: flex-start;
    }
    
    .abilities-list {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .pet-card-details {
        display: none;
        padding: 1rem;
        background: rgba(0, 0, 0, 0.2);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .pet-card.expanded .pet-card-details {
        display: block;
    }

    .nickname-form {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin: 0.5rem 0;
    }

    .nickname-input {
        width: 100%;
        padding: 0.5rem;
        background: rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 4px;
        color: #fff;
    }

    .form-buttons {
        display: flex;
        gap: 0.5rem;
    }

    .save-button,
    .cancel-button {
        padding: 0.5rem 1rem;
        border-radius: 4px;
        cursor: pointer;
        flex: 1;
    }

    .save-button {
        background: #4CAF50;
        color: white;
        border: none;
    }

    .cancel-button {
        background: #f44336;
        color: white;
        border: none;
    }


    .edit-button {
        display: inline-block;
        padding: 0.25rem 0.75rem;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 4px;
        color: #fff;
        cursor: pointer;
        font-size: 0.9rem;
    }

    .edit-button:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    .validation-error {
        color: #ff4444;
        margin: 0.5rem 0;
        font-size: 0.9rem;
    }
}

/* Base nickname form styles - keep these outside media queries */
.nickname-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.5rem 0;
    width: 100%;
}

.nickname-input {
    width: 100%;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
}

.form-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.nickname-form .save-button,
.nickname-form .cancel-button {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    flex: 1;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
}

.nickname-form .save-button {
    background: #4CAF50;
    color: white;
    border: 2px solid #2a9e30;
}

.nickname-form .cancel-button {
    background: #f44336;
    color: white;
    border: 2px solid #9e2a2a;
}

/* Mobile styles */
@media (max-width: 768px) {
    /* Critical: Ensure the pet card details are visible when editing */
    .pet-card.expanded .pet-card-details,
    .pet-card .pet-card-details:has(.nickname-form) {
        display: block !important; /* Force display when nickname form is present */
        padding: 1rem;
        max-height: none !important; /* Override any max-height restrictions */
    }

    /* Ensure the name section is visible when editing */
    .pet-card .pet-name-section:has(.nickname-form) {
        display: block !important;
    }

    /* Style the edit button to be more visible on mobile */
    .edit-button {
        display: inline-block;
        padding: 0.25rem 0.75rem;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 4px;
        color: #fff;
        cursor: pointer;
        font-size: 0.9rem;
        margin-top: 0.5rem;
    }

    /* Ensure the nickname form is always visible when present */
    .nickname-form {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: static !important;
        margin: 0.75rem 0;
    }

    /* Ensure form buttons are visible and properly laid out */
    .nickname-form .form-buttons {
        display: flex !important;
        flex-direction: row;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }
}

.edit-party-header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 100%;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
    text-align: center;
}

.edit-party-header h3 {
    text-align: center;
    margin: 0;
    width: 100%;
}

.release-multiple-button {
    padding: 0.5rem 1rem;
    background-color: #ff4444;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.release-multiple-button:hover {
    background-color: #ff6666;
}

.pets-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    padding: 1rem;
    max-height: 60vh;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

@media (max-width: 768px) {
    .pets-selection-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        padding: 0.5rem;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .pets-selection-grid {
        grid-template-columns: 1fr;
    }
}

.pet-selection-card.selected {
    background: rgba(255, 0, 0, 0.1);
    border-color: #ff4444;
}

.pets-to-release {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.pet-release-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: rgba(255, 0, 0, 0.1);
    border-radius: 4px;
    border: 1px solid #ff4444;
}

@media (max-width: 768px) {
    .pets-selection-grid {
        grid-template-columns: 1fr;
    }
}

.pet-details-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.pet-details-modal .modal-content { 
    max-width: 600px; /* Example desktop width */
    display: flex; 
    flex-direction: column; 
}

.close-details-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--error-color);
    color: var(--text-color);
    border: var(--pixel-border) solid #8f2a2a;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    padding: 1px 4px;
}

.close-details-btn:hover {
    background-color: #e15a5a;
}

.pet-details-header {
    display: flex;
    gap: 15px; /* Space between image and text */
    margin-bottom: 20px;
    align-items: center; /* Align items vertically */
}

.pet-details-avatar {
    flex-shrink: 0; /* Prevent avatar from shrinking too much */
}

.pet-details-image {
    width: 100px; /* Adjust size as needed */
    height: 100px;
    image-rendering: pixelated;
    border: 2px solid var(--border-color);
}

.pet-details-name h2 {
    font-size: 1.2rem; /* Adjust size */
    margin-bottom: 5px;
    color: var(--highlight-color);
}
.pet-details-name p {
    font-size: 0.9rem; /* Adjust size */
    margin-bottom: 3px;
}


.pet-details-body {
    display: flex;
    flex-direction: column;
    gap: 20px; /* Space between sections */
}

.pet-details-stats h3,
.pet-details-abilities h3,
.pet-details-equipment h3,
.pet-details-records h3 {
    color: var(--highlight-color);
    margin-bottom: 10px;
    text-shadow: 2px 2px 0 #000;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 5px;
    font-size: 1.1rem; /* Ensure consistent heading size */
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columns by default */
    gap: 10px 20px; /* Row and column gap */
}

.stat-item span:first-child {
    font-weight: bold;
    color: #aaa; /* Lighter color for label */
    margin-right: 5px;
}
.stat-item span:last-child {
    color: var(--highlight-color); /* Value color */
}


.abilities-list-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ability-item-details {
    background: rgba(255, 255, 255, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.9em;
}

.equipment-slots {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columns by default */
    gap: 20px;
}

.equipment-slot h4 {
    margin-bottom: 8px;
    color: #ccc;
    font-size: 1rem; /* Adjust size */
}

.item-display {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.2);
    padding: 8px;
    border-radius: 4px;
}

.item-icon {
    width: 40px;
    height: 40px;
    image-rendering: pixelated;
    border: 1px solid var(--border-color);
}

/* Style equip/unequip buttons specifically within the details modal */
.pet-details-modal .equip-button, 
.pet-details-modal .unequip-button {
    padding: 4px 8px;
    font-size: 0.8rem;
    /* Re-apply base button styles if they aren't inherited */
    font-family: 'Press Start 2P', monospace;
    cursor: pointer;
    border: var(--pixel-border) solid #2a3b9f; 
    box-shadow: 3px 3px 0 rgba(0,0,0,0.5);
}
.pet-details-modal .equip-button { background-color: var(--success-color); border-color: #2a9e30;}
.pet-details-modal .unequip-button { background-color: var(--secondary-color); border-color: #aa3b2a;}


.pet-details-records p {
    margin-bottom: 5px;
}


/* --- Mobile Adjustments for Pet Details Modal --- */
@media (max-width: 768px) {
    .pet-details-modal .modal-content {
        /* Adjustments specific to pet details on mobile */
        padding: 15px; 
        font-size: 0.9rem; 
    }

    .pet-details-header {
        flex-direction: column; 
        text-align: center; 
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .pet-details-avatar {
         margin-bottom: 5px; 
    }

    .pet-details-image {
        width: 80px; 
        height: 80px;
    }
    
    .pet-details-name h2 {
        font-size: 1.1rem; 
    }
    .pet-details-name p {
        font-size: 0.8rem; 
    }

    .pet-details-body {
        gap: 15px; 
    }
    
    .pet-details-stats h3,
    .pet-details-abilities h3,
    .pet-details-equipment h3,
    .pet-details-records h3 {
        font-size: 1rem; 
        margin-bottom: 8px;
    }

    .stats-grid {
        grid-template-columns: 1fr; /* Stack stats */
        gap: 8px; 
    }
    
    .stat-item {
        display: flex; 
        justify-content: space-between; 
        padding: 3px 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
     .stat-item span:first-child {
        margin-right: 10px; 
    }


    .equipment-slots {
        grid-template-columns: 1fr; /* Stack equipment */
        gap: 15px;
    }

    .equipment-slot h4 { font-size: 0.9rem;}
    
    .item-display {
        padding: 6px;
        gap: 8px;
    }
    
    .item-icon {
        width: 32px;
        height: 32px;
    }
    
    .pet-details-modal .equip-button, 
    .pet-details-modal .unequip-button {
        padding: 3px 6px;
        font-size: 0.75rem;
    }
}

/* --- End of Pet Details Modal Specific Styles --- */ 

/* Container specifically for holding dynamically loaded modals */
#modal-container {
    position: relative; /* Or fixed, depending on desired behavior */
    z-index: 1000; /* Decreased z-index */
}

/* --- Mobile Adjustments --- */
@media (max-width: 768px) {
    /* ... (Keep other mobile styles) ... */

    /* --- Battle Scene Mobile --- */
    .battle-scene {
        padding: 10px; /* Reduce padding */
        gap: 15px;
    }

    .battle-header h2 {
        font-size: 1.2rem; /* Smaller header */
    }
    
    .battle-status {
        padding: 5px 10px;
        font-size: 0.9rem;
    }
    
    .battle-turn, .battle-result {
        font-size: 1rem; /* Slightly smaller turn/result text */
    }

    .battle-arena {
        /* Option 1: Try keeping row, but make elements smaller */
        flex-direction: row; /* Keep side-by-side */
        justify-content: space-around; /* Add some space */
        padding: 15px 10px; /* Reduce padding */
        min-height: 200px; /* Reduce min height */
        gap: 10px;

        /* Option 2 (Alternative): If stacking is unavoidable, manage space better */
        /* flex-direction: column;
           gap: 15px;
           padding: 10px;
           min-height: auto; */
    }

    .battle-combatant {
        /* Option 1 adjustments */
        width: 48%; /* Make combatants narrower to fit */
        gap: 10px; /* Reduce gap inside combatant */
        
        /* Option 2 adjustments (if stacking) */
        /* width: 100%;
           gap: 5px; */
    }
    
    .combatant-info {
        padding: 8px; /* Smaller info box */
    }

    .combatant-info h3 {
        font-size: 0.9rem; /* Smaller name */
        margin-bottom: 5px;
    }

    .health-bar {
        height: 15px; /* Smaller health bar */
    }

    .health-text {
        font-size: 0.7rem; /* Smaller health text */
    }

    .combatant-sprite {
        height: 100px; /* Reduce sprite area height */
    }

    .pet-sprite, .enemy-sprite {
        max-height: 80px; /* Significantly smaller sprites */
        max-width: 80px;
        min-height: 48px; /* Adjust minimums too */
        min-width: 48px;
    }
    
    /* Shrink enemy slightly more if needed */
    .enemy-sprite {
         max-height: 70px; 
         max-width: 70px;
         min-height: 64px; 
         min-width: 64px; 
    }

    .battle-log {
        padding: 10px;
        max-height: 100px; /* Limit height, make scrollable */
        overflow-y: auto;
    }

    .battle-log h4 {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }
    
    .log-entry {
        padding: 3px 5px;
        font-size: 0.8rem; /* Smaller log text */
    }

    .battle-controls {
        padding: 10px;
    }

    .battle-controls h4 {
        font-size: 1rem; /* Smaller controls title */
        margin-bottom: 10px;
    }

    .battle-actions {
        /* Use grid for better button layout on mobile */
        display: grid;
        grid-template-columns: repeat(2, 1fr); /* 2 buttons per row */
        gap: 8px; /* Adjust gap */
        /* flex-direction: column; /* If stacking is preferred */
        /* gap: 8px; */
    }

    .battle-action {
        max-width: 100%; /* Allow buttons to fill grid cells */
        font-size: 12px; /* Smaller button text */
        padding: 10px 8px; /* Adjust padding */
    }
    
    /* Adjustments for battle results on mobile */
    .battle-results {
        padding: 15px;
    }
    .victory-message h3, .defeat-message h3 {
        font-size: 1.5rem;
    }
    .rewards-list li {
        font-size: 1rem;
    }
    .return-button {
         font-size: 12px;
         padding: 10px 15px;
         margin-top: 15px;
    }
}

/* Level Up Modal Specific Styles */
#level-up-modal .modal-content {
    position: relative; /* Needed for fireworks positioning */
    overflow: hidden;   /* Keep fireworks contained */
}

.level-up-stats p {
    margin: 5px 0;
    font-size: 1rem;
}

.stat-value-yellow {
    color: #ffd700; /* Yellow */
    font-weight: bold;
}

.stat-increase-green {
    color: #00ff00; /* Bright Green */
    font-weight: bold;
}

/* Fireworks Animation - UPDATED for Explosion Effect */
.fireworks-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

/* The initial rising particle */
.firework-rocket {
    position: absolute;
    bottom: 0;
    width: 4px;
    height: 8px;
    background-color: #eee; /* Rocket trail */
    border-radius: 1px;
    opacity: 0;
    animation: firework-rocket-rise 1s ease-in forwards; /* Rise and fade */
    box-shadow: 0 0 3px #eee, 0 0 5px #eee;
}

/* The smaller explosion particles */
.firework-spark {
    position: absolute;
    width: 3px;
    height: 3px;
    background-color: white; /* Base spark color */
    border-radius: 50%;
    opacity: 1;
    animation: firework-spark-explode 0.8s ease-out forwards; /* Explode and fade */
}

/* Randomize spark colors */
.firework-spark:nth-child(5n+1) { background-color: #ff4444; box-shadow: 0 0 4px #ff4444, 0 0 6px #ff4444;}
.firework-spark:nth-child(5n+2) { background-color: #44ff44; box-shadow: 0 0 4px #44ff44, 0 0 6px #44ff44;}
.firework-spark:nth-child(5n+3) { background-color: #4444ff; box-shadow: 0 0 4px #4444ff, 0 0 6px #4444ff;}
.firework-spark:nth-child(5n+4) { background-color: #ffff44; box-shadow: 0 0 4px #ffff44, 0 0 6px #ffff44;}
.firework-spark:nth-child(5n+5) { background-color: #ff44ff; box-shadow: 0 0 4px #ff44ff, 0 0 6px #ff44ff;}


@keyframes firework-rocket-rise {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.7);
    }
    50% {
        opacity: 1; /* Fade in during rise */
    }
    100% {
        opacity: 0; /* Fade out at peak */
        transform: translateY(-220px) scale(0.3); /* Rise higher */
    }
}

@keyframes firework-spark-explode {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0.5); /* Explode outwards */
    }
}

/* Level up modal specific close button */
#level-up-modal .close-modal-button {
    /* Add any specific styles if needed, otherwise inherits from .confirm-button */
     margin-top: 20px;
}

#level-up-modal .modal-actions .confirm-button {
     z-index: 10; /* Ensure button is above fireworks */
     position: relative;
}

/* Add these styles, potentially near other modal or item styles */

.equip-options-list {
	max-height: 40vh; /* Limit height and make scrollable */
	overflow-y: auto;
	padding-right: 10px; /* Space for scrollbar */
	margin-bottom: 15px;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    padding-top: 10px;
}
.equip-option-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px;
	margin-bottom: 8px;
	background-color: #f9f9f9;
	border: 1px solid #eee;
	border-radius: 4px;
	gap: 10px;
    transition: background-color 0.2s ease-in-out;
}
.equip-option-item:hover {
    background-color: #f0f0f0;
}
.equip-item-info {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-grow: 1;
    overflow: hidden; /* Prevent long names breaking layout */
}
.item-icon-small {
	width: 32px;
	height: 32px;
	object-fit: contain;
	background-color: #e0e0e0;
	border-radius: 4px;
	image-rendering: pixelated; /* Keep pixel art crisp */
    flex-shrink: 0; /* Prevent icon shrinking */
}
.equip-item-name {
	font-size: 0.9rem;
	display: flex;
	flex-direction: column;
    white-space: nowrap; /* Prevent wrapping */
    overflow: hidden;
    text-overflow: ellipsis; /* Add ellipsis if name is too long */
}
.equip-item-rarity {
	font-size: 0.75rem;
	color: #666;
}
.equip-item-stats {
	font-size: 0.8rem;
	color: #4CAF50; /* Green for positive stats */
	display: flex;
    flex-wrap: wrap;
	gap: 5px 10px; /* Row and column gap */
    justify-content: flex-end;
    min-width: 120px; /* Ensure some space for stats */
    text-align: right;
    flex-shrink: 0; /* Prevent stats shrinking */
}
.equip-item-stats span {
    white-space: nowrap;
    background-color: rgba(76, 175, 80, 0.1); /* Light green background */
    padding: 2px 4px;
    border-radius: 3px;
}
.equip-this-button {
	padding: 5px 10px;
	font-size: 0.8rem;
	background-color: var(--success-color); /* Use success color */
	color: white;
	border: none;
	border-radius: 4px;
	cursor: pointer;
    white-space: nowrap;
    border: 2px solid #2a9e30; /* Match other buttons */
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.1s;
    flex-shrink: 0;
}
.equip-this-button:hover {
	background-color: #3ea043; /* Slightly darker success */
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
}
.equip-this-button:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
}

/* Adjust modal header for back button */
#pet-details-modal .modal-header .close-details-btn {
    /* Use existing styles or define new ones if needed */
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--secondary-dark-color);
}
#pet-details-modal .modal-header .close-details-btn:hover {
    background-color: var(--secondary-dark-color);
}

.pet-details-equipment h3 {
    margin-bottom: 15px; /* Add some space below the "Equipment" title */
    text-align: center; /* Center the title */
}

.equipment-slots {
	display: flex; /* Use flexbox */
	flex-wrap: wrap; /* Allow items to wrap to the next line */
	justify-content: space-around; /* Distribute space around items */
	gap: 20px; /* Add space between the slots */
	margin-top: 10px;
	padding: 0 10px; /* Add some horizontal padding */
}

.equipment-slot {
    flex-basis: calc(50% - 20px); /* Aim for two columns, adjusting for gap */
    min-width: 180px; /* Minimum width before wrapping */
    display: flex;
    flex-direction: column; /* Stack elements vertically */
    align-items: center; /* Center items horizontally */
    text-align: center;
    padding: 10px;
    border: 1px solid var(--accent-color-dark);
    border-radius: 5px;
    background-color: rgba(0, 0, 0, 0.1); /* Slight background */
}


.equipment-slot h4 {
	margin-bottom: 10px; /* Space below slot title */
	font-size: 1rem;
	color: var(--text-color);
	width: 100%; /* Ensure title takes full width */
    border-bottom: 1px solid var(--accent-color-medium); /* Separator line */
    padding-bottom: 5px;
}

.item-display {
	display: flex;
	flex-direction: column; /* Stack icon, name, button vertically */
	align-items: center;
	gap: 8px; /* Space between elements in the display */
	width: 100%; /* Take full width of the slot */
	margin-bottom: 10px; /* Space below item if present */
}

.item-icon {
	width: 48px; /* Slightly larger icon */
	height: 48px;
	object-fit: contain;
	margin-bottom: 5px; /* Space below icon */
    image-rendering: pixelated; /* Keep pixel art crisp */
}

/* Adjust the equip/unequip buttons inside the modal */
.pet-details-modal .equip-button,
.pet-details-modal .unequip-button {
	padding: 6px 12px;
	font-size: 0.9rem;
	cursor: pointer;
	border: 2px solid;
	border-radius: 4px;
	margin-top: auto; /* Push button towards the bottom */
}

.pet-details-modal .equip-button { background-color: var(--success-color); border-color: #2a9e30; color: white;}
.pet-details-modal .unequip-button { background-color: var(--secondary-color); border-color: #aa3b2a; color: white;}

.equipment-slot p { /* Style the 'None' text */
    margin-top: 10px;
    margin-bottom: 10px;
    color: #aaa; /* Lighter color for 'None' */
}

/* ... existing code ... */

/* Ensure equip-item-name divs within item-display stack correctly */
.item-display .equip-item-name {
    display: flex;
    flex-direction: column; /* Stack name and rarity vertically */
    align-items: center;
    gap: 2px; /* Small gap between name and rarity */
}

.item-display .equip-item-rarity {
    font-size: 0.8em; /* Smaller font for rarity */
    color: #ccc; /* Lighter color for rarity */
}


/* ... existing code ... */

@media (max-width: 768px) {
    /* ... other responsive styles ... */

	.pet-details-body {
		padding: 15px;
	}

	.pet-details-stats h3,
	.pet-details-abilities h3,
	.pet-details-equipment h3, /* Apply consistent styling */
	.pet-details-records h3 {
		font-size: 1.1rem;
		margin-bottom: 8px;
		text-align: center; /* Center titles on mobile */
        padding-bottom: 5px;
        border-bottom: 1px solid var(--accent-color-medium);
	}

	.stats-grid {
		grid-template-columns: 1fr 1fr; /* Two columns for stats */
		gap: 5px 15px; /* Adjust gap */
	}

	.stat-item {
		font-size: 0.9rem;
	}

     .stat-item span:first-child {
		font-weight: bold;
		color: #ddd;
	}

	.equipment-slots {
		flex-direction: column; /* Stack slots vertically on small screens */
		gap: 15px; /* Adjust gap for vertical stacking */
        padding: 0; /* Remove horizontal padding when stacking */
	}

    .equipment-slot {
        flex-basis: 100%; /* Take full width when stacked */
        min-width: unset; /* Remove min-width when stacking */
    }

	.equipment-slot h4 { font-size: 0.9rem;}

	.item-display {
		/* Keep vertical stacking */
        gap: 5px;
	}

	.item-icon {
		width: 40px;
		height: 40px;
	}

	.pet-details-modal .equip-button,
	.pet-details-modal .unequip-button {
        display: flex;
        justify-content: center;
		padding: 5px 10px;
		font-size: 0.8rem;
        align-items: center;

	}
}

/* Styles for the Equip Options Modal Content */
.equip-options-modal-content {
    max-height: 80vh; /* Limit height and allow scrolling */
    overflow-y: auto;
}


/* Styles for the header within the Equip Options Modal */
.equip-options-modal-content .modal-header {
    display: flex;
    justify-content: space-between; /* Pushes title and button apart */
    align-items: center;        /* Vertically aligns them */
    margin-bottom: 20px;        /* Increased space below header */
    padding-bottom: 10px;       /* Space below the text/button */
    border-bottom: 1px solid var(--accent-color-dark); /* Separator line */
}

.equip-options-modal-content .modal-header h3 {
    margin: 0; /* Remove default margin */
    flex-grow: 1; /* Allow title to take available space */
    margin-right: 15px; /* Add space between title and button */
    font-size: 1.2rem; /* Adjust font size if needed */
}

/* Use existing .close-details-btn styles, but ensure it doesn't shrink */
.equip-options-modal-content .modal-header .close-details-btn {
   flex-shrink: 0; /* Prevent the button from shrinking */
   /* Adjust padding/font-size if needed for this specific context */
   padding: 4px 10px;
   font-size: 0.9rem;
   background-color: var(--accent-color-medium); /* Match back button style? */
   border-color: var(--accent-color-dark);
}
.equip-options-modal-content .modal-header .close-details-btn:hover {
   background-color: var(--accent-color-dark);
}


/* Styling for the list */
.equip-options-list {
	display: flex;
	flex-direction: column;
	gap: 10px; /* Space between items */
    padding: 0 5px; /* Slight padding for the list */
}

.equip-option-item {
	display: flex;
	align-items: center; /* Align items vertically */
	justify-content: space-between; /* Space out sections */
	background-color: rgba(255, 255, 255, 0.05); /* Slight background */
	padding: 10px;
	border-radius: 4px;
	border: 1px solid var(--accent-color-dark);
    gap: 10px; /* Gap between sections */
    flex-wrap: wrap; /* Allow wrapping on small screens */
}

.equip-option-item:hover {
	background-color: rgba(255, 255, 255, 0.1);
}

.equip-item-info {
	display: flex;
	align-items: center;
	gap: 10px; /* Space between icon and name */
    flex-grow: 1; /* Allow info to take space */
    min-width: 150px; /* Prevent shrinking too much */
}

.item-icon-small {
	width: 32px;
	height: 32px;
	object-fit: contain;
    image-rendering: pixelated;
    flex-shrink: 0; /* Don't shrink icon */
}

.equip-item-name {
	display: flex;
	flex-direction: column; /* Stack name and rarity */
    align-items: flex-start; /* Align text left */
}

.equip-item-rarity {
	font-size: 0.8em;
	color: #bbb; /* Lighter rarity text */
	margin-left: 0; /* Rarity is now below */
    margin-top: 2px;
}

.equip-item-stats {
	display: flex;
	flex-direction: column; /* Stack stats vertically */
	align-items: flex-start; /* Align stats text left */
	gap: 2px;
	font-size: 0.85em;
	color: #ddd;
    min-width: 80px; /* Give stats some minimum space */
    text-align: left;
}

.equip-item-stats span {
	display: block; /* Ensure each stat is on its own line */
    white-space: nowrap; /* Prevent stats from wrapping */
}

.equip-this-button {
	padding: 6px 12px;
	font-size: 0.9rem;
	background-color: var(--success-color);
	border: 2px solid #2a9e30;
	color: white;
	border-radius: 4px;
	cursor: pointer;
	transition: background-color 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0; /* Prevent button shrinking */
}

.equip-this-button:hover {
	background-color: #3abf40;
    border-color: #3abf40;
}

.equip-this-button:active {
	background-color: #2a9e30;
}

/* Styles for the 'No Items' message */
.equip-options-modal-content .no-items-message {
    text-align: center;
    padding: 25px 10px;
    color: #ccc;
    font-style: italic;
}

/* Styles for the 'Go to Shop' link container */
.equip-options-modal-content .go-to-shop-container {
    text-align: center;
    margin-top: 10px;
    padding-bottom: 15px; /* Add padding at the bottom */
}

.equip-options-modal-content .shop-link {
    /* Inherits general .shop-link styles */
    /* Add specific overrides if needed */
    font-size: 0.9em;
    padding: 6px 12px;
}


/* ... existing code ... */

/* Responsive adjustments for equip options */
@media (max-width: 500px) {
    .equip-option-item {
        flex-direction: column; /* Stack everything vertically */
        align-items: stretch; /* Stretch items */
    }
    .equip-item-info {
        justify-content: center; /* Center icon and name */
        margin-bottom: 10px;
    }
    .equip-item-name {
        align-items: center; /* Center text */
    }
     .equip-item-stats {
        align-items: center; /* Center stats */
        margin-bottom: 10px;
        min-width: unset; /* Remove min-width */
    }
    .equip-this-button {
        align-self: center; /* Center button */
    }

    .equip-options-modal-content .modal-header h3 {
        font-size: 1rem; /* Smaller title */
    }

}

/* ... existing code ... */

/* Styles for Egg Carton Result Modal Content */
.egg-result {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin: 20px 0;
	color: #3d2f2f; /* Ensure text color is readable on potentially white background */
}

.egg-row {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap; /* Allow wrapping if many eggs */
	justify-content: center;
	gap: 15px;
	margin-bottom: 20px;
	max-width: 100%; /* Prevent row from exceeding modal width */
}

.egg-image {
	width: 80px; /* Keep size reasonable */
	height: 80px;
	display: flex;
	justify-content: center;
	align-items: center;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 2px 4px rgba(0,0,0,0.2);
	background-color: #eee; /* Light background for the image container */
	flex-shrink: 0; /* Prevent images from shrinking too much */
}

.egg-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	image-rendering: pixelated; /* Keep egg pixelated */
}

.egg-message {
	font-size: 1rem; /* Use relative units */
	text-align: center;
	color: #3d2f2f;
}
.egg-message p {
    color: #3d2f2f; /* Ensure paragraph text is visible */
    margin-bottom: 0.5rem; /* Add some spacing */
    line-height: 1.4;
}
.egg-message strong {
    color: var(--highlight-color); /* Use theme highlight color */
}


/* Ensure base modal styles are sufficient */
/* Example base styles (adjust if yours are different) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 15px; /* Add padding to prevent modal touching edges */
}

.modal-content {
    background-color: var(--card-bg); /* Use theme card background */
    border: var(--pixel-border) solid var(--highlight-color); /* Use theme border */
    box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.5);
    padding: 20px;
    width: auto; /* Allow content to determine width */
    max-width: 500px; /* Limit maximum width */
	min-width: 300px; /* Optional: Set a minimum width */
    max-height: 90vh; /* Limit height */
    overflow-y: auto; /* Allow scrolling if content exceeds height */
    color: var(--text-color); /* Use theme text color */
    text-align: center; /* Center text by default */
    position: relative; /* For potential absolute positioning inside */
}

.modal-content h2 {
	color: var(--highlight-color); /* Use theme highlight */
	text-shadow: 2px 2px 0 #000; /* Match theme */
	margin: 0 0 20px 0; /* Adjust spacing */
    font-size: 1.5rem;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
}

.modal-btn {
    background-color: var(--primary-color);
    color: var(--text-color);
    border: var(--pixel-border) solid #2a3b9f;
    padding: 10px 20px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px; /* Consistent button font size */
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.1s;
    text-decoration: none; /* Ensure links styled as buttons look right */
    display: inline-block; /* Necessary for anchors */
    text-align: center;
}
.modal-btn:hover {
    background-color: #5a7bff;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

.modal-btn.primary-btn {
    background-color: var(--success-color); /* Use success color for primary */
    border-color: #2a9e30; /* Matching border */
    color: white;
}
.modal-btn.primary-btn:hover {
    background-color: #5af160; /* Lighter success color on hover */
}


/* ... rest of your styles ... */

/* --- Styles Specific to Egg Carton Result Modal --- */

/* Override general modal content for egg results */
.egg-result-modal-content {
	background-color: #fff; /* White background */
	border: 3px solid gold; /* Gold border */
	color: #3d2f2f; /* Dark text */
	border-radius: 10px; /* Rounded corners */
	/* Keep max-width, padding etc. from .modal-content or redefine */
	padding: 20px;
	width: auto;
	max-width: 500px;
	min-width: 300px;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Keep shadow */
	text-align: center;
}

/* Override general h2 for egg results */
.egg-result-modal-content h2 {
	color: #333; /* Dark heading */
	font-family: 'Press Start 2P', monospace; /* Ensure font */
    text-shadow: none; /* Remove theme text shadow */
    margin-bottom: 20px;
}

/* Styles for elements inside the egg result modal */
.egg-result-modal-content .egg-result {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin: 20px 0;
	color: #3d2f2f; /* Ensure dark text */
}

.egg-result-modal-content .egg-row {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	justify-content: center;
	gap: 15px;
	margin-bottom: 20px;
	max-width: 100%;
}

/* Use specific selector for egg images inside this modal */
.egg-result-modal-content .egg-result-image {
	width: 80px;
	height: 80px;
	display: flex;
	justify-content: center;
	align-items: center;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 2px 4px rgba(0,0,0,0.2);
	background-color: #eee; /* Light gray background */
	flex-shrink: 0;
}

.egg-result-modal-content .egg-result-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	image-rendering: pixelated; /* Keep egg pixelated */
}

/* Use specific selector for message */
.egg-result-modal-content .egg-result-message {
	font-size: 1rem;
	text-align: center;
	color: #3d2f2f;
    font-family: 'Press Start 2P', monospace;
    line-height: 1.5;
}

.egg-result-modal-content .egg-result-message p {
	color: #3d2f2f;
	margin-bottom: 0.5rem;
}

.egg-result-modal-content .egg-result-message strong {
    color: #333; /* Darker color for the count */
}

/* Override general modal buttons container if needed */
.egg-result-modal-content .egg-result-buttons {
    /* Add specific overrides if .modal-buttons isn't sufficient */
	margin-top: 20px;
}

/* Override general modal button for egg result buttons */
.egg-result-modal-content .egg-result-btn {
	padding: 10px 20px;
	border: 1px solid #ccc; /* Specific border */
	border-radius: 5px;
	background-color: #f0f0f0; /* Specific background */
	color: #333; /* Specific text color */
	font-weight: bold; /* Specific font weight */
	cursor: pointer;
	transition: background-color 0.3s;
	font-family: 'Press Start 2P', monospace;
    box-shadow: 0 2px 3px rgba(0,0,0,0.1); /* Specific shadow */
    /* Reset theme-specific styles if needed */
    text-shadow: none;
}
.egg-result-modal-content .egg-result-btn:hover {
	background-color: #ddd;
	opacity: 1.0; /* Ensure full opacity on hover */
    transform: none; /* Reset theme hover transform if needed */
    box-shadow: 0 2px 3px rgba(0,0,0,0.2); /* Slightly change shadow on hover */
}

/* Override primary button specifically for egg results */
.egg-result-modal-content .egg-result-primary-btn {
	background-color: #4CAF50; /* Green background */
	color: white;
	border: 1px solid #3a9d40; /* Darker green border */
}
.egg-result-modal-content .egg-result-primary-btn:hover {
	background-color: #45a049; /* Darker green on hover */
}

/* --- End of Egg Carton Result Modal Specific Styles --- */

/* ... rest of your styles ... */

/* --- Egg Hatching Modal & Confetti Styles --- */

/* Container for the reveal image and confetti */
.celebration-animation {
    position: relative; /* Allows absolute positioning of confetti */
    width: 100%;
    min-height: 150px; /* Ensure space for the pet image */
    margin-bottom: 20px;
    display: flex; /* Use flex to center pet image easily */
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Keep confetti within bounds if needed, might remove if it clips too much */
}

/* Style the pet image specifically in this animation */
.celebration-animation .pet-image-container {
    z-index: 2; /* Ensure pet image is above confetti */
    position: relative; /* Keep in normal flow */
}

.celebration-animation .pet-reveal-image {
    width: 128px; /* Or desired size */
    height: 128px;
    object-fit: contain;
    image-rendering: pixelated;
    animation: pet-reveal-pop 0.5s ease-out forwards; /* Add a little pop animation */
}

@keyframes pet-reveal-pop {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* Container to hold all confetti pieces */
.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Prevent confetti overflowing the modal *edges* */
    pointer-events: none; /* Allow clicks to pass through */
    z-index: 1; /* Behind pet image, but above modal background */
}

/* Individual confetti piece styling */
.confetti {
    position: absolute;
    width: 8px;
    height: 12px;
    /* background-color set by JS */
    opacity: 0.9;
    top: -20px; /* Start above the modal */
    animation: fall 3s linear infinite;
}

/* Keyframes for the falling animation */
@keyframes fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        /* Fall slightly past the bottom, adjust 110% as needed */
        transform: translateY(110vh) rotate(720deg); 
        opacity: 0;
    }
}

/* Ensure modal content allows relative positioning */
#work-modal .modal-content {
    position: relative; /* Needed for absolute positioning of confetti container */
    /* overflow: visible; /* REMOVED - Allow confetti to potentially fly slightly outside the content box */
}

/* Adjust modal close button specifically for hatching if needed */
#work-modal .close-modal-button {
    z-index: 3; /* Make sure button is clickable above confetti */
    position: relative; /* Ensure z-index applies */
}

/* --- End Egg Hatching Modal & Confetti Styles --- */

/* ... rest of your styles ... */

/* --- Items Page Styles --- */
.items-container {
	padding: 20px;
	max-width: 1200px;
	margin: 0 auto;
}
.items-container h2 { /* Scope h2 inside items container */
    color: var(--highlight-color);
    text-shadow: 3px 3px 0 #000;
    margin-bottom: 20px;
    text-align: center;
}
.items-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 20px;
	margin-top: 20px;
}
.item-card {
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5); /* Use theme shadow */
	background-color: var(--card-bg); /* Use theme card background */
	transition: transform 0.2s;
	border: var(--pixel-border) solid var(--border-color); /* Use theme border */
	display: flex; /* Use flexbox for layout */
	flex-direction: column; /* Stack vertically */
    color: var(--text-color); /* Use theme text color */
}
.item-card:hover {
	transform: translateY(-5px);
}
.item-header {
	padding: 10px 15px;
	display: flex;
	justify-content: space-between;
	align-items: center;
    /* background-color is set inline */
}
.item-header h3 {
	margin: 0;
	color: white; /* Keep white for contrast on colored header */
	font-size: 16px;
	text-shadow: 2px 2px 0px rgba(0,0,0,0.7); /* Consistent shadow */
}
.item-body {
	padding: 15px;
	flex-grow: 1; /* Allow body to take up remaining space */
}
.item-body p {
	margin: 0 0 8px 0; /* Slightly reduce bottom margin */
	font-size: 14px;
}
.item-quantity {
	font-weight: bold;
    color: var(--highlight-color); /* Highlight quantity */
}
/* Style for equipped status */
.item-equipped-status {
	font-size: 12px !important; /* Smaller font */
	font-style: italic;
	color: #ccc; /* Lighter gray color */
	margin-top: 5px !important; /* Add some space above */
	border-top: 1px dashed var(--border-color); /* Separator line using theme color */
	padding-top: 5px; /* Space below separator */
}
.item-actions {
	padding: 0 15px 15px;
	display: flex;
	justify-content: center; /* Center buttons horizontally */
	margin-top: auto; /* Push actions to the bottom */
    gap: 10px; /* Add space between buttons */
}
.use-item-btn {
	background-color: var(--success-color); /* Use theme success */
	color: white;
	border: var(--pixel-border) solid #2a9e30; /* Match theme buttons */
	padding: 8px 15px;
	cursor: pointer;
	font-family: 'Press Start 2P', monospace;
	font-size: 12px; /* Match other buttons */
	box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5); /* Match theme buttons */
	transition: all 0.1s; /* Match theme buttons */
}
.use-item-btn:hover {
	background-color: #5af160; /* Lighter success */
	transform: translate(-2px, -2px); /* Match theme buttons */
	box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5); /* Match theme buttons */
}
/* Style for the Sell button */
.sell-item-btn {
    background-color: var(--error-color); /* Use theme error color (red) */
    color: white;
    border: var(--pixel-border) solid #9e2a2a; /* Darker red border */
    padding: 8px 15px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.1s;
}
.sell-item-btn:hover {
    background-color: #f15a5a; /* Lighter red on hover */
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

.no-items-message {
	text-align: center;
	padding: 30px;
	background-color: var(--card-bg); /* Use theme card background */
	border: var(--pixel-border) solid var(--border-color); /* Use theme border */
	box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.5); /* Use theme shadow */
	margin-top: 20px;
	color: var(--text-color); /* Use theme text color */
}
/* Use existing .button-link style for shop link? Assuming it's defined elsewhere */
/* If not, define .shop-link here based on theme */
.items-container .shop-link { /* Scope shop link */
	display: inline-block;
	margin-top: 15px;
	padding: 10px 20px;
	background-color: var(--primary-color);
	color: var(--text-color);
	text-decoration: none;
	border: var(--pixel-border) solid #2a3b9f;
	box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
	font-family: 'Press Start 2P', monospace;
	font-size: 14px;
	transition: all 0.1s;
}
.items-container .shop-link:hover {
	background-color: #5a7bff;
	transform: translate(-2px, -2px);
	box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}
/* Use general .error style for error messages? Assuming it's defined elsewhere */
/* If not, define .error-message here */
.items-container .error-message { /* Scope error message */
    color: var(--error-color);
    font-weight: bold;
    padding: 15px;
    background-color: rgba(225, 72, 72, 0.2);
    border: var(--pixel-border) solid var(--error-color);
    margin: 20px 0;
    text-align: center;
}
/* --- End Items Page Styles --- */


/* --- Confirmation Modal Styles (Using Specific Classes) --- */
/* Use general .modal-overlay styles */
/* Use general .modal-content styles as base, override below */

.confirm-use-content { /* Specific overrides */
	background-color: #fff; /* White background like original */
	border-radius: 8px;
	padding: 20px;
	width: 90%;
	max-width: 500px;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
	color: #333; /* Dark text */
    /* Reset theme border/shadow if needed */
    border: 1px solid #ccc;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    text-align: center; /* Center text */
}
.confirm-use-content h2 {
	margin-top: 0;
	color: #333;
    text-shadow: none; /* Remove theme shadow */
    font-size: 1.5rem;
    margin-bottom: 15px;
}
.confirm-use-content .modal-body {
	margin: 20px 0;
	color: #3d2f2f;
}
.confirm-use-content .modal-body p {
	color: #3d2f2f;
    margin-bottom: 10px;
}
.confirm-use-content .modal-body strong {
    color: #000; /* Make item name black */
}

.confirm-use-actions { /* Specific actions container */
	display: flex;
	justify-content: center; /* Center buttons */
	gap: 15px; /* Increased gap */
    margin-top: 25px;
}

/* Base styles for buttons in this modal */
.confirm-use-content .modal-btn {
	padding: 10px 20px; /* Larger padding */
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-weight: bold;
	font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    text-shadow: none;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}
.confirm-use-content .modal-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

.confirm-use-cancel-btn { /* Specific cancel button */
	background-color: #f5f5f5;
	color: #333;
	border: 1px solid #ddd;
}
.confirm-use-confirm-btn { /* Specific confirm button */
	background-color: #4CAF50; /* Green */
	color: white;
    border: 1px solid #3a9d40;
}
.confirm-use-cancel-btn:hover {
	background-color: #eee;
}
.confirm-use-confirm-btn:hover {
	background-color: #45a049;
}

/* Add near .pet-selection-card styles (around line 2633) */
.pet-selection-card {
	display: flex; /* Use flexbox for alignment */
	align-items: center; /* Vertically center items */
	justify-content: space-between; /* Push info button to the right */
	padding: 10px;
	border: 2px solid #4a4e69;
	border-radius: 8px;
	background-color: #2e314d; /* Slightly lighter background */
	margin-bottom: 10px;
	transition: background-color 0.2s ease, border-color 0.2s ease;
	/* Remove cursor pointer here, apply to main area */
}

.pet-selection-main {
	display: flex;
	align-items: center;
	flex-grow: 1; /* Allow main content to take available space */
	cursor: pointer; /* Add cursor pointer here */
	margin-right: 10px; /* Add some space before the info button */
}


.pet-selection-card:hover {
	border-color: #6a6e89;
}

.pet-selection-card.active {
	background-color: #4a4e69; /* Active background */
	border-color: var(--primary-color); /* Use primary color border for active */
	box-shadow: 0 0 5px var(--primary-color);
}

.pet-selection-card.active:hover {
	border-color: #6a6e89;
}

/* Style for the info button container */
.info-button-container {
	margin-left: auto; /* Pushes button to the right if needed but justify-content should handle it */
}

/* Style for the new info icon button */
.info-icon-button {
	display: inline-flex; /* Use inline-flex for centering */
	align-items: center;
	justify-content: center;
	width: 28px; /* Adjust size */
	height: 28px; /* Adjust size */
	padding: 0;
	font-family: 'Courier New', Courier, monospace; /* Monospace for 'i' */
	font-size: 1.1rem; /* Adjust icon size */
	font-weight: bold;
	color: #fff;
	background-color: #6a6e89; /* Neutral background */
	border: 1px solid #8a8ea9;
	border-radius: 50%; /* Make it circular */
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease;
	line-height: 1; /* Ensure 'i' is centered vertically */
}

.info-icon-button:hover {
	background-color: #8a8e99;
	border-color: #aaaec9;
}

.info-icon-button:active {
	background-color: #5a5e79;
}

/* Add styles for the details modal container if needed */
#modal-container-details {
	position: fixed; /* Or absolute, depending on layout */
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 1100; /* Increased z-index */
	pointer-events: none; /* Allow clicks to pass through the container itself */
}

/* Ensure the pet details modal content itself intercepts clicks */
#modal-container-details > div { /* Target direct children, like the modal itself */
	pointer-events: auto; /* Re-enable pointer events for the modal content */
}


/* Adjust existing pet details modal styles slightly for overlay context */
.pet-details-modal {
	/* It likely already has position:fixed or similar via .modal, but confirm */
	/* Ensure it has a background to obscure content behind it */
	/* background-color: rgba(0, 0, 0, 0.5); Assuming .modal-overlay handles this */
	z-index: 1101; /* Ensure higher than its container */
}

.work-event-item-img {
   /* center the item in a div */
   display: block;
   margin-left: auto;
   margin-right: auto;
   /* make it 20% smaller */
   width: 20%;
   height: 20%;
}

