* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background:
        radial-gradient(circle at top, #7c3aed 0, #312e81 38%, #0f172a 100%);
    color: #fff;
    min-height: 100vh;
    padding: 20px;
}

.page {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

.card {
    background: rgba(30, 41, 59, 0.92);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 26px;
    padding: 24px;
    box-shadow: 0 22px 70px rgba(0,0,0,0.35);
}

.game-card {
    text-align: center;
}

.badge {
    display: inline-block;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    color: #fef3c7;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 14px;
}

h1 {
    margin: 0 0 8px;
    font-size: 42px;
    text-shadow: 0 4px 0 rgba(0,0,0,0.25);
}

.subtitle {
    color: #e0e7ff;
    line-height: 1.5;
    margin: 0 auto 18px;
    max-width: 760px;
}

.status {
    background: rgba(15,23,42,0.92);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    padding: 14px;
    color: #e0e7ff;
    font-weight: bold;
    margin-bottom: 18px;
}

.maze-wrap {
    background: rgba(15,23,42,0.7);
    border: 4px solid rgba(255,255,255,0.16);
    border-radius: 24px;
    padding: 14px;
    max-width: 760px;
    margin: 0 auto;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.08), 0 20px 60px rgba(0,0,0,0.35);
}

.maze {
    display: grid;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #ede9fe;
    border-radius: 18px;
    overflow: hidden;
}

.cell {
    position: relative;
    background: #ede9fe;
}

.wall {
    background: #312e81;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}

.path {
    background: #f5f3ff;
}

.start {
    background: #dcfce7;
}

.end {
    background: #fee2e2;
}

.player {
    position: absolute;
    inset: 12%;
    border-radius: 50%;
    background: linear-gradient(145deg, #facc15, #f97316);
    box-shadow: 0 6px 14px rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(14px, 2vw, 28px);
    animation: pop .18s ease;
}

.player::after {
    content: "⭐";
}

.exit-flag {
    position: absolute;
    inset: 8%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(14px, 2vw, 28px);
}

.exit-flag::after {
    content: "🚩";
}

@keyframes pop {
    from {
        transform: scale(.82);
    }

    to {
        transform: scale(1);
    }
}

.side h2 {
    margin: 0 0 14px;
    font-size: 26px;
}

.level-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.level-btn {
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 14px;
    padding: 13px 10px;
    font-weight: bold;
    cursor: pointer;
}

.level-btn:hover {
    background: rgba(255,255,255,0.16);
}

.level-btn.active {
    background: #84cc16;
    box-shadow: inset 0 -4px 0 rgba(0,0,0,0.22);
}

.stats-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-box {
    background: #ede9fe;
    color: #312e81;
    border-radius: 18px;
    padding: 16px;
    display: grid;
    gap: 6px;
    box-shadow: inset 0 -4px 0 rgba(0,0,0,0.12);
}

.stat-box span {
    font-size: 14px;
    font-weight: bold;
}

.stat-box strong {
    font-size: 30px;
}

.actions {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.btn {
    display: block;
    border: none;
    text-align: center;
    text-decoration: none;
    background: #ec4899;
    color: #fff;
    padding: 15px;
    border-radius: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: inset 0 -4px 0 rgba(0,0,0,0.22);
}

.btn:hover {
    background: #db2777;
}

.btn-secondary {
    background: rgba(255,255,255,0.12);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.18);
}

.info-box {
    background: rgba(15,23,42,0.66);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 16px;
}

.info-box strong {
    display: block;
    margin-bottom: 8px;
}

.info-box p {
    margin: 0;
    color: #c4b5fd;
    line-height: 1.5;
    font-size: 14px;
}

.mobile-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 220px;
    margin: 0 auto;
}

.move-btn {
    border: none;
    background: #8b5cf6;
    color: #fff;
    border-radius: 16px;
    padding: 18px;
    font-size: 26px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: inset 0 -5px 0 rgba(0,0,0,0.24);
}

.move-btn:hover {
    background: #7c3aed;
}

.move-btn.up {
    grid-column: 2;
}

.move-btn.left {
    grid-column: 1;
}

.move-btn.down {
    grid-column: 2;
}

.move-btn.right {
    grid-column: 3;
}

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

    .side {
        order: -1;
    }
}

@media (max-width: 560px) {
    body {
        padding: 12px;
    }

    .card {
        padding: 18px;
        border-radius: 20px;
    }

    h1 {
        font-size: 32px;
    }

    .level-buttons {
        grid-template-columns: 1fr;
    }

    .maze-wrap {
        padding: 8px;
        border-radius: 18px;
    }

    .maze {
        border-radius: 12px;
    }
}

.maze {
    touch-action: none;
}