html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
}

#app {
    width: 100%;
    height: 100%;
    background-color: white;
    border: 1px solid #ccc;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.screen {
    display: none;
    padding: 20px;
    height: auto;
    box-sizing: border-box;
}

.screen.active {
    display: block;
}

button {
    padding: 10px 20px;
    margin: 5px;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
}

button:hover {
    background-color: #45a049;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow: hidden; /* Prevent modal backdrop from scrolling */
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 700px;
    width: 90%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    cursor: pointer;
    font-size: 28px;
    position: absolute;
    top: 5px;
    right: 10px;
    color: #aaa;
}

.close:hover {
    color: black;
}

.combat-ui {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    background: white;
    background-attachment: fixed;
}

.combat-areas {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex: 1;
    background: white;
    position: relative;
}

.combat-areas::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
    animation: twinkle 4s ease-in-out infinite alternate;
}

@keyframes twinkle {
    0% { opacity: 0.3; }
    100% { opacity: 0.7; }
}

.player-area, .enemy-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px;
    z-index: 1;
}

.sprite {
    width: 150px;
    height: 150px;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 3px solid #fff;
    overflow: hidden;
    position: relative;
}

.sprite-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.sprite::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 50%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: glow 3s ease-in-out infinite alternate;
}

@keyframes glow {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.hud {
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    min-width: 120px;
    transition: all 0.3s ease;
}

.damage-flash {
    animation: shake 0.5s ease-in-out;
    background: rgba(255, 0, 0, 0.3) !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.combat-ui.victory .enemy-area .sprite {
    animation: victory-enemy 2s ease-out forwards;
}

.combat-ui.defeat .player-area .sprite {
    animation: defeat-player 2s ease-out forwards;
}

@keyframes victory-enemy {
    0% { opacity: 1; transform: scale(1); }
    25% { transform: scale(1.1) rotate(5deg); }
    50% { transform: scale(1.2) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
    100% { opacity: 0; transform: scale(0) rotate(360deg); }
}

@keyframes defeat-player {
    0% { opacity: 1; transform: translateY(0); }
    50% { transform: translateY(-10px); }
    100% { opacity: 0; transform: translateY(20px); }
}

.battle-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.battle-modal-content {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 3px solid #007bff;
    max-width: 400px;
    width: 90%;
}

.battle-modal-content h2 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 32px;
}

.battle-modal-content p {
    margin: 0 0 25px 0;
    color: #666;
    font-size: 18px;
}

.battle-modal button {
    margin: 0 10px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.battle-modal button:first-of-type {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.battle-modal button:first-of-type:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.battle-modal button:last-of-type {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
}

.battle-modal button:last-of-type:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

.attacking .sprite {
    animation: attack-move 0.6s ease-in-out;
}

@keyframes attack-move {
    0% { transform: translateX(0) scale(1); }
    50% { transform: translateX(30px) scale(1.1); }
    100% { transform: translateX(0) scale(1); }
}

.defending .sprite {
    animation: defend-move 0.6s ease-in-out;
}

@keyframes defend-move {
    0% { transform: translateX(0) scale(1); }
    50% { transform: translateX(-20px) scale(0.9); }
    100% { transform: translateX(0) scale(1); }
}

.bar {
    width: 100%;
    height: 20px;
    background-color: #ddd;
    border-radius: 10px;
    overflow: hidden;
    margin: 5px 0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #45a049 100%);
    transition: width 0.5s ease;
    border-radius: 10px;
}

.bar-fill.hp-fill {
    background: linear-gradient(90deg, #FF5722 0%, #D32F2F 100%);
}

.bar-fill.cap-fill {
    background: linear-gradient(90deg, #2196F3 0%, #1976D2 100%);
}

.action-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.action-bar > * {
    pointer-events: auto;
}

.action-bar #forfeit-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #dc3545;
    color: white;
    border: 2px solid #b02a37;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.action-bar #forfeit-btn:hover {
    background-color: #c82333;
}

.action-buttons {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    gap: 10px;
}

.action-buttons button {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.action-buttons button:hover:not(:disabled) {
    background-color: #45a049;
}

.action-buttons button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.quiz-options {
    display: flex;
    flex-direction: column;
}

.quiz-options button {
    margin: 5px 0;
}

#rarity-bar {
    width: 100%;
    height: 30px;
    margin: 20px 0;
    border: 1px solid #ccc;
    white-space: nowrap;
}

#equipment-slots {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    margin: 20px 0;
}

.slot {
    width: 150px;
    height: 150px;
    border: 2px solid #ccc;
    margin: 9px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f9f9f9;
}

.slot h3 {
    margin: 0;
    font-size: 14px;
}

.slot-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
}

.empty-slot {
    color: #999;
    font-style: italic;
}

.empty-slot:hover {
    cursor: pointer;
}

.equipped-item {
    font-size: 12px;
}

.character-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 100%;
    box-sizing: border-box;
}

.character-card {
    border-radius: 8px;
    padding: 10px;
    margin: 0;
    max-width: 250px;
}

.character-card small {
    font-size: 12px;
    line-height: 1.2;
}

.character-equipment {
    margin: 20px 0;
    border: 1px solid #ccc;
    padding: 10px;
}

.equipment-slots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    max-width: 100%;
}

.inventory-item {
    border: 1px solid #ccc;
    padding: 10px;
    background-color: #f9f9f9;
    text-align: center;
    font-size: 12px;
}

.inventory-item.equipped {
    border: 2px solid #4CAF50;
    background-color: #e8f5e8;
}

/* Shop Styles */
.resource-display {
    background-color: #e8f5e8;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
}

.shop-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 15px;
    justify-content: center;
}

