:root {
    --primary-red: #ff4655;
    --dark-bg: #0f1923;
    --valorant-white: #ece8e1;
    --accent-red: #ff4655;
    --glass-bg: rgba(15, 25, 35, 0.85);
    --valorant-cyan: #00dfb6;
}

/* Infinite Badge */
.infinite-badge {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    z-index: 1000;
    pointer-events: none;
    animation: badgeSlideDown 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.infinite-badge .badge-icon {
    background-color: var(--valorant-cyan);
    color: var(--dark-bg);
    padding: 8px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 900;
    transform: skew(-15deg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(0, 223, 182, 0.3);
}

.infinite-badge .badge-icon span {
    transform: skew(15deg);
    line-height: 1;
}

.infinite-badge .badge-text {
    background-color: var(--dark-bg);
    color: white;
    padding: 8px 25px;
    font-family: 'Oswald', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    transform: skew(-15deg);
    margin-left: -5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: none;
    white-space: nowrap;
}

@keyframes badgeSlideDown {
    from { transform: translate(-50%, -50px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

/* Override global overflow to prevent right cut */
.main-content {
    overflow: visible !important;
}

.maps-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
    padding-top: 80px;
    margin: 0; /* Remove auto margin to avoid centering issues if overflow */
    width: 100%;
    min-height: 100vh;
    background: url('../src/backgrounds/agents-mode.webp') no-repeat center center;
    background-size: cover;
    position: relative;
    overflow-x: hidden; /* Prevent horizontal scroll on the layout itself */
}

.maps-layout::before {
    display: none; /* Removed the dark overlay as requested */
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 30px;
    padding: 20px 0;
    position: relative;
    z-index: 10;
}

.header-logo .logo {
    width: 250px !important;
    height: auto !important;
    position: relative !important;
    top: auto !important;
    right: auto !important;
    margin: 0 !important;
    filter: drop-shadow(0 0 10px rgba(255, 70, 85, 0.3));
}

.fixed-back-button {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 1000;
    color: white !important;
    text-decoration: none;
    font-weight: bold;
    letter-spacing: 2px;
    font-size: 1.1rem;
    padding: 10px 20px;
    background: rgba(15, 25, 35, 0.8);
    border-left: 3px solid var(--accent-red);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 10px 100%, 0 calc(100% - 10px));
    transition: all 0.3s ease;
}

.fixed-back-button:hover {
    background: var(--accent-red);
    color: white !important;
}

.streak-container {
    display: flex;
    gap: 20px;
    align-items: center;
}

.streak-box {
    background: var(--glass-bg);
    border: 1px solid rgba(255, 70, 85, 0.3);
    padding: 8px 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
    clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
    position: relative;
    overflow: hidden;
}

.streak-box::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-red);
}

.streak-box span:first-child {
    font-size: 0.7rem;
    color: var(--accent-red);
    font-weight: bold;
    letter-spacing: 1px;
}

.streak-box #ui-score,
.streak-box #ui-round,
.streak-box #max-streak {
    font-size: 1.8rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    margin-top: 5px;
}

.max-score-display {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
}

.trophy-icon {
    color: #ffd700;
    font-size: 1.2rem;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
    animation: trophyGlow 2s infinite alternate;
}

@keyframes trophyGlow {
    from { filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.4)); }
    to { filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.8)); transform: scale(1.1); }
}

/* Tactical Grid Layout */
.tactical-grid {
    display: grid;
    grid-template-columns: 1fr 380px; /* Reduced from 400px to avoid right cut */
    gap: 20px;
    width: 95%; /* Use percentage for better responsiveness */
    max-width: 1400px;
    z-index: 10;
    margin: 0 auto;
}

@media (max-width: 1100px) {
    .tactical-grid {
        grid-template-columns: 1fr;
    }
}

.map-view-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.interaction-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.map-display-container {
    width: 100%;
    aspect-ratio: 16/9;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: #000;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    border-bottom: 4px solid var(--accent-red);
    transition: all 0.5s ease;
}

.map-display-container.failed {
    border: 3px solid var(--accent-red);
    box-shadow: 0 0 40px rgba(255, 70, 85, 0.6), inset 0 0 100px rgba(255, 70, 85, 0.5);
    animation: failPulse 2s infinite;
}

