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

body{
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins',sans-serif;
    position: relative;
    background-color: #121212;
    color: #fff;
    -webkit-font-smoothing: antialiased;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none
}

#mazeCanvas{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none
}

.overlay{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18,18,18,0.7);
    z-index: 1
}

.container{
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 90vw
}

.name{
    font-size: clamp(2rem, 4vw, 5rem);
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 2vh;
    position: relative;
    color: #fff;
    text-transform: uppercase;
    line-height: 1.2
}

.glitch{
    position: relative;
    display: inline-block
}

.glitch::before,
.glitch::after{
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    overflow: hidden;
    clip: rect(0,900px,0,0)
}

.glitch::before{
    animation: glitchTop 2s infinite linear;
    color: #0f0;
    z-index: -1
}

.glitch::after{
    animation: glitchBottom 2s infinite linear;
    color: #00ff00;
    z-index: -2
}

@keyframes glitchTop{
    0%{clip:rect(0,900px,0,0)}
    10%{clip:rect(5px,900px,30px,0);transform:translate(-2px,-2px)}
    20%{clip:rect(10px,900px,40px,0);transform:translate(2px,2px)}
    30%{clip:rect(0,900px,0,0)}
    100%{clip:rect(0,900px,0,0)}
}

@keyframes glitchBottom{
    0%{clip:rect(0,900px,0,0)}
    10%{clip:rect(40px,900px,60px,0);transform:translate(2px,-2px)}
    20%{clip:rect(50px,900px,70px,0);transform:translate(-2px,2px)}
    30%{clip:rect(0,900px,0,0)}
    100%{clip:rect(0,900px,0,0)}
}

.buttons{
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: clamp(0.8rem, 1.5vh, 1.5rem);
    list-style: none
}

.buttons li{
    list-style: none
}

.btn{
    position: relative;
    display: inline-block;
    padding: clamp(0.6rem, 1vh, 1rem) clamp(1rem, 2vw, 2rem);
    color: #00ff00;
    text-decoration: none;
    font-size: clamp(0.8rem, 1.8vh, 0.95rem);
    border: 2px solid #00ff00;
    background-color: transparent;
    transition: all 0.3s ease;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
    white-space: nowrap
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300%;
    height: 300%;
    background: #00ff00;
    transition: all 0.5s ease;
    transform: translate(-50%, -50%) rotate(45deg) scale(0);
    z-index: -1;
}

.btn:hover::before {
    transform: translate(-50%, -50%) rotate(45deg) scale(1);
}

.btn:hover {
    color: #121212;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.4);
}

.stats-popup{
    position: absolute;
    bottom: 2vh;
    left: 2vw;
    background-color: rgba(18,18,18,0.98);
    color: #00ff00;
    padding: 0;
    border: 2px solid #00ff00;
    border-radius: 12px;
    display: none;
    z-index: 3;
    font-size: clamp(0.7rem, 1.2vh, 0.8rem);
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.5);
    backdrop-filter: blur(15px);
    max-width: min(500px, 90vw);
    max-height: 85vh;
    min-width: min(350px, 85vw);
    animation: slideInUp 0.6s ease-out;
    transform-origin: bottom left;
    font-family: 'Courier New', monospace;
    overflow-y: auto;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.2rem 0.6rem;
    border-bottom: 1px solid rgba(0, 255, 0, 0.4);
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.1), rgba(0, 255, 0, 0.05));
    position: sticky;
    top: 0;
    z-index: 10;
}

.stats-header h3 {
    margin: 0;
    font-size: clamp(0.8rem, 1.4vh, 0.95rem);
    color: #00ff00;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.close-btn {
    background: none;
    border: none;
    color: #00ff00;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 50%;
}

.close-btn:hover {
    background: rgba(0, 255, 0, 0.15);
    transform: scale(1.1);
}

#statsContent {
    padding: 0.8rem 1.2rem;
    line-height: 1.6;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.stat-item {
    background: rgba(0, 255, 0, 0.05);
    border: 1px solid rgba(0, 255, 0, 0.2);
    border-radius: 6px;
    padding: 0.6rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: rgba(0, 255, 0, 0.1);
    border-color: rgba(0, 255, 0, 0.4);
}

.stat-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: #00ff00;
    margin-bottom: 0.2rem;
    font-family: 'Courier New', monospace;
}

.stat-label {
    font-size: 0.7rem;
    color: #ccc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-chart {
    padding: 0 1.2rem 1rem;
    min-height: 80px;
}

.chart-section {
    margin-bottom: 1rem;
}

.chart-title {
    font-size: 0.8rem;
    color: #00ff00;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.chart-bar {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.3rem 0;
}