.category-btn {
    padding: 8px 12px;
    background-color: #ddd;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.category-btn.active {
    background-color: #4CAF50;
    color: white;
}

.category-btn:hover {
    background-color: #bbb;
}

.category-btn.active:hover {
    background-color: #45a049;
}

.shop-items {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    background-color: #fafafa;
}

/* Shop Screen Layout */
.shop-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.shop-screen h1 {
    padding: 20px 20px 15px 20px;
    margin: 0;
    flex-shrink: 0;
}

.shop-screen .resource-display {
    padding: 0 20px;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.shop-screen .shop-categories {
    padding: 0 20px;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.shop-screen .shop-items {
    flex: 1;
    padding: 0 20px;
    min-height: 0;
    overflow-y: auto;
}

.shop-screen #back-btn {
    padding: 15px 20px;
    align-self: center;
    flex-shrink: 0;
}

.shop-item {
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shop-item h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.item-description {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.item-cost {
    margin: 0;
    font-weight: bold;
    color: #d32f2f;
}

.shop-item .buy-btn {
    align-self: flex-end;
    padding: 8px 16px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.shop-item .buy-btn:hover:not(:disabled) {
    background-color: #1976D2;
}

.shop-item .buy-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* Character Selection Styles */
.rarity-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 15px;
    justify-content: center;
}

.rarity-btn {
    padding: 6px 10px;
    background-color: #ddd;
    border: 2px solid #bbb;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s;
}

.rarity-btn.active {
    background-color: #4CAF50;
    color: white;
    border-color: #45a049;
}

.rarity-btn:hover {
    background-color: #bbb;
    transform: translateY(-1px);
}

.rarity-btn.active:hover {
    background-color: #45a049;
}

#characters {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    background-color: #fafafa;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.character-card {
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    min-height: 200px;
    justify-content: space-between;
}

.character-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.character-card h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
    text-align: center;
    flex-shrink: 0;
}

.character-image {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 5px;
    flex-shrink: 0;
}

.character-stats {
    margin: 0;
    color: #666;
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    flex-shrink: 0;
}

.character-equipment {
    margin: 0;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 8px;
    background-color: #f9f9f9;
    font-size: 12px;
    line-height: 1.4;
}

.character-skills {
    margin: 0;
    color: #555;
    font-size: 12px;
    line-height: 1.2;
    flex: 1;
}

.select-btn {
    padding: 6px 12px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    align-self: center;
    margin-top: auto;
    flex-shrink: 0;
}

.select-btn:hover {
    background-color: #45a049;
}

/* Rarity-based styling - matching gacha colors with enhanced visibility */
.common {
    border: 3px solid grey !important;
    box-shadow: 0 0 8px rgba(128, 128, 128, 0.5);
    background: linear-gradient(135deg, #f8f8f8 0%, #e8e8e8 100%);
}

.rare {
    border: 3px solid blue !important;
    box-shadow: 0 0 8px rgba(0, 0, 255, 0.5);
    background: linear-gradient(135deg, #e8f0ff 0%, #d4e4ff 100%);
}

.epic {
    border: 3px solid purple !important;
    box-shadow: 0 0 8px rgba(128, 0, 128, 0.5);
    background: linear-gradient(135deg, #f0e8ff 0%, #e4d4ff 100%);
}

.unique {
    border: 3px solid yellow !important;
    box-shadow: 0 0 8px rgba(255, 255, 0, 0.5);
    background: linear-gradient(135deg, #fffbe8 0%, #fff4d4 100%);
}

.mythic {
    border: 3px solid red !important;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.5);
    background: linear-gradient(135deg, #ffe8e8 0%, #ffd4d4 100%);
}

.legendary {
    border: 3px solid green !important;
    box-shadow: 0 0 8px rgba(0, 128, 0, 0.5);
    background: linear-gradient(135deg, #e8ffe8 0%, #d4ffd4 100%);
}

.godly {
    border: 3px solid #333 !important;
    box-shadow: 0 0 8px rgba(51, 51, 51, 0.5);
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
}

/* Main Menu Styles */
.resources-display {
    display: flex;
    gap: 8px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 4px;
    justify-content: center;
    flex-wrap: wrap;
}

.resource-item {
    font-weight: bold;
    color: #333;
    font-size: 11px;
    padding: 1px 3px;
    background-color: rgba(76, 175, 80, 0.1);
    border-radius: 2px;
}

.resource-item {
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.main-menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3px;
    height: auto;
}

.main-menu-layout {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    max-width: 600px;
    margin-top: 2px;
    flex: 1;
    justify-content: center;
}

@media (max-width: 1024px) {
    .main-menu-layout {
        gap: 8px;
    }
    
    .character-image-placeholder {
        width: 100px;
        height: 252px;
    }
    
    .game-setup-section {
        padding: 8px;
    }
}

.character-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 600px;
}

.character-top-row {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 20px;
    width: 100%;
    margin-bottom: 10px;
    position: relative;
}

.character-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
}

.character-image-placeholder {
    width: 200px;
    height: 280px;
    border: 3px solid #ddd;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    margin-bottom: 8px;
    font-size: 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    color: #666;
}

.select-char-btn-image {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 8px;
    font-size: 11px;
    font-weight: bold;
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(255, 152, 0, 0.3);
    white-space: nowrap;
    z-index: 10;
}

.select-char-btn-image:hover {
    transform: translateX(-50%) translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 152, 0, 0.4);
}

.character-name-display {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    text-align: center;
    margin-bottom: 4px;
}

.character-rarity-main {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    color: white;
    margin-right: 8px;
}

.character-rarity-main.rarity-common { background-color: grey; }
.character-rarity-main.rarity-rare { background-color: blue; }
.character-rarity-main.rarity-epic { background-color: purple; }
.character-rarity-main.rarity-unique { background-color: yellow; color: #333; }
.character-rarity-main.rarity-mythic { background-color: red; }
.character-rarity-main.rarity-legendary { background-color: green; }
.character-rarity-main.rarity-godly { background-color: #333; }

.character-stats {
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    color: #555;
    margin-bottom: 8px;
}

.character-equipment-section {
    position: absolute;
    right: 0;
    top: 0;
    display: flex;
    flex-direction: column;
}

.character-equipment-section h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #333;
    text-align: center;
}

.equipment-grid {
    display: grid;
    grid-template-columns: 80px 80px;
    grid-template-rows: auto auto auto;
    gap: 6px;
    width: 100%;
}

.equipment-slot {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 7px;
    background-color: #fafafa;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    aspect-ratio: 1;
    overflow: hidden;
}

.equipment-slot:hover {
    border-color: #2196F3;
    background-color: #f0f8ff;
}

.slot-label {
    font-size: 11px;
    font-weight: bold;
    color: #666;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.equipped-item-compact {
    font-size: 10px;
    line-height: 1.1;
    color: #333;
    word-wrap: break-word;
    text-align: center;
}

.equipped-item-compact small {
    font-size: 10px;
    color: #666;
}

.empty-slot-compact {
    color: #999;
    font-style: italic;
    font-size: 11px;
}

/* Specific positioning for equipment slots */
.equipment-slot:nth-child(1) { /* Helmet */
    grid-column: 1;
    grid-row: 1;
}

.equipment-slot:nth-child(2) { /* Armor */
    grid-column: 1;
    grid-row: 2;
}

.equipment-slot:nth-child(3) { /* Weapon */
    grid-column: 2;
    grid-row: 2;
}

.equipment-slot:nth-child(4) { /* Shoes */
    grid-column: 1;
    grid-row: 3;
}

.game-title {
    font-size: 20px;
    color: #333;
    margin-bottom: 2px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 300px;
    margin-bottom: 4px;
    gap: 8px;
}

.primary-btn {
    width: 100%;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(76, 175, 80, 0.4);
}

.secondary-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    width: 100%;
}

.secondary-btn {
    padding: 4px 6px;
    font-size: 10px;
    font-weight: bold;
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px rgba(33, 150, 243, 0.3);
    position: relative;
}

.secondary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.4);
}

.challenges-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.selected-character-section {
    width: 100%;
    margin-top: 0;
}

.selected-character-card {
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.2s;
}

.selected-character-card:hover {
    transform: translateY(-2px);
}

.character-name {
    font-size: 20px;
    margin: 0 0 8px 0;
    text-align: center;
    color: #333;
}

.character-stats {
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 12px;
    color: #555;
}

.character-skills {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
}

.character-equipment {
    margin-bottom: 10px;
    font-weight: bold;
    color: #333;
}

.equipment-slots {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.slot {
    border: 2px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    background-color: #fafafa;
    text-align: center;
    transition: all 0.2s;
}

.slot:hover {
    border-color: #bbb;
    background-color: #f0f0f0;
}

.slot h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #666;
}

.slot-content {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.empty-slot {
    color: #999;
    font-style: italic;
    font-size: 12px;
}

.equipped-item {
    font-size: 12px;
    line-height: 1.3;
    color: #333;
}

.unequip-btn {
    margin-top: 5px;
    padding: 4px 8px;
    font-size: 11px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.unequip-btn:hover {
    background-color: #c82333;
}

.no-character-selected {
    text-align: center;
    padding: 40px 20px;
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    color: #6c757d;
    font-size: 18px;
    margin-bottom: 20px;
}

.select-char-btn {
    display: block;
    margin: 0 auto;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(255, 152, 0, 0.3);
}

.select-char-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 152, 0, 0.4);
}

/* Challenge Modal Styles */
.challenge-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    background-color: #fafafa;
}