@keyframes failPulse {
    0% { border-color: #ff4655; box-shadow: 0 0 30px rgba(255, 70, 85, 0.5); }
    50% { border-color: #ff8e96; box-shadow: 0 0 50px rgba(255, 70, 85, 0.8); }
    100% { border-color: #ff4655; box-shadow: 0 0 30px rgba(255, 70, 85, 0.5); }
}

.map-display-container.failed .main-map-img {
    filter: grayscale(0.4) sepia(1) saturate(4) hue-rotate(-45deg) brightness(0.5);
    transform: scale(1.05); /* Slight zoom in on fail */
}

.map-display-container.failed::after {
    content: var(--fail-text, "MISIÓN FALLIDA");
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-5deg);
    color: rgba(255, 70, 85, 0.8);
    font-size: 5rem;
    font-weight: 900;
    font-family: 'Oswald', sans-serif;
    border: 8px solid rgba(255, 70, 85, 0.8);
    padding: 10px 40px;
    pointer-events: none;
    z-index: 60;
    opacity: 0.6;
    letter-spacing: 10px;
    text-shadow: 0 0 20px rgba(0,0,0,0.5);
}


.loading-overlay {
    position: absolute;
    inset: 0;
    background: var(--dark-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    gap: 20px;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid var(--accent-red);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.mission-briefing {
    background: var(--glass-bg);
    padding: 20px;
    border-left: 4px solid var(--accent-red);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%);
}

.mission-briefing h2 {
    font-size: 1.2rem;
    color: var(--accent-red);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.mission-briefing p {
    color: var(--valorant-white);
    opacity: 0.8;
    line-height: 1.6;
}

/* Minimap Card */
.minimap-card {
    background: var(--glass-bg);
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.minimap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.minimap-name {
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--valorant-white);
    opacity: 0.6;
}

.live-gps {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #22c55e;
    font-size: 0.7rem;
    font-weight: bold;
}

.live-gps .dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

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

/* Map Interaction Area */
.map-interactive-area {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: crosshair;
    overflow: hidden;
    transition: all 0.5s ease;
}

.minimap-card.failed .minimap-img {
    filter: grayscale(0.5) sepia(1) saturate(3) hue-rotate(-50deg) brightness(0.6);
}

.minimap-card.failed .map-interactive-area {
    border-color: var(--accent-red);
    box-shadow: 0 0 20px rgba(255, 70, 85, 0.4);
}


.main-map-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    image-rendering: auto;
    transform-origin: center;
}

.main-map-img.no-transition {
    transition: none !important;
}

.minimap-img {
    width: 100%;
    height: 100%;
    display: block;
    user-select: none;
    pointer-events: none;
}

.marker {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 20;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Map Selection Grid */
.map-grid-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.map-btn {
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.map-btn:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
    transform: translateY(-2px);
}

.map-btn.correct { background: #22c55e !important; border-color: #22c55e !important; }
.map-btn.wrong { background: #ff4655 !important; border-color: #ff4655 !important; }

.phase-label {
    font-size: 0.8rem;
    color: var(--accent-red);
    font-weight: bold;
    letter-spacing: 2px;
}

.user-marker {
    background: var(--accent-red);
    box-shadow: 0 0 10px var(--accent-red);
}

.target-marker {
    background: #22c55e;
    box-shadow: 0 0 10px #22c55e;
}

.error-line-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 15;
}

.hidden { display: none !important; }

/* Buttons */
.action-buttons {
    display: flex;
    gap: 10px;
}

.val-btn {
    width: 100%;
    padding: 15px;
    font-family: 'Oswald', sans-serif;
    font-weight: bold;
    letter-spacing: 2px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
}

.btn-primary {
    background: var(--accent-red);
    color: white;
}

.btn-primary:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

.btn-accent {
    background: white;
    color: var(--dark-bg);
}

.btn-dark {
    background: #1a252f;
    color: white;
}

.val-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: brightness(1.2);
}

/* Result Badge */
.result-badge-container {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 50;
    animation: slideInLeft 0.5s ease-out;
}

.result-badge {
    padding: 10px 20px;
    color: white;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Mini Stats */
.mini-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-item {
    background: var(--glass-bg);
    padding: 15px;
    border-bottom: 3px solid var(--accent-red);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0; /* Prevent overflow */
}

.stat-label {
    font-size: 0.8rem;
    color: var(--accent-red);
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 900;
    color: white;
}

/* Stats Dashboard - Full Area replacement */
.stats-dashboard {
    width: 95%;
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(15, 25, 35, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    padding: 3rem;
    animation: dashboardEntry 0.8s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
    position: relative;
    border-top: 4px solid var(--accent-red);
}

@keyframes dashboardEntry {
    from { opacity: 0; transform: translateY(30px) scale(0.98); filter: blur(10px); }
    to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.stats-dashboard {
    width: 95%;
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(15, 25, 35, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    padding: 3rem;
    animation: dashboardEntry 0.8s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
    position: relative;
    border-top: 4px solid var(--accent-red);
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 3rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-left {
    flex: 1.5;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.header-left h3 {
    font-family: 'Tungsten', sans-serif !important;
    font-size: 3rem !important;
    color: white !important;
    letter-spacing: 3px;
    margin: 0;
    text-transform: uppercase;
    line-height: 0.95;
}

.header-line {
    height: 3px;
    width: 50px;
    background: var(--accent-red);
}

.header-center-stats {
    flex: 3;
    display: flex;
    justify-content: center;
    gap: 4rem;
}

.header-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header-stat .label {
    font-size: 0.8rem;
    color: var(--accent-red);
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.header-stat .value {
    font-family: 'Tungsten', sans-serif;
    font-size: 3.5rem;
    color: white;
    line-height: 1;
}

.header-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

#btn-stats-continue {
    padding: 1rem 2.5rem;
    font-size: 1.3rem;
    letter-spacing: 2px;
    background: var(--accent-red);
    color: white;
    border: none;
    cursor: pointer;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    transition: all 0.3s ease;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.chart-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    min-height: 350px;
}

.chart-title {
    font-family: 'Tungsten', sans-serif;
    color: var(--accent-red);
    font-size: 1.2rem;
    letter-spacing: 2px;
    margin-bottom: 1.5rem;
    border-left: 3px solid var(--accent-red);
    padding-left: 12px;
}

.chart-container {
    flex: 1;
    position: relative;
    width: 100%;
}

.finish-content {
    background: #0f1923;
    padding: 4rem 6rem;
    border: 1px solid rgba(255, 70, 85, 0.3);
    clip-path: polygon(20px 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%, 0 20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    animation: modalEntry 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 70, 85, 0.1);
    position: relative;
    max-width: 90%;
}

@keyframes modalEntry {
    from { transform: scale(0.8); opacity: 0; filter: blur(10px); }
    to { transform: scale(1); opacity: 1; filter: blur(0); }
}

.finish-content h2 {
    font-family: 'Tungsten', sans-serif !important;
    font-size: clamp(2rem, 10vw, 3.5rem) !important;
    color: #00dfb6 !important;
    margin: 0;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(0, 223, 182, 0.4);
    text-align: center;
    width: 100%;
    line-height: 1.1;
}

#finish-score-text {
    font-family: 'Tungsten', sans-serif;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.2rem;
    letter-spacing: 1px;
    margin: 10px 0 0 0;
}

.rank-badge {
    font-family: 'Tungsten', sans-serif !important;
    font-size: clamp(3rem, 15vw, 6rem) !important;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
    line-height: 1;
    margin: 15px 0;
    animation: rankGlow 2s infinite alternate;
}

@keyframes rankGlow {
    from { transform: scale(1); filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.3)); }
    to { transform: scale(1.05); filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.6)); }
}

#btn-restart {
    margin-top: 2rem;
    padding: 1.2rem 4rem;
    font-size: 1.5rem;
    letter-spacing: 3px;
    background: #ff4655;
    color: white;
    border: none;
    cursor: pointer;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    transition: all 0.3s ease;
}

#btn-restart:hover {
    background: white;
    color: #ff4655;
    transform: translateY(-5px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.minimap-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.expand-btn {
    background: transparent;
    border: none;
    color: #ff4655;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.expand-btn:hover {
    color: white;
    transform: scale(1.2);
}

/* Fullscreen Map Modal */
.fullscreen-map-container {
    background: #0f1923;
    width: 90vw;
    max-width: 1200px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    border: 2px solid #ff4655;
    position: relative;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    margin: auto;
}

.fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.fullscreen-header h3 {
    margin: 0;
    letter-spacing: 2px;
    color: #ff4655;
}

.large-map {
    flex-grow: 1;
    cursor: crosshair;
    background: #000;
    position: relative;
    overflow: hidden;
}

.fullscreen-footer {
    padding-top: 15px;
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.7;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
    transition: opacity 0.3s ease;
}

.expand-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: white !important;
    cursor: pointer !important;
    padding: 8px !important;
    border-radius: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    pointer-events: auto !important;
    z-index: 100 !important;
}

.expand-btn:hover {
    background: #ff4655 !important;
    border-color: #ff4655 !important;
    transform: scale(1.1);
}

.fullscreen-map-container {
    z-index: 10001 !important;
}

.map-image-frame {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: #000;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.map-display-container {
    width: 100%;
    max-width: 800px;
    aspect-ratio: 16 / 9;
    margin: 0 auto;
}
