#game-root {
    --mz-accent: #10B981;
    --mz-accent-dark: #0e9c6f;
    --mz-accent-light: #e3f9ef;
    --mz-accent-border: #a7f3d0;
    --mz-wall: #0e9c6f;
    --mz-visited-dot: #a7f3d0;
    border-radius: var(--kw-radius, 16px);
}

.kwg-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 14px;
}

.mz-wrap {
    max-width: 480px;
    margin: 0 auto;
}

.mz-loading,
.mz-error {
    text-align: center;
    padding: 48px 16px;
}

.mz-loading-icon,
.mz-error-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.mz-loading-icon {
    animation: mz-pulse 1.2s ease-in-out infinite;
}

.mz-loading-text {
    font-size: 15px;
    color: #666;
}

.mz-error-text {
    font-size: 15px;
    font-weight: 700;
    color: #EF4444;
}

.mz-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 18px;
}

.mz-header-icon {
    display: flex;
    font-size: 30px;
    line-height: 1;
}

.mz-header-icon img {
    display: block;
    height: 38px;
    width: auto;
}

.mz-header-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--mz-accent);
}

.mz-levels {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.mz-level-card {
    display: flex;
    flex-direction: column;
    border: none;
    border-radius: var(--kw-radius, 16px);
    background: #fff;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
    transition: transform .15s ease, box-shadow .15s ease;
}

.mz-level-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 18px rgba(0, 0, 0, .14);
}

.mz-level-card:active {
    transform: translateY(-1px);
}

.mz-level-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 88px;
    font-size: 36px;
    background: linear-gradient(135deg, var(--mz-accent-light), var(--mz-accent-border));
    background-size: 88px 88px;
    background-repeat: no-repeat;
    background-position: center;
}

.mz-level-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 10px 16px;
}

.mz-level-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--kw-text, #2D2A32);
    text-align: center;
}

.mz-level-age {
    font-size: 12px;
    font-weight: 700;
    color: var(--mz-accent-dark);
    background: var(--mz-accent-light);
    padding: 2px 10px;
    border-radius: 999px;
}

.mz-level-row {
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.mz-level-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--mz-accent-light);
    color: var(--mz-accent-dark);
    border-radius: 999px;
    padding: 5px 12px;
    font-weight: 700;
    font-size: 12px;
}

.mz-level-pill-icon {
    display: inline-flex;
    line-height: 1;
}

.mz-level-pill-icon img {
    display: block;
    width: 14px;
    height: 14px;
    object-fit: cover;
    border-radius: 50%;
}

.mz-change-level-btn {
    border: none;
    background: none;
    color: var(--mz-accent-dark);
    text-decoration: underline;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    padding: 4px;
}

.mz-change-level-btn:hover {
    color: var(--mz-accent);
}

.mz-progress {
    height: 8px;
    border-radius: 999px;
    background: var(--mz-accent-light);
    overflow: hidden;
    margin-bottom: 12px;
}

.mz-progress-fill {
    height: 100%;
    width: 0;
    background: var(--mz-accent);
    border-radius: 999px;
    transition: width .3s ease;
}

.mz-stat-row {
    justify-content: center;
    margin-bottom: 14px;
}

.mz-stat {
    background: var(--mz-accent-light);
    color: var(--mz-accent-dark);
    border-radius: 999px;
    padding: 6px 14px;
    font-weight: 700;
    font-size: 14px;
}

.mz-hint-row {
    justify-content: center;
    margin-bottom: 0px;
}

.mz-hint-btn {
    border: none;
    background: var(--mz-accent-light);
    color: var(--mz-accent-dark);
    border-radius: 999px;
    padding: 8px 16px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: transform .1s ease, background .15s ease;
}

.mz-hint-btn:hover:not(:disabled) {
    background: var(--mz-accent-border);
    transform: translateY(-1px);
}

.mz-hint-btn:disabled {
    opacity: .45;
    cursor: default;
}

.mz-board-wrap {
    position: relative;
    max-width: 480px;
    margin: 0 auto;
}

