/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

body {
    background-color: #1a1a2e;
    color: #fff;
    font-family: 'Press Start 2P', cursive;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    width: 100%;
    max-width: 1600px;
    height: 100%;
    max-height: 1200px;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: #16213e;
    border: 8px solid #0f3460;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.game-header {
    padding: 20px;
    text-align: center;
    background-color: #0f3460;
    border-bottom: 8px solid #e94560;
}

.game-header h1 {
    font-size: 3rem;
    color: #e94560;
    text-shadow: 6px 6px 0 #000;
    margin-bottom: 20px;
}

.stats-bar {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
}

.stat-box {
    background-color: #1a1a2e;
    padding: 10px 20px;
    border: 4px solid #0f3460;
    border-radius: 0;
    min-width: 180px;
}

.stat-label {
    font-size: 1rem;
    color: #e94560;
    display: block;
}

.stat-value {
    font-size: 1.6rem;
    color: #fff;
    display: block;
    margin-top: 6px;
}

.game-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    position: relative;
}

/* Slot roller styles */
.slot-container {
    width: 1100px;
    height: 250px;
    position: relative;
    margin-bottom: 40px;
    overflow: hidden;
    border: 8px solid #0f3460;
    background-color: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

.slot-tape {
    display: flex;
    position: absolute;
    height: 100%;
    transition: transform 0.1s linear;
    left: 50%;
    transform: translateX(-50%);
}

.slot-item {
    width: 220px;
    min-width: 220px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15px;
    text-align: center;
    font-size: 1.2rem;
    border-right: 2px solid rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.slot-item-icon {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin-bottom: 15px;
}

.slot-highlight {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    height: 100%;
    border: 5px solid gold;
    box-shadow: 0 0 40px gold;
    pointer-events: none;
    z-index: 20;
}

.slot-item.winning {
    transform: scale(1.15);
    z-index: 10;
    animation: glow 1s infinite;
}

.slot-item.hidden {
    color: rgba(255, 255, 255, 0.3);
    background-color: rgba(0, 0, 0, 0.5) !important;
}

.slot-item.hidden .slot-item-name,
.slot-item.hidden .slot-item-rarity,
.slot-item.hidden .slot-item-icon {
    visibility: hidden;
}

.slot-item.hidden::after {
    content: "???";
    position: absolute;
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.7);
}

.slot-item.revealed {
    animation: reveal 0.3s ease-out;
}

@keyframes reveal {
    0% { opacity: 0.3; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

.slot-item-name {
    font-size: 1.1rem;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    height: 2.5em;
    line-height: 1.3;
}

.slot-item-rarity {
    font-size: 0.9rem;
    margin-top: 10px;
    padding: 6px 10px;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.5);
    width: 100%;
}

.spin-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.available-spins {
    margin-top: 20px;
    font-size: 1.4rem;
    color: #e94560;
}

/* Timer styles */
.spin-timer {
    margin-top: 10px;
    font-size: 1rem;
    color: #ffdf7c;
    text-shadow: 0 0 5px rgba(255, 223, 124, 0.7);
    background-color: rgba(15, 52, 96, 0.5);
    padding: 8px 16px;
    border-radius: 4px;
    border: 2px solid #ffbc30;
}

.game-footer {
    display: flex;
    justify-content: center;
    padding: 20px;
    background-color: #0f3460;
    border-top: 8px solid #e94560;
    gap: 20px;
}

/* Pixel button styles */
.pixel-button {
    background-color: #e94560;
    color: #fff;
    border: none;
    padding: 20px 40px;
    font-family: 'Press Start 2P', cursive;
    font-size: 1.4rem;
    cursor: pointer;
    position: relative;
    text-transform: uppercase;
    border: 4px solid #0f3460;
    box-shadow: 6px 6px 0 #0f3460;
    transition: all 0.1s;
}

.pixel-button:hover {
    background-color: #ff6b81;
}

.pixel-button:active {
    transform: translate(4px, 4px);
    box-shadow: 2px 2px 0 #0f3460;
}

.pixel-button.small {
    padding: 10px 20px;
    font-size: 1rem;
}

.pixel-button.spin-btn {
    animation: pulse 2s infinite;
}

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

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #1a1a2e;
    padding: 40px;
    border: 8px solid #0f3460;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
}

.modal-content h2 {
    color: #e94560;
    margin-bottom: 30px;
    text-align: center;
    font-size: 2.4rem;
}

.pixel-box {
    border: 8px solid #0f3460;
    box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.3);
    background-color: #16213e;
}