.chart-label {
    width: 70px;
    font-size: 0.7rem;
    color: #ccc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-progress {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin: 0 0.8rem;
    overflow: hidden;
    position: relative;
}

.chart-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff00, #00cc00, #009900);
    transition: width 1.2s ease;
    border-radius: 4px;
    position: relative;
}

.chart-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.chart-value {
    width: 50px;
    text-align: right;
    font-size: 0.7rem;
    color: #00ff00;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.performance-info {
    position: absolute;
    top: 2vh;
    right: 2vw;
    background: rgba(18, 18, 18, 0.9);
    color: #00ff00;
    padding: 0.4rem 0.8rem;
    border: 1px solid rgba(0, 255, 0, 0.3);
    border-radius: 6px;
    font-size: 0.7rem;
    z-index: 3;
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-family: 'Courier New', monospace;
}

.algorithm-info {
    background: rgba(0, 255, 0, 0.05);
    border: 1px solid rgba(0, 255, 0, 0.2);
    border-radius: 6px;
    padding: 0.8rem;
    margin-top: 0.8rem;
    font-size: 0.7rem;
    line-height: 1.5;
}

.algorithm-title {
    color: #00ff00;
    font-weight: bold;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stats-tabs {
    display: flex;
    border-bottom: 1px solid rgba(0, 255, 0, 0.3);
    margin-bottom: 0.8rem;
}

.tab-btn {
    background: none;
    border: none;
    color: #ccc;
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: #00ff00;
    border-bottom-color: #00ff00;
}

.tab-btn:hover {
    color: #00ff00;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.stats-popup p {
    line-height: 1.5;
}

.footer{
    position: absolute;
    bottom: 1vh;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(0.6rem, 1.2vh, 0.75rem);
    color: rgba(255, 255, 255, 0.5);
    z-index: 2;
    text-align: center
}

@media (min-width:1024px){
    .name{
        font-size: 4.5vw
    }
    .btn{
        font-size: 0.95rem;
        padding: 0.8rem 2rem
    }
    .stats-popup{
        font-size: 0.85rem;
        max-width: 600px
    }
}

@media (max-width:768px){
    .name{
        font-size: 6vw;
        margin-bottom: 2vh
    }
    .btn{
        font-size: 0.8rem;
        padding: 0.7rem 1.4rem
    }
    .stats-popup{
        bottom: 1vh;
        left: 1vw;
        right: 1vw;
        font-size: 0.7rem;
        min-width: auto;
        max-width: none;
        max-height: 80vh;
    }
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    .stat-item {
        padding: 0.5rem;
    }
    .stat-value {
        font-size: 0.9rem;
    }
    .stat-label {
        font-size: 0.65rem;
    }
    .tab-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.65rem;
    }
    .chart-label {
        width: 50px;
        font-size: 0.65rem;
    }
    .chart-value {
        width: 40px;
        font-size: 0.65rem;
    }
    .algorithm-info {
        font-size: 0.65rem;
        padding: 0.6rem;
    }
    .footer{
        font-size: 0.6rem;
        bottom: 0.5vh
    }
    .performance-info {
        top: 1vh;
        right: 1vw;
        font-size: 0.65rem;
        padding: 0.3rem 0.6rem
    }
}

@media (max-width:480px){
    .name{
        font-size: 7vw;
        letter-spacing: 0.5px
    }
    .buttons{
        gap: 0.8rem
    }
    .btn{
        font-size: 0.75rem;
        padding: 0.6rem 1.2rem
    }
    .stats-popup{
        font-size: 0.65rem;
        bottom: 0.5vh;
        left: 0.5vw;
        right: 0.5vw;
        max-height: 75vh;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }
    .stat-item {
        padding: 0.4rem;
    }
    .stat-value {
        font-size: 0.8rem;
    }
    .stat-label {
        font-size: 0.6rem;
    }
    .tab-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.6rem;
    }
    .chart-section {
        margin-bottom: 0.8rem;
    }
    .chart-title {
        font-size: 0.7rem;
        margin-bottom: 0.4rem;
    }
    .chart-bar {
        margin-bottom: 0.4rem;
    }
    .chart-label {
        width: 45px;
        font-size: 0.6rem;
    }
    .chart-progress {
        height: 6px;
        margin: 0 0.5rem;
    }
    .chart-value {
        width: 35px;
        font-size: 0.6rem;
    }
    .algorithm-info {
        font-size: 0.6rem;
        padding: 0.5rem;
    }
    .performance-info {
        font-size: 0.6rem;
        padding: 0.25rem 0.5rem;
    }
}

.btn:active {
    transform: scale(0.95);
}

.btn:focus {
    outline: 2px solid #00ff00;
    outline-offset: 2px;
}

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

.stats-popup.show {
    display: block;
}

.btn:hover {
    animation: pulse 2s infinite;
}