.challenge-desc {
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.challenge-reward {
    color: #4CAF50;
    font-weight: bold;
    margin-bottom: 8px;
}

.challenge-progress {
    margin-bottom: 8px;
    color: #666;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background-color: #eee;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.progress-fill.in-progress {
    background-color: #2196F3;
}

.progress-fill.completed {
    background-color: #4CAF50;
}

.claim-btn {
    padding: 8px 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.claim-btn:hover {
    background-color: #45a049;
}

.challenge-finished {
    color: #4CAF50;
    font-weight: bold;
    text-align: center;
}

/* Tutorial Modal Styles */
.tutorial-content {
    max-height: 60vh;
    overflow-y: auto;
    line-height: 1.6;
}

.tutorial-content h3 {
    color: #333;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 18px;
}

.tutorial-content h3:first-child {
    margin-top: 0;
}

.tutorial-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.tutorial-content li {
    margin-bottom: 8px;
}

.tutorial-content em {
    color: #666;
    font-style: italic;
}

/* Gacha Modal Styles */
.gacha-rarity-pie {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: conic-gradient(
        grey 0% 68.18%,
        blue 68.18% 90.91%,
        purple 90.91% 96.59%,
        yellow 96.59% 98.86%,
        red 98.86% 99.55%,
        green 99.55% 99.89%,
        #333 99.89% 100%
    );
    margin: 20px auto;
    position: relative;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.gacha-rarity-pie::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.rarity-legend {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 15px 0;
    font-size: 12px;
}

.rarity-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rarity-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

#gacha-rarity-bar {
    margin: 20px 0;
    text-align: center;
}

.gacha-resources {
    display: flex;
    justify-content: space-around;
    margin: 15px 0;
}

.gacha-resources p {
    margin: 0;
    font-weight: bold;
}

#gacha-modal .modal-content {
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    width: 90%;
    max-width: 600px;
    padding: 20px;
    box-sizing: border-box;
}

#gacha-details-modal .modal-content {
    /* Use absolute positioning for proper centering */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    overflow: visible;
    max-height: none;
    width: 95vw;
    max-width: 500px;
    padding: 15px;
    box-sizing: border-box;
}

