:root {
    --npz-panel-bg: var(--surface);
    --npz-panel-border: var(--border);
    --npz-border-color: var(--border);
    --npz-tile-color: var(--surface-strong);
    --npz-blank-color: rgba(0, 0, 0, 0.2);
    --npz-accent-color: var(--blue);
    --npz-accent-hover: #2cd0ff;
    --npz-white: var(--text);
    --npz-dim: var(--text-muted);
    --npz-green: #27c93f;
    --npz-red: var(--text-muted);
    --npz-btn-primary: var(--blue);
    --npz-btn-primary-hover: #2cd0ff;
    --npz-btn-secondary: transparent;
    --npz-btn-secondary-hover: rgba(255, 255, 255, 0.05);
    --npz-btn-accent: var(--blue);
    --npz-btn-accent-hover: #2cd0ff;
    --npz-btn-danger: var(--surface-strong);
    --npz-btn-danger-hover: var(--surface);
}

#npuzzle-app * {
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

#npuzzle-app {
    width: 100%;
    max-width: 940px;
    height: 720px;
    background: var(--npz-panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--npz-panel-border);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    margin: 2rem auto 4rem auto;
    color: var(--npz-white);
}

#npuzzle-app header {
    text-align: center;
    padding: 30px 0 20px;
    transform: none;
    background: transparent;
    border: none;
    position: static;
    display: block;
    height: auto;
}

#npuzzle-app #main-title {
    color: var(--npz-accent-color);
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 0;
}

#npuzzle-app #main-subtitle {
    color: var(--npz-dim);
    font-size: 1rem;
    margin-top: 5px;
}

#npuzzle-app .divider {
    height: 1px;
    background: var(--npz-border-color);
    margin: 20px 60px 0;
}

#npuzzle-app #main-content {
    flex: 1;
    position: relative;
}

#npuzzle-app .screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 30px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(10px);
}

#npuzzle-app .screen.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

#npuzzle-app h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 30px;
    color: var(--npz-white);
}

#npuzzle-app .dim-text { color: var(--npz-dim); }
#npuzzle-app .accent { color: var(--npz-accent-color); }
#npuzzle-app .bold { font-weight: 600; }
#npuzzle-app .mt-2 { margin-top: 10px; }
#npuzzle-app .mt-4 { margin-top: 25px; }
#npuzzle-app .mb-2 { margin-bottom: 10px; }

#npuzzle-app .button-group, #npuzzle-app .button-row, #npuzzle-app .playback-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 460px;
}

#npuzzle-app .button-row, #npuzzle-app .playback-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

#npuzzle-app .playall-layout {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    width: 100%;
    margin-top: 1rem;
}

#npuzzle-app .side-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
}

#npuzzle-app .btn {
    padding: 14px 24px;
    border: 1px solid var(--npz-border-color);
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--npz-white);
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--npz-btn-secondary);
    outline: none;
    clip-path: none;
    text-transform: none;
    letter-spacing: normal;
    font-family: 'Outfit', sans-serif;
}

#npuzzle-app .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

#npuzzle-app .btn:active {
    transform: translateY(0);
}

#npuzzle-app .btn-primary { background: var(--npz-btn-primary); border-color: var(--npz-accent-color); color: #000; }
#npuzzle-app .btn-primary:hover { background: var(--npz-btn-primary-hover); }

#npuzzle-app .btn-secondary:hover { background: var(--npz-btn-secondary-hover); }

#npuzzle-app .btn-accent { background: var(--npz-btn-accent); color: #000; }
#npuzzle-app .btn-accent:hover { background: var(--npz-btn-accent-hover); }

#npuzzle-app .btn-danger { background: var(--npz-btn-danger); border-color: var(--npz-red); }
#npuzzle-app .btn-danger:hover { background: var(--npz-btn-danger-hover); }

#npuzzle-app .board-wrapper {
    background: var(--npz-panel-bg);
    border: 2px solid var(--npz-border-color);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 20px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    display: block;
}

#npuzzle-app .board {
    position: relative;
    background: transparent;
    padding: 0;
    gap: 0;
    border: none;
    display: block;
}

#npuzzle-app .tile {
    position: absolute;
    background: var(--npz-tile-color);
    border-radius: 9px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    color: var(--npz-white);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 4px 8px rgba(0,0,0,0.3);
    transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#npuzzle-app .tile.blank {
    background: var(--npz-blank-color);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
}

#npuzzle-app .spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--npz-border-color);
    border-top: 4px solid var(--npz-accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#npuzzle-app .stats-card {
    background: var(--npz-panel-bg);
    border: 1px solid var(--npz-border-color);
    border-radius: 14px;
    width: 480px;
    padding: 30px;
}

#npuzzle-app .stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

#npuzzle-app .stat-row:last-child { margin-bottom: 0; }
#npuzzle-app .stat-label { color: var(--npz-dim); }
#npuzzle-app .stat-value { font-weight: 700; }

#npuzzle-app .progress-container {
    width: 520px;
    margin: 10px 0;
}

#npuzzle-app .progress-bar {
    width: 100%;
    height: 9px;
    background: var(--npz-border-color);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

#npuzzle-app .progress-fill {
    height: 100%;
    background: var(--npz-accent-color);
    width: 0%;
    transition: width 0.2s ease;
}

#npuzzle-app .progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--npz-dim);
}

#npuzzle-app .fl-boards {
    display: flex;
    align-items: center;
    gap: 40px;
    margin-top: 20px;
}

#npuzzle-app .fl-board-col {
    text-align: center;
}

#npuzzle-app .board-wrapper.mini {
    padding: 8px;
    border-width: 1px;
}

#npuzzle-app .status-text {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--npz-green);
}
#npuzzle-app .status-text.error { color: var(--npz-red); }

/* MOBILE RESPONSIVENESS */
@media (max-width: 768px) {
    #npuzzle-app {
        height: auto;
        min-height: 700px;
        padding-bottom: 2rem;
    }
    #npuzzle-app .screen.active {
        position: relative;
        height: auto;
    }
    #npuzzle-app .playall-layout {
        flex-direction: column;
        gap: 1rem;
    }
    #npuzzle-app .side-controls {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.8rem;
    }
    #npuzzle-app .fl-boards {
        flex-direction: column;
        gap: 1rem;
    }
    #npuzzle-app .screen {
        padding-top: 10px;
    }
    #npuzzle-app .progress-container,
    #npuzzle-app .stats-card {
        width: 90%;
        max-width: 480px;
    }
    #npuzzle-app .button-group {
        width: 85%;
        max-width: 300px;
    }
}
