:root {
    --team-ally: #00d2ff;
    --team-ally-dim: rgba(0, 210, 255, 0.1);
    --team-axis: #ff2a2a;
    --team-axis-dim: rgba(255, 42, 42, 0.1);
    --role-combat: #ff3b3b;
    --role-offense: #ffa502;
    --role-defense: #2ecc71;
    --role-support: #3498db;
    --role-kill: #9b59b6;
}

* { box-sizing: border-box; }
html, body { overflow-x: hidden; width: 100%; max-width: 100vw; }

.app-container {
    width: 100%; min-height: 100vh;
    padding-top: 110px; padding-bottom: 40px;
    display: flex; flex-direction: column; align-items: center;
    overflow-x: hidden;
}

.view-grid-container {
    width: 100%; max-width: 1100px; 
    position: relative; display: flex; flex-direction: column; align-items: center; padding: 0 50px;
}

.nav-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 40px; height: 60px;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.2); font-size: 1.5rem;
    cursor: pointer; transition: all 0.3s ease; border: none; background: none;
    z-index: 20;
}
.nav-arrow:hover { color: var(--primary); transform: translateY(-50%) scale(1.1); text-shadow: 0 0 20px var(--primary); }
.nav-arrow.disabled { opacity: 0; pointer-events: none; }
.na-prev { left: 5px; } .na-next { right: 5px; }

.matrix-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 20px; width: 100%;
    margin-top: 15px;
}

.matrix-card {
    height: 150px; 
    background: #08080a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    position: relative; overflow: hidden;
    cursor: pointer; 
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}
.matrix-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255,255,255,0.2);
    box-shadow: 0 20px 40px rgba(0,0,0,0.8);
}

.mc-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover; opacity: 0.85; filter: saturate(1.1);
    transition: transform 0.6s ease;
}
.matrix-card:hover .mc-bg { transform: scale(1.05); }

.mc-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.95) 90%);
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 10px 12px; z-index: 2;
}

.mc-header { display: flex; justify-content: flex-end; }
.mc-date {
    font-family: 'Rajdhani'; font-weight: 500; font-size: 0.8rem; color: #ddd;
    background: rgba(0, 0, 0, 0.8); padding: 2px 6px; border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.1); backdrop-filter: blur(4px);
    display: flex; align-items: center; gap: 4px;
}
.mc-date i { color: var(--primary); font-size: 0.7rem; }

.mc-footer { display: flex; flex-direction: column; gap: 5px; }

.mc-map-name {
    font-family: 'Chakra Petch', sans-serif; font-weight: 500; font-size: 0.95rem;
    color: #fff; text-transform: uppercase; letter-spacing: 0.5px;
    text-shadow: 0 2px 5px rgba(0,0,0,1);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.match-result-bar {
    display: flex; height: 22px; width: 100%;
    background: rgba(10, 10, 15, 0.9);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 3px; overflow: hidden;
    backdrop-filter: blur(10px);
    position: relative;
}

.mrb-side {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
    position: relative; transition: 0.3s;
}
.mrb-side::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 2px;
    background: var(--side-color); opacity: 0.6; transition: 0.3s;
}
.matrix-card:hover .mrb-side::after { opacity: 1; }

.mrb-ally { --side-color: var(--team-ally); background: linear-gradient(90deg, var(--team-ally-dim) 0%, transparent 100%); }
.mrb-axis { --side-color: var(--team-axis); background: linear-gradient(-90deg, var(--team-axis-dim) 0%, transparent 100%); }