#gacha-details-modal-content h2 {
    color: #333;
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
}

#gacha-details-modal-content {
    width: 100%;
    box-sizing: border-box;
    /* Add scrolling to the inner content instead */
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.rarity-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    border-left: 3px solid #007bff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.rarity-section h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: bold;
}

.rarity-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.item-count {
    background: rgba(255, 255, 255, 0.8);
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 14px;
    color: #333;
}

.rarity-examples {
    font-size: 14px;
    color: #555;
    line-height: 1.4;
    margin-top: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.rarity-examples strong {
    color: #333;
}

/* Battle Setup Modal Styles */
.battle-setup-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.setup-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.setup-label {
    font-size: 14px;
    font-weight: bold;
    color: #555;
}

.setup-select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.setup-select:hover {
    border-color: #bbb;
}

.setup-select:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
}

.enemy-preview {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.enemy-preview h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.stats-comparison {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
}

.player-stats, .enemy-stats {
    flex: 1;
    text-align: center;
}

.player-stats h4, .enemy-stats h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #555;
    font-weight: bold;
}

.vs-divider {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    align-self: center;
    padding: 0 10px;
}

.stat-item {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 5px 0;
}

.start-battle-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    background: linear-gradient(135deg, #e17055 0%, #d63031 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(225, 112, 85, 0.3);
}

