:root {
    --bg-dark: #121212;
    --bg-card: #1e1e1e;
    --bg-hover: #2c2c2c;
    --primary: #fbbf24;
    --primary-hover: #d97706;
    --text-main: #ffffff;
    --text-muted: #a1a1aa;
    --border: #333;
    
    --rarity-common: #b0c3d9;
    --rarity-rare: #4b69ff;
    --rarity-epic: #8847ff;
    --rarity-legendary: #d32ce6;
    --rarity-special: #eb4b4b;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 1px;
}

.main-nav {
    display: flex;
    gap: 10px;
}

.nav-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
}

.nav-btn:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

.nav-btn.active {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(251, 191, 36, 0.1);
}

.user-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.user-stats .value {
    font-weight: 600;
    color: #4ade80;
    font-size: 18px;
}

/* Buttons */
button {
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: #000;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 6px;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: 6px;
}

.btn-secondary:hover {
    background: #444;
}

.btn-small {
    padding: 5px 10px;
    border-radius: 4px;
    background: var(--bg-hover);
    color: var(--text-main);
    font-weight: bold;
}

/* Grid Layouts */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.card img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 15px;
}

.card h3 {
    margin-bottom: 10px;
    font-size: 16px;
}

.card .price {
    color: var(--primary);
    font-weight: 700;
}

/* Roulette */
.hidden {
    display: none !important;
}

#opening-section {
    text-align: center;
    margin-bottom: 40px;
}

.opening-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.roulette-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto 30px;
    background: #000;
    border-radius: 8px;
    border: 2px solid var(--primary);
    overflow: hidden;
    height: 160px;
}

.roulette-window {
    position: relative;
    height: 100%;
    width: 100%;
}

.roulette-strip {
    display: flex;
    height: 100%;
    /* Will be animated */
}

.roulette-item {
    width: 160px;
    height: 100%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #333;
    padding: 10px;
    background: linear-gradient(to bottom, #1a1a1a, #0d0d0d);
    position: relative;
}

.roulette-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--item-color);
}

.roulette-item img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.roulette-item .name {
    font-size: 12px;
    color: #ccc;
    margin-top: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.roulette-marker {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 100%;
    background: #fff;
    z-index: 10;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Items Preview */
.items-preview {
    margin-top: 40px;
    text-align: left;
    background: var(--bg-card);
    padding: 20px;
    border-radius: 8px;
}

.mini-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.mini-item {
    width: 80px;
    height: 80px;
    background: #111;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 3px solid var(--item-color);
    position: relative;
}

.mini-item:hover::before {
    content: attr(data-name);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 20;
    pointer-events: none;
}

.mini-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

/* Inventory */
#inventory-section {
    border-top: 1px solid var(--border);
    padding-top: 30px;
    margin-top: 30px;
}

.inventory-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.inventory-item {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 4px solid var(--item-color);
}

.inventory-item img {
    width: 100px;
    height: 100px;
    margin-bottom: 10px;
}

.inventory-item .name {
    font-size: 14px;
    text-align: center;
    margin-bottom: 5px;
}

.inventory-item .price {
    font-size: 12px;
    color: #4ade80;
    margin-bottom: 10px;
}

.inventory-item .sell-btn {
    width: 100%;
    background: #333;
    color: #fff;
    border: none;
    padding: 5px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.inventory-item .sell-btn:hover {
    background: #ef4444;
}

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

.modal-content {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    width: 90%;
    max-width: 400px;
    border: 1px solid var(--border);
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

#win-item-display {
    margin: 20px 0;
}

#win-image {
    width: 150px;
    height: 150px;
    margin-bottom: 15px;
}

#win-name {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 5px;
}

#win-rarity {
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    margin-bottom: 10px;
    color: var(--text-muted);
}

#win-value {
    color: #4ade80;
    font-size: 24px;
    font-weight: 700;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* Case Battle Selection Upgrades */
.battle-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #252525 0%, #1a1a1a 100%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 280px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.battle-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(251, 191, 36, 0.1);
}

.card-image-wrap {
    background: radial-gradient(circle at center, #333 0%, #1a1a1a 100%);
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.card-image-wrap img {
    width: 110px;
    height: 110px;
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.5));
    transition: transform 0.3s ease;
}

.battle-card:hover .card-image-wrap img {
    transform: scale(1.1) rotate(5deg);
}

.card-info {
    padding: 15px;
    text-align: center;
    flex: 1;
}

.card-info h3 {
    font-size: 18px;
    margin-bottom: 5px;
    font-weight: 800;
}

.battle-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(251, 191, 36, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.battle-overlay span {
    color: #000;
    font-weight: 900;
    font-size: 18px;
    letter-spacing: 1px;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.battle-card:hover .battle-overlay {
    opacity: 1;
}

.battle-card:hover .battle-overlay span {
    transform: translateY(0);
}

/* Battle Arena Upgrades */
#battle-arena {
    padding: 40px 20px;
    background: radial-gradient(circle at center, #1a1a1a 0%, #050505 100%);
    border-radius: 20px;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.8);
    position: relative;
    overflow: hidden;
}

#battle-arena::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://www.transparenttextures.com/patterns/carbon-fibre.png');
    opacity: 0.1;
    pointer-events: none;
}

.battle-container {
    perspective: 1500px;
    gap: 40px;
}

.battle-column {
    background: linear-gradient(180deg, rgba(40, 40, 40, 0.8) 0%, rgba(20, 20, 20, 0.9) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    min-height: 500px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.battle-vs {
    background: var(--primary);
    color: #000;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    font-size: 28px;
    font-weight: 900;
    margin-top: 200px;
    border: 4px solid #000;
}

.battle-round-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    height: 100px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.battle-round-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-right: 15px;
}

.battle-round-item .info .name {
    font-size: 14px;
    font-weight: 600;
}

.battle-round-item .info .val {
    font-size: 16px;
}

/* Modal Upgrade */
.modal-content {
    background: linear-gradient(145deg, #252525 0%, #121212 100%);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 20px;
    padding: 50px;
}

/* Promo Section Styles */
#promo-section {
    max-width: 600px;
    margin: 40px auto;
}

.promo-container {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 15px;
    border: 1px solid var(--border);
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.promo-container h2 {
    margin-bottom: 10px;
    color: var(--primary);
}

.promo-container p {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.promo-input-wrap {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#promo-input {
    flex: 1;
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #111;
    color: #fff;
    font-size: 16px;
    font-family: inherit;
}

#promo-input:focus {
    outline: none;
    border-color: var(--primary);
}

.promo-status {
    font-weight: 600;
    font-size: 14px;
    min-height: 20px;
    transition: all 0.3s;
}

.promo-status.success {
    color: #4ade80;
}

.promo-status.error {
    color: #ef4444;
}