.mz-board {
    display: grid;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #fff;
    border: 2px solid var(--mz-wall);
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .07);
    animation: mz-fade-in .25s ease;
}

.mz-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border-width: 2px;
    border-color: var(--mz-wall);
    line-height: 1;
}

.mz-cell-player {
    background: var(--mz-accent-light);
}

.mz-cell-goal {
    background: #FEF3C7;
}

.mz-cell-visited {
    background: radial-gradient(circle, var(--mz-visited-dot) 18%, transparent 20%);
}

.mz-cell-clickable {
    cursor: pointer;
}

.mz-cell-clickable:hover {
    box-shadow: inset 0 0 0 2px var(--mz-accent);
}

.mz-cell-hint {
    background: radial-gradient(circle, var(--mz-visited-dot) 18%, transparent 20%);
    background-repeat: no-repeat;
    background-position: center;
    animation: mz-hint-glow 1s ease-in-out infinite;
}

.mz-board.mz-bump {
    animation: mz-shake .2s ease;
}

.mz-toast {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, .75);
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    padding: 14px 22px;
    border-radius: 14px;
    animation: mz-toast-pop .3s ease;
    pointer-events: none;
    white-space: nowrap;
    z-index: 2;
}

.mz-dpad {
    display: grid;
    grid-template-areas:
        ".    up    ."
        "left .     right"
        ".    down  .";
    grid-template-columns: repeat(3, 56px);
    grid-template-rows: repeat(3, 56px);
    gap: 5px;
    justify-content: center;
    margin: 20px auto;
}

.mz-dpad-up { grid-area: up; }
.mz-dpad-down { grid-area: down; }
.mz-dpad-left { grid-area: left; }
.mz-dpad-right { grid-area: right; }

.mz-dpad-btn {
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--mz-accent), var(--mz-accent-dark));
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 3px 0 rgba(0, 0, 0, .12);
    transition: transform .1s ease, box-shadow .1s ease;
}

.mz-dpad-btn:hover {
    transform: translateY(-1px);
}

.mz-dpad-btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

.mz-done-card {
    text-align: center;
    background: #fff;
    border-radius: var(--kw-radius, 16px);
    padding: 32px 20px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .07);
    animation: mz-pop .3s ease;
}

.mz-done-emoji {
    font-size: 56px;
    margin-bottom: 8px;
}

.mz-done-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--mz-accent-dark);
    margin-bottom: 6px;
}

.mz-done-score {
    font-size: 16px;
    font-weight: 600;
    color: #555;
    margin-bottom: 10px;
}

.mz-done-stars {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    font-size: 24px;
}

.mz-done-share {
    justify-content: center;
    margin-top: 16px;
}

.mz-done-actions {
    justify-content: center;
    margin-top: 20px;
}

.mz-btn-primary,
.mz-btn-secondary {
    border: none;
    padding: 12px 22px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    transition: transform .1s ease;
}

.mz-btn-primary {
    background: var(--mz-accent);
    color: #fff;
    box-shadow: 0 3px 0 var(--mz-accent-dark);
}

.mz-btn-primary:hover {
    transform: translateY(-1px);
}

.mz-btn-secondary {
    background: var(--mz-accent-light);
    color: var(--mz-accent-dark);
}

.mz-btn-secondary:hover {
    background: var(--mz-accent-border);
}

@keyframes mz-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes mz-pop {
    0% { transform: scale(.85); }
    100% { transform: scale(1); }
}

@keyframes mz-toast-pop {
    0% { transform: translate(-50%, -50%) scale(.85); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes mz-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-3px); }
}

@keyframes mz-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: .7; }
}

@keyframes mz-hint-glow {
    0%, 100% { background-size: 60% 60%; }
    50% { background-size: 140% 140%; }
}

@media (max-width: 380px) {
    .mz-levels {
        grid-template-columns: 1fr;
    }

    .mz-dpad {
        grid-template-columns: repeat(3, 48px);
        grid-template-rows: repeat(3, 48px);
    }
}