.start-battle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(225, 112, 85, 0.4);
}

/* Game Setup Section Styles */
.game-setup-section {
    width: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 6px;
    padding: 4px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.1);
    max-height: fit-content;
    margin-top: auto;
}

.setup-title {
    font-size: 14px;
    color: #333;
    margin-bottom: 3px;
    text-align: center;
    font-weight: bold;
}

.setup-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    margin-bottom: 3px;
}

.setup-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.setup-label {
    font-size: 11px;
    font-weight: bold;
    color: #555;
    margin-bottom: 1px;
}

.setup-select {
    padding: 3px 4px;
    border: 1px solid #ddd;
    border-radius: 2px;
    font-size: 11px;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.setup-select:hover {
    border-color: #bbb;
}

.setup-select:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.enemy-preview {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    border-radius: 3px;
    padding: 3px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.enemy-preview h3 {
    margin: 0 0 3px 0;
    color: #333;
    font-size: 12px;
}

.stats-comparison {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 3px;
}

.player-stats, .enemy-stats {
    flex: 1;
    text-align: center;
}

.player-stats h4, .enemy-stats h4 {
    margin: 0 0 3px 0;
    font-size: 11px;
    color: #555;
    font-weight: bold;
}

.vs-divider {
    font-size: 12px;
    font-weight: bold;
    color: #333;
    align-self: center;
    padding: 0 4px;
}

.stat-item {
    font-size: 11px;
    font-weight: bold;
    color: #333;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 2px 4px;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.start-battle-btn {
    padding: 4px 8px;
    font-size: 11px;
    font-weight: bold;
    background: linear-gradient(135deg, #e17055 0%, #d63031 100%);
    color: white;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(225, 112, 85, 0.3);
}

.start-battle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(225, 112, 85, 0.4);
}

/* Character Details Modal Styles */
#character-details-modal .modal-content {
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

#character-details-content {
    padding: 20px;
}

.character-details-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.character-avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #ddd;
}

