/* --- MODAL FABULARNY --- */
#story-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 200; /* Powyżej wszystkiego */
    display: none; /* Domyślnie ukryte */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.story-content {
    width: 600px;
    background: #151515;
    border: 2px solid #e74c3c; /* Czerwony akcent fabuły */
    padding: 30px;
    box-shadow: 0 0 50px rgba(231, 76, 60, 0.3);
    text-align: left;
}

.story-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
}

.story-avatar {
    width: 60px;
    height: 60px;
    background: #333;
    border-radius: 50%;
    margin-right: 15px;
    border: 2px solid #e74c3c;
    /* Placeholder na obrazek postaci */
    background-image: linear-gradient(135deg, #444 25%, transparent 25%), linear-gradient(225deg, #444 25%, transparent 25%), linear-gradient(45deg, #444 25%, transparent 25%), linear-gradient(315deg, #444 25%, transparent 25%);
    background-size: 10px 10px;
}

#story-speaker {
    color: #e74c3c;
    font-size: 24px;
    font-weight: bold;
    text-transform: uppercase;
    margin: 0;
}

#story-text {
    font-size: 18px;
    line-height: 1.5;
    color: #eee;
    margin-bottom: 30px;
    font-style: italic;
}

#story-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.story-btn {
    background: #222;
    border: 1px solid #555;
    color: #fff;
    padding: 15px;
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    transition: 0.2s;
}

.story-btn:hover {
    background: #e74c3c;
    border-color: #ff7675;
    color: #000;
    font-weight: bold;
    padding-left: 25px; /* Efekt przesunięcia */
}

/* --- Style dla Paska XP w Menu --- */
#menu-reputation {
    margin-bottom: 20px;
    width: 100%;
}

.xp-container {
    width: 300px;
    height: 20px;
    background: #222;
    border: 1px solid #444;
    margin: 0 auto;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
}

#xp-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #2ecc71, #27ae60);
    transition: width 0.5s ease;
}

#xp-level {
    margin-top: 5px;
    font-size: 14px;
    color: #3498db;
    font-weight: bold;
    letter-spacing: 1px;
}

/* --- Style dla KARIERY --- */
#career-menu {
    width: 900px;
    height: 600px;
    background: #101015;
    border: 2px solid #e74c3c;
    display: none;
    flex-direction: column;
    padding: 30px;
    box-shadow: 0 0 50px rgba(231, 76, 60, 0.2);
}

.career-layout {
    display: flex;
    flex: 1;
    gap: 20px;
    margin-top: 20px;
}

/* Lista tomów */
#career-volumes {
    display: flex;
    justify-content: center;
    gap: 20px;
    width: 100%;
}

.career-volume-btn {
    width: 250px;
    height: 350px;
    background: #1a1a1a;
    border: 2px solid #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
    position: relative;
    overflow: hidden;
}

.career-volume-btn:hover {
    border-color: #e74c3c;
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

.career-volume-btn.locked {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

.career-volume-btn h3 {
    color: #e74c3c;
    font-size: 20px;
    margin-bottom: 10px;
    text-align: center;
}

.career-volume-btn p {
    color: #aaa;
    font-size: 12px;
    padding: 0 15px;
}

.career-volume-btn .status {
    margin-top: 20px;
    font-weight: bold;
    padding: 5px 10px;
    background: #000;
    border-radius: 4px;
    font-size: 10px;
    color: #fff;
}

/* Lista wyścigów w tomie */
#career-races {
    display: none; /* Ukryte domyślnie */
    width: 100%;
}

#career-races-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.career-race-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #222;
    padding: 15px;
    border-left: 4px solid #555;
    cursor: pointer;
    transition: 0.2s;
}

.career-race-item:hover {
    background: #2a2a2a;
    border-left-color: #e74c3c;
}

.career-race-item.locked {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.career-race-item.completed {
    border-left-color: #27ae60;
    opacity: 0.7;
}

.career-race-item.boss-race {
    border: 2px solid #e74c3c;
    background: linear-gradient(90deg, #222, #300);
}

.race-info {
    text-align: left;
}

.opp-name {
    font-weight: bold;
    font-size: 16px;
    color: #fff;
}

.opp-car {
    font-size: 12px;
    color: #888;
}

.race-reward {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #aaa;
}

.race-status {
    font-size: 10px;
    padding: 4px 8px;
    background: #000;
    border-radius: 4px;
    color: #fff;
}

/* --- POZOSTAŁE STYLE (Sklep, Garaż itp.) --- */
#dyno-menu {
    width: 900px;
    height: 600px;
    background: #1c2a30; 
    border: 1px solid #e67e22;
    display: none;
    flex-direction: column;
    padding: 20px;
    box-shadow: 0 0 50px rgba(230, 126, 34, 0.2);
}

#dyno-container {
    flex: 1;
    background: #000;
    border: 2px solid #333;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#dyno-canvas {
    width: 100%;
    height: 100%;
}