.large-modal {
    width: 90%;
    max-width: 1400px;
}

.modal-text {
    font-size: 1.4rem;
    line-height: 1.5;
    margin-bottom: 30px;
}

.modal-text p {
    margin-bottom: 20px;
}

.modal-text ul {
    margin-left: 40px;
    margin-bottom: 30px;
}

.modal-text li {
    margin-bottom: 10px;
}

/* Modal actions */
.modal-actions {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    width: 100%;
}

/* Rarity colors */
.rarity-list li {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.rarity-color {
    display: inline-block;
    width: 30px;
    height: 30px;
    margin-right: 20px;
    border: 4px solid #000;
}

.rarity-color.trash {
    background-color: #777;
}

.rarity-color.common {
    background-color: #ad926d;
}

.rarity-color.uncommon {
    background-color: #00aa00;
}

.rarity-color.rare {
    background-color: #5555ff;
}

.rarity-color.epic {
    background-color: #aa00aa;
}

.rarity-color.legendary {
    background-color: #ffaa00;
}

.rarity-color.mythic {
    background: linear-gradient(124deg, #1de840, #ff002f, #2b1de8, #00fff2, #dd00f3, #dd00f3);
    background-size: 400% 400%;
    color: #fff;
    animation: rainbow 18s ease infinite;
}

/* Collection page styles */
.collection-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #16213e;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

.collection-page.hidden {
    display: none;
}

.collection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 20px;
    border-bottom: 4px solid #0f3460;
    margin-bottom: 20px;
    gap: 20px;
}

.collection-header h2 {
    color: #e94560;
    font-size: 2.5rem;
    text-align: center;
    flex-grow: 1;
}

/* Achievements page styles */
.achievements-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #16213e;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

.achievements-page.hidden {
    display: none;
}

.achievements-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 20px;
    border-bottom: 4px solid #0f3460;
    margin-bottom: 20px;
}

.achievements-header h2 {
    color: #e94560;
    font-size: 2.5rem;
    text-align: center;
    flex-grow: 1;
}

.achievements-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    padding: 20px;
}

.achievement-card {
    background-color: rgba(31, 41, 55, 0.7);
    border: 4px solid #0f3460;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    min-height: 120px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.achievement-card.locked {
    background-color: rgba(31, 41, 55, 0.3);
    opacity: 0.7;
    filter: grayscale(0.8);
}

.achievement-card.unlocked {
    background-color: rgba(31, 41, 55, 0.9);
    border-color: #e94560;
    box-shadow: 0 0 15px rgba(233, 69, 96, 0.5);
}

.achievement-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.achievement-icon {
    width: 50px;
    height: 50px;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    flex-shrink: 0;
}

.achievement-title {
    font-size: 1.1rem;
    color: #fff;
    flex-grow: 1;
}

.achievement-title.locked {
    color: #777;
}

.achievement-description {
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 10px;
    line-height: 1.4;
}

.achievement-description.locked {
    color: #555;
}

.achievement-date {
    font-size: 0.7rem;
    color: #e94560;
    text-align: right;
    margin-top: auto;
}

/* Rarity container */
.rarity-container {
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding: 0 20px;
    max-width: 100%;
    overflow-x: hidden;
}