.character-basic-info {
    flex: 1;
}

.character-basic-info h2 {
    margin: 0 0 5px 0;
    font-size: 24px;
    color: #333;
}

.character-level {
    font-size: 16px;
    color: #666;
    margin-bottom: 5px;
}

.character-rarity {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    color: white;
}

.character-stats-section {
    margin-bottom: 25px;
}

.character-stats-section h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.stat-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    border: 1px solid #dee2e6;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.character-skills-section {
    margin-bottom: 25px;
}

.character-skills-section h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.skills-list {
    display: grid;
    gap: 12px;
}

.skill-item {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
    border-left: 3px solid #007bff;
}

.skill-item strong {
    color: #333;
    font-size: 14px;
    display: block;
    margin-bottom: 4px;
}

.skill-desc {
    color: #666;
    font-size: 13px;
    line-height: 1.4;
}

.character-equipment-section-modal,
.character-inventory-section {
    margin-bottom: 25px;
}

.character-equipment-section-modal h3,
.character-inventory-section h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.equipment-slots-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.equipment-slot-detail {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #dee2e6;
}

.slot-header {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    text-transform: uppercase;
    text-align: center;
}

.equipped-item-detail,
.empty-slot-detail {
    text-align: center;
}

.equipped-item-detail .item-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.equipped-item-detail .item-stats {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

.empty-slot-detail {
    color: #999;
    font-style: italic;
    padding: 20px 0;
}

.unequip-btn {
    padding: 6px 12px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.unequip-btn:hover {
    background-color: #c82333;
}

.inventory-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.inventory-item-detail {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
    border: 1px solid #dee2e6;
}

.inventory-item-detail .item-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.inventory-item-detail .item-type {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
    text-transform: capitalize;
}

.inventory-item-detail .item-stats {
    font-size: 11px;
    color: #666;
    margin-bottom: 8px;
}

.equip-btn {
    padding: 6px 12px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    width: 100%;
}

.equip-btn:hover {
    background-color: #218838;
}

.no-items {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.character-resources-section {
    margin-bottom: 25px;
}

.character-resources-section h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.resource-item {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    border: 1px solid #dee2e6;
}

.resource-value {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.resource-label {
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.character-actions-section {
    margin-bottom: 20px;
}

.upgrade-section h3,
.max-level-notice h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.upgrade-info {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #dee2e6;
}

.upgrade-cost {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.upgrade-status {
    font-size: 14px;
}

.upgrade-status.available {
    color: #28a745;
}

.upgrade-status.unavailable {
    color: #dc3545;
}

.upgrade-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #ffc107 0%, #ff8c00 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    width: 100%;
    transition: all 0.3s ease;
}

.upgrade-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 193, 7, 0.3);
}

.upgrade-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.max-level-notice {
    text-align: center;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #c3e6cb;
}

.character-rarity.common { background-color: grey; }
.character-rarity.rare { background-color: blue; }
.character-rarity.epic { background-color: purple; }
.character-rarity.unique { background-color: yellow; color: #333; }
.character-rarity.mythic { background-color: red; }
.character-rarity.legendary { background-color: green; }
.character-rarity.godly { background-color: #333; }