#dyno-status {
    position: absolute;
    top: 20px;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 0 5px black;
    pointer-events: none;
}

.shop-cat-btn:nth-child(odd), .tuning-cat-btn:nth-child(odd) {
    border-left: 3px solid #9b59b6;
}

.shop-cat-btn:nth-child(even), .tuning-cat-btn:nth-child(even) {
    border-left: 3px solid #8e44ad;
}

.shop-cat-btn:nth-child(5), .shop-cat-btn:nth-child(6),
.tuning-cat-btn:nth-child(5), .tuning-cat-btn:nth-child(6) { 
    border-left-color: #c0392b;
}

.shop-cat-btn:nth-child(3), .tuning-cat-btn:nth-child(3) {
    border-left-color: #bdc3c7;
}

#shop-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    grid-auto-rows: min-content; 
    gap: 15px;
    padding-right: 10px; 
}

.shop-car-nav {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #111;
    overflow-x: auto;
    margin-bottom: 15px;
    border-bottom: 1px solid #333;
}

.car-select-btn {
    flex: 0 0 auto;
    padding: 8px 15px;
    background: #222;
    border: none;
    border-bottom: 3px solid #555;
    color: #888;
    font-size: 12px;
    width: auto;
    margin: 0;
}

.car-select-btn.active {
    background: #333;
    color: #fff;
}

#tuning-menu {
    width: 900px;
    height: 600px;
    background: #1c2a30; 
    border: 1px solid #2ecc71;
    display: none; 
    flex-direction: column;
    padding: 20px;
    box-shadow: 0 0 50px rgba(46, 204, 113, 0.2);
}

.tuning-container {
    display: flex;
    flex: 1;
    gap: 20px;
    margin-top: 15px;
    overflow: hidden;
}

#tuning-categories {
    width: 160px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.tuning-cat-btn {
    padding: 12px 10px;
    background: #222;
    border: 1px solid #444;
    color: #aaa;
    cursor: pointer;
    font-weight: bold;
    text-align: left;
    transition: 0.2s;
    margin: 0;
    width: 100%;
}

.tuning-cat-btn.active {
    background: #2ecc71;
    color: #000;
    border-color: #2ecc71;
}

#tuning-items {
    flex: 1;
    background: #111;
    border: 1px solid #333;
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    grid-auto-rows: 100px;
    gap: 15px;
    overflow-y: auto;
}

.tuning-item {
    background: #222;
    border: 1px solid #444;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.tuning-item.installed {
    border-color: #00ff00;
    box-shadow: inset 0 0 10px rgba(0,255,0,0.2);
}

.t-info {
    display: flex;
    flex-direction: column;
}

.t-name {
    font-weight: bold;
    font-size: 14px;
}

.t-stats {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #aaa;
    margin-top: 5px;
}

.t-action {
    margin-top: auto;
}

.btn-tune {
    width: 100%;
    margin: 0;
    padding: 5px;
    font-size: 11px;
}

.btn-install {
    background: #3498db;
}

.btn-remove {
    background: #e74c3c;
}
/* ===== RACE LOADING SCREEN ===== */
#race-loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rls-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, #0a0a1a 0%, #000 100%);
}

.rls-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 90%;
    max-width: 700px;
}

.rls-vs-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
}

.rls-car-card {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    animation: rls-slide-in 0.5s ease both;
}

#rls-player-card { animation-delay: 0s; border-color: rgba(0,200,255,0.3); }
#rls-ai-card     { animation-delay: 0.15s; border-color: rgba(255,60,60,0.3); }

@keyframes rls-slide-in {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.rls-car-img-wrap {
    width: 160px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rls-car-img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    image-rendering: auto;
}

.rls-car-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    color: #aaa;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.rls-car-model {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
}

.rls-vs {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    color: #e74c3c;
    text-shadow: 0 0 20px rgba(231,76,60,0.8);
    flex-shrink: 0;
    animation: rls-pulse 1s ease-in-out infinite;
}

@keyframes rls-pulse {
    0%, 100% { text-shadow: 0 0 20px rgba(231,76,60,0.8); }
    50%       { text-shadow: 0 0 40px rgba(231,76,60,1), 0 0 60px rgba(231,76,60,0.5); }
}

.rls-info {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    color: #ffd700;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.85;
    text-align: center;
}

.rls-bar-wrap {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
}

.rls-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #e74c3c, #f39c12, #2ecc71);
    border-radius: 3px;
    transition: width 0.1s linear;
}

.rls-countdown {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    font-weight: 900;
    color: #fff;
    opacity: 0.3;
}