/* Rarity row */
.rarity-row {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rarity-header {
    font-size: 1.8rem;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-transform: uppercase;
    font-weight: bold;
    display: inline-block;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    width: fit-content;
}

/* Items grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    width: 100%;
}

.collection-item {
    aspect-ratio: 1/1;
    border: 4px solid;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 0.9rem;
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 5px;
}

.collection-item-icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 5px;
}

.collection-item-icon-placeholder {
    font-size: 2rem;
    margin-bottom: 5px;
}

.collection-item-name {
    font-size: 0.7rem;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 5px;
    z-index: 2;
    color: white;
    text-shadow: 0 0 5px rgba(0,0,0,0.8), 0 0 3px rgba(0,0,0,0.8);
}

.collection-item-rarity {
    font-size: 0.6rem;
    z-index: 2;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 2px 5px;
    width: 100%;
    color: white;
    text-shadow: 0 0 5px rgba(0,0,0,0.8), 0 0 3px rgba(0,0,0,0.8);
}

.collection-item-count {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 2px 5px;
    font-size: 0.7rem;
    z-index: 2;
    color: white;
    text-shadow: 0 0 3px rgba(0,0,0,0.8);
}

/* Collected item effects */
.collection-item.unlocked {
    background-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 0 15px currentColor;
    animation: float 3s infinite ease-in-out;
    animation-delay: calc(var(--index) * 0.1s);
}

/* Rarity backgrounds */
.trash-rarity {
    background-color: #777;
    color: #ccc;
    border-color: #555;
}

.common-rarity {
    background-color: #ad926d;
    color: #333;
    border-color: #ddd;
}

.uncommon-rarity {
    background-color: #00aa00;
    color: #fff;
    border-color: #008800;
}

.rare-rarity {
    background-color: #5555ff;
    color: #fff;
    border-color: #3333cc;
    animation: glow 2s infinite;
}

.epic-rarity {
    background-color: #aa00aa;
    color: #fff;
    border-color: #880088;
    animation: glow 1.5s infinite;
}

.legendary-rarity {
    background-color: #ffaa00;
    color: #333;
    border-color: #cc8800;
    animation: glow 1s infinite;
}

.mythic-rarity {
    background: linear-gradient(124deg, #1de840, #ff002f, #2b1de8, #00fff2, #dd00f3, #dd00f3);
    background-size: 400% 400%;
    animation: rainbow 18s ease infinite;
    border: 4px solid white;
}

/* Inventory count colors */
.inventory-count.trash {
    border-color: #777;
    color: #777;
}

.inventory-count.common {
    border-color: #ad926d;
    color: #ad926d;
}

.inventory-count.uncommon {
    border-color: #00aa00;
    color: #00aa00;
}

.inventory-count.rare {
    border-color: #5555ff;
    color: #5555ff;
}

.inventory-count.epic {
    border-color: #aa00aa;
    color: #aa00aa;
}

.inventory-count.legendary {
    border-color: #ffaa00;
    color: #ffaa00;
}

.inventory-count.mythic {
    border-color: #0ff;
    color: #0ff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.7);
}

/* Achievement notification */
.achievement-notification {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #e94560;
    color: white;
    padding: 20px 40px;
    border-radius: 0;
    font-size: 1.4rem;
    z-index: 1000;
    opacity: 0;
    transition: all 0.5s ease;
    border: 4px solid #0f3460;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    text-align: center;
    max-width: 90%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.achievement-notification.show {
    bottom: 40px;
    opacity: 1;
}

/* Animations */
@keyframes rainbow {
    0%{background-position:0% 82%}
    50%{background-position:100% 19%}
    100%{background-position:0% 82%}
}

@keyframes glow {
    0% { box-shadow: 0 0 10px currentColor; }
    50% { box-shadow: 0 0 40px currentColor; }
    100% { box-shadow: 0 0 10px currentColor; }
}

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

/* Responsive adjustments */
@media (max-width: 1200px) {
    .game-header h1 {
        font-size: 2rem;
    }
    
    .stat-box {
        min-width: 160px;
        padding: 6px 10px;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .slot-container {
        width: 800px;
        height: 200px;
    }
    
    .slot-item {
        width: 160px;
    }
    
    .pixel-button {
        padding: 16px 32px;
        font-size: 1.2rem;
    }
    
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .game-footer {
        flex-wrap: wrap;
    }
    
    .achievements-container {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 900px) {
    .slot-container {
        width: 600px;
        height: 180px;
    }
    
    .slot-item {
        width: 120px;
        font-size: 1rem;
    }
    
    .slot-item-icon {
        width: 80px;
        height: 80px;
    }
    
    .stat-box {
        min-width: 150px;
    }
}

@media (max-width: 768px) {
    .slot-container {
        width: 500px;
        height: 160px;
    }
    
    .slot-item {
        width: 100px;
        font-size: 0.9rem;
    }
    
    .slot-item-icon {
        width: 70px;
        height: 70px;
    }
    
    .slot-item-name {
        font-size: 0.8rem;
    }
    
    .slot-item-rarity {
        font-size: 0.7rem;
    }
    
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }
    
    .collection-item-icon {
        width: 60px;
        height: 60px;
    }
    
    .rarity-header {
        font-size: 1.4rem;
    }
    
    .collection-item-name {
        font-size: 0.6rem;
    }
    
    .achievements-container {
        grid-template-columns: 1fr;
    }
    
    .achievement-card {
        min-height: 100px;
    }
    
    .achievement-icon {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    
    .achievement-title {
        font-size: 0.9rem;
    }
    
    .achievement-description {
        font-size: 0.8rem;
    }
    
    .stat-box {
        min-width: 130px;
    }
    
    .stat-value {
        font-size: 1.0rem;
    }
}

@media (max-width: 550px) {
    .slot-container {
        width: 400px;
        height: 140px;
    }
    
    .slot-item {
        width: 80px;
        font-size: 0.8rem;
    }
    
    .slot-item-icon {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }
    
    .collection-item-icon {
        width: 50px;
        height: 50px;
    }
    
    .rarity-header {
        font-size: 1.2rem;
    }
    
    .achievement-card {
        padding: 10px;
    }
    
    .achievement-icon {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
        margin-right: 10px;
    }
    
    .achievement-title {
        font-size: 0.8rem;
    }
    
    .achievement-description {
        font-size: 0.7rem;
    }
    
    .stat-box {
        min-width: 110px;
    }
    
    .stat-value {
        font-size: 0.9rem;
    }
}

@media (max-height: 1000px) {
    .slot-container {
        width: 800px;
        height: 200px;
    }
    
    .game-header {
        padding: 10px;
    }
    
    .game-header h1 {
        margin-bottom: 10px;
    }
}

/* Add these rules to the existing style.css */
.rarity-header.trash {
    background-color: #777;
    color: #ccc;
}

.rarity-header.common {
    background-color: #ad926d;
    color: #333;
}

.rarity-header.uncommon {
    background-color: #00aa00;
    color: #fff;
}

.rarity-header.rare {
    background-color: #5555ff;
    color: #fff;
}

.rarity-header.epic {
    background-color: #aa00aa;
    color: #fff;
}

.rarity-header.legendary {
    background-color: #ffaa00;
    color: #333;
}

.rarity-header.mythic {
    background: linear-gradient(124deg, #1de840, #ff002f, #2b1de8, #00fff2, #dd00f3, #dd00f3);
    background-size: 400% 400%;
    color: #fff;
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
    animation: rainbow 18s ease infinite;
}

/* Added to style.css */
/* Result Modal Styles */
#result-modal .modal-content {
    max-width: 500px;
    padding: 40px;
    text-align: center;
}

.result-title {
    font-size: 2.5rem;
    color: #e94560;
    margin-bottom: 20px;
    text-shadow: 4px 4px 0 #000;
    animation: pulse 1s infinite;
}

.result-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.result-item-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 30px;
    border-radius: 10px;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    border: 4px solid;
    box-shadow: 0 0 20px;
    min-height: 300px;
    min-width: 300px;
    justify-content: center;
    background: none !important;
}

.result-item-display::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    z-index: 0;
    background-size: 400% 400%;
    animation: gradientAnimation 10s ease infinite;
    filter: blur(5px);
    opacity: 0.8;
}

.result-item-display.trash-rarity::before {
    background: linear-gradient(124deg, #777, #555, #999);
}

.result-item-display.common-rarity::before {
    background: linear-gradient(124deg, #ad926d, #bfa178, #ad926d);
}

.result-item-display.uncommon-rarity::before {
    background: linear-gradient(124deg, #00aa00, #008800, #00cc00);
}

.result-item-display.rare-rarity::before {
    background: linear-gradient(124deg, #5555ff, #3333cc, #7777ff);
}

.result-item-display.epic-rarity::before {
    background: linear-gradient(124deg, #aa00aa, #880088, #cc00cc);
}

.result-item-display.legendary-rarity::before {
    background: linear-gradient(124deg, #ffaa00, #cc8800, #ffcc00);
}

.result-item-display.mythic-rarity::before {
    background: linear-gradient(124deg, #ff0000, #ff9900, #ffff00, #00ff00, #00ffff, #0000ff, #9900ff, #ff00ff);
}

.item-icon {
    font-size: 4rem;
    line-height: 1;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 180px;
    width: 180px;
    z-index: 2;
}

.result-item-icon {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    width: 180px;
    height: 180px;
}

.item-name {
    font-size: 2.2rem;
    font-weight: bold;
    word-break: break-word;
    line-height: 1.2;
    text-shadow: 2px 2px 0 #000;
    z-index: 2;
}

.item-rarity-badge {
    font-size: 1.4rem;
    padding: 10px 20px;
    border-radius: 20px;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
    background-color: rgba(0, 0, 0, 0.7);
    box-shadow: 0 0 15px currentColor;
    z-index: 2;
}

.result-stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
    font-size: 1.3rem;
}

.stat-row {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    z-index: 2;
}

.stat-label {
    color: #e94560;
}

.stat-value {
    font-weight: bold;
    color: #fff;
}

/* Rarity-specific colors */
.result-item-display.trash-rarity {
    border-color: #777;
    box-shadow: 0 0 20px #777;
}
.result-item-display.common-rarity {
    border-color: #ad926d;
    box-shadow: 0 0 20px #ad926d;
}
.result-item-display.uncommon-rarity {
    border-color: #00aa00;
    box-shadow: 0 0 20px #00aa00;
}
.result-item-display.rare-rarity {
    border-color: #5555ff;
    box-shadow: 0 0 20px #5555ff;
}
.result-item-display.epic-rarity {
    border-color: #aa00aa;
    box-shadow: 0 0 20px #aa00aa;
}
.result-item-display.legendary-rarity {
    border-color: #ffaa00;
    box-shadow: 0 0 20px #ffaa00;
}
.result-item-display.mythic-rarity {
    border: 4px solid white;
    box-shadow: 0 0 40px cyan;
}

.item-rarity-badge.trash-rarity {
    color: #ccc;
    background-color: #777;
}
.item-rarity-badge.common-rarity {
    color: #333;
    background-color: #ad926d;
}
.item-rarity-badge.uncommon-rarity {
    color: #fff;
    background-color: #00aa00;
}
.item-rarity-badge.rare-rarity {
    color: #fff;
    background-color: #5555ff;
}
.item-rarity-badge.epic-rarity {
    color: #fff;
    background-color: #aa00aa;
}
.item-rarity-badge.legendary-rarity {
    color: #333;
    background-color: #ffaa00;
}
.item-rarity-badge.mythic-rarity {
    background: linear-gradient(124deg, #1de840, #ff002f, #2b1de8, #00fff2, #dd00f3, #dd00f3);
    background-size: 400% 400%;
    color: #fff;
    text-shadow: 0 0 5px rgba(0,0,0,0.8);
    animation: rainbow 18s ease infinite;
}

/* Animations */
@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    80% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.game-main {
    position: relative;
}

.support-cube-btn {
    position: absolute;
    right: 24px;
    bottom: 24px;
    width: 60px;
    height: 60px;
    background: #ff8f3b;
    border: 4px solid #ffdf7c;
    border-radius: 9px;
    color: #fff;
    font-size: 2.1rem;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 6px 7px 0 #ffbc30, 12px 12px 0 #333;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.1s, box-shadow 0.15s, background 0.12s;
    outline: none;
}
.support-cube-btn:hover, .support-cube-btn:focus {
    background: #ffb366;
    transform: scale(1.06);
    box-shadow: 8px 10px 0 #ffbc30, 16px 16px 0 #222;
}

@media (max-width: 700px) {
    .support-cube-btn {
        right: 6px;
        bottom: 6px;
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }
}

/* Settings Modal Styles */
.settings-modal-content {
    max-width: 600px;
    padding: 30px 40px;
}

.settings-group {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #0f3460;
}

.settings-heading {
    color: #e94560;
    font-size: 1.2rem;
    margin-bottom: 15px;
    text-shadow: 1px 1px 0 #000;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 15px;
}

.volume-slider {
    flex: 1;
    height: 20px;
    background: #0f3460;
    border: 2px solid #e94560;
    border-radius: 10px;
    outline: none;
    -webkit-appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 25px;
    height: 25px;
    background: #e94560;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 25px;
    height: 25px;
    background: #e94560;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
}

.volume-value {
    font-size: 1.1rem;
    min-width: 50px;
    text-align: right;
}

.pixel-select {
    background-color: #1a1a2e;
    color: #fff;
    border: 4px solid #0f3460;
    padding: 12px;
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    width: 100%;
    cursor: pointer;
}

.pixel-select:focus {
    outline: none;
    border-color: #e94560;
}

/* Sell Duplicates Modal Styles */
#sell-duplicates-modal .modal-content {
    max-width: 700px;
    padding: 30px;
}

.duplicate-items-container {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
    border: 4px solid #0f3460;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.3);
}

.duplicate-item {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 10px;
    background-color: rgba(31, 41, 55, 0.7);
    border: 4px solid #0f3460;
}

.duplicate-item:last-child {
    margin-bottom: 0;
}

.duplicate-item-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 1.5rem;
}

.duplicate-item-icon img {
    max-width: 100%;
    max-height: 100%;
}

.duplicate-item-details {
    flex-grow: 1;
}

.duplicate-item-name {
    font-size: 1rem;
    margin-bottom: 5px;
}

.duplicate-item-rarity {
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
}

.duplicate-item-count {
    font-size: 0.9rem;
}

.duplicate-item-value {
    font-size: 1.1rem;
    color: #ffaa00;
    margin: 0 15px;
    min-width: 100px;
    text-align: center;
}

.no-duplicates {
    text-align: center;
    padding: 20px;
    font-size: 1.2rem;
    color: #aaa;
}

/* Rarity colors for duplicate items */
.duplicate-item-rarity.trash {
    background-color: #777;
    color: #ccc;
}

.duplicate-item-rarity.common {
    background-color: #ad926d;
    color: #333;
}

.duplicate-item-rarity.uncommon {
    background-color: #00aa00;
    color: #fff;
}

.duplicate-item-rarity.rare {
    background-color: #5555ff;
    color: #fff;
}

.duplicate-item-rarity.epic {
    background-color: #aa00aa;
    color: #fff;
}

.duplicate-item-rarity.legendary {
    background-color: #ffaa00;
    color: #333;
}

.duplicate-item-rarity.mythic {
    background: linear-gradient(124deg, #1de840, #ff002f, #2b1de8, #00fff2, #dd00f3, #dd00f3);
    background-size: 400% 400%;
    color: #fff;
    animation: rainbow 18s ease infinite;
}
.pixel-button.small {
    padding: 12px 24px;
    font-size: 0.8rem;
    margin-top: 40px;
}

/* Support Modal Styles */
.support-modal-content {
    max-width: 500px;
    padding: 40px;
    text-align: center;
    position: relative;
}

.support-heart {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.support-title {
    color: #e94560;
    font-size: 2.5rem;
    margin-bottom: 20px;
    line-height: 1.2;
    text-shadow: 3px 3px 0 #000;
}

.support-desc {
    font-size: 1.4rem;
    margin-bottom: 30px;
    line-height: 1.5;
}

.support-btns {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.support-paypal-btn {
    background-color: #0070ba;
}

.support-kofi-btn {
    background-color: #ff5e5b;
}

.support-thx {
    font-size: 1.3rem;
    color: #ffaa00;
}

.support-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    line-height: 1;
}

/* Rarity animations */
@keyframes common-pulse {
    0% { transform: scale(1); box-shadow: 0 0 10px #ad926d; }
    50% { transform: scale(1.05); box-shadow: 0 0 20px #ad926d; }
    100% { transform: scale(1); box-shadow: 0 0 10px #ad926d; }
}

@keyframes uncommon-sparkle {
    0% { transform: scale(1); box-shadow: 0 0 15px #00aa00; }
    25% { transform: scale(1.1); box-shadow: 0 0 30px #00aa00; }
    50% { transform: scale(1); box-shadow: 0 0 20px #00ff00; }
    75% { transform: scale(1.05); box-shadow: 0 0 25px #00cc00; }
    100% { transform: scale(1); box-shadow: 0 0 15px #00aa00; }
}

@keyframes rare-shimmer {
    0% { transform: scale(1); box-shadow: 0 0 15px #5555ff; }
    20% { transform: scale(1.1); box-shadow: 0 0 30px #5555ff; }
    40% { transform: scale(1); box-shadow: 0 0 25px #7777ff; }
    60% { transform: scale(1.05); box-shadow: 0 0 35px #5555ff; }
    80% { transform: scale(1); box-shadow: 0 0 20px #8888ff; }
    100% { transform: scale(1); box-shadow: 0 0 15px #5555ff; }
}

@keyframes epic-aura {
    0% { 
        transform: scale(1); 
        box-shadow: 0 0 10px #aa00aa, 0 0 20px #ff00ff; 
    }
    25% { 
        transform: scale(1.15); 
        box-shadow: 0 0 30px #aa00aa, 0 0 40px #ff00ff; 
    }
    50% { 
        transform: scale(1); 
        box-shadow: 0 0 20px #cc00cc, 0 0 30px #ff00ff; 
    }
    75% { 
        transform: scale(1.1); 
        box-shadow: 0 0 35px #aa00aa, 0 0 45px #ff00ff; 
    }
    100% { 
        transform: scale(1); 
        box-shadow: 0 0 10px #aa00aa, 0 0 20px #ff00ff; 
    }
}

@keyframes legendary-beams {
    0% { 
        transform: scale(1); 
        box-shadow: 0 0 20px #ffaa00, 0 0 40px #ffcc00;
    }
    20% { 
        transform: scale(1.2); 
        box-shadow: 0 0 40px #ffaa00, 0 0 60px #ffcc00;
    }
    40% { 
        transform: scale(1); 
        box-shadow: 0 0 30px #ffbb00, 0 0 50px #ffdd00;
    }
    60% { 
        transform: scale(1.15); 
        box-shadow: 0 0 45px #ffaa00, 0 0 65px #ffcc00;
    }
    80% { 
        transform: scale(1.05); 
        box-shadow: 0 0 35px #ffaa00, 0 0 55px #ffcc00;
    }
    100% { 
        transform: scale(1); 
        box-shadow: 0 0 20px #ffaa00, 0 0 40px #ffcc00;
    }
}

@keyframes mythic-rainbow {
    0% { 
        background-position: 0% 50%;
        box-shadow: 0 0 20px #ff0000, 0 0 40px #ff9900;
    }
    15% { 
        background-position: 25% 50%;
        box-shadow: 0 0 30px #ff9900, 0 0 50px #ffff00;
    }
    30% { 
        background-position: 50% 50%;
        box-shadow: 0 0 40px #ffff00, 0 0 60px #00ff00;
    }
    45% { 
        background-position: 75% 50%;
        box-shadow: 0 0 50px #00ff00, 0 0 70px #00ffff;
    }
    60% { 
        background-position: 100% 50%;
        box-shadow: 0 0 60px #00ffff, 0 0 80px #0000ff;
    }
    75% { 
        background-position: 75% 50%;
        box-shadow: 0 0 70px #0000ff, 0 0 90px #9900ff;
    }
    90% { 
        background-position: 25% 50%;
        box-shadow: 0 0 80px #9900ff, 0 0 100px #ff00ff;
    }
    100% { 
        background-position: 0% 50%;
        box-shadow: 0 0 20px #ff0000, 0 0 40px #ff00ff;
    }
}

@keyframes mythic-rotation {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(5deg) scale(1.2); }
    50% { transform: rotate(0deg) scale(1.3); }
    75% { transform: rotate(-5deg) scale(1.2); }
    100% { transform: rotate(0deg) scale(1); }
}

@keyframes screen-shake {
    0% { transform: translate(0, 0); }
    10% { transform: translate(-5px, -5px); }
    20% { transform: translate(5px, 5px); }
    30% { transform: translate(-5px, 5px); }
    40% { transform: translate(5px, -5px); }
    50% { transform: translate(-5px, -5px); }
    60% { transform: translate(5px, 5px); }
    70% { transform: translate(-5px, 5px); }
    80% { transform: translate(5px, -5px); }
    90% { transform: translate(-5px, -5px); }
    100% { transform: translate(0, 0); }
}

/* Animation classes */
.common-animation {
    animation: common-pulse 1.5s ease;
}

.uncommon-animation {
    animation: uncommon-sparkle 1.75s ease;
}

.rare-animation {
    animation: rare-shimmer 2s ease;
}

.epic-animation {
    animation: epic-aura 2s ease;
}

.legendary-animation {
    animation: legendary-beams 2.5s ease;
}

.mythic-animation {
    animation: 
        mythic-rainbow 2s linear infinite,
        mythic-rotation 2.5s ease;
}

.screen-shake {
    animation: screen-shake 0.8s ease;
}

/* === Mobile letterbox scaling (target 1600×900) === */
html, body { height: 100%; }
body { overflow: hidden; }

#stage-wrapper{
  position: fixed; inset: 0; display: grid; place-items: center;
  width: 100vw; height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: #1a1a2e;
  z-index: 0;
}

#game-root{
  width: 1600px; height: 900px;
  transform-origin: top left;
  position: absolute; left: 0; top: 0;
  /* ensure the root box is predictable regardless of .game-container rules */
  padding: 0 !important; margin: 0 !important; outline: 0 !important;
  box-sizing: border-box; /* keep your border in the size */
}

#rotate-overlay{
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  background:#1a1a2e; z-index: 2000;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
#rotate-overlay .rotate-box{
  text-align:center; border:2px dashed #ffcc66; border-radius:16px;
  padding:24px 28px; width:min(90vw, 440px); background:#0a1a2a; box-shadow:0 12px 32px rgba(0,0,0,.4);
  color:#ffe7a1;
}
#rotate-overlay .rotate-icon{ font-size:56px; margin-bottom:8px; }
#rotate-overlay .rotate-text{ font-size:18px; }


/* === Centering fix for HTML/itch embeds (keep mobile behavior) === */
#stage-wrapper{
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}
#game-root{
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: top left;
}