.mrb-label { font-family: 'Teko'; font-size: 0.8rem; letter-spacing: 0.5px; color: #aaa; margin-top: 1px; font-weight: 300; }
.mrb-val { font-family: 'Chakra Petch'; font-weight: 500; font-size: 0.95rem; color: #fff; text-shadow: 0 0 10px var(--side-color); line-height: 1; }
.mrb-divider { width: 1px; background: rgba(255,255,255,0.1); position: relative; }

.pagination-container { margin-top: 20px; display: flex; gap: 6px; }
.page-dot {
    width: 30px; height: 3px; background: rgba(255,255,255,0.1); border-radius: 2px;
    cursor: pointer; transition: 0.3s;
}
.page-dot.active { background: var(--primary); box-shadow: 0 0 10px var(--primary); }

.view-details {
    display: none; width: 100%; max-width: 1200px; 
    flex-direction: column; gap: 20px;
    padding: 0 30px;
}
.view-details.active { display: flex; }

.details-toolbar {
    width: 100%; display: flex; justify-content: flex-start;
    margin-bottom: -15px; z-index: 10;
}
.back-btn {
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff; font-family: 'Chakra Petch'; font-weight: 500; font-size: 0.8rem; 
    padding: 8px 18px; border-radius: 4px; cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: all 0.3s ease; backdrop-filter: blur(5px);
    text-transform: uppercase; letter-spacing: 1px;
}
.back-btn:hover {
    background: var(--primary); border-color: var(--primary);
    box-shadow: 0 0 20px rgba(255, 26, 26, 0.4); transform: translateX(-5px);
}

.match-hero {
    width: 100%; height: 260px; 
    border-radius: 12px; position: relative; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 20px 40px rgba(0,0,0,0.8);
    animation: heroEnter 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    opacity: 0; transform: translateY(20px);
}

.hero-bg {
    width: 100%; height: 100%; object-fit: cover;
    filter: brightness(0.6) saturate(1.1);
    transform: scale(1); transition: transform 6s ease;
}
.view-details.active .hero-bg { transform: scale(1.1); }

.texture-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: radial-gradient(rgba(0,0,0,0) 50%, rgba(0,0,0,1)), 
                      url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAIklEQVQIW2NkQAKrVq36zwjjgzjwqkJfYwKfCpDNACsAAg4kAucg5IkAAAAASUVORK5CYII=');
    background-repeat: repeat; opacity: 0.4; pointer-events: none; z-index: 1;
}

.hero-content {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 2; padding: 25px 40px;
    display: flex; justify-content: space-between; align-items: flex-end;
    background: linear-gradient(0deg, #050505 0%, rgba(5,5,5,0.8) 20%, transparent 100%);
}

.hero-info { display: flex; flex-direction: column; gap: 5px; max-width: 60%; }

.hero-map-title {
    font-family: 'Chakra Petch'; font-weight: 500; font-size: 2.2rem; 
    color: #fff; text-transform: uppercase; line-height: 1;
    text-shadow: 0 10px 30px rgba(0,0,0,1); letter-spacing: -1px; margin-bottom: 5px;
}

.hero-meta-row { display: flex; gap: 12px; align-items: center; }
.meta-pill {
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
    padding: 4px 12px; border-radius: 4px; backdrop-filter: blur(10px);
    font-family: 'Teko'; font-size: 1rem; color: #ddd; letter-spacing: 1px; font-weight: 300;
    display: flex; align-items: center; gap: 6px;
}
.meta-pill i { color: var(--primary); }

.hero-score-wrapper {
    display: flex; align-items: center; gap: 30px;
    background: rgba(0,0,0,0.6); padding: 10px 30px;
    border-radius: 10px; border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
}

.score-group { text-align: center; }
.sg-label { 
    font-family: 'Teko'; font-size: 1.1rem; letter-spacing: 2px; font-weight: 300;
    color: #888; display: block; margin-bottom: -5px; 
}
.sg-val {
    font-family: 'Chakra Petch'; font-weight: 500; font-size: 2.8rem; 
    line-height: 1; color: #fff; text-shadow: 0 0 40px var(--glow);
}
.sg-ally { --glow: var(--team-ally); } .sg-ally .sg-label { color: var(--team-ally); }
.sg-axis { --glow: var(--team-axis); } .sg-axis .sg-label { color: var(--team-axis); }
.score-divider { font-family: 'Teko'; font-size: 2rem; color: #444; font-weight: 300; transform: skew(-15deg); }

.mvp-section { margin-top: -15px; }
.mvp-container { display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; width: 100%; }

.mvp-op-card {
    width: 170px; min-height: 120px; 
    background: linear-gradient(145deg, rgba(20,20,25,0.9), rgba(10,10,12,0.95));
    border: 1px solid rgba(255,255,255,0.05); border-top: 3px solid var(--role-c);
    border-radius: 6px; padding: 12px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    position: relative; overflow: hidden; transition: all 0.4s ease;
    opacity: 0; animation: slideUp 0.6s ease forwards;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}
.mvp-op-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.6), 0 0 20px var(--role-c-dim);
    background: linear-gradient(145deg, rgba(30,30,35,0.95), rgba(15,15,18,1));
}

.op-icon-circle {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,0.05); display: flex; align-items: center; justify-content: center;
    margin-bottom: 8px; color: var(--role-c); font-size: 1rem;
    border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 0 15px var(--role-c-dim);
}
.op-label { font-family: 'Teko'; color: #888; letter-spacing: 1px; font-size: 0.9rem; font-weight: 300; }
.op-name { 
    font-family: 'Chakra Petch'; font-weight: 500; color: #fff; font-size: 0.95rem; 
    margin: 2px 0 5px 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.op-val { font-family: 'Rajdhani'; font-weight: 600; font-size: 1.3rem; color: #fff; line-height: 1; }

.data-grid-layout {
    display: grid; grid-template-columns: 320px 1fr; gap: 25px;
    opacity: 0; animation: fadeIn 0.8s ease 0.6s forwards;
    align-items: start; 
}

.glass-panel {
    background: rgba(12, 12, 14, 0.85); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px; padding: 20px; backdrop-filter: blur(10px);
}
.panel-head {
    display: flex; align-items: center; gap: 8px; margin-bottom: 15px; padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-family: 'Chakra Petch'; font-size: 1rem; color: #fff; font-weight: 500;
}
.panel-head i { color: var(--primary); }

.w-row { display: flex; flex-direction: column; margin-bottom: 12px; }
.w-info { display: flex; justify-content: space-between; font-family: 'Rajdhani'; font-weight: 500; color: #ccc; font-size: 0.85rem; margin-bottom: 4px; }
.w-track { width: 100%; height: 5px; background: rgba(255,255,255,0.05); border-radius: 3px; overflow: hidden; }
.w-progress { height: 100%; background: var(--primary); width: 0; transition: width 1s ease 0.5s; box-shadow: 0 0 10px var(--primary-dim); }

.left-col-stack { display: flex; flex-direction: column; gap: 20px; }
.left-stats-container { display: flex; flex-direction: column; gap: 15px; opacity: 0; animation: fadeIn 0.8s ease 0.8s forwards; }

.mini-stat-card {
    background: rgba(12, 12, 14, 0.6); border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px; padding: 15px; display: flex; flex-direction: column;
    transition: 0.3s;
}
.mini-stat-card:hover { background: rgba(20, 20, 25, 0.9); border-color: rgba(255,255,255,0.15); transform: translateY(-3px); }
.msc-head {
    font-family: 'Teko'; font-size: 1.1rem; color: #888; border-bottom: 1px solid rgba(255,255,255,0.05); font-weight: 300;
    padding-bottom: 6px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; letter-spacing: 1px;
}
.msc-head i { color: var(--icon-c); }
.msc-list { display: flex; flex-direction: column; gap: 5px; }
.msc-row { display: flex; justify-content: space-between; font-family: 'Rajdhani'; font-size: 0.9rem; color: #ccc; padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,0.02); }
.msc-row:last-child { border: none; }
.msc-row span:first-child { color: #fff; font-weight: 500; }
.msc-row span:last-child { color: var(--val-c); font-weight: 500; }

.knife-list-group { display: flex; flex-direction: column; gap: 10px; }
.kl-sub { font-size: 0.8rem; color: #666; font-family:'Teko'; border-bottom:1px solid #222; margin-bottom:2px; font-weight: 300;}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
}

.custom-table { width: 100%; border-collapse: separate; border-spacing: 0 4px; }
.custom-table th, .custom-table td { white-space: nowrap; }

.custom-table th {
    text-align: left; padding: 8px 12px; font-family: 'Teko'; font-size: 1rem; font-weight: 400;
    letter-spacing: 1px; color: #666; border-bottom: 1px solid rgba(255,255,255,0.1); cursor: pointer;
    transition: color 0.3s;
}
.custom-table th:hover { color: var(--primary); }

.custom-table td {
    padding: 8px 12px; background: rgba(255,255,255,0.02);
    font-family: 'Rajdhani'; font-weight: 400; font-size: 0.95rem; color: #ddd; transition: 0.2s;
}
.custom-table td:first-child { border-radius: 4px 0 0 4px; font-weight: 600; color: #777; }
.custom-table td:last-child { border-radius: 0 4px 4px 0; }
.custom-table tr:hover td { background: rgba(255,255,255,0.08); color: #fff; }
.custom-table tr:hover td:first-child { color: var(--primary); }

#tableBody tr { cursor: pointer; }

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); backdrop-filter: blur(15px);
    z-index: 10000; display: flex; justify-content: center; align-items: center;
    padding: 20px; opacity: 0; visibility: hidden; transition: all 0.3s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.player-modal-box {
    max-height: 85vh; background: #0e0e10; border: 1px solid rgba(255,26,26,0.3); border-top: 3px solid var(--primary);
    border-radius: 16px; box-shadow: 0 25px 60px rgba(0,0,0,0.9);
    width: 100%; max-width: 600px; display: flex; flex-direction: column; overflow: hidden;
    transform: translateY(30px) scale(0.95); transition: 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-overlay.active .player-modal-box { transform: translateY(0) scale(1); }

.pm-header {
    padding: 15px 25px; background: linear-gradient(90deg, rgba(255, 26, 26, 0.1) 0%, transparent 100%);
    border-bottom: 1px solid rgba(255, 26, 26, 0.2); display: flex; align-items: center;
}
.pm-name { font-family: 'Black Ops One'; font-size: 1.5rem; color: #fff; text-transform: uppercase; letter-spacing: 1px; text-shadow: 0 0 10px rgba(255,26,26,0.4); }
.pm-score { display: none; margin-left: auto; margin-right: 15px; color: var(--primary); font-family: 'Black Ops One'; font-size: 1.5rem; }
.pm-kd { display: none; margin-right: 15px; color: #2ecc71; font-family: 'Rajdhani'; font-weight: 700; font-size: 1.2rem; }
.pm-close { 
    background: none; border: none; color: #888; font-size: 1.2rem; 
    cursor: pointer; transition: 0.3s; margin-left: auto; 
}
.pm-close:hover { color: #fff; transform: rotate(90deg); }

.pm-body { padding: 20px 25px; overflow-y: auto; }
.pm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px; }
.pm-card { background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); padding: 15px; border-radius: 10px; }
.pm-title { font-family: 'Teko'; font-size: 1.1rem; color: #fff; letter-spacing: 1px; border-left: 3px solid var(--primary); padding-left: 10px; margin-bottom: 12px; background: linear-gradient(90deg, rgba(255, 26, 26, 0.05), transparent); text-transform: uppercase; }
.pm-list { display: flex; flex-direction: column; gap: 5px; }

@keyframes heroEnter { from { opacity: 0; transform: translateY(30px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 1100px) {
    .hero-map-title { font-size: 2rem; }
    .hero-score-wrapper { padding: 10px 20px; gap: 20px; }
    .sg-val { font-size: 2.5rem; }
    .data-grid-layout { grid-template-columns: 1fr; }
    .view-details { padding: 0 20px; }
}

@media (max-width: 900px) {
    .matrix-grid { grid-template-columns: 1fr 1fr; } 
    .pm-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .view-grid-container { 
        padding: 0 10px 100px 10px; 
        width: 100%; 
        display: block;
    }
    
    .matrix-grid { 
        display: grid;
        grid-template-columns: 1fr; 
        gap: 15px;
        margin-bottom: 0; 
    } 

    .pagination-container {
        position: absolute; 
        bottom: 60px; 
        left: 50%; 
        transform: translateX(-50%);
        margin: 0;
        display: flex;
        align-items: center;
        gap: 8px;
        z-index: 25;
    }
    
    .page-dot {
        width: 35px;
        height: 4px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 2px;
        transition: background-color 0.3s ease; 
        transform: none !important; 
        box-shadow: none !important; 
    }
    .page-dot.active { 
        background-color: var(--primary); 
        transform: none !important; 
    }
    .page-dot:hover {
        transform: none !important; 
    }

    .nav-arrow {
        position: absolute;
        top: auto; 
        bottom: 5px; 
        transform: none; 
        width: 40px; 
        height: 40px;
        background: rgba(255, 255, 255, 0.05); 
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 50%;
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 30;
    }
    .na-prev { left: 30%; transform: translateX(-50%); } 
    .na-next { left: 70%; transform: translateX(-50%); } 

    .nav-arrow:hover { transform: translateX(-50%) scale(1); }

    .view-details { padding: 0 10px; width: 100%; box-sizing: border-box; }
    
    .match-hero { height: auto; padding-bottom: 0; display: flex; flex-direction: column; }
    .hero-content {
        position: relative;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-end;
        gap: 15px;
        padding: 15px;
        background: linear-gradient(0deg, rgba(5,5,5,1) 0%, rgba(5,5,5,0.7) 60%, transparent 100%);
    }
    .hero-info { max-width: 100%; }
    .hero-map-title { font-size: 1.5rem; white-space: normal; word-wrap: break-word; }
    
    .hero-score-wrapper {
        align-self: stretch;
        justify-content: space-around;
        padding: 10px;
        gap: 10px;
        margin-top: 5px;
        width: 100%;
        box-sizing: border-box;
    }
    .sg-val { font-size: 1.8rem; }
    .score-divider { font-size: 1.5rem; }
    
    .mvp-container { flex-direction: column; gap: 10px; }
    .mvp-op-card {
        width: 100%; 
        min-height: auto;
        flex-direction: row; 
        align-items: center;
        justify-content: space-between;
        padding: 10px 15px;
    }
    .op-icon-circle { margin-bottom: 0; margin-right: 12px; flex-shrink: 0; }
    .op-label { display: none; } 
    .op-name { margin: 0; text-align: left; flex: 1; font-size: 1.1rem; }
    .op-val { font-size: 1.4rem; margin-left: 10px; }
    
    .data-grid-layout { display: flex; flex-direction: column; gap: 15px; width: 100%; }
    .glass-panel, .mini-stat-card { padding: 12px; width: 100%; box-sizing: border-box; }
    
    .custom-table th, .custom-table td {
        font-size: 0.8rem; 
        padding: 6px 4px; 
    }
    
    .player-modal-box { width: 90%; margin: 0 5%; max-height: 90vh; }
    .pm-header, .pm-body { padding: 15px; }
    .pm-grid { display: flex; flex-direction: column; }
}

@media (max-width: 480px) {
    .custom-table th, .custom-table td { font-size: 0.85rem; padding: 6px 8px; }
}